/* ============================================================================
   InfraSpace Meetings -- client stylesheet

   Palette is taken from the platform hub's own ACCENTS/TONES so the product
   sits inside InfraSpace rather than beside it: sky #0ea5e9, blue #3b82f6,
   ok #22c55e, warn #f59e0b, bad #ef4444, idle #64748b.
   ========================================================================= */

:root {
  --bg:        #070b14;
  --bg-2:      #0c1322;
  --panel:     #111a2c;
  --panel-2:   #16223a;
  --line:      #1f2c46;
  --line-soft: #172238;
  --text:      #e8eefb;
  --text-dim:  #9db0d0;
  --text-mute: #6b7fa3;
  --sky:       #0ea5e9;
  --blue:      #3b82f6;
  --ok:        #22c55e;
  --warn:      #f59e0b;
  --bad:       #ef4444;
  --idle:      #64748b;
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 18px 40px -24px rgba(0, 0, 0, .9);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image:
    radial-gradient(900px 480px at 12% -8%, rgba(14, 165, 233, .16), transparent 62%),
    radial-gradient(760px 420px at 88% 0%, rgba(59, 130, 246, .13), transparent 60%);
  background-repeat: no-repeat;
}

a { color: var(--sky); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.18rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .7rem; }
code, .mono { font-family: "JetBrains Mono", "Cascadia Mono", Consolas, monospace; font-size: .86em; }

/* ------------------------------------------------------------------ topbar */

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 14, 25, .78);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 11px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(140deg, var(--sky), var(--blue));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .09) inset, 0 6px 18px -8px rgba(14, 165, 233, .9);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: .96rem; letter-spacing: .01em; }
.brand-text span { font-size: .8rem; color: var(--text-dim); }

.topnav { display: flex; gap: 16px; margin-left: auto; font-size: .9rem; }
.topnav a { color: var(--text-dim); }
.topnav a:hover { color: var(--text); text-decoration: none; }

.conn {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); font-size: .82rem; color: var(--text-dim);
  max-width: 42ch;
}
.conn-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--idle); flex: none; }
.conn[data-state="ok"]   .conn-dot { background: var(--ok);   box-shadow: 0 0 0 4px rgba(34, 197, 94, .16); }
.conn[data-state="warn"] .conn-dot { background: var(--warn); box-shadow: 0 0 0 4px rgba(245, 158, 11, .16); }
.conn[data-state="bad"]  .conn-dot { background: var(--bad);  box-shadow: 0 0 0 4px rgba(239, 68, 68, .16); }

/* ----------------------------------------------------------------- layout */

.app { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 26px 22px 40px; }

