/* ---------------------------------------------------------------------------
   shadcn-inspired design system & accessibility layer.
   Preserves DearTask Pro's forest-emerald & gold branding and custom Gilroy/VT fonts,
   while standardizing surfaces, borders, focus rings, typography, and interactive states.
   --------------------------------------------------------------------------- */

:root {
  /* Core brand & surface tokens (refined dark forest palette) */
  --bg: #090d0b;
  --panel: #101613;
  --panel2: #171f1b;
  --line: #1f2a24;
  --line2: #293730;
  --text: #f0f5f1;
  --body: #d6dfd9;
  --muted: #8e9f95;

  /* Radii & shadows (shadcn scale) */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.36), 0 2px 6px -2px rgba(0, 0, 0, 0.24);
  --shadow-lg: 0 16px 36px -6px rgba(0, 0, 0, 0.55), 0 6px 16px -4px rgba(0, 0, 0, 0.35);
  --ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--green2);
}

:root[data-theme="light"] {
  --shadow-sm: 0 1px 2px rgba(16, 24, 20, 0.06);
  --shadow-md: 0 4px 12px -2px rgba(16, 24, 20, 0.08), 0 2px 6px -2px rgba(16, 24, 20, 0.05);
  --shadow-lg: 0 16px 36px -6px rgba(16, 24, 20, 0.16), 0 6px 16px -4px rgba(16, 24, 20, 0.08);
}

/* ---- Global typography & smoothing ---- */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  line-height: 1.45;
  letter-spacing: -0.005em;
}

/* ---- Keyboard focus rings (WCAG 2.4.7 / 2.4.11) ---- */
:focus {
  outline: none;
}
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
[role="checkbox"]:focus-visible,
[tabindex]:focus-visible,
.ag:focus-visible,
.ce:focus-visible,
.mc:focus-visible,
.tm-row:focus-visible {
  outline: none;
  box-shadow: var(--ring) !important;
  z-index: 2;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--green2);
  box-shadow: 0 0 0 3px rgba(var(--gRGB), 0.22);
}

