/* Cassandra console — the family console shell (Kai's composition) carrying
   Cassandra's emerald identity from the public landing. */
:root {
  --ink: #080d0b;
  --ink-deep: #050806;
  --surface: #0e1713;
  --surface-2: #121d18;
  --line: #20342a;
  --paper: #eef1ee;
  --paper-2: #f6f8f5;
  --card-line: #d5ddd6;
  --card-line-soft: #e3e8e2;
  --text: #f0f7f3;
  --text-dark: #17221d;
  --muted: #a0b2aa;
  --muted-dark: #78857e;
  --emerald: #34d399;
  --emerald-2: #6ee7b7;
  --emerald-ink: #0d4636;
  --teal: #2dd4bf;
  --warn: #b07816;
  --stop: #c04a4a;
  --shadow: 0 24px 80px rgba(0, 0, 0, .34);
  --mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Newsreader", Georgia, serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--ink); color: var(--text); font-family: var(--sans); font-size: 15px; }
button, input, textarea, select { font: inherit; }
button, a { color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }

.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 1.7px; text-transform: uppercase; color: var(--emerald); display: flex; align-items: center; gap: 10px; }
.eyebrow > span { display: inline-block; width: 26px; height: 1px; background: var(--emerald); }
.brand-mark { display: inline-flex; flex: 0 0 auto; width: 36px; height: 36px; align-items: center; justify-content: center; color: var(--emerald); filter: drop-shadow(0 5px 10px rgba(52, 211, 153, .22)); }
.brand-mark svg { display: block; width: 100%; height: 100%; overflow: visible; }
.brand-mark circle, .brand-mark path { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.brand-mark .vault-frame { stroke-width: 3.4; }
.brand-mark .vault-hub, .brand-mark .vault-handle, .brand-mark .vault-hinge { stroke: var(--emerald-2); stroke-width: 2.7; }

/* Access gate */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 32px 20px; background: radial-gradient(circle at 76% 12%, rgba(52, 211, 153, .09), transparent 34%), var(--ink-deep); }
.gate[hidden] { display: none; }
.gate-card { width: min(430px, 100%); background: var(--surface); border: 1px solid #2b4436; padding: 34px; box-shadow: var(--shadow); border-radius: 6px; }
.gate-mark { margin-bottom: 24px; }
.gate h1 { font-size: 33px; letter-spacing: -.05em; line-height: 1.02; margin: 16px 0 12px; }
.gate h1 em { font-style: italic; font-family: var(--serif); color: var(--emerald-2); font-weight: 500; }
.gate-lede { color: var(--muted); line-height: 1.6; font-size: 13px; }
.gate-status { background: rgba(192, 74, 74, .12); border: 1px solid rgba(192, 74, 74, .4); color: #f1b9b9; font-size: 12px; padding: 10px 12px; border-radius: 4px; }
.gate label { display: grid; gap: 6px; font-size: 10px; color: var(--muted); margin-top: 14px; }
.gate input { background: var(--ink-deep); border: 1px solid #2a3c33; border-radius: 4px; padding: 11px; color: var(--text); outline: none; }
.gate input:focus { border-color: var(--emerald); box-shadow: 0 0 0 3px rgba(52, 211, 153, .12); }
.gate small { display: block; color: #65756d; font-size: 10px; text-align: center; margin-top: 18px; line-height: 1.6; }
.gate small a { color: var(--muted); }
.text-link { display: block; margin: 12px auto 0; border: 0; background: none; color: var(--emerald); font-size: 11px; }

.button { border: 1px solid var(--line); border-radius: 4px; padding: 12px 18px; display: inline-flex; align-items: center; justify-content: center; background: transparent; color: inherit; font-weight: 600; font-size: 13px; transition: .2s ease; }
.button:hover { border-color: var(--emerald); }
.button-primary { background: var(--emerald); color: #05231a; border-color: var(--emerald); box-shadow: 0 0 30px rgba(52, 211, 153, .14); }
.button-primary:hover { background: var(--emerald-2); }
.button-ghost { background: rgba(8, 13, 11, .5); border-color: rgba(255, 255, 255, .22); }
.button-full { width: 100%; margin: 5px 0; }

/* Console shell */
.console { min-height: 100vh; background: var(--paper); color: var(--text-dark); display: grid; grid-template-columns: 238px 1fr; }
.console[hidden] { display: none; }
.sidebar { background: #0a120e; color: #cbd5cf; position: fixed; inset: 0 auto 0 0; width: 238px; display: flex; flex-direction: column; border-right: 1px solid #24332c; z-index: 20; }
.console-brand { height: 66px; padding: 0 20px; border-bottom: 1px solid #24332c; display: flex; align-items: center; gap: 12px; }
.console-brand > span:last-child { display: grid; line-height: 1; }
.console-brand b { font-size: 21px; letter-spacing: -.6px; }
.console-brand small { font-size: 9px; text-transform: uppercase; letter-spacing: 1.6px; color: var(--muted); margin-top: 5px; }
.workspace { margin: 15px 12px 18px; padding: 10px; border: 1px solid #26372f; background: #101e18; color: inherit; display: flex; align-items: center; text-align: left; border-radius: 4px; }
.workspace .avatar { width: 30px; height: 30px; border-radius: 3px; background: #14503c; color: var(--emerald); display: grid; place-items: center; font-weight: 600; margin-right: 9px; }
.workspace > span:nth-child(2) { display: grid; }
.workspace b { font-size: 11px; }
.workspace small { font-size: 8px; color: #708078; margin-top: 3px; }
.workspace i { font-style: normal; margin-left: auto; }
.sidebar nav { padding: 0 10px; }
.sidebar nav button { width: 100%; height: 39px; border: 0; border-radius: 3px; background: transparent; color: #9baba3; display: flex; align-items: center; gap: 12px; font-size: 11px; text-align: left; padding: 0 10px; margin: 2px 0; }
.sidebar nav button:hover, .sidebar nav button.active { background: #14231c; color: #edf3ef; }
.sidebar nav button.active { box-shadow: inset 2px 0 var(--emerald); }
.sidebar nav button > span { font-family: var(--mono); font-size: 15px; width: 18px; text-align: center; }
.sidebar nav button i { margin-left: auto; background: #1d352a; padding: 2px 6px; border-radius: 8px; font-size: 8px; font-style: normal; }
.sidebar nav p { font-family: var(--mono); font-size: 8px; text-transform: uppercase; letter-spacing: 1.4px; color: #607168; margin: 23px 10px 8px; }
.sidebar-foot { margin-top: auto; padding: 14px 12px; border-top: 1px solid #24332c; }
.system-note { display: flex; align-items: center; padding: 8px; }
.system-note > span { width: 7px; height: 7px; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 0 4px rgba(52, 211, 153, .1); margin-right: 12px; flex: none; }
.system-note.alert > span { background: #e8a13c; box-shadow: 0 0 0 4px rgba(232, 161, 60, .12); }
.system-note p { margin: 0; display: grid; }
.system-note b { font-size: 9px; }
.system-note small { font-size: 8px; color: #6f8178; margin-top: 3px; }
.sidebar-foot > button { border: 0; background: transparent; color: #6f8178; font-size: 9px; padding: 8px; }

.workspace-main { grid-column: 2; min-width: 0; }
.app-header { height: 66px; background: var(--paper-2); border-bottom: 1px solid var(--card-line); display: flex; align-items: center; justify-content: space-between; padding: 0 28px; position: sticky; top: 0; z-index: 10; }
.crumb { font-size: 11px; color: var(--muted-dark); }
.crumb b { color: #253029; }
.header-tools { display: flex; align-items: center; gap: 8px; }
.pack-chip { font-family: var(--mono); font-size: 9px; color: #3f7a62; background: #e2f2ea; border: 1px solid #bfdccd; border-radius: 3px; padding: 6px 8px; }
.profile { border: 1px solid #d7ded9; background: #fff; height: 32px; border-radius: 3px; color: #637068; display: flex; align-items: center; gap: 6px; padding: 0 6px; }
.profile span { width: 23px; height: 23px; background: #123f2f; color: #a9ecd0; display: grid; place-items: center; border-radius: 2px; font-size: 8px; }
.profile i { font-style: normal; }
.mobile-menu { display: none; }
.app-content { padding: 30px; max-width: 1600px; margin: 0 auto; }
.loading { height: 70vh; display: grid; place-content: center; text-align: center; color: #87938c; }
.loading span { width: 32px; height: 32px; border: 2px solid #d4dcd7; border-top-color: #259a71; border-radius: 50%; animation: spin 1s linear infinite; margin: auto; }
.loading p { font-family: var(--mono); font-size: 9px; margin-top: 15px; }
@keyframes spin { to { transform: rotate(360deg); } }

.page-title { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 26px; gap: 16px; }
.page-title h1 { font-size: 28px; letter-spacing: -.04em; margin: 0 0 6px; color: var(--text-dark); }
.page-title p { margin: 0; color: var(--muted-dark); font-size: 11px; }
.page-title-actions { display: flex; gap: 8px; flex: none; }
.app-button { border: 1px solid #cad4ce; background: #fff; color: #26332c; border-radius: 3px; height: 35px; padding: 0 14px; font-size: 10px; font-weight: 600; }
.app-button.primary { background: var(--emerald-ink); color: #eaf9f2; border-color: var(--emerald-ink); }
.app-button:disabled { opacity: .45; cursor: not-allowed; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.stat-card, .panel { background: #fff; border: 1px solid var(--card-line); border-radius: 4px; }
.stat-card { padding: 18px; }
.stat-card > small { font-size: 9px; color: var(--muted-dark); text-transform: uppercase; letter-spacing: .6px; }
.stat-card strong { font-family: var(--mono); font-size: 26px; font-weight: 500; display: block; margin: 11px 0 5px; }
.stat-card p { font-size: 9px; color: #829087; margin: 0; }
.positive { color: #208260 !important; }
.warning { color: var(--warn) !important; }
.negative { color: #a84b3f !important; }

.overview-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .75fr); gap: 14px; margin-bottom: 14px; }
.panel-head { min-height: 54px; border-bottom: 1px solid var(--card-line-soft); padding: 10px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-head h2 { font-size: 12px; margin: 0; }
.panel-head p { margin: 3px 0 0; color: #87928c; font-size: 8px; }
.panel-head > div:first-child { display: grid; }
.link-button { border: 0; background: none; color: #24785d; text-decoration: none; font-size: 9px; }

.status-pill { font-family: var(--mono); font-size: 8px; text-transform: uppercase; padding: 5px 7px; border-radius: 2px; background: #e5f6ee; color: #187153; white-space: nowrap; }
.status-pill.clear { background: #e5f6ee; color: #187153; }
.status-pill.attention { background: #fdf1da; color: #8c6114; }
.status-pill.critical { background: #f9e8e5; color: #a84b3f; }
.status-pill.standard { background: #e7f3ec; color: #257258; }
.status-pill.extended_soon { background: #fdf1da; color: #8c6114; }
.status-pill.extended, .status-pill.past_extended { background: #f9e8e5; color: #a84b3f; }
.status-pill.unknown { background: #eef0f8; color: #5e68a3; }
.status-pill.verified { background: #e5f6ee; color: #187153; }
.status-pill.pending_verification { background: #fdf1da; color: #8c6114; }
.status-pill.requested, .status-pill.provisioning, .status-pill.validating { background: #e8f0fb; color: #2d5e9e; }
.status-pill.tearing_down { background: #fdf1da; color: #8c6114; }
.status-pill.completed { background: #e5f6ee; color: #187153; }
.status-pill.failed { background: #f9e8e5; color: #a84b3f; }
.drill-timeline { display: grid; gap: 8px; margin-top: 4px; }
.drill-timeline .audit-item { grid-template-columns: 110px 130px 1fr; }
.evidence-chip { font-family: var(--mono); font-size: 7px; text-transform: uppercase; letter-spacing: .8px; padding: 3px 5px; border-radius: 2px; border: 1px solid #cfd9d2; color: #5d6d64; background: #f2f5f1; }
.evidence-chip.observed { border-color: #b7dcc9; color: #1f7355; background: #e9f6ef; }
.evidence-chip.computed { border-color: #c3cfe8; color: #4b5da3; background: #edf1fa; }
.evidence-chip.declared { border-color: #e2d2b3; color: #8c6114; background: #faf3e2; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; font-size: 8px; text-transform: uppercase; letter-spacing: .7px; color: #87938c; background: var(--paper-2); padding: 10px 16px; border-bottom: 1px solid var(--card-line-soft); }
.data-table td { padding: 13px 16px; border-bottom: 1px solid #edf0ed; font-size: 10px; vertical-align: middle; }
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover { background: #fafbf9; }
.data-table td b { font-size: 10px; }
.data-table td small { display: block; color: #829088; font-size: 8px; margin-top: 3px; }
.data-table .mono { font-family: var(--mono); font-size: 9px; }
.table-panel { margin-top: 14px; }
.table-scroll { overflow: auto; }
.store-name { display: flex; align-items: center; gap: 10px; }
.engine-icon { width: 29px; height: 29px; border: 1px solid #d7dfda; background: #f1f5f2; display: grid; place-items: center; border-radius: 3px; font-family: var(--mono); font-size: 7px; color: #2b7359; flex: none; }

/* Deadline meter */
.deadline-list { padding: 8px 16px 15px; }
.deadline-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; padding: 13px 0; border-bottom: 1px solid #edf0ed; }
.deadline-row:last-child { border: 0; }
.deadline-row .who { display: flex; align-items: center; gap: 8px; font-size: 10px; }
.deadline-row .who b { font-size: 10px; }
.deadline-row .who small { color: #829088; font-size: 8px; }
.deadline-row > strong { font-family: var(--mono); font-size: 10px; font-weight: 500; color: #26332c; text-align: right; }
.deadline-row .meter { grid-column: 1 / -1; height: 5px; background: #e8eeea; border-radius: 3px; overflow: hidden; }
.deadline-row .meter i { display: block; height: 100%; border-radius: 3px; background: #31a87d; }
.deadline-row .meter i.warn { background: #d99b28; }
.deadline-row .meter i.stop { background: #c05f4a; }
.deadline-row .action { grid-column: 1 / -1; font-size: 8px; color: #829088; }

.finding-list { padding: 8px 16px 15px; }
.finding-row { display: flex; align-items: flex-start; gap: 11px; padding: 12px 0; border-bottom: 1px solid #edf0ed; }
.finding-row:last-child { border: 0; }
.finding-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 4px; flex: none; background: #9fb3a9; }
.finding-dot.critical { background: #c05f4a; box-shadow: 0 0 0 4px rgba(192, 95, 74, .12); }
.finding-dot.warn { background: #d99b28; box-shadow: 0 0 0 4px rgba(217, 155, 40, .12); }
.finding-dot.info { background: #7f97b5; }
.finding-row p { margin: 0; display: grid; gap: 3px; }
.finding-row b { font-size: 10px; }
.finding-row small { font-size: 8.5px; color: #71807a; line-height: 1.55; }
.finding-row .chips { display: flex; gap: 5px; margin-top: 3px; }

.view-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filters select { border: 1px solid #cad4ce; background: #fff; border-radius: 3px; height: 33px; padding: 0 10px; font-size: 10px; color: #26332c; }

.connection-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.connection-card { padding: 20px; }
.connection-card-head { display: flex; align-items: center; gap: 11px; }
.connection-logo { width: 39px; height: 39px; background: #101e18; color: var(--emerald); font-family: var(--mono); font-size: 10px; display: grid; place-items: center; border-radius: 4px; flex: none; }
.connection-card h3 { font-size: 12px; margin: 0 0 4px; }
.connection-card p { font-size: 8px; color: #829088; margin: 0; }
.connection-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin: 22px 0; }
.connection-card dt { font-size: 8px; color: #87938d; }
.connection-card dd { margin: 4px 0 0; font-family: var(--mono); font-size: 9px; overflow-wrap: anywhere; }

.audit-list { padding: 0; }
.audit-item { display: grid; grid-template-columns: 150px 190px 1fr; gap: 15px; padding: 15px 18px; border-bottom: 1px solid #e8ece9; }
.audit-item:last-child { border: 0; }
.audit-item time { font-family: var(--mono); font-size: 8px; color: #6d7c74; }
.audit-item code { font-family: var(--mono); font-size: 8px; color: #28795d; background: #edf6f1; padding: 3px 5px; width: max-content; }
.audit-item small { display: block; color: #849088; margin-top: 4px; font-size: 8px; }
.audit-item p { font-size: 9px; margin: 0; }
.empty-state { padding: 60px; text-align: center; color: #839087; font-size: 11px; }

/* Detail dialog */
.modal { width: min(660px, calc(100vw - 32px)); border: 1px solid #31453a; background: #0f1b16; color: #dfe7e3; padding: 34px; box-shadow: var(--shadow); border-radius: 6px; }
.modal::backdrop { background: rgba(2, 7, 5, .78); backdrop-filter: blur(5px); }
.modal-close { position: absolute; right: 12px; top: 10px; border: 0; background: none; color: #879a90; font-size: 24px; }
.modal h2 { font-size: 27px; letter-spacing: -.045em; margin: 14px 0 6px; }
.dialog-subtitle { color: #91a199; font-size: 11px; margin-bottom: 20px; }
.fact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: #24382e; border: 1px solid #24382e; border-radius: 4px; overflow: hidden; margin: 18px 0; }
.fact-grid > div { background: #101d17; padding: 11px 12px; }
.fact-grid small { display: block; font-size: 7.5px; text-transform: uppercase; letter-spacing: .8px; color: #6d7f76; margin-bottom: 6px; }
.fact-grid b { font-family: var(--mono); font-size: 10.5px; font-weight: 500; overflow-wrap: anywhere; }
.fact-grid b.bad { color: #eda28f; }
.fact-grid b.good { color: #86e0bd; }
.modal-section { margin-top: 20px; border-top: 1px solid #24382e; padding-top: 16px; }
.modal-section h3 { font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px; color: #7d9187; font-family: var(--mono); margin-bottom: 12px; }
.modal .finding-row { border-color: #1c2d24; }
.modal .finding-row small { color: #8ba095; }
.modal .finding-row b { color: #e4ede8; }
.lifecycle-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-family: var(--mono); font-size: 9px; color: #9fb3a9; }
.lifecycle-line b { color: #e4ede8; font-weight: 500; }
.modal label { display: grid; font-size: 9px; color: #8ba095; gap: 6px; margin-bottom: 13px; }
.modal input { width: 100%; border: 1px solid #2a3c33; background: #0a130f; border-radius: 3px; padding: 11px; color: #e5ebe7; outline: none; }
.modal input:focus { border-color: #4b9e80; box-shadow: 0 0 0 3px rgba(52, 211, 153, .1); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.workspace-callout { border: 1px solid #2b4436; background: #0d1a14; border-radius: 4px; padding: 13px 14px; margin: 6px 0 16px; display: grid; gap: 5px; }
.workspace-callout b { font-size: 10px; color: #cfe6da; }
.workspace-callout span { font-size: 9px; color: #86988e; line-height: 1.6; }
.modal pre { background: #0a130f; border: 1px solid #26372f; padding: 14px; font-family: var(--mono); font-size: 9px; color: #9ead9f; overflow: auto; border-radius: 4px; }
.dialog-stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 6px; }
.dialog-stat-grid > div { border: 1px solid #24382e; border-radius: 4px; padding: 11px 12px; display: grid; gap: 5px; }
.dialog-stat-grid small { font-size: 7.5px; text-transform: uppercase; letter-spacing: .8px; color: #6d7f76; }
.dialog-stat-grid b { font-family: var(--mono); font-size: 11px; font-weight: 500; }

.toast-region { position: fixed; right: 24px; bottom: 24px; z-index: 200; display: grid; gap: 8px; }
.toast { background: #102019; color: #dce8e2; border: 1px solid #355143; border-left: 3px solid var(--emerald); padding: 13px 16px; min-width: 260px; box-shadow: var(--shadow); font-size: 10px; animation: toast-in .2s ease; border-radius: 3px; }
.toast.error { border-left-color: var(--stop); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1050px) {
  .sidebar { transform: translateX(-100%); transition: .2s; }
  .sidebar.open { transform: translateX(0); }
  .console { grid-template-columns: 1fr; }
  .workspace-main { grid-column: 1; }
  .mobile-menu { display: inline-block; border: 0; background: none; margin-right: 10px; }
  .overview-grid, .view-grid, .connection-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .fact-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .app-content { padding: 18px; }
  .page-title { align-items: flex-start; flex-direction: column; }
  .stat-grid, .fact-grid, .dialog-stat-grid { grid-template-columns: 1fr; }
  .data-table { min-width: 720px; }
  .audit-item { grid-template-columns: 1fr; gap: 6px; }
  .form-row { grid-template-columns: 1fr; }
  .modal { padding: 26px; }
  .pack-chip { display: none; }
}
