/* Galeport Console
   Port Ink #101C2B · Brass #C08A2E · Paper #F4F0E6
   Light palette on bare :root. Dark redefined twice: media query guarded
   against an explicit light choice, and [data-theme="dark"] for the toggle. */

:root {
  --bg:        #F4F0E6;
  --surface:   #FBF9F3;
  --sunk:      #EFEADC;
  --raised:    #FFFFFF;
  --line:      #DCD5C4;
  --line-soft: #E8E2D4;
  --text:      #101C2B;
  --dim:       #5A6675;
  --faint:     #8A8676;
  --accent:    #9A6B14;
  --brass:     #C08A2E;
  --good:      #2E6F52;
  --alarm:     #A8412C;
  --on-accent: #FFFBF2;
  --shadow:    0 1px 2px rgba(16,28,43,.06), 0 8px 24px rgba(16,28,43,.07);
  --shadow-lg: 0 2px 6px rgba(16,28,43,.08), 0 24px 60px rgba(16,28,43,.16);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  --r: 6px;
  --tap: 46px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C1622; --surface: #14202F; --sunk: #101A27; --raised: #1A2839;
    --line: #26374B; --line-soft: #1D2C3D;
    --text: #EDE7D8; --dim: #9AA8B8; --faint: #6F7F91;
    --accent: #D9A343; --brass: #D9A343; --good: #5FB78C; --alarm: #E0806A;
    --on-accent: #0C1622;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.34);
    --shadow-lg: 0 2px 6px rgba(0,0,0,.5), 0 24px 60px rgba(0,0,0,.5);
  }
}
:root[data-theme="dark"] {
  --bg: #0C1622; --surface: #14202F; --sunk: #101A27; --raised: #1A2839;
  --line: #26374B; --line-soft: #1D2C3D;
  --text: #EDE7D8; --dim: #9AA8B8; --faint: #6F7F91;
  --accent: #D9A343; --brass: #D9A343; --good: #5FB78C; --alarm: #E0806A;
  --on-accent: #0C1622;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.34);
  --shadow-lg: 0 2px 6px rgba(0,0,0,.5), 0 24px 60px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  overflow-wrap: break-word;
}
a { color: inherit; }

/* ------------------------------------------------------------- top bar --- */

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 10px max(14px, env(safe-area-inset-left)) 10px max(14px, env(safe-area-inset-right));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; flex: none; }
.mark { width: 24px; height: 24px; fill: var(--text); flex: none; }
.brand-name { font-family: var(--serif); font-size: 19px; font-weight: 600; letter-spacing: .01em; }

.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  display: flex; align-items: center; min-height: 38px;
  padding: 0 13px; border-radius: 999px;
  text-decoration: none; color: var(--dim); font-size: 14.5px; font-weight: 500;
  border: 1px solid transparent; white-space: nowrap;
}
.nav a:hover { color: var(--text); background: var(--sunk); }
.nav a[aria-current="page"] { color: var(--text); background: var(--sunk); border-color: var(--line); }

.themer { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; flex: none; }
.themer button {
  appearance: none; border: 0; background: transparent; color: var(--dim);
  width: 36px; height: 34px; display: grid; place-items: center; cursor: pointer; padding: 0;
}
.themer button + button { border-left: 1px solid var(--line); }
.themer button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.themer svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.6; }

@media (max-width: 700px) {
  .topbar { gap: 10px; }
  .brand-name { display: none; }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; margin: 0;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    gap: 6px;
  }
  .nav a { flex: 1; justify-content: center; min-height: var(--tap); border-radius: var(--r); font-size: 15px; }
  body { padding-bottom: 76px; }
}

/* -------------------------------------------------------------- layout --- */

.screen { max-width: 1080px; margin: 0 auto; padding: 22px 16px 48px; outline: none; }
.screen.wide { max-width: none; padding-left: 0; padding-right: 0; }

