/* ═══════════════════════════════════════════════════════════
   TIAIC Venue Booking — v2
   Brand-grounded · Tembusu greens · Poppins typography
   Applies /impeccable design principles + tembusutech.com.sg tokens
   ═══════════════════════════════════════════════════════════ */

:root {
  /* Brand — single green (#2ED67E) with soft and deep derivatives for contrast */
  --brand-green:       #2ED67E;
  --brand-green-deep:  #16733E;   /* for text where AA contrast on light bg demands */
  --brand-green-soft:  #D8F3E1;   /* subtle fills, hover bg */
  --brand-on-green:    #0A2915;   /* dark text that rides on bright green */
  --brand-rust:        #9c2426;   /* destructive only */

  /* Tinted neutrals — no pure black/white */
  --bg:            #FAFAF7;
  --surface:       #FDFDFA;
  --surface-2:     #F2F2EC;
  --surface-3:     #E8E7DF;
  --border:        #E1DFD6;
  --border-strong: #C7C4B9;
  --text:          #151414;
  --text-muted:    #525150;
  --text-subtle:   #8F8F8F;

  /* Focus/rings */
  --brand-ring:    rgba(46, 214, 126, 0.28);

  /* Semantic */
  --danger:        var(--brand-rust);
  --danger-soft:   #FBEDED;
  --pending-bg:    #FBEED1;
  --pending-fg:    #7C5411;
  --confirmed-bg:  var(--brand-green-soft);
  --confirmed-fg:  var(--brand-green-deep);

  /* 4pt spacing scale */
  --s-1:   4px;
  --s-2:   8px;
  --s-3:   12px;
  --s-4:   16px;
  --s-5:   20px;
  --s-6:   24px;
  --s-8:   32px;
  --s-10:  40px;
  --s-12:  48px;
  --s-16:  64px;
  --s-20:  80px;

  /* Shape & motion */
  --radius:        10px;
  --radius-sm:     6px;
  --radius-pill:   999px;
  --shadow-xs:     0 1px 0 rgba(21, 20, 20, 0.03);
  --shadow-sm:     0 1px 2px rgba(21, 20, 20, 0.04);
  --shadow:        0 1px 2px rgba(21, 20, 20, 0.04), 0 8px 24px rgba(21, 20, 20, 0.04);
  --shadow-lg:     0 20px 48px rgba(21, 20, 20, 0.12);
  --t:             180ms cubic-bezier(.2,.6,.2,1);

  /* Type scale — 1.25 ratio */
  --font-sans:     'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-display:  'Fraunces', 'Poppins', Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand-green:       #2ED67E;
    --brand-green-deep:  #7EDFA7;    /* on dark bg, deep becomes the lighter variant */
    --brand-green-soft:  #17341F;    /* subtle fills */
    --brand-on-green:    #0A2915;
    --brand-rust:        #E5625F;

    --bg:            #141413;
    --surface:       #1C1C1A;
    --surface-2:     #23231F;
    --surface-3:     #2B2B26;
    --border:        #2F2F2A;
    --border-strong: #3F3F39;
    --text:          #EDEAE1;
    --text-muted:    #A6A397;
    --text-subtle:   #6C6A5F;

    --brand-ring:    rgba(46, 214, 126, 0.32);

    --danger:        #E5625F;
    --danger-soft:   #2C1715;
    --pending-bg:    #3A2C0C;
    --pending-fg:    #E8C56F;
    --confirmed-bg:  var(--brand-green-soft);
    --confirmed-fg:  var(--brand-green-deep);

    --shadow-xs:     0 1px 0 rgba(0,0,0,.3);
    --shadow-sm:     0 1px 2px rgba(0,0,0,.4);
    --shadow:        0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.32);
    --shadow-lg:     0 20px 48px rgba(0,0,0,.55);
  }
}

/* ═══════════ Base ═══════════ */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11";
}

h1, h2, h3 {
  margin: 0; font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

a { color: var(--brand-green-deep); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

.muted { color: var(--text-muted); font-weight: 400; }

.eyebrow {
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-subtle);
  margin: 0 0 var(--s-3);
}

kbd {
  display: inline-block; padding: 1px 6px; margin: 0 1px;
  font: 500 11px 'Poppins', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
}

/* Icons */
.icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  stroke: currentColor; fill: none;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.icon-sm { width: 14px; height: 14px; }

/* ═══════════ Header ═══════════ */

.site-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-5);
  padding: var(--s-4) var(--s-8);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; min-width: 0; }
