/* Lincoln Day event manager — internal admin UI.
   Dark by default: this gets used in a dim ballroom on a phone. */

:root {
  --bg:        #0b0f18;
  --bg-2:      #0f1420;
  --surface:   #151b2b;
  --surface-2: #1c2436;
  --line:      #26304a;
  --line-soft: #1e2637;
  --text:      #e8ecf5;
  --muted:     #8d98b3;
  --accent:    #c8102e;   /* Lincoln Day red */
  --accent-dim:#8f0c21;
  --good:      #2fbf71;
  --warn:      #e8b339;
  --info:      #4a9de8;
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 8px 28px rgba(0,0,0,.4);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; }
h2 { font-size: 1rem; letter-spacing: .01em; }
a { color: var(--info); }

.muted { color: var(--muted); }
.small { font-size: .82rem; }
.error { color: #ff8a9b; }
[hidden] { display: none !important; }

/* ── Login ─────────────────────────────────────────────────────── */
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: radial-gradient(1200px 600px at 50% -10%, #1a2238 0%, transparent 60%), var(--bg);
}
.login-card {
  width: min(380px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow);
  text-align: center;
}
.login-mark { font-size: 2.5rem; }
.login-card h1 { font-size: 1.4rem; margin-top: .25rem; }
.login-card p { margin: 0 0 1.25rem; font-size: .9rem; }
.login-card input { margin-bottom: .75rem; }

/* ── Chrome ────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem 1rem;
  padding-top: max(.75rem, env(safe-area-inset-top));
  background: rgba(15,20,32,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.brand-mark { font-size: 1.3rem; }
.brand strong { display: block; font-size: .98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand .muted { font-size: .78rem; }
.topbar-actions { display: flex; gap: .4rem; flex-shrink: 0; }

.tabs {
  position: sticky; top: 57px; z-index: 25;
  display: flex; gap: .25rem;
  padding: .5rem 1rem;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0;
  background: none; border: 0;
  color: var(--muted);
  font: inherit; font-size: .88rem; font-weight: 500;
  padding: .45rem .8rem;
  border-radius: 999px;
  cursor: pointer;
}
.tab:hover { color: var(--text); background: var(--surface); }
.tab.is-active { background: var(--accent); color: #fff; }

main { padding: 1rem; padding-bottom: 4rem; max-width: 1200px; margin: 0 auto; }
.panel { display: none; }
.panel.is-active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ── Controls ──────────────────────────────────────────────────── */
input, select, textarea, button { font-family: inherit; font-size: 1rem; }

/* Match on everything that isn't a toggle rather than on [type=text]:
   inputs built with createElement carry no type attribute, so an
   attribute selector would skip every field in the modal forms. */
input:not([type=checkbox]):not([type=radio]):not([type=file]),
select, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: .55rem .7rem;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--info); box-shadow: 0 0 0 3px rgba(74,157,232,.16); }
textarea { min-height: 70px; resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 1.9rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: .5rem .85rem;
  border-radius: var(--radius-sm);
  font-size: .88rem; font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--line); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #d81834; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface); }