/* ---- Refined scrollbar ---- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line2) transparent;
}
*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
*::-webkit-scrollbar-thumb {
  background: var(--line2);
  border-radius: 999px;
}

/* ---- Header & top bar ---- */
header {
  min-height: 56px;
  padding: 8px 16px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.bname {
  font-size: 19px;
  letter-spacing: -0.02em;
}
.clock b {
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.clock small {
  font-size: 11.5px;
}

/* ---- Icon buttons & Undo/Redo group (shadcn outline button style) ---- */
.iconbtn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--panel);
  border: 1px solid var(--line2);
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.iconbtn:hover:not(:disabled) {
  background: var(--panel2);
  border-color: color-mix(in srgb, var(--line2) 70%, var(--text));
}
.iconbtn:active:not(:disabled) {
  transform: translateY(0.5px);
}
.iconbtn.primary {
  background: var(--green);
  border-color: color-mix(in srgb, var(--green2) 60%, transparent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.iconbtn.primary:hover:not(:disabled) {
  background: var(--green2);
}
.ur {
  border-radius: var(--radius-md);
  background: var(--panel);
  border: 1px solid var(--line2);
  box-shadow: var(--shadow-sm);
}
.ur button {
  width: 36px;
  height: 34px;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.ur button:hover:not(:disabled) {
  background: var(--panel2);
}
.ur button:disabled {
  opacity: 0.38;
}

/* ---- Buttons (shadcn primary, secondary, destructive, ghost) ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  background: var(--panel2);
  border: 1px solid var(--line2);
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.2;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s ease, border-color 0.15s ease, filter 0.15s ease, transform 0.1s ease;
}
.btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--panel2) 82%, var(--text));
  border-color: color-mix(in srgb, var(--line2) 75%, var(--text));
}
.btn:active:not(:disabled) {
  transform: translateY(0.5px);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn.p {
  background: var(--green);
  border-color: color-mix(in srgb, var(--green2) 55%, transparent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.btn.p:hover:not(:disabled) {
  background: var(--green2);
  border-color: var(--green2);
}
.btn.r {
  background: var(--redSoft);
  color: var(--redTxt);
  border-color: rgba(229, 83, 75, 0.35);
}
.btn.r:hover:not(:disabled) {
  background: rgba(229, 83, 75, 0.24);
  border-color: rgba(229, 83, 75, 0.55);
}
.btn.big {
  min-height: 44px;
  padding: 12px 16px;
  font-size: 15px;
  border-radius: var(--radius-lg);
}

/* ---- Inputs, selects, textareas & field labels ---- */
input,
select,
textarea {
  min-height: 42px;
  padding: 10px 13px;
  border-radius: var(--radius-md);
  background: var(--panel);
  border: 1px solid var(--line2);
  font-size: 14px;
  line-height: 1.4;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
input::placeholder,
textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 78%, transparent);
}
.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--body);
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}
.field input + input,
.field .seg + input {
  margin-top: 10px !important;
}

/* ---- Segmented controls (shadcn TabsList style) ---- */
.seg {
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--line);
}
.seg button {
  padding: 8px 12px;
  border-radius: calc(var(--radius-lg) - 4px);
  background: transparent;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.seg button:hover:not(.on) {
  color: var(--text);
  background: color-mix(in srgb, var(--panel2) 60%, transparent);
}
.seg button.on {
  background: var(--green);
  border-color: color-mix(in srgb, var(--green2) 50%, transparent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.seg#acRow {
  background: transparent;
  border: 0;
  padding: 2px 0;
  gap: 8px;
}

/* ---- View headers & section dividers ---- */
.vhead {
  padding: 12px 16px 8px;
  border-bottom: 1px solid transparent;
}
.vhead h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.sec {
  padding: 10px 16px 6px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* ---- Week strip ---- */
.week {
  padding: 6px 16px 10px;
  gap: 6px;
}
.wday {
  min-width: 54px;
  padding: 8px 6px;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--line);
  font-weight: 600;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
}
.wday:hover:not(.on) {
  border-color: var(--line2);
  background: var(--panel2);
}
.wday.on {
  box-shadow: 0 4px 12px rgba(var(--gRGB2), 0.32);
}

/* ---- Agenda rows & day headers ---- */
.ag-day {
  padding: 14px 16px 8px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.ag-day h3 {
  font-size: 15px;
  letter-spacing: -0.01em;
}
.ag-day button {
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--line2);
  font-weight: 600;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.ag-day button:hover {
  background: var(--panel2);
  color: var(--text);
}
.ag {
  margin: 2px 12px;
  padding: 10px 10px 10px 4px;
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.ag:hover {
  background: var(--panel);
  border-color: var(--line);
}
.ag.cur {
  background: var(--greenSoft);
  border-color: rgba(var(--gRGB), 0.32);
}
.ag-tm b {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.ag-tm small {
  font-variant-numeric: tabular-nums;
}
.ag .cb,
.row .cb {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border-width: 1.75px;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.ag .cb:hover,
.row .cb:hover {
  transform: scale(1.06);
}
.startb {
  padding: 7px 13px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 600;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.startb:hover {
  background: rgba(var(--gRGB), 0.28);
}

/* ---- Chips / Badges (shadcn Badge style) ---- */
.chip {
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* ---- Banners ---- */
.banner {
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
}
.banner button {
  border-radius: var(--radius-sm);
  padding: 6px 11px;
  font-weight: 600;
  transition: opacity 0.15s ease;
}
.banner button:hover {
  opacity: 0.9;
}

/* ---- Month calendar & event cards ---- */
.mc {
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.mc:hover:not(.s) {
  border-color: var(--line2);
  background: var(--panel2);
}
.ce,
.row,
.gmini,
.gbox {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.ce[data-tid]:hover,
.row:hover {
  border-color: var(--line2);
}

/* ---- Team cards, tabs, and rows ---- */
.tm-card {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 14px 14px 8px;
}
.tm-tabs button {
  border-radius: var(--radius-md);
  padding: 7px 13px;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.tm-tabs button:hover:not(.on) {
  color: var(--text);
  border-color: var(--line2);
}
.tm-row {
  border-radius: var(--radius-sm);
  padding: 10px 4px;
  transition: background-color 0.12s ease;
}
.tm-row.mine:hover,
.tm-row[data-aopen]:hover,
.tm-row.ml:hover {
  background: color-mix(in srgb, var(--panel2) 65%, transparent);
}
.prow button {
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-weight: 600;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.prow button:hover {
  background: color-mix(in srgb, var(--panel2) 80%, var(--text));
}

/* ---- Modal Sheet / Dialog (shadcn Dialog & Drawer style) ---- */
.scrim {
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.16s ease-out;
}
.sheet {
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  border: 1px solid var(--line2);
  box-shadow: var(--shadow-lg);
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  animation: sheetUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@media (min-width: 700px) {
  .sheet {
    border-radius: var(--radius-xl);
    max-width: 480px;
    padding: 22px 24px;
  }
}
.sheet h3 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 10px;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes sheetUp {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---- Login card (shadcn Card style, top-anchored so switching tabs never jumps) ---- */
.loginov {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: max(6vh, 28px) 20px 32px;
  scrollbar-gutter: stable;
  background: var(--bg);
}
.lcard {
  width: min(410px, 100%);
  min-height: 470px;
  padding: 28px 26px;
  border-radius: var(--radius-xl);
  background: var(--panel);
  border: 1px solid var(--line2);
  box-shadow: var(--shadow-lg);
  gap: 18px;
}
.lbrand {
  font-size: 26px;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.lcard .seg {
  background: var(--bg);
}
.lcard .seg button {
  padding: 9px 10px;
  font-size: 13px;
}
.lcard #lAuth,
.lcard #lTeam,
.lcard #lSolo {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.lcard .field {
  margin: 0;
}
.lcard .field label {
  margin-bottom: 9px;
}
.lcard .lmsg {
  min-height: 18px;
  margin: -6px 0;
  line-height: 1.4;
}

/* ---- Bottom navigation bar ---- */
nav.tabs {
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
nav.tabs button {
  font-size: 12px;
  font-weight: 600;
  transition: color 0.15s ease;
}
nav.tabs button:hover:not(.on) {
  color: var(--text);
}

/* ---- Toast (shadcn Sonner style) ---- */
.toast {
  border-radius: var(--radius-lg);
  padding: 10px 16px;
  box-shadow: var(--shadow-lg);
  font-weight: 600;
}

/* ---- Reduced motion respect (WCAG 2.3.3) ---- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


/* ---- Bigger header: logo and app name are the face of the product ---- */
header { min-height: 72px; padding: 10px 18px; gap: 14px; }
header .brand { gap: 14px; }
header .brand img { height: 60px; max-width: 260px; width: auto; }
header .brand .bname { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; opacity: 1; }
header .brand.has .bname { font-size: 24px; opacity: 1; }
header .brand .bname .pro { font-size: .46em; padding: 3px 9px; border-radius: 6px; }
header .clock b { font-size: 20px; }
header .clock small { font-size: 12.5px; }
header .iconbtn { width: 42px; height: 42px; }
@media (max-width: 520px) {
  header { min-height: 60px; padding: 8px 12px; gap: 10px; }
  header .brand { gap: 10px; }
  header .brand { overflow: hidden; }
  header .brand img { height: 42px; max-width: 120px; flex: none; }
  header .brand .bname, header .brand.has .bname { font-size: 17px; }
  header .brand.has .bname .pro { display: none; }
  header .clock b { font-size: 16px; }
  header .clock b { font-size: 17px; }
}

/* Logo as big as the app name; Team as a clear labelled button; Settings top-right */
header .brand img { height: 64px; max-width: 300px; }
#stHdr { flex: none; }
#teamHdr .tlbl { display: none; }
@media (min-width: 1000px) {
  header #teamHdr { display: inline-flex; align-items: center; gap: 8px; width: auto; padding: 0 16px; height: 42px; font-weight: 700; font-size: 14px;
    background: var(--greenSoft); border-color: var(--green2); color: var(--text); }
  header #teamHdr .tlbl { display: inline; }
  header #teamHdr:hover { background: var(--green); border-color: var(--green); color: #fff; }
}

/* Settings: big, top-right, labelled on desktop; icon on phones */
header #stHdr { width: 44px; height: 44px; }
@media (min-width: 1000px) {
  header #stHdr { display: inline-flex; align-items: center; gap: 8px; width: auto; padding: 0 16px; height: 44px; font-weight: 700; font-size: 14px; }
  header #stHdr .tlbl { display: inline; }
  header #stHdr:hover { background: var(--green); border-color: var(--green); color: #fff; }
}
@media (max-width: 520px) { header #stHdr { width: 38px; height: 38px; } header .clock small { display: none; } }

/* Compact mode toggle switch */
.cmpbtn { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 8px; font-size: 13px; font-weight: 700; color: var(--text); background: var(--panel2); border: 1px solid var(--line2); border-radius: 999px; }
.cmpbtn .sw { position: relative; width: 34px; height: 20px; border-radius: 999px; background: var(--line2); flex: none; transition: background .15s; }
.cmpbtn .sw i { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35); transition: transform .15s; }
.cmpbtn.on { background: var(--greenSoft); border-color: var(--green2); color: var(--text); }
.cmpbtn.on .sw { background: var(--green); }
.cmpbtn.on .sw i { transform: translateX(14px); }
.todaybtn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: auto; padding: 0 14px; font-size: 13px; font-weight: 700; }
#stHdr .tlbl { display: none; }
@media (min-width: 1000px) { header #stHdr .tlbl { display: inline; } }
@media (max-width: 520px) { header .brand .bname .pro { display: none; } }

/* Earlier days toggle + floating Today button */
#v-cal { position: relative; }
.pastday { opacity: .5; transition: opacity .2s; }
.pastday:hover { opacity: .9; }
.todayfab { position: absolute; left: 50%; bottom: 20px; transform: translate(-50%, 16px); opacity: 0; pointer-events: none; z-index: 30; display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 22px; border-radius: 999px; background: var(--green); color: #fff; font-size: 15px; font-weight: 800; border: 0; box-shadow: 0 6px 22px rgba(0,0,0,.4); transition: opacity .18s, transform .18s; }
.todayfab.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.todayfab b { font-size: 18px; line-height: 1; }

/* Settings: account card at the top */
.acctcard { display: flex; align-items: center; gap: 12px; width: 100%; margin: 4px 0 14px; padding: 12px 14px; border: 1px solid var(--line2); border-radius: 14px; background: var(--panel2); color: var(--text); text-align: start; }
.acctcard svg { width: 26px; height: 26px; flex: none; }
.acctcard span { display: flex; flex-direction: column; min-width: 0; }
.acctcard b { font-size: 15px; }
.acctcard small { color: var(--muted); font-size: 12px; }
.acctcard i { margin-inline-start: auto; font-style: normal; font-size: 12px; font-weight: 700; color: var(--green2); white-space: nowrap; }
.acctcard:hover { border-color: var(--green2); }

/* subtle floating Today pill */
.todayfab { height: 36px; padding: 0 16px; font-size: 13px; font-weight: 700; bottom: 18px; background: color-mix(in srgb, var(--green) 72%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 3px 14px rgba(0,0,0,.28); }
.todayfab.on { opacity: .85; }
.todayfab.on:hover { opacity: 1; }
.todayfab b { font-size: 15px; }
header .brand img { height: 60px; max-width: 320px; width: auto; }

/* "starts soon" alert at the top */
#soonBar:empty { display: none; }
#soonBar .banner { margin: 0; border-radius: 0; border-inline: 0; }
.nowl { margin: 2px 12px; }

/* no zoom: no double-tap / pinch zoom, and iOS won't auto-zoom when a field gets focus (that was cropping the page) */
html { touch-action: pan-x pan-y; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (pointer: coarse) { input, select, textarea { font-size: 16px !important; } }

/* visible grip on the Agenda | Calendar divider */
@media (min-width: 1000px) {
  #splitter::before { content: ""; position: absolute; top: 50%; left: 1px; width: 8px; height: 44px; margin-top: -22px; border-radius: 6px; background: var(--line2); border: 1px solid var(--line); }
  #splitter:hover::before, #splitter.drag::before { background: var(--green2); border-color: var(--green2); }
}

/* large text: on phones the header keeps its normal size so the name and buttons still fit */
@media (max-width: 520px) {
  html[data-tsz="lg"] header { zoom: 0.9091; }
  html[data-tsz="xl"] header { zoom: 0.8333; }
}

/* ---- mobile fixes: no doubled safe-area gap at the bottom, no see-through blur at the top ---- */
html,body{height:100%;height:100dvh}
html{background:var(--bg)}
header{background:var(--panel);backdrop-filter:none;-webkit-backdrop-filter:none}
nav.tabs{background:var(--panel);backdrop-filter:none;-webkit-backdrop-filter:none}
.ag-day{background:var(--bg);backdrop-filter:none;-webkit-backdrop-filter:none}
.scrim{backdrop-filter:none;-webkit-backdrop-filter:none}
/* time editor at the top of the task sheet */
.tbox{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(0,1fr) minmax(0,1fr);gap:8px;margin:6px 0 8px}
.tbox label{display:block;font-size:11.5px;color:var(--muted);margin:0 0 4px 2px;font-weight:600}
.tbox input{padding:10px 8px;font-size:15px;min-width:0}
.tbox.two2{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
.tbox input{width:100%;min-width:0;font-size:14px;padding:10px 6px}
.dchips{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 6px}
.dchips button{padding:8px 12px;border-radius:10px;background:var(--panel2);border:1px solid var(--line2);font-size:13px;color:var(--muted)}
.dchips button.on{background:var(--green);border-color:var(--green);color:#fff}
.dlbl{font-size:12px;color:var(--muted);margin:6px 0 4px;font-weight:600}

/* sync indicator: deliberately faded so it never adds clutter */
.syncdot{display:inline-grid;place-items:center;flex:none;width:22px;height:22px;opacity:.38;color:var(--muted)}
.syncdot .ic{width:18px;height:18px}
.syncdot.off{opacity:.85;color:#e3a83f}
.syncdot.pend{opacity:.6;animation:syncPulse 1.2s ease-in-out infinite}
@keyframes syncPulse{50%{opacity:.25}}

/* ---- desktop: use the width, but don't let single columns stretch into empty bands ---- */
@media (min-width: 1000px) {
  main.fs #v-cal .agenda { max-width: 1100px; margin-inline: auto; }
  main.fs #v-cal .vhead, main.fs #v-cal .week, main.fs #v-cal .banners { max-width: 1100px; margin-inline: auto; width: 100%; }
  main.fs #teamBox { display: grid; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); gap: 0 16px; align-items: start; }
  main.fs #teamBox > .tm-tabs, main.fs #teamBox > .tm-top, main.fs #teamBox > .tm-note, main.fs #teamBox > .tm-online,
  main.fs #teamBox > .sec, main.fs #teamBox > .empty { grid-column: 1 / -1; }
  .tm-top { flex-wrap: wrap; }
}
/* native dropdowns: our own arrow, so it is never clipped */
select { -webkit-appearance: none; appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238d9c94' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 14px; }

/* ---- phones: the name must never be cut off; squeeze the buttons instead ---- */
@media (max-width: 520px) {
  header { gap: 6px; padding-inline: 10px; }
  header .brandgrp { gap: 6px; flex: 1 1 auto; min-width: 0; }
  header .brandgrp .brand { flex: 0 0 auto; }
  header .iconbtn { width: 34px; height: 34px; }
  header .ur button { width: 30px; height: 34px; }
  header .clock b { font-size: 15px; }
  header .clock small { display: none; }
  .syncdot { width: 18px; height: 18px; }
  .syncdot .ic { width: 16px; height: 16px; }
}
@media (max-width: 520px) {
  header .brand img { height: 34px; max-width: 90px; }
  header .brandgrp { overflow: hidden; }
}
@media (max-width: 420px) {
  header { gap: 4px; padding-inline: 8px; }
  header .iconbtn { width: 32px; height: 32px; }
  header .ur button { width: 26px; }
  header .clock b { font-size: 14px; }
  header .brandgrp { gap: 5px; }
}
@media (max-width: 420px) { .syncdot.ok { display: none; } }

/* ---- brand area: logo and the DearTask name sit on one centre line at a similar size; a long logo stops at its box ---- */
header .brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
header .brand img { height: 44px; width: auto; max-width: 170px; object-fit: contain; flex: none; }
header .brand .bname, header .brand.has .bname { font-size: 24px; line-height: 1; opacity: 1; white-space: nowrap; }
header .brand .bname .pro { vertical-align: middle; margin-left: 6px; }
header .brand .bsep { height: 26px; }
@media (max-width: 520px) {
  header .brand { gap: 5px; }
  header .brandgrp { overflow: visible; }
  header .brand img { height: 32px; max-width: 70px; }
  header .brand .bname, header .brand.has .bname { font-size: 17px; }
  header .brand .bsep { height: 20px; }
}

/* one-colour logo shown in the readable colour on the opposite theme */
header .brand img.ink-black { filter: brightness(0); }
header .brand img.ink-white { filter: brightness(0) invert(1); }

/* ---- phones: a slimmer top area so the first task is on screen, not buried under bars ---- */
@media (max-width: 520px) {
  header { min-height: 46px; padding-block: 5px; }
  .banner { padding: 6px 12px; gap: 8px; flex-wrap: nowrap; font-size: 13px; }
  .banner > span { min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .banner button { height: 30px; padding: 0 10px; font-size: 12.5px; flex: none; }
  #v-cal .vhead { padding: 6px 12px 4px; gap: 6px; }
  #v-cal .vhead h2 { display: none; }
  .cmpbtn { height: 30px; padding: 0 10px 0 6px; font-size: 12.5px; gap: 6px; }
  #todayBtn { height: 30px; width: auto; padding: 0 10px; font-size: 12.5px; }
  .week { padding: 2px 12px 6px; }
  .wday { min-width: 44px; padding: 4px 6px; border-radius: 10px; }
  .wday b { font-size: 15px; margin-top: 0; }
  .wday .dot { margin-top: 2px; }
  .ag-day { padding: 8px 12px 4px; }
}
@media (max-width: 520px) { .banner .st { display: none; } }

/* ---- Settings menu: grouped rows that open pages, like a phone's own settings ---- */
.nvh { display: flex; align-items: center; gap: 10px; margin: -2px 0 14px; }
.nvh h3 { margin: 0; font-size: 18px; }
.nvb { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--panel2); border: 1px solid var(--line2); flex: none; }
.nvb .ic { width: 18px; height: 18px; }
.nvs { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.mrows { border: 1px solid var(--line2); border-radius: 14px; background: var(--panel2); overflow: hidden; margin-bottom: 14px; }
.mrow { display: flex; align-items: center; gap: 10px; width: 100%; padding: 14px 14px; text-align: start; font-size: 15px; color: var(--text); }
.mrow + .mrow { border-top: 1px solid var(--line); }
.mrow:hover { background: color-mix(in srgb, var(--panel2) 80%, var(--text)); }
.mrow .ml { flex: 1; min-width: 0; }
.mrow .mv { color: var(--muted); font-size: 13.5px; max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow .ic { width: 16px; height: 16px; color: var(--muted); flex: none; }
[dir=rtl] .mrow .ic { transform: scaleX(-1); }
.mrow.red { color: var(--redTxt); }

/* quiet "add a task" line after the last item of a day: small, faded, not a card */
.ag-add { display: flex; align-items: center; gap: 8px; width: 100%; margin: 2px 0 12px; padding: 10px 18px; color: var(--muted); font-size: 12.5px; opacity: .55; text-align: start; border-radius: 0; cursor: pointer; }
.ag-add .ic { width: 14px; height: 14px; }
.ag-add small { font-size: 12px; margin-inline-start: 2px; }
.ag-add small::before { content: "·"; margin-inline-end: 8px; }
.ag-add:hover, .ag-add:focus-visible { opacity: 1; color: var(--text); background: var(--panel2); }

.lgprev img.ink-black { filter: brightness(0); }
.lgprev img.ink-white { filter: brightness(0) invert(1); }

/* the "push the other tasks?" question, shown right under the task title */
.pgbox { margin: 8px 0 14px; padding: 12px; border: 1px solid var(--line2); border-radius: 14px; background: var(--panel2); }
.pgt { font-size: 13.5px; line-height: 1.5; margin-bottom: 10px; color: var(--body); }
.pgbox .btn { margin-top: 6px; }

/* task sheet: editable name, start time with a Now button, small action chips */
.ttlin { width: 100%; font-size: 19px; font-weight: 700; background: transparent !important; border: 1px solid transparent !important; box-shadow: none !important; padding: 6px 8px !important; margin: -6px 0 0 -8px; min-height: 0 !important; width: calc(100% + 8px); }
.ttlin:hover { border-color: var(--line2) !important; }
.ttlin:focus { border-color: var(--green) !important; background: var(--panel2) !important; }
.trow { display: flex; align-items: flex-end; gap: 8px; margin: 6px 0 8px; }
.trow .tfield { flex: 1; min-width: 0; }
.tfield label { display: block; font-size: 11.5px; color: var(--muted); margin: 0 0 4px 2px; font-weight: 600; }
.tfield { margin-bottom: 8px; }
.nowbtn { height: 42px; padding: 0 16px; border-radius: 12px; background: var(--green); color: #fff; font-weight: 700; font-size: 14px; flex: none; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.acts button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 10px; font-size: 12.5px; background: var(--panel2); border: 1px solid var(--line2); color: var(--body); }
.acts button .ic { width: 14px; height: 14px; }
.acts button.on { background: var(--greenSoft); border-color: var(--green2); color: var(--text); }
.acts button.red { color: var(--redTxt); }

/* short plain-language explanations under an option */
.hint { margin: 10px 0 4px; padding: 10px 12px; border-left: 2px solid var(--line2); color: var(--muted); font-size: 12.5px; line-height: 1.55; }

/* task sheet: time, Now and day share one slim row */
.trow { display: flex; align-items: flex-end; gap: 6px; margin: 6px 0 10px; }
.trow .tfield { margin: 0; min-width: 0; }
.trow .tt { flex: 1 1 0; }
.trow .td { flex: 1.15 1 0; }
.trow input, .tbox input { min-height: 36px; padding: 6px 8px; font-size: 14px; }
.nowbtn { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }

.hint ol { margin: 8px 0 0 18px; padding: 0; }
.hint li { margin: 3px 0; }
/* Home Screen app: the notch / home-bar areas get the same solid colour as the header and tab bar */
body::before, body::after { content: ""; position: fixed; left: 0; right: 0; background: var(--panel); z-index: 2000; pointer-events: none; }
body::before { top: 0; height: env(safe-area-inset-top, 0px); }
body::after { bottom: 0; height: env(safe-area-inset-bottom, 0px); }

/* install guide */
.stp { display: flex; gap: 12px; margin: 14px 0; }
.stn { width: 24px; height: 24px; border-radius: 50%; background: var(--green); color: #fff; font-size: 13px; font-weight: 700; display: grid; place-items: center; flex: none; margin-top: 1px; }
.stb { flex: 1; min-width: 0; }
.stt { font-size: 14px; margin-bottom: 8px; line-height: 1.45; }
#installBar { border-radius: 0; }

/* after answering: one quiet line with a Change button */
.pgbox.pgdone { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin: 6px 0 12px; font-size: 12.5px; color: var(--muted); background: transparent; }
.pgbox.pgdone span { flex: 1; }
.pglist { max-height: 170px; overflow: auto; margin-top: 8px; border-top: 1px solid var(--line); }
.pgrow { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 12.5px; border-bottom: 1px solid var(--line); }
.pgrow small { color: var(--muted); white-space: nowrap; }
