/* Time Keeper — interactive rebuild (2026).
   Values taken from the Claude Design mock; where the mock failed WCAG AA
   the token was darkened and the original value is noted next to it. */

:root {
  --tk-rail: #0c5c56;
  --tk-primary: #0f766e;        /* mock: #0d9488 on the button = 3.74:1, fails AA */
  --tk-primary-hover: #115e59;
  --tk-accent: #0d9488;         /* decorative only: dots, bars, icons */
  --tk-accent-soft: #e5f3f1;
  --tk-accent-text: #0f5f57;
  --tk-bg: #f3f5f6;
  --tk-surface: #ffffff;
  --tk-surface-2: #fafbfb;
  --tk-border: #e7ebec;
  --tk-divider: #eef1f2;
  --tk-divider-soft: #f2f4f5;
  --tk-text: #101828;
  --tk-text-2: #344054;
  --tk-text-3: #475467;
  --tk-muted: #667085;          /* mock: #8a94a3 (3.07:1) and #98a2b3 (2.48:1), both fail AA */
  --tk-danger: #f04438;
  --tk-error: #b42318;
  --tk-dark: #101828;
  --tk-radius: 16px;
  --tk-radius-sm: 9px;
  --tk-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.06);
  --tk-font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }
body {
  font-family: var(--tk-font);
  color: var(--tk-text);
  background: #e6eaeb;
  -webkit-font-smoothing: antialiased;
  min-width: 1180px;
}

h1, h2, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
button, input, select { font-family: inherit; }
button { cursor: pointer; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 2px solid var(--tk-accent); outline-offset: 2px; }

