/* ------------------------------------------------------------------ tokens */
:root {
  --bg: #ffffff;
  --bg-2: #fafafa;
  --bg-3: #f4f4f5;
  --line: #e5e7eb;
  --line-2: #d4d4d8;
  --text: #18181b;
  --text-2: #52525b;
  --text-3: #a1a1aa;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --today: #f1f5f9;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.08);
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --top-h: 48px;
  --strip-h: 40px;
  --side-w: 340px;
  --panel-w: 400px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font); font-size: 13px; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
input, textarea, select { outline: none; }
[hidden] { display: none !important; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------------ shared */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg);
  color: var(--text-2); font-weight: 500; white-space: nowrap;
}
.btn:hover { background: var(--bg-3); color: var(--text); }
.btn-primary { background: var(--text); color: #fff; border-color: var(--text); }
.btn-primary:hover { background: #000; color: #fff; }
.btn-ghost { border-color: transparent; }
.btn-icon { width: 28px; padding: 0; justify-content: center; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn.active { background: var(--text); color: #fff; border-color: var(--text); }
.btn-sm { height: 24px; padding: 0 8px; font-size: 12px; }

.check {
  width: 14px; height: 14px; border: 1.5px solid var(--line-2); border-radius: 4px; flex: none;
  display: inline-flex; align-items: center; justify-content: center; background: var(--bg);
  transition: background .1s, border-color .1s;
}
.check:hover { border-color: var(--text-2); }
.check.on { background: var(--text); border-color: var(--text); }
.check.on::after {
  content: ""; width: 4px; height: 7px; border: solid #fff; border-width: 0 1.5px 1.5px 0;
  transform: translateY(-1px) rotate(45deg);
}

.avatar {
  width: 20px; height: 20px; border-radius: 50%; color: #fff; font-size: 9px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; flex: none; letter-spacing: .3px;
}
.avatar.sm { width: 16px; height: 16px; font-size: 8px; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.pill {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px;
  border-radius: 10px; background: var(--bg-3); color: var(--text-2); font-size: 11px; font-weight: 500;
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.mono { font-family: var(--mono); font-size: 11px; }
.muted { color: var(--text-3); }
.field {
  height: 28px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); width: 100%;
}
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
textarea.field { height: auto; min-height: 60px; padding: 6px 8px; resize: vertical; }
.inline-input {
  width: 100%; border: 0; background: transparent; padding: 2px 0; font-size: 12px; color: var(--text);
}
.inline-input::placeholder { color: var(--text-3); }
kbd { font-family: var(--mono); font-size: 10px; padding: 1px 4px; border: 1px solid var(--line); border-radius: 3px; background: var(--bg-2); color: var(--text-3); }

/* ------------------------------------------------------------------ layout */
.app { display: grid; grid-template-rows: var(--top-h) var(--strip-h) 1fr; grid-template-columns: minmax(0, 1fr); height: 100vh; }
.app > * { min-width: 0; }   /* a long top bar or strip must never make the page wider than the window */
.topbar {
  display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; margin-right: 8px; }
.logo-mark { width: 16px; height: 16px; border-radius: 4px; background: var(--text); display: inline-block; position: relative; }
.logo-mark::after { content:""; position:absolute; left:4px; top:4px; width:8px; height:8px; border-radius:2px; background:#fff; }
.topbar .spacer { flex: 1; }
.month-nav { display: flex; align-items: center; gap: 2px; }
.month-nav .title { min-width: 150px; text-align: center; font-weight: 600; font-size: 14px; }
.view-switch { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.view-switch button { height: 26px; padding: 0 10px; color: var(--text-2); font-weight: 500; border-right: 1px solid var(--line); }
.view-switch button:last-child { border-right: 0; }
.view-switch button.active { background: var(--text); color: #fff; }
.people { display: flex; align-items: center; gap: 4px; min-width: 0; flex: 0 1 auto; overflow-x: auto; scrollbar-width: none; }
.people::-webkit-scrollbar { display: none; }
.people button { flex: none; }
.topbar > :not(.people):not(.spacer) { flex-shrink: 0; }
.people button {
  height: 26px; padding: 0 8px 0 4px; border-radius: 13px; display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-2); font-weight: 500; border: 1px solid transparent;
}
.people button:hover { background: var(--bg-3); }
.people button.active { background: var(--text); color: #fff; }
.people button.all { padding: 0 10px; }

/* sprint strip */
.strip {
  display: flex; align-items: center; gap: 14px; padding: 0 12px; border-bottom: 1px solid var(--line);
  background: var(--bg-2); font-size: 12px; color: var(--text-2); overflow-x: auto;
}
.strip b { color: var(--text); font-weight: 600; }
.strip .sep { width: 1px; height: 16px; background: var(--line); }
.strip .meter { display: inline-flex; align-items: center; gap: 8px; }
.bar { width: 80px; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--text); }
.strip .mem { display: inline-flex; align-items: center; gap: 4px; }

.main { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 0; }
.side { grid-column: 1; }
.cal, .tablev, .prodv, .boardv { grid-column: 2; }
.main.side-collapsed { grid-template-columns: 0 1fr; }

/* ------------------------------------------------------------------ side: project table */
.side { border-right: 1px solid var(--line); overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.main.side-collapsed .side { border-right: 0; }
.side-head { display: flex; align-items: center; gap: 6px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--line); }
.side-head h2 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--text-2); margin: 0; flex: 1; }
.side-body { overflow-y: auto; flex: 1; padding-bottom: 40px; }

.proj { border-bottom: 1px solid var(--line); }
.proj-head {
  display: grid; grid-template-columns: 16px 10px 1fr auto; align-items: center; gap: 8px;
  padding: 8px 10px 8px 8px; cursor: pointer; position: relative;
}
.proj-head:hover { background: var(--bg-2); }
.chev { width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-3); transition: transform .12s; }
.proj.open .chev { transform: rotate(90deg); }
.proj-name { font-weight: 600; display: flex; align-items: center; gap: 6px; min-width: 0; }
.proj-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-code { font-family: var(--mono); font-size: 10px; color: var(--text-3); }
.proj-meta { display: flex; align-items: center; gap: 6px; }
.avatars { display: inline-flex; }
.avatars .avatar { margin-left: -5px; border: 1.5px solid #fff; }
.avatars .avatar:first-child { margin-left: 0; }
.proj-now { padding: 0 10px 8px 34px; font-size: 11px; color: var(--text-2); display: flex; flex-direction: column; gap: 3px; }
.proj-now .now-row { display: flex; align-items: center; gap: 6px; }
.proj-now .now-row .dot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); width: 6px; height: 6px; }
.proj-body { display: none; padding: 0 0 6px; }
.proj.open .proj-body { display: block; }

.trow {
  display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 8px;
  padding: 4px 10px 4px 34px; min-height: 28px; cursor: grab; position: relative;
}
.trow.sub { padding-left: 56px; }
.trow:hover { background: var(--bg-2); }
.trow.sel { background: var(--accent-soft); }
.trow.dim { opacity: .4; }
.trow .ttl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow.done .ttl { color: var(--text-3); text-decoration: line-through; }
.trow .right { display: inline-flex; align-items: center; gap: 5px; color: var(--text-3); font-size: 11px; }
.trow .now-dot { width: 6px; height: 6px; background: var(--accent); }
.trow .subcount { font-family: var(--mono); font-size: 10px; }
.trow .date { font-size: 10px; font-family: var(--mono); }
.trow .date.overdue { color: var(--danger); }
.trow.dragging { opacity: .4; }
.add-row { padding: 2px 10px 2px 34px; }
.add-row.sub { padding-left: 56px; }
.add-row .inline-input { padding: 4px 0; }
.side-empty { padding: 30px 20px; color: var(--text-3); text-align: center; line-height: 1.6; }

/* ------------------------------------------------------------------ calendar */
.cal { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.cal-head { display: grid; grid-template-columns: 200px repeat(7, 1fr); border-bottom: 1px solid var(--line); }
.cal.no-goals .cal-head, .cal.no-goals .week { grid-template-columns: repeat(7, 1fr); }
.cal.no-goals .goals, .cal.no-goals .cal-head > div:first-child { display: none; }
.cal-head div {
  padding: 6px 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-3); border-right: 1px solid var(--line);
}
.cal-head div:last-child { border-right: 0; }
.cal-head div.weekend { color: var(--text-3); background: var(--bg-2); }
.cal-body { flex: 1; overflow-y: auto; display: grid; grid-auto-rows: minmax(140px, 1fr); }
.week { display: grid; grid-template-columns: 200px repeat(7, 1fr); border-bottom: 1px solid var(--line); min-height: 140px; }
.week.sprint-start { border-top: 2px solid var(--text); }
.week:last-child { border-bottom: 0; }

.day, .goals { border-right: 1px solid var(--line); padding: 4px 6px 6px; min-width: 0; position: relative; display: flex; flex-direction: column; }
.day:last-child { border-right: 0; }
.day.other { background: var(--bg-2); }
.day.other .dnum { color: var(--text-3); }
.day.weekend { background: var(--bg-2); }
.day.today { background: var(--today); }
.day.drop { background: var(--accent-soft); outline: 1px dashed var(--accent); outline-offset: -2px; }
.dhead { display: flex; align-items: center; justify-content: space-between; height: 22px; }
.dnum { font-size: 12px; font-weight: 500; color: var(--text-2); width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.day.today .dnum { background: var(--text); color: #fff; font-weight: 600; }
.dadd { opacity: 0; width: 20px; height: 20px; border-radius: 4px; color: var(--text-3); display: inline-flex; align-items: center; justify-content: center; font-size: 16px; line-height: 1; }
.day:hover .dadd { opacity: 1; }
.dadd:hover { background: var(--line); color: var(--text); }
.dtasks { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.task {
  display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 6px;
  padding: 3px 5px; border-radius: 4px; cursor: grab; font-size: 12px; line-height: 1.3;
  border: 1px solid transparent; background: var(--bg);
}
.day.other .task, .day.weekend .task, .day.today .task { background: var(--bg); border-color: var(--line); }
.task:hover { border-color: var(--line-2); box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.task.sel { border-color: var(--accent); background: var(--accent-soft); }
.task.dragging { opacity: .35; }
.task .ttl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task.done .ttl { color: var(--text-3); text-decoration: line-through; }
.task .proj-tag { width: 3px; height: 14px; border-radius: 2px; }
.task .meta { display: inline-flex; align-items: center; gap: 4px; }
.task .meta .pc { font-size: 10px; color: var(--text-3); font-family: var(--mono); }
.task.high .ttl::before { content: "!"; color: var(--warn); font-weight: 700; margin-right: 4px; }
.task.overdue { border-color: #fecaca; background: var(--danger-soft); }
.task.overdue .ttl { color: var(--danger); }
.task.sub-task .ttl { color: var(--text-2); }
.task.sub-task .ttl::after { content: attr(data-parent); color: var(--text-3); font-size: 10px; margin-left: 5px; }
.day .add-input { margin-top: 2px; padding: 3px 5px; border: 1px solid var(--accent); border-radius: 4px; background: var(--bg); }
.more { font-size: 11px; color: var(--text-3); padding: 2px 5px; }

/* week goals column */
.goals { background: var(--bg-2); gap: 4px; }
.goals .ghead { display: flex; align-items: center; justify-content: space-between; height: 22px; font-size: 10px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; color: var(--text-3); }
.goals .ghead .wk { font-family: var(--mono); }
.goals .gadd { opacity: 0; font-size: 15px; width: 20px; height: 20px; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-3); }
.goals:hover .gadd { opacity: 1; }
.goals .gadd:hover { background: var(--line); color: var(--text); }
.goal { display: grid; grid-template-columns: 14px 1fr auto; gap: 6px; align-items: center; padding: 2px 3px; border-radius: 4px; font-size: 12px; }
.goal:hover { background: var(--bg-3); }
.goal.met .gt { color: var(--text-3); text-decoration: line-through; }
.goal .gt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: text; }
.goal .gt:focus { outline: none; white-space: normal; }
.goal .gdel { opacity: 0; color: var(--text-3); font-size: 14px; line-height: 1; }
.goal:hover .gdel { opacity: 1; }
.goal .gdel:hover { color: var(--danger); }
.gsec { font-size: 10px; color: var(--text-3); font-weight: 600; margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.gsec:first-of-type { margin-top: 0; }
.gscore { margin-left: auto; font-family: var(--mono); font-weight: 500; }
.gscore.full { color: var(--ok); }

/* ------------------------------------------------------------------ table view */
.tablev { overflow: auto; }
.tablev table { width: 100%; border-collapse: collapse; font-size: 12px; }
.tablev th { position: sticky; top: 0; background: var(--bg); text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-3); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tablev td { padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.tablev tr:hover td { background: var(--bg-2); }
.tablev tr.done td { color: var(--text-3); }
.tablev td.ttl { white-space: normal; min-width: 240px; cursor: pointer; }
.tablev td.ttl:hover { color: var(--accent); }
.tablev .pth { color: var(--text-3); }
.tablev .filters { display: flex; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); align-items: center; }

/* ------------------------------------------------------------------ products view */
.prodv { overflow: auto; min-width: 0; }
.pbar { display: flex; align-items: center; gap: 6px; white-space: nowrap; padding: 8px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 2; }
.ptab { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: var(--radius); color: var(--text-2); font-weight: 500; }
.ptab:hover { background: var(--bg-3); }
.ptab.active { background: var(--text); color: #fff; }
.ptab.active .pill { background: rgba(255,255,255,.2); color: #fff; }
.ptable { width: 100%; border-collapse: collapse; font-size: 12px; }
.ptable th { position: sticky; top: 45px; background: var(--bg); text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-3); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.ptable td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.ptable tr:hover td { background: var(--bg-2); }
.ptable tr.clickrow { cursor: pointer; }
.code-chip { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 4px; color: #fff; font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .3px; }
.serial { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--text); padding: 2px 6px; border-radius: 4px; background: var(--bg-3); cursor: pointer; letter-spacing: .2px; }
.serial:hover { background: var(--accent-soft); color: var(--accent); }
.serial.sm { font-size: 11px; font-weight: 500; }
.serial.big { display: block; font-family: var(--mono); font-size: 17px; font-weight: 600; letter-spacing: .5px; padding: 10px; text-align: center; background: var(--bg-3); border-radius: var(--radius); cursor: default; }
.serial-preview { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; background: var(--bg-2); }
.serial-preview .parts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 8px; }
.serial-preview .part { display: inline-flex; flex-direction: column; align-items: center; padding: 3px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg); }
.serial-preview .part b { font-family: var(--mono); font-size: 11px; }
.serial-preview .part i { font-style: normal; font-size: 9px; color: var(--text-3); text-transform: uppercase; letter-spacing: .4px; }
.mini-sel { border: 1px solid transparent; background: transparent; border-radius: 4px; padding: 2px 4px; font-size: 12px; color: var(--text); }
.mini-sel:hover { border-color: var(--line); background: var(--bg); }
.mini-input { border: 1px solid transparent; background: transparent; border-radius: 4px; padding: 3px 5px; font-size: 12px; width: 100%; min-width: 60px; color: var(--text); }
.mini-input:hover { border-color: var(--line); background: var(--bg); }
.mini-input:focus { border-color: var(--accent); background: var(--bg); outline: none; }
.urow { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 3px 0; border-bottom: 1px solid var(--line); }

/* AI namer */
.ai-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; background: var(--bg-2); }
.ai-out { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.ai-out:empty { display: none; }
.ai-chip { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 5px 9px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); text-align: left; }
.ai-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.ai-chip b { font-family: var(--mono); font-size: 11px; color: var(--text); }
.ai-chip span { font-size: 11px; color: var(--text-2); }
.chip.mono { font-family: var(--mono); font-size: 10px; height: 20px; padding: 0 6px; }

/* ------------------------------------------------------------------ track board */
.boardv { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.bbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--bg); flex: none; white-space: nowrap; }
.bbar > b { font-size: 16px; }
.bbar .sep { width: 1px; height: 16px; background: var(--line); }

.bstrip { flex: 1; display: flex; align-items: flex-start; gap: 12px; padding: 14px 12px 20px; overflow-x: auto; overflow-y: hidden; }
.bcol {
  flex: 0 0 300px; display: flex; flex-direction: column;
  height: calc(100vh - var(--top-h) - var(--strip-h) - 78px);
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.bcol.dragging { opacity: .4; }
.bcol.over { border-color: var(--accent); }
.bcol.done { opacity: .55; }
.bcol.done .btitle { text-decoration: line-through; }

.bhead { padding: 10px 10px 8px; border-top: 3px solid var(--accent); border-radius: 8px 8px 0 0; border-bottom: 1px solid var(--line); flex: none; }
.brow1 { display: grid; grid-template-columns: 14px 1fr 20px; gap: 8px; align-items: start; }
.btitle { font-weight: 600; font-size: 13px; line-height: 1.35; word-break: break-word; cursor: text; border-radius: 3px; }
.btitle:focus { outline: none; background: var(--accent-soft); }
.bmenu { width: 20px; height: 20px; border-radius: 4px; color: var(--text-3); line-height: 1; }
.bmenu:hover { background: var(--bg-3); color: var(--text); }
.bmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 7px; }
.btag { font-size: 10px; padding: 1px 6px; border-radius: 9px; font-weight: 500; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bwhen { font-size: 11px; color: var(--text-2); }
.bwhen.stale { color: var(--warn); font-weight: 500; }
.bdays { font-size: 10px; font-family: var(--mono); color: var(--text-3); margin-left: auto; }

.bnotes { flex: 1; overflow-y: auto; padding: 8px 10px; min-height: 0; }
.bdate { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text-3); margin: 8px 0 3px; }
.bdate:first-child { margin-top: 0; }
.bnote { display: grid; grid-template-columns: 1fr 16px; gap: 4px; align-items: start; padding: 2px 0; }
.bnote-body { font-size: 12px; line-height: 1.5; color: var(--text); word-break: break-word; border-radius: 3px; padding: 1px 3px; cursor: text; }
.bnote-body:focus { outline: none; background: var(--accent-soft); }
.bnote-body::before { content: "·"; color: var(--text-3); margin-right: 5px; }
.bnote-del { opacity: 0; color: var(--text-3); font-size: 14px; line-height: 1; }
.bnote:hover .bnote-del { opacity: 1; }
.bnote-del:hover { color: var(--danger); }
.bempty { font-size: 11px; color: var(--text-3); line-height: 1.6; padding: 6px 2px; }

.bfoot { flex: none; border-top: 1px solid var(--line); padding: 7px 8px; }
.badd { width: 100%; border: 0; background: transparent; font-size: 12px; line-height: 1.5; resize: none; color: var(--text); font-family: inherit; }
.badd::placeholder { color: var(--text-3); }
.badd:focus { outline: none; }

.bcol.bnew { border-style: dashed; background: var(--bg-2); cursor: pointer; align-items: stretch; box-shadow: none; }
.bcol.bnew:hover { border-color: var(--accent); background: var(--accent-soft); }
.bnew-inner { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--text-3); font-size: 12px; }

.bnew .plus { font-size: 22px; line-height: 1; }

/* column options popover */
.cmenu-back { position: fixed; inset: 0; z-index: 40; }
.cmenu { position: fixed; z-index: 41; width: 230px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.cmrow { display: flex; align-items: center; gap: 8px; }
.cmrow label { font-size: 11px; color: var(--text-3); width: 52px; flex: none; }

/* ------------------------------------------------------------------ right sliding panel */
.panel {
  position: fixed; top: var(--top-h); right: 0; bottom: 0; width: var(--panel-w); background: var(--bg);
  border-left: 1px solid var(--line); box-shadow: var(--shadow); transform: translateX(100%);
  transition: transform .18s ease; display: flex; flex-direction: column; z-index: 20;
}
.panel.open { transform: translateX(0); }
/* wider screens: an open panel pushes the board over instead of covering it */
@media (min-width: 761px) {
  .main, .strip { transition: margin-right .18s ease; }
  body:has(.panel.open) .main, body:has(.panel.open) .strip { margin-right: var(--panel-w); }
}
.panel-head { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.panel-head .crumb { flex: 1; font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-body { flex: 1; overflow-y: auto; padding: 14px 16px 30px; }
.panel-title { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.panel-title .check { margin-top: 5px; width: 18px; height: 18px; }
.panel-title textarea {
  flex: 1; border: 0; font-size: 17px; font-weight: 600; resize: none; line-height: 1.35; padding: 0; background: transparent; overflow: hidden;
}
.props { display: grid; grid-template-columns: 90px 1fr; gap: 6px 10px; align-items: center; margin-bottom: 16px; }
.props label { font-size: 12px; color: var(--text-3); }
.props select, .props input { height: 26px; }
.row { display: flex; align-items: center; }
.props .row { display: flex; gap: 6px; align-items: center; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); cursor: pointer; user-select: none; }
.toggle .sw { width: 28px; height: 16px; border-radius: 8px; background: var(--line-2); position: relative; transition: background .12s; }
.toggle .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: left .12s; }
.toggle.on .sw { background: var(--accent); }
.toggle.on .sw::after { left: 14px; }
.section { margin-top: 18px; }
.section h4 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-3); font-weight: 600; display: flex; align-items: center; }
.section h4 .count { margin-left: 6px; font-family: var(--mono); font-weight: 500; }
.subs .trow { padding-left: 4px; cursor: pointer; border-radius: 4px; }
.subs .add-row { padding-left: 4px; }
.comment { padding: 8px 0; border-bottom: 1px solid var(--line); }
.comment .who { font-size: 11px; color: var(--text-3); display: flex; gap: 6px; margin-bottom: 2px; }
.comment .who b { color: var(--text-2); font-weight: 600; }
.comment .cdel { margin-left: auto; opacity: 0; color: var(--text-3); }
.comment:hover .cdel { opacity: 1; }
.comment .body { white-space: pre-wrap; line-height: 1.45; }
.comment-box { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.comment-box .actions { display: flex; justify-content: flex-end; gap: 6px; }
.panel-foot { display: flex; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--line); }

/* project description table */
.dtable { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.drow { display: grid; grid-template-columns: 120px 1fr 24px; align-items: stretch; border-bottom: 1px solid var(--line); }
.drow:last-of-type { border-bottom: 0; }
.drow.new { background: var(--bg-2); }
.dcell { border: 0; background: transparent; padding: 6px 8px; font-size: 12px; min-width: 0; }
.dcell:focus { background: var(--accent-soft); outline: none; }
.dlabel { border-right: 1px solid var(--line); color: var(--text-2); font-weight: 500; }
.dvalue { color: var(--text); }
.ddel { opacity: 0; color: var(--text-3); font-size: 15px; line-height: 1; }
.drow:hover .ddel { opacity: 1; }
.ddel:hover { color: var(--danger); }
.dsuggest { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border-top: 1px solid var(--line); background: var(--bg-2); }
.dsuggest .chip { height: 22px; padding: 0 8px; font-size: 11px; }

/* member chips (project editor) */
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px 0 3px; border: 1px solid var(--line); border-radius: 12px; font-size: 12px; color: var(--text-2); }
.chip:hover { background: var(--bg-3); }
.chip.on { background: var(--text); color: #fff; border-color: var(--text); }
.swatches { display: flex; gap: 4px; }
.swatch { width: 18px; height: 18px; border-radius: 50%; border: 2px solid transparent; }
.swatch.on { border-color: var(--text); }

/* ------------------------------------------------------------------ modal (settings) */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 30; display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.modal { background: var(--bg); width: 440px; border-radius: 10px; box-shadow: var(--shadow); padding: 18px 20px; }
.modal h3 { margin: 0 0 12px; font-size: 15px; }
.modal .props { grid-template-columns: 130px 1fr; }
.modal .foot { display: flex; justify-content: flex-end; gap: 6px; margin-top: 12px; }
.modal.wide { width: 620px; max-height: 82vh; overflow-y: auto; }
.modal .shead { margin: 0 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-3); font-weight: 600; }
.member-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.member-list .mrow { display: grid; grid-template-columns: 24px 1.1fr 50px 1.4fr 52px; gap: 8px; align-items: center; }
.member-list .mrow input { height: 26px; }
.member-list .mhead { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-3); font-weight: 600; }
.member-list .mhead span:nth-child(3) { text-align: center; }
.member-list .add { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 2px; }
.member-list .avatar { border: 0; }

/* ------------------------------------------------------------------ toast */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--text); color: #fff; padding: 8px 14px; border-radius: 6px; font-size: 12px; z-index: 50; opacity: 0; transition: opacity .15s; pointer-events: none; }
.toast.show { opacity: 1; }

/* ------------------------------------------------------------------ login */
.login-body { display: flex; align-items: center; justify-content: center; height: 100vh; background: var(--bg-2); }
.login-card { width: 320px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.login-logo { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; margin-bottom: 8px; }
.login-label { font-size: 12px; color: var(--text-2); }
.login-input { height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.login-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.login-error { color: var(--danger); font-size: 12px; }
.login-btn { height: 34px; justify-content: center; margin-top: 6px; }

@media (max-width: 1100px) {
  :root { --side-w: 280px; --panel-w: 360px; }
  .cal-head, .week { grid-template-columns: 160px repeat(7, 1fr); }
}

/* ---------------------------------------------------------------- project history */
.vtop { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.vtop h4 { margin: 0; }
.vsum { font-size: 12px; color: var(--text-2); margin: 2px 0 8px; }
.vsum b { color: var(--text); font-weight: 600; }

.vcard { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 6px; background: var(--bg-1); }
.vcard.open { background: var(--bg-2); border-color: var(--line-2, var(--line)); }
.vhead { display: flex; align-items: center; gap: 8px; padding: 8px 10px; cursor: pointer; }
.vhead:hover { background: var(--bg-2); border-radius: var(--radius); }
.vcaret { color: var(--text-3, var(--text-2)); font-size: 10px; width: 10px; }
.vwhen { font-size: 12px; font-weight: 600; }
.vdays { font-size: 11px; color: var(--text-2); background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; }
.vwho { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.vgist { padding: 0 10px 8px 28px; font-size: 12px; color: var(--text-2); }

.vdates { display: grid; grid-template-columns: 44px 1fr 28px 1fr; gap: 6px; align-items: center; padding: 0 10px 8px; }
.vdates label { font-size: 11px; color: var(--text-2); }
.vfield { padding: 0 10px 8px; }
.vfield > label { display: block; font-size: 11px; color: var(--text-2); margin-bottom: 4px; }
.vfield .chips { margin-bottom: 6px; }
.vfoot { padding: 0 10px 10px; }

/* ---------------------------------------------------------------- history view */
.row-btns { display: flex; gap: 6px; }
.vnotes { margin-left: 8px; color: var(--accent, #2563eb); font-size: 11px; }

.histv { grid-column: 2; min-width: 0; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.hempty { padding: 60px 24px; text-align: center; color: var(--text-2); }
.hempty h3 { margin: 0 0 8px; font-size: 15px; color: var(--text); }
.hempty p { margin: 2px 0; font-size: 13px; }

.hwin { flex: 1; display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 0; min-width: 0; }
.hrail { border-right: 1px solid var(--line); overflow-y: auto; }
.hrail-h { position: sticky; top: 0; z-index: 1; background: var(--bg-2); border-bottom: 1px solid var(--line);
           padding: 7px 12px; font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-2); }
.htrip { display: block; width: 100%; text-align: left; border: 0; background: none; font: inherit;
         padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--line);
         border-left: 2px solid transparent; color: var(--text); }
.htrip:hover { background: var(--bg-2); }
.htrip.on { background: var(--bg-2); border-left-color: var(--accent, #2563eb); }
.htrip .t1 { font-size: 12.5px; font-weight: 600; }
.htrip .t2 { font-size: 11px; color: var(--text-2); margin-top: 1px; }
.htrip .t3 { font-size: 11px; color: var(--text-3, var(--text-2)); margin-top: 2px;
             overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .85; }

.hdetail { max-width: 100%; overflow-x: hidden; overflow-y: auto; padding: 14px 18px 24px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.hdetail > * { max-width: 1120px; }
.hd-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hd-top h3 { margin: 0; font-size: 15px; font-weight: 600; }
.hd-top .days { font-size: 11px; color: var(--text-2); background: var(--bg-2);
                border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }
.hwho { display: flex; align-items: center; gap: 3px; }
.hdates { display: grid; grid-template-columns: 44px 160px 28px 160px; gap: 8px; align-items: center; }
.hdates label { font-size: 11px; color: var(--text-2); }
.hfield > label { display: block; font-size: 10px; letter-spacing: .07em; text-transform: uppercase;
                  color: var(--text-2); margin-bottom: 5px; }
.hfield .chips { margin-bottom: 6px; }

.hq { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.qbox { border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 11px; background: var(--bg-2); }
.qbox > label { display: block; font-size: 10px; letter-spacing: .07em; text-transform: uppercase;
                color: var(--text-2); margin-bottom: 5px; }
.qbox.mid { border-left: 2px solid #b45309; }
.qbox.hard { border-left: 2px solid #7c3aed; }

.hstream { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.hst-h { display: flex; align-items: center; gap: 7px; padding: 7px 11px; background: var(--bg-2);
         border-bottom: 1px solid var(--line); font-size: 10px; letter-spacing: .07em;
         text-transform: uppercase; color: var(--text-2); }
.hev { display: grid; grid-template-columns: 62px 1fr 22px; gap: 9px; padding: 8px 11px;
       border-bottom: 1px solid var(--line); font-size: 12.5px; align-items: start; }
.hev:last-of-type { border-bottom: 0; }
.hev time { font-size: 11px; color: var(--text-2); padding-top: 1px; }
.hev p { margin: 0; color: var(--text); }
.hev.empty p { color: var(--text-2); font-style: italic; }
.hev .ddel { opacity: 0; }
.hev:hover .ddel { opacity: 1; }
.kind { display: inline-block; font-size: 9.5px; font-weight: 600; letter-spacing: .04em;
        text-transform: uppercase; border-radius: 3px; padding: 0 5px; margin-right: 6px; vertical-align: 1px; }
.kind.change { background: #fef3c7; color: #92400e; }
.kind.problem { background: #ede9fe; color: #5b21b6; }
.kind.done { background: #dcfce7; color: #166534; }
.haddrow { display: flex; gap: 6px; padding: 8px 11px; border-top: 1px solid var(--line); background: var(--bg-2); }
.haddrow .field { flex: 1; }
.hfoot { padding-top: 2px; }

@media (max-width: 860px) { .hwin { grid-template-columns: 1fr; } .hrail { max-height: 180px; } }

.histv .bbar { flex-wrap: wrap; }

/* ---------------------------------------------------------------- logins & my day */
.whoami { font-size: 12px; color: var(--text-2); margin-right: 6px; white-space: nowrap; }
.login-hint { margin-top: 12px; font-size: 11.5px; color: var(--text-2); line-height: 1.5; }
.pwbox { display: flex; gap: 6px; flex-wrap: wrap; }
.pwbox .field { width: 150px; }

body.is-member .proj-head .btn-icon,
body.is-member .add-task,
body.is-member .goal-edit { display: none !important; }

.dayv { grid-column: 2; min-width: 0; display: flex; flex-direction: column; overflow-y: auto; }
.bbar.sub { border-top: 0; }
.daysheet { padding: 12px 18px 26px; max-width: 900px; display: flex; flex-direction: column; gap: 14px; }
.daysheet .section h4 { margin: 0 0 6px; }

.dlines { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.dline { display: grid; grid-template-columns: 190px 1fr 58px 22px; gap: 10px; align-items: center;
         padding: 7px 10px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.dline:last-child { border-bottom: 0; }
.dline.empty { display: block; color: var(--text-2); font-style: italic; }
.dl-task { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-hrs { text-align: right; color: var(--text-2); font-size: 11.5px; }
.dline .ddel { opacity: 0; }
.dline:hover .ddel { opacity: 1; }
.daddrow { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.daddrow .field:nth-child(2) { flex: 1; min-width: 180px; }

.dassigned { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.darow { display: flex; align-items: center; gap: 8px; padding: 7px 10px;
         border-bottom: 1px solid var(--line); font-size: 12.5px; }
.darow:last-child { border-bottom: 0; }
.darow.done span { text-decoration: line-through; color: var(--text-2); }
.darow .muted { margin-left: auto; }

.dmissing { display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
            padding: 8px 18px; border-bottom: 1px solid var(--line); background: #fff7ed; }
.dmissing b { font-size: 12px; color: #9a3412; }
.dmissing .chip { cursor: pointer; }

.dgrid { display: grid; gap: 10px; padding: 12px 18px 26px;
         grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.dcard { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-1); overflow: hidden; }
.dcard.blank { border-style: dashed; }
.dc-head { display: flex; align-items: center; gap: 7px; padding: 8px 10px;
           border-bottom: 1px solid var(--line); cursor: pointer; font-size: 12.5px; }
.dc-head:hover { background: var(--bg-2); }
.dc-head .days { font-size: 11px; color: var(--text-2); background: var(--bg-2);
                 border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; }
.nope { font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
        color: #9a3412; background: #ffedd5; border-radius: 3px; padding: 1px 5px; }
.dc-body { display: grid; grid-template-columns: 1fr 1fr; }
.dc-col { padding: 8px 10px; min-width: 0; }
.dc-col + .dc-col { border-left: 1px solid var(--line); }
.dc-col > label { display: block; font-size: 10px; letter-spacing: .07em; text-transform: uppercase;
                  color: var(--text-2); margin-bottom: 4px; }
.mini { font-size: 12px; line-height: 1.45; margin-bottom: 3px; }
.mini.done { text-decoration: line-through; color: var(--text-2); }
.dc-note { padding: 7px 10px; border-top: 1px solid var(--line); background: var(--bg-2);
           font-size: 12px; color: var(--text-2); }
.login-list .mrow { display: grid; grid-template-columns: 150px 1fr 1fr 130px; gap: 8px;
                    align-items: center; margin-bottom: 5px; }
.login-list .mrow input { height: 26px; }
.login-list .mhead { font-size: 10px; text-transform: uppercase; letter-spacing: .5px;
                     color: var(--text-3); font-weight: 600; margin-bottom: 4px; }
.login-list .mname { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.view-switch button { white-space: nowrap; }
.dayv .bbar { flex-wrap: wrap; }

.pwcell { display: flex; gap: 4px; align-items: center; }
.pwcell .field { flex: 1; min-width: 0; }
.pwnow { display: flex; align-items: center; }
.pwnow code { font-size: 11.5px; background: var(--bg-2); border: 1px solid var(--line);
              border-radius: 4px; padding: 1px 6px; user-select: all; }
.pwall { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 8px;
         padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); }
.pwall code { font-size: 11.5px; background: var(--bg-1); border: 1px solid var(--line);
              border-radius: 4px; padding: 1px 5px; }

/* ================================================================== responsive
   ≥1101px desktop (unchanged) · 761–1100px tablet · ≤760px phone            */
.dname { display: none; }

/* touch screens: hover-only buttons are always visible, tick boxes are bigger */
@media (hover: none) {
  .dadd, .goals .gadd, .goal .gdel, .comment .cdel, .ddel, .dline .ddel, .hev .ddel { opacity: 1; }
  .check { width: 18px; height: 18px; }
  .check.on::after { width: 5px; height: 9px; }
}

/* ---------------- tablet */
@media (max-width: 1100px) {
  .topbar { overflow-x: auto; scrollbar-width: none; }
  .topbar::-webkit-scrollbar { display: none; }
  .topbar > * { flex-shrink: 0; }            /* scroll the bar sideways instead of crushing it */
  .month-nav .title { min-width: 120px; }
  .whoami { display: none; }
  .modal.wide { width: min(620px, calc(100vw - 24px)); }
}

/* closed panel is parked off-screen; hide it so phones don't widen the page to reach it */
.panel:not(.open) { visibility: hidden; transition: transform .18s ease, visibility 0s .18s; }

/* ---------------- tablet portrait: narrower project list and goals column */
@media (max-width: 900px) {
  :root { --side-w: 240px; }
  .cal-head, .week { grid-template-columns: 110px repeat(7, minmax(0, 1fr)); }
  .task { grid-template-columns: 14px minmax(0, 1fr); }
  .task .meta { display: none; }
  .task .ttl { white-space: normal; overflow-wrap: break-word; line-height: 1.3; }
}

/* ---------------- phone */
@media (max-width: 760px) {
  html, body { overflow-x: hidden; max-width: 100vw; }
  body { font-size: 14px; }
  .app { grid-template-rows: auto auto 1fr; grid-template-columns: minmax(0, 1fr); height: 100vh; height: 100dvh; }
  .app > * { min-width: 0; }

  /* top bar: two rows — logo + actions, then the view tabs and month */
  .topbar { flex-wrap: wrap; gap: 6px; padding: 6px 8px; overflow: visible; }
  .logo { margin-right: auto; }
  .topbar .spacer { display: none; }
  .view-switch { order: 10; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .view-switch::-webkit-scrollbar { display: none; }
  .view-switch button { flex: 1 0 auto; height: 32px; }
  .month-nav { order: 11; width: 100%; justify-content: space-between; }
  .month-nav[style*="hidden"] { display: none; }
  .people { order: 12; width: 100%; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .people::-webkit-scrollbar { display: none; }
  .people button { flex: none; }
  .btn { height: 32px; }
  .btn-icon { width: 32px; }
  .btn-sm { height: 28px; }
  .field, .props select, .props input { height: 34px; font-size: 16px; }   /* 16px stops iOS zooming in */
  textarea.field, .inline-input, .badd { font-size: 16px; }

  .strip { gap: 10px; padding: 6px 8px; min-height: 36px; white-space: nowrap; }

  /* one column; the project list slides in from the left */
  .main, .main.side-collapsed { grid-template-columns: 1fr; position: relative; }
  .cal, .tablev, .prodv, .boardv, .histv, .dayv { grid-column: 1; }
  .side {
    position: fixed; z-index: 25; top: 0; bottom: 0; left: 0; width: min(88vw, 360px);
    background: var(--bg); box-shadow: var(--shadow); transform: translateX(0); transition: transform .18s ease;
  }
  .main.side-collapsed .side { transform: translateX(-105%); box-shadow: none; }
  .main:not(.side-collapsed)::after {
    content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 24;
  }
  .trow, .proj-head { min-height: 38px; }

  /* calendar becomes a list of days, one week after another */
  .cal-head { display: none; }
  .cal-body { display: block; }
  .week, .cal.no-goals .week { display: flex; flex-direction: column; min-height: 0; }
  .day, .goals { border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 12px; min-height: 52px; }
  .day.other { display: none; }
  .goals { min-height: 0; }
  .dhead { justify-content: flex-start; gap: 8px; height: 28px; }
  .dname { display: inline; font-size: 12px; font-weight: 600; color: var(--text-2); }
  .dadd { margin-left: auto; width: 32px; height: 28px; font-size: 20px; }
  .dnum { width: 26px; height: 26px; }
  .task { padding: 6px 8px; min-height: 36px; }
  .task .ttl { white-space: normal; }

  /* side panel and dialogs use the whole screen */
  .panel { top: 0; width: 100%; z-index: 40; }
  .panel-body { padding: 12px 14px 30px; }
  .props { grid-template-columns: 96px minmax(0, 1fr); }
  .backdrop { padding: 0; align-items: stretch; z-index: 45; }
  .modal, .modal.wide { width: 100%; max-height: none; min-height: 100%; border-radius: 0; padding: 16px 14px 28px; overflow-y: auto; }
  .modal .props { grid-template-columns: 1fr; }
  .modal .foot { position: sticky; bottom: -28px; background: var(--bg); padding: 10px 0 12px; border-top: 1px solid var(--line); }
  .member-list .mrow { grid-template-columns: 24px 1fr 52px 40px; row-gap: 4px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
  .member-list .mrow > :nth-child(4) { grid-column: 2 / 4; grid-row: 2; }
  .member-list .mrow > :nth-child(5) { grid-column: 4; grid-row: 1; }
  .member-list .mhead { display: none; }
  .login-list .mrow { grid-template-columns: 1fr 1fr; }
  .login-list .mhead { display: none; }

  /* table, products: scroll sideways inside the view, filters wrap */
  .tablev .filters, .pbar { flex-wrap: wrap; overflow-x: auto; }
  .tablev td.ttl { min-width: 180px; }

  /* board: one card per screen width, swipe between them */
  .bbar { flex-wrap: wrap; white-space: normal; }
  .bbar .muted { display: none; }
  .bstrip { scroll-snap-type: x mandatory; padding: 10px 8px 16px; }
  .bcol { flex: 0 0 calc(100vw - 32px); scroll-snap-align: center; height: calc(100dvh - 210px); }

  /* my day + trips */
  .daysheet, .dgrid { padding: 10px 12px 24px; }
  .dline { grid-template-columns: 1fr 50px 28px; }
  .dl-task { grid-column: 1 / -1; }
  .dgrid { grid-template-columns: 1fr; }
  .dc-body { grid-template-columns: 1fr; }
  .dc-col + .dc-col { border-left: 0; border-top: 1px solid var(--line); }
  .hwin { grid-template-columns: 1fr; }
  .hrail { max-height: 180px; border-right: 0; border-bottom: 1px solid var(--line); }
  .hdates, .vdates { grid-template-columns: 44px 1fr; }
  .drow { grid-template-columns: 100px 1fr 28px; }

  .toast { left: 12px; right: 12px; transform: none; text-align: center; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .login-card { width: calc(100vw - 32px); max-width: 360px; }
}


/* ================================================================== my tasks, profile, admin */
.me-link { display: inline-flex; border-radius: 50%; padding: 2px; border: 2px solid transparent; flex-shrink: 0; }
.me-link .avatar { width: 26px; height: 26px; font-size: 10px; }
.me-link.active, .me-link:hover { border-color: var(--line-2); }
#settingsBtn.active { background: var(--text); color: #fff; }
img.avatar.pic { object-fit: cover; background: var(--bg-3); }
.avatar.xl { width: 96px; height: 96px; font-size: 32px; }
.field[readonly] { background: var(--bg-2); color: var(--text-2); }

.minev, .pagev { grid-column: 1 / -1; min-width: 0; overflow-y: auto; }
.mine-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px 6px; max-width: 900px; }
.mine-head .avatar { width: 40px; height: 40px; font-size: 14px; }
.mine-head h2 { margin: 0; font-size: 18px; }
.mine-list { padding: 6px 20px 40px; max-width: 900px; display: flex; flex-direction: column; gap: 10px; }
.mine-sec { border: 1px solid var(--line); border-radius: 8px; background: var(--bg); overflow: hidden; }
.mine-sec > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 10px 12px;
                      font-weight: 600; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.mine-sec > summary::-webkit-details-marker { display: none; }
.mine-sec:not([open]) > summary { border-bottom: 0; }
.mine-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 10px; align-items: center;
            padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.mine-row:last-child { border-bottom: 0; }
.mine-row:hover { background: var(--bg-2); }
.mine-row.now { box-shadow: inset 3px 0 0 var(--accent); }
.mine-row.done .mine-title { color: var(--text-3); text-decoration: line-through; }
.mine-title { font-weight: 500; overflow-wrap: break-word; }
.mine-title .hi { color: var(--warn); }
.mine-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 3px; font-size: 11px; }
.mine-date { font-family: var(--mono); font-size: 11px; color: var(--text-2); white-space: nowrap; }
.mine-date.overdue { color: var(--danger); font-weight: 600; }

.page-wrap { max-width: 900px; padding: 18px 20px 48px; display: flex; flex-direction: column; gap: 14px; }
.page-wrap.wide { max-width: 1200px; }
.page-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.page-title h2 { margin: 0; font-size: 20px; }
.card { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: var(--bg); min-width: 0; }
.card .shead { margin: 0 0 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-3); font-weight: 600; }
.settings-card .shead { margin-top: 18px; }
.prof-grid { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 14px; }
.prof-pic { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding-top: 6px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.tile { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--bg-2); display: flex; flex-direction: column; gap: 2px; }
.tile b { font-size: 22px; font-weight: 600; }
.tile span { font-size: 11.5px; color: var(--text-2); }
.tile.bad b { color: var(--danger); }
.tile.warn b { color: var(--warn); }
.admin-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.admin-body { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.scroll-x { overflow-x: auto; padding: 0; }
.scroll-x .ptable th { top: 0; }
.ptable td.bad { color: var(--danger); font-weight: 600; }
.ptable td.wrap { white-space: normal; min-width: 160px; }
.mname { display: inline-flex; align-items: center; gap: 8px; }
.log { padding: 6px 16px 12px; }
.log-row { display: grid; grid-template-columns: 44px 92px minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 6px 0;
           border-bottom: 1px solid var(--line); font-size: 12.5px; }
.log-row:last-child { border-bottom: 0; }
.log-row time { color: var(--text-3); font-family: var(--mono); font-size: 11px; }
.log-row .kind { text-align: center; }

@media (max-width: 760px) {
  .mine-head { padding: 12px 12px 4px; }
  .mine-list { padding: 6px 10px 32px; }
  .page-wrap { padding: 12px 10px 40px; }
  .prof-grid { grid-template-columns: 1fr; }
  .log-row { grid-template-columns: 40px minmax(0, 1fr); }
  .log-row .kind { grid-column: 2; justify-self: start; }
  .log-row > span:last-child { grid-column: 1 / -1; }
  .me-link { order: 1; }
}

/* several people on one task */
.avatars .more-av { background: var(--bg-3); color: var(--text-2); }
.chips.pick .chip { cursor: pointer; }
.chips.pick .chip.clear { padding: 0 10px; color: var(--text-3); }

/* ================================================================== bell, notices, stand-up */
.bell-wrap { position: relative; flex-shrink: 0; }
#bellBtn { position: relative; }
.bell-badge { position: absolute; top: 1px; right: 0; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px;
              background: var(--danger); color: #fff; font-size: 9.5px; font-weight: 700; line-height: 15px; text-align: center; }
.bell-menu { position: fixed; top: calc(var(--top-h) - 4px); right: 12px; width: 360px; max-height: 70vh; overflow-y: auto; z-index: 60;
             background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.bell-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line);
             position: sticky; top: 0; background: var(--bg); }
.bell-empty { padding: 24px 16px; text-align: center; color: var(--text-3); }
.bell-item { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; width: 100%; text-align: left;
             padding: 9px 12px; border-bottom: 1px solid var(--line); }
.bell-item:hover { background: var(--bg-2); }
.bell-item.unread { background: var(--accent-soft); }
.bell-ico { font-size: 14px; text-align: center; }
.bell-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bell-txt b { font-weight: 600; font-size: 12.5px; overflow-wrap: break-word; }
.bell-txt span { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bell-txt time { font-size: 10.5px; color: var(--text-3); }

.notice-strip { display: flex; flex-direction: column; gap: 8px; }
.notice-strip:empty { display: none; }
.notice { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-2); }
.notice.new { background: #fffbeb; border-color: #fde68a; }
.notice-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.notice-body { white-space: pre-wrap; font-size: 12.5px; color: var(--text-2); }
.notice-admin { display: flex; align-items: flex-start; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.notice-admin:last-child { border-bottom: 0; }

.standup { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field.blocked, .dc-note.blocked { border-color: #fecaca; background: var(--danger-soft); color: var(--danger); }

@media (max-width: 760px) {
  .bell-menu { left: 8px; right: 8px; width: auto; top: 52px; }
  .standup { grid-template-columns: 1fr; }
  .bell-wrap { order: 1; }
}

/* ================================================================== leave, holidays, HR, assets */
.day.holiday { background: #fdf4ff; }
.hol-tag { font-size: 10.5px; color: #86198f; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 2px; }
.away { display: flex; align-items: center; gap: 3px; font-size: 11px; margin-bottom: 2px; }
.leave-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin: 12px 0 8px; }
.leave-form label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--text-2); }
.leave-form label.inline { flex-direction: row; align-items: center; gap: 6px; padding-bottom: 6px; }
.leave-form label.grow { flex: 1; min-width: 160px; }
.leave-list { display: flex; flex-direction: column; margin-top: 8px; border-top: 1px solid var(--line); }
.leave-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.leave-why { flex: 1; min-width: 120px; overflow-wrap: anywhere; }
button.tile { text-align: left; cursor: pointer; }
button.tile:hover { border-color: var(--line-2); }
.hr-card > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hr-card > summary::-webkit-details-marker { display: none; }
.hr-card[open] > summary { padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.hr-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.hr-form label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--text-2); }
.hr-form label.wide { grid-column: 1 / -1; }
.ptable tr.done td { opacity: .55; }
.leave-form > .field, .leave-form label > .field:not([type=number]) { width: auto; min-width: 140px; }

/* ================================================================== dependencies, health, risks, workload, templates */
.lock { font-size: 10px; margin-right: 3px; }
.chip a { color: inherit; text-decoration: none; }
.chip.on a { color: #fff; }
.chip-x { margin-left: 2px; opacity: .7; font-size: 13px; line-height: 1; color: inherit; }
.health-box { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-2); }
.hbars { display: flex; flex-direction: column; gap: 4px; }
.hbars > div { display: grid; grid-template-columns: 34px minmax(0, 1fr) 36px; gap: 8px; align-items: center; font-size: 11px; color: var(--text-2); }
.bar.wide { width: 100%; }
.bar.time > i { background: var(--text-3); }
.risk { padding: 7px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; }
.risk.closed { opacity: .5; }
.risk.closed b { text-decoration: line-through; }
.risk-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; }
.risk-add { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.risk-add .row .field { width: auto; flex: 1; }
.risk-add > .btn { align-self: flex-end; }
.wl-table th, .wl-table td { text-align: center; }
.wl-table td:first-child, .wl-table th:first-child { text-align: left; }
.wl-day { font-size: 10px !important; line-height: 1.3; padding: 6px 4px !important; }
.wl-day.off { color: var(--line-2) !important; }
td.wl { min-width: 30px; padding: 6px 2px !important; font-weight: 600; font-size: 12px; }
td.wl.weekend { background: var(--bg-2); }
td.wl.leave, td.wl.holiday { background: #fdf4ff; }
.wl.l1, .wl-key.l1 { background: #dbeafe; }
.wl.l2, .wl-key.l2 { background: #93c5fd; }
.wl.l3, .wl-key.l3 { background: #f87171; color: #fff; }
.wl-key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; }
.bad { color: var(--danger); font-weight: 600; }
.tpl-lines { display: flex; flex-direction: column; gap: 4px; }
.tpl-row { display: grid; grid-template-columns: minmax(160px, 1fr) 64px 130px 60px 170px 28px; gap: 6px; align-items: center; }
.tpl-row.sub > :first-child { margin-left: 22px; width: calc(100% - 22px); }
.tpl-head { font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-3); font-weight: 600; }
.tpl-lines > .btn { align-self: flex-start; margin-top: 4px; }
@media (max-width: 760px) {
  .tpl-row { grid-template-columns: 1fr 60px; }
  .tpl-head { display: none; }
}
