/* Components for the Work Calendar. Colours come from tokens.css only. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 500 14px/1.45 var(--font); -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 15px; height: 15px; }
svg.i.fill { fill: currentColor; stroke: none; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 20; height: 62px; padding: 0 20px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; letter-spacing: -.01em; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #FF7A59, var(--coral) 55%, #E64C7E);
  box-shadow: 0 4px 12px rgba(242, 92, 74, .35);
}
.brand-mark svg { width: 19px; height: 19px; stroke: #fff; stroke-width: 2.4; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.top-actions { display: flex; justify-content: flex-end; align-items: center; gap: 6px; }

.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--sunken); border-radius: var(--r-pill); }
.tab {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 16px; border-radius: var(--r-pill);
  font-weight: 700; color: var(--text-2); transition: background .15s, color .15s;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tab[aria-selected="true"] svg { color: var(--accent); }

.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; display: inline-grid; place-items: center; color: var(--text-2);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.search-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 12px; border-radius: 10px;
  background: var(--sunken); color: var(--text-3); font-weight: 600; min-width: 190px;
}
.search-btn:hover { color: var(--text-2); }
.kbd {
  margin-left: auto; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 5px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-3);
}

/* ---------------------------------------------------------------- menus, buttons, inputs */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 190px; padding: 6px; z-index: 30;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-lg);
  animation: pop-in .16s var(--ease);
}
.menu[hidden] { display: none; }
.menu-label { padding: 6px 10px 4px; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.menu-item {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm);
  font-weight: 600; text-align: left;
}
.menu-item:hover { background: var(--hover); }
.menu-item[aria-checked="true"] { color: var(--accent-text); }
.menu-item[aria-checked="true"]::after { content: '✓'; margin-left: auto; font-weight: 800; }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--border); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 10px; font-weight: 700; white-space: nowrap; transition: background .15s, transform .1s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 3px 10px rgba(242, 92, 74, .28); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-soft { background: var(--sunken); color: var(--text); }
.btn-soft:hover { background: var(--hover); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-sm { height: 30px; padding: 0 10px; border-radius: var(--r-sm); font-size: 13px; }

.input {
  width: 100%; height: 42px; padding: 0 14px; border-radius: 10px; background: var(--surface-2);
  border: 1.5px solid var(--border); font-weight: 600; transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--blue); box-shadow: var(--ring); }

/* ---------------------------------------------------------------- pills, chips, dots */
.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: var(--r-xs);
  background: var(--c, var(--sunken)); color: var(--c-ink, var(--text-2));
  font-size: 12px; font-weight: 800; white-space: nowrap; letter-spacing: .01em;
}
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: var(--r-pill);
  background: var(--sunken); color: var(--text-2); font-size: 12px; font-weight: 700; white-space: nowrap;
}
.chip.time { color: var(--text); }
.chip.due { background: var(--warn-soft); color: var(--warn); }
.chip.due.late { background: var(--bad-soft); color: var(--bad); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }

/* ---------------------------------------------------------------- estimate vs actual */
.est { display: flex; align-items: center; gap: 8px; }
.est-track { position: relative; flex: 1; height: 6px; border-radius: var(--r-pill); background: var(--sunken); overflow: visible; }
.est-fill { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--ok); transition: width .4s var(--ease); }
.est-mark { position: absolute; top: -3px; width: 2px; height: 12px; border-radius: 2px; background: var(--text-2); }
.est[data-state="near"] .est-fill { background: var(--orange); }
.est[data-state="over"] .est-fill { background: var(--bad); }
.est[data-state="none"] .est-fill { background: var(--border-strong); }
.est-text { font-size: 12px; font-weight: 700; color: var(--text-2); white-space: nowrap; }
.est[data-state="near"] .est-text { color: var(--warn); }
.est[data-state="over"] .est-text { color: var(--bad); }

