:root {
    color-scheme: dark;
    --bg: #07111f;
    --surface: #0c1727;
    --surface-2: #111f31;
    --surface-3: #17283c;
    --line: rgba(148, 163, 184, .16);
    --line-strong: rgba(148, 163, 184, .27);
    --text: #f3f7fb;
    --muted: #94a7bd;
    --blue: #38a8ff;
    --blue-2: #1479d4;
    --cyan: #44d7d0;
    --green: #42d392;
    --amber: #f4b85d;
    --red: #ff6b76;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 24px 70px rgba(0, 0, 0, .32);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.65rem, 2.7vw, 2.35rem); letter-spacing: -.035em; line-height: 1.1; }
h2 { font-size: 1.08rem; letter-spacing: -.015em; }
h3 { font-size: .98rem; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.eyebrow { color: #84caff; font-size: .73rem; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }

.boot-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 18px; color: var(--muted); }
.brand-mark { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; gap: 3px; background: linear-gradient(145deg, #268eea, #3fc9cb); box-shadow: 0 14px 35px rgba(56,168,255,.22); }
.brand-mark span { width: 3px; border-radius: 3px; background: white; animation: pulse-bars 1.1s ease-in-out infinite; }
.brand-mark span:nth-child(1) { height: 11px; animation-delay: -.16s; }
.brand-mark span:nth-child(2) { height: 21px; }
.brand-mark span:nth-child(3) { height: 15px; animation-delay: -.32s; }
@keyframes pulse-bars { 50% { transform: scaleY(.45); opacity: .72; } }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(370px, .8fr); background: radial-gradient(circle at 15% 20%, rgba(24,121,212,.19), transparent 34%), var(--bg); }
.login-story { padding: clamp(44px, 7vw, 100px); display: flex; flex-direction: column; justify-content: space-between; min-height: 100vh; border-right: 1px solid var(--line); overflow: hidden; position: relative; }
.login-story::after { content: ""; position: absolute; width: 540px; height: 540px; border-radius: 50%; border: 1px solid rgba(68,215,208,.12); right: -270px; bottom: -270px; box-shadow: 0 0 0 70px rgba(68,215,208,.025), 0 0 0 140px rgba(68,215,208,.02); }
.brand-lockup { display: flex; align-items: center; gap: 13px; position: relative; z-index: 1; }
.brand-lockup strong { display: block; font-size: 1.05rem; letter-spacing: -.02em; }
.brand-lockup small { display: block; color: var(--muted); margin-top: 2px; }
.story-copy { position: relative; z-index: 1; max-width: 680px; }
.story-copy h1 { font-size: clamp(2.2rem, 5vw, 4.6rem); margin-bottom: 22px; }
.story-copy h1 span { color: #6fc4ff; }
.story-copy > p { color: #abc0d3; font-size: 1.06rem; max-width: 590px; line-height: 1.7; }
.story-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 38px; }
.story-metrics div { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(12,23,39,.68); backdrop-filter: blur(10px); }
.story-metrics strong, .story-metrics small { display: block; }
.story-metrics strong { font-size: .9rem; margin-bottom: 5px; }
.story-metrics small { color: var(--muted); line-height: 1.45; }
.login-panel { display: grid; place-content: center; padding: 32px; }
.login-card { width: min(420px, 100%); }
.login-card h2 { font-size: 1.7rem; margin: 28px 0 8px; }
.login-card > p { line-height: 1.6; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 250px; padding: 24px 17px 18px; border-right: 1px solid var(--line); background: #091524; display: flex; flex-direction: column; z-index: 30; }
.sidebar .brand-lockup { padding: 0 8px 25px; }
.sidebar .brand-mark { width: 37px; height: 37px; border-radius: 11px; }
.nav-label { color: #61768e; font-size: .67rem; text-transform: uppercase; letter-spacing: .14em; font-weight: 800; padding: 15px 12px 8px; }
.nav-list { display: grid; gap: 4px; }
.nav-button { width: 100%; border: 0; background: transparent; display: flex; align-items: center; gap: 12px; padding: 11px 12px; color: #93a7bd; border-radius: 10px; cursor: pointer; text-align: left; font-weight: 620; font-size: .88rem; }
.nav-button:hover { background: rgba(148,163,184,.07); color: white; }
.nav-button.active { background: linear-gradient(90deg, rgba(56,168,255,.17), rgba(56,168,255,.06)); color: #e9f6ff; box-shadow: inset 2px 0 #41afff; }
.nav-icon { width: 24px; height: 24px; border: 1px solid rgba(148,163,184,.22); border-radius: 8px; display: grid; place-content: center; font-size: .7rem; font-weight: 800; }
.sidebar-bottom { margin-top: auto; padding-top: 18px; }
.worker-card { border: 1px solid var(--line); background: rgba(17,31,49,.75); border-radius: 13px; padding: 13px; }
.worker-card > div { display: flex; gap: 9px; align-items: center; }
.worker-card p { margin: 9px 0 0; color: var(--muted); font-size: .74rem; line-height: 1.45; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(244,184,93,.1); }
.status-dot.green { background: var(--green); box-shadow: 0 0 0 4px rgba(66,211,146,.1); }
.main-column { grid-column: 2; min-width: 0; }
.topbar { height: 72px; position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 0 30px; background: rgba(7,17,31,.82); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.page-crumb { display: flex; gap: 12px; align-items: center; }
.page-crumb strong { font-size: .92rem; }
.page-crumb span { color: var(--muted); font-size: .8rem; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; gap: 10px; align-items: center; padding-left: 12px; border-left: 1px solid var(--line); }
.avatar { width: 34px; height: 34px; border-radius: 10px; background: #172b41; color: #86ceff; display: grid; place-content: center; font-size: .74rem; font-weight: 800; }
.user-chip strong, .user-chip small { display: block; }
.user-chip strong { font-size: .78rem; }
.user-chip small { color: var(--muted); font-size: .68rem; }
button.mobile-menu { display: none; }
.content { padding: 30px; max-width: 1560px; margin: 0 auto; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 24px; }
.page-heading h1 { margin-bottom: 8px; }
.page-heading p { margin: 0; color: var(--muted); line-height: 1.55; max-width: 720px; }
.heading-actions { display: flex; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }

.button { border: 1px solid var(--line-strong); border-radius: 9px; padding: 9px 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--surface-2); color: #dbe9f7; cursor: pointer; font-weight: 720; font-size: .8rem; min-height: 39px; }
.button:hover { background: var(--surface-3); border-color: rgba(148,163,184,.38); }
.button.primary { border-color: transparent; color: #fff; background: linear-gradient(135deg, #238fe8, #196fc1); box-shadow: 0 9px 24px rgba(35,143,232,.2); }
.button.primary:hover { filter: brightness(1.08); }
.button.ghost { background: transparent; }
.button.danger { color: #ffadb4; border-color: rgba(255,107,118,.24); background: rgba(255,107,118,.07); }
.button.small-button { min-height: 32px; padding: 6px 10px; font-size: .73rem; }
.button.wide { width: 100%; }
.button:disabled { opacity: .5; cursor: not-allowed; }
.text-button { border: 0; background: transparent; color: #72c3ff; padding: 3px; cursor: pointer; font-size: .78rem; font-weight: 700; }

.alert { padding: 13px 15px; border: 1px solid; border-radius: 11px; margin: 14px 0; font-size: .84rem; line-height: 1.5; }
.alert.danger { color: #ffc0c5; border-color: rgba(255,107,118,.28); background: rgba(255,107,118,.08); }
.alert.warning { color: #ffdaa2; border-color: rgba(244,184,93,.28); background: rgba(244,184,93,.08); }
.alert.info { color: #bde4ff; border-color: rgba(56,168,255,.28); background: rgba(56,168,255,.08); }
.alert.success { color: #b8f3d8; border-color: rgba(66,211,146,.28); background: rgba(66,211,146,.08); }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric-card { border: 1px solid var(--line); background: linear-gradient(145deg, rgba(17,31,49,.92), rgba(10,23,39,.92)); border-radius: var(--radius); padding: 18px; min-height: 138px; position: relative; overflow: hidden; }
.metric-card::after { content: ""; position: absolute; width: 105px; height: 105px; border-radius: 50%; top: -62px; right: -48px; background: rgba(56,168,255,.09); }
.metric-top { display: flex; justify-content: space-between; align-items: center; }
.metric-label { color: var(--muted); font-size: .76rem; font-weight: 650; }
.metric-icon { width: 31px; height: 31px; border-radius: 9px; display: grid; place-content: center; background: rgba(56,168,255,.1); color: #6bc3ff; font-size: .72rem; font-weight: 800; }
.metric-value { display: block; font-size: 2rem; letter-spacing: -.04em; margin: 20px 0 4px; }
.metric-foot { color: #71879e; font-size: .71rem; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .8fr); gap: 18px; }
.panel { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); box-shadow: 0 10px 35px rgba(0,0,0,.09); }
.panel-header { padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 15px; border-bottom: 1px solid var(--line); }
.panel-header h2 { margin: 0; }
.panel-header p { margin: 5px 0 0; font-size: .76rem; color: var(--muted); }
.panel-body { padding: 20px; }
.readiness-hero { padding: 24px; background: radial-gradient(circle at 90% 0%, rgba(56,168,255,.11), transparent 39%), var(--surface); }
.readiness-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.readiness-score { width: 92px; height: 92px; border: 9px solid rgba(56,168,255,.14); border-top-color: var(--blue); border-radius: 50%; display: grid; place-content: center; flex: 0 0 auto; }
.readiness-score strong { font-size: 1.4rem; }
.readiness-score small { color: var(--muted); font-size: .62rem; text-align: center; }
.readiness-hero h2 { font-size: 1.35rem; margin-bottom: 8px; }
.readiness-hero > .readiness-top > div > p { color: var(--muted); line-height: 1.55; }
.checklist { display: grid; gap: 1px; margin: 20px -24px -24px; background: var(--line); border-top: 1px solid var(--line); }
.check-row { padding: 14px 24px; display: grid; grid-template-columns: 28px minmax(0,1fr) auto; gap: 12px; align-items: center; background: var(--surface); }
.check-indicator { width: 23px; height: 23px; border-radius: 7px; display: grid; place-content: center; background: rgba(66,211,146,.1); color: var(--green); font-size: .7rem; font-weight: 850; }
.check-indicator.pending { background: rgba(244,184,93,.09); color: var(--amber); }
.check-row strong { display: block; font-size: .82rem; }
.check-row small { color: var(--muted); font-size: .71rem; }
.check-row > span:last-child { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; }
.activity-list { display: grid; }
.activity-item { display: grid; grid-template-columns: 11px minmax(0,1fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.activity-item:last-child { border-bottom: 0; }
.activity-pin { width: 8px; height: 8px; border: 2px solid var(--blue); border-radius: 50%; margin-top: 4px; }
.activity-item p { margin: 0; font-size: .79rem; }
.activity-item small { color: var(--muted); font-size: .69rem; }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.entity-card { border: 1px solid var(--line); background: var(--surface); border-radius: 15px; padding: 18px; display: flex; flex-direction: column; min-height: 235px; }
.entity-card:hover { border-color: rgba(56,168,255,.3); }
.entity-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.entity-avatar { width: 42px; height: 42px; display: grid; place-content: center; border-radius: 12px; color: #78c8ff; background: rgba(56,168,255,.1); border: 1px solid rgba(56,168,255,.14); font-size: .78rem; font-weight: 850; }
.entity-card h2 { margin: 15px 0 5px; }
.entity-subtitle { color: var(--muted); font-size: .76rem; margin-bottom: 17px; }
.entity-meta { display: grid; gap: 8px; margin-bottom: 18px; }
.meta-row { display: flex; justify-content: space-between; gap: 12px; font-size: .73rem; }
.meta-row span:first-child { color: var(--muted); }
.meta-row span:last-child { text-align: right; overflow: hidden; text-overflow: ellipsis; }
.entity-actions { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.status-detail { margin: 0 0 14px; padding: 9px 10px; border-radius: 8px; background: rgba(148,163,184,.05); color: var(--muted); font-size: .68rem; line-height: 1.45; overflow-wrap: anywhere; }
.badge { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; border: 1px solid; border-radius: 999px; padding: 5px 8px; font-size: .65rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.badge.green { color: #8aebbc; border-color: rgba(66,211,146,.22); background: rgba(66,211,146,.08); }
.badge.amber { color: #f5cc8d; border-color: rgba(244,184,93,.22); background: rgba(244,184,93,.08); }
.badge.red { color: #ff9ca4; border-color: rgba(255,107,118,.22); background: rgba(255,107,118,.08); }
.badge.blue { color: #8dcfff; border-color: rgba(56,168,255,.22); background: rgba(56,168,255,.08); }
.badge.gray { color: #a4b4c5; border-color: var(--line); background: rgba(148,163,184,.06); }
.empty-state { padding: 55px 22px; text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: rgba(12,23,39,.55); }
.empty-icon { width: 52px; height: 52px; display: grid; place-content: center; border-radius: 15px; background: var(--surface-2); color: var(--muted); font-weight: 800; margin: 0 auto 16px; }
.empty-state p { color: var(--muted); max-width: 450px; margin: 0 auto 18px; line-height: 1.55; }

.table-panel { overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 17px; text-align: left; border-bottom: 1px solid var(--line); font-size: .77rem; white-space: nowrap; }
th { background: rgba(17,31,49,.72); color: #7790a8; font-size: .67rem; text-transform: uppercase; letter-spacing: .08em; }
td { color: #d4e0ec; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(148,163,184,.025); }
.cell-title { font-weight: 700; }
.cell-subtitle { display: block; color: var(--muted); margin-top: 4px; font-size: .68rem; }
.table-actions { display: flex; gap: 6px; justify-content: flex-end; }

.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .55fr); gap: 18px; }
.settings-section + .settings-section { margin-top: 18px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row h3 { margin: 0 0 4px; }
.setting-row p { margin: 0; color: var(--muted); font-size: .75rem; }
.inline-field { width: 125px; }

.stack-form { display: grid; gap: 16px; }
.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
label { display: grid; gap: 7px; color: #acbdd0; font-size: .73rem; font-weight: 700; }
label .hint { font-size: .66rem; color: #6f8298; font-weight: 500; }
input, select, textarea { width: 100%; color: var(--text); background: #091525; border: 1px solid var(--line-strong); border-radius: 9px; padding: 10px 11px; outline: none; }
input, select { min-height: 42px; }
textarea { min-height: 105px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: rgba(56,168,255,.7); box-shadow: 0 0 0 3px rgba(56,168,255,.09); }
input::placeholder, textarea::placeholder { color: #52667c; }
select { color-scheme: dark; }
.checkbox-label { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.checkbox-label input { width: 18px; min-height: 18px; accent-color: var(--blue); }
.field-section { padding: 15px; border: 1px solid var(--line); border-radius: 12px; }
.field-section > h3 { margin-bottom: 14px; }
.secret-note { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .7rem; }

.modal-layer { position: fixed; inset: 0; z-index: 60; background: rgba(1,8,16,.72); backdrop-filter: blur(7px); display: grid; place-items: center; padding: 24px; }
.modal { width: min(720px, 100%); max-height: calc(100vh - 48px); overflow: auto; background: #0d1929; border: 1px solid var(--line-strong); border-radius: 18px; box-shadow: var(--shadow); }
.modal.wide-modal { width: min(920px, 100%); }
.modal-header { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding: 19px 22px; border-bottom: 1px solid var(--line); background: rgba(13,25,41,.96); backdrop-filter: blur(12px); }
.modal-header h2 { margin: 0 0 5px; }
.modal-header p { margin: 0; color: var(--muted); font-size: .73rem; }
.modal-close { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); cursor: pointer; }
.modal-body { padding: 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 9px; background: rgba(17,31,49,.48); }

.setup-body { min-height: 100vh; display: grid; place-content: center; padding: 30px; background: radial-gradient(circle at 20% 10%, rgba(56,168,255,.18), transparent 33%), var(--bg); }
.setup-card { width: min(700px, calc(100vw - 38px)); padding: 30px; border: 1px solid var(--line-strong); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.setup-card h1 { margin: 29px 0 10px; }
.setup-success { text-align: center; padding: 20px 0 5px; }
.setup-success .status-icon { display: grid; place-content: center; width: 62px; height: 62px; border-radius: 18px; margin: 0 auto 18px; background: rgba(66,211,146,.1); color: var(--green); font-size: 1.7rem; }
.setup-success h1 { margin-top: 0; }

.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: grid; gap: 10px; width: min(370px, calc(100vw - 40px)); }
.toast { padding: 14px 16px; border-radius: 11px; border: 1px solid var(--line-strong); background: #13243a; color: #e9f3fc; box-shadow: 0 16px 40px rgba(0,0,0,.3); animation: toast-in .2s ease-out; font-size: .8rem; line-height: 1.45; }
.toast.error { border-color: rgba(255,107,118,.3); }
.toast.success { border-color: rgba(66,211,146,.3); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

@media (max-width: 1150px) {
    .metrics-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .card-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
    .login-shell { grid-template-columns: 1fr; }
    .login-story { display: none; }
    .login-panel { min-height: 100vh; }
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow); }
    .sidebar.open { transform: translateX(0); }
    .main-column { grid-column: 1; }
    button.mobile-menu { display: inline-flex; }
    .topbar { padding: 0 17px; }
    .content { padding: 21px 17px; }
    .settings-grid { grid-template-columns: 1fr; }
    .user-chip > div:last-child { display: none; }
}
@media (max-width: 600px) {
    .metrics-grid, .card-grid { grid-template-columns: 1fr; }
    .form-grid.two, .form-grid.three { grid-template-columns: 1fr; }
    .page-heading { display: block; }
    .heading-actions { margin-top: 15px; justify-content: flex-start; }
    .modal-layer { padding: 0; align-items: end; }
    .modal, .modal.wide-modal { width: 100%; max-height: 94vh; border-radius: 18px 18px 0 0; }
    .readiness-top { display: block; }
    .readiness-score { margin-top: 18px; }
    .story-metrics { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
