/* Three Sixteen Ops — brand styling.
   Palette, type and proportions taken from threesixteen.com: ivory page,
   black chrome (as the site's footer), brown as the one action colour.
   No green anywhere. */

@font-face { font-family:'PP Mori'; src:url('/fonts/PPMori-Regular.ttf')  format('truetype'); font-weight:400; font-style:normal; font-display:swap; }
@font-face { font-family:'PP Mori'; src:url('/fonts/PPMori-Medium.ttf')   format('truetype'); font-weight:500; font-style:normal; font-display:swap; }
@font-face { font-family:'PP Mori'; src:url('/fonts/PPMori-SemiBold.ttf') format('truetype'); font-weight:600; font-style:normal; font-display:swap; }

:root {
  /* brand tokens, lifted from the site */
  --ivory:        #f5f2eb;
  --white:        #ffffff;
  --light-beige:  #e0d7c4;
  --dark-beige:   #d1c4aa;
  --brown:        #6d4e41;
  --black:        #1b1b1b;
  --darker-grey:  #242424;
  --dark-grey:    #707070;
  --mid-grey:     #adadad;
  --light-grey:   #ebebeb;
  --lighter-grey: #f7f7f7;
  --accent-yellow:#f2ff37;

  /* roles */
  --paper:     var(--ivory);
  --card:      var(--white);
  --line:      var(--light-beige);
  --ink:       var(--black);
  --ink-soft:  #4a4a4a;
  --ink-faint: var(--dark-grey);
  --accent:    var(--brown);
  --accent-ink:#ffffff;
  --accent-wash: #f0e9e3;

  --side:      var(--black);
  --side-ink:  var(--ivory);
  --side-dim:  #9a9188;
  --side-line: #2f2f2f;

  --danger:      #a3392c;
  --danger-soft: #f6e7e4;
  --warn:        #7a5a1c;
  --warn-soft:   #f6efdf;
  --ok:          var(--brown);
  --ok-soft:     var(--accent-wash);

  --radius: 4px;
  --font: 'PP Mori', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:     #131211;
    --card:      #1c1a18;
    --line:      #322e29;
    --ink:       var(--ivory);
    --ink-soft:  #bdb5a9;
    --ink-faint: #8d857a;
    --accent:    #a97a66;
    --accent-ink:#1b1b1b;
    --accent-wash: #2a221e;

    --side:      #0d0c0b;
    --side-ink:  var(--ivory);
    --side-dim:  #8d857a;
    --side-line: #292522;

    --danger:      #d98d80;
    --danger-soft: #2c1e1b;
    --warn:        #d9bb77;
    --warn-soft:   #2b2519;
    --ok:          #a97a66;
    --ok-soft:     #2a221e;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: 2px; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.025em; line-height: 1.05; margin: 0; }
code { font: 13px/1.4 var(--mono); background: var(--accent-wash); color: var(--accent);
  padding: 1px 5px; border-radius: 3px; }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; }
