/* SHADOW CHATEAU — application shell chrome.
   Palette is Root's logo palette, defined as --sc-* on the shell root. The
   shell owns layout only; every station's own styling
   arrives inside its frame, untouched — gizmo colours are the surface's. */

:root {
  /* Shadow Chateau — the logo palette. These eight are the source of truth. */
  --sc-ground:    #0B0714;   /* near-black violet, app background */
  --sc-panel:     #140C22;   /* panel fill                        */
  --sc-line:      #2A1B45;   /* borders / splitters / grid lines   */
  --sc-primary:   #E93E9C;   /* hot magenta — wordmark, seal pill, active tab, scrub */
  --sc-secondary: #8B4DD8;   /* violet — SURFACE tags, chips       */
  --sc-accent:    #5B8DEF;   /* blue-violet — selection, focus     */
  --sc-text:      #E8E2F4;   /* primary text                       */
  --sc-muted:     #8B7FA6;   /* ENGINE tags, secondary labels      */

  /* Working aliases. Every one is either one of the eight above or is mixed
     from them — no hue is introduced that Root did not supply. */
  --bg:      var(--sc-ground);
  --panel:   var(--sc-panel);
  --panel-2: color-mix(in srgb, var(--sc-panel) 82%, var(--sc-line));
  --rail:    color-mix(in srgb, var(--sc-panel) 58%, var(--sc-line));
  --edge:    var(--sc-line);
  --edge-2:  color-mix(in srgb, var(--sc-line) 68%, var(--sc-muted));
  --ink:     var(--sc-text);
  --ink-2:   var(--sc-muted);
  --ink-3:   color-mix(in srgb, var(--sc-muted) 68%, var(--sc-panel));
  --accent:  var(--sc-primary);
  --select:  color-mix(in srgb, var(--sc-accent) 26%, var(--sc-panel));

  /* The one colour outside the eight: a distinct failure state for the seal
     pill, so "provenance unavailable" cannot be mistaken for a normal chip.
     Flagged for Ari — say the word and it becomes --sc-secondary. */
  --warn:    #E0A53C;

  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 12px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---- workspace grid ------------------------------------------------- */

#studio {
  display: grid;
  height: 100%;
  grid-template-columns: var(--left, 268px) 4px 1fr 4px var(--right, 300px);
  grid-template-rows: 34px 1fr 4px var(--dock, 248px);
  grid-template-areas:
    "menu   menu   menu   menu   menu"
    "left   gutL   center gutR   right"
    "left   gutL   splitB splitB splitB"
    "left   gutL   dock   dock   dock";
}

/* ---- menu strip ----------------------------------------------------- */

#menu {
  grid-area: menu;
  display: flex; align-items: center; gap: 2px;
  padding: 0 8px;
  background: var(--rail);
  border-bottom: 1px solid var(--edge);
  user-select: none;
}
#menu .brand {
  font-weight: 600; letter-spacing: .08em; font-size: 11px;
  color: var(--ink); padding-right: 14px; text-transform: uppercase;
}
#menu .brand em { color: var(--accent); font-style: normal; }
#menu button.m {
  background: none; border: 0; color: var(--ink-2);
  font: inherit; padding: 5px 9px; border-radius: 3px; cursor: pointer;
}
#menu button.m:hover { background: var(--edge); color: var(--ink); }
#menu .spacer { flex: 1; }

/* provenance badge */
#crown {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 10.5px;
  padding: 3px 9px; border-radius: 3px;
  background: var(--panel-2); border: 1px solid var(--edge-2);
  color: var(--ink-2); cursor: pointer;
}
#crown .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink-3);
}
#crown.sealed .dot { background: var(--accent); }
#crown.sealed b { color: var(--ink); font-weight: 500; }
#crown.unknown .dot { background: var(--warn); }

/* ---- panels --------------------------------------------------------- */

.panel {
  background: var(--panel);
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  overflow: hidden;
}
#left   { grid-area: left;   border-right: 1px solid var(--edge); }
#right  { grid-area: right;  border-left: 1px solid var(--edge); }
#center { grid-area: center; background: var(--sc-ground); }
#dock   { grid-area: dock;   border-top: 1px solid var(--edge); }

