:root {
  --ink: #17120d;
  --ink-2: #1f1812;
  --ink-3: #271f17;
  --line: #3a2f24;
  --paper: #f3e9d9;
  --paper-dim: #b9ac98;
  --muted: #8a7d6c;
  --amber: #e6a14b;
  --amber-deep: #c9762a;
  --terra: #cf5b3c;
  --sage: #9bb07a;
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.7);
  --r: 14px;
}

body.theme-light {
  --ink: #f6efe3;
  --ink-2: #fffaf1;
  --ink-3: #eadfcf;
  --line: #d5c4ad;
  --paper: #221a13;
  --paper-dim: #5f5141;
  --muted: #8c7b67;
  --amber: #b8631f;
  --amber-deep: #8f4818;
  --terra: #b24d35;
  --sage: #647d42;
  --shadow: 0 18px 50px -26px rgba(91, 62, 32, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: "Hanken Grotesk", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(1200px 600px at 85% -10%, rgba(230, 161, 75, 0.10), transparent 60%),
    radial-gradient(900px 500px at 5% 110%, rgba(207, 91, 60, 0.08), transparent 55%);
  min-height: 100vh;
}

body.theme-light {
  background-image:
    radial-gradient(1200px 600px at 85% -10%, rgba(184, 99, 31, 0.12), transparent 60%),
    radial-gradient(900px 500px at 5% 110%, rgba(100, 125, 66, 0.10), transparent 55%);
}

h1, h2, h3, .title, .brand__name { font-family: "Fraunces", Georgia, serif; }
button, input { font-family: inherit; }
[hidden] { display: none !important; }

.mono, .col-table, .col-bag, .pin__dots, .staff td:nth-child(2) { font-family: "Spline Sans Mono", monospace; }

/* ============================ BRAND ============================ */
.brand { display: flex; align-items: center; gap: 14px; color: var(--amber); }
.brand__mark { display: inline-flex; }
.brand__name { font-size: 1.45rem; font-weight: 600; letter-spacing: 0.01em; color: var(--paper); margin: 0; line-height: 1; }
.brand__sub { margin: 4px 0 0; font-size: 0.72rem; letter-spacing: 0.42em; text-transform: uppercase; color: var(--amber); }
.brand--sm .brand__name--sm { font-size: 1.05rem; }
.brand__logo { border-radius: 50%; object-fit: cover; background: var(--paper); flex: none; box-shadow: 0 0 0 1px var(--line); }

/* ============================ LOGIN ============================ */
.login {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  padding: 24px;
}
.login__grain {
  position: absolute; inset: 0; pointer-events: none; opacity: 0.045; z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.login__card {
  position: relative; z-index: 1;
  width: min(380px, 100%);
  background: linear-gradient(180deg, var(--ink-2), var(--ink));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px 32px 40px;
  box-shadow: var(--shadow);
  animation: rise 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.login__prompt { text-align: center; color: var(--paper-dim); margin: 28px 0 18px; font-size: 0.95rem; }

.pin__dots { display: flex; justify-content: center; gap: 14px; min-height: 22px; }
.pin__dots span {
  width: 13px; height: 13px; border-radius: 50%;
  border: 1.5px solid var(--muted); transition: all 0.18s;
}
.pin__dots span.filled { background: var(--amber); border-color: var(--amber); box-shadow: 0 0 12px rgba(230, 161, 75, 0.5); }
.pin__error { text-align: center; color: var(--terra); font-size: 0.85rem; min-height: 1.1em; margin: 12px 0 0; }
.login__card.shake { animation: shake 0.4s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%,60%{transform:translateX(-8px)} 40%,80%{transform:translateX(8px)} }

.keypad {
  margin-top: 22px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.keypad button {
  aspect-ratio: 1.6 / 1;
  border: 1px solid var(--line);
  background: var(--ink-3);
  color: var(--paper);
  font-size: 1.3rem; font-weight: 500;
  border-radius: 12px; cursor: pointer;
  transition: transform 0.08s, background 0.15s, border-color 0.15s;
}
.keypad button:hover { border-color: var(--amber); }
.keypad button:active { transform: scale(0.95); background: var(--amber-deep); border-color: var(--amber-deep); }
.keypad__util { font-size: 0.9rem !important; color: var(--paper-dim); font-family: "Hanken Grotesk", sans-serif; }

/* ============================ TOPBAR ============================ */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 16px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  background: rgba(23, 18, 13, 0.85);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 50;
}
body.theme-light .topbar { background: rgba(246, 239, 227, 0.88); }
.tabs { display: flex; gap: 4px; margin: 0 auto 0 8px; }
.tabs button {
  background: none; border: none; color: var(--paper-dim);
  padding: 9px 16px; border-radius: 999px; cursor: pointer;
  font-size: 0.92rem; font-weight: 600; letter-spacing: 0.01em;
  transition: color 0.15s, background 0.15s;
}
.tabs button:hover { color: var(--paper); }
.tabs button.is-active { color: var(--ink); background: var(--amber); }
.who { display: flex; align-items: center; gap: 14px; }
.theme-toggle {
  display: inline-flex; align-items: center; gap: 7px; color: var(--paper-dim);
  font-size: 0.82rem; font-weight: 700; white-space: nowrap; cursor: pointer;
}
.theme-toggle input { width: 17px; height: 17px; accent-color: var(--amber); }
.who__name { color: var(--paper); font-weight: 600; font-size: 0.9rem; }
.who__name::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--sage); margin-right: 7px; vertical-align: middle; }
.btn-ghost { background: none; border: 1px solid var(--line); color: var(--paper-dim); padding: 7px 14px; border-radius: 999px; cursor: pointer; font-size: 0.85rem; transition: 0.15s; }
.btn-ghost:hover { border-color: var(--terra); color: var(--terra); }

/* ============================ PANEL ============================ */
.panel { max-width: 1120px; margin: 0 auto; padding: clamp(20px, 4vw, 42px); animation: fade 0.35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.title { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 500; margin: 0 0 6px; }
.lede { color: var(--paper-dim); max-width: 60ch; margin: 0 0 22px; }

.panel__head { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.searchbar {
  display: flex; align-items: center; gap: 10px;
  background: var(--ink-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 0 18px; color: var(--muted);
  min-width: min(340px, 100%); transition: border-color 0.15s;
}
.searchbar:focus-within { border-color: var(--amber); color: var(--amber); }
.searchbar input { background: none; border: none; outline: none; color: var(--paper); padding: 13px 0; width: 100%; font-size: 1rem; }
.searchbar input::placeholder { color: var(--muted); }

/* ---- Filters ---- */
.filters { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; margin-bottom: 20px; }
.filters__group { display: flex; flex-wrap: wrap; gap: 8px; }
.filters__tables { padding-left: 18px; border-left: 1px solid var(--line); }
.filters button {
  background: var(--ink-2); border: 1px solid var(--line); color: var(--paper-dim);
  padding: 8px 15px; border-radius: 999px; cursor: pointer; font-size: 0.85rem; font-weight: 600;
  transition: 0.15s;
}
.filters button:hover { border-color: var(--amber); color: var(--paper); }
.filters button.is-active { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.filters__tables button.is-active { background: var(--amber); border-color: var(--amber); }

/* ---- Add rows ---- */
.addrow { display: flex; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; }
.addrow input {
  background: var(--ink-2); border: 1px solid var(--line); color: var(--paper);
  padding: 12px 16px; border-radius: 10px; font-size: 0.95rem; outline: none; transition: border-color 0.15s;
}
.addrow input:focus { border-color: var(--amber); }
.addrow input::placeholder { color: var(--muted); }
#newName, #empName { flex: 1; min-width: 200px; }
#newTable { width: 110px; }
#newBag { width: 110px; }
#newAdditional, .numinput { width: 150px; text-align: center; }
.fieldlabel {
  display: flex; flex-direction: column; gap: 5px; color: var(--muted);
  font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 800;
}
.fieldlabel input { width: 150px; }
#empPin { width: 170px; }
.addrow--staff { align-items: center; }
.check { display: flex; align-items: center; gap: 8px; color: var(--paper-dim); font-size: 0.9rem; white-space: nowrap; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--amber); }
.formerror { color: var(--terra); font-size: 0.88rem; margin: -10px 0 16px; min-height: 1em; }

.btn {
  background: var(--amber); color: var(--ink); border: none; font-weight: 700;
  padding: 12px 22px; border-radius: 10px; cursor: pointer; font-size: 0.95rem;
  transition: transform 0.08s, background 0.15s;
}
.btn:hover { background: var(--amber-deep); color: var(--paper); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn:disabled:hover { background: transparent; color: var(--amber); border-color: var(--line); }

.eventtools {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin: -6px 0 18px;
}
.locknotice {
  margin: 0 auto 0 0; color: var(--amber); border: 1px solid var(--line);
  background: var(--ink-2); border-radius: 10px; padding: 9px 13px; font-size: 0.88rem;
}
.locktoggle { margin-left: 2px; }

.export { display: flex; gap: 10px; flex-wrap: wrap; }
.export .btn { padding: 10px 18px; font-size: 0.88rem; }

/* ============================ TABLES ============================ */
.tablewrap {
  border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
  background: linear-gradient(180deg, var(--ink-2), rgba(31, 24, 18, 0.4));
}
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-family: "Hanken Grotesk", sans-serif;
  font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
  font-weight: 700; padding: 16px 20px; border-bottom: 1px solid var(--line); background: var(--ink-3);
}
tbody td { padding: 14px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: rgba(230, 161, 75, 0.05); }
.guests .col-name { font-size: 1.05rem; font-weight: 600; }
.col-table { width: 90px; }
.col-bag { width: 110px; }
.col-toggle { width: 130px; }
.col-actions { width: 56px; text-align: right; }
.tablenum {
  display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 30px; padding: 0 8px;
  background: var(--ink-3); border: 1px solid var(--line); border-radius: 8px; font-size: 0.9rem; color: var(--amber);
}
.tablenum.is-none { color: var(--muted); border-style: dashed; }
.sorthead {
  appearance: none; border: 0; background: none; color: inherit; padding: 0; cursor: pointer;
  font: inherit; letter-spacing: inherit; text-transform: inherit;
}
.sorthead::after { content: ""; display: inline-block; width: 0.75em; color: var(--amber); }
.sorthead.is-active::after { content: "↑"; margin-left: 5px; }
.sorthead.is-active[data-dir="desc"]::after { content: "↓"; }
.sorthead:hover { color: var(--paper-dim); }

/* ---- Toggle ---- */
.toggle {
  --on: var(--sage);
  display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none;
}
.toggle .track {
  width: 46px; height: 26px; border-radius: 999px; background: var(--ink-3);
  border: 1px solid var(--line); position: relative; transition: 0.2s;
}
.toggle .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--muted); transition: transform 0.2s, background 0.2s;
}
.toggle .lbl { font-size: 0.82rem; color: var(--muted); font-weight: 600; width: 26px; }
.toggle.on .track { background: rgba(155, 176, 122, 0.2); border-color: var(--on); }
.toggle.on .track::after { transform: translateX(20px); background: var(--on); }
.toggle.on .lbl { color: var(--on); }
.toggle--out { --on: var(--terra); }

/* ---- Party size ---- */
.col-party { width: 120px; }
.party { display: flex; align-items: center; gap: 10px; }
.party__extra { width: 88px; text-align: center; }
.party__total {
  font-family: "Spline Sans Mono", monospace; font-size: 0.88rem; color: var(--amber); white-space: nowrap;
}

/* ---- Who checked in / out ---- */
.togglecell { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.toggle__by { font-size: 0.72rem; color: var(--muted); line-height: 1; min-height: 0.72rem; }
.rowdel {
  background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; line-height: 1;
  padding: 6px; border-radius: 8px; transition: 0.15s;
}
.rowdel:hover { color: var(--terra); background: rgba(207, 91, 60, 0.12); }
.rowdel:disabled, .toggle:disabled { opacity: 0.42; cursor: not-allowed; }
.rowdel:disabled:hover { color: var(--muted); background: none; }

.tag { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.03em; }
.tag--admin { background: rgba(230, 161, 75, 0.16); color: var(--amber); }
.tag--staff { background: var(--ink-3); color: var(--paper-dim); }

.empty { padding: 56px 20px; text-align: center; color: var(--muted); font-style: italic; }

/* ============================ STATS + CHARTS ============================ */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin: 26px 0 32px; }
.statcard {
  background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--r); padding: 22px 24px;
  position: relative; overflow: hidden;
}
.statcard::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent, var(--amber)); }
.statcard .num { font-family: "Fraunces", serif; font-size: 2.6rem; font-weight: 500; line-height: 1; }
.statcard .lbl { color: var(--paper-dim); font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase; margin-top: 8px; }

