/* Stax — base styles, layout and shared components. View-specific styles live in views.css. */

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bg: #ffffff;
  --bg-2: #f9f8f8;
  --bg-3: #f1f0ef;
  --hover: #f6f5f4;
  --selected: #edf2fc;
  --border: #e8e6e4;
  --border-2: #d3d0ce;
  --text: #1e1f21;
  --text-2: #6d6e6f;
  --text-3: #a2a0a2;
  --accent: #f06a6a;
  --accent-2: #e25757;
  --primary: #4573d2;
  --primary-2: #3a63bb;
  --primary-soft: #eaf0fb;
  --green: #2c9466;
  --green-soft: #e6f4ed;
  --red: #d63b48;
  --red-soft: #fdecee;
  --amber: #b9770e;
  --sb-bg: #1e1f21;
  --sb-hover: #2b2c2f;
  --sb-active: #393a3e;
  --sb-text: #f2f1f0;
  --sb-text-2: #a9a7a6;
  --border-3: #c4c1bf;
  --primary-border: #c7d5f3;
  --green-2: #26805a;
  --red-2: #bf2f3b;
  --amber-soft: #fdf3e1;
  --amber-soft-2: #fcefd0;
  --amber-text: #8a5a00;
  --amber-text-2: #6b4a00;
  --amber-faint: #fffaf0;
  --amber-border: #f1d49b;
  --red-pill: #fde1e1;
  --red-pill-text: #a8262f;
  --red-faint: #fde8e8;
  --teal-pill: #d7f3f1;
  --teal-pill-text: #0f6a65;
  --purple: #6b4fd8;
  --purple-2: #5a3fc8;
  --purple-soft: #f6f3ff;
  --purple-soft-2: #ede7ff;
  --purple-border: #d9d0fb;
  --purple-border-2: #c6b8f7;
  --clay-soft: #f3eee8;
  --clay: #b8672e;
  --bg-weekend: #fcfbfb;
  --switch-off: #cfccca;
  --shimmer: #f8f7f6;
  --glow-1: #fde9e9;
  --glow-2: #e6edfb;
  --sb-border: #2f3033;
  --sb-line: #4a4b4f;
  --toast-bg: #2a2b2e;
  --toast-error: #a3232e;
  --radius: 6px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(30, 31, 33, .06);
  --shadow-pop: 0 10px 30px rgba(30, 31, 33, .16), 0 0 0 1px rgba(30, 31, 33, .06);
  --topbar-h: 52px;
  --pane-w: min(var(--pane-w-user, 640px), calc(100vw - 40px)); /* drag the panel edge to change */
}

/* Dark theme, chosen per person in My profile → Appearance (theme-boot.js / theme.js set data-theme). */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1e1f22;
  --bg-2: #242528;
  --bg-3: #2c2d31;
  --hover: #2a2b2f;
  --selected: #24324d;
  --border: #34353a;
  --border-2: #46474d;
  --border-3: #5a5b62;
  --text: #ecebea;
  --text-2: #a9a8a7;
  --text-3: #7d7c7e;
  --accent: #f06a6a;
  --accent-2: #f47f7f;
  --primary: #5f87e0;
  --primary-2: #7b9cea;
  --primary-soft: #253149;
  --primary-border: #36508a;
  --green: #36a170;
  --green-2: #44b281;
  --green-soft: #1c3a2c;
  --red: #e0505c;
  --red-2: #ea6a74;
  --red-soft: #41232a;
  --amber: #e2a53e;
  --amber-soft: #382e1b;
  --amber-soft-2: #41351c;
  --amber-text: #efc36b;
  --amber-text-2: #efc36b;
  --amber-faint: #2c271d;
  --amber-border: #5b4823;
  --red-pill: #48242a;
  --red-pill-text: #ff9aa3;
  --red-faint: #3a2328;
  --teal-pill: #173b39;
  --teal-pill-text: #6fd6cd;
  --purple: #a28ff2;
  --purple-2: #b6a6f6;
  --purple-soft: #29243f;
  --purple-soft-2: #322b50;
  --purple-border: #463b7c;
  --purple-border-2: #5b4ca0;
  --clay-soft: #3a2c22;
  --clay: #e3965f;
  --bg-weekend: #212225;
  --switch-off: #55565d;
  --shimmer: #34353a;
  --glow-1: rgba(240, 106, 106, .14);
  --glow-2: rgba(95, 135, 224, .16);
  --sb-bg: #161719;
  --sb-hover: #222326;
  --sb-active: #2e2f33;
  --sb-border: #26272a;
  --sb-line: #3d3e42;
  --toast-bg: #3a3b40;
  --toast-error: #b3303c;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-pop: 0 10px 30px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .07);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.45 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