.brand-logo {
  height: 64px; width: auto; object-fit: contain;
  display: block;
}
.brand-text { display: none; }

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

/* Language toggle — segmented pill, EN · 中. Fixed width keeps it stable across languages. */
.lang-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  width: 64px;
  flex-shrink: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  font: 600 12px var(--font-sans);
  color: var(--text-muted);
  letter-spacing: 0.02em;
  transition: border-color var(--t), background var(--t);
  user-select: none;
}
.lang-toggle .lang-opt {
  display: inline-block;
  min-width: 1.5em;
  text-align: center;
}
.lang-toggle:hover {
  border-color: var(--border-strong);
  background: var(--surface);
}
.lang-toggle .lang-opt {
  transition: color var(--t);
}
.lang-toggle .lang-opt.active {
  color: var(--text);
}
.lang-toggle .lang-sep {
  color: var(--text-subtle);
  font-weight: 400;
}

.top-tabs { display: flex; gap: 2px; }
.top-tab {
  position: relative;
  padding: var(--s-2) var(--s-4);
  background: transparent; color: var(--text-muted);
  border: none; border-radius: var(--radius-sm);
  cursor: pointer;
  font: 500 13px var(--font-sans);
  letter-spacing: -0.005em;
  transition: color var(--t);
  white-space: nowrap;
  /* Reserve a stable width so EN/中文 length differences don't shift layout
     130px fits the longest EN label ("Admin Access" ≈ 124px) and gives 中文 the same box. */
  min-width: 130px;
  text-align: center;
}
.top-tab:hover { color: var(--text); }
.top-tab.active { color: var(--text); }
.top-tab.active::after {
  content: "";
  position: absolute; left: var(--s-4); right: var(--s-4); bottom: -17px;
  height: 2px; background: var(--brand-green); border-radius: 2px 2px 0 0;
}

/* ═══════════ Main ═══════════ */

.main {
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--s-12) var(--s-8) var(--s-20);
}

.page-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: var(--s-8);
  gap: var(--s-6);
}
.page-title {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--text);
  margin: 0;
  font-variation-settings: "opsz" 96;
}
.page-title strong {
  font-weight: 500;
  color: var(--brand-green);
}

.view { display: none; animation: fadeIn 220ms cubic-bezier(.2,.6,.2,1); }
.view.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════ Card ═══════════ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  padding: var(--s-8);
}
.card + .card { margin-top: var(--s-4); }
.card-slim { max-width: 420px; margin: 0 auto; }
.card-title {
  font-size: 18px; font-weight: 500;
  margin-bottom: var(--s-6);
  color: var(--text);
  letter-spacing: -0.015em;
}

.section + .section {
  padding-top: var(--s-6);
  margin-top: var(--s-6);
  border-top: 1px solid var(--border);
}

/* ═══════════ Forms ═══════════ */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-5) var(--s-5);
}
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.field { display: flex; flex-direction: column; min-width: 0; }
.field-full { grid-column: 1 / -1; }
.field-actions { align-self: end; }

label {
  font-size: 12px; font-weight: 500;
  color: var(--text-muted);
  margin-bottom: var(--s-1);
  letter-spacing: 0.005em;
}

input[type="text"], input[type="email"], input[type="number"],
input[type="date"], input[type="time"], input[type="password"],
input[type="search"], select, textarea {
  width: 100%;
  padding: var(--s-2) var(--s-3);
  font: 400 13.5px var(--font-sans);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color var(--t), box-shadow var(--t);
  font-variant-numeric: tabular-nums;
}
input::placeholder, textarea::placeholder { color: var(--text-subtle); }
input:hover, select:hover, textarea:hover { border-color: var(--text-subtle); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand-green);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
textarea { resize: vertical; min-height: 84px; line-height: 1.55; }

/* Date input — replace the native locale-specific text entirely.
   The <input type="date"> is made invisible (opacity: 0) so its browser-rendered
   text ("yyyy/mm/日" on CJK locales) can't leak through. A sibling <span>
   displays clean "YYYY / MM / DD" text that we fully control. Tap anywhere
   on the wrap opens the native picker popup. */