.panel > header {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  height: 26px; padding: 0 9px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--edge);
  font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-2);
  user-select: none;
}
.panel > .body { flex: 1 1 auto; overflow: auto; min-height: 0; }

/* section blocks inside the side rails */
.sect > h4 {
  margin: 0; padding: 7px 9px 5px;
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
  border-bottom: 1px solid var(--edge);
  background: var(--panel-2);
  position: sticky; top: 0; z-index: 1;
}
.sect .rows { padding: 4px 0 8px; }

.row {
  display: grid; grid-template-columns: 1fr auto;
  align-items: center; gap: 8px;
  padding: 3px 9px 3px 16px;
  color: var(--ink-2);
}
.row:hover { background: var(--panel-2); color: var(--ink); }
.row .n { font-family: var(--mono); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .t { font-size: 9.5px; letter-spacing: .05em; color: var(--ink-3); text-transform: uppercase; }
.row.browser .t { color: var(--sc-secondary); }
.row.headless { opacity: .72; }

/* attribute-editor style key/value */
.attr {
  display: grid; grid-template-columns: 96px 1fr;
  gap: 8px; align-items: baseline;
  padding: 3px 9px;
}
.attr dt { color: var(--ink-3); font-size: 10.5px; }
.attr dd { margin: 0; font-family: var(--mono); font-size: 11px; color: var(--ink); overflow-wrap: anywhere; }

.note {
  margin: 8px 9px; padding: 8px 10px;
  border-left: 2px solid var(--edge-2);
  background: var(--panel-2);
  color: var(--ink-2); line-height: 1.5; font-size: 11px;
}
.note b { color: var(--ink); font-weight: 500; }
.note code { font-family: var(--mono); font-size: 10.5px; color: var(--sc-secondary); }

/* ---- dock tabs ------------------------------------------------------ */

#dock > header { padding: 0; gap: 0; height: 27px; }
#dock .tab {
  background: none; border: 0; border-right: 1px solid var(--edge);
  color: var(--ink-3); font: inherit;
  font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase;
  padding: 0 14px; height: 100%; cursor: pointer;
}
#dock .tab:hover { color: var(--ink-2); background: var(--panel); }
#dock .tab[aria-selected="true"] {
  color: var(--ink); background: var(--panel);
  box-shadow: inset 0 -2px 0 var(--accent);
}
#dock .dockspace { flex: 1; }
#dock .hint { padding-right: 10px; color: var(--ink-3); font-family: var(--mono); font-size: 10px; letter-spacing: 0; text-transform: none; }

/* ---- station frames -------------------------------------------------- */

.station { display: none; width: 100%; height: 100%; border: 0; background: var(--bg); }
.station.on { display: block; }

/* ---- splitters ------------------------------------------------------- */

.gutter { background: var(--edge); }
.gutter:hover, .gutter.drag { background: var(--edge-2); }
#gutL { grid-area: gutL; cursor: col-resize; }
#gutR { grid-area: gutR; cursor: col-resize; }
#splitB { grid-area: splitB; cursor: row-resize; }

/* ---- provenance sheet ------------------------------------------------ */

#sheet[hidden] { display: none; }
#sheet {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(6, 8, 11, .68);
  display: flex; align-items: center; justify-content: center;
}
#sheet .card {
  width: min(760px, 92vw); max-height: 82vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--edge-2); border-radius: 5px;
  box-shadow: 0 24px 70px rgba(0,0,0,.6);
}
#sheet .card > header {
  display: flex; align-items: center; height: 34px; padding: 0 12px;
  border-bottom: 1px solid var(--edge); background: var(--panel-2);
  font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2);
}
#sheet .card > header button {
  margin-left: auto; background: none; border: 0; color: var(--ink-3);
  font: inherit; font-size: 15px; cursor: pointer; padding: 0 4px;
}
#sheet table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 11px; }
#sheet th, #sheet td { text-align: left; padding: 4px 12px; border-bottom: 1px solid var(--edge); }
#sheet th { color: var(--ink-3); font-weight: 500; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
#sheet td.s-browser { color: var(--sc-secondary); }
#sheet td.s-headless { color: var(--ink-3); }
