:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --sidebar: #ffffff;
  --ink: #1f2937;
  --muted: #7a8797;
  --line: #e6ebf1;
  --accent: #2878ed;
  --accent-dark: #1c62cf;
  --accent-soft: #eaf2ff;
  --success: #21a46b;
  --warning: #db9428;
  --danger: #e35f6b;
  --shadow: 0 6px 24px rgba(22, 42, 70, .05);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 "Segoe UI", "Microsoft YaHei", sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 24%, transparent); outline-offset: 2px; }
.is-hidden { display: none !important; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 264px; background: var(--sidebar); border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 20; transition: width .2s ease, transform .2s ease; }
.sidebar.collapsed { width: 78px; }
.brand { height: 76px; display: flex; align-items: center; gap: 12px; padding: 0 28px; border-bottom: 1px solid #f0f3f7; white-space: nowrap; overflow: hidden; }
.brand-logo { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: #eaf2ff; color: var(--accent); border: 1px solid #d7e6ff; font-size: 13px; font-weight: 800; }
.brand-copy strong, .brand-copy span { display: block; }
.brand-copy strong { font-size: 16px; letter-spacing: .1px; }
.brand-copy span { color: var(--muted); font-size: 12px; margin-top: 1px; }
.sidebar-nav { display: grid; gap: 4px; padding: 22px 14px; }
.nav-item { border: 0; background: transparent; color: #536171; border-radius: 8px; min-height: 44px; display: flex; align-items: center; gap: 12px; padding: 0 16px; text-align: left; transition: background .15s, color .15s; }
.nav-item:hover { background: #f3f7fc; color: var(--accent); }
.nav-item.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-icon { width: 20px; text-align: center; font-size: 19px; line-height: 1; color: currentColor; }
.sidebar-bottom { margin-top: auto; padding: 18px 28px 25px; color: #8591a1; font-size: 12px; white-space: nowrap; overflow: hidden; }
.sidebar-bottom small { display: block; margin: 5px 0 0 16px; color: #a0a9b5; }
.online-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--success); margin-right: 8px; box-shadow: 0 0 0 3px #e2f7ee; }

.main { min-height: 100vh; margin-left: 264px; padding: 0 36px 60px; transition: margin-left .2s ease; }
.main.sidebar-collapsed { margin-left: 78px; }
.main.login-mode { margin-left: 0; padding: 0; display: grid; place-items: center; }
.topbar { height: 76px; margin: 0 -36px 36px; padding: 0 36px; display: flex; align-items: center; justify-content: space-between; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-left, .topbar-right, .breadcrumbs, .heading-actions { display: flex; align-items: center; }
.topbar-left { gap: 22px; }
.topbar-right { gap: 18px; }
.breadcrumbs { gap: 10px; color: #9aa5b4; font-size: 13px; }
.breadcrumbs i { font-style: normal; color: #c4cbd5; }
.breadcrumbs strong { color: var(--ink); font-weight: 600; }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: #5f6c7b; display: inline-grid; place-items: center; padding: 0; }
.icon-button:hover { border-color: #c6d6ed; color: var(--accent); background: #f8fbff; }
.top-action { border: 0; background: transparent; color: #637083; padding: 7px 0; }
.top-action:hover { color: var(--accent); }
.user-chip { display: inline-flex; align-items: center; gap: 8px; color: #4d5a6b; }
.user-avatar { width: 27px; height: 27px; border-radius: 50%; background: #e8f0fd; color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 12px; }

.workspace { max-width: 1640px; margin: 0 auto; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 22px; margin-bottom: 27px; }
.eyebrow { color: var(--accent); font-size: 11px; letter-spacing: 1.25px; font-weight: 700; }
h1, h2, h3, p { margin: 0; }
.page-heading h1 { margin-top: 5px; font-size: 29px; line-height: 1.25; letter-spacing: 0; }
.page-heading p { color: var(--muted); margin-top: 8px; }
.heading-actions { gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.button { min-height: 38px; border-radius: 7px; border: 1px solid transparent; padding: 0 15px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 600; line-height: 1; transition: background .15s, border-color .15s, color .15s, box-shadow .15s; }
.button-primary { background: var(--accent); color: #fff; box-shadow: 0 3px 10px rgba(40, 120, 237, .18); }
.button-primary:hover { background: var(--accent-dark); }
.button-light { background: var(--surface); color: #536171; border-color: var(--line); }
.button-light:hover { color: var(--accent); border-color: #bcd2f2; background: #fbfdff; }
.button-danger { background: #fff4f5; color: var(--danger); border-color: #ffd7dc; }
.button-danger:hover { background: #ffe9ec; }
.button:active { transform: translateY(1px); }
.button-primary:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent), 0 3px 10px rgba(40, 120, 237, .18); }
.button-wide { width: 100%; }
.link-button { border: 0; background: transparent; color: var(--accent); padding: 4px 0; }
.link-button:hover { color: var(--accent-dark); text-decoration: underline; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.metric-card { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow); padding: 19px 20px; display: flex; align-items: flex-start; gap: 13px; min-height: 115px; }
.metric-symbol { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; font-size: 19px; flex: 0 0 auto; }
.symbol-blue { color: #2d83ef; background: #eaf3ff; }
.symbol-purple { color: #7865c7; background: #f0edff; }
.symbol-orange { color: #c68420; background: #fff4df; }
.symbol-green { color: #27986b; background: #e8f8f0; }
.metric-card span { color: var(--muted); font-size: 13px; }
.metric-card strong { display: block; margin-top: 3px; font-size: 26px; line-height: 1.2; letter-spacing: 0; }
.metric-card small { display: block; color: #9aa5b3; font-size: 11px; margin-top: 5px; }
.dashboard-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 18px; margin-bottom: 20px; }
.surface-card { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow); }
.connection-card, .quick-card, .recent-card { padding: 22px 24px; }
.surface-heading, .data-card-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.surface-heading h2, .data-card-heading h2 { font-size: 18px; margin-top: 5px; }
.status-pill { display: inline-flex; align-items: center; min-height: 27px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.status-success { color: #188657; background: #e8f8f0; }
.status-warning { color: #a36a14; background: #fff4dd; }
.status-danger { color: #c24d59; background: #fff0f2; }
.status-neutral { color: #657386; background: #f0f3f7; }
.connection-body { display: flex; align-items: center; gap: 22px; padding-top: 25px; }
.connection-ring { width: 86px; height: 86px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; background: conic-gradient(var(--accent) 0 74%, #edf1f5 74% 100%); position: relative; }
.connection-ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--surface); }
.connection-ring span { position: relative; z-index: 1; color: var(--accent); font-size: 12px; font-weight: 700; }
.connection-copy strong { font-size: 16px; }
.connection-copy p { color: var(--muted); margin: 5px 0 14px; font-size: 13px; }
.path-note { display: block; max-width: 560px; margin: -7px 0 14px; color: #97a3b1; overflow-wrap: anywhere; }
.mini-plan-list { margin-top: 13px; }
.mini-plan-row { display: flex; justify-content: space-between; align-items: center; min-height: 42px; border-bottom: 1px solid var(--line); }
.mini-plan-row:last-child { border-bottom: 0; }
.mini-plan-row strong { font-size: 13px; }
.mini-plan-row span { color: var(--muted); font-size: 12px; }
.recent-card { margin-bottom: 20px; }
.recent-card .surface-heading { margin-bottom: 16px; }
.snapshot-table { overflow-x: auto; }

.summary-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow); padding: 18px 21px; margin-bottom: 12px; }
.summary-strip > div { padding: 0 20px; border-right: 1px solid var(--line); min-width: 0; }
.summary-strip > div:first-child { padding-left: 0; }
.summary-strip > div:last-child { border-right: 0; }
.summary-strip span { display: block; color: var(--muted); font-size: 12px; }
.summary-strip strong { display: block; margin-top: 5px; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inline-message, .form-message { min-height: 20px; color: var(--danger); font-size: 12px; }
.discovery-card, .relations-card { padding: 21px 0 0; overflow: hidden; }
.data-card-heading { padding: 0 22px 17px; align-items: center; }
.data-card-heading p { color: var(--muted); font-size: 12px; margin-top: 4px; }
.table-tools { display: flex; align-items: center; gap: 8px; }
.table-tools input, .search-box input { height: 36px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-alt); color: var(--ink); padding: 0 11px; outline: 0; }
.table-tools input:focus, .search-box input:focus, input:focus { border-color: #a9c8f5; box-shadow: 0 0 0 3px #eaf2ff; }
.table-scroll { width: 100%; overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 930px; }
.data-table th, .data-table td { border-top: 1px solid var(--line); text-align: left; padding: 13px 16px; vertical-align: middle; white-space: nowrap; }
.data-table th { background: #fbfcfe; color: #667486; font-size: 12px; font-weight: 700; }
.data-table td { color: #3e4d5e; font-size: 13px; }
.data-table tbody tr:hover { background: #fbfdff; }
.data-table .col-expander { width: 42px; }
.row-toggle { width: 26px; height: 26px; padding: 0; border: 0; background: transparent; color: #8d99a8; font-size: 17px; }
.row-toggle[aria-expanded="true"] { color: var(--accent); transform: rotate(90deg); }
.row-detail-grid { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 10px 22px; padding: 16px 22px 18px 58px; }
.row-detail-item { display: grid; gap: 4px; min-width: 0; }
.row-detail-item b { color: #506073; font-size: 12px; }
.row-detail-item span { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; white-space: normal; }
.table-name { color: #253447; font-weight: 600; }
.entity-tag { display: inline-block; padding: 3px 8px; border-radius: 5px; background: var(--accent-soft); color: var(--accent); font-size: 11px; }
.sample-tag { color: var(--success); font-size: 12px; }
.detail-row td { padding: 0; background: #fbfcfe; }
.detail-panel { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(240px, .8fr); gap: 18px; padding: 17px 58px 19px; border-top: 1px dashed #dfe6ef; }
.detail-panel h3 { font-size: 13px; margin-bottom: 8px; }
.field-list, .sample-list, .index-list { display: grid; gap: 5px; }
.field-item, .sample-item, .index-item { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; }
.field-item b { color: #3d4c5c; font-weight: 600; }
.sample-item span:last-child { color: #536171; max-width: 58%; overflow: hidden; text-overflow: ellipsis; }
.index-item b { color: #3d4c5c; font-weight: 600; }
.index-item span { text-align: right; }
.sample-section { grid-column: 1 / -1; min-width: 0; }
.sample-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
.sample-table { width: max-content; min-width: 100%; border-collapse: collapse; font-size: 12px; }
.sample-table th, .sample-table td { max-width: 260px; padding: 8px 10px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.sample-table th { background: var(--surface-alt); color: #536171; font-weight: 650; }
.sample-table td { color: var(--muted); }
.relations-card { margin-top: 20px; padding-bottom: 18px; }
.relations-list { padding: 0 22px; }
.relation-item { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 12px 0; font-size: 13px; color: #536171; }
.relation-item code { color: var(--accent); background: var(--accent-soft); padding: 2px 6px; border-radius: 4px; }
.empty-state { padding: 28px 15px; color: var(--muted); text-align: center; }

.toolbar-card { padding: 15px 20px; margin-bottom: 16px; }
.data-toolbar-card { padding: 16px 20px; margin-bottom: 16px; }
.data-toolbar-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.data-toolbar-main label { color: var(--muted); font-size: 12px; font-weight: 650; }
.data-toolbar-main select, .data-toolbar-main input { height: 36px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-alt); color: var(--ink); padding: 0 10px; outline: 0; }
.data-toolbar-main select { min-width: 250px; }
.data-toolbar-main input { flex: 1; min-width: 180px; }
.data-toolbar-main select:focus, .data-toolbar-main input:focus { border-color: #a9c8f5; box-shadow: 0 0 0 3px #eaf2ff; }
.data-toolbar-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.data-toolbar-meta .form-message { min-height: 0; }
.generic-data-table { min-width: 900px; }
.data-modal-panel { width: min(760px, 100%); }
.data-form-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 15px; max-height: 48vh; overflow-y: auto; padding-right: 3px; }
.data-form-field { display: grid; gap: 5px; }
.data-form-field > span { color: #627082; font-size: 12px; }
.data-form-field input { width: 100%; }
.data-form-field input:disabled { color: #8d99a8; background: #f1f4f7; }
.settings-card { padding: 24px; max-width: 880px; }
.settings-form { display: grid; gap: 12px; margin-top: 20px; }
.settings-form input, .settings-form select { height: 40px; border: 1px solid var(--line); border-radius: 7px; outline: 0; background: var(--surface-alt); color: var(--ink); padding: 0 11px; margin-top: 6px; }
.settings-form input:focus, .settings-form select:focus { border-color: #a9c8f5; box-shadow: 0 0 0 3px #eaf2ff; }
.settings-help { color: var(--muted); font-size: 12px; }
.integration-settings-card { margin-top: 18px; }
.gateway-key-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; padding-top: 4px; }
.gateway-key-grid label { min-width: 0; }
.gateway-key-grid input { width: 100%; font-family: Consolas, "Courier New", monospace; font-size: 12px; }
.toolbar-row { display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.search-box { display: flex; align-items: center; gap: 8px; flex: 1; max-width: none; flex-wrap: wrap; }
.search-box > span { color: #8d99a8; font-size: 20px; }
.search-box input { flex: 1; min-width: 170px; }
.search-box select { height: 36px; min-width: 118px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-alt); color: var(--ink); padding: 0 9px; }
#author-expiration-filter { min-width: 138px; }
.toolbar-meta { display: flex; align-items: center; gap: 15px; color: var(--muted); font-size: 12px; }
.mapping-note { color: #8591a1; }
.data-card { overflow: hidden; }
.author-table { min-width: 1180px; }
.author-table select { height: 32px; min-width: 128px; border: 1px solid var(--line); border-radius: 6px; padding: 0 8px; color: #4c5a6a; background: var(--surface); }
.author-actions { display: inline-flex; gap: 7px; align-items: center; }
.action-link { border: 0; background: transparent; color: var(--accent); padding: 5px 2px; }
.action-link:hover { text-decoration: underline; }
.status-select { min-width: 95px !important; }
.raw-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.expiration-cell { display: grid; gap: 5px; min-width: 195px; white-space: normal; }
.expiration-cell small { color: var(--muted); font-size: 11px; line-height: 1.35; }
.expiration-badge { display: inline-flex; align-items: center; justify-self: start; min-height: 24px; padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; }
.expiration-unlimited { color: #566679; background: #eef2f6; }
.expiration-active { color: #188657; background: #e8f8f0; }
.expiration-expiring { color: #a36a14; background: #fff4dd; }
.expiration-expired { color: #c24d59; background: #fff0f2; }
.expiration-missing { color: #7854b8; background: #f1ebff; }
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

.plan-table { min-width: 980px; }
.plan-code { display: inline-flex; width: 32px; height: 28px; align-items: center; justify-content: center; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.plan-table input { width: 90px; height: 32px; border: 1px solid var(--line); border-radius: 6px; padding: 0 8px; color: var(--ink); background: var(--surface); }
.plan-card-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 19px; }
.plan-card { padding: 20px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); box-shadow: var(--shadow); }
.plan-card.featured { border-color: #9dc4fb; box-shadow: 0 0 0 2px #e5efff; }
.plan-card .plan-card-code { color: var(--accent); font-size: 11px; letter-spacing: 1.1px; font-weight: 700; }
.plan-card h3 { margin-top: 6px; font-size: 17px; }
.plan-price { margin: 15px 0; font-size: 26px; font-weight: 700; }
.plan-quota { border-top: 1px solid var(--line); padding-top: 13px; display: grid; gap: 8px; }
.plan-quota div { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.plan-quota b { color: var(--ink); }

.login-screen { width: min(900px, calc(100% - 36px)); }
.login-card { display: grid; grid-template-columns: 1fr 310px; gap: 58px; padding: 46px 52px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 15px 45px rgba(31, 53, 83, .08); }
.login-intro h1 { margin: 11px 0 11px; font-size: 30px; }
.login-intro p { color: var(--muted); max-width: 390px; }
.login-points { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.login-points span { padding: 5px 9px; border-radius: 5px; background: #f1f5fa; color: #6a7888; font-size: 11px; }
.login-form { display: grid; gap: 8px; align-content: center; }
.login-form label, .modal-form label { color: #627082; font-size: 12px; }
.login-form input, .modal-form input, .modal-form select { height: 40px; border: 1px solid var(--line); border-radius: 7px; outline: 0; background: var(--surface-alt); color: var(--ink); padding: 0 11px; margin-bottom: 7px; }
.login-form input::placeholder, .modal-form input::placeholder, .table-tools input::placeholder, .search-box input::placeholder { color: #aab4c0; }

.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; overflow-y: auto; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 30, 50, .35); }
.modal-panel { position: relative; z-index: 1; width: min(620px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; border-radius: 11px; background: var(--surface); box-shadow: 0 24px 70px rgba(15, 30, 50, .22); padding: 25px; }
.modal-heading { display: flex; justify-content: space-between; margin-bottom: 20px; }
.modal-heading h2 { font-size: 19px; margin-top: 5px; }
.modal-subtitle { color: var(--muted); font-size: 12px; margin-top: 5px; overflow-wrap: anywhere; }
.modal-form { display: grid; gap: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 15px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 4px; }
.author-modal-panel { width: min(680px, 100%); }
.expiration-field { display: grid; gap: 7px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-alt); }
.expiration-field > label { color: #627082; font-size: 12px; }
.expiration-field > input { width: 100%; margin: 0; }
.expiration-field > small { color: var(--muted); font-size: 11px; }
.expiration-field.is-unlimited { background: #f4f7fa; }
.expiration-field.is-unlimited .expiry-presets { opacity: .45; pointer-events: none; }
.expiry-presets { display: flex; flex-wrap: wrap; gap: 7px; }
.expiry-presets button { min-height: 30px; padding: 0 10px; border: 1px solid #d4e1f3; border-radius: 6px; background: #fff; color: var(--accent); font-size: 12px; font-weight: 600; }
.expiry-presets button:hover { border-color: #a9c8f5; background: var(--accent-soft); }
.audit-section { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.audit-heading { min-height: 42px; padding: 0 13px; display: flex; align-items: center; justify-content: space-between; background: #fbfcfe; border-bottom: 1px solid var(--line); }
.audit-heading h3 { font-size: 13px; }
.audit-heading span { color: var(--muted); font-size: 11px; }
.audit-list { max-height: 190px; overflow-y: auto; }
.audit-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 10px 13px; border-bottom: 1px solid var(--line); }
.audit-item:last-child { border-bottom: 0; }
.audit-item > div { display: grid; gap: 3px; min-width: 0; }
.audit-item strong { color: #445365; font-size: 12px; font-weight: 600; white-space: normal; overflow-wrap: anywhere; }
.audit-item small, .audit-item time { color: var(--muted); font-size: 10px; }
.audit-item time { flex: 0 0 auto; }
.empty-state.compact { padding: 16px 12px; font-size: 12px; }

@media (max-width: 1180px) { .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .plan-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .sidebar { width: 220px; } .main { margin-left: 220px; padding: 0 23px 45px; } .main.sidebar-collapsed { margin-left: 0; } .topbar { margin-left: -23px; margin-right: -23px; padding: 0 23px; } .dashboard-grid { grid-template-columns: 1fr; } }
@media (max-width: 680px) { .sidebar { width: 100%; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--line); } .brand { height: 66px; padding: 0 18px; } .sidebar-nav { display: flex; overflow-x: auto; padding: 10px 12px; } .nav-item { flex: 0 0 auto; padding: 0 13px; } .sidebar-bottom { display: none; } .main { margin-left: 0; padding: 0 15px 35px; } .topbar { height: 64px; margin: 0 -15px 25px; padding: 0 15px; } .topbar-left { gap: 10px; } .breadcrumbs span, #sidebar-toggle { display: none; } .topbar-right { gap: 10px; } .user-chip { font-size: 12px; } .page-heading { flex-direction: column; } .heading-actions { justify-content: flex-start; } .metric-grid, .plan-card-grid { grid-template-columns: 1fr; } .summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 0; } .summary-strip > div:nth-child(2) { border-right: 0; } .summary-strip > div:nth-child(3) { padding-left: 0; } .summary-strip > div:nth-child(4) { border-right: 0; } .connection-body { align-items: flex-start; } .toolbar-row { align-items: flex-start; flex-direction: column; } .toolbar-meta { width: 100%; justify-content: space-between; } .search-box { max-width: none; width: 100%; flex-wrap: wrap; } .search-box input { flex-basis: calc(100% - 34px); } .search-box select { flex: 1; } .data-toolbar-main { align-items: stretch; flex-direction: column; } .data-toolbar-main select, .data-toolbar-main input { width: 100%; min-width: 0; } .data-toolbar-meta { align-items: flex-start; flex-direction: column; } .data-form-fields { grid-template-columns: 1fr; max-height: 42vh; } .row-detail-grid { grid-template-columns: 1fr; padding-left: 22px; padding-right: 22px; } .login-screen { width: calc(100% - 24px); } .login-card { grid-template-columns: 1fr; gap: 24px; padding: 29px 24px; } .form-grid, .gateway-key-grid { grid-template-columns: 1fr; } .integration-key-row { grid-template-columns: 1fr 36px; } .integration-key-row input:first-child { grid-column: 1 / -1; } .detail-panel { grid-template-columns: 1fr; padding-left: 22px; padding-right: 22px; } }
@media (max-height: 560px) { .modal { align-items: start; padding: 12px; } .modal-panel { max-height: calc(100vh - 24px); padding: 18px; } .modal-heading { margin-bottom: 12px; } .modal-form { gap: 4px; } .modal-form input, .modal-form select { height: 36px; margin-bottom: 3px; } }
@media (max-width: 420px) { .modal { align-items: start; padding: 8px; } .modal-panel { max-height: calc(100vh - 16px); padding: 16px; border-radius: 9px; } .modal-heading { margin-bottom: 13px; } .author-modal-panel .modal-actions { position: sticky; bottom: -16px; margin: 2px -16px -16px; padding: 11px 16px 16px; background: var(--surface); border-top: 1px solid var(--line); } .expiration-field { padding: 11px; } .expiry-presets button { flex: 1 1 calc(50% - 4px); } .audit-list { max-height: 150px; } .audit-item { display: grid; gap: 4px; } }

.sidebar.collapsed .brand { justify-content: center; padding: 0; }
.sidebar.collapsed .brand-copy, .sidebar.collapsed .nav-item span:last-child, .sidebar.collapsed .sidebar-bottom { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 0; }

.operations-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin: -8px 0 18px; }
.operations-live-status { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.operations-toolbar-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 12px; }
.operations-range { display: inline-grid; grid-template-columns: repeat(2, minmax(76px, 1fr)); height: 34px; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.operations-range button { min-width: 76px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 650; transition: background .15s, color .15s; }
.operations-range button:hover { color: var(--accent); }
.operations-range button.is-active { background: var(--accent-soft); color: var(--accent); }
.live-indicator, .operations-window { display: inline-flex; align-items: center; gap: 7px; min-height: 31px; padding: 0 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--muted); font-size: 12px; }
.live-indicator { color: var(--success); font-weight: 650; }
.live-indicator i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 15%, transparent); }
.operations-kpis { margin-bottom: 18px; }
.operations-local-strip { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 18px; }
.operations-local-strip > div { padding: 0 14px; }
.operations-kpis .metric-card { min-height: 98px; padding: 15px 17px; }
.operations-kpis .metric-symbol { width: 30px; height: 30px; border-radius: 7px; font-size: 18px; }
.operations-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 1.2fr); gap: 18px; margin-bottom: 18px; }
.operations-chart-card, .operations-source-card { min-height: 270px; }
.telemetry-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 4px 0; }
.telemetry-item { border: 1px solid var(--line); border-radius: 7px; padding: 13px; background: var(--surface-alt); }
.telemetry-item span { display: block; color: var(--muted); font-size: 12px; }
.telemetry-item strong { display: block; margin-top: 5px; font-size: 21px; color: var(--ink); }
.telemetry-track { height: 5px; margin-top: 12px; overflow: hidden; border-radius: 99px; background: #e8edf3; }
.telemetry-fill { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.telemetry-footnote { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }
.operations-sources { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 16px; }
.operation-source { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.operation-source-main { overflow: hidden; color: #4d5c6d; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.operation-source small { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }
.operation-source .status-pill { min-height: 22px; padding: 0 7px; font-size: 10px; }
.operation-source.is-failed { padding-left: 9px; border-left: 2px solid var(--danger); }
.operation-source.is-slow { padding-left: 9px; border-left: 2px solid var(--warning); }
.operations-business-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ops-bars { display: grid; gap: 8px; min-height: 188px; }
.ops-bar-row { display: grid; grid-template-columns: 75px minmax(0, 1fr) 52px; align-items: center; gap: 8px; }
.ops-bar-label { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.ops-bar-track { height: 9px; overflow: hidden; border-radius: 99px; background: #edf1f5; }
.ops-bar-fill { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.ops-bar-row strong { color: #4e5d6d; font-size: 12px; text-align: right; }
.operations-detail-card { padding: 20px 0 0; }
.operations-table { min-width: 1080px; }
.operations-table td { max-width: 360px; white-space: normal; overflow-wrap: anywhere; line-height: 1.45; }
.operations-table .ops-ok { color: var(--success); font-weight: 650; }
.operations-table .ops-fail { color: var(--danger); font-weight: 650; }
.operations-logs-card { margin-bottom: 18px; padding: 20px; }
.operations-registrants-card { margin-bottom: 18px; }
.operations-registrants-table { min-width: 620px; }
.operations-logs-card .surface-heading { margin-bottom: 14px; }
.section-note { color: var(--muted); font-size: 12px; margin-top: 4px; }
.operations-log-summary { display: grid; grid-template-columns: repeat(6, minmax(110px, 1fr)); gap: 10px; margin-bottom: 16px; }
.operations-log-stat { display: grid; gap: 3px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-alt); }
.operations-log-stat > span { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.operations-log-stat > strong { color: var(--ink); font-size: 20px; line-height: 1.15; }
.operations-log-stat > small { color: var(--success); font-size: 10px; }
.operations-log-stat.is-error > small { color: var(--danger); }
.operations-log-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; border-top: 1px solid var(--line); }
.operations-log-item { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.operations-log-source { color: var(--accent); font-size: 11px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.operations-log-item p { margin: 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.operations-log-item.is-error .operations-log-source { color: var(--danger); }
.operations-log-filters { display: grid; grid-template-columns: 150px 130px minmax(180px, 1fr) auto; gap: 8px; margin-bottom: 14px; }
.operations-log-filters input, .operations-log-filters select { height: 36px; min-width: 0; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-alt); color: var(--ink); padding: 0 10px; }
@media (max-width: 900px) { .operations-grid, .operations-business-grid { grid-template-columns: 1fr; } .telemetry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1180px) and (min-width: 681px) { .operations-local-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 0; } .operations-local-strip > div:nth-child(3) { border-right: 0; } .operations-local-strip > div:nth-child(4) { padding-left: 0; } }
@media (max-width: 680px) { .operations-toolbar { align-items: flex-start; flex-direction: column; } .operations-live-status, .operations-toolbar-actions { width: 100%; } .operations-toolbar-actions { justify-content: space-between; } .live-indicator, .operations-window { flex: 1; justify-content: center; } .telemetry-grid, .operations-sources { grid-template-columns: 1fr; } .ops-bar-row { grid-template-columns: 58px minmax(0, 1fr) 42px; } .operations-log-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } .operations-log-list { grid-template-columns: 1fr; } .operations-log-filters { grid-template-columns: 1fr 1fr; } .operations-log-filters input { grid-column: 1 / -1; } }
@media (max-width: 680px) { .operations-local-strip > div:nth-child(5) { padding-left: 0; } .operations-local-strip > div:nth-child(6) { border-right: 0; } }

/* Theme control and a restrained dark palette shared by every management view. */
.theme-toggle { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--muted); font-size: 12px; }
.theme-toggle:hover { color: var(--accent); border-color: #a9c8f5; background: var(--accent-soft); }
.theme-toggle-icon { font-size: 15px; line-height: 1; }
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111827;
  --surface: #182231;
  --surface-alt: #202c3d;
  --sidebar: #151e2b;
  --ink: #edf3fb;
  --muted: #9aa9bc;
  --line: #2d3b4f;
  --accent: #68a5ff;
  --accent-dark: #8ab9ff;
  --accent-soft: #223a5d;
  --success: #4dcc93;
  --warning: #f0b34e;
  --danger: #ff7d89;
  --shadow: 0 8px 26px rgba(0, 0, 0, .22);
}
html[data-theme="dark"] .brand { border-bottom-color: var(--line); }
html[data-theme="dark"] .nav-item { color: #b7c3d2; }
html[data-theme="dark"] .nav-item:hover { background: #1d3048; color: var(--accent); }
html[data-theme="dark"] .data-table th { background: #1d2939; color: #aebbd0; }
html[data-theme="dark"] .data-table td { color: #c8d3e0; }
html[data-theme="dark"] .data-table tbody tr:hover { background: #1d2d42; }
html[data-theme="dark"] .detail-row td, html[data-theme="dark"] .audit-heading { background: #1d2939; }
html[data-theme="dark"] .telemetry-track, html[data-theme="dark"] .ops-bar-track { background: #2a384b; }
html[data-theme="dark"] .login-points span { background: #223044; color: #aab9cb; }
html[data-theme="dark"] .button-light, html[data-theme="dark"] .link-button { color: #b8c8db; }
html[data-theme="dark"] .button-light:hover { background: #223a5d; color: var(--accent); }
html[data-theme="dark"] .settings-form input, html[data-theme="dark"] .settings-form select, html[data-theme="dark"] .data-toolbar-main select, html[data-theme="dark"] .data-toolbar-main input, html[data-theme="dark"] .search-box input, html[data-theme="dark"] .search-box select { background: #1b2838; color: var(--ink); }
html[data-theme="dark"] .operations-log-stat { background: #1d2939; }
html[data-theme="dark"] .operations-log-filters input, html[data-theme="dark"] .operations-log-filters select { background: #1b2838; color: var(--ink); }
html[data-theme="dark"] .operations-range button.is-active { background: #29476e; color: #8fc0ff; }
html[data-theme="dark"] .brand-logo, html[data-theme="dark"] .user-avatar { background: var(--accent-soft); border-color: #31527e; }
html[data-theme="dark"] .breadcrumbs, html[data-theme="dark"] .top-action, html[data-theme="dark"] .user-chip, html[data-theme="dark"] .operation-source-main, html[data-theme="dark"] .ops-bar-row strong { color: #c0ccda; }
html[data-theme="dark"] .icon-button { color: #b7c3d2; }
html[data-theme="dark"] .icon-button:hover { background: var(--accent-soft); border-color: #44658e; }
html[data-theme="dark"] .status-success { color: #71dfad; background: #193b32; }
html[data-theme="dark"] .status-warning { color: #f2c36e; background: #48371d; }
html[data-theme="dark"] .status-danger { color: #ff9ba5; background: #4b2932; }
html[data-theme="dark"] .status-neutral { color: #bdc9d8; background: #2a3748; }
html[data-theme="dark"] .symbol-blue, html[data-theme="dark"] .symbol-purple, html[data-theme="dark"] .symbol-orange, html[data-theme="dark"] .symbol-green { color: var(--accent); background: var(--accent-soft); }
html[data-theme="dark"] .row-detail-item b, html[data-theme="dark"] .field-item b, html[data-theme="dark"] .index-item b, html[data-theme="dark"] .table-name, html[data-theme="dark"] .audit-item strong { color: #dce5f0; }
html[data-theme="dark"] .expiry-presets button { background: #1b2838; border-color: var(--line); }
@media (max-width: 1080px) and (min-width: 681px) { .operations-log-summary { grid-template-columns: repeat(4, minmax(110px, 1fr)); } }
@media (max-width: 420px) { .theme-toggle-label { display: none; } .theme-toggle { width: 34px; padding: 0; justify-content: center; } }
