/* Sala — Mielina design system.
   Tokens come from the generated mirror; nothing is declared here. The page is
   a shell, so it also takes the viewport height the hub page has no use for. */

@import url('../components.css?v=abf45399');

* { box-sizing: border-box; }
html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.28;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.28;
  -webkit-font-smoothing: antialiased;
}

/* ---------- shell ---------- */

.shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr) 300px;
  height: 100vh;
  height: 100dvh;
}

.col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.col + .col { border-left: 1px solid var(--line); }

.col-head {
  padding: var(--space-2) var(--space-2) var(--space-1);
  border-bottom: 1px solid var(--line);
  flex: none;
}

.kicker {
  margin: 0;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.2003em;
  text-transform: uppercase;
  color: var(--muted);
}

.col-body {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  padding: var(--space-2);
}

/* ---------- roster ---------- */

.roster-group + .roster-group { margin-top: var(--space-3); }

.roster-label {
  margin: 0 0 var(--space-1);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.contact {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px var(--space-1);
  min-height: 44px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.contact:hover { border-color: var(--line-strong); }

.contact[aria-current="true"] {
  background: var(--surface-active);
  border-color: var(--line-strong);
}

.contact:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

.avatar {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--g1) 0%, var(--g2) 100%);
  color: var(--bg);
}

.avatar svg { width: 18px; height: 18px; }

.avatar.person {
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  color: var(--fg);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
}

.contact-text { min-width: 0; flex: 1; }

.contact-name {
  display: block;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.28;
}

.dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: var(--radius-pill);
  background: var(--muted);
}

.dot.live { background: var(--status-live); }
.dot.away { background: var(--status-pending); }

.sub-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- advanced options ---------- */

.advanced {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
}

.advanced summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before { content: '+'; margin-right: 8px; }
.advanced[open] summary::before { content: '–'; }
.advanced summary:hover { color: var(--fg); }
.advanced summary:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

.advanced-note {
  margin: 0 0 var(--space-2);
  color: var(--muted);
  line-height: 1.5;
  font-size: 14px;
}

.engine {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px var(--space-1);
  min-height: 44px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.engine:hover { border-color: var(--line-strong); }

.engine[aria-pressed="true"] {
  background: var(--surface-active);
  border-color: var(--line-strong);
}

.engine:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

.engine-swatch {
  flex: none;
  width: 4px;
  height: 26px;
  background: linear-gradient(180deg, var(--g1) 0%, var(--g2) 100%);
}

.engine-text { min-width: 0; }
.engine-name { display: block; font-weight: 500; }

.engine-sub {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- conversation ---------- */

.thread-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: var(--space-2);
  border-bottom: 1px solid var(--line);
  flex: none;
}

.thread-title {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-weight: 500;
  text-wrap: balance;
}

.thread-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.thread {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.msg { max-width: 68ch; }
.msg.mine { margin-left: auto; }

.msg-who {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.msg.mine .msg-who { text-align: right; }

.bubble {
  padding: 12px var(--space-2);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  line-height: 1.6;
  font-size: 14px;
}

.msg.mine .bubble { border-color: var(--line-strong); }

/* ---------- GenUI surface ---------- */

.genui {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-2);
  max-width: none;
}

.genui-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--space-2);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.genui-tag b { color: var(--fg); font-weight: 700; }

/* Card form */
.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: var(--space-2);
}

.service-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.service-card:hover { border-color: var(--line-strong); }

.art {
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--g1) 55%, transparent) 0%,
      color-mix(in srgb, var(--g2) 42%, transparent) 100%),
    var(--bg);
}

.art svg { width: 44px; height: 44px; color: var(--fg); }

.card-body { padding: 12px var(--space-2) var(--space-2); }

.meta {
  display: flex;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.card-body h3 {
  margin: 10px 0 6px;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-weight: 500;
  text-wrap: balance;
}

.card-body p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: 14px;
  color: var(--status-live);
}

.status.pending { color: var(--status-pending); }

