/* Expo — Material Design 3 (dark, amber primary) */

:root {
  /* ── MD3 color tokens (dark scheme) ── */
  --primary: #ffb951;
  --on-primary: #432c00;
  --primary-container: #614000;
  --on-primary-container: #ffddb3;
  --secondary-container: #3a352b;
  --on-secondary-container: #f4e3c9;

  --surface: #131313;
  --surface-container-lowest: #0d0d0d;
  --surface-container-low: #1b1b1b;
  --surface-container: #1f1f1f;
  --surface-container-high: #2a2a2a;
  --surface-container-highest: #353535;
  --on-surface: #e6e2e6;
  --on-surface-variant: #c9c5ca;
  --on-surface-faint: #97939a;

  --outline: #948f96;
  --outline-variant: #3c3a3e;

  --error: #ffb4ab;
  --on-error: #690005;
  --error-container: #93000a;

  --inverse-surface: #e6e2e6;
  --inverse-on-surface: #2f2f2f;

  --scrim: rgba(0, 0, 0, 0.55);

  /* priority hues */
  --p-low: #7c7c7c;
  --p-normal: #7fb2ff;
  --p-high: var(--primary);
  --p-urgent: #ff8a80;

  /* ── shape ── */
  --r-xs: 4px; --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 28px; --r-full: 999px;

  /* ── elevation ── */
  --e1: 0 1px 2px rgba(0,0,0,.3), 0 1px 3px 1px rgba(0,0,0,.15);
  --e2: 0 1px 2px rgba(0,0,0,.3), 0 2px 6px 2px rgba(0,0,0,.15);
  --e3: 0 4px 8px 3px rgba(0,0,0,.15), 0 1px 3px rgba(0,0,0,.3);

  --kb: 0px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; }
body {
  background: var(--surface);
  color: var(--on-surface);
  font: 400 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--on-surface-variant); }
.small { font-size: 12px; }
.cap { text-transform: capitalize; }
.spacer { flex: 1; }

/* responsive helpers (compact breakpoint = 700px) */
@media (max-width: 700px) { .desktop-only { display: none !important; } }
@media (min-width: 701px) { .mobile-only { display: none !important; } }

/* ── screens ── */
.screen { min-height: 100dvh; }
.center { display: flex; align-items: center; justify-content: center; padding: 24px; }

/* ── brand / typography ── */
.brand { font-weight: 700; letter-spacing: .25px; color: var(--primary); font-size: 22px; }
.brand-lg { font-size: 40px; text-align: center; }

/* ── auth ── */
.auth-card {
  width: 100%; max-width: 380px; background: var(--surface-container-low);
  border-radius: var(--r-xl); padding: 32px 28px;
  display: flex; flex-direction: column; gap: 16px; box-shadow: var(--e1);
}
.auth-card .muted { text-align: center; margin: 0 0 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--on-surface-faint); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--outline-variant); }

/* ── inputs ── */
input, textarea, select {
  background: var(--surface-container-highest); color: var(--on-surface);
  border: none; border-bottom: 1px solid var(--outline);
  border-radius: var(--r-xs) var(--r-xs) 0 0;
  padding: 13px 14px; font: inherit; font-size: 16px; /* 16px avoids iOS zoom-on-focus */
  width: 100%; min-height: 48px; transition: border-color .15s, background .15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-bottom: 2px solid var(--primary); }
textarea { resize: vertical; min-height: 88px; line-height: 1.5; }
/* iOS date inputs ignore width and use an intrinsic size that overflows the cell;
   resetting -webkit-appearance + min-width forces them to honor the container. */
