:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #172033;
  --muted: #667085;
  --border: #e1e6ee;
  --primary: #6f3bf5;
  --primary-dark: #5825db;
  --success: #087a55;
  --success-bg: #e8f7f1;
  --danger: #b42318;
  --danger-bg: #fff0ee;
  --warning: #945d00;
  --warning-bg: #fff7df;
  --neutral-bg: #eef1f5;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 18px rgba(16,24,40,.04);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.45; }
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar { min-height: 68px; background: #161b26; color: #fff; display: flex; align-items: center; padding: 0 28px; gap: 32px; position: sticky; top: 0; z-index: 30; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.brand { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand a { color: #fff; font-weight: 750; font-size: 18px; text-decoration: none; }
.version { color: #98a2b3; font-size: 12px; }
.nav { display: flex; gap: 6px; flex: 1; }
.nav a { color: #c7cdd8; padding: 9px 12px; border-radius: 8px; text-decoration: none; font-size: 14px; }
.nav a:hover, .nav a.active { color: #fff; background: rgba(255,255,255,.1); }
.logout-form { display: flex; align-items: center; gap: 12px; }
.user-name { color: #d0d5dd; font-size: 14px; }
.container { max-width: 1460px; margin: 0 auto; padding: 32px 28px 60px; min-height: calc(100vh - 125px); }
.footer { max-width: 1460px; margin: 0 auto; padding: 20px 28px 35px; color: var(--muted); display: flex; justify-content: space-between; font-size: 12px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 24px; }
h1, h2, h3 { margin-top: 0; line-height: 1.2; }
h1 { font-size: 30px; margin-bottom: 7px; letter-spacing: -.02em; }
h2 { font-size: 19px; margin-bottom: 4px; }
h3 { font-size: 16px; margin-bottom: 8px; }
p { margin-top: 0; }
.muted { color: var(--muted); }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.button { appearance: none; border: 1px solid transparent; border-radius: 8px; padding: 10px 15px; font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none !important; line-height: 1.15; }
.button:disabled { opacity: .48; cursor: not-allowed; }
.button.primary { background: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-dark); }
.button.secondary { background: #fff; border-color: #ccd3de; color: #344054; }
.button.secondary:hover, .button.ghost:hover { background: #f1f3f6; }
.button.ghost { background: transparent; border-color: #667085; color: inherit; }
.button.danger { background: var(--danger); color: #fff; }
.button.small { padding: 7px 10px; font-size: 12px; }
.button.wide { width: 100%; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 22px; margin-bottom: 22px; }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.card-header p { margin-bottom: 0; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.metric-card { background: var(--card); border: 1px solid var(--border); border-radius: 11px; box-shadow: var(--shadow); padding: 18px 20px; }
.metric-card span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 7px; }
.metric-card strong { font-size: 27px; }
.danger-text { color: var(--danger); }
.table-wrap { overflow-x: auto; margin: 0 -22px -22px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { color: var(--muted); background: #fafbfc; font-size: 12px; letter-spacing: .02em; text-transform: uppercase; text-align: left; padding: 11px 16px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfcfd; }
td small { display: block; color: var(--muted); margin-top: 3px; }
.align-right { text-align: right; }
.empty { text-align: center; color: var(--muted); padding: 32px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #f1f3f6; border-radius: 5px; padding: 2px 5px; font-size: .9em; overflow-wrap: anywhere; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 8px; font-weight: 650; font-size: 11px; text-transform: capitalize; white-space: nowrap; }
.badge.success { background: var(--success-bg); color: var(--success); }
.badge.error { background: var(--danger-bg); color: var(--danger); }
.badge.running { background: #eee8ff; color: #5b31c7; }
.badge.neutral { background: var(--neutral-bg); color: #475467; }
.badge.large { padding: 7px 11px; font-size: 13px; }
.alert { border-radius: 9px; padding: 12px 14px; margin-bottom: 20px; border: 1px solid; font-size: 14px; }
.alert.info { background: #eef5ff; border-color: #c8dcff; color: #1849a9; }
.alert.success { background: var(--success-bg); border-color: #b8e4d3; color: var(--success); }
.alert.error { background: var(--danger-bg); border-color: #f3c2bd; color: var(--danger); }
.alert.warning { background: var(--warning-bg); border-color: #edd79b; color: var(--warning); }
.two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; align-items: start; }
.two-column.uneven { grid-template-columns: minmax(0, 1.5fr) minmax(280px, .7fr); }
.details { margin: 0 0 18px; }
.details > div { display: grid; grid-template-columns: minmax(110px, .7fr) minmax(0, 1.8fr); padding: 9px 0; border-bottom: 1px solid var(--border); gap: 12px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; overflow-wrap: anywhere; }
.small-details { margin-top: 18px; }
.notice-card { border-left: 4px solid var(--primary); }
.form-stack { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #344054; font-weight: 600; }
input, select, textarea { width: 100%; border: 1px solid #cfd6e1; border-radius: 8px; padding: 10px 11px; font: inherit; color: var(--text); background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(111,59,245,.17); border-color: var(--primary); }
.check-row { flex-direction: row; align-items: center; gap: 9px; grid-column: 1 / -1; }
.check-row input { width: auto; }
.inline-form { display: flex; gap: 12px; align-items: end; }
.inline-form .grow { flex: 1; }
.search-form { margin-bottom: 16px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }
.compact-top { margin-top: 10px; }
.breadcrumbs { color: var(--muted); display: flex; gap: 8px; margin-bottom: 16px; font-size: 13px; }
.field-header { align-items: center; }
.field-search { width: 260px; }
.field-list { border: 1px solid var(--border); border-radius: 9px; max-height: 680px; overflow: auto; }
.field-row { display: grid; grid-template-columns: 24px minmax(240px, 1.2fr) minmax(240px, 1fr); gap: 12px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); font-weight: 400; cursor: pointer; }
.field-row:last-child { border-bottom: 0; }
.field-row:hover { background: #fafbfc; }
.field-row input { width: auto; }
.field-main { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.field-main strong { font-size: 13px; }
.field-meta { display: flex; justify-content: flex-end; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; text-align: right; }
.sticky-save { position: sticky; bottom: 0; display: flex; justify-content: flex-end; padding-top: 16px; background: linear-gradient(transparent, #fff 35%); }
.info-panel p { color: #475467; font-size: 14px; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; border-color: #f0c7c3; }
.error-panel { border-left: 4px solid var(--danger); }
pre { white-space: pre-wrap; overflow-wrap: anywhere; background: #161b26; color: #f7f7f8; border-radius: 8px; padding: 16px; overflow: auto; }
.login-shell { min-height: calc(100vh - 220px); display: grid; place-items: center; }
.login-card { width: min(420px, 100%); background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 32px; box-shadow: var(--shadow); }
.login-mark { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: #eee8ff; color: var(--primary); font-size: 26px; font-weight: 700; margin-bottom: 18px; }
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; padding: 14px 18px; gap: 10px 20px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .container { padding: 24px 16px 50px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-column, .two-column.uneven { grid-template-columns: 1fr; }
  .page-heading, .danger-zone { flex-direction: column; }
  .field-row { grid-template-columns: 24px 1fr; }
  .field-meta { grid-column: 2; justify-content: flex-start; text-align: left; }
}
@media (max-width: 560px) {
  .metric-grid, .form-grid { grid-template-columns: 1fr; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .actions { width: 100%; }
  .actions .button, .actions form { flex: 1; }
  .field-header { flex-direction: column; }
  .field-search { width: 100%; }
  .footer { flex-direction: column; gap: 6px; }
}
