.spacer { flex: 1; }

.is-armed {
  width: auto !important;
  padding: 0 10px !important;
  background: var(--danger) !important;
  border-color: var(--danger) !important;
  color: var(--paper) !important;
  font-weight: 550;
}
.btn-danger-icon:hover { color: var(--danger); background: var(--danger-wash); }

/* ---------- Tracker bar ---------- */

.tracker {
  padding: 14px 16px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: 0 1px 2px oklch(22% 0.01 90 / 0.05);
}
.tracker-modes { margin-bottom: 12px; }

.tracker-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  align-items: center;
  gap: 12px;
}
.tracker-desc { height: 40px; font-size: 15px; }
.tracker-tools { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tracker-controls { display: flex; align-items: center; gap: 8px; }
.tracker-time { min-width: 92px; text-align: right; font-size: 22px; letter-spacing: -0.01em; color: var(--muted); }
.tracker-time.is-running { color: var(--accent); }
.tracker-since { width: 100px; }
.tracker-go { height: 40px; min-width: 104px; }

/* Entry fields (manual form + inline edit) */
.ef-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ef-desc { flex: 1 1 220px; height: 40px; font-size: 15px; width: auto; }
.ef-row-time { margin-top: 14px; align-items: flex-end; }
.ef-row-time .field { width: 140px; }
.ef-actions { display: flex; align-items: center; gap: 8px; margin-top: 16px; }

/* ---------- Week header + entries ---------- */

.week-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 28px 0 16px;
}
.week-total-wrap { display: flex; align-items: baseline; gap: 10px; }
.week-total { font-size: 18px; font-weight: 600; }

.day-group { margin-bottom: 24px; }
.day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 8px 8px;
  border-bottom: 1px solid var(--border-strong);
}
.day-label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.day-total { font-size: 13px; font-weight: 600; color: var(--ink-2); }

.entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px 124px 76px 108px;
  align-items: center;
  gap: 12px;
  padding: 8px 8px;
  border-bottom: 1px solid var(--border);
  transition: background-color var(--t-fast) var(--ease-out);
}
.entry:hover { background: var(--surface); }
.entry.is-running { background: var(--accent-wash); }

.entry-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 2px 0;
  border: none;
  background: transparent;
  text-align: left;
  color: inherit;
}
button.entry-main { cursor: pointer; }
.entry-desc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-desc.is-empty { color: var(--muted); }
.entry-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.entry-meta:empty { display: none; }
.meta-project { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); white-space: nowrap; }

.entry-billable { color: var(--faint); }
.entry-billable.is-on { color: var(--ink); }
.entry-range { white-space: nowrap; font-size: 13px; }
.entry-dur { min-width: 64px; text-align: right; font-weight: 600; }
.entry-actions { display: flex; align-items: center; justify-content: flex-end; gap: 2px; min-width: 100px; opacity: 0; transition: opacity var(--t-fast) var(--ease-out); }
.entry:hover .entry-actions, .entry:focus-within .entry-actions, .entry.is-running .entry-actions { opacity: 1; }
@media (hover: none) { .entry-actions { opacity: 1; } }

.entry-edit { padding: 16px 8px 18px; background: var(--surface); border-bottom: 1px solid var(--border); }

/* ---------- Stats ---------- */

.stats { display: flex; flex-wrap: wrap; gap: 20px 0; margin: 0 0 8px; }
.stat { padding-right: 28px; margin-right: 28px; border-right: 1px solid var(--border); }
.stat:last-child { padding-right: 0; margin-right: 0; border-right: none; }
.stat-label { font-size: 12px; font-weight: 550; color: var(--muted); }
.stat-value { margin: 2px 0 0; font-size: 24px; font-weight: 600; letter-spacing: -0.015em; }
.stat-unit { font-size: 13px; font-weight: 500; color: var(--muted); }

/* ---------- Chart ---------- */

.chart { --gap: clamp(1px, 0.6vw, 6px); }
.chart-body { display: grid; grid-template-columns: 44px minmax(0, 1fr); height: 200px; }
.chart-y { position: relative; }
.chart-y span { position: absolute; right: 10px; transform: translateY(50%); font-size: 11px; color: var(--muted); }
.chart-plot {
  position: relative;
  display: grid;
  align-items: end;
  gap: var(--gap);
  border-bottom: 1px solid var(--border-strong);
}
.chart-line { position: absolute; left: 0; right: 0; height: 1px; background: var(--border); pointer-events: none; }
.chart-col {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 100%;
  border-radius: 4px;
}
.chart-col:hover, .chart-col:focus-visible { background: var(--surface); }
.chart-stack {
  display: flex;
  flex-direction: column-reverse;
  width: min(100%, 56px);
  height: var(--h);
  border-radius: 4px 4px 0 0;
  overflow: hidden;
}
.chart-seg { flex: var(--s) 1 0%; min-height: 2px; background: var(--c); }
.chart-seg + .chart-seg { box-shadow: 0 1px 0 var(--paper); }
.chart-x-wrap { display: grid; grid-template-columns: 44px minmax(0, 1fr); margin-top: 8px; }
.chart-x { display: grid; gap: var(--gap); }
.chart-tick { display: flex; flex-direction: column; align-items: center; font-size: 11px; line-height: 1.3; color: var(--muted); }
.chart-tick.is-today { color: var(--ink); font-weight: 600; }
.chart-tick.is-hidden > * { visibility: hidden; }