input[type="date"] {
  -webkit-appearance: none; appearance: none;
  min-width: 0; max-width: 100%; width: 100%;
}
input[type="date"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
input[type="date"]::-webkit-calendar-picker-indicator { margin-left: auto; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='%23c9c5ca'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 36px;
}

/* ── buttons (MD3) ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 22px; border: none; border-radius: var(--r-full);
  font: 500 14px/1 system-ui, sans-serif; letter-spacing: .1px; cursor: pointer;
  white-space: nowrap; transition: filter .15s, background .15s, box-shadow .15s;
}
.btn:active { transform: translateY(.5px); }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { filter: brightness(1.08); box-shadow: var(--e1); }
.btn-tonal { background: var(--secondary-container); color: var(--on-secondary-container); }
.btn-tonal:hover { filter: brightness(1.12); }
.btn-text { background: transparent; color: var(--primary); padding: 0 12px; }
.btn-text:hover { background: rgba(255,185,81,.10); }
.btn-ghost { background: transparent; color: var(--on-surface-variant); }
.btn-ghost:hover { background: rgba(255,255,255,.06); }
.btn-danger { background: transparent; color: var(--error); padding: 0 12px; }
.btn-danger:hover { background: rgba(255,180,171,.10); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; pointer-events: none; }

.file-btn {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  min-height: 40px; padding: 0 16px; border: 1px solid var(--outline);
  border-radius: var(--r-full); color: var(--primary); cursor: pointer;
  font: 500 14px/1 system-ui, sans-serif; width: auto;
}
.file-btn:hover { background: rgba(255,185,81,.08); }

.link { background: none; border: none; color: var(--primary); cursor: pointer; font: inherit; padding: 0; }

/* ── icon buttons ── */
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px;
  border: none; background: transparent; color: var(--on-surface-variant);
  border-radius: var(--r-full); cursor: pointer; position: relative; flex: none;
}
.icon-btn:hover { background: rgba(255,255,255,.07); color: var(--on-surface); }
.icon-btn svg { display: block; }
.badge-count {
  position: absolute; top: 6px; right: 6px; background: var(--error); color: var(--on-error);
  font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; border-radius: var(--r-full);
  display: none; align-items: center; justify-content: center; padding: 0 4px; line-height: 16px;
}

/* ── top app bar ── */
/* In standalone (home-screen) mode the web view runs under the status bar, so the
   bar's height includes the safe-area inset and its content is padded below it. */
.topbar {
  display: flex; align-items: center; gap: 4px;
  height: calc(60px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 8px 0 16px;
  background: var(--surface-container); position: sticky; top: 0; z-index: 20;
}
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--on-surface-variant); font-size: 13px; margin: 0 4px; }
.role-tag {
  font-size: 10px; text-transform: uppercase; letter-spacing: .5px;
  background: var(--primary-container); color: var(--on-primary-container);
  border-radius: var(--r-sm); padding: 2px 8px;
}

/* ── surface bar (primary My Playlist | Shared, always visible) ── */
.surfacebar {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px 6px;
  background: var(--surface); position: sticky; top: calc(60px + env(safe-area-inset-top)); z-index: 16;
}
.surfacebar .segmented button { height: 38px; padding: 0 18px; font-size: 14px; }

/* ── toolbar (filters) ── */
.toolbar {
  display: flex; align-items: center; gap: 8px; padding: 4px 16px 10px;
  background: var(--surface); overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--outline-variant); position: sticky; top: calc(104px + env(safe-area-inset-top)); z-index: 15;
}
.toolbar::-webkit-scrollbar { display: none; }
.toolbar .select { flex: none; width: auto; min-height: 40px; padding: 8px 34px 8px 12px;
  border: 1px solid var(--outline-variant); border-radius: var(--r-sm); background-color: var(--surface-container-high); }
.toolbar .select:focus { border: 1px solid var(--primary); }

/* segmented buttons (view toggle) */
.segmented { display: inline-flex; border: 1px solid var(--outline); border-radius: var(--r-full); overflow: hidden; flex: none; }
.segmented button {
  appearance: none; border: none; background: transparent; color: var(--on-surface-variant);
  height: 40px; padding: 0 16px; cursor: pointer; font: 500 13px/1 system-ui, sans-serif; white-space: nowrap;
}
.segmented button + button { border-left: 1px solid var(--outline); }
.segmented button.active { background: var(--secondary-container); color: var(--on-secondary-container); }

/* ── FAB ── */
.fab {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border: none; border-radius: var(--r-lg);
  background: var(--primary-container); color: var(--on-primary-container);
  display: grid; place-items: center; box-shadow: var(--e3); cursor: pointer; z-index: 30;
}
.fab:hover { filter: brightness(1.08); }
.fab:active { transform: scale(.96); }