kbd {
  font: 11px/1 var(--font); padding: 3px 6px; border-radius: 4px;
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text-2);
}
.icon { flex-shrink: 0; display: block; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.spacer { flex: 1 1 auto; }
.bad { color: var(--red); }
.good { color: var(--green); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

/* ------------------------------------------------------------- boot */

.boot-splash { height: 100vh; display: grid; place-items: center; }
.boot-spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--bg-3); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ----------------------------------------------------------- layout */

.shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.view { flex: 1; overflow: auto; position: relative; transition: margin-right .16s ease; }
@media (min-width: 1280px) {
  html:not(.pane-overlay) .shell.pane-open .view { margin-right: var(--pane-w); }
}
/* Inbox: keep the rows (and their buttons) out from under the open task. */
@media (min-width: 1000px) {
  html:not(.pane-overlay-inbox) .shell.pane-open .view:has(> .inbox) { margin-right: var(--pane-w); }
}

/* ---------------------------------------------------------- sidebar */

.sidebar {
  background: var(--sb-bg);
  color: var(--sb-text);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 12px 10px 10px;
  gap: 2px;
}
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.sb-link {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 6px;
  color: var(--sb-text); text-decoration: none !important;
  font-size: 14px; min-height: 34px;
}
.sb-link .icon { color: var(--sb-text-2); }
.sb-link:hover { background: var(--sb-hover); }
.sb-link.active { background: var(--sb-active); }
.sb-link.active .icon { color: var(--sb-text); }
.sb-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-badge {
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
}
.sb-nav { display: flex; flex-direction: column; gap: 2px; padding-bottom: 12px; border-bottom: 1px solid var(--sb-border); }
.sb-section { padding-top: 12px; flex: 1; }
.sb-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 6px 10px; color: var(--sb-text-2); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.sb-add { color: var(--sb-text-2) !important; }
.sb-add:hover { background: var(--sb-hover) !important; color: var(--sb-text) !important; }
.sb-projects { display: flex; flex-direction: column; gap: 1px; }
.sb-project { padding: 6px 10px; min-height: 32px; }
.sb-project .project-dot { width: 12px; height: 12px; border-radius: 3px; }
.sb-project .project-badge { border-radius: 5px; }
.sb-lock { width: 12px; height: 12px; }
.sb-empty { background: none; border: 1px dashed var(--sb-line); color: var(--sb-text-2); border-radius: 6px; padding: 8px; margin: 4px 0; cursor: pointer; }
.sb-empty:hover { color: var(--sb-text); border-color: var(--sb-text-2); }
.sb-archived-toggle { display: flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--sb-text-2); font-size: 12px; padding: 10px 10px 4px; cursor: pointer; }
.sb-archived-toggle:hover { color: var(--sb-text); }
.sb-projects.archived .sb-link { opacity: .7; }
.sb-bottom { border-top: 1px solid var(--sb-border); padding-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.sb-me { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; color: var(--sb-text); text-decoration: none !important; }
.sb-me:hover, .sb-me.active { background: var(--sb-hover); }
.sb-scrim { display: none; }

/* ----------------------------------------------------------- topbar */

.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  position: relative;
  z-index: 40;
}
.icon-btn.menu-btn { display: none; }
.search { position: relative; flex: 0 1 480px; display: flex; align-items: center; }
.search-icon { position: absolute; left: 11px; color: var(--text-3); pointer-events: none; }
.search-input {
  width: 100%; height: 34px; padding: 0 36px 0 34px;
  border: 1px solid var(--border); border-radius: 17px;
  background: var(--bg-2); font: inherit; color: var(--text);
  transition: background .12s, border-color .12s;
}
.search-input:hover { border-color: var(--border-2); }
.search-input:focus { outline: none; background: var(--bg); border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.search-input::-webkit-search-cancel-button { display: none; }
.search-kbd { position: absolute; right: 10px; pointer-events: none; }
.search-input:focus ~ .search-kbd { display: none; }
.search-drop {
  position: absolute; top: 40px; left: 0; right: 0;
  background: var(--bg); border-radius: 10px; box-shadow: var(--shadow-pop);
  padding: 6px; max-height: 420px; overflow-y: auto;
}
.search-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 0; background: none; text-align: left; padding: 8px 10px; border-radius: 6px; cursor: pointer;
}
.search-item:hover, .search-item.active { background: var(--hover); }
.search-item-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-item small { color: var(--text-3); white-space: nowrap; }
.search-item .done-icon { color: var(--green); }
.search-item .icon { color: var(--text-3); }
.create-btn { background: var(--accent) !important; border-color: var(--accent) !important; border-radius: 16px !important; padding: 0 14px !important; }
.create-btn:hover { background: var(--accent-2) !important; }
.avatar-btn { border: 0; background: none; padding: 0; border-radius: 50%; cursor: pointer; display: inline-flex; }
.avatar-btn:hover { box-shadow: 0 0 0 3px var(--bg-3); }

