:root {
  --navy-950: #071426;
  --navy-900: #0b1d35;
  --navy-800: #132b49;
  --blue-700: #175cd3;
  --blue-600: #2475ed;
  --blue-100: #dbeafe;
  --slate-700: #344054;
  --slate-500: #667085;
  --slate-300: #d0d5dd;
  --slate-200: #e4e7ec;
  --slate-100: #f2f4f7;
  --slate-50: #f8fafc;
  --white: #fff;
  --green-700: #067647;
  --green-100: #dcfae6;
  --amber-700: #b54708;
  --amber-100: #fef0c7;
  --red-700: #b42318;
  --red-100: #fee4e2;
  --shadow-sm: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 8%);
  --shadow-lg: 0 24px 48px rgb(7 20 38 / 16%);
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--navy-900);
  background: var(--slate-50);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body { min-height: 100vh; margin: 0; background: var(--slate-50); line-height: 1.5; }
a { color: var(--blue-700); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button, summary, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid rgb(36 117 237 / 28%); outline-offset: 2px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.35rem, 2vw, 1.7rem); letter-spacing: -.025em; margin-bottom: 0; }
h2 { font-size: 1.2rem; letter-spacing: -.015em; margin-bottom: 0; }
h3 { font-size: 1rem; margin-bottom: .35rem; }
code { font: 500 .82rem ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--navy-800); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; left: 1rem; top: -5rem; padding: .65rem 1rem; border-radius: 8px; background: white; color: var(--navy-900); }
.skip-link:focus { top: 1rem; }
.eyebrow { display: block; margin-bottom: .22rem; color: var(--slate-500); font-size: .68rem; line-height: 1.2; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.muted { color: var(--slate-500); }
.grow { min-width: 0; flex: 1; }
.spaced { margin-top: 1.35rem; }
.full { width: 100%; }

.app-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; z-index: 30; display: flex; flex-direction: column; height: 100vh; padding: 1.25rem .9rem; overflow-y: auto; color: #d6e1f0; background: radial-gradient(circle at 20% 0, #17375c 0, var(--navy-900) 34%, var(--navy-950) 100%); }
.brand { display: flex; align-items: center; gap: .75rem; margin: .1rem .55rem 2rem; color: white; }
.brand:hover { text-decoration: none; }
.brand > span:last-child { display: flex; flex-direction: column; line-height: 1.05; }
.brand small { margin-top: .2rem; color: #9db2cb; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; }
.brand-mark { display: inline-grid; place-items: center; width: 42px; height: 42px; flex: 0 0 auto; border: 1px solid rgb(255 255 255 / 18%); border-radius: 12px; color: white; background: linear-gradient(145deg, #3693ff, #175cd3); box-shadow: 0 9px 22px rgb(23 92 211 / 30%); font-size: .78rem; font-weight: 850; letter-spacing: -.02em; }
.brand-mark.large { width: 58px; height: 58px; border-radius: 17px; font-size: 1rem; }
.nav-list { display: grid; gap: .35rem; }
.nav-list a { display: flex; align-items: center; gap: .75rem; padding: .7rem .8rem; border: 1px solid transparent; border-radius: 9px; color: #b9c9db; font-size: .88rem; font-weight: 570; }
.nav-list a span { display: inline-grid; width: 1.2rem; place-items: center; color: #7fa0c3; }
.nav-list a:hover { color: white; background: rgb(255 255 255 / 6%); text-decoration: none; }
.nav-list a.active { color: white; border-color: rgb(255 255 255 / 8%); background: rgb(51 139 255 / 15%); }
.nav-list a.active span { color: #6cb0ff; }
.sidebar-footer { margin-top: auto; padding: 1rem .55rem .1rem; border-top: 1px solid rgb(255 255 255 / 9%); }
.sidebar-footer strong { display: block; overflow: hidden; margin-bottom: .75rem; color: #e8eef7; font-size: .82rem; text-overflow: ellipsis; }
.sidebar-footer .eyebrow { color: #7891ae; }

.workspace { min-width: 0; }
.topbar { display: flex; align-items: center; min-height: 82px; padding: 1rem clamp(1.25rem, 3vw, 2.5rem); border-bottom: 1px solid var(--slate-200); background: rgb(255 255 255 / 88%); backdrop-filter: blur(16px); }
.topbar > div { flex: 1; }
.server-state { display: inline-flex; align-items: center; gap: .45rem; color: var(--slate-500); font-size: .74rem; font-weight: 600; }
.server-state i { width: 8px; height: 8px; border-radius: 50%; background: #17b26a; box-shadow: 0 0 0 4px #dcfae6; }
.menu-button { display: none; margin-right: .75rem; border: 0; background: transparent; color: var(--navy-900); font-size: 1.3rem; }
.content { width: min(1440px, 100%); margin: 0 auto; padding: clamp(1.25rem, 3vw, 2.5rem); }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: .55rem .9rem; border: 1px solid var(--slate-300); border-radius: 8px; color: var(--slate-700); background: white; box-shadow: var(--shadow-sm); cursor: pointer; font-size: .82rem; font-weight: 700; text-decoration: none; transition: transform .15s, box-shadow .15s, background .15s; }
.button:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgb(16 24 40 / 10%); text-decoration: none; }
.button.primary { border-color: var(--blue-700); color: white; background: linear-gradient(180deg, var(--blue-600), var(--blue-700)); }
.button.secondary { color: var(--blue-700); border-color: #b2d3ff; background: #eef6ff; }
.button.ghost { min-height: 35px; color: #b9c9db; border-color: rgb(255 255 255 / 14%); background: rgb(255 255 255 / 5%); box-shadow: none; }
.button.danger { color: var(--red-700); border-color: #fda29b; background: white; }
.button.small { min-height: 34px; padding: .4rem .65rem; font-size: .75rem; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.metric-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric-card { position: relative; min-height: 132px; padding: 1.15rem; overflow: hidden; border: 1px solid var(--slate-200); border-radius: var(--radius); background: white; box-shadow: var(--shadow-sm); }
.metric-card::after { content: ""; position: absolute; right: -28px; top: -32px; width: 92px; height: 92px; border-radius: 50%; background: linear-gradient(135deg, #eff6ff, transparent); }
.metric-card span, .metric-card small { display: block; color: var(--slate-500); font-size: .76rem; font-weight: 600; }
.metric-card strong { display: block; margin: .35rem 0 .1rem; font-size: 2rem; line-height: 1; letter-spacing: -.04em; }
.section-heading, .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1.8rem 0 .85rem; }
.panel-heading { margin: 0 0 1rem; }
.count-pill { padding: .3rem .58rem; border-radius: 999px; color: var(--slate-700); background: var(--slate-100); font-size: .73rem; font-weight: 700; }
.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.product-card { display: block; padding: 1.15rem; border: 1px solid var(--slate-200); border-radius: var(--radius); color: inherit; background: white; box-shadow: var(--shadow-sm); transition: transform .18s, box-shadow .18s, border-color .18s; }
.product-card:hover { transform: translateY(-2px); border-color: #b2d3ff; box-shadow: 0 10px 25px rgb(16 24 40 / 9%); text-decoration: none; }
.product-card-head, .inline-title { display: flex; align-items: center; justify-content: space-between; gap: .7rem; }
.product-card h3 { margin-top: 1rem; }
.product-card p { min-height: 2.7rem; color: var(--slate-500); font-size: .82rem; }
.product-icon { display: inline-grid; place-items: center; width: 42px; height: 42px; flex: 0 0 auto; border-radius: 12px; color: var(--blue-700); background: var(--blue-100); font-weight: 850; }
.product-icon.small { width: 36px; height: 36px; border-radius: 10px; }
.product-icon.large { width: 58px; height: 58px; border-radius: 16px; font-size: 1.25rem; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 1rem 0 0; padding-top: .8rem; border-top: 1px solid var(--slate-200); }
.mini-stats div { padding: 0 .5rem; border-right: 1px solid var(--slate-200); }
.mini-stats div:first-child { padding-left: 0; }
.mini-stats div:last-child { border-right: 0; }
.mini-stats dt { color: var(--slate-500); font-size: .64rem; }
.mini-stats dd { margin: .1rem 0 0; font-size: .98rem; font-weight: 800; }

.panel, .hero-panel, .success-card { padding: clamp(1rem, 2.2vw, 1.4rem); border: 1px solid var(--slate-200); border-radius: var(--radius); background: white; box-shadow: var(--shadow-sm); }
.hero-panel { display: flex; align-items: center; gap: 1rem; }
.hero-panel p { margin: .25rem 0 .5rem; color: var(--slate-500); }
.breadcrumb { display: flex; gap: .5rem; margin-bottom: 1rem; color: var(--slate-500); font-size: .78rem; }
.breadcrumb span:last-child { color: var(--slate-700); }
.two-column { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, .75fr); align-items: start; gap: 1.3rem; }
.two-column .section-heading { margin-top: 0; }
.sticky-panel { position: sticky; top: 1.2rem; }
.list-cards { display: grid; gap: .7rem; }
.list-card { display: flex; align-items: center; gap: .8rem; padding: .85rem; border: 1px solid var(--slate-200); border-radius: 11px; color: inherit; background: white; box-shadow: var(--shadow-sm); }
.list-card:hover { border-color: #b2d3ff; text-decoration: none; }
.list-card strong, td strong { display: block; }
.list-card small, td small { display: block; margin-top: .12rem; color: var(--slate-500); font-size: .7rem; }
.list-card .chevron { color: var(--slate-500); font-size: 1.6rem; }

.badge { display: inline-flex; align-items: center; padding: .25rem .5rem; border-radius: 999px; font-size: .68rem; line-height: 1.15; font-weight: 750; white-space: nowrap; }
.badge.positive { color: var(--green-700); background: var(--green-100); }
.badge.warning { color: var(--amber-700); background: var(--amber-100); }
.badge.negative { color: var(--red-700); background: var(--red-100); }
.badge.neutral { color: var(--slate-700); background: var(--slate-100); }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .79rem; }
th { padding: .7rem .75rem; border-bottom: 1px solid var(--slate-200); color: var(--slate-500); background: var(--slate-50); font-size: .68rem; letter-spacing: .03em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: .8rem .75rem; border-bottom: 1px solid var(--slate-200); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcff; }
.actions-cell { position: relative; width: 3rem; text-align: right; }
.actions-menu { position: relative; }
.actions-menu summary { display: inline-grid; width: 32px; height: 32px; place-items: center; border: 1px solid var(--slate-300); border-radius: 8px; background: white; cursor: pointer; list-style: none; font-weight: 800; }
.actions-menu summary::-webkit-details-marker { display: none; }
.actions-menu > div { position: absolute; z-index: 20; top: 38px; right: 0; width: 250px; padding: .85rem; border: 1px solid var(--slate-200); border-radius: 10px; background: white; box-shadow: var(--shadow-lg); text-align: left; }
.actions-menu form + form { margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--slate-200); }
.actions-menu label { font-size: .7rem; }
.actions-menu input { margin: .3rem 0 .55rem; }

.form-stack { display: grid; gap: .9rem; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-full { grid-column: 1 / -1; }
label { display: block; color: var(--slate-700); font-size: .76rem; font-weight: 700; }
label small { display: block; margin-top: .3rem; color: var(--slate-500); font-weight: 450; }
input, select, textarea { width: 100%; margin-top: .35rem; padding: .6rem .7rem; border: 1px solid var(--slate-300); border-radius: 8px; color: var(--navy-900); background: white; box-shadow: inset 0 1px 2px rgb(16 24 40 / 4%); }
textarea { resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #98a2b3; }
.short-input { max-width: 6rem; text-transform: uppercase; }
.form-actions { display: flex; justify-content: flex-end; }
.info-box { display: flex; flex-direction: column; padding: .8rem 1rem; border: 1px solid #b2d3ff; border-radius: 9px; color: #1849a9; background: #eff8ff; font-size: .76rem; }
.info-box.warning { border-color: #fedf89; color: #93370d; background: #fffaeb; }

.alert { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; padding: .75rem 1rem; border: 1px solid #abefc6; border-radius: 9px; color: var(--green-700); background: #ecfdf3; font-size: .8rem; }
.alert.error { border-color: #fecdca; color: var(--red-700); background: #fef3f2; }
.alert.warning { border-color: #fedf89; color: var(--amber-700); background: #fffaeb; }
.alert button { border: 0; color: inherit; background: transparent; cursor: pointer; font-size: 1.2rem; }
.empty-state { padding: 3rem 1rem; border: 1px dashed var(--slate-300); border-radius: var(--radius); color: var(--slate-500); text-align: center; }
.empty-state > span { display: block; margin-bottom: .5rem; color: #98a2b3; font-size: 2rem; }
.empty-state h3 { color: var(--navy-900); }
.empty-state.compact { padding: 1.8rem 1rem; }
.empty-inline { margin: 0; padding: 1rem; color: var(--slate-500); text-align: center; }

.success-card { width: min(700px, 100%); margin: 2rem auto; text-align: center; }
.success-icon { display: inline-grid; width: 54px; height: 54px; margin-bottom: 1rem; place-items: center; border-radius: 50%; color: var(--green-700); background: var(--green-100); font-size: 1.55rem; font-weight: 800; }
.success-card > p { color: var(--slate-500); }
.serial-box { display: flex; align-items: center; gap: .8rem; margin: 1.25rem 0 1rem; padding: 1rem; border: 1px solid #b2d3ff; border-radius: 12px; background: #f5faff; }
.serial-box code { flex: 1; overflow-wrap: anywhere; color: #1849a9; font-size: clamp(.9rem, 2.2vw, 1.2rem); font-weight: 750; letter-spacing: .06em; }
.detail-list { display: grid; grid-template-columns: repeat(2, 1fr); margin: 1rem 0; text-align: left; }
.detail-list div { padding: .7rem; border-bottom: 1px solid var(--slate-200); }
.detail-list dt { color: var(--slate-500); font-size: .68rem; }
.detail-list dd { margin: .15rem 0 0; font-size: .82rem; font-weight: 700; }
.timeline { margin-left: .4rem; border-left: 1px solid var(--slate-200); }
.timeline article { position: relative; display: flex; gap: 1rem; padding: .2rem 0 1.3rem 1.4rem; }
.timeline article:last-child { padding-bottom: .2rem; }
.timeline-dot { position: absolute; left: -5px; top: .35rem; width: 9px; height: 9px; border: 2px solid white; border-radius: 50%; background: var(--blue-600); box-shadow: 0 0 0 2px var(--blue-100); }
.timeline p { margin: .25rem 0; color: var(--slate-700); font-size: .8rem; }
.timeline small { color: var(--slate-500); }

.auth-page { overflow-x: hidden; background: var(--navy-950); }
.login-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 480px); align-items: center; min-height: 100vh; padding: clamp(1.5rem, 6vw, 6rem); gap: clamp(2rem, 8vw, 8rem); background: radial-gradient(circle at 15% 30%, #1b4674 0, #0b1d35 30%, #071426 68%); }
.login-intro { max-width: 680px; color: white; }
.login-intro .eyebrow { margin: 1.5rem 0 .7rem; color: #7db9ff; }
.login-intro h1 { max-width: 620px; font-size: clamp(2.2rem, 5vw, 4.4rem); line-height: 1.03; letter-spacing: -.055em; }
.login-intro p:last-child { max-width: 520px; color: #afc4dc; font-size: 1rem; }
.login-card { padding: clamp(1.5rem, 4vw, 2.25rem); border: 1px solid rgb(255 255 255 / 12%); border-radius: 18px; background: white; box-shadow: 0 28px 80px rgb(0 0 0 / 35%); }
.login-card h2 { margin-bottom: .35rem; font-size: 1.55rem; }
.login-card > .muted { margin-bottom: 1.4rem; font-size: .84rem; }
.security-note { margin: 1.2rem 0 0; color: var(--slate-500); font-size: .72rem; text-align: center; }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 800px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; width: min(290px, 86vw); transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .menu-button { display: inline-grid; place-items: center; }
  .server-state { display: none; }
  .two-column { grid-template-columns: 1fr; }
  .sticky-panel { position: static; }
  .login-layout { grid-template-columns: 1fr; }
  .login-intro { display: none; }
}

@media (max-width: 620px) {
  .topbar { min-height: 72px; padding: .8rem 1rem; }
  .content { padding: 1rem; }
  .metric-grid, .metric-grid.three, .product-grid, .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .form-grid .span-full { grid-column: 1; }
  .section-heading { align-items: flex-start; }
  .hero-panel { align-items: flex-start; flex-wrap: wrap; }
  .hero-panel .button { width: 100%; }
  .serial-box { flex-direction: column; }
  .serial-box .button { width: 100%; }
  .detail-list { grid-template-columns: 1fr; }
  .login-layout { padding: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
