/* Daily Work Tracker — Coinbase-derived surface.
   Rules held throughout: one action colour (--primary), used scarcely; display type
   at weight 400 with negative tracking; pill geometry on everything interactive;
   one shadow tier; every number in mono. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

.mono {
  font-family: var(--font-mono);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.display {
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.05;
  margin: 0;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.hidden {
  display: none !important;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  height: 44px;
  padding: 0 var(--space-md);
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.15;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:disabled {
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
}

.btn-primary:active:not(:disabled) {
  background: var(--primary-active);
}

.btn-primary:disabled {
  background: var(--primary-disabled);
}

.btn-secondary {
  background: var(--surface-strong);
  color: var(--ink);
}

.btn-secondary:active:not(:disabled) {
  background: var(--hairline);
}

.btn-secondary:disabled {
  color: var(--muted-soft);
}

.btn-on-dark {
  background: var(--surface-dark-elevated);
  color: var(--on-dark);
}

.btn-outline-dark {
  background: transparent;
  color: var(--on-dark);
  border-color: rgba(255, 255, 255, 0.4);
}

.btn-lg {
  height: 56px;
  padding: 0 var(--space-xl);
}

.btn-text {
  background: transparent;
  color: var(--primary);
  height: auto;
  padding: 0;
  border: 0;
  font-weight: 600;
  cursor: pointer;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--r-full);
  background: var(--surface-strong);
  color: var(--ink);
  cursor: pointer;
}

.btn-icon:active {
  background: var(--hairline);
}

/* ------------------------------------------------------------------- inputs */

.input {
  width: 100%;
  height: 48px;
  padding: 0 var(--space-base);
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  outline: none;
}

.input::placeholder {
  color: var(--muted-soft);
}

.input:focus {
  border: 2px solid var(--primary);
  padding: 0 15px;
}

/* --------------------------------------------------------------- login page */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-section) var(--space-lg);
}

.login-card {
  width: 100%;
  max-width: 400px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}

.wordmark-dot {
  width: 12px;
  height: 12px;
  border-radius: var(--r-full);
  background: var(--primary);
}

.login-title {
  font-size: 52px;
  letter-spacing: -0.025em;
  margin: var(--space-xl) 0 var(--space-sm);
}

.login-sub {
  color: var(--body);
  margin: 0 0 var(--space-xl);
}

.field {
  margin-bottom: var(--space-base);
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--body);
  margin-bottom: var(--space-xs);
}

.form-error {
  color: var(--semantic-down);
  font-size: 14px;
  margin: var(--space-sm) 0 0;
  min-height: 21px;
}

/* ----------------------------------------------------------------- top nav */

.nav {
  height: 64px;
  border-bottom: 1px solid var(--hairline);
  background: var(--canvas);
  position: sticky;
  top: 0;
  z-index: 20;
}

.nav-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-base);
}

.nav-tabs {
  display: flex;
  gap: var(--space-xxs);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  height: 36px;
  padding: 0 var(--space-base);
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.tab:hover {
  color: var(--ink);
}

.btn-signout {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xxs);
}

.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xxs);
}

.tab[aria-selected="true"] {
  background: var(--surface-strong);
  color: var(--ink);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 14px;
  color: var(--muted);
}

/* --------------------------------------------------------------- log screen */

.screen {
  padding: var(--space-xxl) 0;
}

.day-nav {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.day-pill {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 var(--space-md);
  border-radius: var(--r-pill);
  background: var(--surface-strong);
  font-size: 14px;
}

.day-today {
  font-size: 13px;
  color: var(--muted);
}

.composer {
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  padding: var(--space-xl);
  background: var(--canvas);
}

.composer-row {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.composer-row .input {
  flex: 1;
  min-width: 0;
}

.composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-base);
  margin-top: var(--space-base);
  font-size: 13px;
  color: var(--muted);
}

/* mic */

.mic-group {
  display: flex;
  align-items: stretch;
  border-radius: var(--r-pill);
  background: var(--surface-strong);
  /* The engine menu is absolutely positioned against this. */
  position: relative;
}

.mic-btn,
.mic-caret {
  height: 44px;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.mic-btn {
  padding: 0 var(--space-sm) 0 var(--space-base);
}

.mic-caret {
  padding: 0 var(--space-sm) 0 0;
  color: var(--muted);
}

.mic-group.listening {
  background: var(--primary);
}

.mic-group.listening .mic-btn,
.mic-group.listening .mic-caret {
  color: var(--on-primary);
}

.mic-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--r-full);
  background: var(--semantic-down);
}

.mic-group:not(.listening) .mic-dot {
  display: none;
}

