/* ============================================================
   Behavior Log — styles (phone first)
   Base palette vars, chrome, hold buttons and form bases come
   from toolshed-common.css (loads first). Behavior Log is used
   mostly on a phone in one hand, so the layout starts there:
   one column, big targets (48px+), a bottom tab bar, bottom
   sheets for editing. Wider screens get the same column, centred,
   with a little more room.
   ============================================================ */

/* The shared .btn / .ghost-btn set display, which would beat [hidden]. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; }

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: .8rem .8rem 1.6rem;
}

h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 1.3rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 0 0 .5rem; }
h3 { font-size: 1rem; margin: 0; }

.meta, .hint { color: var(--dim); font-size: .92rem; margin: .2rem 0 .9rem; }
.hint { font-size: .85rem; }

/* ---------- Buttons (extras on the shared .btn / .ghost-btn) ---------- */
.btn { min-height: 48px; text-decoration: none; }
.btn:hover { text-decoration: none; }
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  border-radius: 12px;
  padding: .55rem .95rem;
  min-height: 44px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.ghost-btn:hover { text-decoration: none; }
.ghost-btn.small { padding: .35rem .75rem; min-height: 38px; font-size: .88rem; border-radius: 10px; }
.ghost-btn.danger { color: #b04a3a; border-color: #e0b9b2; }
.ghost-btn.danger:hover { background: #fbeeea; border-color: #b04a3a; }
.file-btn { cursor: pointer; }
[data-theme="dark"] .ghost-btn.danger,
[data-theme="midnight"] .ghost-btn.danger,
[data-theme="high"] .ghost-btn.danger,
[data-theme="warm"] .ghost-btn.danger { color: #ff9c86; border-color: #7a4a40; }
[data-theme="dark"] .ghost-btn.danger:hover,
[data-theme="midnight"] .ghost-btn.danger:hover,
[data-theme="high"] .ghost-btn.danger:hover,
[data-theme="warm"] .ghost-btn.danger:hover { background: #3a221c; }
.link-btn {
  background: none; border: none; padding: .2rem .1rem;
  color: var(--accent); font-weight: 700; font-size: .85rem; cursor: pointer;
}
.icon-btn {
  width: 48px; height: 48px; flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1.7rem; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 0 .15rem;
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn:focus-visible, .link-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Day bar: ‹  Today, Dec 2  › ---------- */
.day-bar {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: .1rem 0 .8rem;
}
.day-mid { flex: 1; min-width: 0; text-align: center; }
.day-sub {
  display: flex; align-items: center; justify-content: center;
  gap: .4rem; flex-wrap: wrap; margin-top: .25rem;
}
.day-pill {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .15rem .7rem;
  font-size: .8rem;
  font-weight: 700;
  color: var(--dim);
}
.day-pill.on { color: var(--accent2); border-color: var(--accent2); }
.student-pick select,
.set-row select {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: .4rem .55rem;
  min-height: 40px;
  font-size: .95rem;
  font-weight: 600;
  max-width: 100%;
}

/* ---------- Gentle reminder banner (same as Our Day) ---------- */
.reminder-banner {
  display: flex;
  align-items: center;
  gap: .7rem;
  background: var(--hold-bg);
  border: 1.5px solid var(--hold-border);
  color: var(--hold-text);
  border-radius: 14px;
  padding: .65rem .8rem;
  margin-bottom: .8rem;
  animation: bannerIn .4s ease;
}
@keyframes bannerIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}
.banner-band { width: 6px; align-self: stretch; border-radius: 4px; background: var(--hold-text); flex-shrink: 0; }
.banner-text { margin: 0; font-weight: 700; flex: 1; }
.banner-x {
  background: transparent;
  border: 1px solid var(--hold-border);
  color: var(--hold-text);
  border-radius: 10px;
  width: 2.5rem; height: 2.5rem;
  font-size: 1.2rem; line-height: 1;
  cursor: pointer; flex-shrink: 0;
}

/* ---------- Empty state ---------- */
.empty-card {
  background: var(--surface);
  border: 1.5px dashed var(--border-strong);
  border-radius: 18px;
  padding: 1.1rem;
  margin-bottom: 1rem;
}

/* ---------- Interval card ---------- */
.now-card {
  position: relative;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  padding: .9rem .9rem 1rem 1.15rem;
  overflow: hidden;
  margin-bottom: .9rem;
}
.now-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 6px;
  background: var(--band, var(--accent));
}
.now-card[data-mode="just"]::before { background: var(--hold-text); }
.now-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .6rem; }
.now-kicker {
  margin: 0;
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--dim);
}
.now-card[data-mode="just"] .now-kicker { color: var(--hold-text); }
.now-subject {
  margin: .05rem 0 0;
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.now-where { margin: .05rem 0 0; color: var(--accent); font-weight: 700; font-size: .92rem; }
.now-where:empty { display: none; }
.next-chip {
  display: flex; flex-direction: column; align-items: flex-end;
  text-align: right; flex-shrink: 0;
  font-size: .8rem; color: var(--dim); line-height: 1.3;
}
.next-label { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.next-chip strong { font-size: 1.05rem; color: var(--text); font-variant-numeric: tabular-nums; }
.now-progress {
  height: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin: .55rem 0 0;
}
.now-fill {
  display: block; height: 100%; width: 0;
  background: var(--accent); border-radius: 999px;
  transition: width 1s linear;
}
.now-todo { margin: .35rem 0 0; font-size: .82rem; color: var(--dim); }
.now-todo:empty { display: none; }
.now-cta { margin: .7rem 0 0; font-size: .9rem; color: var(--dim); }
.now-cta:empty { display: none; }

/* ---------- Absence ---------- */
.absent-btn {
  border: 1.5px dashed var(--border-strong);
  background: transparent;
  color: var(--dim);
  border-radius: 999px;
  padding: .15rem .75rem;
  min-height: 30px;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
}
.absent-btn:hover { border-color: var(--accent); color: var(--text); }
.absent-btn[aria-pressed="true"] {
  border-style: solid;
  background: var(--surface-2);
  border-color: var(--text);
  color: var(--text);
}
.absent-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.now-card[data-mode="absent"]::before { background: var(--dim); }
.absent-note {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: .7rem .8rem .8rem;
  margin-top: .8rem;
}
.absent-note p { margin: 0 0 .6rem; font-size: .92rem; }
.absent-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }
.absent-actions .btn, .absent-actions .ghost-btn { min-height: 48px; }
.absent-toggle {
  display: flex; align-items: center; gap: .7rem;
  width: 100%;
  margin-top: .6rem;
  min-height: 56px;
  background: var(--bg);
  border: 1.5px dashed var(--border-strong);
  border-radius: 14px;
  padding: .55rem .75rem;
  color: var(--text);
  font: inherit; font-weight: 700; text-align: left;
  cursor: pointer;
}
.absent-toggle small { display: block; font-weight: 400; font-size: .8rem; color: var(--dim); }
.absent-box {
  width: 2.2rem; height: 2.2rem; flex-shrink: 0;
  border-radius: 9px; border: 1.5px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; color: var(--dim); background: var(--surface);
}
.absent-toggle[aria-pressed="true"] { border-style: solid; border-color: var(--text); background: var(--surface-2); }
.absent-toggle[aria-pressed="true"] .absent-box { background: var(--text); color: var(--surface); border-color: var(--text); }
.absent-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- 1 / 0 ---------- */
.mark-list { display: flex; flex-direction: column; gap: .55rem; margin-top: .8rem; }
.mark-row {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: .6rem .6rem .6rem .75rem;
}
.mark-row.done { border-color: var(--accent2); }
.mark-name { font-weight: 700; font-size: 1rem; overflow-wrap: anywhere; }
.mark-name small {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-weight: 400; color: var(--dim); font-size: .8rem; line-height: 1.35; margin-top: .1rem;
}
.mark-set { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; }
.mark-btn {
  min-height: 3.6rem;
  border-radius: 12px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  padding: .3rem .4rem;
  cursor: pointer;
  line-height: 1.1;
  touch-action: manipulation;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.mark-big { font-size: 1.35rem; font-weight: 800; }
.mark-btn small { display: block; font-size: .74rem; font-weight: 600; color: var(--dim); margin-top: .1rem; }
.mark-btn:hover { border-color: var(--accent); }
.mark-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mark-btn:active { transform: scale(.97); }
.mark-btn[aria-pressed="true"][data-v="1"] { background: var(--hold-bg); border-color: var(--hold-text); color: var(--hold-text); }
.mark-btn[aria-pressed="true"][data-v="0"] { background: var(--accent2); border-color: var(--accent2); color: #fff; }
.mark-btn[aria-pressed="true"][data-v="x"] { background: var(--surface-2); border-color: var(--dim); color: var(--text); }
.mark-btn[aria-pressed="true"] small { color: inherit; opacity: .85; }
.quick-row { display: grid; grid-template-columns: 1fr; gap: .45rem; margin-top: .6rem; }
.quick-row .ghost-btn { min-height: 48px; font-size: .9rem; }

/* ---------- The day, as a list of intervals ---------- */
.list-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  padding: .85rem .7rem .9rem;
}
.list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 0 .2rem; }
.list-head h2 { margin: 0; }
.list-count { color: var(--dim); font-size: .82rem; font-weight: 700; }
.grid-hint { margin: .15rem .2rem .4rem; }
.legend { display: none; margin: 0 .2rem .5rem; font-size: .78rem; color: var(--dim); }
.legend b { color: var(--accent); }

.day-list { display: flex; flex-direction: column; }
.iv-head, .iv-row, .iv-foot {
  display: grid;
  grid-template-columns: 6.6rem repeat(var(--n, 3), minmax(2.3rem, 1fr)) 1.6rem;
  align-items: center;
  gap: .35rem;
  padding: 0 .3rem;
}
.iv-head {
  font-size: .74rem; font-weight: 700; color: var(--accent);
  background: var(--surface-2); border-radius: 10px;
  padding-top: .4rem; padding-bottom: .4rem;
  position: sticky; top: 0; z-index: 1;
}
.iv-head .iv-col { text-align: center; line-height: 1.15; overflow-wrap: anywhere; }
.iv-head .abbr { display: none; }
.iv-row {
  width: 100%;
  min-height: 52px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
  touch-action: manipulation;
}
.iv-row:hover { background: var(--surface-2); }
.iv-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 10px; }
.iv-time { font-weight: 700; font-size: .9rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
.iv-time small {
  display: block; font-weight: 500; color: var(--dim); font-size: .72rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip-v {
  justify-self: center;
  width: 2.2rem; height: 2.2rem;
  border-radius: 9px;
  border: 1.5px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .95rem;
  background: var(--surface);
}
.chip-v[data-v="1"] { background: var(--hold-bg); border-color: var(--hold-border); color: var(--hold-text); }
.chip-v[data-v="0"] { color: var(--accent2); border-color: var(--accent2); }
.chip-v[data-v="x"] { background: var(--surface-2); color: var(--dim); }
.iv-row[data-state="missed"] .chip-v[data-v=""] { border-style: dashed; border-color: var(--hold-text); }
.iv-row[data-state="now"] { background: var(--surface-2); box-shadow: inset 4px 0 0 var(--accent); border-radius: 10px; }
.iv-row[data-state="future"] { opacity: .5; }
.iv-row[data-state="absent"] .iv-time { color: var(--dim); }
.iv-note { text-align: center; color: var(--accent); font-size: 1rem; }
.iv-note-h { font-size: .7rem; text-align: center; }
.iv-foot { padding-top: .6rem; padding-bottom: .2rem; font-weight: 800; }
.iv-foot .iv-col { text-align: center; font-size: .88rem; }
.off-day {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .7rem .85rem;
  color: var(--dim);
  font-weight: 600;
  font-size: .9rem;
  margin: .2rem 0 .6rem;
}
.grid-actions { display: grid; gap: .5rem; margin-top: 1rem; }
.export-note { margin: .45rem .2rem 0; }
.sync-status { font-size: .85rem; color: var(--dim); margin: .6rem 0 0; }
.sync-status:empty { display: none; }
.sync-status.ok { color: var(--accent2); font-weight: 700; }
.sync-status.warn {
  background: var(--hold-bg);
  border: 1px solid var(--hold-border);
  color: var(--hold-text);
  border-radius: 10px;
  padding: .5rem .65rem;
  font-weight: 600;
}

/* ---------- Setup ---------- */
.intro { margin-bottom: .9rem; }
.intro h1 { font-size: 1.4rem; }
.intro-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; margin: .6rem 0 0; }
.intro-actions .ghost-btn { width: 100%; }
.settings-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  padding: .9rem .9rem 1rem;
  margin-top: .9rem;
}
.settings-card h2:not(:first-child) { margin-top: 1.2rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-bottom: .3rem; }
.card-head h2 { margin: 0; }
.set-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: .45rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--border);
}
.set-row:last-of-type { border-bottom: none; }
.set-row.inline { flex-direction: row; align-items: center; justify-content: space-between; }
.set-label { font-weight: 700; font-size: .95rem; }
.set-hint { display: block; font-weight: 400; font-size: .82rem; color: var(--dim); margin-top: .1rem; }
.set-row input[type="checkbox"] { width: 1.5rem; height: 1.5rem; accent-color: var(--accent); flex-shrink: 0; }
.set-row input[type="text"],
.set-row input[type="time"],
.set-row input[type="date"] {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: .55rem .65rem;
  min-height: 46px;
  font-size: 1rem;           /* 16px+ keeps iOS from zooming the page */
  width: 100%;
  min-width: 0;
}
.set-row select { width: 100%; min-height: 46px; font-size: 1rem; }
.set-ctrl { display: flex; align-items: center; gap: .45rem; }
.set-ctrl input { flex: 1; }
.set-ctrl > span { color: var(--dim); font-weight: 600; }