/* ---------- Dashboard lists ---------- */

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 0 56px; }
.dash-col { min-width: 0; }

.bars { display: flex; flex-direction: column; }
.bar-row {
  display: grid;
  grid-template-columns: minmax(110px, 1.2fr) minmax(60px, 1.6fr) 52px 40px;
  align-items: center;
  gap: 12px;
  padding: 7px 0;
}
.bar-label { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-sub { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { display: block; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 4px; background: var(--c, var(--ink-2)); }
.bar-fill.is-budget { background: var(--ink-2); }
.bar-track.is-warn .bar-fill { background: var(--warning); }
.bar-track.is-over .bar-fill { background: var(--danger); }
.bar-value { text-align: right; font-weight: 600; }
.bar-share { text-align: right; font-size: 12px; }

.budget-row { display: grid; gap: 6px; padding: 8px 0; }
.budget-text { font-size: 12px; }

.recent { display: flex; flex-direction: column; }
.recent-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 9px 6px;
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
}
.recent-row:hover { background: var(--surface); }
.recent-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.recent-when { font-size: 12px; white-space: nowrap; }

/* ---------- Week timesheet ---------- */

.ts-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.ts { width: 100%; min-width: 780px; border-collapse: collapse; }
.ts th, .ts td { padding: 6px 4px; }
.ts thead th { padding: 10px 4px; border-bottom: 1px solid var(--border-strong); font-size: 12px; font-weight: 600; color: var(--ink-2); text-align: center; }
.ts .ts-first { width: 26%; padding-left: 14px; text-align: left; font-weight: 500; }
.ts thead .ts-first { font-weight: 600; }
.ts-label { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; }
.ts-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-task { white-space: nowrap; }
.ts tbody tr + tr > * { border-top: 1px solid var(--border); }
.ts-day.is-today, .ts-td.is-today { background: var(--surface); }
.ts-td { text-align: center; }
.ts-cell {
  width: 100%;
  min-width: 56px;
  height: 34px;
  padding: 0 4px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  text-align: center;
}
.ts-cell:not(:placeholder-shown) { background: var(--surface-2); font-weight: 550; }
.ts-cell::placeholder { color: var(--faint); }
.ts-cell:hover:not(:disabled) { border-color: var(--border-strong); }
.ts-cell:focus-visible { outline: none; border-color: var(--ink); background: var(--paper); box-shadow: 0 0 0 3px oklch(22% 0.01 90 / 0.12); }
.ts-cell:disabled { cursor: not-allowed; opacity: 0.8; }
.ts-sum { width: 76px; padding-right: 10px !important; text-align: right; font-weight: 600; }
.ts-action { width: 40px; }
.ts-remove { width: 28px; height: 28px; }
.ts tfoot th, .ts tfoot td { border-top: 1px solid var(--border-strong); font-weight: 600; text-align: center; }
.ts tfoot .ts-first { text-align: left; }
.ts tfoot .ts-sum { text-align: right; }
.ts-add { margin-top: 14px; display: flex; }

/* ---------- Projects ---------- */

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.pj-search { max-width: 260px; }

.pj-row {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.2fr) 90px minmax(0, 1.6fr) 96px 44px;
  align-items: center;
  gap: 12px;
  padding: 8px 8px;
  border-bottom: 1px solid var(--border);
}
.pj-row:not(.pj-head):hover { background: var(--surface); }
.pj-row.is-open { background: var(--surface); border-bottom-color: transparent; }
.pj-row.is-archived .pj-title { color: var(--muted); }
.pj-head { padding-top: 0; padding-bottom: 8px; border-bottom-color: var(--border-strong); font-size: 12px; font-weight: 600; color: var(--muted); }
.pj-num { text-align: right; }
.pj-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px 0;
  border: none;
  background: none;
  text-align: left;
  font-weight: 550;
  color: var(--ink);
}
.pj-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-bill { display: inline-flex; color: var(--faint); }
.pj-client { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-budget-inner { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.pj-actions { display: flex; justify-content: flex-end; }

.pj-panel {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 20px 20px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-strong);
}
.pj-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.pj-colors, .pj-billable { grid-column: 1 / -1; }
.pj-form .picker { width: 100%; }
.pj-form .picker .icon-chevron { margin-left: auto; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--c);
  color: var(--paper);
}
.swatch:hover { transform: scale(1.08); }
.swatch.is-on { outline: 2px solid var(--ink); outline-offset: 2px; }