.page-head { margin-bottom: 18px; }
.eyebrow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); margin: 0 0 5px; }
h1 { font-family: var(--serif); font-weight: 600; font-size: 27px; line-height: 1.15; margin: 0 0 4px; text-wrap: balance; }
h2 { font-family: var(--serif); font-weight: 600; font-size: 19px; line-height: 1.2; margin: 0 0 10px; }
h3 { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.lede { color: var(--dim); margin: 0; max-width: 62ch; }
.muted { color: var(--dim); }
.tiny { font-size: 13px; color: var(--faint); }
.num { font-variant-numeric: tabular-nums; }

.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.spread { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; justify-content: space-between; }
.stack { display: grid; gap: 14px; }

/* ------------------------------------------------------------- buttons --- */

.btn {
  appearance: none; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 16px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 15px; font-weight: 500;
}
.btn:hover { border-color: var(--dim); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-brass { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-danger { color: var(--alarm); border-color: color-mix(in srgb, var(--alarm) 40%, var(--line)); background: transparent; }
.btn-sm { min-height: 36px; padding: 0 11px; font-size: 13.5px; }
.btn-wide { width: 100%; }

/* ----------------------------------------------------------- surfaces --- */

.panel {
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--r); padding: 16px;
}
.panel + .panel { margin-top: 14px; }
.panel > h2 { margin-bottom: 12px; }
.panel-head { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; }

.note { border-left: 2px solid var(--accent); padding: 3px 0 3px 14px; color: var(--dim); font-size: 14.5px; }
.note.warn { border-left-color: var(--alarm); }
.empty { color: var(--faint); font-size: 14.5px; padding: 8px 0; }

/* --------------------------------------------------------------- board --- */

.board {
  display: flex; gap: 12px; overflow-x: auto; padding: 2px 16px 14px;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
}
.col {
  flex: 1 0 min(240px, 82vw); display: flex; flex-direction: column; gap: 9px;
  scroll-snap-align: start;
}
.col-head {
  display: flex; align-items: center; gap: 8px; padding: 0 2px 2px;
  position: sticky; top: 0;
}
.col-head .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brass); flex: none; }
.col-head b { font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.col-head .count { margin-left: auto; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.col-body { display: grid; gap: 9px; align-content: start; background: var(--sunk); border-radius: var(--r); padding: 9px; min-height: 84px; }

.card {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r);
  padding: 12px 13px; box-shadow: var(--shadow); font: inherit; color: inherit;
}
.card:hover { border-color: var(--brass); }
.card b { display: block; font-size: 15px; font-weight: 600; line-height: 1.25; }
.card .where { color: var(--dim); font-size: 13.5px; margin-top: 1px; }
.card .figs { display: flex; gap: 10px; margin-top: 9px; flex-wrap: wrap; align-items: baseline; }
.card .fig { font-size: 13px; color: var(--faint); font-variant-numeric: tabular-nums; }
.card .fig b { display: inline; font-size: 13.5px; font-weight: 600; color: var(--text); }
.card .fig.owed b { color: var(--alarm); }
.card .fig.clear b { color: var(--good); }
.card-wrap { display: grid; gap: 8px; }
.card-move { display: flex; gap: 6px; }
.card-move button {
  flex: 1; min-height: 34px; border: 1px solid var(--line); border-radius: 4px;
  background: var(--bg); color: var(--dim); cursor: pointer; font: inherit; font-size: 12.5px;
}
.card-move button:hover:not([disabled]) { color: var(--text); border-color: var(--dim); }
.card-move button[disabled] { opacity: .3; cursor: default; }

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

.fields { display: grid; gap: 14px; }
.two { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; align-items: end; }
@media (max-width: 620px) { .two { grid-template-columns: 1fr; } }

.field > label, .field > .lab { display: block; font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.field .hint { font-size: 13px; color: var(--faint); margin: 0 0 6px; font-weight: 400; }
input[type="text"], input[type="url"], input[type="number"], input[type="date"], select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--raised); color: var(--text);
  font: inherit; font-size: 16px; /* 16px keeps iOS from zooming */
}
textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brass); outline-offset: 1px; border-color: var(--brass); }
input::placeholder, textarea::placeholder { color: var(--faint); }
.field.bad input, .field.bad textarea { border-color: var(--alarm); }
.field .err { color: var(--alarm); font-size: 13px; margin-top: 5px; display: none; }
.field.bad .err { display: block; }