/* ---------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px;
  border: 1px solid var(--border-2); border-radius: var(--radius);
  background: var(--bg); color: var(--text);
  font: 500 14px/1 var(--font); cursor: pointer; white-space: nowrap;
  text-decoration: none !important;
  transition: background .1s, border-color .1s, color .1s;
}
.btn:hover { background: var(--hover); border-color: var(--border-3); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-2); border-color: var(--primary-2); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: var(--red-2); border-color: var(--red-2); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-quiet:hover { background: var(--bg-3); border-color: transparent; color: var(--text); }
.btn-quiet.filter-on { background: var(--primary-soft); color: var(--primary); }
.btn-block { width: 100%; height: 40px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: 0; border-radius: 6px;
  background: transparent; color: var(--text-2); cursor: pointer; flex-shrink: 0;
  text-decoration: none !important;
}
.icon-btn:hover { background: var(--bg-3); color: var(--text); }
.icon-btn.sm { width: 26px; height: 26px; }
.link-btn {
  display: inline-flex; align-items: center; gap: 4px;
  border: 0; background: none; color: var(--primary); cursor: pointer; padding: 2px 4px; border-radius: 4px; font-size: 13px;
  text-decoration: none !important;
}
.link-btn:hover { background: var(--primary-soft); }
.link-btn.danger { color: var(--red); }
.link-btn.right { margin-left: auto; }
.segmented { display: inline-flex; background: var(--bg-3); border-radius: 8px; padding: 3px; gap: 2px; }
.segmented button { border: 0; background: transparent; padding: 5px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--text-2); }
.segmented button.active { background: var(--bg); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 500; }

/* ------------------------------------------------------------ forms */

.input {
  display: block; width: 100%;
  height: 36px; padding: 0 11px;
  border: 1px solid var(--border-2); border-radius: var(--radius);
  background: var(--bg); color: var(--text); font: inherit;
}
textarea.input { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.45; }
select.input { padding-right: 6px; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input-lg { height: 44px; font-size: 18px; font-weight: 500; border-color: transparent; padding: 0 4px; }
.input-lg:focus { box-shadow: none; border-color: transparent; border-bottom: 2px solid var(--primary); border-radius: 0; }
.input-btn { display: flex; align-items: center; gap: 8px; cursor: pointer; text-align: left; }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span:first-child { font-size: 13px; font-weight: 500; color: var(--text-2); }
.row-end { display: flex; justify-content: flex-end; gap: 8px; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch-btn {
  width: 26px; height: 26px; border-radius: 6px; border: 0; cursor: pointer; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .1s;
}
.swatch-btn:hover { transform: scale(1.1); }
.swatch-btn.selected { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text); }
.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.radio-card { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border-2); border-radius: 8px; padding: 10px; cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.radio-card input { margin: 3px 0 0; }
.radio-card strong { display: block; font-size: 13px; }
.radio-card small { color: var(--text-2); font-size: 12px; }

/* ------------------------------------------------------ small parts */

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; color: #fff; font-weight: 600; flex-shrink: 0; line-height: 1;
  user-select: none; letter-spacing: .02em;
}
.avatar-empty { border: 1.5px dashed var(--text-3); color: var(--text-3); background: transparent; }
.avatar-inactive { filter: grayscale(1); opacity: .6; }
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--bg); }
.avatar-stack .avatar + .avatar { margin-left: -6px; }
.avatar-more { background: var(--bg-3); color: var(--text-2); font-size: 11px; }
.project-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; display: inline-block; }
.project-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 2px 8px; border-radius: 12px; background: var(--bg-3);
  font-size: 12px; color: var(--text); border: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-decoration: none !important; cursor: default;
}
button.project-chip, a.project-chip { cursor: pointer; }
button.project-chip:hover, a.project-chip:hover { background: var(--border); }
.project-chip.big { font-size: 14px; padding: 6px 12px; }
.pill { display: inline-flex; align-items: center; font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 10px; white-space: nowrap; }
.pill-high { background: var(--red-pill); color: var(--red-pill-text); }
.pill-medium { background: var(--amber-soft-2); color: var(--amber-text); }
.pill-low { background: var(--teal-pill); color: var(--teal-pill-text); }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--bg-3); color: var(--text-2); white-space: nowrap; }
.tag-accent { background: var(--primary-soft); color: var(--primary); }
.tag-warn { background: var(--amber-soft-2); color: var(--amber-text); }
.tag-quiet { background: transparent; border: 1px solid var(--border); }
.badges { display: inline-flex; gap: 8px; color: var(--text-3); font-size: 12px; flex-shrink: 0; }
.badge { display: inline-flex; align-items: center; gap: 3px; }

