:root {
  color-scheme: light;
  --navy-950: #102d45;
  --navy-900: #173a55;
  --navy-800: #214964;
  --teal-700: #087e79;
  --teal-600: #0b918a;
  --teal-100: #e7f4f2;
  --ink: #172d3c;
  --muted: #6b7d89;
  --line: #e2e8eb;
  --surface: #ffffff;
  --canvas: #f4f7f8;
  --danger: #a43838;
  --danger-bg: #fff0ef;
  --success: #14724c;
  --success-bg: #e9f6ee;
  --shadow: 0 22px 70px rgba(14, 39, 57, .18);
  font-family: 'Segoe UI', Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--canvas); color: var(--ink); }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.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; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(380px, 1fr) minmax(420px, 1.05fr); background: var(--surface); }
.login-panel { width: min(100%, 520px); justify-self: center; align-self: center; padding: 56px 54px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand-login { color: var(--navy-950); margin-bottom: 74px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px 10px 10px 3px; background: var(--teal-600); color: white; font: 800 22px Manrope, sans-serif; }
.brand strong { display: block; font: 800 15px 'Segoe UI', Arial, sans-serif; letter-spacing: .14em; }
.brand small { display: block; margin-top: 3px; color: #9ab0bd; font-size: 11px; letter-spacing: .02em; }
.brand-login small { color: var(--muted); }
.eyebrow { margin: 0 0 12px; color: var(--teal-700); font-size: 10px; font-weight: 700; letter-spacing: .14em; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: 'Segoe UI', Arial, sans-serif; }
.login-panel h1 { margin-bottom: 12px; font-size: clamp(28px, 3vw, 36px); letter-spacing: -.04em; line-height: 1.18; }
.muted { color: var(--muted); line-height: 1.65; }
.login-copy { margin-bottom: 32px; font-size: 14px; }
.form-stack { display: grid; gap: 10px; }
label { color: #294250; font-size: 12px; font-weight: 700; }
input { width: 100%; min-height: 44px; border: 1px solid #cbd7dc; border-radius: 5px; background: #fff; color: var(--ink); padding: 0 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus { border-color: var(--teal-600); box-shadow: 0 0 0 3px rgba(11, 145, 138, .13); }
.form-stack label:not(:first-child) { margin-top: 10px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 40px; border: 1px solid transparent; border-radius: 5px; padding: 0 15px; font-size: 12px; font-weight: 700; transition: background .15s, border-color .15s, transform .15s; }
.button:focus-visible, .icon-button:focus-visible, .nav-item:focus-visible, .account-popover button:focus-visible { outline: 3px solid rgba(11, 145, 138, .45); outline-offset: 2px; }
.button:active { transform: translateY(1px); }
.button-primary { background: var(--teal-700); color: #fff; }
.button-primary:hover { background: #066e69; }
.button-primary:disabled { cursor: wait; opacity: .65; }
.button-secondary { background: #fff; color: #345262; border-color: #d8e1e5; }
.button-secondary:hover { background: #f7fafb; border-color: #b8c9d0; }
.button-full { width: 100%; min-height: 46px; margin-top: 14px; }
.form-error, .inline-error { padding: 10px 12px; border: 1px solid #f0c9c6; border-radius: 5px; background: var(--danger-bg); color: var(--danger); font-size: 12px; line-height: 1.5; }
.login-footnote { margin-top: 44px; color: #758793; font-size: 11px; line-height: 1.7; }
.login-footnote code { color: #355569; }
.login-aside { position: relative; min-height: 100vh; overflow: hidden; display: flex; align-items: flex-end; padding: 11%; background: var(--navy-950); color: white; }
.login-aside::before { position: absolute; inset: 0; content: ''; background: linear-gradient(130deg, rgba(11,145,138,.18), transparent 48%), radial-gradient(ellipse at 80% 15%, rgba(78,144,169,.22), transparent 44%); }
.aside-orbit { position: absolute; border: 1px solid rgba(185, 224, 224, .13); border-radius: 50%; }
.orbit-one { width: 600px; height: 600px; top: -180px; right: -90px; }
.orbit-two { width: 420px; height: 420px; top: -90px; right: 0; }
.aside-content { position: relative; max-width: 510px; margin-bottom: 2vh; }
.aside-kicker, .aside-caption { font-size: 9px; letter-spacing: .17em; color: #94b9c3; font-weight: 700; }
.aside-content h2 { margin: 24px 0 18px; font-size: clamp(32px, 4vw, 52px); line-height: 1.1; letter-spacing: -.045em; }
.aside-content p { max-width: 390px; margin-bottom: 28px; color: #bdcdd5; font-size: 14px; line-height: 1.7; }
.aside-rule { width: 48px; height: 3px; margin-bottom: 22px; background: #30b5a6; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; min-height: 540px; padding: 26px 16px 18px; background: var(--navy-950); color: white; }
.sidebar .brand { padding: 0 10px 28px; }
.sidebar .brand-mark { width: 38px; height: 38px; border-radius: 9px 9px 9px 3px; background: #149c91; }
.sidebar-label { padding: 16px 12px 10px; color: #7793a2; font-size: 9px; font-weight: 700; letter-spacing: .16em; }
.side-nav { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border: 0; background: transparent; color: #c0ced5; text-align: left; font-size: 12px; font-weight: 600; }
.nav-item:hover { background: rgba(255,255,255,.06); color: white; }
.nav-item.is-active { background: #214b64; color: #fff; box-shadow: inset 3px 0 #39b6a7; }
.nav-icon { width: 18px; color: #72c5bd; font-size: 16px; text-align: center; }
.sidebar-bottom { display: grid; gap: 11px; margin-top: auto; padding: 18px 10px 0; border-top: 1px solid rgba(255,255,255,.1); color: #a8bbc5; font-size: 11px; }
.sidebar-status { display: flex; align-items: center; gap: 8px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #48c799; box-shadow: 0 0 0 3px rgba(72,199,153,.12); }
.sidebar-version { color: #7893a1; font-size: 10px; }
.main-column { min-width: 0; }
.topbar { height: 70px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(20px, 4vw, 52px); border-bottom: 1px solid var(--line); background: var(--surface); }
.breadcrumb { display: flex; gap: 10px; align-items: center; color: #758894; font-size: 11px; }
.breadcrumb strong { color: #294656; font-weight: 700; }
.crumb-divider { color: #b7c3c8; }
.account-menu { position: relative; display: flex; align-items: center; gap: 9px; }
.avatar { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--teal-100); color: var(--teal-700); font-size: 11px; font-weight: 800; }
.account-name { max-width: 160px; overflow: hidden; color: #3d5664; font-size: 11px; font-weight: 700; text-overflow: ellipsis; }
.icon-button { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 4px; background: transparent; color: #607683; font-size: 19px; }
.icon-button:hover { background: #f0f5f6; }
.account-popover { position: absolute; z-index: 5; top: 40px; right: 0; width: 180px; padding: 5px; border: 1px solid var(--line); border-radius: 5px; background: #fff; box-shadow: 0 12px 30px rgba(16,45,69,.12); }
.account-popover button { width: 100%; padding: 10px; border: 0; border-radius: 3px; background: #fff; color: #345262; text-align: left; font-size: 12px; }
.account-popover button:hover { background: #f2f7f8; }
.content-area { width: min(100%, 1500px); margin: 0 auto; padding: 39px clamp(20px, 4vw, 52px) 48px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 25px; }
.page-heading h1 { margin-bottom: 8px; color: var(--navy-950); font-size: 29px; letter-spacing: -.04em; }
.page-heading .muted { margin-bottom: 0; font-size: 12px; }
.plus { font-size: 17px; font-weight: 400; }
.metric-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.metric-card { min-height: 110px; display: grid; align-content: start; gap: 7px; padding: 17px 19px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
.metric-label { color: #758995; font-size: 9px; font-weight: 700; letter-spacing: .13em; }
.metric-card strong { color: var(--navy-950); font: 700 25px 'Segoe UI', Arial, sans-serif; }
.metric-note { color: #8a9aa3; font-size: 10px; }
.data-panel { border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
.panel-heading { min-height: 79px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 20px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin-bottom: 4px; color: #203d4e; font-size: 14px; letter-spacing: -.02em; }
.panel-heading p { margin: 0; color: #7c8d97; font-size: 10px; line-height: 1.5; }
.panel-heading .button { min-height: 34px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { height: 39px; padding: 0 18px; border-bottom: 1px solid #edf1f3; background: #fafcfc; color: #81919a; font-size: 9px; font-weight: 700; letter-spacing: .1em; white-space: nowrap; }
td { height: 63px; padding: 9px 18px; border-bottom: 1px solid #edf1f3; color: #526a77; font-size: 11px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
.service-name { display: block; color: #253f4e; font-weight: 700; }
.service-id { display: block; max-width: 210px; margin-top: 4px; overflow: hidden; color: #9aa8ae; font: 10px ui-monospace, SFMono-Regular, Consolas, monospace; text-overflow: ellipsis; }
.key-prefix { display: inline-block; padding: 5px 7px; border-radius: 3px; background: #f2f6f7; color: #476372; font: 10px ui-monospace, SFMono-Regular, Consolas, monospace; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 3px; font-size: 10px; font-weight: 700; }
.badge::before { width: 5px; height: 5px; border-radius: 50%; background: currentColor; content: ''; }
.badge-active { background: var(--success-bg); color: var(--success); }
.badge-revoked, .badge-disabled { background: #f1f3f4; color: #76858d; }
.row-actions { display: flex; justify-content: flex-end; gap: 7px; }
.text-button { border: 0; background: transparent; color: var(--teal-700); font-size: 10px; font-weight: 700; }
.text-button:hover { text-decoration: underline; }
.text-button-danger { color: var(--danger); }
.text-button:disabled { cursor: not-allowed; color: #9eaaaf; text-decoration: none; }
.loading-state, .empty-state { padding: 35px 20px; color: #758894; text-align: center; font-size: 11px; }
.empty-mark { display: grid; width: 40px; height: 40px; margin: 0 auto 12px; place-items: center; border-radius: 50%; background: var(--teal-100); color: var(--teal-700); font-size: 19px; }
.empty-state h3 { margin-bottom: 6px; color: #294656; font-size: 14px; }
.empty-state p { margin-bottom: 16px; color: #7c8d97; font-size: 11px; }
.inline-error { margin: 14px; }
.security-note { display: flex; align-items: flex-start; gap: 9px; margin: 16px 2px; color: #71858f; font-size: 10px; line-height: 1.6; }
.security-note span { color: var(--teal-700); font-size: 16px; line-height: 1; }

.dialog-card { width: min(94vw, 480px); max-height: min(90vh, 760px); padding: 0; overflow: auto; border: 1px solid #d8e2e5; border-radius: 7px; background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.dialog-card::backdrop { background: rgba(11, 31, 46, .58); backdrop-filter: blur(2px); }
.dialog-form { display: grid; gap: 9px; padding: 25px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 2px; }
.dialog-heading h2, .dialog-form h2 { margin: 0 0 4px; color: var(--navy-950); font-size: 21px; letter-spacing: -.035em; }
.dialog-form > .muted { margin: 0 0 8px; font-size: 11px; }
.dialog-close { flex: 0 0 auto; font-size: 22px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 13px; }
.field-hint { color: #7c8d97; font-size: 10px; line-height: 1.5; }
.copy-field { display: flex; gap: 8px; }
.copy-field input { font: 11px ui-monospace, SFMono-Regular, Consolas, monospace; }
.copy-field .button { flex: 0 0 auto; }
.copy-all-button { justify-self: start; }
.credential-dialog { text-align: left; }
.credential-symbol { width: 39px; height: 39px; display: grid; margin-bottom: 4px; place-items: center; border-radius: 50%; background: var(--success-bg); color: var(--success); font-size: 18px; font-weight: 800; }
.credential-dialog .dialog-form { gap: 11px; }
.toast { position: fixed; z-index: 20; right: 24px; bottom: 22px; max-width: min(400px, calc(100vw - 36px)); padding: 12px 16px; border-radius: 5px; background: var(--navy-950); color: #fff; box-shadow: 0 9px 30px rgba(16,45,69,.2); font-size: 11px; }

@media (max-width: 900px) {
  .login-shell { grid-template-columns: minmax(350px, .95fr) minmax(300px, 1.05fr); }
  .login-panel { padding: 40px 34px; }
  .brand-login { margin-bottom: 48px; }
  .app-shell { grid-template-columns: 208px minmax(0, 1fr); }
  .sidebar { padding-right: 10px; padding-left: 10px; }
  .content-area { padding-top: 30px; }
  th, td { padding-right: 12px; padding-left: 12px; }
}
@media (max-width: 680px) {
  .login-shell { display: block; background: var(--canvas); }
  .login-panel { width: min(100%, 470px); min-height: 100vh; padding: 32px 25px; background: #fff; }
  .brand-login { margin-bottom: 54px; }
  .login-aside { display: none; }
  .app-shell { display: block; }
  .sidebar { position: sticky; z-index: 4; top: 0; height: auto; min-height: 0; padding: 10px 14px 0; }
  .sidebar .brand { padding: 0 4px 10px; }
  .sidebar .brand-mark { width: 32px; height: 32px; font-size: 18px; }
  .sidebar .brand small { font-size: 10px; }
  .sidebar-label, .sidebar-bottom { display: none; }
  .side-nav { display: flex; gap: 4px; overflow-x: auto; }
  .nav-item { min-height: 39px; padding: 0 11px; white-space: nowrap; }
  .nav-item.is-active { box-shadow: inset 0 -3px #39b6a7; }
  .topbar { height: 55px; padding: 0 16px; }
  .breadcrumb { font-size: 10px; }
  .account-name { max-width: 84px; font-size: 10px; }
  .content-area { padding: 27px 15px 35px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 14px; }
  .page-heading h1 { font-size: 25px; }
  .metric-row { gap: 8px; }
  .metric-card { min-height: 94px; padding: 12px 10px; }
  .metric-label { font-size: 8px; letter-spacing: .08em; }
  .metric-card strong { font-size: 22px; }
  .metric-note { font-size: 9px; }
  .panel-heading { align-items: flex-start; padding: 14px; }
  .panel-heading p { max-width: 235px; }
  th, td { padding-right: 11px; padding-left: 11px; }
  .table-scroll { margin: 0 -1px; }
  .dialog-form { padding: 20px; }
}
@media (max-width: 390px) {
  .metric-row { grid-template-columns: 1fr; }
  .metric-card { min-height: auto; grid-template-columns: 1fr auto; align-items: center; }
  .metric-label, .metric-note { grid-column: 1; }
  .metric-card strong { grid-column: 2; grid-row: 1 / span 2; }
  .account-name { display: none; }
}
