:root {
  --navy: #080809;
  --navy-2: #111113;
  --blue: #d8d8dc;
  --blue-soft: rgba(255,255,255,.06);
  --ink: #f5f5f7;
  --muted: #a1a1a6;
  --line: rgba(255,255,255,.08);
  --surface: rgba(20,20,22,.78);
  --page: #000;
  --green: #66d19e;
  --amber: #d28316;
  --red: #d94a58;
  --shadow: 0 24px 48px -16px rgba(0,0,0,.55);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--ink); background: var(--page); font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", "Helvetica Neue", Arial, sans-serif; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.brand { display: flex; align-items: center; gap: 11px; font-size: 17px; font-weight: 760; letter-spacing: .01em; }
.brand--light { color: white; }
.brand--dark { color: var(--navy); }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; color: white; border-radius: 10px; background: linear-gradient(145deg, #5a8cff, #2458e4); box-shadow: 0 7px 20px rgba(47, 107, 255, .36); }
.eyebrow { margin: 0 0 12px; font-size: 11px; font-weight: 800; letter-spacing: .18em; color: rgba(255,255,255,.58); }
.eyebrow--blue { color: var(--blue); }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(420px, .82fr); background: white; }
.login-visual { position: relative; overflow: hidden; display: flex; flex-direction: column; padding: 46px 7vw; color: white; background:
  radial-gradient(circle at 74% 23%, rgba(68, 121, 255, .37), transparent 32%),
  radial-gradient(circle at 16% 82%, rgba(44, 191, 192, .16), transparent 28%),
  linear-gradient(145deg, #07122c 0%, #0c204a 54%, #102e6d 100%); }
.login-visual::before { content: ""; position: absolute; inset: 0; opacity: .28; background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px); background-size: 52px 52px; mask-image: linear-gradient(to bottom right, black, transparent 78%); }
.login-visual::after { content: ""; position: absolute; width: 460px; height: 460px; right: -160px; bottom: -170px; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; box-shadow: 0 0 0 70px rgba(255,255,255,.025), 0 0 0 140px rgba(255,255,255,.02); }
.login-visual > * { position: relative; z-index: 1; }
.login-copy { margin: auto 0; max-width: 660px; }
.login-copy h1 { margin: 0; font-size: clamp(43px, 5vw, 72px); line-height: 1.12; letter-spacing: -.045em; }
.login-copy p:last-child { max-width: 530px; margin: 26px 0 0; color: rgba(255,255,255,.67); font-size: 17px; line-height: 1.8; }
.login-metrics { display: flex; gap: 42px; padding-top: 26px; border-top: 1px solid rgba(255,255,255,.12); }
.login-metrics div { display: flex; flex-direction: column; gap: 5px; }
.login-metrics strong { font-size: 15px; }
.login-metrics span { font-size: 12px; color: rgba(255,255,255,.5); }
.login-panel { display: grid; place-items: center; padding: 45px; }
.login-card { width: min(420px, 100%); }
.login-card > .brand { margin-bottom: 76px; }
.login-heading { margin-bottom: 33px; }
.login-heading h2 { margin: 0 0 9px; font-size: 31px; letter-spacing: -.03em; }
.login-heading p, .login-security { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.login-card label, .form-grid label { display: grid; gap: 8px; margin-bottom: 18px; color: #4e596d; font-size: 13px; font-weight: 650; }
input, select, textarea { width: 100%; border: 1px solid #dfe3ea; border-radius: 10px; background: white; color: var(--ink); outline: none; transition: .18s border, .18s box-shadow; }
input, select { height: 44px; padding: 0 13px; }
textarea { min-height: 92px; padding: 12px 13px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #7ea2ff; box-shadow: 0 0 0 3px rgba(47, 107, 255, .1); }
.form-error { margin: -5px 0 14px; color: var(--red); font-size: 13px; }
.login-security { margin-top: 20px; text-align: center; font-size: 11px; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 0 15px; border: 0; border-radius: 9px; font-size: 13px; font-weight: 700; text-decoration: none; transition: .18s transform, .18s opacity, .18s box-shadow; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.button--large { width: 100%; height: 48px; margin-top: 7px; }
.button--primary { color: white; background: linear-gradient(135deg, #326fff, #2458df); box-shadow: 0 9px 22px rgba(47, 107, 255, .25); }
.button--secondary { color: #34405a; border: 1px solid var(--line); background: white; }
.button--danger { color: #b82f3d; background: #fff0f2; }
.button--success { color: #087454; background: #e9f8f2; }
.button--text { min-height: 30px; padding: 0 8px; color: var(--blue); background: transparent; }
.button--small { min-height: 30px; padding: 0 10px; font-size: 12px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 18px 18px; color: white; background: linear-gradient(175deg, #0a1734, #0b1c42); }
.sidebar-brand { padding: 0 8px 31px; border-bottom: 1px solid rgba(255,255,255,.08); }
.main-nav { display: grid; gap: 6px; margin-top: 23px; }
.main-nav button { display: flex; align-items: center; gap: 12px; height: 45px; padding: 0 13px; color: rgba(255,255,255,.62); border: 0; border-radius: 9px; background: transparent; text-align: left; font-size: 13px; font-weight: 650; }
.main-nav button:hover { color: white; background: rgba(255,255,255,.06); }
.main-nav button.is-active { color: white; background: linear-gradient(90deg, rgba(67,116,255,.28), rgba(67,116,255,.10)); box-shadow: inset 3px 0 #5b8cff; }
.nav-icon { display: inline-grid; place-items: center; width: 22px; font-size: 17px; }
.sidebar-links { display: grid; gap: 12px; margin-top: auto; padding: 19px 10px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-links a { display: flex; justify-content: space-between; color: rgba(255,255,255,.53); font-size: 12px; text-decoration: none; }
.sidebar-links a:hover { color: white; }
.sidebar-user { display: grid; grid-template-columns: 34px 1fr 28px; align-items: center; gap: 10px; padding: 14px 9px 5px; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: white; background: #416fe4; font-weight: 800; }
.sidebar-user div { min-width: 0; display: grid; gap: 2px; }
.sidebar-user strong { overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.sidebar-user small { color: rgba(255,255,255,.43); font-size: 10px; }
.sidebar-user button { color: rgba(255,255,255,.55); border: 0; background: transparent; font-size: 17px; }

.main-area { min-width: 0; }
.topbar { min-height: 105px; display: flex; align-items: center; justify-content: space-between; gap: 30px; padding: 25px 36px 21px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.93); backdrop-filter: blur(14px); }
.topbar h1 { margin: 0; font-size: 24px; letter-spacing: -.025em; }
.topbar .eyebrow { margin-bottom: 7px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.system-state { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.system-state i { width: 8px; height: 8px; border-radius: 50%; background: #20b47b; box-shadow: 0 0 0 5px rgba(32,180,123,.1); }
.page-content { padding: 30px 36px 60px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.page-head h2 { margin: 0 0 5px; font-size: 20px; }
.page-head p { margin: 0; color: var(--muted); font-size: 13px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat-card, .panel { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 3px 15px rgba(24,39,75,.035); }
.stat-card { position: relative; overflow: hidden; min-height: 130px; padding: 20px; }
.stat-card::after { content: ""; position: absolute; width: 84px; height: 84px; right: -24px; top: -26px; border-radius: 50%; background: var(--tone, #edf3ff); }
.stat-card span { display: block; color: var(--muted); font-size: 12px; }
.stat-card strong { display: block; margin: 12px 0 7px; font-size: 26px; letter-spacing: -.035em; }
.stat-card small { color: #8892a5; font-size: 11px; }
.stat-card--blue { --tone: #e8f0ff; }
.stat-card--green { --tone: #e6f7f0; }
.stat-card--amber { --tone: #fff4df; }
.stat-card--violet { --tone: #f0eaff; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .55fr); gap: 17px; margin-top: 17px; }
.panel { padding: 20px; }
.panel-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.panel-title h3 { margin: 0; font-size: 15px; }
.panel-title span { color: var(--muted); font-size: 11px; }
.service-bars { display: grid; gap: 14px; }
.service-bar-head { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 7px; font-size: 12px; }
.service-bar-head span:last-child { color: var(--muted); }
.bar-track { height: 7px; overflow: hidden; border-radius: 99px; background: #eef1f6; }
.bar-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #3f73f6, #63a3ff); }
.policy-list { display: grid; gap: 14px; }
.policy-item { display: grid; grid-template-columns: 34px 1fr; gap: 11px; }
.policy-item b { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; color: var(--blue); background: var(--blue-soft); font-size: 13px; }
.policy-item strong { display: block; font-size: 12px; margin-bottom: 3px; }
.policy-item span { display: block; color: var(--muted); font-size: 11px; line-height: 1.5; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.toolbar input, .toolbar select { width: auto; min-width: 190px; height: 38px; }
.table-panel { overflow: hidden; padding: 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th { height: 43px; padding: 0 14px; color: #7c879b; background: #fafbfc; text-align: left; font-size: 10px; letter-spacing: .045em; font-weight: 750; }
.data-table td { padding: 13px 14px; border-top: 1px solid #edf0f4; vertical-align: middle; }
.data-table tr:hover td { background: #fbfcff; }
.data-table strong { font-size: 12px; }
.subtext { display: block; margin-top: 4px; color: #8b95a7; font-size: 10px; }
.money { font-variant-numeric: tabular-nums; font-weight: 760; }
.actions { display: flex; flex-wrap: wrap; gap: 4px; }
.badge { display: inline-flex; align-items: center; gap: 5px; min-height: 23px; padding: 0 8px; border-radius: 99px; font-size: 10px; font-weight: 750; white-space: nowrap; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge--success { color: #0a805c; background: #eaf8f2; }
.badge--danger { color: #c53c4a; background: #fff0f2; }
.badge--warning { color: #ae6e0f; background: #fff5e4; }
.badge--neutral { color: #667187; background: #eff2f6; }
.badge--blue { color: #2f63df; background: #edf3ff; }
.client-name { display: flex; align-items: center; gap: 10px; }
.client-logo { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; color: #305ed0; background: #ebf1ff; font-weight: 800; }
.key-list { display: grid; gap: 7px; margin-top: 8px; }
.key-chip { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border: 1px solid #e8ebf1; border-radius: 8px; background: #fafbfc; }
.key-chip code { color: #59657a; font-size: 10px; }
.empty-state { display: grid; place-items: center; min-height: 260px; padding: 35px; color: var(--muted); text-align: center; }
.empty-state b { display: grid; place-items: center; width: 50px; height: 50px; margin-bottom: 12px; border-radius: 14px; color: var(--blue); background: var(--blue-soft); font-size: 22px; }
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 14px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }

.modal-backdrop { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: 25px; background: rgba(7, 16, 35, .58); backdrop-filter: blur(5px); }
.modal-card { position: relative; width: min(570px, 100%); max-height: calc(100vh - 50px); overflow: auto; padding: 28px; border-radius: 17px; background: white; box-shadow: var(--shadow); }
.modal-card--wide { width: min(760px, 100%); }
.modal-close { position: absolute; top: 17px; right: 17px; width: 30px; height: 30px; color: #758096; border: 0; border-radius: 8px; background: #f2f4f7; font-size: 20px; }
.modal-title { margin: 0 35px 7px 0; font-size: 20px; }
.modal-subtitle { margin: 0 0 23px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.secret-box { margin-top: 20px; padding: 15px; border: 1px solid #cddafd; border-radius: 10px; background: #f3f7ff; }
.secret-box p { margin: 0 0 10px; color: #405171; font-size: 11px; }
.secret-value { display: flex; align-items: center; gap: 8px; }
.secret-value code { flex: 1; overflow-wrap: anywhere; padding: 10px; border-radius: 7px; color: #214493; background: white; font-size: 11px; }
.warning-box { padding: 11px 13px; border-radius: 9px; color: #995f08; background: #fff5e3; font-size: 11px; line-height: 1.55; }
.toast { position: fixed; z-index: 80; right: 25px; bottom: 25px; max-width: 380px; padding: 13px 17px; color: white; border-radius: 10px; background: #14213e; box-shadow: var(--shadow); font-size: 12px; animation: toast-in .22s ease-out; }
.toast.is-error { background: #a92f3d; }
.loading-line { height: 3px; overflow: hidden; border-radius: 99px; background: #e7ebf2; }
.loading-line::after { content: ""; display: block; width: 35%; height: 100%; background: var(--blue); animation: loading 1s infinite ease-in-out; }

@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes loading { from { transform: translateX(-110%); } to { transform: translateX(350%); } }

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-panel { min-height: 100vh; padding: 30px; }
  .app-shell { grid-template-columns: 72px minmax(0, 1fr); }
  .sidebar { padding-inline: 11px; }
  .sidebar-brand span:last-child, .main-nav button:not(.is-active) > :not(.nav-icon), .main-nav button.is-active > :not(.nav-icon), .sidebar-links, .sidebar-user div, .sidebar-user button { display: none; }
  .sidebar-brand { justify-content: center; padding-inline: 0; }
  .main-nav button { justify-content: center; padding: 0; }
  .sidebar-user { display: flex; justify-content: center; padding-inline: 0; }
  .topbar, .page-content { padding-left: 20px; padding-right: 20px; }
  .topbar-actions .system-state { display: none; }
  .data-table { min-width: 850px; }
  .table-panel { overflow-x: auto; }
}
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; gap: 14px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
}

/* AIPACS dark workspace — aligned with ferrylive.cn/dev. */
body { background: #000; }
body::before { content: ""; position: fixed; z-index: -1; inset: 0; pointer-events: none; opacity: .28; background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px); background-size: 48px 48px; mask-image: radial-gradient(circle at 50% 12%, black, transparent 68%); }
.brand--dark, .brand--light { color: var(--ink); }
.brand-mark { color: var(--ink); border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.06); box-shadow: none; }
.eyebrow { color: var(--quiet, #6e6e73); }
.eyebrow--blue { color: #77777d; }

.login-shell { background: #000; }
.login-visual { min-height: 100vh; padding: 46px 7vw; color: var(--ink); background: #000; }
.login-visual::before { opacity: .28; background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px); background-size: 48px 48px; mask-image: radial-gradient(circle at 52% 50%, black, transparent 73%); }
.login-visual::after { display: none; }
.login-copy { max-width: 470px; }
.login-copy h1 { font-size: clamp(42px, 4.4vw, 64px); }
.login-copy p:last-child { max-width: 450px; color: var(--muted); font-size: 15px; }
.login-panel { background: #000; }
.login-card { width: min(356px, 100%); padding: 26px 22px 22px; border: 1px solid var(--line); border-radius: 20px; background: rgba(20,20,22,.76); box-shadow: inset 0 1px rgba(255,255,255,.04), 0 24px 48px -16px rgba(0,0,0,.5); backdrop-filter: blur(20px); }
.login-card > .brand { margin-bottom: 36px; }
.login-heading { margin-bottom: 27px; }
.login-heading h2 { margin-bottom: 7px; font-size: 22px; }
.login-heading p, .login-security { color: var(--muted); font-size: 11px; }
.login-card label, .form-grid label { color: var(--muted); font-size: 11px; font-weight: 500; }

input, select, textarea { color: var(--ink); border: 1px solid var(--line); background: rgba(255,255,255,.04); }
input:focus, select:focus, textarea:focus { border-color: rgba(255,255,255,.22); box-shadow: 0 0 0 3px rgba(255,255,255,.05); }
.button--primary { color: #111113; background: #f5f5f7; box-shadow: none; }
.button--secondary { color: var(--ink); border-color: var(--line); background: rgba(255,255,255,.04); }
.button--text { color: #d4d4d8; }
.button--danger { color: #ff9da7; background: rgba(217,74,88,.12); }
.button--success { color: #9bdbbd; background: rgba(102,209,158,.10); }

.app-shell { background: #000; }
.sidebar { border-right: 1px solid var(--line); background: #0b0b0c; }
.main-nav button { color: #77777d; }
.main-nav button:hover { color: var(--ink); background: rgba(255,255,255,.05); }
.main-nav button.is-active { color: var(--ink); background: rgba(255,255,255,.07); box-shadow: inset 2px 0 #f5f5f7; }
.avatar { color: #111; background: #e2e2e5; }
.main-area { background: #000; }
.topbar { border-color: var(--line); background: rgba(0,0,0,.82); }
.system-state i { background: var(--green); box-shadow: 0 0 0 4px rgba(102,209,158,.08); }

.stat-card, .panel { border-color: var(--line); background: var(--surface); box-shadow: inset 0 1px rgba(255,255,255,.025); }
.stat-card::after { opacity: .08; }
.stat-card--blue, .stat-card--green, .stat-card--amber, .stat-card--violet { --tone: #fff; }
.bar-track { background: rgba(255,255,255,.06); }
.bar-track i { background: #d8d8dc; }
.policy-item b { color: #d8d8dc; background: rgba(255,255,255,.06); }

.data-table th { color: #77777d; background: rgba(255,255,255,.025); }
.data-table td { border-color: var(--line); }
.data-table tr:hover td { background: rgba(255,255,255,.025); }
.service-table-panel { overflow-x: auto; }
.service-table { min-width: 1120px; }
.service-table th:nth-child(1) { width: 250px; }
.service-table th:nth-child(2) { width: 78px; }
.service-table th:nth-child(3) { width: 350px; }
.service-table th:nth-child(4) { width: 112px; }
.service-table th:nth-child(5) { width: 90px; }
.service-table th:nth-child(6) { width: 62px; }
.service-table th:nth-child(7) { width: 145px; }
.service-table td:nth-child(3) code { white-space: nowrap; }
.service-table .service-price { width: 88px; min-width: 88px; }
.service-table .service-timeout { width: 72px; min-width: 72px; }
.service-table td:last-child { white-space: nowrap; }
.subtext { color: #77777d; }
.client-logo { color: #d8d8dc; background: rgba(255,255,255,.07); }
.key-chip { border-color: var(--line); background: rgba(255,255,255,.025); }
.key-chip code { color: var(--muted); }
.badge--success { color: #9bdbbd; background: rgba(102,209,158,.10); }
.badge--danger { color: #ff9da7; background: rgba(217,74,88,.12); }
.badge--warning { color: #e8bb79; background: rgba(210,131,22,.12); }
.badge--neutral, .badge--blue { color: #c6c6ca; background: rgba(255,255,255,.07); }
.pagination { border-color: var(--line); }

.modal-backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(12px); }
.modal-card { border: 1px solid rgba(255,255,255,.12); background: #121214; }
.modal-close { color: var(--muted); border: 1px solid var(--line); background: rgba(255,255,255,.04); }
.modal-actions { border-color: var(--line); }
.secret-box { border-color: rgba(255,255,255,.14); background: rgba(255,255,255,.04); }
.secret-box p { color: var(--muted); }
.secret-value code { color: var(--ink); background: #09090a; }
.warning-box { color: #e8bb79; background: rgba(210,131,22,.12); }
.toast { background: #27272a; }
.loading-line { background: rgba(255,255,255,.06); }
.loading-line::after { background: #d8d8dc; }

@media (max-width: 820px) {
  .login-panel { background: #000; }
}