.weekday-picks { display: grid; grid-template-columns: repeat(5, 1fr); gap: .35rem; }
.weekday-picks label {
  display: inline-flex; align-items: center; justify-content: center; gap: .3rem;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  min-height: 44px;
  font-size: .88rem; font-weight: 700;
  cursor: pointer;
}
.weekday-picks input { accent-color: var(--accent2); margin: 0; width: 1.05rem; height: 1.05rem; }
.weekday-picks label:has(input:checked) { border-color: var(--accent2); color: var(--accent2); }

.item-list { list-style: none; margin: .4rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.item-row {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: .65rem .7rem;
  display: flex; flex-direction: column; gap: .5rem;
}
.item-main { display: flex; flex-direction: column; }
.item-title { font-weight: 700; overflow-wrap: anywhere; }
.item-meta { color: var(--dim); font-size: .82rem; overflow-wrap: anywhere; }
.item-meta a { font-weight: 600; }
.item-actions { display: flex; gap: .35rem; flex-wrap: wrap; }
.item-actions .ghost-btn { flex: 1 1 auto; }
.item-actions .move { flex: 0 0 auto; width: 2.6rem; padding: 0; }
.item-empty { color: var(--dim); font-size: .9rem; margin: .3rem 0 0; }
.chip-list { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip {
  display: inline-flex; align-items: center; gap: .2rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .15rem .2rem .15rem .7rem;
  font-size: .84rem; font-weight: 600;
}
.chip button {
  background: transparent; border: none; color: var(--dim);
  font-size: 1.15rem; line-height: 1; cursor: pointer;
  border-radius: 50%; width: 1.9rem; height: 1.9rem;
}
.chip button:hover { color: var(--text); background: var(--border); }

.google-state { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; font-weight: 600; }
.google-dot { width: .7rem; height: .7rem; border-radius: 50%; background: var(--border-strong); flex-shrink: 0; }
.google-dot.on { background: var(--accent2); }
.google-btns { display: grid; gap: .45rem; margin-top: .6rem; }
.privacy-note {
  background: var(--why-bg);
  border: 1px solid var(--why-border);
  border-radius: 12px;
  padding: .6rem .75rem;
  font-size: .84rem;
  color: var(--text);
  margin: .7rem 0 0;
}

/* Account card (signed-in mode) */
.acct-card { border-color: var(--accent2); }
.save-state { font-size: .8rem; font-weight: 700; color: var(--accent2); }
.save-state.warn { color: var(--hold-text); }
.acct-who { display: flex; align-items: center; gap: .3rem .6rem; flex-wrap: wrap; margin: .3rem 0 .5rem; }
.acct-name { font-weight: 700; }
.acct-email { color: var(--dim); font-size: .85rem; overflow-wrap: anywhere; }
.acct-who .ghost-btn { margin-left: auto; }
.acct-row { display: flex; gap: .45rem; flex-wrap: wrap; margin: .4rem 0; }
.acct-row select, .acct-row input { flex: 1 1 12rem; min-height: 46px; font-size: 1rem; min-width: 0; }
.acct-row input, .acct-invite input, .acct-link input {
  background: var(--surface); color: var(--text);
  border: 1.5px solid var(--border); border-radius: 10px; padding: .55rem .65rem;
}
.acct-check { display: flex; align-items: center; gap: .45rem; font-size: .9rem; margin: .4rem 0 .7rem; }
.acct-check input { width: 1.3rem; height: 1.3rem; accent-color: var(--accent2); }
.acct-note { font-size: .88rem; font-weight: 600; color: var(--accent2); margin: .3rem 0 .5rem; }
.acct-note.warn {
  background: var(--hold-bg); border: 1px solid var(--hold-border); color: var(--hold-text);
  border-radius: 10px; padding: .5rem .65rem;
}
.acct-team h3 { font-size: 1rem; margin: 1rem 0 .1rem; }
.acct-invite { display: grid; gap: .45rem; margin-top: .7rem; }
.acct-invite input, .acct-invite select { min-height: 46px; font-size: 1rem; width: 100%; min-width: 0; }
.acct-link { margin-top: .6rem; display: grid; gap: .4rem; font-size: .88rem; }
.acct-link p { margin: 0; }
.acct-link input { font-size: .85rem; width: 100%; }
.google-btn { display: flex; align-items: center; justify-content: center; width: 100%; margin-top: .3rem; }
.settings-card.read-only .item-actions, .settings-card.read-only #addBeh, .settings-card.read-only #addStudent,
.settings-card.read-only #addOff, .settings-card.read-only #delStudent { display: none; }
@media (min-width: 641px) {
  .acct-invite { grid-template-columns: 1fr auto auto; align-items: center; }
  .acct-link { grid-template-columns: 1fr auto; }
  .acct-link p { grid-column: 1 / -1; }
}

.acct-foot { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-top: 1rem;
  padding-top: .7rem; border-top: 1px solid var(--border); font-size: .88rem; }

/* Google import review */
.import-move { grid-column: 2; margin: .15rem 0 0; width: 100%; min-height: 38px;
  font-size: .85rem; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; }
.import-list { display: flex; flex-direction: column; gap: .7rem; margin-top: .4rem; }
.import-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: .7rem .75rem .75rem;
}
.import-name { margin: 0 !important; font-size: .75rem !important; text-transform: uppercase; letter-spacing: .05em; color: var(--dim); }
.import-name input { margin-top: .2rem; font-size: 1.05rem !important; font-weight: 700; text-transform: none; letter-spacing: 0; color: var(--text); }
.import-meta { margin: .35rem 0 .5rem; font-size: .82rem; color: var(--dim); }
.import-files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.import-files li {
  display: grid; grid-template-columns: 1.5rem 1fr; align-items: center; column-gap: .55rem; row-gap: .15rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .45rem .55rem;
}
.import-files input[type="checkbox"] { width: 1.3rem; height: 1.3rem; accent-color: var(--accent); grid-row: span 2; }
.import-files label { margin: 0 !important; grid-column: 2; font-weight: 400 !important; }
.import-files small { color: var(--dim); font-size: .78rem; overflow-wrap: anywhere; }
dialog .import-beh { padding: .4rem .5rem; font-weight: 700; }
.import-card.failed h3 { font-size: .9rem; color: var(--hold-text); margin-bottom: .3rem; }
.import-failed { margin: 0; padding-left: 1.1rem; font-size: .84rem; color: var(--dim); }
.import-warn {
  grid-column: 1 / -1;
  display: block; margin: .3rem 0 0;
  background: var(--hold-bg); border: 1px solid var(--hold-border); color: var(--hold-text);
  border-radius: 8px; padding: .3rem .5rem; font-size: .8rem; font-weight: 600;
}

/* Theme picker (markup consumed by toolshed-common) */
.theme-wrap { position: relative; display: block; }
.theme-btn { min-height: 44px; }
#themePanel { left: 0; right: auto; display: flex; flex-direction: column; gap: .3rem; }

/* ---------- Dialogs / bottom sheets ---------- */
dialog {
  border: 1.5px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  padding: 1rem 1rem 1.1rem;
  width: min(480px, 94vw);
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 18px 50px rgba(0,0,0,.28);
}
dialog::backdrop { background: rgba(15, 20, 26, .45); }
dialog h2 { margin: 0 0 .1rem; font-variant-numeric: tabular-nums; }
dialog .meta { margin-top: 0; }
dialog label { display: block; font-size: .88rem; font-weight: 700; margin: .8rem 0 .2rem; }
dialog input[type="text"],
dialog textarea {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: .6rem .65rem;
  font-size: 1rem;
  font-family: inherit;
}
dialog textarea { resize: vertical; }
.sheet-grip { display: none; }
.form-warn {
  background: var(--hold-bg);
  border: 1px solid var(--hold-border);
  color: var(--hold-text);
  border-radius: 10px;
  padding: .45rem .6rem;
  font-size: .87rem; font-weight: 600;
  margin: .7rem 0 0;
}
.dlg-actions { display: grid; gap: .45rem; margin-top: 1rem; }

/* ---------- Bottom tab bar (phones) ---------- */
.tab-bar { display: none; }

/* ---------- Nav links double as 1s hold buttons, like Our Day ---------- */
.site-nav a.hold-btn { padding: .3rem .75rem; font-size: .9rem; color: var(--accent); }
.site-nav a.hold-btn[aria-current="page"] { color: var(--text); font-weight: 700; border-color: var(--accent); }
.site-nav a.hold-btn:hover { border-color: var(--accent); text-decoration: none; }
.site-nav a.hold-btn .hold-track { width: 1rem; height: 1rem; }

/* ============================================================
   Phones (the main case)
   ============================================================ */
@media (max-width: 640px) {
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }

  /* Compact shared header: brand + icon-only controls. Page nav moves
     to the bottom tab bar, and Fullscreen isn't needed on a phone. */
  .site-head { padding: .45rem .7rem; gap: .3rem .6rem; flex-wrap: nowrap; }
  .site-head .brand h1 { font-size: 1rem; }
  .site-head .brand-sub { display: none; }
  .site-head .site-nav { display: none; }
  .header-tools { gap: .3rem; }
  .header-controls { flex-wrap: nowrap; gap: .3rem; }
  .header-controls .fs-btn { display: none; }
  .header-controls .hold-btn { padding: .3rem .5rem; min-height: 40px; gap: .3rem; }
  .header-controls .hold-label { display: none; }
  .header-controls .sound-btn[aria-pressed="false"] .hold-icon { opacity: .4; }

  .tab-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tab-bar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .05rem; min-height: 58px;
    color: var(--dim); font-size: .78rem; font-weight: 700; text-decoration: none;
  }
  .tab-bar a span { font-size: 1.25rem; line-height: 1; }
  .tab-bar a[aria-current="page"] { color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }

  /* staff know the definitions — keep the live card short enough that
     every behavior and the quick buttons fit on one screen */
  #markList .mark-name small { display: none; }
  #markList .mark-row { gap: .4rem; padding: .5rem .5rem .5rem .7rem; }
  #markList .mark-btn { min-height: 3.3rem; }

  .iv-head .full { display: none; }
  .iv-head .abbr { display: inline; }
  .legend { display: block; }
  .iv-head, .iv-row, .iv-foot { grid-template-columns: 5.6rem repeat(var(--n, 3), minmax(2.1rem, 1fr)) 1.3rem; gap: .25rem; padding: 0 .15rem; }
  .iv-time { font-size: .84rem; }
  .chip-v { width: 2.05rem; height: 2.05rem; }

  /* Editing sheets rise from the bottom edge */
  dialog.sheet {
    width: 100%; max-width: 100%;
    margin: auto 0 0;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    padding: .5rem 1rem calc(1rem + env(safe-area-inset-bottom));
    max-height: 92vh;
    animation: sheetUp .22s ease-out;
  }
  dialog.sheet .sheet-grip {
    display: block; width: 42px; height: 5px; border-radius: 999px;
    background: var(--border-strong); margin: .2rem auto .7rem;
  }
  @keyframes sheetUp { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }

  .site-foot { padding-bottom: 1rem; }
}