/* ---------------------------------------------------------------- cards */
.card {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.task-card {
  padding: 10px 12px 10px 15px; display: grid; gap: 8px; cursor: grab; overflow: hidden;
  transition: box-shadow .15s, transform .15s, border-color .15s;
}
.task-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.task-card:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.task-title { font-weight: 700; line-height: 1.3; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.task-card.done .task-title { color: var(--text-3); text-decoration: line-through; text-decoration-thickness: 1.5px; }

/* ---------------------------------------------------------------- board */
.board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(268px, 1fr); gap: 14px;
  padding: 18px 20px 24px; overflow-x: auto; align-items: start; min-height: calc(100vh - 62px);
}
.col { background: var(--sunken); border-radius: var(--r-lg); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 4px 2px; }
.col-head h3 { margin: 0; font-size: 14px; font-weight: 800; }
.col-icon { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--c); color: var(--c-ink); }
.col-icon svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.count { margin-left: auto; font-size: 12px; font-weight: 800; color: var(--text-2); background: var(--surface); padding: 1px 8px; border-radius: var(--r-pill); }
.count.full { background: var(--accent); color: var(--accent-ink); }
.col-body { display: flex; flex-direction: column; gap: 8px; min-height: 48px; border-radius: var(--r); }
.group-head { display: flex; align-items: center; gap: 7px; padding: 8px 4px 0; font-size: 12px; font-weight: 800; color: var(--text-2); }
.capacity { padding: 8px 10px; border-radius: var(--r); background: var(--surface); display: grid; gap: 6px; }
.capacity-row { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--text-2); }
.capacity .est-track { height: 8px; }
.incomplete {
  padding: 8px; border-radius: var(--r); display: grid; gap: 8px;
  background: var(--warn-soft); border: 1.5px dashed color-mix(in srgb, var(--orange) 60%, transparent);
}
.incomplete-head { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; color: var(--warn); padding: 0 4px; }
.sortable-ghost { opacity: .35; }
.sortable-chosen .task-card, .task-card.sortable-chosen { box-shadow: var(--shadow-lg); transform: rotate(1.5deg); }
.drop-full { outline: 2px dashed var(--bad); outline-offset: 2px; }

/* ---------------------------------------------------------------- focus */
.focus { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; padding: 20px; max-width: 1360px; margin: 0 auto; }
.focus-main, .focus-side { display: grid; gap: 18px; align-content: start; }
.hello { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.hello h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.panel { padding: 16px; }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; font-size: 15px; font-weight: 800; }
.panel-head .count { margin-left: 0; background: var(--sunken); }
.panel-head .count.full { background: var(--accent); }

.now-card { padding: 0; overflow: hidden; }
.now-band { height: 6px; background: linear-gradient(90deg, var(--c), color-mix(in srgb, var(--c) 40%, var(--accent))); }
.now-body { padding: 18px 20px 20px; display: grid; gap: 14px; }
.now-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-text); }
.live { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgba(242, 92, 74, .6); animation: live 1.8s infinite; }
.now-title { margin: 0; font-size: 21px; font-weight: 800; line-height: 1.25; letter-spacing: -.01em; }
.now-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.timer { font-size: 46px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.timer-btns { display: flex; gap: 8px; }
.round-btn { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--sunken); color: var(--text); transition: transform .12s, background .15s; }
.round-btn:hover { background: var(--hover); transform: scale(1.05); }
.round-btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 14px rgba(242, 92, 74, .35); }
.round-btn.primary:hover { background: var(--accent-hover); }
.now-foot { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 13px; color: var(--text-2); font-weight: 600; }

.row-list { display: grid; gap: 6px; }
.task-row {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border);
  transition: background .15s, opacity .3s, transform .3s var(--ease);
}
.task-row:hover { background: var(--hover); }
.task-row .grow { min-width: 0; display: grid; gap: 4px; }
.task-row .task-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-row.done { opacity: .55; }
.task-row.done .task-title { text-decoration: line-through; }
.check {
  width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--border-strong); display: grid; place-items: center;
  color: transparent; transition: background .15s, border-color .15s, transform .25s var(--spring);
}
.check:hover { border-color: var(--green); }
.check svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.check.on { background: var(--green); border-color: var(--green); color: #fff; transform: scale(1.12); }
.check.pop { animation: check-pop .45s var(--spring); }
.slot { font-size: 12px; font-weight: 800; color: var(--text-2); min-width: 44px; }

/* one-day time column */
.day { position: relative; display: grid; grid-template-columns: 46px 1fr; }
.day-hours { position: relative; }
.day-hour { height: var(--hour, 52px); font-size: 11px; font-weight: 700; color: var(--text-3); transform: translateY(-7px); }
.day-grid { position: relative; border-left: 1px solid var(--border); }
.day-line { height: var(--hour, 52px); border-top: 1px solid var(--border); }
.day-line:first-child { border-top-color: transparent; }
.ev {
  position: absolute; left: 6px; right: 4px; border-radius: 9px; padding: 5px 9px; overflow: hidden;
  font-size: 12px; line-height: 1.25; display: grid; align-content: start; gap: 1px;
}
.ev b { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev small { font-weight: 700; opacity: .85; }
.ev.task { background: var(--c); color: var(--c-ink); box-shadow: var(--shadow-sm); cursor: ns-resize; touch-action: none; }
.ev.task.dragging { box-shadow: var(--shadow-lg); z-index: 3; opacity: .95; }
.ev.task.is-now { outline: 2px solid var(--text); outline-offset: 1px; }
.ev.busy { background: repeating-linear-gradient(135deg, var(--busy), var(--busy) 6px, var(--busy-stripe) 6px, var(--busy-stripe) 12px), var(--busy); color: var(--busy-text); }
.ev.busy::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--border-strong); }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--accent); z-index: 4; pointer-events: none; }
.now-line::before { content: ''; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }

/* donut */
.donut-wrap { display: grid; grid-template-columns: 132px 1fr; gap: 16px; align-items: center; }
.donut { position: relative; width: 132px; height: 132px; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-center b { font-size: 22px; font-weight: 800; line-height: 1; }
.donut-center span { font-size: 11px; font-weight: 700; color: var(--text-3); }
.legend { display: grid; gap: 7px; font-size: 13px; font-weight: 700; }
.legend div { display: flex; align-items: center; gap: 8px; }
.legend span:last-child { margin-left: auto; color: var(--text-2); }
.seg-toggle { display: inline-flex; gap: 2px; padding: 3px; background: var(--sunken); border-radius: var(--r-pill); margin-left: auto; }
.seg-toggle button { padding: 3px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 700; color: var(--text-2); }
.seg-toggle button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------------------------------------------------------------- table */
.table-wrap { padding: 18px 20px 24px; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.tbl th { text-align: left; font-size: 12px; font-weight: 800; color: var(--text-2); padding: 11px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--hover); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.tbl .grp td { background: var(--surface-2); font-weight: 800; font-size: 13px; padding-top: 12px; }
.tbl td.title-cell { font-weight: 700; position: relative; padding-left: 18px; }
.tbl td.title-cell::before { content: ''; position: absolute; left: 0; top: 6px; bottom: 6px; width: 4px; border-radius: 0 3px 3px 0; background: var(--c); }
.status { display: inline-flex; justify-content: center; min-width: 96px; height: 26px; align-items: center; border-radius: var(--r-xs); font-size: 12px; font-weight: 800; background: var(--c); color: var(--c-ink); }

/* ---------------------------------------------------------------- empty states, toast, modal, login */
.empty { max-width: 460px; margin: 12vh auto; text-align: center; padding: 0 20px; display: grid; justify-items: center; gap: 10px; }
.empty h2 { margin: 6px 0 0; font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.empty p { margin: 0; color: var(--text-2); }
.blob { width: 92px; height: 92px; border-radius: 30px; display: grid; place-items: center; transform: rotate(-6deg); box-shadow: var(--shadow); }
.blob svg { width: 44px; height: 44px; stroke: #fff; stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; transform: rotate(6deg); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-radius: var(--r);
  background: var(--text); color: var(--bg); font-weight: 700; box-shadow: var(--shadow-lg);
  transition: opacity .2s, transform .25s var(--ease); pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { color: var(--accent); font-weight: 800; padding: 4px 8px; border-radius: 6px; }

.scrim { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(14, 16, 30, .45); animation: fade .15s; }
.modal { width: min(440px, calc(100vw - 32px)); padding: 20px; display: grid; gap: 14px; animation: pop-in .2s var(--ease); box-shadow: var(--shadow-lg); }
.modal h3 { margin: 0; font-size: 17px; font-weight: 800; }
.modal p { margin: 0; color: var(--text-2); }
.pick { display: grid; gap: 6px; }
.pick button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); text-align: left; font-weight: 700; }
.pick button:hover { border-color: var(--accent); background: var(--accent-soft); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--coral) 16%, transparent), transparent 60%),
              radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--blue) 14%, transparent), transparent 60%), var(--bg); }
.login-card { width: min(380px, 100%); padding: 28px; display: grid; gap: 16px; box-shadow: var(--shadow-lg); }
.login-card h1 { margin: 0; font-size: 22px; font-weight: 800; }
.login-card p { margin: 0; color: var(--text-2); }
.form-error { color: var(--bad); font-weight: 700; min-height: 20px; font-size: 13px; }

/* ---------------------------------------------------------------- motion */
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes live { 0% { box-shadow: 0 0 0 0 rgba(242, 92, 74, .55); } 70% { box-shadow: 0 0 0 9px rgba(242, 92, 74, 0); } 100% { box-shadow: 0 0 0 0 rgba(242, 92, 74, 0); } }
@keyframes check-pop { 0% { transform: scale(.7); } 60% { transform: scale(1.25); } 100% { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------------------------------------------------------------- narrow windows */
@media (max-width: 1100px) { .focus { grid-template-columns: 1fr; } .search-btn { min-width: 0; } .search-btn .label, .search-btn .kbd { display: none; } }
@media (max-width: 720px) {
  .topbar { grid-template-columns: auto 1fr; padding: 0 12px; height: auto; min-height: 62px; }
  .topbar .tabs { grid-column: 1 / -1; grid-row: 2; justify-self: center; margin-bottom: 10px; }
  .brand-name { display: none; }
  .tab { padding: 0 12px; }
  .focus, .table-wrap { padding: 16px; }
  .board { padding: 16px; }
  .timer { font-size: 38px; }
  .donut-wrap { grid-template-columns: 1fr; justify-items: center; }
}