.tasks-title { margin-bottom: 4px; font-size: 14px; font-weight: 600; }
.tasks .hint { margin-bottom: 12px; max-width: 60ch; }
.tasks-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; max-width: 480px; }
.task-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 6px; }
.task-row.is-archived .task-input { color: var(--muted); }
.task-name { padding: 6px 0; }
.task-add { display: flex; gap: 8px; max-width: 480px; }

/* ---------- Reports ---------- */

.rp-filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.rp-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rp-preset { width: auto; min-width: 170px; }
.rp-row .input[type="date"] { width: 150px; }
.rp-group { width: auto; min-width: 190px; margin-left: auto; }

.rp-table { display: flex; flex-direction: column; }
.rp-grow {
  display: grid;
  grid-template-columns: minmax(0, 2fr) 76px minmax(120px, 1.6fr) 80px 104px;
  align-items: center;
  gap: 12px;
  padding: 9px 8px;
  border-bottom: 1px solid var(--border);
}
.rp-head { padding-top: 0; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom-color: var(--border-strong); }
.rp-foot { border-top: 1px solid var(--border-strong); border-bottom: none; font-weight: 600; }
.rp-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rp-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-sub { font-size: 12px; white-space: nowrap; }
.rp-num { text-align: right; }
.rp-share { display: flex; align-items: center; gap: 10px; }
.rp-share .bar-track { flex: 1; }
.rp-pct { width: 38px; text-align: right; font-size: 12px; }
.rp-note { margin-top: 10px; }

.rp-drow {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 72px 96px;
  align-items: center;
  gap: 12px;
  padding: 9px 8px;
  border-bottom: 1px solid var(--border);
}
.rp-details .rp-head { border-bottom-color: var(--border-strong); }
.rp-date { white-space: nowrap; font-size: 13px; }
.rp-desc { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rp-more { display: flex; justify-content: center; padding-top: 16px; }

/* ---------- Settings ---------- */

.page.page-narrow { max-width: 640px; margin-left: 0; }
.settings-section { padding-top: 24px; border-top: 1px solid var(--border); margin-top: 36px; }
.settings-section:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }
.settings-email { margin-bottom: 16px; }
.settings-hint { margin-bottom: 12px; }
.form-stack { display: flex; flex-direction: column; gap: 16px; max-width: 380px; }
.named-list { display: flex; flex-direction: column; gap: 6px; max-width: 480px; }
.named-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; }
.named-usage { font-size: 12px; min-width: 76px; text-align: right; }
.named-add { display: flex; gap: 8px; margin-top: 12px; max-width: 480px; }
.named-empty { padding: 4px 0; }

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 880px) {
  .tracker-row { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .tracker-controls { justify-content: space-between; }
  .tracker-time { text-align: left; }
  .tracker-go { flex: 1; max-width: 160px; }
  .ef-row-time .field { width: calc(50% - 4px); }
  .pj-form { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
  .stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
  .stat, .stat:last-child { padding: 0; margin: 0; border: none; }
  .stat-value { font-size: 20px; }
  .rp-sub { display: none; }

  .entry {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "main main dur"
      "bill range actions";
    row-gap: 4px;
    padding: 10px 6px;
  }
  .entry-main { grid-area: main; }
  .entry-dur { grid-area: dur; }
  .entry-billable { grid-area: bill; }
  .entry-range { grid-area: range; }
  .entry-actions { grid-area: actions; min-width: 0; }

  .bar-row { grid-template-columns: minmax(90px, 1fr) minmax(40px, 1fr) 48px; }
  .bar-share { display: none; }

  .pj-row { grid-template-columns: minmax(0, 1fr) 80px 44px; }
  .pj-client, .pj-budget, .pj-rate { display: none; }
  .pj-panel { padding: 16px 12px 18px; }

  .rp-grow { grid-template-columns: minmax(0, 1fr) 64px minmax(80px, 1fr); }
  .rp-optional { display: none; }
  .rp-drow { grid-template-columns: minmax(0, 1fr) 64px; }
  .rp-drow .rp-date { grid-column: 1 / -1; }
  .rp-details .rp-head { display: none; }
  .rp-group { margin-left: 0; }
}