/* Very narrow phones: one quick action per row */
@media (max-width: 360px) {
  .quick-row { grid-template-columns: 1fr; }
  .now-subject { font-size: 1.45rem; }
}

/* ============================================================
   Tablets and desktop: same column, a little roomier
   ============================================================ */
@media (min-width: 641px) {
  .wrap { padding: 1.3rem 1.1rem 2.5rem; }
  h1 { font-size: 1.45rem; }
  .now-card { padding: 1.1rem 1.2rem 1.2rem 1.4rem; }
  .mark-row { flex-direction: row; align-items: center; }
  .mark-name { flex: 1; }
  .mark-set { width: 14rem; flex-shrink: 0; }
  .mark-btn { min-height: 3.2rem; }
  .list-card { padding: 1rem 1rem 1.1rem; }
  .grid-actions { grid-template-columns: auto auto; justify-content: start; }
  .intro-actions { display: flex; flex-wrap: wrap; }
  .intro-actions .ghost-btn { width: auto; }
  .set-row { flex-direction: row; align-items: center; justify-content: space-between; gap: 1rem; }
  .set-label { flex: 1 1 16rem; }
  .set-row input[type="text"] { width: 17rem; }
  .set-row input[type="date"], .set-row select { width: auto; }
  .set-row .set-ctrl { flex: 0 1 auto; }
  .set-row .set-ctrl input[type="time"] { width: 8.5rem; }
  .set-row.stack { flex-direction: column; align-items: stretch; }
  .item-row { flex-direction: row; align-items: center; }
  .item-main { flex: 1; min-width: 0; }
  .item-actions { flex-wrap: nowrap; }
  .item-actions .ghost-btn { flex: 0 0 auto; }
  .google-btns { display: flex; flex-wrap: wrap; }
  .dlg-actions { display: flex; flex-wrap: wrap; }
  .theme-wrap { display: inline-block; }
  #themePanel { right: 0; left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .now-fill { transition: none; }
  .reminder-banner, dialog.sheet { animation: none; }
  .mark-btn:active { transform: none; }
}

@media print {
  .site-head, .site-foot, .tab-bar, .day-bar .icon-btn, .reminder-banner, .now-card, .grid-actions, .grid-hint { display: none !important; }
  .list-card { border: none; padding: 0; }
}
