:root {
  color-scheme: dark;
  --bg: #070a10;
  --panel: #101622;
  --panel-2: #141c2a;
  --border: #283247;
  --text: #f7f9fc;
  --muted: #929db2;
  --orange: #ff7a18;
  --orange-soft: #ff9d45;
  --cyan: #38d9f5;
  --green: #65e6a5;
  --red: #ff6b7e;
  --radius: 22px;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 78% 8%, #112031 0, transparent 34%), var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.ambient { position: fixed; pointer-events: none; filter: blur(90px); opacity: .16; border-radius: 50%; z-index: 0; }
.ambient-orange { width: 340px; height: 340px; background: var(--orange); left: -170px; top: -170px; }
.ambient-cyan { width: 300px; height: 300px; background: var(--cyan); right: -180px; top: 180px; }

.topbar { position: sticky; top: 0; z-index: 20; height: 82px; display: flex; align-items: center; justify-content: space-between; padding: 0 30px; border-bottom: 1px solid rgba(255,255,255,.08); background: rgba(7,10,16,.86); backdrop-filter: blur(20px); }
.brand { display: flex; align-items: center; gap: 13px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 50px; height: 50px; border: 1px solid rgba(255,122,24,.7); border-radius: 15px; background: linear-gradient(145deg, rgba(255,122,24,.28), rgba(255,122,24,.04)); color: white; font-weight: 900; box-shadow: 0 0 36px rgba(255,122,24,.16); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; letter-spacing: -.02em; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.env { display: inline-flex; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid #355062; border-radius: 999px; color: var(--cyan); font-size: 11px; font-weight: 800; letter-spacing: .11em; }
.env span { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }
.icon-button, .quiet-button, .text-button { border: 0; color: var(--text); background: transparent; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 12px; font-size: 21px; }
.quiet-button { color: var(--muted); padding: 8px 10px; }
.text-button { color: var(--cyan); font-weight: 700; }

.app-shell { position: relative; z-index: 1; display: grid; grid-template-columns: 220px minmax(0,1fr); max-width: 1580px; margin: 0 auto; }
.sidebar { min-height: calc(100vh - 82px); padding: 34px 20px; border-right: 1px solid rgba(255,255,255,.07); display: flex; flex-direction: column; justify-content: space-between; }
.sidebar nav { display: grid; gap: 8px; }
.nav-section-label { margin: 2px 14px 3px; color: #657086; font-size: 9px; font-weight: 900; letter-spacing: .17em; text-transform: uppercase; }
.nav-separator { height: 1px; margin: 11px 8px; background: rgba(255,255,255,.07); }
.nav-item { display: flex; align-items: center; gap: 14px; width: 100%; padding: 13px 14px; border: 1px solid transparent; border-radius: 13px; background: transparent; color: var(--muted); text-align: left; font-weight: 700; }
.nav-item span { font: 700 10px ui-monospace, SFMono-Regular, monospace; color: #5f6a7f; }
.nav-item:hover, .nav-item.active { color: white; background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.08); }
.nav-item.active span { color: var(--orange); }
.portal-link { display: grid; grid-template-columns: 18px minmax(0,1fr) auto; align-items: center; gap: 10px; width: 100%; padding: 12px 13px; border: 1px solid rgba(255,122,24,.15); border-radius: 13px; background: rgba(255,122,24,.045); color: var(--text); text-decoration: none; }
.portal-link:hover { border-color: rgba(255,122,24,.45); background: rgba(255,122,24,.1); transform: translateX(2px); }
.portal-link.customer { border-color: rgba(56,217,245,.15); background: rgba(56,217,245,.04); }
.portal-link.customer:hover { border-color: rgba(56,217,245,.42); background: rgba(56,217,245,.09); }
.portal-link > span:first-child { font: 700 10px ui-monospace, SFMono-Regular, monospace; color: var(--orange); }
.portal-link.customer > span:first-child { color: var(--cyan); }
.portal-link-copy strong, .portal-link-copy small { display: block; }
.portal-link-copy strong { font-size: 12px; }
.portal-link-copy small { margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 600; }
.portal-link b { color: #657086; font-size: 13px; }
.sidebar-note { padding: 16px; border: 1px solid rgba(56,217,245,.18); border-radius: 16px; background: rgba(56,217,245,.05); }
.sidebar-note strong { color: var(--cyan); font-size: 12px; text-transform: uppercase; letter-spacing: .12em; }
.sidebar-note p { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

main { min-width: 0; padding: 42px 44px 70px; }
.view { display: none; }
.active-view { display: block; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; margin-bottom: 26px; }
.eyebrow { margin: 0 0 8px; color: var(--orange); font-size: 11px; font-weight: 900; letter-spacing: .16em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(30px, 4vw, 48px); letter-spacing: -.045em; line-height: 1.02; }
h2 { margin-bottom: 0; font-size: 20px; letter-spacing: -.02em; }
.freshness { display: grid; grid-template-columns: 10px auto; column-gap: 8px; align-items: center; color: var(--muted); text-align: right; }
.freshness span { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 14px var(--green); }
.freshness strong { color: var(--text); font-size: 13px; }
.freshness small { grid-column: 2; font-size: 11px; }

.login-panel { max-width: 1080px; margin: 5vh auto 0; display: grid; grid-template-columns: 1.2fr .8fr; gap: 44px; align-items: center; padding: 54px; border: 1px solid var(--border); border-radius: 30px; background: linear-gradient(135deg, rgba(20,28,42,.96), rgba(10,14,22,.96)); box-shadow: 0 34px 100px rgba(0,0,0,.35); }
.login-copy h1 { font-size: clamp(38px, 5vw, 68px); }
.login-copy h1 span { color: var(--orange); }
.login-copy > p:last-child { max-width: 620px; margin: 24px 0 0; color: var(--muted); line-height: 1.7; }
.login-form { padding: 24px; border: 1px solid rgba(255,255,255,.08); border-radius: 20px; background: rgba(255,255,255,.035); }
.login-form label { display: block; margin-bottom: 10px; color: #c8cfdb; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.token-row { display: grid; gap: 10px; }
input, select { min-height: 44px; border: 1px solid var(--border); border-radius: 12px; outline: 0; background: #0b1019; color: white; padding: 0 13px; }
input:focus, select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(56,217,245,.1); }
.token-row button { min-height: 46px; border: 0; border-radius: 12px; background: linear-gradient(100deg, var(--orange), #f15a00); color: white; font-weight: 900; }
.login-form small { display: block; margin-top: 12px; color: var(--muted); line-height: 1.45; }
.form-error { min-height: 20px; margin: 10px 0 0; color: var(--red); font-size: 13px; }
.entry-menu { grid-column: 1 / -1; padding-top: 30px; border-top: 1px solid rgba(255,255,255,.07); }
.entry-menu-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 17px; }
.entry-menu-heading small { color: var(--muted); font-size: 11px; }
.entry-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.entry-card { position: relative; display: grid; grid-template-columns: 28px minmax(0,1fr) auto; align-items: center; gap: 12px; min-height: 104px; padding: 18px; overflow: hidden; border: 1px solid var(--border); border-radius: 17px; background: rgba(255,255,255,.028); color: var(--text); text-decoration: none; transition: transform .18s ease, border-color .18s ease, background .18s ease; }
.entry-card::after { content: ""; position: absolute; right: -25px; bottom: -35px; width: 90px; height: 90px; border-radius: 50%; background: var(--orange); filter: blur(35px); opacity: .12; }
.entry-card.cyan::after { background: var(--cyan); }
.entry-card.white::after { background: white; opacity: .07; }
.entry-card:hover { transform: translateY(-3px); border-color: rgba(255,122,24,.55); background: rgba(255,122,24,.055); }
.entry-card.cyan:hover { border-color: rgba(56,217,245,.5); background: rgba(56,217,245,.055); }
.entry-card.white:hover { border-color: rgba(255,255,255,.3); background: rgba(255,255,255,.06); }
.entry-card > span:nth-child(2) strong, .entry-card > span:nth-child(2) small { display: block; }
.entry-card > span:nth-child(2) strong { font-size: 14px; }
.entry-card > span:nth-child(2) small { margin-top: 7px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.entry-number { color: var(--orange); font: 800 11px ui-monospace, SFMono-Regular, monospace; }
.entry-card.cyan .entry-number { color: var(--cyan); }
.entry-card.white .entry-number { color: white; }
.entry-card b { align-self: start; color: #667287; }

.notice { display: flex; gap: 15px; padding: 18px 20px; margin-bottom: 22px; border: 1px solid rgba(56,217,245,.23); border-radius: 16px; background: rgba(56,217,245,.055); }
.notice-icon { flex: 0 0 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: rgba(56,217,245,.16); color: var(--cyan); font-weight: 900; }
.notice strong { font-size: 14px; }
.notice p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.metric { position: relative; overflow: hidden; min-height: 150px; padding: 21px; border: 1px solid var(--border); border-radius: var(--radius); background: linear-gradient(145deg, var(--panel-2), var(--panel)); }
.metric::after { content: ""; position: absolute; right: -30px; bottom: -40px; width: 110px; height: 110px; border-radius: 50%; background: var(--orange); filter: blur(40px); opacity: .12; }
.metric.cyan::after { background: var(--cyan); }
.metric.verified::after { background: var(--green); }
.metric.warning::after { background: var(--red); }
.metric span, .metric small { display: block; color: var(--muted); }
.metric span { font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: .09em; }
.metric strong { display: block; margin: 16px 0 8px; font-size: 42px; letter-spacing: -.05em; }
.metric small { font-size: 12px; }
.dashboard-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 18px; }
.panel { border: 1px solid var(--border); border-radius: var(--radius); background: rgba(16,22,34,.88); box-shadow: 0 18px 60px rgba(0,0,0,.15); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px 18px; border-bottom: 1px solid rgba(255,255,255,.06); }
.event-feed { padding: 8px 24px 16px; }
.event-row { display: grid; grid-template-columns: 10px minmax(110px,.7fr) minmax(130px,1fr) auto; gap: 12px; align-items: center; padding: 15px 0; border-bottom: 1px solid rgba(255,255,255,.055); }
.event-row:last-child { border-bottom: 0; }
.event-bullet { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); }
.event-bullet.fail { background: var(--red); }
.event-row strong { font-size: 13px; }
.event-row span, .event-row time { color: var(--muted); font-size: 12px; }
.distribution { padding: 18px 24px 24px; }
.bar-row { margin: 15px 0; }
.bar-label { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.bar-track { height: 7px; overflow: hidden; border-radius: 99px; background: #080c13; }
.bar-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--orange), var(--orange-soft)); }

.search-field { display: flex; align-items: center; gap: 8px; min-width: 270px; border: 1px solid var(--border); border-radius: 13px; background: #0b1019; padding-left: 12px; color: var(--muted); }
.search-field input { width: 100%; border: 0; background: transparent; }
.filters { display: flex; gap: 10px; }
.filters select, .filters input { min-width: 190px; }
.table-panel { overflow: hidden; }
.table-meta { display: flex; justify-content: space-between; gap: 20px; padding: 16px 22px; border-bottom: 1px solid rgba(255,255,255,.06); color: var(--muted); font-size: 12px; }
.table-meta strong { color: white; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 20px; text-align: left; white-space: nowrap; border-bottom: 1px solid rgba(255,255,255,.055); }
th { color: #7f8aa0; font-size: 10px; letter-spacing: .11em; text-transform: uppercase; }
td { color: #cfd5df; font-size: 13px; }
tbody tr:hover { background: rgba(255,255,255,.025); }
.serial { color: white; font-weight: 800; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.badge { display: inline-flex; align-items: center; padding: 5px 8px; border: 1px solid; border-radius: 999px; font-size: 10px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.badge.historical { color: var(--orange-soft); border-color: rgba(255,157,69,.3); background: rgba(255,122,24,.08); }
.badge.verified { color: var(--green); border-color: rgba(101,230,165,.3); background: rgba(101,230,165,.08); }
.badge.failure { color: var(--red); border-color: rgba(255,107,126,.3); background: rgba(255,107,126,.08); }
.badge.neutral { color: var(--cyan); border-color: rgba(56,217,245,.26); background: rgba(56,217,245,.07); }
.empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.toast { position: fixed; z-index: 40; right: 22px; bottom: 22px; transform: translateY(20px); opacity: 0; pointer-events: none; max-width: 360px; padding: 13px 16px; border: 1px solid var(--border); border-radius: 13px; background: #151c28; color: white; box-shadow: 0 16px 50px rgba(0,0,0,.35); transition: .2s ease; }
.toast.show { transform: translateY(0); opacity: 1; }
.skeleton-block:empty { min-height: 200px; background: linear-gradient(90deg, transparent, rgba(255,255,255,.035), transparent); background-size: 200% 100%; animation: shimmer 1.5s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; padding: 12px 20px; border-right: 0; border-bottom: 1px solid rgba(255,255,255,.07); }
  .sidebar nav { grid-template-columns: repeat(3,1fr); }
  .nav-section-label, .nav-separator { display: none; }
  .portal-link { display: flex; justify-content: center; min-height: 48px; padding: 9px 8px; }
  .portal-link > span:first-child, .portal-link b { display: none; }
  .portal-link-copy { text-align: center; }
  .portal-link-copy small { display: none; }
  .sidebar-note { display: none; }
  .nav-item { justify-content: center; }
  main { padding: 28px 22px 60px; }
  .metric-grid { grid-template-columns: repeat(2,1fr); }
  .dashboard-grid, .login-panel { grid-template-columns: 1fr; }
  .login-panel { margin-top: 2vh; padding: 36px; }
  .entry-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .topbar { height: 72px; padding: 0 15px; }
  .brand small, .env { display: none; }
  .app-shell { min-height: calc(100vh - 72px); }
  .sidebar { position: sticky; top: 72px; z-index: 18; background: rgba(7,10,16,.95); }
  .nav-item { padding: 11px 6px; font-size: 12px; }
  .nav-item span { display: none; }
  main { padding: 24px 15px 50px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric { min-height: 128px; padding: 16px; }
  .metric strong { font-size: 34px; }
  .filters { flex-direction: column; }
  .filters select, .filters input, .search-field { width: 100%; min-width: 0; }
  .table-meta { flex-direction: column; gap: 5px; }
  .login-panel { padding: 25px; border-radius: 22px; }
  .entry-menu-heading { align-items: flex-start; flex-direction: column; gap: 6px; }
}
