/*
 * Workspace styling.
 *
 * Tokens first, components second. There is no build step and no framework:
 * this file is served as written, and the Content-Security-Policy forbids
 * inline script, so nothing here depends on JavaScript running.
 */

:root {
  --paper: #fafbf9;
  --surface: #ffffff;
  --surface-2: #f1f5f2;
  --ink: #1d2a2e;
  --ink-2: #4a5b60;
  --ink-3: #71838a;
  --line: #dde5e1;
  --accent: #0e7c6b;
  --accent-ink: #0a5a4e;
  --accent-soft: #ddede9;
  --warn-soft: #f5ecdb;
  --warn-ink: #7a5a1e;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(29, 42, 46, .05), 0 4px 14px rgba(29, 42, 46, .04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12191c;
    --surface: #182126;
    --surface-2: #1e2a30;
    --ink: #e4ebe8;
    --ink-2: #a9bab6;
    --ink-3: #7c8f8b;
    --line: #263238;
    --accent: #3fb39c;
    --accent-ink: #6fcbb8;
    --accent-soft: #16302c;
    --warn-soft: #33290f;
    --warn-ink: #d8b15e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .22);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

h1 { font-size: 1.9rem; line-height: 1.15; margin: .2em 0 .3em; letter-spacing: -.015em; }
h2 { font-size: 1.15rem; margin: 0 0 .7em; }
p  { margin: 0 0 1em; }
a  { color: var(--accent); }
a:focus-visible, .sidebar__link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

code, .mono {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .86em;
}
code { background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }

.eyebrow {
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 .2em;
}
.lede { color: var(--ink-2); max-width: 62ch; }
.muted { color: var(--ink-3); }

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

.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
@media (max-width: 720px) { .shell { grid-template-columns: 1fr; } }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.sidebar__brand { display: flex; align-items: center; gap: 10px; }
.sidebar__mark {
  width: 22px; height: 22px; border-radius: 6px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-ink));
}
.sidebar__name { font-weight: 650; font-size: .95rem; }

.sidebar__nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar__link {
  color: var(--ink-2);
  text-decoration: none;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: .92rem;
}
.sidebar__link:hover { background: var(--surface-2); color: var(--ink); }
.sidebar__link.is-current { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }

.content { padding: 40px 32px 72px; max-width: 900px; }
.page-head { margin-bottom: 28px; }

/* ---- components -------------------------------------------------------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.card__label { font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.card__value { font-weight: 600; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
}

.list { margin: 0; padding-left: 1.2em; }
.list li { margin: .3em 0; }

.pill {
  display: inline-block;
  padding: .12em .65em;
  border-radius: 99px;
  font-size: .78rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--ink-2);
}
.pill--active, .pill--trial { background: var(--accent-soft); color: var(--accent-ink); }
.pill--past_due, .pill--suspended { background: var(--warn-soft); color: var(--warn-ink); }

/* ---- bare pages (errors, sign-in) -------------------------------------- */

.bare { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.bare__panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 36px;
  max-width: 460px;
  width: 100%;
}

/* ---- forms --------------------------------------------------------------- */

.form { display: flex; flex-direction: column; gap: 14px; margin: 18px 0 12px; }
.form--inline { flex-direction: row; align-items: center; gap: 8px; margin: 8px 0 0; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .form__row { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 5px; }
.field__label { font-size: .82rem; font-weight: 600; color: var(--ink-2); }

input[type="text"], input[type="email"], input[type="password"], textarea {
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  width: 100%;
}
input:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
textarea { resize: vertical; min-height: 72px; }

.input--code {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 1.5rem;
  letter-spacing: .4em;
  text-align: center;
}
.input--reason { min-width: 220px; }

.btn {
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 18px;
  cursor: pointer;
  align-self: flex-start;
}
.btn:hover { background: var(--accent-ink); }
.btn--quiet {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}
.btn--quiet:hover { background: var(--surface-2); }
.btn--warn { background: var(--warn-ink); }
.btn--block { width: 100%; align-self: stretch; }
.btn--tiny { padding: 4px 11px; font-size: .82rem; }

/* ---- notices and banners -------------------------------------------------- */

.notice {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-radius: 8px;
  padding: 11px 15px;
  margin: 0 0 18px;
  font-size: .92rem;
}
.notice--bad { background: var(--warn-soft); color: var(--warn-ink); }
.notice--ok  { background: var(--accent-soft); color: var(--accent-ink); }
.notice a { color: inherit; text-decoration: underline; }

.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 9px 18px;
  font-size: .88rem;
  font-weight: 500;
}
.banner--support { background: #41519e; color: #fff; }
.banner--warn    { background: var(--warn-ink); color: #fff; }
.banner .btn--tiny { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .3); color: #fff; }
.banner .btn--tiny:hover { background: rgba(255, 255, 255, .26); }
.banner form { margin: 0; }

/* ---- panels, tables, chips ------------------------------------------------- */

.panel + .panel { margin-top: 18px; }
.panel--ok   { border-left: 3px solid var(--accent); }
.panel--warn { border-left: 3px solid var(--warn-ink); }

.tbl-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th {
  text-align: left;
  font-size: .72rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.small { font-size: .84rem; }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 16px; margin: 0 0 14px; font-size: .9rem; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; gap: 2px; } }
.kv dt { font-weight: 600; color: var(--ink-2); }
.kv dd { margin: 0; }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; }
.chip {
  background: var(--surface-2);
  color: var(--ink-2);
  border-radius: 6px;
  padding: 3px 9px;
  font-size: .78rem;
}

.pill--phi     { background: var(--warn-soft); color: var(--warn-ink); margin-left: 6px; }
.pill--support { background: #e2e6f4; color: #41519e; margin-left: 6px; }
.pill--invited, .pill--provisioning { background: var(--surface-2); color: var(--ink-3); }
.pill--disabled { background: var(--warn-soft); color: var(--warn-ink); }

.document {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 20px;
  max-height: 420px;
  overflow: auto;
  font-size: .82rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

/* ---- sidebar footer -------------------------------------------------------- */

.sidebar__foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.who { display: flex; flex-direction: column; gap: 1px; padding: 0 10px; }
.who__name  { font-size: .88rem; font-weight: 600; }
.who__roles { font-size: .76rem; color: var(--ink-3); }
.sidebar__mark--platform { background: linear-gradient(135deg, #41519e, #2d3a75); }

.bare__panel .form { margin-top: 22px; }

/* An unread reply should be findable at a glance in a long list. */
tr.is-unread td { background: var(--accent-soft); }
tr.is-unread td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

.pill--sent, .pill--delivered, .pill--read { background: var(--accent-soft); color: var(--accent-ink); }
.pill--skipped, .pill--cancelled { background: var(--surface-2); color: var(--ink-3); }
.pill--failed { background: var(--warn-soft); color: var(--warn-ink); }

input[type="file"] {
  font: inherit;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px dashed var(--line-strong, var(--line));
  border-radius: 8px;
  padding: 14px;
  width: 100%;
}
