/* KoreDB dashboard. World: drill-core sample boxes. Basalt ground, shale
   panels, chalk text, strata colours with lithology patterns, oxide copper
   for primary actions. */

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("assets/fonts/archivo-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("assets/fonts/archivo-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("assets/fonts/jetbrains-mono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("assets/fonts/jetbrains-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ground: #121110;
  --rail: #0c0b0a;
  --well: #0e0d0c;
  --panel: #191715;
  --panel-2: #221f1c;
  --raise: #2b2723;
  --line: #2b2825;
  --line-2: #3b3732;
  --text: #ece6dc;
  --text-2: #bdb4a7;
  --text-3: #938b7f;
  --accent: #e07a3f;
  --accent-hi: #ee8f57;
  --accent-ink: #1c1008;
  --accent-soft: rgba(224, 122, 63, 0.15);
  --ok: #72c291;
  --ok-soft: rgba(114, 194, 145, 0.13);
  --warn: #e8b64c;
  --warn-soft: rgba(232, 182, 76, 0.13);
  --err: #f06464;
  --err-soft: rgba(240, 100, 100, 0.13);

  --lith-0: #c9973f; /* ochre */
  --lith-1: #b5543a; /* iron oxide */
  --lith-2: #4f8f6a; /* serpentine */
  --lith-3: #d6b98c; /* sandstone */
  --lith-4: #5f7fa0; /* shale blue */
  --lith-5: #7d6f96; /* slate violet: auth */
  --lith-6: #8a8478; /* chalk grey: storage */
  --lith-7: #3d3833; /* basalt bedrock */

  --font: "Archivo", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --r: 6px;
  --r-sm: 4px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

html, body { margin: 0; height: 100%; }
body {
  background: var(--ground);
  color: var(--text);
  font: 400 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  caret-color: var(--accent);
}
::selection { background: rgba(224, 122, 63, 0.35); color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

a { color: var(--text); text-decoration-color: var(--line-2); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: 22px; line-height: 1.25; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
h3.sub { margin: 20px 0 8px; color: var(--text-2); }
p { margin: 0; }
code, .mono, kbd, pre { font-family: var(--mono); font-variant-ligatures: none; }
.mono, .num, td, dd { font-variant-numeric: tabular-nums; }
kbd { font-size: 11px; padding: 1px 5px; border-radius: 3px; background: rgba(0,0,0,0.18); color: inherit; opacity: 0.8; }

.muted { color: var(--text-2); }
.sm { font-size: 12.5px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.pad { padding: 16px; }
.pre-line { white-space: pre-line; }
.row { display: flex; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.center { justify-content: center; }
.gap { gap: 10px; }
.gap-sm { gap: 6px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.spacer { flex: 1; }

.ico { width: 16px; height: 16px; flex: none; }

/* ---------------------------------------------------------------- controls */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--panel-2); color: var(--text);
  font: 500 13px/1 var(--font); white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease);
}
.btn:hover { background: var(--raise); border-color: #4a453e; }
.btn:active { transform: translateY(0.5px); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hi); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.danger { background: var(--err-soft); border-color: rgba(240, 100, 100, 0.3); color: #ff9a9a; }
.btn.danger:hover { background: rgba(240, 100, 100, 0.22); }
.btn.danger.ghost { background: transparent; border-color: transparent; }
.btn.danger.ghost:hover { background: var(--err-soft); }
.btn.on { border-color: var(--accent); color: var(--text); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.block { width: 100%; }
.btn:disabled, .icon-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary .spin { border-color: rgba(0,0,0,0.25); border-top-color: var(--accent-ink); }

.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0;
  border: 0; border-radius: var(--r); background: transparent; color: var(--text-2); cursor: pointer;
  transition: background-color 160ms var(--ease), color 160ms var(--ease);
}
.icon-btn:hover:not(:disabled) { background: var(--panel-2); color: var(--text); }
.icon-btn.sm { width: 26px; height: 26px; }
.icon-btn.xs { width: 20px; height: 20px; }
.icon-btn.xs .ico { width: 13px; height: 13px; }

.link { background: none; border: 0; padding: 0; color: var(--text-2); cursor: pointer; font: inherit; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.link:hover { color: var(--text); text-decoration-color: var(--accent); }

.input {
  width: 100%; min-width: 0; height: 34px; padding: 0 10px;
  border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--well); color: var(--text); font: 400 13.5px/1.3 var(--font);
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.input::placeholder { color: #7a7368; }
.input:hover { border-color: #4a453e; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input:disabled { opacity: 0.5; }
.input.sm { height: 28px; font-size: 12.5px; padding: 0 8px; }
.input.mono { font-family: var(--mono); font-size: 12.5px; }
textarea.input { height: auto; padding: 8px 10px; line-height: 1.5; resize: vertical; }
select.input {
  appearance: none; padding-right: 28px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23938b7f' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 14px;
}
select.input option { background: var(--panel); color: var(--text); }
input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; cursor: pointer; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.field.compact { gap: 4px; }
.field small { font-size: 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 2px; }
.check > span { display: flex; flex-direction: column; gap: 2px; }
.check.sm { align-items: center; font-size: 12.5px; color: var(--text-2); }
.check.sm input { margin: 0; }
.input-group { display: flex; gap: 6px; align-items: center; }
.form-err { display: flex; gap: 8px; align-items: flex-start; color: #ff9a9a; font-size: 13px; }

.search { position: relative; display: block; min-width: 200px; }
.search .ico { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 32px; height: 32px; }

.seg { display: inline-flex; padding: 2px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--well); }
.seg button {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border: 0; border-radius: 4px; background: transparent; color: var(--text-3);
  font: 500 12.5px/1 var(--font); cursor: pointer;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--raise); color: var(--text); }
.seg.full { display: flex; }
.seg.full button { flex: 1; justify-content: center; }

.switch {
  position: relative; width: 36px; height: 20px; padding: 0; border-radius: 20px; border: 1px solid var(--line-2);
  background: var(--well); cursor: pointer; flex: none; transition: background-color 160ms var(--ease);
}
.switch span { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-3); transition: transform 180ms var(--ease), background-color 180ms; }
.switch[aria-checked="true"] { background: var(--accent); border-color: transparent; }
.switch[aria-checked="true"] span { transform: translateX(16px); background: var(--accent-ink); }

.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--panel-2);
  color: var(--text-2); font-size: 12px; white-space: nowrap; vertical-align: middle;
}
.chip .ico { width: 13px; height: 13px; }
.chip.sm { height: 19px; padding: 0 6px; font-size: 11.5px; }
.chip.ok { color: var(--ok); background: var(--ok-soft); border-color: rgba(114, 194, 145, 0.25); }
.chip.warn { color: var(--warn); background: var(--warn-soft); border-color: rgba(232, 182, 76, 0.25); }
.chip.err { color: #ff9a9a; background: var(--err-soft); border-color: rgba(240, 100, 100, 0.25); }
.chip.cmd { font-family: var(--mono); color: var(--text); }
.link-chip { font-family: var(--mono); }
td .chip + .chip { margin-left: 4px; }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; color: var(--text-2); background: var(--panel-2); margin-left: 6px; }
.badge.preview { color: var(--warn); background: var(--warn-soft); margin: 0; cursor: help; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.status { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); }
.status.ok { color: var(--ok); }

.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin 0.8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--panel); color: var(--text-2); margin: 12px 0; }
.note .ico { margin-top: 2px; }
.note.warn { border-color: rgba(232, 182, 76, 0.28); background: var(--warn-soft); color: #f1d394; }
.note.err { border-color: rgba(240, 100, 100, 0.3); background: var(--err-soft); color: #ffb3b3; }
.note pre { margin: 0; white-space: pre-wrap; font-size: 12.5px; line-height: 1.5; }
.ok-line { display: flex; align-items: center; gap: 8px; color: var(--ok); padding: 14px 16px; }

/* ---------------------------------------------------------------- top bar */

.topbar {
  display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 16px; flex: none;
  border-bottom: 1px solid var(--line); background: var(--ground); position: relative; z-index: 20;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; letter-spacing: -0.01em; text-decoration: none; color: var(--text); }
.logo { width: 14px; height: 20px; flex: none; }
.crumbs { display: flex; align-items: center; gap: 4px; min-width: 0; }
.crumb-sep { color: var(--line-2); padding: 0 2px; }

.menu { position: relative; }
.menu-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 8px 0 10px; max-width: 240px;
  border: 1px solid transparent; border-radius: var(--r); background: transparent; color: var(--text);
  font: 500 13.5px/1 var(--font); cursor: pointer;
}
.menu-btn:hover { background: var(--panel-2); }
.menu-btn[aria-expanded="true"] { background: var(--panel-2); border-color: var(--line-2); }
.menu-btn > .ico:last-child { color: var(--text-3); width: 14px; height: 14px; }
.menu-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu.account .menu-btn { width: 32px; height: 32px; padding: 0; justify-content: center; border-radius: 50%; background: var(--raise); font-size: 12px; font-weight: 600; }
.menu.account .menu-btn > .ico { display: none; }
.menu-pop {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 240px; max-height: 60vh; overflow: auto; padding: 6px;
  border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
  animation: pop 140ms var(--ease);
}
.menu-pop.right { left: auto; right: 0; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.menu-head { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-sec { padding: 6px 10px 4px; font-size: 12px; color: var(--text-3); }
.menu-item {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px; border: 0; border-radius: 5px;
  background: transparent; color: var(--text); font: 400 13.5px/1.2 var(--font); text-align: left; text-decoration: none; cursor: pointer;
}
.menu-item:hover { background: var(--panel-2); }
.menu-item.cur { background: var(--accent-soft); }
.menu-item .ico { color: var(--text-3); }

/* ---------------------------------------------------------------- console */

.console { display: grid; grid-template-columns: 216px minmax(0, 1fr); height: 100vh; }
.rail { display: flex; flex-direction: column; gap: 4px; padding: 10px 10px 16px; background: var(--rail); border-right: 1px solid var(--line); overflow-y: auto; }
.rail-brand { display: flex; align-items: center; height: 30px; padding: 0 10px; margin-bottom: 10px; }
.rail ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.rail-item {
  display: flex; align-items: center; gap: 11px; height: 34px; padding: 0 10px; border-radius: var(--r);
  color: var(--text-2); text-decoration: none; font-size: 13.5px; white-space: nowrap;
  transition: background-color 160ms var(--ease), color 160ms var(--ease);
}
.rail-item:hover { background: var(--panel); color: var(--text); }
.rail-item.on { background: var(--panel-2); color: var(--text); }
.rail-item.on .ico { color: var(--accent); }
.rail-toggle { display: none; }
.rail-scrim { display: none; }
.console-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.work { flex: 1; min-height: 0; overflow: auto; }

.page { padding: 24px 28px 48px; max-width: 1240px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.section { margin-top: 28px; }
.section > h2 { margin-bottom: 12px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.danger-zone { padding: 16px; border: 1px solid rgba(240, 100, 100, 0.28); border-radius: 8px; }
.danger-zone h2 { color: #ff9a9a; margin-bottom: 8px; }

.tabs { display: flex; gap: 2px; box-shadow: inset 0 -1px 0 var(--line); margin-bottom: 18px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tab {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px;
  color: var(--text-2); text-decoration: none; font-size: 13.5px; white-space: nowrap; border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

.opening { display: grid; place-items: center; align-content: center; gap: 10px; height: 100%; min-height: 360px; text-align: center; }
.drill { width: 22px; height: 120px; border: 1.5px solid var(--text-3); border-radius: 3px; overflow: hidden; position: relative; }
.drill span {
  position: absolute; inset: 0;
  background: linear-gradient(var(--lith-0) 0 18%, var(--lith-1) 18% 30%, var(--lith-2) 30% 52%, var(--lith-3) 52% 62%, var(--lith-4) 62% 80%, var(--lith-7) 80% 100%);
  transform-origin: top; animation: drill 1.6s var(--ease) infinite;
}
@keyframes drill { 0% { transform: scaleY(0); } 70%, 100% { transform: scaleY(1); } }

.center-screen { min-height: 100vh; display: grid; place-items: center; }

/* ---------------------------------------------------------------- lithology */

.lith-0 { background-color: var(--lith-0); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12'%3E%3Cg fill='rgba(40,24,4,.4)'%3E%3Ccircle cx='2' cy='3' r='.9'/%3E%3Ccircle cx='8' cy='1.5' r='.7'/%3E%3Ccircle cx='5.5' cy='7' r='1'/%3E%3Ccircle cx='10.5' cy='9.5' r='.8'/%3E%3C/g%3E%3Cg fill='rgba(255,236,190,.28)'%3E%3Ccircle cx='10' cy='5' r='.7'/%3E%3Ccircle cx='1.5' cy='9' r='.7'/%3E%3C/g%3E%3C/svg%3E"); }
.lith-1 { background-color: var(--lith-1); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='10'%3E%3Cpath d='M0 2.5h9 M12 2.5h4 M0 7.5h3 M6 7.5h9' fill='none' stroke='rgba(20,6,2,.42)' stroke-width='1' stroke-linecap='round'/%3E%3C/svg%3E"); }
.lith-2 { background-color: var(--lith-2); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='8'%3E%3Cpath d='M0 4q6 -3 12 0t12 0' fill='none' stroke='rgba(4,20,10,.42)' stroke-width='1' stroke-linecap='round'/%3E%3C/svg%3E"); }
.lith-3 { background-color: var(--lith-3); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='12'%3E%3Cg fill='rgba(70,48,18,.42)'%3E%3Ccircle cx='2' cy='2' r='.7'/%3E%3Ccircle cx='7' cy='4.5' r='.6'/%3E%3Ccircle cx='11.5' cy='1.5' r='.6'/%3E%3Ccircle cx='4' cy='9' r='.7'/%3E%3Ccircle cx='12' cy='10' r='.6'/%3E%3C/g%3E%3Ccircle cx='9' cy='8.5' r='1.6' fill='none' stroke='rgba(70,48,18,.4)' stroke-width='.8'/%3E%3C/svg%3E"); }
.lith-4 { background-color: var(--lith-4); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='6'%3E%3Cpath d='M0 1.5h18 M0 4.5h7 M10 4.5h8' fill='none' stroke='rgba(5,12,22,.42)' stroke-width='1' stroke-linecap='round'/%3E%3C/svg%3E"); }
.lith-5 { background-color: var(--lith-5); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='12'%3E%3Cpath d='M0 .5h16 M0 6.5h16 M4 .5v6 M12 6.5v6' fill='none' stroke='rgba(14,8,24,.42)' stroke-width='1' stroke-linecap='round'/%3E%3C/svg%3E"); }
.lith-6 { background-color: var(--lith-6); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10'%3E%3Cpath d='M0 0l10 10 M10 0l-10 10' fill='none' stroke='rgba(0,0,0,.26)' stroke-width='1' stroke-linecap='round'/%3E%3C/svg%3E"); }
.lith-7 { background-color: var(--lith-7); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='16'%3E%3Cpath d='M3 3l2 3.5l2 -3.5 M12 10l2 3.5l2 -3.5' fill='none' stroke='rgba(255,255,255,.13)' stroke-width='1' stroke-linecap='round'/%3E%3Cpath d='M9.5 0v16' fill='none' stroke='rgba(0,0,0,.28)' stroke-width='1' stroke-linecap='round'/%3E%3C/svg%3E"); }

.swatch { display: inline-block; width: 10px; height: 14px; border-radius: 2px; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35); vertical-align: middle; }

/* The core column, the product's signature */
.core { display: grid; grid-template-columns: 62px 58px minmax(0, 1fr); align-items: start; }
.core-depths { position: relative; height: var(--core-h); }
.depth {
  position: absolute; right: 8px; transform: translateY(-50%);
  font: 500 11px/1 var(--mono); color: var(--text-3); white-space: nowrap;
}
.depth::after { content: ""; position: absolute; right: -8px; top: 50%; width: 5px; height: 1px; background: var(--text-3); }
.core-tube {
  position: relative; isolation: isolate;
  display: flex; flex-direction: column; border: 1.5px solid #6e675d; border-radius: 4px; overflow: hidden;
  background: var(--well); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
/* Rock grain over every stratum, then the light of a round core: dark flanks, a soft highlight left of centre. */
.core-tube::before, .core-tube::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.core-tube::before { z-index: 3; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); opacity: 0.5; mix-blend-mode: multiply; }
.core-tube::after {
  z-index: 4;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.42) 0%, rgba(0, 0, 0, 0) 20%, rgba(255, 255, 255, 0.11) 36%, rgba(255, 255, 255, 0) 54%, rgba(0, 0, 0, 0.16) 80%, rgba(0, 0, 0, 0.4) 100%);
}
.stratum { position: relative; display: block; transition: filter 160ms var(--ease); }
/* Each bed is a little paler at its top and denser at its base. */
.stratum::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0) 30%, rgba(0, 0, 0, 0) 68%, rgba(0, 0, 0, 0.2));
}
.stratum.hot { filter: brightness(1.2) saturate(1.1); }
a.stratum:focus-visible { outline-offset: -2px; }

/* Contacts: where one rock meets the next. The lower stratum's own texture
   rises into the one above through a mask shaped like a real contact
   (undulating, gradational, interfingering, dipping; clasts over the parent
   rock). The shadow traces the contact line. */
.contact { position: absolute; left: 0; right: 0; top: -8px; height: 12px; z-index: 2; pointer-events: none; filter: drop-shadow(0 -1px 0 rgba(0, 0, 0, 0.5)); }
.contact i { display: block; height: 100%; -webkit-mask: var(--shape) center / 100% 100% no-repeat; mask: var(--shape) center / 100% 100% no-repeat; }
.contact.c-0 { --shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 12' preserveAspectRatio='none'%3E%3Cpath d='M0 7C8 3 14 9 22 6S36 2 46 6S62 10 72 5S90 3 100 7V12H0Z'/%3E%3C/svg%3E"); }
.contact.c-1 { --shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 12' preserveAspectRatio='none'%3E%3Cellipse cx='10' cy='3' rx='4' ry='1.2'/%3E%3Cellipse cx='38' cy='2' rx='5' ry='1'/%3E%3Cellipse cx='70' cy='3.4' rx='4' ry='1.1'/%3E%3Cellipse cx='90' cy='1.8' rx='3' ry='.9'/%3E%3Cellipse cx='22' cy='5.6' rx='7' ry='1.4'/%3E%3Cellipse cx='54' cy='5.8' rx='8' ry='1.5'/%3E%3Cellipse cx='84' cy='6' rx='7' ry='1.4'/%3E%3Cpath d='M0 8Q12 7 25 8.4T50 8T75 8.5T100 8V12H0Z'/%3E%3C/svg%3E"); }
.contact.c-2 { --shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 12' preserveAspectRatio='none'%3E%3Cpath d='M0 8L9 4L16 7L27 2L35 6L44 3.5L52 8L63 4.5L71 7L82 2.5L90 6L100 4V12H0Z'/%3E%3C/svg%3E"); }
.contact.c-3 { --shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 12' preserveAspectRatio='none'%3E%3Cpath d='M0 3C30 4 70 8 100 9.5V12H0Z'/%3E%3C/svg%3E"); }
.contact.c-rock { --shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 12' preserveAspectRatio='none'%3E%3Cpath d='M6 1l5 1l-1 3l-5 -1zM30 .5l6 2l-3 2.5l-4 -1.5zM58 1.5l4 -1l3 3l-5 1zM82 1l6 1.5l-2 2.5l-5 -1zM16 5l8 .5l-1 2.5l-8 -.5zM44 4.5l9 1l-2 2.6l-8 -1zM70 5l8 0l1 2.6l-9 .3zM92 5.5l6 .3l0 2l-6 0zM0 9L12 8L20 9.2L33 8.2L47 9.3L60 8.3L74 9.2L88 8.4L100 9V12H0Z'/%3E%3C/svg%3E"); }

/* The parent rock is not drawn to scale: a break in the core says so. */
.core-break { position: absolute; left: 0; right: 0; top: 56%; height: 10px; z-index: 2; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='10'%3E%3Cpath d='M0 2L3 0L6 2L9 0L12 2V8L9 10L6 8L3 10L0 8Z' fill='%230e0d0c'/%3E%3C/svg%3E") 0 0 / 12px 10px repeat-x; }
.core-labels { display: flex; flex-direction: column; }
.core-label {
  display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; column-gap: 8px;
  padding: 0 0 0 12px; position: relative; text-decoration: none; color: var(--text-2); min-height: 0; overflow: hidden;
  border-bottom: 1px dashed transparent;
}
.core-label::before { content: ""; position: absolute; left: 0; top: 50%; width: 8px; height: 1px; background: var(--line-2); }
.core-label .swatch { width: 10px; height: 10px; }
.cl-name { color: var(--text); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-sub { font: 11.5px/1 var(--mono); color: var(--text-3); white-space: nowrap; }
.core-label.hot .cl-name { color: var(--accent-hi); }
.core-label.hot::before { background: var(--accent); width: 10px; }

.mini-core { display: flex; flex-direction: column; width: 14px; height: 46px; border: 1px solid #6e675d; border-radius: 2px; overflow: hidden; flex: none; }
.mini-core span { display: block; flex-grow: 0; flex-shrink: 1; min-height: 3px; border-bottom: 1px solid rgba(0, 0, 0, 0.5); }
.mini-core .bed { flex: 1 0 8px; border: 0; }
/* not .empty: that class is the global empty-state block */
.mini-core.is-empty { background: var(--well); border-style: dashed; }

/* ---------------------------------------------------------------- auth */

.auth-screen { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; }
.auth-pane { display: flex; flex-direction: column; padding: 24px 32px; }
.auth-top { display: flex; align-items: center; justify-content: space-between; }
.auth-form { width: 100%; max-width: 380px; margin: auto; padding: 48px 0; display: flex; flex-direction: column; gap: 18px; }
.auth-form h1 { font-size: 26px; }
.auth-note { display: flex; gap: 8px; align-items: flex-start; max-width: 380px; margin: 0 auto; font-size: 12.5px; color: var(--text-3); }
.auth-note .ico { margin-top: 2px; }
.auth-side {
  display: flex; flex-direction: column; justify-content: center; gap: 24px; padding: 48px 56px;
  background: var(--rail); border-left: 1px solid var(--line);
}
.auth-side-text { max-width: 440px; }
.auth-side-text h2 { font-size: 20px; margin-bottom: 8px; }
.auth-side-text p { color: var(--text-2); }
.auth-side .core { max-width: 480px; }

/* ---------------------------------------------------------------- org */

.org-screen { min-height: 100vh; display: flex; flex-direction: column; }
.org-main { width: 100%; max-width: 1120px; margin: 0 auto; padding: 28px 28px 64px; }
.narrow { max-width: 520px; margin: 24px auto; display: flex; flex-direction: column; gap: 14px; }
.narrow h1 { font-size: 24px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); text-decoration: none; font-size: 13px; width: max-content; }
.back:hover { color: var(--text); }

.project-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.project-row {
  display: grid; grid-template-columns: 14px minmax(180px, 1fr) minmax(0, 2.4fr) 18px; align-items: center; gap: 22px;
  padding: 14px 10px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none;
  transition: background-color 160ms var(--ease);
}
.project-row:hover { background: var(--panel); }
.project-row > .ico { color: var(--text-3); }
.pr-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pr-main strong { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-main .mono { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-facts { display: grid; grid-template-columns: minmax(0, 0.7fr) minmax(0, 0.9fr) minmax(0, 1.1fr) minmax(0, 1.3fr); gap: 16px; margin: 0; }
.pr-facts dt { font-size: 12px; color: var(--text-3); }
.pr-facts dd { margin: 2px 0 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }

/* ---------------------------------------------------------------- home */

.home { padding: 24px 28px 48px; max-width: 1320px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 40px; align-items: start; }
.home-core { position: sticky; top: 0; padding-top: 4px; }
.figures { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.figures > div { padding: 14px 16px 16px; border-left: 1px solid var(--line); }
.figures > div:first-child { border-left: 0; padding-left: 2px; }
.figures dt { font-size: 12.5px; color: var(--text-3); }
.figures dd { margin: 6px 0 0; white-space: nowrap; font-size: 21px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.figures dd small { margin-left: 4px; font-size: 12px; font-weight: 400; color: var(--text-3); letter-spacing: 0; }
.log-table td.sw { width: 18px; padding-right: 0; }
.recent { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.recent li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.recent code { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent li.err code { color: #ff9a9a; }

.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.kv .k { font-size: 12.5px; color: var(--text-3); }
.kv .v { font-size: 12.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv + p { margin-top: 8px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px 24px; margin: 18px 0 0; }
.facts dt { font-size: 12px; color: var(--text-3); }
.facts dd { margin: 3px 0 0; }
.facts code { font-size: 12.5px; }

/* ---------------------------------------------------------------- lists */

.list-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.list-table th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--text-3); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.list-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.list-table th:first-child, .list-table td:first-child { padding-left: 4px; }
.list-table .num { text-align: right; white-space: nowrap; }
.list-table tbody tr { transition: background-color 120ms; }
.list-table tbody tr:hover { background: rgba(255, 255, 255, 0.018); }
.list-table tr.clickable { cursor: pointer; }
.list-table tr.err td { color: #ffb3b3; }
.list-table td a { text-decoration: none; }
.list-table td a:hover { color: var(--accent-hi); }
.list-table tr.detail td { background: var(--panel); padding: 12px; }
.logs .sql-cell { max-width: 560px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }

.user-cell { display: flex; align-items: center; gap: 10px; }
.avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--lith-5); color: #f4f0fa; font-size: 12px; font-weight: 600; flex: none; }

.ext-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.ext { display: flex; align-items: center; gap: 16px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.ext strong { display: inline-flex; align-items: center; gap: 8px; margin-right: 8px; }
.ext p { margin-top: 3px; }

.policy-card { padding: 16px 0; border-bottom: 1px solid var(--line); }
.policy-card header { margin-bottom: 8px; }
.policy-card h3 { font-size: 14.5px; }
.policies { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.policies li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.policy-exprs { margin-top: 5px; color: var(--text-2); word-break: break-word; }
.templates { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* ---------------------------------------------------------------- editor */

.editor { display: grid; grid-template-columns: 252px minmax(0, 1fr); height: 100%; min-height: 0; }
.side-panel { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--panel); }
.side-head { display: flex; flex-direction: column; gap: 10px; padding: 14px 12px 10px; border-bottom: 1px solid var(--line); }
.side-head .search { min-width: 0; }
.table-list { flex: 1; overflow-y: auto; padding: 8px 6px 16px; display: flex; flex-direction: column; gap: 1px; }
.list-label { padding: 10px 8px 6px; font-size: 12px; color: var(--text-3); }
.table-item {
  display: flex; align-items: center; gap: 9px; width: 100%; min-height: 32px; padding: 4px 8px; border: 0; border-radius: 5px;
  background: transparent; color: var(--text-2); font: 400 13.5px/1.25 var(--font); text-align: left; text-decoration: none; cursor: pointer;
}
.table-item:hover { background: var(--panel-2); color: var(--text); }
.table-item.on { background: var(--raise); color: var(--text); }
.table-item.err .ti-name { color: #ff9a9a; }
.table-item.hist { align-items: flex-start; flex-direction: column; gap: 2px; padding: 6px 8px; }
.ti-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-item.hist .ti-name { font-size: 12px; width: 100%; }
.ti-rls { color: var(--ok); display: inline-flex; }
.ti-rls .ico { width: 13px; height: 13px; }
.ti-btn { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }

.editor-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.editor-main.scroll { overflow-y: auto; }
.table-view { display: flex; flex-direction: column; min-height: 0; height: 100%; padding: 16px 20px 0; }
.tv-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.tv-title h1 { font-size: 19px; }
.tv-title p { margin-top: 3px; }
.filter-bar { display: flex; flex-direction: column; gap: 8px; padding: 10px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.filter-row { display: grid; grid-template-columns: minmax(120px, 200px) 120px minmax(0, 1fr) 28px; gap: 6px; align-items: center; }

.grid-area { flex: 1; min-height: 0; display: flex; flex-direction: column; transition: opacity 160ms; }
.grid-area.busy { opacity: 0.6; }
.grid-area.flat { flex: none; }
.grid-area .empty { margin: auto; }
.grid-wrap { flex: 1; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--well); }
.grid-area.flat .grid-wrap { max-height: 70vh; }
.grid { border-collapse: separate; border-spacing: 0; font-size: 12.5px; min-width: 100%; }
.grid th, .grid td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); white-space: nowrap; }
.grid th { position: sticky; top: 0; z-index: 2; background: var(--panel-2); text-align: left; font-weight: 500; padding: 0; }
.grid th.chk, .grid td.chk { width: 34px; text-align: center; padding: 0 10px; }
.grid th.chk { z-index: 3; }
.th-btn {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; background: none;
  color: var(--text); font: 500 12.5px/1.2 var(--font); text-align: left; cursor: default;
}
th.sortable .th-btn { cursor: pointer; }
th.sortable .th-btn:hover { background: var(--raise); }
.th-btn .ico { width: 13px; height: 13px; color: var(--accent); }
.th-name { white-space: nowrap; }
.th-type { font: 400 11px/1 var(--mono); color: var(--text-3); }
.grid td { padding: 6px 10px; font-family: var(--mono); max-width: 340px; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.grid td.num { text-align: right; }
.grid th.num .th-btn { justify-content: flex-end; }
.grid td.rownum, .grid th.rownum { width: 1%; color: var(--text-3); text-align: right; font-size: 11px; padding: 6px 8px; background: var(--panel); position: sticky; left: 0; z-index: 1; }
.grid th.rownum { z-index: 3; background: var(--panel-2); }
.grid tbody tr:hover td { background: rgba(255, 255, 255, 0.025); }
.grid tbody tr.sel td { background: var(--accent-soft); }
.grid tbody tr.clickable { cursor: pointer; }
.null { color: var(--text-3); font-size: 11px; }
.bool { color: var(--text-3); }
.bool.on { color: var(--ok); }

.pager { display: flex; align-items: center; gap: 16px; padding: 10px 2px 12px; flex: none; }
.last-sql { flex: 1; min-width: 0; font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.definition { overflow-y: auto; padding-bottom: 32px; }

/* ---------------------------------------------------------------- sheet / dialog */

.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(5, 4, 3, 0.55); animation: fade 160ms var(--ease); }
.scrim.center { display: grid; place-items: center; padding: 16px; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 51; width: min(520px, 100vw);
  display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line-2);
  box-shadow: -16px 0 40px rgba(0, 0, 0, 0.45); animation: slide 220ms var(--ease);
}
.sheet.wide { width: min(700px, 100vw); }
@keyframes slide { from { transform: translateX(32px); opacity: 0; } }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 16px; }
.sheet-head p { margin-top: 2px; font-family: var(--mono); font-size: 12px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 18px; }
.sheet-body > form { min-height: 100%; }
.sheet-foot {
  position: sticky; bottom: -18px; margin: 8px -18px -18px; padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 12px;
  background: var(--panel); border-top: 1px solid var(--line);
}
.sql-preview summary { cursor: pointer; font-size: 12.5px; color: var(--text-2); margin-bottom: 8px; }
.sql-preview summary:hover { color: var(--text); }

.dialog {
  width: min(460px, 100%); padding: 20px; display: flex; flex-direction: column; gap: 14px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55); animation: pop 160ms var(--ease);
}
.dialog h2 { font-size: 16px; }

.row-form { display: flex; flex-direction: column; gap: 14px; }
.rf-field { display: flex; flex-direction: column; gap: 6px; }
.rf-label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.rf-field.changed .rf-label .mono { color: var(--accent-hi); }

.cols-editor { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 10px 12px; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.cols-editor legend { padding: 0 6px; font-size: 12.5px; color: var(--text-2); }
.ce-head, .ce-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.1fr) 34px 38px 52px 26px; gap: 6px; align-items: center; }
.ce-head { font-size: 11.5px; color: var(--text-3); padding: 0 2px; }
.ce-row input[type="checkbox"] { justify-self: center; }

/* ---------------------------------------------------------------- code */

.code-editor {
  display: flex; flex: 1; min-height: 0; overflow: auto; background: var(--well);
  border: 1px solid var(--line); border-radius: var(--r); font: 400 13px/20px var(--mono);
}
.code-editor:focus-within { border-color: var(--line-2); }
.ce-gutter {
  position: sticky; left: 0; z-index: 1; flex: none; min-width: 44px; padding: 10px 10px 10px 8px; align-self: flex-start;
  min-height: 100%; text-align: right; color: #5f5950; background: var(--well); border-right: 1px solid var(--line); user-select: none;
}
.ce-gutter span { display: block; }
.ce-body { position: relative; flex: 1; min-width: 0; }
.ce-hl, .ce-input { margin: 0; padding: 10px 14px; font: inherit; white-space: pre; tab-size: 2; letter-spacing: 0; word-spacing: 0; }
.ce-hl { min-width: calc(var(--cols) * 1ch + 40px); min-height: calc(var(--rows) * 20px + 20px); color: var(--text); pointer-events: none; }
.ce-input {
  position: absolute; inset: 0; width: 100%; height: 100%; resize: none; overflow: hidden; border: 0; outline: none;
  background: transparent; color: transparent; caret-color: var(--accent); -webkit-text-fill-color: transparent;
}
.ce-input::selection { background: rgba(224, 122, 63, 0.3); -webkit-text-fill-color: transparent; }

.tk-kw { color: #eaa572; }
.tk-type { color: #93bbdb; }
.tk-fn { color: #ddc78e; }
.tk-str { color: #93d0a3; }
.tk-num { color: #bfaee0; }
.tk-com { color: #7a7368; font-style: italic; }
.tk-op { color: #cfc6b9; }
.tk-punc { color: #8f877b; }
.tk-ident { color: #f0e3cf; }
.tk-param { color: var(--accent-hi); }

.codeblock { position: relative; border: 1px solid var(--line); border-radius: var(--r); background: var(--well); }
.codeblock pre { margin: 0; padding: 12px 14px; overflow-x: auto; font-size: 12.5px; line-height: 1.6; white-space: pre; }
.cb-actions { position: absolute; top: 6px; right: 6px; opacity: 0.6; transition: opacity 160ms; }
.codeblock:hover .cb-actions { opacity: 1; }

/* ---------------------------------------------------------------- sql page */

.sql-page { display: grid; grid-template-columns: 252px minmax(0, 1fr); height: 100%; min-height: 0; }
.sql-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 14px 18px 0; }
.title-input { width: auto; flex: 1 1 200px; max-width: 360px; background: transparent; border-color: transparent; font-weight: 600; font-size: 15px; }
.title-input:hover { border-color: var(--line-2); }
.sql-editor-wrap { display: flex; height: 40%; min-height: 160px; flex: none; }
.results { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-top: 12px; padding-bottom: 12px; }
.results-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex: none; }
.results .grid-wrap { flex: 1; }

/* ---------------------------------------------------------------- storage */

.path { display: flex; align-items: center; gap: 4px; font-size: 13.5px; min-width: 0; flex-wrap: wrap; }
.file-name { display: inline-flex; align-items: center; gap: 9px; }
.file-name .ico { color: var(--text-3); }
.files td { padding-top: 8px; padding-bottom: 8px; }
.file-preview { display: grid; place-items: center; min-height: 240px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: repeating-conic-gradient(#1a1816 0 25%, #151311 0 50%) 0 0 / 16px 16px; }
.file-preview img { max-width: 100%; max-height: 60vh; }
.text-preview { margin: 0; width: 100%; max-height: 60vh; overflow: auto; font-size: 12.5px; white-space: pre-wrap; background: var(--well); padding: 12px; border-radius: var(--r); }

/* ---------------------------------------------------------------- api */

.api-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.api-pair .list-label { padding: 0 0 6px; }
.api-op h2 { margin-bottom: 10px; }

/* ---------------------------------------------------------------- empty, skeleton, toasts */

.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 56px 24px; max-width: 460px; margin: 0 auto; }
.empty-mark { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 10px; background: var(--panel-2); color: var(--text-2); border: 1px solid var(--line-2); margin-bottom: 4px; }
.empty-mark .ico { width: 22px; height: 22px; }
.empty h3 { font-size: 16px; }
.empty p { color: var(--text-2); }
.empty .row { margin-top: 8px; }

.skeleton { display: flex; flex-direction: column; gap: 10px; padding: 12px 4px; }
.sk-line { height: 12px; border-radius: 4px; background: linear-gradient(90deg, var(--panel-2) 0%, var(--raise) 50%, var(--panel-2) 100%) 0 0 / 200% 100%; animation: sheen 1.4s linear infinite; }
@keyframes sheen { to { background-position: -200% 0; } }

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 8px 10px 12px; border-radius: 8px;
  background: var(--raise); border: 1px solid var(--line-2); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  animation: rise 200ms var(--ease); font-size: 13.5px;
}
.toast > .ico { color: var(--ok); margin-top: 2px; }
.toast.err > .ico { color: var(--err); }
.toast span { flex: 1; white-space: pre-line; word-break: break-word; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------------------------------------------------------------- team and invites */

.banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 18px; border-radius: 8px;
  background: var(--panel); border: 1px solid var(--line-2); border-left: 3px solid var(--accent);
  animation: rise 200ms var(--ease);
}
.banner > .ico { color: var(--accent); flex: none; }
.banner p { margin: 0; }
.banner strong { display: block; font-weight: 600; }

.role { color: var(--text-2); font-size: 13px; }
.invite-form { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.invite-form .input { width: auto; }
.invite-form input { flex: 1 1 260px; min-width: 0; }
.count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums;
}

.invite-list, .invite-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.invite-list li, .invite-cards li {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line);
}
.invite-list li .grow, .invite-cards li .grow { display: flex; flex-direction: column; gap: 2px; min-width: 180px; }
.invite-list li.fresh { border-color: var(--accent); background: linear-gradient(var(--accent-soft), var(--accent-soft)), var(--panel); }
.invite-cards li p { margin: 0; }
.invite-url {
  max-width: 260px; padding: 4px 8px; border-radius: 4px; background: var(--well); border: 1px solid var(--line);
  font-family: var(--mono); font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.landing { min-height: 100vh; display: flex; flex-direction: column; padding: 20px 28px; }
.landing-card {
  width: 100%; max-width: 480px; margin: auto; padding: 28px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line-2); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
  display: flex; flex-direction: column; gap: 12px; animation: rise 220ms var(--ease);
}
.landing-card h1 { font-size: 22px; line-height: 1.25; }
.landing-card p { margin: 0; }
.landing-card .opening { min-height: 160px; }
.landing-card .empty { padding: 12px 0; }
.landing-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); }

/* ---------------------------------------------------------------- plans */

.plan-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--panel); color: var(--text-2); font-size: 13px; text-decoration: none; white-space: nowrap;
  transition: border-color 160ms var(--ease), color 160ms var(--ease);
}
.plan-chip:hover { border-color: var(--accent); color: var(--text); }
.plan-chip .ico { width: 14px; height: 14px; color: var(--accent); }
.seats { font-weight: 400; font-variant-numeric: tabular-nums; margin-left: 4px; }

.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.plan-card {
  display: flex; flex-direction: column; gap: 10px; padding: 16px; min-width: 0;
  border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel);
}
.plan-card.current { border-color: var(--accent); background: linear-gradient(var(--accent-soft), var(--accent-soft)), var(--panel); }
.plan-card h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 16px; }
.plan-core { display: flex; flex-direction: column; width: 14px; height: 60px; border: 1px solid #6e675d; border-radius: 2px; overflow: hidden; }
.plan-core span { flex: 1; border-bottom: 1px solid rgba(0, 0, 0, 0.5); }
.plan-core span:last-child { border-bottom: 0; }
.plan-core span.void { background: var(--well); border-bottom-color: transparent; }
.plan-price { margin: 0; white-space: nowrap; }
.plan-price strong { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.plan-price span { margin-left: 5px; font-size: 12.5px; color: var(--text-3); }
.plan-price strong.custom { font-size: 18px; letter-spacing: 0; }
.plan-limits { list-style: none; margin: 0; padding: 10px 0 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 7px; flex: 1; font-size: 13px; color: var(--text-2); }
.plan-card .btn { justify-content: center; width: 100%; white-space: normal; height: auto; min-height: 34px; padding-top: 6px; padding-bottom: 6px; text-align: center; }

.usage { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 32px; margin-top: 16px; }
.quota { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.usage .quota { margin-top: 0; }
.quota-head { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; color: var(--text-3); }
.quota-head .mono { color: var(--text-2); white-space: nowrap; }
.meter { height: 6px; border-radius: 3px; background: var(--well); border: 1px solid var(--line); overflow: hidden; }
.meter span { display: block; height: 100%; min-width: 2px; background: var(--lith-2); transition: width 220ms var(--ease); }
.quota.warn .meter span { background: var(--warn); }
.quota.over .meter span { background: var(--err); }
.quota.over .quota-head .mono { color: #ff9a9a; }

.pricing { width: 100%; max-width: 1180px; margin: 0 auto; padding: 20px 28px 64px; }
.pricing-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin: 44px 0 22px; }
.pricing-head h1 { font-size: 26px; margin-bottom: 6px; }
.pricing-head p { margin: 0; max-width: 60ch; }
.pricing-notes { margin: 18px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.landing-icon.ok { background: var(--ok-soft); color: var(--ok); }
/* Members with the read-only role see data, not the controls that change it. */
.console.read-only .w { display: none !important; }
.backup-line { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; }
.backup-line:not(.form-err) > .ico { color: var(--ok); }
.forgot { align-self: flex-end; margin-top: -6px; font-size: 13px; color: var(--text-2); }
.forgot:hover { color: var(--accent-hi); }

/* ---------------------------------------------------------------- front page */

.lp { width: 100%; max-width: 1120px; margin: 0 auto; padding: 18px 28px 40px; }
.lp-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.lp-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.lp-link { color: var(--text-2); text-decoration: none; font-size: 13.5px; padding: 0 6px; }
.lp-link:hover { color: var(--text); }
.btn.lg { height: 42px; padding: 0 20px; font-size: 15px; }

.lp-hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 56px; align-items: center; padding: 72px 0 64px; }
.lp-hero-text { display: flex; flex-direction: column; gap: 20px; }
.lp-hero h1 { font-size: clamp(30px, 3.9vw, 44px); line-height: 1.12; font-weight: 650; letter-spacing: -0.025em; text-wrap: balance; }
.lp-lead { margin: 0; max-width: 54ch; font-size: 16px; line-height: 1.6; color: var(--text-2); }
.lp-hero-text > .muted { margin: 0; }
.lp-hero-core { margin: 0; display: flex; flex-direction: column; gap: 14px; }
.lp-hero-core figcaption { padding-left: 62px; }
/* The core is drilled once, on arrival. */
.lp-hero-core .core-tube { animation: core-in 900ms var(--ease) both; }
.lp-hero-core .core-label, .lp-hero-core .depth { animation: fade 500ms 500ms var(--ease) both; }
@keyframes core-in { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }

.lp-section { padding: 48px 0; border-top: 1px solid var(--line); }
.lp-section > h2, .lp-section .pricing-head h2 { font-size: 22px; letter-spacing: -0.01em; margin-bottom: 6px; }
.lp-section > .muted { margin: 0 0 22px; }
.lp-section .pricing-head { margin: 0 0 22px; }

/* Read like a core log: pattern, name, description, the identifier behind it. */
.lp-log { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.lp-log li { display: grid; grid-template-columns: 12px 190px minmax(0, 1fr) auto; gap: 18px; align-items: baseline; padding: 15px 4px; border-bottom: 1px solid var(--line); }
.lp-log .swatch { width: 12px; height: 18px; align-self: center; }
.lp-log strong { font-size: 15px; font-weight: 600; }
.lp-log-text { color: var(--text-2); line-height: 1.55; }
.lp-log code { font: 12px/1.4 var(--mono); color: var(--text-3); white-space: nowrap; }

.lp-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 28px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 13px; }
.lp-foot nav { display: flex; gap: 20px; flex-wrap: wrap; }
.lp-foot a { color: var(--text-2); text-decoration: none; }
.lp-foot a:hover { color: var(--accent-hi); }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 1180px) {
  .console { grid-template-columns: 60px minmax(0, 1fr); }
  .rail-item span { display: none; }
  .rail-item { justify-content: center; padding: 0; }
  .rail-brand { justify-content: center; padding: 0; }
  .home-grid { grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; }
  .pr-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 920px) {
  .lp-hero { grid-template-columns: minmax(0, 1fr); gap: 40px; padding: 44px 0 40px; }
  .lp-log li { grid-template-columns: 12px minmax(0, 1fr); row-gap: 4px; }
  .lp-log li > .lp-log-text, .lp-log li > code { grid-column: 2; }
  .lp-log code { white-space: normal; }
  .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .home-core { position: static; }
  .figures { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .figures > div:nth-child(4) { border-left: 0; padding-left: 2px; }
  .figures > div:nth-child(n + 4) { border-top: 1px solid var(--line); }
  .auth-screen { grid-template-columns: minmax(0, 1fr); }
  .auth-side { display: none; }
  .editor, .sql-page { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .side-panel { border-right: 0; border-bottom: 1px solid var(--line); max-height: 34vh; }
  .api-pair { grid-template-columns: minmax(0, 1fr); }
  .project-row { grid-template-columns: 14px minmax(0, 1fr) 18px; }
  .pr-facts { display: none; }
}

@media (max-width: 720px) {
  .lp { padding: 14px 14px 32px; }
  .lp-nav .lp-link, .lp-nav .btn.ghost { display: none; }
  .plan-grid { grid-template-columns: minmax(0, 1fr); }
  .pricing { padding: 16px 14px 40px; }
  .console { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 60; width: 236px;
    transform: translateX(-100%); transition: transform 220ms var(--ease);
  }
  .rail-item span { display: inline; }
  .rail-item { justify-content: flex-start; padding: 0 10px; }
  .rail-brand { justify-content: flex-start; padding: 0 10px; }
  .console.rail-open .rail { transform: none; }
  .console.rail-open .rail-scrim { display: block; z-index: 55; }
  .rail-toggle { display: inline-grid; }
  .topbar { padding: 0 10px; gap: 6px; }
  .badge.preview { display: none; }
  .console .crumbs > .menu:first-child, .console .crumbs > .crumb-sep { display: none; }
  .crumbs { flex: 1; min-width: 0; }
  .topbar .spacer { display: none; }
  .menu-btn { max-width: 140px; }
  .page, .home, .org-main { padding: 18px 14px 40px; }
  .table-view, .sql-main { padding: 12px 12px 0; }
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figures > div:nth-child(odd) { border-left: 0; padding-left: 2px; }
  .figures > div:nth-child(4) { border-left: 1px solid var(--line); padding-left: 16px; }
  .figures > div:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .kv { grid-template-columns: minmax(0, 1fr) auto auto; }
  .kv .k { grid-column: 1 / -1; }
  .filter-row { grid-template-columns: minmax(0, 1fr) 100px 28px; }
  .filter-row input { grid-column: 1 / 3; }
  .ce-head { display: none; }
  .ce-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 26px; }
  .ce-row input[type="checkbox"] { display: none; }
  .auth-pane { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .drill span { transform: none; }
}