/* ---------- Portfolio demo bar ---------- */
.demo-bar {
  display: flex; align-items: center; gap: 18px;
  height: 44px; padding: 0 20px;
  background: var(--tk-dark); color: #fff; font-size: 13px;
}
.demo-bar__back { color: #fff; font-weight: 600; text-decoration: none; }
.demo-bar__back:hover { text-decoration: underline; }
.demo-bar__label { color: #d0d5dd; }
.demo-bar__hint { display: none; margin-left: auto; color: #fde68a; }
@media (max-width: 1179px) { .demo-bar__hint { display: inline; } }
.demo-bar :focus-visible { outline-color: #fff; }
.noscript { padding: 16px 20px; background: #fef3c7; color: #92400e; font-weight: 600; }

/* ---------- Shell ---------- */
.app-shell {
  display: flex;
  height: max(760px, calc(100vh - 44px));
  background: var(--tk-bg);
  overflow: hidden;
}

/* Icon rail */
.icon-rail {
  width: 72px; flex-shrink: 0; background: var(--tk-rail);
  display: flex; flex-direction: column; align-items: center; padding: 18px 0 20px;
}
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px; background: rgba(255, 255, 255, 0.14);
  display: flex; align-items: center; justify-content: center; margin-bottom: 28px;
}
.rail-group { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.rail-spacer { flex: 1; }
.rail-btn {
  width: 40px; height: 40px; border: none; border-radius: 10px; background: transparent;
  display: flex; align-items: center; justify-content: center; color: rgba(255, 255, 255, 0.75);
}
.rail-btn:hover { background: rgba(255, 255, 255, 0.12); }
.rail-btn--active { background: rgba(255, 255, 255, 0.16); }
.rail-btn--active:hover { background: rgba(255, 255, 255, 0.22); }
.icon-rail :focus-visible { outline-color: #fff; }
.rail-avatar {
  width: 34px; height: 34px; border-radius: 50%; margin-top: 4px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 12px; background: var(--tk-primary);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

/* Secondary nav */
.secondary-nav {
  width: 232px; flex-shrink: 0; background: var(--tk-surface-2);
  border-right: 1px solid var(--tk-border); padding: 24px 16px;
  display: flex; flex-direction: column; gap: 2px;
}
.secondary-nav__title {
  font-size: 12px; font-weight: 700; color: var(--tk-muted);
  letter-spacing: 0.06em; text-transform: uppercase; padding: 0 10px 12px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: none; border-radius: 8px; background: transparent;
  color: var(--tk-text-2); font-size: 14px; font-weight: 500; text-align: left;
}
.nav-item:hover { background: var(--tk-divider); }
.nav-item--expanded { background: var(--tk-accent-soft); color: var(--tk-accent-text); font-weight: 600; margin-top: 2px; }
.nav-item--expanded:hover { background: #dcefec; }
.nav-item__label { flex: 1; }
.nav-item__chevron { transition: transform 0.15s ease; }
.nav-item[aria-expanded="false"] .nav-item__chevron { transform: rotate(-90deg); }
.nav-item--quiet { color: var(--tk-muted); font-size: 13px; }
.nav-sublist { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 6px; }
.nav-subitem {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px 8px 34px; border: none; border-radius: 8px; background: transparent;
  color: var(--tk-text-3); font-size: 14px; text-align: left;
}
.nav-subitem:hover { background: var(--tk-divider); }
.nav-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--tk-accent); flex-shrink: 0; }

/* ---------- Main ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 84px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; background: var(--tk-surface); border-bottom: 1px solid var(--tk-border);
}
.topbar__greeting { font-size: 19px; font-weight: 700; line-height: 1.2; }
.topbar__date { font-size: 13px; color: var(--tk-muted); margin-top: 2px; }
.topbar__actions { display: flex; align-items: center; gap: 14px; }

.view-as { display: flex; align-items: center; gap: 2px; padding: 3px; background: var(--tk-divider-soft); border-radius: var(--tk-radius-sm); }
.seg-btn {
  border: none; background: transparent; color: var(--tk-muted);
  font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 7px;
}
.seg-btn:hover { background: rgba(255, 255, 255, 0.6); }
.seg-btn[aria-pressed="true"] { background: #fff; color: var(--tk-accent-text); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08); }

.search-field {
  display: flex; align-items: center; gap: 8px; width: 220px;
  padding: 8px 12px; background: var(--tk-divider-soft);
  border: 1px solid transparent; border-radius: var(--tk-radius-sm);
}
.search-field:focus-within { border-color: var(--tk-accent); background: #fff; }
.search-field input { border: none; background: transparent; outline: none; width: 100%; font-size: 14px; color: var(--tk-text-2); }
.search-field input::placeholder { color: var(--tk-muted); }

.btn-primary {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  border: none; border-radius: var(--tk-radius-sm); padding: 9px 16px;
  background: var(--tk-primary); color: #fff; font-size: 14px; font-weight: 600;
}
.btn-primary:hover { background: var(--tk-primary-hover); }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--tk-border); background: #fff; color: var(--tk-text-3);
  font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 8px;
}
.btn-ghost:hover { background: #f8fafa; }

.icon-btn {
  position: relative; width: 38px; height: 38px; border: none; border-radius: var(--tk-radius-sm);
  background: transparent; display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--tk-divider-soft); }
.icon-btn__dot {
  position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--tk-danger); border: 1.5px solid #fff;
}

.avatar {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 700;
}
.avatar--lg { width: 38px; height: 38px; font-size: 13px; background: var(--tk-primary); }

.content { flex: 1; display: flex; gap: 18px; padding: 20px 28px; min-height: 0; }

/* ---------- Cards ---------- */
.card { background: var(--tk-surface); border-radius: var(--tk-radius); box-shadow: var(--tk-shadow); }
.card--pad { padding: 18px 20px; flex-shrink: 0; }
.card--grow { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.card-title { font-size: 16px; font-weight: 700; }
.card-title--sm { font-size: 15px; margin-bottom: 12px; }
.card-subtitle { font-size: 13px; color: var(--tk-muted); margin-top: 2px; }
.card-row { display: flex; align-items: baseline; justify-content: space-between; }
.card-row .card-title--sm { margin-bottom: 12px; }
.card-meta { font-size: 12px; color: var(--tk-muted); }

/* ---------- Timesheet ---------- */
.timesheet { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.timesheet__header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 16px; flex-shrink: 0; }
.timesheet__tools { display: flex; gap: 8px; }
.timesheet__scroll { flex: 1; overflow: auto; }
.timesheet__footer {
  padding: 14px 24px; border-top: 1px solid var(--tk-divider); flex-shrink: 0;
  font-size: 13px; color: var(--tk-muted);
}

.ts-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.ts-table th {
  position: sticky; top: 0; z-index: 1;
  padding: 10px 12px; text-align: left; background: var(--tk-surface-2);
  border-top: 1px solid var(--tk-divider); border-bottom: 1px solid var(--tk-divider);
  font-size: 12px; font-weight: 700; color: var(--tk-muted); letter-spacing: 0.03em; text-transform: uppercase;
}
.ts-table th:first-child, .ts-table td:first-child { padding-left: 24px; }
.ts-table th:last-child, .ts-table td:last-child { padding-right: 20px; }
.ts-table td { padding: 16px 12px; border-bottom: 1px solid var(--tk-divider-soft); font-size: 14px; color: var(--tk-text-3); vertical-align: middle; }
.ts-table tbody tr:last-child td { border-bottom: none; }
.ts-table tr.is-new td { animation: rowFlash 2.4s ease; }
@keyframes rowFlash { 0%, 40% { background: var(--tk-accent-soft); } 100% { background: transparent; } }

.ts-project { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ts-project__mark { width: 8px; height: 8px; border-radius: 2px; background: var(--tk-accent); flex-shrink: 0; }
.ts-project__name { font-weight: 600; color: var(--tk-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.assignees { display: flex; }
.assignees .avatar { border: 2px solid #fff; }
.assignees .avatar + .avatar { margin-left: -6px; }
.ts-date { white-space: nowrap; }

.status, .priority {
  display: inline-block; white-space: nowrap;
  font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 6px;
}
.status--progress { background: #dbeafe; color: #1e40af; }
.status--stuck { background: #fee2e2; color: #991b1b; }
.status--done { background: #d1fae5; color: #065f46; }
.status--notstarted { background: var(--tk-divider-soft); color: var(--tk-text-3); box-shadow: inset 0 0 0 1px var(--tk-border); }
.priority--high { background: #ffe4d5; color: #9a3412; }
.priority--medium { background: #fef3c7; color: #92400e; }
.priority--low { background: #e2e8f0; color: #334155; }

.progress { display: flex; align-items: center; gap: 8px; }
.progress__track { flex: 1; height: 6px; background: var(--tk-divider); border-radius: 4px; overflow: hidden; }
.progress__bar { height: 100%; background: var(--tk-accent); border-radius: 4px; }
.progress__bar--stuck { background: var(--tk-danger); }
.progress__value { font-size: 12px; font-weight: 600; color: var(--tk-muted); min-width: 34px; text-align: right; }

.row-menu {
  width: 28px; height: 28px; border: none; border-radius: 6px; background: transparent;
  display: flex; align-items: center; justify-content: center;
}
.row-menu:hover { background: var(--tk-divider-soft); }

.ts-empty td { text-align: center; padding: 40px 24px; color: var(--tk-muted); }

/* ---------- Right column ---------- */
.right-col { width: 320px; flex-shrink: 0; display: flex; flex-direction: column; gap: 14px; min-height: 0; }

/* Timer */
.timer-card {
  flex-shrink: 0; padding: 18px 20px; border-radius: var(--tk-radius);
  background: var(--tk-primary); color: #fff; box-shadow: var(--tk-shadow);
}
.timer-card :focus-visible { outline-color: #fff; }
.timer-card__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.timer-task { font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, 0.92); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer-status {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
  padding: 4px 9px; border-radius: 6px; background: #134e4a;   /* was rgba(255,255,255,.16): axe color-contrast */
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
}
.timer-status__dot { width: 6px; height: 6px; border-radius: 50%; background: #cbd5e1; }
.timer-card[data-state="running"] .timer-status__dot { background: #4ade80; animation: pulseDot 1.6s ease-in-out infinite; }
.timer-card[data-state="stopped"] .timer-status__dot { background: #fbbf24; }
@keyframes pulseDot { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) {
  .timer-card[data-state="running"] .timer-status__dot, .ts-table tr.is-new td { animation: none; }
}
.timer-time { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; margin-bottom: 14px; }

.timer-panel { display: none; }
.timer-card[data-state="idle"] [data-panel="idle"],
.timer-card[data-state="running"] [data-panel="running"] { display: block; }
.timer-card[data-state="stopped"] [data-panel="stopped"] { display: flex; }
.timer-panel--split { gap: 8px; }
.timer-panel--split > * { flex: 1; }

.timer-label { display: block; font-size: 12px; font-weight: 600; color: rgba(255, 255, 255, 0.92); margin-bottom: 6px; }
.timer-select {
  width: 100%; margin-bottom: 10px; padding: 9px 10px;
  border: 1px solid transparent; border-radius: var(--tk-radius-sm);
  background: #fff; color: var(--tk-text); font-size: 14px;
}
.timer-select[aria-invalid="true"] { border-color: #fecaca; box-shadow: 0 0 0 2px #fecaca; }
.timer-error { font-size: 13px; font-weight: 600; margin: -2px 0 10px; }
.timer-error::before { content: "⚠ "; }

.btn-dark, .btn-light, .btn-outline-light {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  padding: 11px; border-radius: 10px; font-size: 14px; font-weight: 600;
}
.btn-dark { background: var(--tk-dark); color: #fff; border: none; }
.btn-dark:hover { background: #1d2939; }
.btn-light { background: #fff; color: var(--tk-primary); border: none; }
.btn-light:hover { background: #f0fdfa; }
.btn-outline-light { background: transparent; color: #fff; border: 1.5px solid rgba(255, 255, 255, 0.7); }
.btn-outline-light:hover { background: rgba(255, 255, 255, 0.1); }
.btn-outline-light[data-confirm="true"] { background: #fff; color: var(--tk-error); border-color: #fff; }

/* Schedule */
.schedule { display: flex; flex-direction: column; gap: 10px; }
.schedule li { display: flex; gap: 12px; font-size: 14px; font-weight: 500; color: var(--tk-text-2); }
.schedule__time { width: 62px; flex-shrink: 0; font-size: 12.5px; font-weight: 600; color: var(--tk-primary); padding-top: 1px; }

/* Messages */
.messages { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; }
.message { display: flex; gap: 10px; }
.message .avatar { width: 28px; height: 28px; }
.message__body { min-width: 0; flex: 1; }
.message__head { display: flex; justify-content: space-between; gap: 8px; }
.message__name { font-size: 13.5px; font-weight: 600; }
.message__time { font-size: 11.5px; color: var(--tk-muted); flex-shrink: 0; }
.message__text { font-size: 13px; color: var(--tk-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Hours */
.hours { display: flex; align-items: center; gap: 18px; }
.donut {
  position: relative; width: 88px; height: 88px; flex-shrink: 0; border-radius: 50%;
  background: conic-gradient(#0d9488 0% 37.14%, #6366f1 37.14% 71.43%, #f59e0b 71.43% 100%);
}
.donut__hole {
  position: absolute; inset: 12px; border-radius: 50%; background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.donut__total { font-size: 16px; font-weight: 700; line-height: 1.1; }
.donut__label { font-size: 11px; color: var(--tk-muted); }
.legend { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.legend__swatch { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.legend__name { flex: 1; color: var(--tk-text-3); }
.legend__value { font-weight: 600; }

/* ---------- Dialog ---------- */
.dialog {
  width: 480px; max-width: calc(100vw - 32px); padding: 0; border: none;
  border-radius: var(--tk-radius); box-shadow: 0 24px 60px rgba(16, 24, 40, 0.25); color: var(--tk-text);
}
.dialog::backdrop { background: rgba(16, 24, 40, 0.45); }
.dialog form { padding: 22px 24px 20px; }
.dialog__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.dialog__title { font-size: 18px; font-weight: 700; }
.dialog__footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

.field { margin: 0 0 16px; padding: 0; border: none; min-width: 0; }
.field__label { display: block; padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--tk-text-2); }
.field__req { color: var(--tk-error); }
.field__input {
  width: 100%; padding: 9px 12px; font-size: 14px; color: var(--tk-text);
  border: 1px solid #d0d5dd; border-radius: var(--tk-radius-sm); background: #fff;
}
.field__input:focus-visible { outline: none; border-color: var(--tk-accent); box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2); }
.field__input[aria-invalid="true"] { border-color: #d92d20; }
.field__hint { font-size: 12.5px; color: var(--tk-muted); margin-top: 5px; }
.field__error { font-size: 13px; font-weight: 600; color: var(--tk-error); margin-top: 5px; }

.pill-group { display: flex; gap: 8px; }
.pill-option { position: relative; cursor: pointer; }
.pill-option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pill-option .priority { padding: 6px 14px; box-shadow: inset 0 0 0 2px transparent; }
.pill-option input:checked + .priority { box-shadow: inset 0 0 0 2px currentColor; }
.pill-option input:focus-visible + .priority { outline: 2px solid var(--tk-accent); outline-offset: 2px; }

.assignee-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.assignee-option {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px;
  border: 1px solid var(--tk-border); border-radius: var(--tk-radius-sm); font-size: 14px; cursor: pointer;
}
.assignee-option:hover { background: var(--tk-surface-2); }
.assignee-option input { margin: 0; accent-color: var(--tk-primary); }
.assignee-grid[aria-invalid="true"] .assignee-option { border-color: #fda29b; }

/* ---------- Toasts ---------- */
.toast-region { position: fixed; right: 24px; bottom: 24px; z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  max-width: 360px; padding: 12px 16px; border-radius: 10px;
  background: var(--tk-dark); color: #fff; font-size: 14px; box-shadow: 0 12px 30px rgba(16, 24, 40, 0.3);
  animation: toastIn 0.2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Fade the last visible message so a clipped list reads as scrollable */
.messages {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent);
  padding-bottom: 12px;
}

.messages:focus-visible { outline: 2px solid var(--tk-accent); outline-offset: 4px; border-radius: 6px; }