.date-wrap {
  position: relative;
  width: 100%;
}
.date-wrap input[type="date"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  opacity: 0;
  cursor: pointer;
  font-size: 16px; /* prevents iOS Safari zoom on focus */
  -webkit-appearance: none;
  appearance: none;
  z-index: 1;
}
.date-text {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  min-height: calc(13.5px * 1.5 + 18px);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: 400 13.5px var(--font-sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  cursor: pointer;
  user-select: none;
  transition: border-color var(--t), box-shadow var(--t);
}
.date-text.is-empty { color: var(--text-subtle); }
.date-text .date-icon {
  margin-left: auto;
  width: 14px; height: 14px;
  color: var(--text-subtle);
  flex-shrink: 0;
}
.date-wrap:hover .date-text { border-color: var(--text-subtle); }
.date-wrap input[type="date"]:focus + .date-text {
  border-color: var(--brand-green);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238F8F8F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right var(--s-3) center;
  padding-right: var(--s-8);
}

.form-hint { font-size: 12px; margin-top: var(--s-3); color: var(--text-subtle); }
.form-actions {
  display: flex; gap: var(--s-2); justify-content: flex-end;
  margin-top: var(--s-8);
  padding-top: var(--s-5);
  border-top: 1px solid var(--border);
}

/* ═══════════ Hint banners (inline) ═══════════ */

.hint {
  margin-top: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: flex; gap: var(--s-2); align-items: flex-start;
  line-height: 1.5;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.hint-info {
  background: #FBEED1;
  border-color: #E9CB7E;
  color: #7C5411;
}
@media (prefers-color-scheme: dark) {
  .hint-info {
    background: #2E2308;
    border-color: #614B16;
    color: #E8C56F;
  }
}
.hint .icon { margin-top: 1px; }

/* ═══════════ Buttons ═══════════ */

.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: var(--s-2) var(--s-4);
  font: 500 13px var(--font-sans);
  border: 1px solid transparent; border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--t), border-color var(--t), color var(--t), box-shadow var(--t);
  white-space: nowrap;
  letter-spacing: -0.005em;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-ring); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--brand-green); color: var(--brand-on-green);
  border-color: var(--brand-green);
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover { filter: brightness(0.94); }

.btn-secondary {
  background: var(--surface); color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-2); border-color: var(--text-subtle); }

.btn-ghost {
  background: transparent; color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

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

.btn-success {
  background: var(--surface); color: var(--brand-green-deep);
  border-color: var(--border-strong);
}
.btn-success:hover { background: var(--brand-green-soft); border-color: var(--brand-green); }

.btn-small { padding: 5px 10px; font-size: 12px; }
.btn-icon {
  padding: 0; width: 30px; height: 30px;
  color: var(--text-muted);
}

/* ═══════════ Banner ═══════════ */

.banner {
  margin-top: var(--s-4);
  padding: var(--s-4) var(--s-4);
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-size: 13px;
  line-height: 1.55;
  animation: fadeIn 220ms ease;
}
.banner-success {
  background: var(--confirmed-bg);
  color: var(--confirmed-fg);
  border-color: #A8D3B6;
}
@media (prefers-color-scheme: dark) {
  .banner-success { border-color: #2A5339; }
}
.banner-success a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* ═══════════ Admin toolbar ═══════════ */

.admin-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--s-4);
  gap: var(--s-3); flex-wrap: wrap;
}

.sub-tabs {
  display: inline-flex; gap: 2px;
  padding: 3px;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
}
.sub-tab {
  padding: 6px 14px;
  background: transparent; color: var(--text-muted);
  border: none; border-radius: 5px;
  cursor: pointer;
  font: 500 13px var(--font-sans);
  display: inline-flex; align-items: center; gap: 8px;
  transition: background var(--t), color var(--t);
}
.sub-tab:hover { color: var(--text); }
.sub-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.count-badge {
  display: inline-block; min-width: 18px; padding: 0 7px;
  font: 600 11px var(--font-sans);
  font-variant-numeric: tabular-nums;
  line-height: 1.7;
  background: var(--surface-2); color: var(--text-muted);
  border-radius: var(--radius-pill);
  text-align: center;
}
.sub-tab.active .count-badge {
  background: var(--surface-3); color: var(--text);
}

.toolbar-right { display: flex; gap: var(--s-2); align-items: center; }

/* ═══════════ Filters ═══════════ */

.filters {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr) auto;
  gap: var(--s-3);
  margin-bottom: var(--s-5);
  padding-bottom: var(--s-5);
  border-bottom: 1px solid var(--border);
}

/* ═══════════ Table ═══════════ */

