/* The same visual language as pd.ravaya.ae and invoice.ravaya.ae: one house,
   three doors. Colours live here at the top so the dark palette can redefine
   every one of them in a single place. */

:root {
  --paper: #f1f3f5;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --rule: #dee2e6;
  --rule-2: #ced4da;
  --ink: #212529;
  --ink-2: #495057;
  --ink-3: #6c757d;
  --brass: #17541f;
  --brass-soft: #e8f1e9;
  --red: #b42318;
  --red-soft: #fdecea;
  --amber: #8a6100;
  --amber-soft: #fdf3e3;
  --r: 6px;
  --r-lg: 8px;
  --shadow: 0 1px 2px rgba(33, 37, 41, .05);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --rail: 15.25rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #131619;
    --surface: #1b1f23;
    --surface-2: #22262b;
    --rule: #2e343a;
    --rule-2: #3a4148;
    --ink: #e6e9ec;
    --ink-2: #b9c0c7;
    --ink-3: #8b949c;
    --brass: #6fbf7a;
    --brass-soft: #1d2a20;
    --red: #e4756a;
    --red-soft: #2a1b1a;
    --amber: #d9a441;
    --amber-soft: #2b2416;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
  .btn-primary { color: #0c1a0f; }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: .95rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
}

h1 { font-size: 1.35rem; margin: 0; }
h2 { font-size: 1rem; margin: 0 0 .75rem; }

.shell { display: flex; min-block-size: 100dvh; }

.rail {
  inline-size: var(--rail);
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.25rem 1rem;
  background: var(--surface);
  border-inline-end: 1px solid var(--rule);
}

.brand { display: block; text-decoration: none; color: inherit; }
.brand strong { display: block; font-size: 1.15rem; letter-spacing: .02em; }
.brand small { display: block; color: var(--ink-3); font-size: .78rem; }

.eyebrow {
  display: block;
  font-size: .66rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--brass);
  font-weight: 700;
}

.rail nav { display: flex; flex-direction: column; gap: .15rem; }

.rail nav a {
  padding: .45rem .6rem;
  border-radius: var(--r);
  text-decoration: none;
  color: var(--ink-2);
}

.rail nav a:hover { background: var(--surface-2); }
.rail nav a[aria-current="page"] { background: var(--brass-soft); color: var(--brass); font-weight: 600; }

.rail-foot { margin-block-start: auto; display: flex; flex-direction: column; gap: .5rem; }
.who strong { display: block; }

.workspace { flex: 1; min-inline-size: 0; }

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-block-end: 1px solid var(--rule);
}

main { padding: 1.5rem; max-inline-size: 90rem; }

.panel {
  padding: 1.25rem;
  margin-block-end: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}

table { inline-size: 100%; border-collapse: collapse; }

th, td {
  text-align: start;
  padding: .6rem .7rem;
  border-block-end: 1px solid var(--rule);
  vertical-align: top;
}

th {
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-3);
  background: var(--surface-2);
}

.sub { display: block; font-size: .76rem; color: var(--ink-3); }
.mono { font-family: var(--mono); }
.none { color: var(--ink-3); }
.off { color: var(--red); }
.acc { display: block; margin-block-end: .35rem; }

.tag {
  display: inline-block;
  padding: .1rem .45rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 650;
  background: var(--surface-2);
  border: 1px solid var(--rule-2);
  color: var(--ink-2);
}

.count {
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink-3);
}