/* ── notifications dropdown ── */
.notif-wrap { position: relative; }
/* Fixed to the viewport so it can't run off the right edge on mobile. */
.dropdown {
  position: fixed; top: calc(64px + env(safe-area-inset-top)); right: 8px; left: auto;
  width: min(360px, calc(100vw - 16px)); max-height: 70vh; overflow-y: auto;
  background: var(--surface-container-high); border-radius: var(--r-md); z-index: 40; box-shadow: var(--e3);
}
.dd-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; font-weight: 600; border-bottom: 1px solid var(--outline-variant); }
.dd-item { padding: 12px 16px; border-bottom: 1px solid var(--outline-variant); cursor: pointer; }
.dd-item:hover { background: var(--surface-container-highest); }
.dd-item.unread { border-left: 3px solid var(--primary); }
.dd-body { font-size: 14px; }
.dd-time { color: var(--on-surface-faint); font-size: 12px; margin-top: 2px; }
.dd-empty { padding: 24px 16px; color: var(--on-surface-faint); text-align: center; }
.dd-item:last-child { border-bottom: none; }

/* ── board ── */
.board { padding: 16px; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.column { background: var(--surface-container-low); border-radius: var(--r-lg); min-height: 120px; }
.column.drop-hover { outline: 2px solid var(--primary); background: #211c12; }
.column-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; font-weight: 600; font-size: 15px; }
.column-head .count { color: var(--on-surface-variant); font-weight: 400; }
.column-body { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 10px; min-height: 48px; }
.col-empty { color: var(--on-surface-faint); font-size: 13px; padding: 16px; text-align: center; }

/* cards */
.card {
  background: var(--surface-container-high); border-radius: var(--r-md); padding: 13px 14px;
  cursor: pointer; display: flex; flex-direction: column; gap: 8px; transition: background .12s;
}
.card:hover { background: var(--surface-container-highest); }
.card:active { transform: scale(.99); }
.card.dragging { opacity: .5; }
.card-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-title { font-weight: 500; font-size: 15px; line-height: 1.3; }
.card-meta { display: flex; gap: 10px; flex-wrap: wrap; }
.meta { color: var(--on-surface-faint); font-size: 12px; }
.meta-due { color: var(--primary); }

.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot-low { background: var(--p-low); } .dot-normal { background: var(--p-normal); }
.dot-high { background: var(--p-high); } .dot-urgent { background: var(--p-urgent); }

.badge { font-size: 11px; font-weight: 500; letter-spacing: .3px; padding: 3px 8px; border-radius: var(--r-sm);
  border: 1px solid var(--outline-variant); color: var(--on-surface-variant); }
.badge-ticket { color: var(--p-urgent); border-color: #5a2a26; }
.badge-task { color: var(--p-normal); border-color: #25405f; }
.badge-group { color: var(--primary); border-color: var(--primary-container); }
.badge-cat { color: var(--on-surface); }
.badge-private { color: var(--on-surface-variant); border-color: var(--outline); }

/* checkbox row (e.g. Private toggle) */
.check-row { display: flex; align-items: center; gap: 10px; color: var(--on-surface); min-height: 44px; cursor: pointer; }
.check-row input { width: auto; min-height: 0; accent-color: var(--primary); }

/* list view (audit) — scroll horizontally on narrow screens instead of overflowing */
.board.list { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.list-table { width: 100%; min-width: 640px; border-collapse: collapse; background: var(--surface-container-low); border-radius: var(--r-lg); overflow: hidden; }
.list-table th { text-align: left; color: var(--on-surface-variant); font-weight: 500; font-size: 12px; padding: 12px 14px; border-bottom: 1px solid var(--outline-variant); }
.list-table td { padding: 13px 14px; border-bottom: 1px solid var(--outline-variant); font-size: 14px; }
.list-table tr { cursor: pointer; }
.list-table tbody tr:hover { background: var(--surface-container); }
.cell-title { font-weight: 500; }

/* ── playlist surface ── */
.board.playlist { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }

.np-card { background: var(--surface-container-high); border-radius: var(--r-lg); box-shadow: var(--e2); padding: 16px; display: flex; flex-direction: column; gap: 10px; border-left: 3px solid var(--primary); }
.np-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--primary); }
.np-eq { font-size: 11px; }
.np-body { cursor: pointer; display: flex; flex-direction: column; gap: 8px; }
.np-title { font-size: 19px; font-weight: 600; line-height: 1.25; }
.np-desc { color: var(--on-surface-variant); font-size: 14px; line-height: 1.4; }
.transport { display: flex; gap: 10px; justify-content: flex-end; padding-top: 4px; }
.transport .btn { min-height: 44px; padding: 0 24px; }

.np-empty { background: var(--surface-container-low); border-radius: var(--r-lg); padding: 28px 20px; text-align: center; display: flex; flex-direction: column; gap: 6px; }
.np-empty-title { font-size: 18px; font-weight: 600; }

.queue-head { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; color: var(--on-surface-variant); padding: 4px 4px 0; }
.queue-head .count { color: var(--on-surface-faint); font-weight: 400; }
.queue { display: flex; flex-direction: column; gap: 8px; }

.q-row { display: flex; align-items: center; gap: 10px; background: var(--surface-container); border-radius: var(--r-md); padding: 12px 12px; }
.q-row.dragging { opacity: .5; }
.q-handle { color: var(--on-surface-faint); cursor: grab; font-size: 20px; touch-action: none; user-select: none; line-height: 1; padding: 8px 10px; margin: -8px -4px -8px -8px; flex: none; }
.q-handle:active { cursor: grabbing; color: var(--primary); }
/* freeze the page while reordering the queue */
body.reordering { overflow: hidden; touch-action: none; -webkit-user-select: none; user-select: none; }
.q-title { flex: 1; cursor: pointer; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-meta { color: var(--on-surface-faint); font-size: 12px; flex: none; }
.q-top { background: transparent; border: none; color: var(--on-surface-variant); cursor: pointer; width: 36px; height: 36px; border-radius: var(--r-full); font-size: 16px; flex: none; }
.q-top:hover { background: rgba(255,255,255,.07); color: var(--primary); }
.q-row.done { opacity: .55; }
.q-row.done .q-title { text-decoration: line-through; cursor: default; }

.done-today { margin-top: 4px; }
.done-today > summary { cursor: pointer; color: var(--on-surface-variant); font-size: 13px; padding: 8px 4px; list-style: none; }
.done-today > summary::-webkit-details-marker { display: none; }
.done-today > summary::before { content: '▸ '; }
.done-today[open] > summary::before { content: '▾ '; }

/* ── shared surface ── */
.board.shared { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.lane { background: var(--surface-container-low); border-radius: var(--r-lg); overflow: hidden; }
.lane-head { cursor: pointer; padding: 14px 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; list-style: none; }
.lane-head::-webkit-details-marker { display: none; }
.lane-head::before { content: '▸'; color: var(--on-surface-faint); }
.lane[open] .lane-head::before { content: '▾'; }
.lane-head .count { color: var(--on-surface-faint); font-weight: 400; }
.lane-body { padding: 0 10px 10px; display: flex; flex-direction: column; gap: 8px; }
.s-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--surface-container); border-radius: var(--r-md); padding: 12px; }
.s-title { flex: 1 1 60%; cursor: pointer; font-weight: 500; min-width: 0; }
.s-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.send-to { width: auto; min-height: 40px; padding: 8px 30px 8px 10px; border: 1px solid var(--outline-variant); border-radius: var(--r-sm); background-color: var(--surface-container-high); }
.s-add { min-height: 40px; padding: 0 14px; white-space: nowrap; }

/* ── the chart (Top 40) ── */
.board.chart { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 2px; }
.chart-head { font-size: 13px; font-weight: 600; color: var(--on-surface-variant); padding: 4px 4px 10px; }
.chart-row { display: flex; align-items: center; gap: 12px; padding: 11px 8px; border-radius: var(--r-md); cursor: pointer; }
.chart-row:hover { background: var(--surface-container); }
.chart-rank { width: 22px; text-align: center; font-weight: 700; color: var(--on-surface-faint); font-size: 14px; flex: none; font-variant-numeric: tabular-nums; }
.chart-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chart-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-sub { font-size: 12px; color: var(--on-surface-faint); }
.chart-play { display: flex; align-items: center; gap: 6px; color: var(--on-surface-variant); font-size: 13px; font-variant-numeric: tabular-nums; flex: none; }

/* owner avatars (chart + collaborators) */
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700; flex: none; line-height: 1; }

/* collaborators row in the focus view */
.collab-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.collab-chip { display: flex; align-items: center; gap: 6px; background: var(--surface-container); border-radius: var(--r-full); padding: 3px 6px 3px 3px; font-size: 13px; }
.collab-chip .avatar { width: 24px; height: 24px; font-size: 10px; }
.collab-chip .x { cursor: pointer; color: var(--on-surface-faint); padding: 0 4px; }
.collab-owner { border: 1px solid var(--outline-variant); }
.collab-add { width: auto; min-height: 36px; padding: 6px 28px 6px 10px; border: 1px solid var(--outline-variant); border-radius: var(--r-full); background-color: var(--surface-container-high); font-size: 13px; }

/* ── ticket desk ── */
.board.tickets { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.status-chip { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: var(--r-full); flex: none; }
.status-todo { background: #3a3a3a; color: var(--on-surface-variant); }
.status-in_progress { background: var(--primary-container); color: var(--on-primary-container); }
.status-done { background: #1f3a26; color: #7fdf9f; }

/* ── quick add (bottom sheet) ── */
.qa-overlay { position: fixed; inset: 0; background: var(--scrim); z-index: 70; }
.qa-sheet {
  position: fixed; left: 0; right: 0; bottom: var(--kb, 0);
  background: var(--surface-container-high); border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 20px 20px calc(16px + env(safe-area-inset-bottom));
  box-shadow: var(--e3); display: flex; flex-direction: column; gap: 12px;
  transition: bottom .12s ease-out;
}
.qa-typetoggle { align-self: flex-start; }
.qa-typetoggle button { height: 36px; padding: 0 20px; font-size: 14px; }
.qa-help { color: var(--on-surface-variant); font-size: 13px; margin-top: -4px; }
#qa-input { background: transparent; border: none; font-size: 17px; font-weight: 500; padding: 4px 2px; min-height: 0; }
#qa-input::placeholder { font-weight: 400; color: var(--on-surface-faint); }
#qa-input:focus { outline: none; }
.qa-actions { display: flex; align-items: center; gap: 10px; }
.qa-link { background: none; border: none; color: var(--primary); font: 500 14px/1 system-ui, sans-serif; cursor: pointer; padding: 10px 4px; }
.qa-actions .btn { min-height: 40px; }

/* resolve-ticket sheet */
.rv-head { font-size: 16px; font-weight: 600; }
.rv-sub { color: var(--on-surface-variant); font-size: 14px; margin-top: -4px; }
#rv-note { background: var(--surface-container-highest); border: none; border-bottom: 1px solid var(--outline); border-radius: var(--r-xs) var(--r-xs) 0 0; padding: 12px; min-height: 64px; font-size: 16px; }
#rv-note:focus { border-bottom: 2px solid var(--primary); outline: none; }

/* ── dialogs ── */
.modal-overlay { position: fixed; inset: 0; background: var(--scrim); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 60; overflow-y: auto; overscroll-behavior: contain; }
.modal {
  width: 100%; max-width: 560px; background: var(--surface-container-high); border-radius: var(--r-xl);
  display: flex; flex-direction: column; max-height: calc(100dvh - 48px); overflow: hidden; box-shadow: var(--e3);
  overscroll-behavior: contain;
}
.modal-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; }
.modal-head h2 { margin: 0; font-size: 20px; font-weight: 500; }
.modal-body { padding: 4px 20px 24px; display: flex; flex-direction: column; gap: 0; overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.modal-head h2 { flex: none; }
#tm-type-chip { margin-left: 2px; }

/* form sections — clear separation + accent headers */
.tm-section { display: flex; flex-direction: column; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--outline-variant); }
.tm-section:first-child { padding-top: 8px; }
.tm-section-flush { border-bottom: none; }
.tm-section-head { font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--primary); margin-bottom: -2px; }

/* prominent, heading-style title + context (less boxy/gray) */
.tm-title-input { font-size: 18px; font-weight: 600; background: transparent; border: none; border-bottom: 1px solid var(--outline-variant); border-radius: 0; padding: 8px 2px; min-height: 0; }
.tm-title-input::placeholder { font-weight: 400; }
.tm-title-input:focus { border-bottom: 2px solid var(--primary); }
.tm-context { background: transparent; border: none; border-bottom: 1px solid var(--outline-variant); border-radius: 0; padding: 8px 2px; min-height: 40px; font-size: 15px; color: var(--on-surface); }
.tm-context:focus { border-bottom: 2px solid var(--primary); }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--outline-variant); background: var(--surface-container-high); position: sticky; bottom: 0; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field > label { font-size: 12px; font-weight: 500; color: var(--on-surface-variant); letter-spacing: .3px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 > .field { min-width: 0; }    /* prevent grid children from overflowing */
.radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.radio { display: flex; align-items: center; gap: 8px; color: var(--on-surface); min-height: 44px; padding: 0 4px; }
.radio input { width: auto; min-height: 0; accent-color: var(--primary); }

/* photos */
.photo-strip { display: flex; gap: 10px; flex-wrap: wrap; }
.thumb { width: 76px; height: 76px; object-fit: cover; border-radius: var(--r-md); cursor: pointer; }

/* comments */
.comments { display: flex; flex-direction: column; gap: 10px; }
.comment { background: var(--surface-container); border-radius: var(--r-md); padding: 11px 13px; }
.comment-head { font-size: 12px; font-weight: 600; display: flex; gap: 8px; align-items: baseline; }
.comment-head .muted { font-weight: 400; }
.comment-body { margin-top: 4px; line-height: 1.4; }
.comment-compose { display: flex; gap: 8px; align-items: center; }
.compose-text { display: flex; gap: 8px; align-items: center; flex: 1; min-width: 0; }
.compose-text input { flex: 1; min-width: 0; }
/* clear circular "attach photo" button (was easily mistaken for download) */
.file-btn.icon-only { padding: 0; width: 44px; height: 44px; justify-content: center; flex: none; color: var(--primary); background: var(--surface-container-high); border: 1px solid var(--outline-variant); border-radius: 50%; }
.file-btn.icon-only:hover { background: var(--surface-container-highest); }

/* second-tier details disclosure in the focus view */
.tm-details { border: 1px solid var(--outline-variant); border-radius: var(--r-md); padding: 0 14px; }
.tm-details > summary { cursor: pointer; padding: 14px 0; font-size: 13px; font-weight: 600; color: var(--on-surface-variant); list-style: none; }
.tm-details > summary::-webkit-details-marker { display: none; }
.tm-details > summary::after { content: '▸'; float: right; color: var(--on-surface-faint); }
.tm-details[open] > summary::after { content: '▾'; }
.tm-details[open] { padding-bottom: 14px; display: flex; flex-direction: column; gap: 14px; }

/* team admin */
.team-row { display: grid; grid-template-columns: 1.4fr .9fr 1.6fr; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--outline-variant); }
.team-row:last-child { border-bottom: none; }
.team-name { font-weight: 500; }
.role-select { width: auto; min-height: 44px; text-transform: capitalize; }
.team-stores { display: flex; gap: 14px; flex-wrap: wrap; }
.store-check { display: flex; align-items: center; gap: 6px; color: var(--on-surface); font-size: 14px; min-height: 44px; }
.store-check input { width: auto; min-height: 0; accent-color: var(--primary); }
.store-check.dim { opacity: .4; }

/* version footer */
.app-footer { text-align: center; color: var(--on-surface-faint); font-size: 11px; padding: 8px 0 calc(20px + env(safe-area-inset-bottom)); letter-spacing: .3px; }

/* ── snackbar (toast) ── */
#toast-container { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; z-index: 90; width: max-content; max-width: 92vw; }
.toast { background: var(--inverse-surface); color: var(--inverse-on-surface); padding: 14px 16px; border-radius: var(--r-xs); font-size: 14px; font-weight: 500; opacity: 0; transform: translateY(12px); transition: all .2s; box-shadow: var(--e3); }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-error { border-left: 4px solid var(--error-container); }
.toast-action { display: flex; align-items: center; gap: 16px; }
.toast-btn { background: none; border: none; color: var(--primary); font: 600 14px/1 system-ui, sans-serif; cursor: pointer; padding: 4px 4px; }

/* ── compact / mobile ── */
@media (max-width: 700px) {
  .kanban { grid-template-columns: 1fr; gap: 14px; }
  .grid2 { grid-template-columns: 1fr; }
  .board { padding: 14px; }

  /* Full-screen, keyboard-aware dialogs.
     Pinned to the visual viewport so the sticky footer & focused field stay
     above the on-screen keyboard. --vvh/--vvtop are published by keyboard.js;
     100dvh is the fallback for browsers without VisualViewport. */
  .modal-overlay { padding: 0; align-items: stretch; }
  .modal {
    position: fixed; left: 0; right: 0;
    top: var(--vvtop, 0); height: var(--vvh, 100dvh);
    max-width: none; max-height: none; border-radius: 0;
  }
  .modal-head { padding-top: max(12px, env(safe-area-inset-top)); }
}