.btn-danger { color: #ff8a9b; border-color: #4a2230; }
.btn-danger:hover { background: #3a1a24; }
.btn-block { width: 100%; }
.btn-sm { padding: .3rem .55rem; font-size: .8rem; }
.linkish { background: none; border: 0; color: var(--info); cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}
.card > h2 { display: flex; align-items: center; gap: .5rem; }
.card p.muted { margin-top: 0; font-size: .86rem; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 720px) { .two-col { grid-template-columns: 1fr; } }

/* ── Goal card ─────────────────────────────────────────────────── */
.goal-card {
  background: linear-gradient(160deg, #1b2237, var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.goal-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: .9rem; }
.goal-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.goal-amount { font-size: 2.4rem; font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.goal-right { text-align: right; }
.goal-goal { font-size: 1.2rem; font-weight: 600; color: var(--muted); }
.bar { height: 10px; background: var(--bg); border-radius: 999px; overflow: hidden; border: 1px solid var(--line-soft); }
.bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-dim), var(--accent)); border-radius: 999px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.goal-foot { display: flex; justify-content: space-between; margin-top: .55rem; font-size: .83rem; color: var(--muted); }

/* ── Stat tiles ────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .9rem;
}
.stat-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: .3rem; }
.stat-value { font-size: 1.7rem; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.stat-sub { font-size: .78rem; color: var(--muted); margin-top: .15rem; }
.stat-value.is-warn { color: var(--warn); }
.stat-value.is-good { color: var(--good); }

/* ── Breakdown rows ────────────────────────────────────────────── */
.row-item { display: flex; align-items: center; gap: .7rem; padding: .5rem 0; border-bottom: 1px solid var(--line-soft); }
.row-item:last-child { border-bottom: 0; }
.row-item .rk { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-item .rv { font-weight: 600; font-variant-numeric: tabular-nums; }
.row-item .rs { font-size: .78rem; color: var(--muted); min-width: 72px; text-align: right; }

/* ── Toolbar ───────────────────────────────────────────────────── */
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .5rem; align-items: center; }
.toolbar input[type=search] { flex: 1 1 220px; min-width: 0; }
.toolbar select { flex: 0 1 160px; }
.toolbar-note { font-size: .8rem; color: var(--muted); margin-bottom: .75rem; min-height: 1.1em; }

/* ── Data grid ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.grid { width: 100%; border-collapse: collapse; font-size: .87rem; }
table.grid th {
  text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 600;
  padding: .6rem .7rem; border-bottom: 1px solid var(--line);
  background: var(--surface-2); position: sticky; top: 0; white-space: nowrap;
}
table.grid td { padding: .55rem .7rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tbody tr:hover { background: var(--surface-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted); }

/* ── Badges ────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: .12rem .45rem; border-radius: 999px;
  font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  border: 1px solid transparent; white-space: nowrap;
}
.badge-anedot { background: rgba(74,157,232,.16); color: #7dbcf5; border-color: rgba(74,157,232,.3); }
.badge-cash   { background: rgba(47,191,113,.14); color: #62d79a; border-color: rgba(47,191,113,.3); }
.badge-check  { background: rgba(232,179,57,.14); color: #edc76a; border-color: rgba(232,179,57,.3); }
.badge-comp   { background: rgba(141,152,179,.16); color: #aab3c9; border-color: rgba(141,152,179,.3); }
.badge-other  { background: rgba(141,152,179,.12); color: #9aa4bd; border-color: rgba(141,152,179,.25); }
.badge-pledged{ background: rgba(232,179,57,.14); color: #edc76a; border-color: rgba(232,179,57,.35); }
.pill { background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: .05rem .5rem; font-size: .78rem; color: var(--muted); font-weight: 600; }

/* ── Tables / seating ──────────────────────────────────────────── */
.table-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .75rem; }
.tbl {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .85rem;
}
.tbl.is-full { border-color: rgba(47,191,113,.4); }
.tbl.is-over { border-color: var(--accent); }
.tbl-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; margin-bottom: .5rem; }
.tbl-head strong { font-size: .95rem; }
.tbl-cap { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tbl-sponsor { font-size: .78rem; color: var(--warn); margin-bottom: .4rem; }
.seat-list { list-style: none; margin: 0; padding: 0; }
.seat-list li {
  display: flex; align-items: center; gap: .4rem;
  padding: .3rem 0; border-bottom: 1px solid var(--line-soft); font-size: .85rem;
}
.seat-list li:last-child { border-bottom: 0; }
.seat-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-name.is-blank { color: var(--muted); font-style: italic; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); flex-shrink: 0; }
.dot.is-in { background: var(--good); }
.chip-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: .25rem .6rem; font-size: .82rem;
  cursor: pointer;
}
.chip:hover { border-color: var(--info); }