.boot { text-align: center; color: var(--text-dim); padding: 70px 0; }
.boot-spinner {
  width: 26px; height: 26px; margin: 0 auto 14px;
  border: 2px solid var(--line); border-top-color: var(--sky);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.cols { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }

.panel {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { flex: 1; }
.panel-sub { color: var(--text-dim); font-size: .88rem; }

.section-title {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .13em;
  color: var(--text-dim); margin: 22px 0 10px;
}

/* ------------------------------------------------------------------ chips */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  font-size: .74rem; font-weight: 600; letter-spacing: .02em;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text-dim);
  white-space: nowrap;
}
.chip-ok    { color: #86efac; border-color: rgba(34, 197, 94, .35);  background: rgba(34, 197, 94, .1); }
.chip-warn  { color: #fcd34d; border-color: rgba(245, 158, 11, .35); background: rgba(245, 158, 11, .1); }
.chip-bad   { color: #fca5a5; border-color: rgba(239, 68, 68, .35);  background: rgba(239, 68, 68, .1); }
.chip-sky   { color: #7dd3fc; border-color: rgba(14, 165, 233, .35); background: rgba(14, 165, 233, .1); }
.chip-idle  { color: var(--text-dim); }

/* ------------------------------------------------------------------ forms */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; }
.field label { font-size: .82rem; color: var(--text-dim); font-weight: 600; }
.field .hint { font-size: .76rem; color: var(--text-dim); opacity: .85; }

input, select, textarea {
  width: 100%; padding: 9px 11px; color: var(--text);
  background: #0a1120; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(14, 165, 233, .45); outline-offset: 1px; border-color: var(--sky); }
textarea { min-height: 84px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #55688a; }

.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }
@media (max-width: 620px) { .row { flex-direction: column; } }

.check { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 11px; font-size: .88rem; }
.check input { width: auto; margin-top: 3px; flex: none; }
.check span small { display: block; color: var(--text-dim); font-size: .78rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 15px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  font: inherit; font-weight: 600; font-size: .88rem;
}
.btn:hover { border-color: #2c3f63; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(140deg, var(--sky), var(--blue)); border-color: transparent; color: #04121f; }
.btn-danger  { border-color: rgba(239, 68, 68, .45); color: #fca5a5; background: rgba(239, 68, 68, .1); }
.btn-quiet   { background: transparent; }
.btn-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 6px; }

/* ------------------------------------------------------------------ rooms */

.rooms { display: flex; flex-direction: column; gap: 11px; }
.room-card {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); padding: 14px 15px;
}
.room-card.is-open { border-color: rgba(14, 165, 233, .5); background: var(--panel-2); }
.room-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.room-top h3 { flex: 1; min-width: 12ch; }
.room-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.room-agenda { color: var(--text-dim); font-size: .88rem; margin-top: 9px; white-space: pre-wrap; }
.room-actions { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }

.empty { color: var(--text-dim); border: 1px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center; }

.kv { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 6px 14px; font-size: .88rem; }
.kv dt { color: var(--text-dim); }
.kv dd { margin: 0; word-break: break-word; }
@media (max-width: 620px) { .kv { grid-template-columns: 1fr; gap: 2px 0; } .kv dd { margin-bottom: 8px; } }

/* ---------------------------------------------------------------- notices */

.banner {
  display: flex; flex-direction: column; gap: 4px;
  border: 1px solid var(--line); border-left-width: 3px; border-radius: var(--radius-sm);
  padding: 12px 14px; margin-bottom: 16px; font-size: .9rem; background: var(--panel);
}
.banner strong { font-size: .92rem; }
.banner span { color: var(--text-dim); }
.banner-bad  { border-left-color: var(--bad);  background: rgba(239, 68, 68, .07); }
.banner-warn { border-left-color: var(--warn); background: rgba(245, 158, 11, .07); }
.banner-ok   { border-left-color: var(--ok);   background: rgba(34, 197, 94, .07); }
.banner ul { margin: 4px 0 0; padding-left: 20px; color: var(--text-dim); }

.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 9px; z-index: 50; max-width: min(430px, 92vw); }
.toast {
  border: 1px solid var(--line); border-left-width: 3px; border-radius: var(--radius-sm);
  background: #0d1626; padding: 11px 13px; font-size: .87rem; box-shadow: var(--shadow);
  animation: rise .18s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.toast strong { display: block; margin-bottom: 3px; }
.toast span { color: var(--text-dim); word-break: break-word; }
.toast-bad  { border-left-color: var(--bad); }
.toast-ok   { border-left-color: var(--ok); }
.toast-warn { border-left-color: var(--warn); }
.toast pre { margin: 6px 0 0; padding: 8px; background: #060b14; border-radius: 6px; overflow: auto; max-height: 200px; font-size: .78rem; }

/* ----------------------------------------------------------------- footer */

.footer {
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 16px 22px; border-top: 1px solid var(--line);
  color: var(--text-dim); font-size: .82rem;
}
.footer-meta { display: flex; gap: 14px; }

/* ---------------------------------------------------------------- utility */

.muted { color: var(--text-dim); }
.tiny  { font-size: .8rem; }
.nowrap { white-space: nowrap; }
.mt0 { margin-top: 0; }
.mb0 { margin-bottom: 0; }
.sep { height: 1px; background: var(--line-soft); margin: 16px 0; }
.pill-code { background: #0a1120; border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }
.center { text-align: center; }

.dl-inline { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: .88rem; }
.dl-inline div { display: flex; gap: 7px; }
.dl-inline dt { color: var(--text-dim); }
.dl-inline dd { margin: 0; }

.linkbox {
  display: flex; gap: 8px; align-items: stretch; margin-top: 8px;
}
.linkbox input { flex: 1; font-size: .84rem; }

table.grid { width: 100%; border-collapse: collapse; font-size: .86rem; }
table.grid th, table.grid td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line-soft); }
table.grid th { color: var(--text-dim); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }

/* ------------------------------------------------------------------- media */
/* The call tiles. A tile is 16:9 with the video filling it and two lines of
   text laid over the bottom, because a mesh call is mostly a grid of faces and
   the state of each one has to be readable at a glance. */
.media-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px; margin-top: 8px;
}
.media-tile {
  position: relative; overflow: hidden; aspect-ratio: 16 / 9;
  border: 1px solid var(--line); border-radius: var(--radius); background: #05080f;
}
.media-tile.is-local { border-color: rgba(14, 165, 233, .5); }
.media-video { display: block; width: 100%; height: 100%; object-fit: cover; background: #05080f; cursor: pointer; }
.media-name {
  position: absolute; left: 9px; bottom: 23px;
  font-size: .78rem; font-weight: 600; color: #fff; text-shadow: 0 1px 3px #000;
}
.media-state {
  position: absolute; left: 9px; bottom: 7px;
  font-size: .72rem; color: var(--text-dim); text-shadow: 0 1px 3px #000;
}
.media-grid .empty { grid-column: 1 / -1; }