/* the round completion checkbox */
.check {
  border: 0; background: none; padding: 0; margin: 0;
  color: var(--text-3); display: inline-flex; cursor: pointer; border-radius: 50%; flex-shrink: 0;
}
.check .icon circle { fill: transparent; transition: fill .12s, stroke .12s; }
.check:hover { color: var(--green); }
.check:hover .icon circle { fill: var(--green-soft); }
.check.done { color: var(--green); }
.check.done .icon circle { fill: var(--green); stroke: var(--green); }
.check.done .icon path { stroke: #fff; }
.check.pop { animation: pop .4s cubic-bezier(.3, 1.6, .5, 1); }
.check.ghost { opacity: .45; cursor: default; }
.check.ghost:hover .icon circle { fill: transparent; }
@keyframes pop { 0% { transform: scale(.7); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* ------------------------------------------------- popovers & menus */

.popover {
  position: fixed; z-index: 300;
  background: var(--bg); border-radius: 10px; box-shadow: var(--shadow-pop);
  animation: pop-in .1s ease-out;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-3px); } }
.menu { padding: 6px; min-width: 220px; max-height: 70vh; overflow-y: auto; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 0; background: none; padding: 7px 10px; border-radius: 6px; cursor: pointer; text-align: left; font-size: 14px;
}
.menu-item .icon { color: var(--text-2); }
.menu-item:hover:not(:disabled) { background: var(--hover); }
.menu-item:disabled { opacity: .45; cursor: default; }
.menu-item.danger, .menu-item.danger .icon { color: var(--red); }
.menu-item.checked { font-weight: 500; }
.menu-label { flex: 1; }
.menu-check { color: var(--primary) !important; }
.menu-icon-space { width: 16px; }
.menu-item .swatch { width: 12px; height: 12px; border-radius: 3px; }
.menu-divider { height: 1px; background: var(--border); margin: 5px 0; }
.menu-header { padding: 6px 10px 4px; font-size: 12px; color: var(--text-2); font-weight: 600; }
.picker { width: 300px; padding: 10px; }
.picker-title { font-size: 12px; font-weight: 600; color: var(--text-2); padding: 0 2px 8px; }
.picker-search { width: 100%; height: 34px; border: 1px solid var(--border-2); border-radius: 6px; padding: 0 10px; font: inherit; margin-bottom: 6px; }
.picker-search:focus { outline: none; border-color: var(--primary); }
.picker-list { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.picker-option { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 6px 8px; border-radius: 6px; cursor: pointer; text-align: left; }
.picker-option.active { background: var(--hover); }
.picker-option.selected { font-weight: 500; }
.picker-name { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.picker-name small { color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; font-weight: 400; }
.picker-check { color: var(--primary); }
.picker-empty { padding: 12px; color: var(--text-3); text-align: center; font-size: 13px; }
.color-pop { padding: 12px; width: 236px; }

.date-picker { display: flex; }
.date-quick { display: flex; flex-direction: column; gap: 2px; padding: 8px; border-right: 1px solid var(--border); width: 170px; }
.date-quick-btn { display: flex; flex-direction: column; align-items: flex-start; border: 0; background: none; padding: 6px 10px; border-radius: 6px; cursor: pointer; text-align: left; }
.date-quick-btn small { color: var(--text-3); font-size: 11px; }
.date-quick-btn:hover { background: var(--hover); }
.date-quick-btn.selected { background: var(--primary-soft); }
.date-quick-btn.clear { flex-direction: row; align-items: center; gap: 6px; color: var(--red); margin-top: auto; }
.mini-cal { padding: 10px; width: 252px; }
.mini-head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; margin-bottom: 6px; }
.mini-dow, .mini-days { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.mini-dow span { font-size: 11px; color: var(--text-3); padding: 4px 0; }
.mini-day { border: 0; background: none; height: 32px; border-radius: 50%; cursor: pointer; font-size: 13px; }
.mini-day:hover { background: var(--hover); }
.mini-day.other { color: var(--text-3); }
.mini-day.today { color: var(--accent); font-weight: 700; }
.mini-day.selected { background: var(--primary); color: #fff; }

/* ------------------------------------------------------------ modal */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(30, 31, 33, .42);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 10vh 16px 16px; overflow-y: auto;
  animation: fade-in .12s ease-out;
}
@keyframes fade-in { from { opacity: 0; } }
.modal {
  width: 100%; background: var(--bg); border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  animation: modal-in .16s ease-out;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 4px 24px; }
.modal-head h2 { font-size: 18px; }
.modal-body { padding: 12px 24px 20px; }
.modal-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--border); }
.foot-hint { margin-right: auto; color: var(--text-3); font-size: 12px; }
.confirm-text { margin: 0; color: var(--text-2); }
.create-task { display: flex; flex-direction: column; gap: 12px; }
.create-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.credentials { background: var(--bg-3); padding: 12px 14px; border-radius: 8px; font: 13px/1.6 ui-monospace, Consolas, monospace; white-space: pre-wrap; margin: 0; user-select: all; }
.lightbox .modal-body { padding: 0 16px 16px; }
.lightbox-body { display: grid; place-items: center; background: var(--bg-3); border-radius: 8px; }
.lightbox-body img { max-width: 100%; max-height: 70vh; display: block; }
.shortcuts { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 0; align-items: center; }
.shortcuts dd { margin: 0; color: var(--text-2); }

/* ----------------------------------------------------------- toasts */

.toasts { position: fixed; left: 0; right: 0; bottom: 24px; z-index: 400; /* full width (clicks pass through), so long messages aren't squeezed into half the screen */ display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 12px;
  background: var(--toast-bg); color: #fff; padding: 10px 10px 10px 16px; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25); font-size: 14px; max-width: min(560px, 92vw);
  opacity: 0; transform: translateY(8px); transition: opacity .18s, transform .18s; pointer-events: auto;
}
.toast.show { opacity: 1; transform: none; }
.toast-error { background: var(--toast-error); }
.toast-msg { flex: 1; }
.toast-action { border: 0; background: rgba(255, 255, 255, .14); color: #fff; font-weight: 600; padding: 5px 10px; border-radius: 5px; cursor: pointer; }
.toast-action:hover { background: rgba(255, 255, 255, .24); }
.toast-close { border: 0; background: none; color: rgba(255, 255, 255, .7); cursor: pointer; display: flex; padding: 4px; border-radius: 4px; }
.toast-close:hover { color: #fff; }

/* ------------------------------------------------- loading & empty */

.skeleton-row, .skeleton-line {
  background: linear-gradient(90deg, var(--bg-3) 25%, var(--shimmer) 50%, var(--bg-3) 75%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px;
}
.skeleton-row { height: 30px; margin: 8px 0; }
.skeleton-row.tall { height: 56px; }
.skeleton-line { height: 14px; margin: 8px 0; }
.skeleton-line.short { width: 60%; }
.loading-rows { padding: 8px 24px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty-state { text-align: center; padding: 56px 24px; color: var(--text-2); max-width: 440px; margin: 0 auto; }
.empty-state h2, .empty-state h3 { color: var(--text); margin-bottom: 8px; }
.empty-state p { margin: 0 0 16px; }
.empty-state.small { padding: 24px; }
.empty-state.page { padding-top: 15vh; }
.empty-icon { color: var(--text-3); display: flex; justify-content: center; margin-bottom: 12px; }

/* ----------------------------------------------------------- sign in */

.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 10% -10%, var(--glow-1) 0, transparent 60%), radial-gradient(900px 500px at 110% 110%, var(--glow-2) 0, transparent 60%), var(--bg-2);
}
.login-card { width: 100%; max-width: 400px; background: var(--bg); border-radius: 16px; padding: 36px 32px 28px; box-shadow: 0 10px 40px rgba(30, 31, 33, .1), 0 0 0 1px rgba(30, 31, 33, .04); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.login-brand h1 { font-size: 24px; letter-spacing: -.02em; }
.login-form { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; }
.login-error { color: var(--red); font-size: 13px; min-height: 18px; }
.login-foot { margin: 20px 0 0; text-align: center; }

/* ---------------------------------------------------- drag & drop */

.drag-ghost {
  position: fixed !important; left: 0; top: 0; z-index: 1000; margin: 0 !important;
  pointer-events: none; opacity: .96; background: var(--bg);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .22); border-radius: 8px;
}
.drag-placeholder { opacity: .3; }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none; }

/* ------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 272px; z-index: 120;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  .shell.sb-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .35); }
  .shell.sb-open .sb-scrim { display: block; position: fixed; inset: 0; z-index: 110; background: rgba(0, 0, 0, .35); }
  .icon-btn.menu-btn { display: inline-flex; }
  .search-kbd { display: none; }
  .topbar { padding: 0 10px; gap: 8px; }
}
/* Phones: a tab bar at the bottom instead of the menu button and Create in the top bar. */
.bottom-nav { display: none; }
@media (max-width: 700px) {
  .shell { padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }
  .bottom-nav {
    display: flex; align-items: stretch; justify-content: space-around;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
    height: calc(60px + env(safe-area-inset-bottom, 0px)); padding: 0 4px env(safe-area-inset-bottom, 0px);
    background: var(--bg); border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(30, 31, 33, .06);
  }
  .bn-item {
    flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border: 0; background: none; font: inherit; font-size: 11px; font-weight: 500; color: var(--text-2);
    text-decoration: none !important; cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .bn-item.active { color: var(--primary); }
  .bn-icon { position: relative; display: inline-flex; }
  .bn-badge {
    position: absolute; top: -5px; left: 14px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
    background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
    border: 2px solid var(--bg);
  }
  .bn-create {
    flex: 0 0 50px; width: 50px; height: 50px; align-self: center; margin: 0 6px; border: 0; border-radius: 50%;
    background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
    box-shadow: 0 4px 14px rgba(240, 106, 106, .45); -webkit-tap-highlight-color: transparent;
  }
  .bn-create:active { transform: scale(.94); }
  .icon-btn.menu-btn, .topbar .create-btn { display: none !important; }
  /* "More": the whole menu as a sheet that slides up from the bottom */
  .sidebar {
    top: auto; bottom: 0; left: 0; right: 0; width: auto; max-height: min(84dvh, 680px);
    border-radius: 16px 16px 0 0; transform: translateY(105%);
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .sidebar::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--sb-line); margin: 0 auto 10px; flex-shrink: 0; }
  .shell.sb-open .sidebar { transform: none; }
  .shell.pane-open .bottom-nav { display: none; }
  .shell.pane-open { padding-bottom: 0; }
  /* While the on-screen keyboard is open (see app.js), give it the room. */
  .kb-open .bottom-nav { display: none; }
  .kb-open .shell { padding-bottom: 0; }
  .toasts { bottom: calc(74px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 560px) {
  .create-btn span { display: none; }
  .create-btn { padding: 0 9px !important; }
  .create-fields, .radio-cards { grid-template-columns: minmax(0, 1fr); }
  .date-picker { flex-direction: column; }
  .date-quick { width: auto; border-right: 0; border-bottom: 1px solid var(--border); flex-direction: row; flex-wrap: wrap; }
  .modal-backdrop { padding-top: 16px; }
}

/* ---- v1.21.8 phones: the top bar has the logo and name; search opens across it; nothing under the status bar */
.topbar-brand, .search-toggle, .search-cancel { display: none; }
@media (max-width: 700px) {
  /* Fixed to the top, with its own colour (the page behind is a shade different): iPhone Safari then paints the
     status bar in the bar's colour instead of blurring whatever is at the top of the page. */
  .topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 90; background: var(--bg);
    height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); padding-top: env(safe-area-inset-top, 0px); }
  .main { padding-top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); }
  body { background: var(--bg-2); }
  .view { background: var(--bg); }
  .topbar-brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none !important; font-weight: 700; font-size: 19px; letter-spacing: -.01em; min-width: 0; }
  .topbar-brand img { width: 28px; height: 28px; flex-shrink: 0; }
  .topbar-brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .search { display: none; }
  .search-toggle { display: inline-flex; }
  .topbar.searching .search { display: flex; flex: 1 1 auto; }
  .topbar.searching .search-cancel { display: inline-flex; }
  .topbar.searching .topbar-brand, .topbar.searching .search-toggle, .topbar.searching .spacer,
  .topbar.searching .ask-btn, .topbar.searching .avatar-btn { display: none !important; }
  .pane { padding-top: env(safe-area-inset-top, 0px); }
}