/* ── Check-in ──────────────────────────────────────────────────── */
.checkin-head { display: flex; gap: 1rem; align-items: center; margin-bottom: .75rem; }
.checkin-head input { flex: 1; font-size: 1.05rem; padding: .7rem .8rem; }
.checkin-stats { display: flex; gap: 1rem; text-align: center; flex-shrink: 0; }
.checkin-stats div strong { display: block; font-size: 1.5rem; line-height: 1; font-variant-numeric: tabular-nums; }
.checkin-stats div span { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.seg { display: flex; gap: .25rem; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .2rem; margin-bottom: .75rem; }
.seg-btn { flex: 1; background: none; border: 0; color: var(--muted); font: inherit; font-size: .85rem; font-weight: 500; padding: .4rem; border-radius: 999px; cursor: pointer; }
.seg-btn.is-active { background: var(--surface-2); color: var(--text); }
.checkin-list { margin-top: .75rem; }
.ci-row {
  display: flex; align-items: center; gap: .75rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: .7rem .85rem; margin-bottom: .45rem;
  cursor: pointer; user-select: none;
  transition: border-color .12s, background .12s;
}
.ci-row:hover { border-color: var(--info); }
.ci-row.is-in { background: rgba(47,191,113,.08); border-color: rgba(47,191,113,.35); }
.ci-check {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--line); flex-shrink: 0;
  display: grid; place-items: center; font-size: .85rem; color: transparent;
}
.ci-row.is-in .ci-check { background: var(--good); border-color: var(--good); color: #0b0f18; }
.ci-main { flex: 1; min-width: 0; }
.ci-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-meta { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-table { font-size: .78rem; color: var(--info); flex-shrink: 0; font-weight: 600; }

/* ── Import ────────────────────────────────────────────────────── */
.drop {
  border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 2rem 1rem; text-align: center; cursor: pointer;
  background: var(--bg); transition: border-color .15s, background .15s;
}
.drop:hover, .drop.is-over { border-color: var(--info); background: rgba(74,157,232,.06); }
.drop-icon { font-size: 1.8rem; color: var(--muted); margin-bottom: .3rem; }
.import-opts { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: .9rem; font-size: .86rem; align-items: center; }
.import-opts label { display: flex; align-items: center; gap: .4rem; }
.import-opts select { width: auto; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .6rem; }
.map-grid label { font-size: .8rem; color: var(--muted); }
.map-grid select { margin-top: .2rem; }
.notice { border-radius: var(--radius-sm); padding: .65rem .8rem; font-size: .85rem; margin-bottom: .75rem; }
.notice-warn { background: rgba(232,179,57,.1); border: 1px solid rgba(232,179,57,.35); color: #edc76a; }
.notice-good { background: rgba(47,191,113,.1); border: 1px solid rgba(47,191,113,.35); color: #7ee0aa; }
.notice-info { background: rgba(74,157,232,.1); border: 1px solid rgba(74,157,232,.3); color: #8cc5f7; }

/* ── Forms / modal ─────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .75rem; }
.form-grid label, .form-row label { display: block; font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.form-grid input, .form-grid select, .form-grid textarea { margin-top: .25rem; }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 560px) { .form-grid .span-2 { grid-column: span 1; } }
.form-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }
.settings-actions { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }

.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5,8,14,.7);
  display: grid; place-items: center;
  padding: 1rem;
  overflow-y: auto;
}
.modal-card {
  width: min(620px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; gap: 1rem; }
.modal-head h2 { margin: 0; font-size: 1.05rem; }

.tier-row { display: grid; grid-template-columns: 1fr 110px 80px 36px; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.tier-row .th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
@media (max-width: 560px) { .tier-row { grid-template-columns: 1fr 90px 64px 32px; gap: .35rem; } }

/* ── Toast ─────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text); padding: .65rem 1rem; border-radius: 999px;
  box-shadow: var(--shadow); z-index: 200; font-size: .88rem;
  max-width: calc(100vw - 2rem); text-align: center;
  animation: toastin .2s ease;
}
.toast.is-error { border-color: #6b2434; color: #ff9dab; }
.toast.is-good { border-color: rgba(47,191,113,.4); }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (max-width: 640px) {
  .goal-amount { font-size: 2rem; }
  .toolbar .btn, .toolbar a.btn { flex: 1 1 auto; }
  .checkin-head { flex-wrap: wrap; }
  .checkin-head input { flex: 1 1 100%; }
  .checkin-stats { width: 100%; justify-content: space-around; }
}