.mic-menu {
  position: absolute;
  z-index: 30;
  margin-top: var(--space-xxs);
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-soft);
  padding: var(--space-xxs);
  min-width: 220px;
}

.mic-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: var(--r-sm);
  padding: var(--space-xs) var(--space-sm);
  cursor: pointer;
  font-size: 14px;
}

.mic-menu button:hover {
  background: var(--surface-soft);
}

.mic-menu button[aria-checked="true"] {
  color: var(--primary);
  font-weight: 600;
}

.mic-menu .menu-note {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

/* toggle */

.toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  cursor: pointer;
  user-select: none;
}

.toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  width: 36px;
  height: 20px;
  border-radius: var(--r-pill);
  background: var(--hairline);
  position: relative;
  transition: background-color 0.15s ease;
  flex: none;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: var(--r-full);
  background: var(--canvas);
  transition: transform 0.15s ease;
}

.toggle input:checked + .toggle-track {
  background: var(--primary);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(16px);
}

.toggle input:disabled + .toggle-track {
  opacity: 0.5;
}

/* task rows */

.task-list {
  margin-top: var(--space-xl);
}

.task-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-base);
  padding: var(--space-base) 0;
  border-bottom: 1px solid var(--hairline-soft);
}

.task-row:first-child {
  border-top: 1px solid var(--hairline-soft);
}

.task-time {
  flex: none;
  width: 76px;
  font-size: 13px;
  color: var(--muted);
  padding-top: 2px;
}

.task-body {
  flex: 1;
  min-width: 0;
}

.task-text {
  margin: 0;
  overflow-wrap: anywhere;
}

.task-raw {
  margin: var(--space-xxs) 0 0;
  font-size: 13px;
  color: var(--muted);
}

.task-flags {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-top: var(--space-xxs);
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 var(--space-xs);
  border-radius: var(--r-pill);
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.badge-warn {
  color: var(--semantic-down);
}

.task-actions {
  flex: none;
  display: flex;
  gap: var(--space-xs);
  opacity: 0;
  transition: opacity 0.12s ease;
}

.task-row:hover .task-actions,
.task-row:focus-within .task-actions {
  opacity: 1;
}

.task-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--r-full);
}

.task-actions button:hover {
  color: var(--ink);
  background: var(--surface-strong);
}

.task-actions button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.task-row.pending {
  opacity: 0.55;
}

.task-edit {
  width: 100%;
  min-height: 80px;
  padding: var(--space-sm);
  border: 2px solid var(--primary);
  border-radius: var(--r-md);
  resize: vertical;
  outline: none;
}

.empty {
  padding: var(--space-xxl) 0;
  color: var(--muted);
  text-align: center;
}

/* ------------------------------------------------------------ report screen */

.hero-dark {
  background: var(--surface-dark);
  color: var(--on-dark);
  padding: var(--space-section) 0;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: var(--space-xxl);
  align-items: center;
}

.hero-title {
  font-size: 44px;
  letter-spacing: -0.023em;
  line-height: 1.09;
}

.hero-sub {
  color: var(--on-dark-soft);
  margin: var(--space-base) 0 var(--space-xl);
  max-width: 46ch;
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-base);
}

.preset {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  height: 36px;
  padding: 0 var(--space-base);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--on-dark-soft);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.preset:hover {
  color: var(--on-dark);
  border-color: rgba(255, 255, 255, 0.32);
}

.preset[aria-pressed="true"] {
  background: var(--surface-dark-elevated);
  border-color: transparent;
  color: var(--on-dark);
  font-weight: 600;
}

.range-row {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
}

.range-field {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  height: 44px;
  padding: 0 var(--space-base);
  background: var(--surface-dark-elevated);
  border-radius: var(--r-pill);
  font-size: 13px;
  color: var(--on-dark-soft);
}

.range-field input[type="date"] {
  background: transparent;
  color: var(--on-dark);
  border: 0;
  outline: none;
  font-family: var(--font-mono);
  font-size: 13px;
  color-scheme: dark;
}

.btn-icon-dark {
  background: var(--surface-dark-elevated);
  color: var(--on-dark);
}

.btn-icon-dark:hover,
.btn-icon-dark:active {
  background: #23262c;
}

.hero-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.ui-card {
  background: var(--surface-dark-elevated);
  border-radius: var(--r-xl);
  padding: var(--space-xl);
  box-shadow: var(--shadow-soft);
}

.ui-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--space-base);
  font-size: 13px;
  color: var(--on-dark-soft);
}

/* Long periods scroll inside the card rather than stretching the hero. */
.ui-days {
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.ui-day {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-xs) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 14px;
}

.ui-day:last-child {
  border-bottom: 0;
}

.ui-card-foot {
  margin-top: var(--space-base);
  padding-top: var(--space-sm);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
  color: var(--on-dark-soft);
}