.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.chartcard {
  background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; margin: 0;
  min-height: 280px; display: flex; flex-direction: column;
}
.chartcard--wide { grid-column: 1 / -1; }
.chartcard figcaption { font-family: "Fraunces", serif; font-size: 1.15rem; margin-bottom: 16px; }
.chartcard canvas { flex: 1; max-height: 320px; }

/* ============================ TOAST ============================ */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--paper); color: var(--ink); padding: 13px 24px; border-radius: 999px;
  font-weight: 600; font-size: 0.9rem; box-shadow: var(--shadow); z-index: 100; opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--terra); color: var(--paper); }

/* ============================ EVENT PICKER ============================ */
.eventpicker { display: flex; align-items: center; gap: 9px; }
.eventpicker__lbl { font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); font-weight: 700; }

/* Shared dropdown look for every <select> in the app. */
select {
  font-family: inherit; font-size: 0.92rem; color: var(--paper);
  background: var(--ink-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 34px 10px 14px; cursor: pointer; outline: none; transition: border-color 0.15s;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238a7d6c' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}
select:hover, select:focus { border-color: var(--amber); }
.eventpicker select { font-weight: 600; max-width: 240px; }

/* ============================ SUBHEADINGS ============================ */
.subhead {
  font-family: "Fraunces", serif; font-size: 1.4rem; font-weight: 500;
  margin: 36px 0 4px; padding-top: 26px; border-top: 1px solid var(--line);
}
#tab-admin .subhead:first-of-type { margin-top: 8px; padding-top: 0; border-top: none; }

/* ---- table dropdowns in the guest list ---- */
.filters__table { display: flex; align-items: center; gap: 8px; padding-left: 18px; border-left: 1px solid var(--line); }
.filters__table > span { font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.tableselect { min-width: 130px; }
.tableselect--inline { padding: 7px 30px 7px 12px; font-size: 0.88rem; min-width: 110px; }
.guestselect { min-width: 150px; }
.guestselect--inline { padding: 7px 30px 7px 12px; font-size: 0.88rem; min-width: 88px; }
#newTable { width: 150px; }
.baginput {
  background: var(--ink-2); border: 1px solid var(--line); color: var(--paper);
  padding: 12px 14px; border-radius: 10px; font-size: 0.95rem; outline: none; transition: border-color 0.15s;
}
.baginput:focus { border-color: var(--amber); }
.baginput::placeholder { color: var(--muted); }
.baginput--inline {
  width: 86px; padding: 7px 9px; background: var(--ink-3); border-radius: 8px;
  font-family: "Spline Sans Mono", monospace; font-size: 0.88rem;
}
.addrow--event input, .addrow--event { align-items: center; }
.fieldtoggles { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
#evName { flex: 1; min-width: 180px; }
#evLocation { flex: 1; min-width: 160px; }
#evTables { width: 110px; }
#evDate { color: var(--paper); }

.btn--ghost { background: transparent; color: var(--amber); border: 1px solid var(--line); font-weight: 600; }
.btn--ghost:hover { border-color: var(--amber); background: rgba(230, 161, 75, 0.08); color: var(--amber); }

/* ---- guest contact column ---- */
.col-contact { width: 220px; }
.contact { display: flex; flex-direction: column; gap: 2px; font-size: 0.82rem; }
.contact__line { color: var(--paper-dim); text-decoration: none; }
.contact__line:hover { color: var(--amber); }
.contact__phone { font-family: "Spline Sans Mono", monospace; }
.contact__none { color: var(--muted); }

/* ============================ NO EVENT ============================ */
.noevent { padding: 56px 24px; text-align: center; color: var(--paper-dim); border: 1px dashed var(--line); border-radius: var(--r); background: var(--ink-2); }

/* ============================ EVENTS ADMIN ============================ */
.eventlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 8px; }
.eventcard { background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; }
.eventcard__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.eventcard__name { font-family: "Fraunces", serif; font-size: 1.25rem; font-weight: 500; margin: 0; }
.eventcard__meta { color: var(--muted); font-size: 0.82rem; margin: 4px 0 0; }
.eventcard__label { font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 16px 0 10px; }
.eventcard__staff { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--ink-3); font-size: 0.82rem; color: var(--paper-dim); cursor: pointer; transition: 0.15s; }
.chip:has(input:checked) { border-color: var(--amber); background: rgba(230, 161, 75, 0.14); color: var(--paper); }
.chip input { width: 15px; height: 15px; accent-color: var(--amber); }

/* ============================ EVENTS CALENDAR ============================ */
.calnav { display: flex; align-items: center; gap: 12px; }
.calnav__month {
  font-family: "Fraunces", serif; font-size: 1.15rem; color: var(--paper);
  min-width: 9.5ch; text-align: center;
}
.calnav__arrow {
  background: var(--ink-2); border: 1px solid var(--line); color: var(--paper-dim);
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer; font-size: 1rem; transition: 0.15s;
}
.calnav__arrow:hover { border-color: var(--amber); color: var(--amber); }

.calendar__weekdays,
.calendar__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.calendar__weekdays { margin-bottom: 8px; }
.calendar__weekdays div {
  text-align: center; font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
}
.calcell {
  background: var(--ink-2); border: 1px solid var(--line); border-radius: 10px;
  min-height: 108px; padding: 8px; display: flex; flex-direction: column; gap: 6px;
}
.calcell--empty { background: transparent; border-color: transparent; }
.calcell__num { font-family: "Spline Sans Mono", monospace; font-size: 0.85rem; color: var(--muted); }
.calcell.is-today { border-color: var(--amber); box-shadow: inset 0 0 0 1px var(--amber); }
.calcell.is-today .calcell__num { color: var(--amber); font-weight: 600; }
.calcell__events { display: flex; flex-direction: column; gap: 5px; }

.calpill {
  display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left; cursor: pointer;
  background: rgba(230, 161, 75, 0.14); border: 1px solid rgba(230, 161, 75, 0.35);
  border-left: 3px solid var(--amber); border-radius: 7px; padding: 5px 7px; color: var(--paper);
  transition: 0.15s;
}
.calpill:hover { background: rgba(230, 161, 75, 0.26); }
.calpill--locked {
  border-left-color: var(--terra); border-color: rgba(207, 91, 60, 0.35); background: rgba(207, 91, 60, 0.14);
}
.calpill__name { font-size: 0.8rem; font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calpill__meta { font-size: 0.68rem; color: var(--paper-dim); }

.calundated { margin-top: 28px; }
.calundated__list { display: flex; flex-wrap: wrap; gap: 10px; }
.calundated__list .calpill { width: auto; min-width: 170px; }

@media (max-width: 640px) {
  .calcell { min-height: 84px; padding: 6px; }
  .calpill__meta { display: none; }
}

/* ============================ MODAL / IMPORT ============================ */
.modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(8, 6, 4, 0.72); backdrop-filter: blur(3px); }
body.theme-light .modal__backdrop { background: rgba(70, 50, 31, 0.28); }
.modal__card {
  position: relative; z-index: 1; width: min(720px, 100%); max-height: 90vh; overflow-y: auto;
  background: linear-gradient(180deg, var(--ink-2), var(--ink)); border: 1px solid var(--line);
  border-radius: 18px; padding: 26px 28px; box-shadow: var(--shadow);
}
.modal__head { display: flex; justify-content: space-between; align-items: center; }
.modal__head h2 { font-family: "Fraunces", serif; font-weight: 500; margin: 0; font-size: 1.5rem; }
.modal__x { background: none; border: none; color: var(--muted); font-size: 1.6rem; line-height: 1; cursor: pointer; padding: 0 6px; }
.modal__x:hover { color: var(--terra); }
.modal__lede { color: var(--paper-dim); font-size: 0.9rem; margin: 8px 0 18px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 18px; }

.import__tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; margin-bottom: 18px; }
.import__file { cursor: pointer; }
.import__paste { flex: 1; min-width: 240px; }
.import__paste summary { cursor: pointer; color: var(--amber); font-size: 0.9rem; font-weight: 600; padding: 11px 0; }
.import__paste textarea { width: 100%; margin: 8px 0; background: var(--ink-2); border: 1px solid var(--line); border-radius: 10px; color: var(--paper); padding: 12px; font-family: "Spline Sans Mono", monospace; font-size: 0.85rem; resize: vertical; outline: none; }
.import__paste textarea:focus { border-color: var(--amber); }

.datasheet { border: 1px solid var(--line); border-radius: var(--r); overflow: auto; max-height: 320px; }
.datasheet table { width: 100%; border-collapse: collapse; }
.datasheet th { position: sticky; top: 0; background: var(--ink-3); text-align: left; font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.datasheet td { padding: 4px 8px; border-bottom: 1px solid var(--line); }
.datasheet tr:last-child td { border-bottom: none; }
.datasheet input { width: 100%; background: none; border: 1px solid transparent; border-radius: 7px; color: var(--paper); padding: 8px 10px; font-size: 0.9rem; outline: none; }
.datasheet input:focus { border-color: var(--amber); background: var(--ink-2); }
.datasheet td:nth-child(2) input,
.datasheet td:nth-child(3) input { width: 70px; }
.datasheet__foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.datasheet__count { color: var(--muted); font-size: 0.85rem; }

@media (max-width: 720px) {
  .charts { grid-template-columns: 1fr; }
  .tabs { order: 3; width: 100%; margin: 0; justify-content: center; }
  .topbar { flex-wrap: wrap; }
  .eventpicker { order: 2; }
  .col-contact, .col-bag, .col-toggle .lbl { display: none; }
  .col-toggle { width: 70px; }
}