.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  table-layout: fixed;
}
.data-table th, .data-table td {
  padding: var(--s-4) var(--s-3);
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table th {
  background: transparent;
  font-weight: 500; color: var(--text-subtle);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em;
  border-bottom: 1px solid var(--border-strong);
  padding-top: var(--s-3); padding-bottom: var(--s-3);
}
.data-table tbody tr { transition: background var(--t); }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* Column widths — actions is fixed px, the rest are percentages of remaining */
.data-table th:nth-child(1), .data-table td:nth-child(1) { width: 17%; }
.data-table th:nth-child(2), .data-table td:nth-child(2) { width: 16%; }
.data-table th:nth-child(3), .data-table td:nth-child(3) { width: 23%; }
.data-table th:nth-child(4), .data-table td:nth-child(4) { width: 10%; }
.data-table th:nth-child(5), .data-table td:nth-child(5) { width: 16%; }
.data-table th:nth-child(6), .data-table td:nth-child(6) { width: 170px; }
.col-actions { text-align: right; }

/* Stacked cell content */
.stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stack-primary {
  font-weight: 500; color: var(--text);
  font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stack-secondary {
  font-size: 12px; color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.subtle-link { color: var(--text-subtle); }
.subtle-link:hover { color: var(--text-muted); text-decoration: underline; text-underline-offset: 2px; }

.cell-notes-col { min-width: 0; }
.cell-notes { display: flex; flex-direction: column; gap: var(--s-1); min-width: 0; }
.cell-notes .notes-text {
  font-size: 13px; color: var(--text-muted); line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.text-subtle { color: var(--text-subtle); }

/* Admin button — combines "edit" action with "has note?" indicator */
.btn-admin {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px 3px 7px;
  font: 500 11.5px var(--font-sans);
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--t), color var(--t), border-color var(--t);
}
.btn-admin .icon { width: 12px; height: 12px; }
.btn-admin:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--text-subtle);
}
.btn-admin-on {
  background: var(--brand-green-soft);
  color: var(--brand-green-deep);
  border-color: transparent;
}
.btn-admin-on:hover {
  background: var(--brand-green-soft);
  color: var(--brand-green-deep);
  border-color: var(--brand-green);
  filter: brightness(0.97);
}

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 500;
  text-transform: capitalize;
  letter-spacing: 0.02em;
}
.status-pending { background: var(--pending-bg); color: var(--pending-fg); }
.status-confirmed { background: var(--confirmed-bg); color: var(--confirmed-fg); }

.cell-actions { text-align: right; white-space: nowrap; }
.row-actions {
  display: inline-flex; gap: 2px; justify-content: flex-end;
}
.btn-icon:hover { background: var(--surface); color: var(--text); }
.btn-icon-success:hover { color: var(--brand-green-deep); background: var(--brand-green-soft); }
.btn-icon-danger:hover  { color: var(--danger); background: var(--danger-soft); }

/* ═══════════ Empty state ═══════════ */

.empty {
  padding: var(--s-16) var(--s-5);
  text-align: center;
  color: var(--text-muted);
}
.empty-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  margin-bottom: var(--s-4);
  color: var(--text-subtle);
}
.empty-icon .icon { width: 20px; height: 20px; }
.empty-title { font-size: 15px; font-weight: 500; color: var(--text); margin-bottom: var(--s-1); }
.empty-hint { font-size: 13px; color: var(--text-subtle); }

/* ═══════════ Modals ═══════════ */

dialog.modal {
  padding: 0;
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  background: var(--surface);
  color: var(--text);
  max-width: 440px;
  width: 90%;
}
dialog.modal.modal-wide { max-width: 560px; }
dialog.modal::backdrop {
  background: rgba(12, 14, 11, 0.45);
  backdrop-filter: blur(3px);
}
.modal-content { padding: var(--s-6) var(--s-8) var(--s-6); }
.modal-title { font-size: 17px; margin-bottom: var(--s-1); letter-spacing: -0.015em; font-weight: 500; }
.modal-actions {
  display: flex; justify-content: flex-end; gap: var(--s-2);
  margin-top: var(--s-5);
}