.brand-logo { display: block; width: 100%; max-width: 210px; height: auto; }
.auth-card .brand { justify-content: center; margin-bottom: 30px; }
.auth-card .brand-logo { max-width: 240px; }
.brand-sub { font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-faint); text-align: center; margin: 10px 0 0; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100%; display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 40px 36px 32px; }
.auth-card label { display: block; font-size: 11px; font-weight: 500; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-faint); margin: 18px 0 6px; }
.auth-card input { width: 100%; padding: 12px 14px; font: inherit; font-size: 15px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.auth-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.auth-card button { width: 100%; margin-top: 26px; padding: 13px; font: inherit; font-weight: 500;
  font-size: 14px; letter-spacing: .04em; color: var(--accent-ink); background: var(--accent);
  border: 0; border-radius: var(--radius); cursor: pointer; transition: opacity .15s; }
.auth-card button:hover { opacity: .88; }
.auth-foot { margin: 20px 0 0; font-size: 13px; line-height: 1.5; color: var(--ink-faint); text-align: center; }
.notice { padding: 10px 13px; border-radius: var(--radius); font-size: 13.5px; margin-bottom: 6px; }
.notice.err  { background: var(--danger-soft); color: var(--danger); }
.notice.ok   { background: var(--ok-soft); color: var(--ok); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.sidebar { background: var(--side); color: var(--side-ink); padding: 30px 20px 20px;
  display: flex; flex-direction: column; gap: 30px; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { padding: 0 8px; }
.sidebar .brand-logo { max-width: 190px; }
.nav-section { font-size: 10px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase;
  color: var(--side-dim); padding: 0 12px; margin-bottom: -18px; }
.nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; text-align: left;
  background: none; border: 0; border-radius: var(--radius); color: var(--side-ink); font: inherit; cursor: pointer;
  transition: background .12s; }
.nav-item svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round; opacity: .65; }
.nav-text { display: flex; flex-direction: column; min-width: 0; }
.nav-label { font-size: 14.5px; font-weight: 500; letter-spacing: -.01em; }
.nav-blurb { font-size: 11.5px; color: var(--side-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item:hover { background: #ffffff0f; }
.nav-item[aria-current="true"] { background: var(--brown); color: #fff; }
.nav-item[aria-current="true"] .nav-blurb { color: #ffffffb8; }
.nav-item[aria-current="true"] svg { opacity: 1; }
.side-foot { margin-top: auto; border-top: 1px solid var(--side-line); padding-top: 18px; }
.who { display: flex; align-items: center; gap: 11px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brown); color: #fff;
  display: grid; place-items: center; font-weight: 500; font-size: 14px; }
.who-text { display: flex; flex-direction: column; min-width: 0; }
.who-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-role { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--side-dim); }
/* "Password" is a bare <a>, "Sign out" is a <button> inside a <form>. Without
   this the form stretches as a flex item and its button sits lower than the
   link, so the two sit on visibly different baselines. Centre both, and give
   the form no box of its own. */
.side-actions { display: flex; align-items: center; gap: 16px; margin-top: 14px; padding-left: 2px; }
.side-actions form { margin: 0; display: flex; align-items: center; }
.side-actions .link-btn { display: block; line-height: 1.4; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-size: 12.5px;
  color: var(--side-dim); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.link-btn:hover { color: var(--side-ink); }

/* min-width:0 is required: a grid item defaults to min-width:auto, so the wide
   admin table would push the whole column open instead of scrolling inside
   .table-scroll, and the entire page would scroll sideways. */
.content { padding: 46px 48px 70px; max-width: 1220px; min-width: 0; }
.panel, .table-scroll { min-width: 0; max-width: 100%; }
.loading { color: var(--ink-faint); }

/* ---------- panes ---------- */
.pane-head { margin-bottom: 30px; }
.pane-head h2 { font-size: clamp(28px, 3vw, 40px); margin-bottom: 8px; }
.pane-head p { margin: 0; color: var(--ink-soft); font-size: 15px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 28px; margin-bottom: 22px; }
.panel h3 { font-size: 12px; font-weight: 500; letter-spacing: .13em; text-transform: uppercase;
  color: var(--ink-faint); margin-bottom: 18px; }
.hint { margin: 14px 0 0; font-size: 12.5px; color: var(--ink-faint); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; display: flex; flex-direction: column; gap: 3px; }
.stat-label { font-size: 10px; font-weight: 500; letter-spacing: .15em; text-transform: uppercase; color: var(--ink-faint); }
.stat-value { font-size: 34px; font-weight: 600; letter-spacing: -.03em; line-height: 1.1; margin-top: 4px; }
.stat-note { font-size: 12.5px; color: var(--ink-soft); }
.empty-state { background: var(--card); border: 1px solid var(--line); border-left: 2px solid var(--dark-beige);
  border-radius: var(--radius); padding: 38px 32px; }
.empty-mark { width: 26px; height: 26px; border: 1.5px solid var(--dark-beige); border-radius: 50%; }
.empty-state h3 { margin: 16px 0 8px; font-size: 19px; letter-spacing: -.02em; text-transform: none; color: var(--ink); }
.empty-state p { margin: 0; color: var(--ink-soft); font-size: 14.5px; max-width: 60ch; }
.next-list { margin: 18px 0 0; padding-left: 18px; color: var(--ink-soft); font-size: 14px; }
.next-list li { margin: 6px 0; }

/* ---------- tables ---------- */
.table-scroll { overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid th { text-align: left; font-size: 10px; letter-spacing: .13em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 500; padding: 0 10px 11px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid td { padding: 13px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid tr.inactive { opacity: .5; }
/* Permission columns were sized by their HEADER TEXT, not their content:
   `.grid th` sets white-space:nowrap, so "TIP ALLOCATION" alone forced a 120px
   column and the table overflowed into a scrollbar on a wide screen. Let these
   headers wrap — a checkbox needs far less room than its label. */
.perm, .perm-head { text-align: center; width: 58px; }
/* These columns hold a 16px checkbox, so the generic 10px cell padding and the
   .13em header tracking were costing ~16px per column for nothing. */
.grid th.perm-head, .grid td.perm { padding-left: 4px; padding-right: 4px; }
.grid th.perm-head { white-space: nowrap; letter-spacing: .04em; }
.perm-head span { display: block; font-size: 9.5px; line-height: 1.2; }
.role-select { width: 86px; }
.perm-box { width: 16px; height: 16px; accent-color: var(--brown); cursor: pointer; }
.perm-box:disabled { cursor: not-allowed; opacity: .4; }
.u-name { font-weight: 500; }
.u-mail { color: var(--ink-soft); font-size: 13px; }
.u-meta { color: var(--ink-faint); font-size: 11.5px; margin-top: 3px; }
.mono { font-family: var(--mono); font-size: 12px; }
.dim { color: var(--ink-soft); }
.tag { display: inline-block; font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: .1em;
  padding: 2px 7px; border-radius: 3px; background: var(--accent-wash); color: var(--accent); }
.tag.off  { background: var(--danger-soft); color: var(--danger); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.row-actions { white-space: nowrap; }
.mini:last-child { margin-right: 0; }
/* Audit "Detail" is free text of any length — wrap it instead of widening the table. */
.grid.log td:last-child { white-space: normal; word-break: break-word; }
select, .inline-form input { font: inherit; font-size: 13.5px; padding: 7px 8px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--paper); color: var(--ink); }
select:focus, .inline-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.mini { font: inherit; font-size: 12px; padding: 5px 9px; margin-right: 4px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink-soft); border-radius: var(--radius); cursor: pointer; transition: .12s; }
.mini:hover { border-color: var(--accent); color: var(--accent); }
.mini.danger:hover { border-color: var(--danger); color: var(--danger); }
.inline-form { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 10px; font-weight: 500; letter-spacing: .13em; text-transform: uppercase; color: var(--ink-faint); }
.inline-form button { font: inherit; font-weight: 500; font-size: 14px; letter-spacing: .03em; padding: 10px 20px;
  color: var(--accent-ink); background: var(--accent); border: 0; border-radius: var(--radius); cursor: pointer; }
.inline-form button:hover { opacity: .88; }

/* ---------- toast ---------- */
#toast { position: fixed; right: 24px; bottom: 24px; max-width: 430px; display: flex; flex-direction: column; gap: 10px; z-index: 50; }
.toast { background: var(--black); color: var(--ivory); border-radius: var(--radius);
  padding: 14px 16px; font-size: 14px; box-shadow: 0 10px 30px rgba(27,27,27,.22); }
.toast.err { background: var(--danger); color: #fff; }
.toast .secret { display: block; margin-top: 9px; font-family: var(--mono); font-size: 13px;
  background: #ffffff1f; color: var(--accent-yellow); padding: 9px 10px; border-radius: 3px;
  user-select: all; word-break: break-all; }

/* Below this the accounts table cannot fit its columns on one line. Rather than
   show a horizontal scrollbar, let the action buttons and the email wrap — a
   slightly taller row reads better than a scrollbar. Wide screens are untouched. */
@media (max-width: 1200px) {
  .row-actions { white-space: normal; }
  .mini { margin-bottom: 4px; }
}

/* ---------- narrow screens ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; gap: 24px; }
  .content { padding: 28px 20px 56px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-item { width: auto; }
  .nav-blurb { display: none; }
  .sidebar .brand-logo { max-width: 160px; }
}

/* ---------- wordmark ---------- */
.brand-logo {
  display: block; width: 100%; max-width: 210px; aspect-ratio: 1002 / 113;
  background-color: currentColor;
  -webkit-mask: url('/brand/logo.svg?v=80759b9e') no-repeat center / contain;
          mask: url('/brand/logo.svg?v=80759b9e') no-repeat center / contain;
}
.sidebar .brand { color: var(--side-ink); }
.auth-card .brand { color: var(--ink); }