/* Pane form */
.pane-top {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  margin-bottom: var(--space-2);
}

.pane-art {
  flex: none;
  width: 108px;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--g1) 55%, transparent) 0%,
      color-mix(in srgb, var(--g2) 42%, transparent) 100%),
    var(--bg);
}

.pane-art svg { width: 32px; height: 32px; color: var(--fg); }

.pane-top h3 {
  margin: 0 0 6px;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-weight: 500;
}

.pane-top p { margin: 0; color: var(--muted); line-height: 1.6; }

.fields {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 10px var(--space-2);
  margin: 0;
  padding-top: var(--space-2);
  border-top: 1px solid var(--line);
}

.fields dt {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.fields dd { margin: 0; font-variant-numeric: tabular-nums; }

/* Table form */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

td.wrap { white-space: normal; min-width: 220px; color: var(--muted); }

/* Row form */
.rows { list-style: none; margin: 0; padding: 0; }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.row .swatch {
  flex: none;
  width: 4px;
  align-self: stretch;
  background: linear-gradient(180deg, var(--g1) 0%, var(--g2) 100%);
}

.row-name { font-weight: 500; }

.row-desc {
  color: var(--muted);
  margin-left: auto;
  text-align: right;
  font-size: 14px;
}

/* Metric form */
.metric-n {
  font-size: 62px;
  line-height: 1.1;
  letter-spacing: 0.01em;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.metric-label {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
  max-width: 46ch;
}

/* Chip form */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--space-2);
}

.lens {
  height: var(--chip-h);
  padding: 0 var(--chip-x);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.lens:hover { border-color: var(--line-strong); color: var(--fg); }

.lens[aria-pressed="true"] {
  background: var(--surface-active);
  border-color: var(--line-strong);
  color: var(--fg);
  font-weight: 500;
}

.lens:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

.lens .count { font-variant-numeric: tabular-nums; opacity: 0.7; }

/* Empty + unknown forms */
.empty {
  padding: var(--space-3) 0;
  text-align: center;
}

.empty h3 {
  margin: 0 0 8px;
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.empty p {
  margin: 0 auto;
  max-width: 48ch;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.unknown { border-color: var(--line-strong); }
.unknown h3 { color: var(--fg); }

/* ---------- composer ---------- */

.composer {
  flex: none;
  border-top: 1px solid var(--line);
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.composer-row { display: flex; gap: 10px; }

input[type="text"] {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 var(--space-2);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
}

input[type="text"]::placeholder { color: var(--muted); }

input[type="text"]:hover { border-color: var(--line-strong); }

input[type="text"]:focus {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
  border-color: var(--line-strong);
}

.send {
  flex: none;
  height: 44px;
  padding: 0 var(--space-3);
  background: var(--fg);
  color: var(--bg);
  border: 1px solid var(--fg);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.send:hover { opacity: 0.82; }
.send:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

/* ---------- decision rail ---------- */

.trace { display: flex; flex-direction: column; gap: var(--space-3); }

.trace-empty { color: var(--muted); line-height: 1.6; }

.rule {
  display: flex;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.5;
}

.rule:last-child { border-bottom: 0; }

.rule-n {
  flex: none;
  font-weight: 700;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.rule.hit { color: var(--fg); }
.rule.hit .rule-n { color: var(--status-live); }

.rule.hit .rule-text b { font-weight: 700; }

.verdict {
  padding: 12px;
  border: 1px solid var(--line-strong);
  background: var(--bg-elev);
}

.verdict dt {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.verdict dd { margin: 4px 0 12px; line-height: 1.5; }
.verdict dd:last-child { margin-bottom: 0; }

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .shell { grid-template-columns: 232px minmax(0, 1fr); }
  .col.rail { display: none; }
}

@media (max-width: 760px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    height: auto;
    min-height: 100dvh;
  }
  .col.roster { max-height: 40vh; }
  .col + .col { border-left: 0; border-top: 1px solid var(--line); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