.choice { display: flex; gap: 8px; }
.choice button {
  flex: 1; min-height: var(--tap); border: 1px solid var(--line); border-radius: var(--r);
  background: var(--raised); color: var(--dim); cursor: pointer; font: inherit; font-size: 15px;
}
.choice button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 600; }

/* ---------------------------------------------------------- photo drop --- */

.drop {
  border: 1.5px dashed var(--line); border-radius: var(--r); background: var(--sunk);
  padding: 20px 16px; text-align: center; color: var(--dim);
}
.drop.over { border-color: var(--brass); background: color-mix(in srgb, var(--brass) 10%, var(--sunk)); }
.drop b { display: block; font-size: 15px; color: var(--text); margin-bottom: 3px; }
.drop .btn { margin-top: 12px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.shot { position: relative; aspect-ratio: 1; border-radius: 5px; overflow: hidden; background: var(--sunk); border: 1px solid var(--line-soft); }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot button {
  position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%;
  border: 0; background: rgba(16,28,43,.72); color: #fff; cursor: pointer; font-size: 15px; line-height: 1;
  display: grid; place-items: center;
}

/* --------------------------------------------------------------- steps --- */

.steps { display: grid; gap: 2px; }
.stepline {
  display: flex; align-items: center; gap: 12px; min-height: var(--tap);
  padding: 4px 6px; border-radius: 5px; cursor: pointer; user-select: none;
}
.stepline:hover { background: var(--sunk); }
.stepline input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; margin: 0; min-height: 0; }
.stepline .txt { font-size: 15px; }
.stepline .txt small { display: block; color: var(--faint); font-size: 12.5px; }
.stepline.done .txt { color: var(--dim); }

/* -------------------------------------------------------------- tables --- */

.tw { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--r); }
table { border-collapse: collapse; width: 100%; background: var(--surface); font-size: 14.5px; min-width: 480px; }
th, td { text-align: left; padding: 11px 13px; border-top: 1px solid var(--line-soft); vertical-align: top; }
th { border-top: 0; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 600; border-top: 1px solid var(--line); }

/* --------------------------------------------------------------- stats --- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r); padding: 14px 16px; }
.stat .k { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.stat .v { font-family: var(--serif); font-size: 27px; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat.owed .v { color: var(--alarm); }
.stat.in .v { color: var(--good); }

/* ------------------------------------------------------------- preview --- */

.pv-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.pv-bar .seg { display: flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.pv-bar .seg button { appearance: none; border: 0; background: var(--surface); color: var(--dim); min-height: var(--tap); padding: 0 14px; cursor: pointer; font: inherit; font-size: 14.5px; }
.pv-bar .seg button + button { border-left: 1px solid var(--line); }
.pv-bar .seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); font-weight: 600; }
.pv-stage { background: var(--sunk); border: 1px solid var(--line-soft); border-radius: var(--r); padding: 14px; display: grid; place-items: center; }
.pv-frame { width: 100%; max-width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; box-shadow: var(--shadow-lg); }
.pv-frame.phone { width: 390px; max-width: 100%; border-radius: 18px; }
.pv-frame iframe { display: block; width: 100%; height: 74vh; min-height: 520px; border: 0; background: #fff; }
.pv-frame.phone iframe { height: 720px; }

/* ------------------------------------------------------------- sundry --- */

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 25px; padding: 0 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .02em;
  background: var(--sunk); color: var(--dim); border: 1px solid var(--line-soft);
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--dim); text-decoration: none; font-size: 14.5px; min-height: 38px; }
.back:hover { color: var(--text); }
.saveflash { color: var(--good); font-size: 13px; opacity: 0; transition: opacity .25s; }
.saveflash.on { opacity: 1; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(20px);
  bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 90;
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 999px;
  font-size: 14.5px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; max-width: min(90vw, 420px); text-align: center;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (max-width: 700px) { .toast { bottom: calc(88px + env(safe-area-inset-bottom)); } }

.confirm { display: none; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.confirm.on { display: flex; }
