:root {
  --bg: #f3f3f8; --surface: #fff; --ink: #17181d; --muted: #8d8e98; --line: #ececf2;
  --accent: #4757ee; --accent-hover: #3949dc; --accent-soft: #eef0ff;
  --success: #21a963; --success-soft: #eaf9f0; --danger: #e4515a; --danger-soft: #fff0f1;
  --shadow: 0 10px 32px rgba(46, 48, 74, .055);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; font-family: inherit; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
.app-shell { display: flex; min-height: 100vh; padding: 22px; gap: 22px; }
.sidebar { position: sticky; top: 22px; width: 248px; height: calc(100vh - 44px); flex: 0 0 248px; display: flex; flex-direction: column; padding: 24px 18px 20px; overflow: hidden; background: var(--surface); border: 1px solid rgba(232,232,240,.7); border-radius: 28px; box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; margin: 4px 12px 42px; color: var(--ink); font-size: 17px; font-weight: 750; letter-spacing: -.02em; }
.brand-mark { width: 35px; height: 35px; display: grid; place-items: center; border: 2px solid var(--accent); border-radius: 11px; color: var(--accent); font-weight: 850; }
.nav-section { margin: 0 12px 10px; color: #a2a2aa; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.nav { display: grid; gap: 7px; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 10px 14px; border-radius: 14px; color: #7d7e88; font-weight: 550; transition: color .18s ease, background .18s ease; }
.nav-link:hover { color: var(--accent); background: var(--accent-soft); }
.nav-link.is-active { color: #fff; background: var(--accent); box-shadow: 0 9px 20px rgba(71,87,238,.22); }
.nav-icon { width: 22px; height: 22px; display: grid; place-items: center; flex: 0 0 auto; font-size: 20px; line-height: 1; }
.sidebar-footer { margin-top: auto; padding: 17px 12px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.logout { display: block; padding: 0; border: 0; background: none; color: var(--accent); cursor: pointer; font-weight: 700; }
.main-content { width: min(1500px, calc(100% - 270px)); padding: 6px 0 0; margin: 0 auto; }
.topbar { display: flex; align-items: center; min-height: 66px; margin-bottom: 20px; }
h1, h2, p { margin-top: 0; } h1 { margin-bottom: 0; font-size: clamp(25px,2.2vw,32px); line-height: 1.16; letter-spacing: -.04em; } h2 { margin-bottom: 0; font-size: 18px; letter-spacing: -.025em; }
.eyebrow { margin-bottom: 5px; color: var(--muted); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; font-weight: 750; }
.env-badge, .pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 10px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700; white-space: nowrap; }
.metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.metric-card, .panel { background: var(--surface); border: 1px solid rgba(232,232,240,.85); border-radius: 22px; box-shadow: var(--shadow); }
.metric-card { position: relative; min-height: 154px; display: grid; align-content: space-between; gap: 8px; padding: 20px; overflow: hidden; }
.metric-card::after { content: ""; position: absolute; top: 19px; right: 19px; width: 39px; height: 39px; border-radius: 14px; background: var(--accent-soft); }
.metric-card:nth-child(-n+3)::after { display: none; }
.metric-card:nth-child(-n+3) > span:first-child { max-width: 100%; }
.metric-card:nth-child(2)::after { background: #fff0f1; } .metric-card:nth-child(3)::after { background: #ebfaf1; } .metric-card:nth-child(4)::after { background: #fff3ea; }
.metric-card > span:first-child { max-width: calc(100% - 50px); color: var(--muted); font-size: 13px; }
.metric-card strong { font-size: clamp(28px,2.5vw,38px); line-height: 1; letter-spacing: -.05em; }
.metric-card a, .text-link, .table-link, .back-link { color: var(--accent); font-weight: 700; font-size: 12px; }
.metric-card a:hover, .text-link:hover, .table-link:hover, .back-link:hover { color: var(--accent-hover); }
.metric-warn strong { color: var(--danger); }
.connection-strip { display: flex; align-items: center; gap: 20px 34px; flex-wrap: wrap; padding: 17px 20px; margin-bottom: 18px; background: linear-gradient(110deg,#21243d,#303553); color: #fff; border-radius: 19px; box-shadow: var(--shadow); }
.connection-strip > div { display: grid; gap: 2px; } .connection-strip .eyebrow { color: #aeb6dc; margin: 0; } .connection-strip .muted { color: #c2c6d8; } .connection-strip .text-link { margin-left: auto; color: #cbd0ff; } .text-success { color: #66dda0; }
.oauth-panel { border-color: rgba(71,87,238,.16); background: linear-gradient(135deg,#fff 0%,#fafaff 100%); }
.oauth-summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.oauth-summary > div { display: grid; gap: 4px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.72); }
.oauth-summary span { color: var(--muted); font-size: 11px; }
.oauth-summary strong { font-size: 14px; }
.oauth-not-configured { padding: 16px; border: 1px dashed #d9dbea; border-radius: 14px; background: #fafaff; }
.oauth-not-configured p { margin-bottom: 6px; color: #555866; }
.oauth-error-note { padding: 12px 14px; margin-top: 14px; border-radius: 11px; background: var(--danger-soft); color: var(--danger); }
.oauth-actions form { display: inline-flex; }
.button-danger { background: var(--danger-soft); color: var(--danger); }
.button-danger:hover { background: #ffe2e4; }
.content-grid, .detail-grid { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(330px,.8fr); gap: 18px; margin-bottom: 18px; }
.content-grid > .panel { height: 100%; margin-bottom: 0; }
.panel { padding: 22px; margin-bottom: 18px; overflow: hidden; } .panel:last-child { margin-bottom: 0; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 20px; } .panel-heading .eyebrow { margin-bottom: 3px; }
.table-wrap { margin: 0 -22px -22px; overflow: auto; } table { width: 100%; min-width: 680px; border-collapse: collapse; text-align: left; }
.content-grid > .panel:first-child table { min-width: 560px; }
.content-grid > .panel:first-child th, .content-grid > .panel:first-child td { padding-left: 15px; padding-right: 15px; }
th { color: #a0a1aa; font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .065em; white-space: nowrap; }
th, td { padding: 13px 22px; border-top: 1px solid var(--line); vertical-align: top; } td { color: #565864; } td strong { display: block; color: var(--ink); } td small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; } tbody tr { transition: background .15s ease; } tbody tr:hover { background: #fafafe; }
.pill::before { content: ""; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: currentColor; }
.pill-success { background: var(--success-soft); color: var(--success); } .pill-error { background: var(--danger-soft); color: var(--danger); } .pill-muted { background: #f1f2f6; color: #777a87; }
.timeline { display: grid; } .timeline-item { display: flex; align-items: center; gap: 11px; padding: 13px 0; border-top: 1px solid var(--line); } .timeline-item:first-child { border-top: 0; padding-top: 0; } .timeline-item div { flex: 1; min-width: 0; } .timeline-item p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.run-status { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: #adb8c9; } .run-success { background: #35b77a; } .run-failed { background: #e06767; } .run-running { background: #e4a33f; }
.empty-state { padding: 34px 12px 16px; color: var(--muted); text-align: center; } .muted { color: var(--muted); }
.filter-bar { display: flex; flex-wrap: wrap; gap: 9px; padding-bottom: 20px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
input, select { width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid #dedfe7; border-radius: 11px; background: #fff; color: var(--ink); outline: none; }
select { appearance: none; -webkit-appearance: none; padding-right: 42px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%237b7d88' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 15px center; background-size: 12px 8px; }
.filter-bar input { flex: 1 1 220px; } .filter-bar select { flex: 0 1 185px; } input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(71,87,238,.1); }
.button { min-height: 42px; padding: 10px 17px; border: 0; border-radius: 11px; cursor: pointer; font-weight: 750; transition: background .18s ease; }
.button-primary { background: var(--accent); color: #fff; box-shadow: 0 8px 18px rgba(71,87,238,.2); } .button-primary:hover { background: var(--accent-hover); } .button-secondary { background: #eff0f5; color: #4f5260; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 24px; padding-top: 20px; color: var(--muted); font-size: 12px; } .pagination a { color: var(--accent); font-weight: 700; }
.panel > .pagination { margin: 22px -22px -22px; padding: 18px 22px; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; } label { display: grid; gap: 7px; color: #5c5f6d; font-size: 12px; font-weight: 700; }
.settings-fields { grid-template-columns: repeat(3,minmax(0,1fr)); }
.field-hint { color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.45; }
.checkbox-label { display: flex; align-items: center; gap: 9px; margin-top: 20px; } .checkbox-label input { width: 17px; min-height: auto; accent-color: var(--accent); } .form-actions { display: flex; align-items: center; gap: 14px; margin-top: 24px; }
.type-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; } .type-item { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 13px; }
.editable-table-wrap { margin-bottom: 0; }
.editable-table { min-width: 720px; }
.editable-table input, .editable-table select { min-height: 38px; }
.period-control { display: grid; grid-template-columns: 88px minmax(120px,1fr); gap: 8px; }
.datetime-input { min-width: 210px; }
.switch { position: relative; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { position: absolute; width: 1px; height: 1px; min-height: 0; opacity: 0; }
.switch-track { width: 38px; height: 22px; display: flex; align-items: center; padding: 3px; border-radius: 999px; background: #dfe1e8; transition: background .18s ease; }
.switch-track span { width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(34,35,45,.2); transition: margin-left .18s ease; }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track span { margin-left: 16px; }
.switch input:focus-visible + .switch-track { outline: 3px solid rgba(71,87,238,.18); outline-offset: 2px; }
.switch-label { color: #666875; font-size: 11px; font-weight: 600; }
.switch-label-on { display: none; }
.switch input:checked ~ .switch-label-on { display: inline; }
.switch input:checked ~ .switch-label-off { display: none; }
.type-code, .mono { font-family: ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; font-size: 11px; } .box-chip { display: inline-block; margin: 2px; padding: 4px 7px; border-radius: 7px; background: var(--accent-soft); color: #5962a0; font-size: 11px; } .box-chip.is-disabled { opacity: .5; }
.details { display: grid; grid-template-columns: 155px 1fr; gap: 13px 16px; margin: 0; } .details dt { color: var(--muted); font-size: 12px; } .details dd { margin: 0; overflow-wrap: anywhere; color: #4f5260; }
.state-list { display: grid; } .state-list div { display: flex; justify-content: space-between; gap: 20px; padding: 13px 0; border-top: 1px solid var(--line); } .state-list div:first-child { padding-top: 0; border-top: 0; } .state-list span { color: var(--muted); } .state-list strong { text-align: right; }
.back-link { display: inline-flex; margin-bottom: 15px; } .alert { padding: 13px 15px; margin-bottom: 18px; border-radius: 12px; } .alert-error { background: var(--danger-soft); color: var(--danger); } .alert-success { background: var(--success-soft); color: var(--success); } .alert-warning { background: #fff6db; color: #8a5a00; } .panel-note { padding: 12px 14px; margin: 0 0 18px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); } .documents-run-summary { display: grid; gap: 8px; margin: 0 0 18px; } .documents-run-summary .panel-note { margin: 0; padding: 8px 12px; } .text-error { color: var(--danger); } .manual-sync-details { margin: 0 0 18px; } .manual-sync-details summary { display: inline-flex; list-style: none; margin-bottom: 12px; } .manual-sync-details summary::-webkit-details-marker { display: none; } .manual-sync-note { margin: 0 0 12px; } .manual-sync-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 0; align-items: end; } .manual-sync-form label { min-width: 0; } .manual-sync-form .button { width: 100%; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 20% 20%,#e9ebff,transparent 36%),var(--bg); } .login-card { width: min(430px,100%); padding: 36px; background: #fff; border: 1px solid var(--line); border-radius: 26px; box-shadow: 0 24px 70px rgba(45,48,80,.12); } .login-brand { margin: 0 0 44px; } .login-card h1 { margin-bottom: 8px; font-size: 27px; } .stack-form { display: grid; gap: 16px; margin-top: 24px; }
@media (max-width: 1080px) {
  .app-shell { padding: 14px; gap: 14px; } .sidebar { top: 14px; width: 212px; height: calc(100vh - 28px); flex-basis: 212px; padding-inline: 13px; } .main-content { width: min(100%,calc(100% - 226px)); }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } .content-grid, .detail-grid { grid-template-columns: 1fr; } .settings-fields { grid-template-columns: repeat(2,minmax(0,1fr)); } .manual-sync-form { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 700px) {
  .app-shell { display: block; padding: 0; } .sidebar { position: static; width: 100%; height: auto; padding: 14px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; }
  .brand { margin: 0 4px 13px; } .nav-section, .sidebar-footer { display: none; } .nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; } .nav::-webkit-scrollbar { display: none; }
  .nav-link { min-height: 40px; padding: 8px 11px; white-space: nowrap; } .nav-icon { width: 18px; height: 18px; font-size: 17px; } .main-content { width: 100%; padding: 20px 14px 40px; }
  .topbar { align-items: flex-start; margin-bottom: 18px; }
  .metric-grid, .form-grid, .type-grid, .manual-sync-form { grid-template-columns: 1fr; } .metric-card { min-height: 132px; } .panel { padding: 17px; border-radius: 17px; } .table-wrap { margin: 0 -17px -17px; } th, td { padding-left: 17px; padding-right: 17px; }
  .connection-strip .text-link { width: 100%; margin-left: 0; } .details { grid-template-columns: 1fr; gap: 4px; } .details dd { margin-bottom: 10px; } .type-item { grid-template-columns: 1fr auto; } .type-item .type-code { grid-column: 1/-1; }
  .oauth-summary { grid-template-columns: 1fr; }
}