.edit-summary {
  margin: var(--s-3) 0 var(--s-5);
  padding: var(--s-3) var(--s-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px; line-height: 1.55;
  color: var(--text);
}
.edit-summary strong { font-weight: 600; }

.edit-grid { display: flex; flex-direction: column; gap: var(--s-3); }
.readonly-box {
  padding: var(--s-3) var(--s-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-muted);
  min-height: 42px;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* ═══════════ Toast ═══════════ */

.toast-host {
  position: fixed; right: var(--s-5); bottom: var(--s-5);
  z-index: 1000;
  display: flex; flex-direction: column; gap: var(--s-2);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 240px; max-width: 380px;
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: slideIn 220ms cubic-bezier(.2,.6,.2,1);
  display: flex; align-items: flex-start; gap: var(--s-2);
}
.toast::before {
  content: "";
  width: 6px; height: 6px; flex-shrink: 0;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--brand-green);
}
.toast.toast-error::before { background: var(--danger); }
.toast.toast-warn::before  { background: #C08419; }
.toast.leaving { animation: slideOut 180ms ease forwards; }

@keyframes slideIn {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes slideOut {
  to { transform: translateX(110%); opacity: 0; }
}

/* ═══════════ Shortcuts float ═══════════ */

.hint-float {
  position: fixed; left: 50%; bottom: var(--s-6); transform: translateX(-50%);
  padding: var(--s-2) var(--s-4);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-pill); box-shadow: var(--shadow);
  font-size: 12px; color: var(--text-muted);
  z-index: 900;
  animation: fadeIn 220ms ease;
}

/* ═══════════ Responsive ═══════════ */

@media (max-width: 860px) {
  .main { padding: var(--s-6) var(--s-4) var(--s-12); }
  .site-header { padding: var(--s-3) var(--s-4); }
  .brand-logo { height: 48px; }
  .page-header { flex-direction: column; align-items: flex-start; gap: var(--s-3); }
  .page-title { font-size: 24px; letter-spacing: -0.025em; }
  .card { padding: var(--s-5) var(--s-4); }
  .section + .section { padding-top: var(--s-5); margin-top: var(--s-5); }
  .form-grid { grid-template-columns: 1fr; gap: var(--s-3); }
  .form-grid-3 { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .field-actions { grid-column: 1 / -1; }
  .admin-toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-right { justify-content: space-between; }

  .data-table { table-layout: auto; }
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td {
    display: block; width: 100% !important; min-width: 0 !important;
  }
  .data-table tr {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: var(--s-2);
    padding: var(--s-2) var(--s-3);
    background: var(--surface);
  }
  .data-table td {
    border: none;
    padding: var(--s-1) 0;
    display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-3);
  }
  .data-table td::before {
    content: attr(data-label);
    font-size: 11px; font-weight: 500;
    color: var(--text-subtle); letter-spacing: 0.08em; text-transform: uppercase;
    flex-shrink: 0; padding-top: 2px;
  }
  .data-table tbody tr:hover { background: var(--surface); }
  .stack { align-items: flex-end; text-align: right; }
  .stack-primary, .stack-secondary { white-space: normal; overflow: visible; text-overflow: clip; }
  .cell-notes-col, .cell-notes { align-items: flex-end; }
  .cell-actions { text-align: right; }
  .row-actions { justify-content: flex-end; }
}

@media (max-width: 560px) {
  /* Stack the sticky header vertically: logo on top, tabs below as full-width
     segmented control. Prevents overlap on narrow screens, including WeChat's
     embedded browser. */
  .site-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--s-2);
    padding: var(--s-3) var(--s-3);
  }
  .brand { justify-content: flex-start; }
  .brand-logo { height: 36px; }
  .header-actions {
    width: 100%;
    justify-content: space-between;
    gap: var(--s-2);
  }
  .lang-toggle { padding: 5px 9px; font-size: 11.5px; }
  .top-tabs {
    flex: 1;
    gap: 2px;
    padding: 3px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
  }
  .top-tab {
    flex: 1;
    text-align: center;
    padding: 6px 8px;
    font-size: 12.5px;
    border-radius: 5px;
  }
  .top-tab.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-xs);
  }
  /* No underline in the segmented-control variant */
  .top-tab.active::after { display: none; }
  .filters { grid-template-columns: 1fr; }
}

/* ═══════════ Print ═══════════ */

@media print {
  .site-header, .top-tabs, .admin-toolbar, .filters, .row-actions,
  .toast-host, .hint-float, .btn { display: none !important; }
  .main { padding: 0; }
  .card { box-shadow: none; border: none; padding: 0; }
  .data-table { font-size: 11px; }
  .data-table tbody tr:hover { background: none; }
}