.live {
  margin-inline-start: auto;
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.empty { color: var(--ink-3); padding: 1.5rem 0; }
.fineprint { font-size: .8rem; color: var(--ink-3); }

.note {
  padding: .75rem 1rem;
  border-radius: var(--r);
  margin-block-end: 1rem;
}

.note-bad { background: var(--red-soft); color: var(--red); }

/* Sign-in -------------------------------------------------------------- */

.gate {
  min-block-size: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.gate-box { inline-size: min(26rem, 100%); }
.gate-crest { text-align: center; margin-block-end: 1rem; }
.gate-crest strong { display: block; font-size: 1.3rem; }

label {
  display: block;
  margin-block: .75rem .3rem;
  font-size: .8rem;
  color: var(--ink-3);
}

input {
  inline-size: 100%;
  padding: .5rem .65rem;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-radius: var(--r);
}

input:focus-visible {
  outline: none;
  border-color: var(--brass);
  box-shadow: 0 0 0 3px var(--brass-soft);
}

.btn {
  display: inline-block;
  padding: .5rem .9rem;
  font: inherit;
  border: 1px solid var(--rule-2);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
}

.btn:hover { border-color: var(--brass); color: var(--brass); }

.btn-primary {
  inline-size: 100%;
  margin-block-start: 1rem;
  background: var(--brass);
  border-color: var(--brass);
  color: #ffffff;
  font-weight: 600;
}

.btn-quiet { background: transparent; }

.qr { display: grid; place-items: center; margin: 1rem 0; }

/* Big enough for a phone camera to read across a desk, and never wider than
   the card. The SVG carries a viewBox, so this scales it rather than cropping
   it -- a cropped QR code looks fine and will not scan. */
.qr svg {
  inline-size: min(16rem, 100%);
  block-size: auto;
  background: #ffffff;
  padding: .5rem;
  border-radius: var(--r);
}

.secret {
  font-family: var(--mono);
  font-size: .95rem;
  letter-spacing: .06em;
  word-break: break-all;
  padding: .5rem .65rem;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: var(--r);
}

:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .rail { inline-size: auto; border-inline-end: none; border-block-end: 1px solid var(--rule); }
  main { padding: 1rem; }
}

/* Attaching an account to a person ---------------------------------------- */

.row-form {
  display: flex;
  gap: .3rem;
  align-items: center;
  margin-block-end: .3rem;
}

.row-form select,
.row-form input {
  inline-size: 9rem;
  padding: .25rem .4rem;
  font-size: .82rem;
}

select {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-radius: var(--r);
  padding: .4rem .5rem;
}

.btn-compact { padding: .25rem .55rem; font-size: .82rem; }

.new-person summary {
  cursor: pointer;
  font-size: .78rem;
  color: var(--ink-3);
  list-style: none;
}

.new-person summary::-webkit-details-marker { display: none; }
.new-person[open] summary { color: var(--brass); }
.new-person .row-form { margin-block-start: .35rem; }

/* A detach is a correction, not a decision; it should not look like a button. */
.linkish {
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: .72rem;
  color: var(--ink-3);
  text-decoration: underline;
  cursor: pointer;
}

.linkish:hover { color: var(--red); }
.inline { display: inline; }

/* Operations -------------------------------------------------------------- */

.state {
  display: inline-block;
  padding: .1rem .45rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 650;
}

.state-ok      { background: var(--brass-soft); color: var(--brass); }
.state-failed  { background: var(--red-soft);   color: var(--red); }
.state-pending,
.state-skipped { background: var(--surface-2);  color: var(--ink-3); }

.note-ok   { background: var(--brass-soft); color: var(--brass); }
.note-warn { background: var(--amber-soft); color: var(--amber); }

.action-strip { display: flex; gap: .5rem; flex-wrap: wrap; }
.action-strip form { margin: 0; }

.btn-danger { border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red-soft); color: var(--red); }

.person-link { color: inherit; text-decoration: none; }
.person-link:hover strong { color: var(--brass); text-decoration: underline; }

fieldset {
  margin: 1rem 0 0;
  padding: .75rem .9rem;
  border: 1px solid var(--rule);
  border-radius: var(--r);
}

legend { font-size: .8rem; color: var(--ink-3); padding-inline: .3rem; }

.tick {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0 0 .3rem;
  font-size: .9rem;
  color: var(--ink);
}

.tick input { inline-size: auto; }
