:root {
  --navy-950: #071926;
  --navy-900: #0b2638;
  --navy-800: #123b54;
  --blue-700: #185b7b;
  --teal-600: #0f8b83;
  --teal-100: #dff5f1;
  --orange-500: #f29f3d;
  --amber-100: #fff2d7;
  --red-600: #c54848;
  --red-100: #fbe4e4;
  --purple-600: #6755a6;
  --slate-900: #162735;
  --slate-700: #465d6d;
  --slate-500: #728795;
  --slate-300: #cbd6dd;
  --slate-200: #dde6eb;
  --slate-100: #eef3f6;
  --surface: #ffffff;
  --shadow: 0 12px 35px rgba(19, 50, 70, .08);
  font-family: Tahoma, Arial, sans-serif;
  color: var(--slate-900);
  background: #f4f7f9;
}

* { box-sizing: border-box; }
html { min-height: 100%; font-size: 16px; }
body { margin: 0; min-height: 100vh; background: #f4f7f9; color: var(--slate-900); }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.app-shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: linear-gradient(170deg, var(--navy-950), var(--navy-800)); color: #fff; display: flex; flex-direction: column; padding: 24px 18px; z-index: 30; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 48px; height: 48px; border-radius: 15px; background: linear-gradient(135deg, #fff, #dcecf4); color: var(--navy-900); display: grid; place-items: center; font-size: 1rem; font-weight: 900; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.brand > span:last-child { display: grid; gap: 2px; }
.brand strong { font-size: 1.1rem; letter-spacing: .02em; }
.brand small { color: #a9c4d4; font-size: .82rem; }
.main-nav { display: grid; gap: 5px; margin-top: 36px; }
.main-nav a { display: flex; align-items: center; gap: 11px; min-height: 44px; padding: 10px 13px; border-radius: 12px; color: #bed0dc; font-size: .94rem; transition: .18s ease; }
.main-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.main-nav a.active { background: #fff; color: var(--navy-900); font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,.14); }
.nav-dot { width: 8px; height: 8px; border: 2px solid currentColor; border-radius: 50%; opacity: .85; }
.main-nav a.active .nav-dot { border-color: var(--orange-500); background: var(--orange-500); }
.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding: 20px 8px 2px; display: grid; gap: 4px; }
.sidebar-footer > span { font-weight: 700; }
.sidebar-footer > small { color: #9db7c7; }
.logout-button { border: 0; padding: 0; margin-top: 11px; color: #f7bd7b; background: transparent; cursor: pointer; text-align: right; }

.main-content { min-width: 0; }
.topbar { min-height: 92px; padding: 20px 34px; display: flex; align-items: center; gap: 16px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--slate-200); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px); }
.topbar h1 { font-size: 1.35rem; margin: 0 0 5px; }
.topbar p { color: var(--slate-500); margin: 0; font-size: .87rem; }
.menu-button { display: none; width: 42px; height: 42px; border: 1px solid var(--slate-200); background: #fff; border-radius: 12px; cursor: pointer; }
.live-pill { margin-right: auto; display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 8px 13px; font-size: .82rem; font-weight: 700; }
.live-pill span { width: 8px; height: 8px; border-radius: 50%; }
.live-pill.ready { background: var(--teal-100); color: #08746e; }
.live-pill.ready span { background: var(--teal-600); box-shadow: 0 0 0 5px rgba(15,139,131,.12); }
.live-pill.waiting { background: var(--amber-100); color: #95641f; }
.live-pill.waiting span { background: var(--orange-500); }
.page-content { padding: 28px 34px 48px; }

.hero-panel { min-height: 190px; padding: 34px 38px; display: flex; align-items: center; justify-content: space-between; gap: 30px; overflow: hidden; position: relative; color: #fff; border-radius: 24px; background: radial-gradient(circle at 14% 20%, rgba(38,177,164,.44), transparent 34%), linear-gradient(120deg, var(--navy-900), #155674); box-shadow: var(--shadow); }
.hero-panel h2 { font-size: clamp(1.65rem, 3vw, 2.35rem); margin: 8px 0 10px; }
.hero-panel p { color: #c6dce7; margin: 0; max-width: 650px; line-height: 1.8; }
.eyebrow { color: var(--teal-600); font-size: .76rem; font-weight: 800; letter-spacing: .06em; }
.hero-panel .eyebrow { color: #83ded3; }
.hero-orbit { width: 124px; height: 124px; border: 1px solid rgba(255,255,255,.28); border-radius: 50%; display: grid; place-items: center; position: relative; flex: 0 0 auto; }
.hero-orbit:before { content: ''; position: absolute; inset: 16px; border: 1px dashed rgba(255,255,255,.24); border-radius: 50%; }
.hero-orbit span { position: absolute; width: 15px; height: 15px; border-radius: 50%; background: var(--orange-500); top: 9px; right: 25px; box-shadow: 0 0 25px rgba(242,159,61,.8); }
.hero-orbit strong { font-size: 1.55rem; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 22px 0; }
.metric-card { min-height: 138px; background: var(--surface); border: 1px solid var(--slate-200); border-radius: 18px; padding: 20px; display: grid; align-content: space-between; position: relative; overflow: hidden; box-shadow: 0 6px 20px rgba(19,50,70,.04); }
.metric-card:after { content: ''; position: absolute; width: 70px; height: 70px; border-radius: 50%; top: -34px; left: -28px; opacity: .16; }
.metric-card.teal:after { background: var(--teal-600); }.metric-card.blue:after { background: var(--blue-700); }.metric-card.amber:after { background: var(--orange-500); }.metric-card.purple:after { background: var(--purple-600); }
.metric-card > span { color: var(--slate-500); font-size: .85rem; }
.metric-card > strong { font-size: 1.8rem; color: var(--navy-900); }
.metric-card > small { color: var(--slate-500); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, .8fr); gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--slate-200); border-radius: 18px; box-shadow: 0 7px 24px rgba(19,50,70,.045); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 22px 14px; }
.panel-heading h3 { margin: 4px 0 0; font-size: 1.02rem; }
.panel-heading a { color: var(--teal-600); font-weight: 700; font-size: .83rem; }
.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 13px 15px; text-align: right; border-bottom: 1px solid var(--slate-100); vertical-align: middle; white-space: nowrap; }
th { color: var(--slate-500); background: #f8fafb; font-size: .78rem; font-weight: 800; position: sticky; top: 0; }
td { font-size: .86rem; }
tbody tr:hover { background: #f9fcfd; }
tbody tr:last-child td { border-bottom: 0; }
.compact th, .compact td { padding: 11px 14px; }
.mono { direction: ltr; text-align: right; font-family: Consolas, "Courier New", monospace; font-weight: 600; }
.number-cell { direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }
.empty-cell, .empty-state { text-align: center; color: var(--slate-500); padding: 34px !important; }
.status-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 9px; font-size: .75rem; font-weight: 800; }
.status-badge.ok { background: var(--teal-100); color: #08746e; }.status-badge.warn { background: var(--amber-100); color: #8c5b17; }.status-badge.danger { background: var(--red-100); color: var(--red-600); }
.expiry-list { padding: 0 20px 13px; }
.expiry-item { display: flex; justify-content: space-between; gap: 14px; padding: 13px 2px; border-bottom: 1px solid var(--slate-100); }
.expiry-item:last-child { border-bottom: 0; }
.expiry-item > div { display: grid; gap: 4px; }.expiry-item > div:last-child { text-align: left; }
.expiry-item strong { font-size: .86rem; }.expiry-item span { color: var(--slate-500); font-size: .77rem; }
.expiry-item .text-danger { color: var(--red-600); }.expiry-item .text-amber { color: #a16d1e; }

.report-toolbar { padding: 18px; margin-bottom: 17px; display: flex; align-items: end; gap: 16px; justify-content: space-between; }
.filter-form { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; flex: 1; }
.filter-form label { display: grid; gap: 6px; color: var(--slate-500); font-size: .76rem; font-weight: 700; }
.filter-form input, .filter-form select, .login-form input { min-height: 42px; border: 1px solid var(--slate-300); background: #fff; border-radius: 11px; padding: 8px 11px; color: var(--slate-900); outline: none; }
.filter-form input:focus, .filter-form select:focus, .login-form input:focus { border-color: var(--teal-600); box-shadow: 0 0 0 3px rgba(15,139,131,.11); }
.search-field { min-width: 230px; flex: 1; max-width: 360px; }
.filter-actions, .report-actions { display: flex; gap: 8px; }
.primary-button, .secondary-button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: 11px; padding: 8px 16px; cursor: pointer; font-weight: 800; font-size: .84rem; }
.primary-button { border: 1px solid var(--navy-900); background: var(--navy-900); color: #fff; }
.primary-button:hover { background: var(--navy-800); }
.secondary-button { border: 1px solid var(--slate-300); background: #fff; color: var(--slate-700); }
.report-summary { display: flex; align-items: baseline; gap: 8px; margin: 0 2px 12px; }
.report-summary strong { font-size: 1.25rem; color: var(--navy-900); }.report-summary span { color: var(--slate-500); font-size: .84rem; }
.report-panel { overflow: hidden; }
.data-table th { z-index: 2; }
.pagination { display: flex; justify-content: center; flex-wrap: wrap; gap: 7px; margin-top: 20px; }
.pagination a { min-width: 39px; height: 39px; border-radius: 10px; border: 1px solid var(--slate-300); display: grid; place-items: center; background: #fff; font-size: .84rem; padding: 0 10px; }
.pagination a.active { background: var(--navy-900); color: #fff; border-color: var(--navy-900); }

.sync-intro { padding: 25px; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.sync-intro h2 { margin: 5px 0 8px; font-size: 1.25rem; }.sync-intro p { margin: 0; color: var(--slate-500); }
.shield-mark { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 20px 20px 28px 28px; background: var(--teal-100); color: var(--teal-600); font-size: 1.7rem; font-weight: 900; }
.sync-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.sync-card { background: #fff; border: 1px solid var(--slate-200); border-radius: 15px; padding: 15px; display: grid; gap: 7px; }
.sync-card > div { display: flex; align-items: center; gap: 8px; }.sync-card > span { color: var(--slate-700); font-size: .84rem; }.sync-card > small { color: var(--slate-500); }
.sync-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--orange-500); }.sync-card.done .sync-dot { background: var(--teal-600); }

.login-page { display: grid; place-items: center; padding: 30px 18px; background: radial-gradient(circle at 20% 20%, rgba(15,139,131,.25), transparent 33%), linear-gradient(145deg, var(--navy-950), var(--navy-800)); }
.login-card { width: min(480px, 100%); background: #fff; border-radius: 26px; padding: 34px; box-shadow: 0 28px 80px rgba(0,0,0,.3); }
.login-brand { color: var(--navy-900); margin-bottom: 30px; }.login-brand .brand-mark { background: var(--navy-900); color: #fff; }
.login-copy h1 { font-size: 1.8rem; margin: 8px 0 10px; }.login-copy p { color: var(--slate-500); line-height: 1.7; margin-bottom: 25px; }
.login-form { display: grid; gap: 15px; }.login-form label { display: grid; gap: 7px; color: var(--slate-700); font-size: .84rem; font-weight: 700; }.login-form .primary-button { width: 100%; margin-top: 5px; }
.login-note { color: var(--slate-500); display: block; text-align: center; margin-top: 20px; line-height: 1.6; }
.alert { padding: 12px 14px; margin-bottom: 16px; border-radius: 11px; line-height: 1.55; font-size: .86rem; }.alert.error { background: var(--red-100); color: #9b3434; }.alert.success { background: var(--teal-100); color: #08746e; }
.button-link { width: 100%; margin-top: 16px; }.setup-card { width: min(540px, 100%); }
.users-layout { display: grid; grid-template-columns: minmax(260px, .65fr) minmax(0, 1.6fr); gap: 18px; }
.admin-form { display: grid; gap: 13px; padding: 4px 22px 22px; }
.admin-form label { display: grid; gap: 6px; color: var(--slate-500); font-size: .78rem; font-weight: 700; }
.admin-form input, .admin-form select, .password-reset input { min-height: 41px; border: 1px solid var(--slate-300); border-radius: 10px; padding: 8px 10px; }
.inline-actions { display: flex; align-items: center; gap: 8px; }.inline-actions form { margin: 0; }
.password-reset { display: flex; align-items: center; gap: 5px; }.password-reset input { width: 145px; min-height: 34px; }
.text-button { border: 0; background: transparent; color: var(--teal-600); font-weight: 800; cursor: pointer; padding: 6px; }
.sidebar-overlay { display: none; }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sync-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .users-layout { grid-template-columns: 1fr; }
  .report-toolbar { align-items: stretch; flex-direction: column; }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; right: 0; width: 278px; transform: translateX(105%); transition: transform .2s ease; box-shadow: -14px 0 40px rgba(0,0,0,.25); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-overlay { position: fixed; inset: 0; background: rgba(5,20,31,.55); z-index: 25; }
  body.sidebar-open .sidebar-overlay { display: block; }
  .menu-button { display: grid; place-items: center; }
  .topbar { padding: 16px 18px; }.topbar h1 { font-size: 1.12rem; }.topbar p { display: none; }
  .live-pill { padding: 7px 10px; font-size: .74rem; }
  .page-content { padding: 18px 14px 36px; }
  .hero-panel { padding: 28px 23px; }.hero-orbit { display: none; }
  .sync-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-form { display: grid; grid-template-columns: 1fr 1fr; }.search-field { max-width: none; grid-column: 1 / -1; }
  .filter-actions { align-self: end; }.report-actions { width: 100%; }.report-actions > * { flex: 1; }
}

@media (max-width: 520px) {
  .metric-grid, .sync-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 120px; }
  .filter-form { grid-template-columns: 1fr; }.search-field { grid-column: auto; }
  .filter-actions > *, .report-actions > * { flex: 1; }
  .live-pill { max-width: 132px; text-align: center; }
  .login-card { padding: 27px 22px; border-radius: 20px; }
}

@media print {
  .sidebar, .topbar, .report-toolbar, .pagination, .sidebar-overlay { display: none !important; }
  .app-shell { display: block; }.page-content { padding: 0; }.panel { box-shadow: none; border: 0; }.report-summary { margin-top: 0; }
  table { min-width: 0; font-size: 10px; } th, td { padding: 6px; white-space: normal; }
}