.ui-card-foot:empty {
  display: none;
}

.ui-day-name {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--on-dark-soft);
}

.ui-day.has-entries .ui-day-name {
  color: var(--on-dark);
}

.ui-count {
  color: var(--on-dark-soft);
}

.ui-day.has-entries .ui-count {
  color: var(--semantic-up);
}

.report-body {
  padding: var(--space-xxl) 0 var(--space-section);
}

.report-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--space-xxl);
  align-items: start;
}

.rail-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 var(--space-sm);
}

.rail-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 14px;
  color: var(--body);
}

.rail-item:hover {
  background: var(--surface-soft);
}

.rail-item[aria-current="true"] {
  background: var(--surface-strong);
  color: var(--ink);
  font-weight: 600;
}

.report-card {
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  padding: var(--space-xl);
}

.report-heading {
  font-size: 32px;
  letter-spacing: -0.0125em;
}

.report-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-base);
  margin-bottom: var(--space-base);
  flex-wrap: wrap;
}

.report-status {
  font-size: 13px;
  color: var(--muted);
}

.report-text {
  width: 100%;
  min-height: 520px;
  padding: var(--space-md);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  background: var(--canvas);
  line-height: 1.7;
  resize: vertical;
  outline: none;
}

.report-text:focus {
  border: 2px solid var(--primary);
  padding: 19px;
}

.report-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-base);
  flex-wrap: wrap;
}

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

.toasts {
  position: fixed;
  right: var(--space-lg);
  bottom: var(--space-lg);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  max-width: min(420px, calc(100vw - 48px));
}

.toast {
  background: var(--surface-dark);
  color: var(--on-dark);
  padding: var(--space-sm) var(--space-base);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-soft);
  font-size: 14px;
}

.toast.error {
  background: var(--semantic-down);
}

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

@media (max-width: 1024px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .report-grid {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-base);
  }

  .hero-dark {
    padding: var(--space-xxl) 0;
  }

  .hero-title {
    font-size: 36px;
  }

  .login-title {
    font-size: 40px;
  }

  .nav-inner {
    gap: var(--space-xs);
  }

  .nav-user {
    display: none;
  }

  /* Presets and the date fields both need to wrap cleanly at thumb width. */
  .preset {
    height: 34px;
    padding: 0 var(--space-sm);
    font-size: 13px;
  }

  .range-field {
    flex: 1 1 44%;
    min-width: 0;
    padding: 0 var(--space-sm);
  }

  .range-field input[type="date"] {
    width: 100%;
    min-width: 0;
  }

  .hero-actions .btn-lg {
    width: 100%;
  }

  .ui-card {
    padding: var(--space-md);
  }

  .ui-days {
    max-height: 260px;
  }

  /* The report is the reason you opened the tab — saved reports go beneath it. */
  .report-grid > aside {
    order: 2;
  }

  .report-grid > .report-card {
    order: 1;
  }

  .report-card {
    padding: var(--space-base);
    border-radius: var(--r-lg);
  }

  .report-heading {
    font-size: 26px;
  }

  .report-actions .btn {
    flex: 1;
  }

  .composer {
    padding: var(--space-base);
    border-radius: var(--r-lg);
  }

  .composer-row {
    flex-wrap: wrap;
  }

  .composer-row .input {
    flex-basis: 100%;
  }

  .composer-row .btn,
  .composer-row .mic-group {
    flex: 1;
  }

  .mic-btn {
    justify-content: center;
    flex: 1;
  }

  .task-time {
    display: none;
  }

  .task-actions {
    opacity: 1;
  }

  .report-text {
    min-height: 400px;
  }
}

/* Phone widths: the nav has three groups competing for one row, so the
   wordmark and the Sign out label drop to their marks. */
@media (max-width: 560px) {
  .wordmark-text,
  .signout-text {
    display: none;
  }

  .nav-tabs {
    flex: 1;
    justify-content: center;
  }

  .tab {
    padding: 0 var(--space-sm);
  }

  .day-pill {
    flex: 1;
    justify-content: center;
  }

  .composer-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-xs);
  }

  .toasts {
    right: var(--space-base);
    left: var(--space-base);
    bottom: var(--space-base);
    max-width: none;
  }

  .mic-menu {
    right: auto;
    left: 0;
    min-width: 200px;
  }

  /* The engine name doesn't fit the pill at this width — the caret still shows it. */
  .mic-engine {
    display: none;
  }

  /* Keep both date fields on one row and both arrows together on the next. */
  .range-field {
    order: 1;
    flex: 1 1 46%;
  }

  .range-row .btn-icon-dark {
    order: 2;
  }
}
