:root {
  color-scheme: light;
  --canvas: #f3f6f4;
  --surface: #ffffff;
  --surface-subtle: #eaf0ed;
  --surface-strong: #dde7e2;
  --text: #17211e;
  --text-muted: #61706a;
  --line: #d8e1dc;
  --line-strong: #bccbc4;
  --primary: #10756a;
  --primary-hover: #0b665d;
  --primary-soft: #d9efeb;
  --primary-contrast: #ffffff;
  --warning: #9a5b18;
  --warning-soft: #fff1da;
  --danger: #b42318;
  --danger-soft: #fde8e6;
  --focus: #24a99b;
  --backdrop: rgba(8, 17, 14, 0.52);
  --shadow: 0 10px 30px rgba(23, 33, 30, 0.07);
  --radius: 8px;
  --radius-small: 6px;
  --nav-height: 76px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --icon-filter: none;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --canvas: #111613;
    --surface: #1a211d;
    --surface-subtle: #222c27;
    --surface-strong: #2d3933;
    --text: #eff5f1;
    --text-muted: #a5b3ac;
    --line: #334039;
    --line-strong: #4a5b52;
    --primary: #48bcae;
    --primary-hover: #62cabc;
    --primary-soft: #173a35;
    --primary-contrast: #09231f;
    --warning: #e5a75f;
    --warning-soft: #3d2e1b;
    --danger: #ff9188;
    --danger-soft: #402421;
    --focus: #70d8cb;
    --backdrop: rgba(0, 0, 0, 0.66);
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
    --icon-filter: invert(1);
  }
}

body[data-theme="light"] {
  color-scheme: light;
  --canvas: #f3f6f4;
  --surface: #ffffff;
  --surface-subtle: #eaf0ed;
  --surface-strong: #dde7e2;
  --text: #17211e;
  --text-muted: #61706a;
  --line: #d8e1dc;
  --line-strong: #bccbc4;
  --primary: #10756a;
  --primary-hover: #0b665d;
  --primary-soft: #d9efeb;
  --primary-contrast: #ffffff;
  --warning: #9a5b18;
  --warning-soft: #fff1da;
  --danger: #b42318;
  --danger-soft: #fde8e6;
  --focus: #24a99b;
  --backdrop: rgba(8, 17, 14, 0.52);
  --shadow: 0 10px 30px rgba(23, 33, 30, 0.07);
  --icon-filter: none;
}

body[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #111613;
  --surface: #1a211d;
  --surface-subtle: #222c27;
  --surface-strong: #2d3933;
  --text: #eff5f1;
  --text-muted: #a5b3ac;
  --line: #334039;
  --line-strong: #4a5b52;
  --primary: #48bcae;
  --primary-hover: #62cabc;
  --primary-soft: #173a35;
  --primary-contrast: #09231f;
  --warning: #e5a75f;
  --warning-soft: #3d2e1b;
  --danger: #ff9188;
  --danger-soft: #402421;
  --focus: #70d8cb;
  --backdrop: rgba(0, 0, 0, 0.66);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
  --icon-filter: invert(1);
}

html {
  box-sizing: border-box;
  min-width: 320px;
  min-height: 100%;
  overflow-x: hidden;
  background: var(--canvas);
}

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

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  overflow-x: hidden;
  background: var(--canvas);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

a {
  color: inherit;
}

img {
  display: block;
  width: 20px;
  height: 20px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 1.55rem;
  line-height: 1.2;
  font-weight: 780;
}

h2 {
  font-size: 1.12rem;
  line-height: 1.3;
  font-weight: 760;
}

h3 {
  font-size: 1rem;
  line-height: 1.35;
  font-weight: 730;
}

.muted,
.helper-text {
  color: var(--text-muted);
}

.helper-text {
  font-size: 0.82rem;
  font-weight: 520;
}

.eyebrow,
.section-kicker {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 760;
  text-transform: uppercase;
}

.app-shell {
  min-height: 100dvh;
  padding: max(14px, env(safe-area-inset-top)) 14px calc(172px + env(safe-area-inset-bottom));
}

.top-bar {
  width: min(1120px, 100%);
  margin: 0 auto 14px;
}

.title-block {
  display: grid;
  gap: 3px;
}

.view {
  width: min(1120px, 100%);
  min-width: 0;
  margin: 0 auto;
  outline: none;
}

.view:focus-visible {
  outline: none;
}

.screen-stack,
.settings-stack {
  display: grid;
  gap: 14px;
}

.add-layout {
  display: grid;
  width: min(720px, 100%);
  margin-inline: auto;
  gap: 12px;
}

.task-panel,
.report-panel,
.settings-section,
.rate-hero,
.summary-hero,
.custom-report {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.task-panel,
.settings-section,
.custom-report {
  padding: 16px;
}

.add-panel {
  display: grid;
  gap: 18px;
}

.section-heading,
.screen-tools,
.settings-heading,
.sheet-header,
.day-heading,
.entry-title-row,
.entry-pay {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.section-heading > *,
.screen-tools > *,
.settings-heading > *,
.day-heading > *,
.entry-title-row > * {
  min-width: 0;
}

.compact-heading {
  align-items: end;
}

.date-control {
  display: grid;
  width: min(176px, 100%);
  gap: 5px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.field,
.field-group,
.sheet-form,
.form-grid,
.settings-form {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field,
.field-group {
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 680;
}

.field-group {
  margin: 0;
  padding: 0;
  border: 0;
}

.field-group legend {
  margin-bottom: 8px;
  padding: 0;
}

.field input,
.field select,
.field textarea,
.date-control input,
.tag-input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  font-weight: 560;
}

.field input,
.field select,
.field textarea,
.date-control input {
  padding: 11px 12px;
}

.field textarea {
  min-height: 102px;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder,
.tag-input input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.quick-hours {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.hour-button {
  min-width: 0;
  min-height: 50px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--text);
  font-weight: 760;
  transition: transform 140ms var(--ease-out), border-color 180ms ease, background-color 180ms ease;
}

.hour-button.active {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-contrast);
}

.all-hours-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 50px;
  margin-top: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface-subtle);
  color: var(--text);
  text-align: start;
}

.all-hours-button > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 720;
}

.hour-selection {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-choices,
.filter-badges,
.tag-list,
.button-row,
.summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-chip,
.filter-badges button,
.tag-badge,
.status-badge {
  border-radius: 999px;
}

.choice-chip {
  min-height: 44px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  background: var(--surface-subtle);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 680;
}

.combobox-field {
  position: relative;
}

.tag-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  cursor: text;
}

.tag-input input {
  flex: 1 1 150px;
  min-width: 100px;
  min-height: 44px;
  padding: 2px 4px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
}

.selected-tags {
  display: contents;
}

.tag-token {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  gap: 3px;
  padding: 3px 4px 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 700;
}

.tag-token button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
}

.tag-token img {
  width: 15px;
  height: 15px;
  filter: var(--icon-filter);
}

.suggestion-menu {
  position: absolute;
  z-index: 20;
  inset-inline: 0;
  top: calc(100% - 26px);
  display: grid;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.suggestion-menu button {
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  text-align: start;
}

.optional-details {
  border-top: 1px solid var(--line);
}

.optional-details summary,
.audit-disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  color: var(--text);
  font-weight: 700;
}

.optional-details summary::-webkit-details-marker,
.audit-disclosure > summary::-webkit-details-marker {
  display: none;
}

.optional-details summary img,
.audit-disclosure > summary > img {
  filter: var(--icon-filter);
  transition: transform 180ms var(--ease-out);
}

.optional-details[open] summary img,
.audit-disclosure[open] > summary > img {
  transform: rotate(180deg);
}

.optional-details[open] .field {
  margin-top: 8px;
}

.save-bar {
  position: fixed;
  right: 14px;
  bottom: calc(var(--nav-height) + 18px + env(safe-area-inset-bottom));
  left: 14px;
  z-index: 25;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 1.2fr);
  gap: 8px;
  width: min(692px, calc(100% - 28px));
  margin-inline: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--canvas);
  box-shadow: var(--shadow);
}

.day-total {
  display: grid;
  align-content: center;
  min-width: 0;
  padding: 4px 8px;
}

.day-total span {
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 650;
}

.day-total strong {
  overflow: hidden;
  font-size: 0.98rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.text-button {
  min-height: 48px;
  border-radius: var(--radius-small);
  padding: 9px 14px;
  font-weight: 730;
  text-decoration: none;
  transition: transform 140ms var(--ease-out), background-color 180ms ease, border-color 180ms ease;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
}

.primary-button {
  width: 100%;
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-contrast);
}

.secondary-button {
  background: var(--surface-subtle);
  color: var(--text);
}

.ghost-button {
  background: transparent;
  color: var(--text);
}

.danger-button {
  border-color: var(--danger);
  background: var(--danger);
  color: #ffffff;
}

.text-button {
  min-height: 44px;
  padding-inline: 6px;
  border: 0;
  background: transparent;
  color: var(--primary);
}

.fit-button,
.compact-button {
  width: auto;
}

.compact-button {
  min-height: 44px;
  padding-block: 7px;
}

.icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--text);
}

:is(.primary-button, .secondary-button, .ghost-button, .danger-button, .icon-button, .text-button) img,
.settings-icon img,
.warning img,
.nav-icon img,
.auth-mark img,
.brand-mark img {
  filter: var(--icon-filter);
}

.field-error,
.form-error {
  color: var(--danger);
  font-size: 0.84rem;
  font-weight: 650;
}

.form-error {
  padding: 10px 12px;
  border: 1px solid var(--danger);
  border-radius: var(--radius-small);
  background: var(--danger-soft);
}

.warning {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--warning);
  border-radius: var(--radius);
  background: var(--warning-soft);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 620;
}

.warning img {
  flex: 0 0 20px;
}

.compact-warning {
  padding: 10px 12px;
}

.screen-tools {
  align-items: end;
}

.filter-badges button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 650;
}

.filter-badges img {
  width: 16px;
  height: 16px;
  filter: var(--icon-filter);
}

.day-list,
.day-group,
.entry-list,
.rate-timeline,
.recent-entry-list,
.audit-log {
  display: grid;
  gap: 10px;
}

.day-group {
  gap: 8px;
}

.day-heading {
  align-items: end;
  padding: 4px 2px;
}

.day-heading > div {
  display: grid;
  gap: 1px;
}

.day-heading > div:last-child {
  text-align: end;
}

.day-heading span {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.entry-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.entry-main {
  min-width: 0;
}

.entry-title-row {
  align-items: baseline;
}

.entry-title-row h3 {
  overflow-wrap: anywhere;
}

.entry-title-row strong {
  flex: 0 0 auto;
}

.tag-list {
  margin-top: 7px;
  gap: 5px;
}

.tag-badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 3px 9px;
  background: var(--surface-subtle);
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.entry-note {
  margin-top: 8px;
  overflow-wrap: anywhere;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.entry-pay {
  align-items: center;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 0.82rem;
}

.entry-pay strong {
  color: var(--text);
}

.entry-menu-button {
  border-color: transparent;
  background: transparent;
}

.loading-panel,
.empty-state,
.empty-inline {
  color: var(--text-muted);
}

.loading-panel {
  display: grid;
  min-height: 140px;
  place-items: center;
  gap: 10px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.loading-line {
  width: 72px;
  height: 4px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface-strong);
}

.loading-line::after {
  content: "";
  display: block;
  width: 42%;
  height: 100%;
  background: var(--primary);
  animation: loading-slide 900ms var(--ease-out) infinite alternate;
}

@keyframes loading-slide {
  to { transform: translateX(100%); }
}

.empty-state {
  display: grid;
  min-height: 230px;
  place-items: center;
  align-content: center;
  gap: 9px;
  padding: 28px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  text-align: center;
}

.empty-state > img {
  width: 28px;
  height: 28px;
  filter: var(--icon-filter);
}

.empty-state h2,
.empty-state h3 {
  color: var(--text);
}

.empty-inline {
  padding: 16px 2px;
  font-size: 0.9rem;
}

.segmented-control {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-subtle);
}

.segmented-control button,
.segmented-control label span {
  display: grid;
  min-height: 44px;
  place-items: center;
  padding: 6px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
}

.segmented-control button.active,
.segmented-control label:has(input:checked) span {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(23, 33, 30, 0.08);
}

.summary-hero,
.rate-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
}

.summary-hero > div:first-child {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  gap: 0 7px;
}

.summary-hero p,
.rate-hero p {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 680;
}

.summary-hero > div:first-child > strong {
  font-size: clamp(2.4rem, 10vw, 4rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.summary-hero > div:first-child > span {
  color: var(--text-muted);
  font-weight: 700;
}

.summary-pay {
  display: grid;
  gap: 1px;
  text-align: end;
}

.summary-pay span,
.summary-pay small {
  color: var(--text-muted);
}

.summary-pay strong {
  font-size: 1.35rem;
}

.report-grid {
  display: grid;
  gap: 14px;
}

.report-panel {
  padding: 15px;
}

.bar-list {
  display: grid;
  gap: 13px;
  margin-top: 14px;
}

.bar-row {
  display: grid;
  gap: 6px;
}

.bar-row > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.86rem;
}

.bar-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-row strong {
  flex: 0 0 auto;
}

progress {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border: 0;
  border-radius: 5px;
  background: var(--surface-strong);
  color: var(--primary);
}

progress::-webkit-progress-bar {
  background: var(--surface-strong);
}

progress::-webkit-progress-value {
  background: var(--primary);
}

progress::-moz-progress-bar {
  background: var(--primary);
}

.plain-section {
  padding-top: 4px;
}

.custom-report {
  display: grid;
  gap: 14px;
}

.compact-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.compact-metrics > div {
  display: grid;
  min-width: 0;
  gap: 2px;
  padding: 10px;
  border-radius: var(--radius-small);
  background: var(--surface-subtle);
}

.compact-metrics span {
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 650;
}

.compact-metrics strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.recent-entry:last-child {
  border-bottom: 0;
}

.recent-entry > div {
  display: grid;
  min-width: 0;
}

.recent-entry > div:last-child {
  flex: 0 0 auto;
  text-align: end;
}

.recent-entry span {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.rate-hero > div {
  display: grid;
}

.rate-hero > div > strong {
  font-size: 2rem;
  font-variant-numeric: tabular-nums;
}

.rate-hero > div > span {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.rate-timeline {
  position: relative;
  margin-top: 10px;
}

.rate-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  padding: 14px 14px 14px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.rate-row.current {
  border-color: var(--primary);
}

.timeline-dot {
  position: absolute;
  top: 20px;
  left: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line-strong);
}

.rate-row.current .timeline-dot {
  background: var(--primary);
}

.rate-row-main > div {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.rate-row-main p {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.status-badge {
  min-height: 24px;
  background: var(--primary-soft);
  color: var(--text);
}

.rate-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  padding-top: 4px;
}

.danger-icon {
  color: var(--danger);
}

.settings-stack {
  width: min(820px, 100%);
  margin-inline: auto;
}

.settings-form {
  gap: 14px;
}

.settings-section {
  display: grid;
  gap: 16px;
}

.settings-heading {
  justify-content: flex-start;
}

.settings-heading h2,
.audit-disclosure .settings-heading strong {
  color: var(--text);
  font-size: 1.05rem;
}

.settings-heading p,
.audit-disclosure .settings-heading small {
  display: block;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 520;
}

.settings-icon,
.brand-mark,
.auth-mark {
  display: grid;
  place-items: center;
  border-radius: var(--radius-small);
  background: var(--surface-subtle);
}

.settings-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
}

.theme-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
}

.theme-control label {
  cursor: pointer;
}

.settings-save {
  position: sticky;
  z-index: 8;
  bottom: calc(var(--nav-height) + 6px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow);
}

.compact-field-width {
  width: min(260px, 100%);
}

.danger-text {
  color: var(--danger);
}

.download-grid {
  display: grid;
  gap: 8px;
}

.danger-zone {
  display: grid;
  gap: 10px;
  padding-top: 15px;
  border-top: 1px solid var(--danger);
}

.danger-zone p {
  color: var(--text-muted);
  font-size: 0.86rem;
}

.audit-disclosure > summary {
  margin: -4px 0;
}

.audit-disclosure[open] .audit-log {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.audit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.audit-row:last-child {
  border-bottom: 0;
}

.audit-row > div {
  display: grid;
}

.audit-row span,
.audit-row code {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.app-navigation {
  position: fixed;
  z-index: 30;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 7px 8px max(7px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 -8px 24px rgba(23, 33, 30, 0.07);
}

.nav-brand {
  display: none;
}

.nav-items {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2px;
}

.nav-items > button {
  display: grid;
  min-width: 0;
  min-height: 58px;
  place-items: center;
  align-content: center;
  gap: 2px;
  padding: 3px 2px;
  border: 0;
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.nav-icon {
  display: grid;
  width: 34px;
  height: 28px;
  place-items: center;
  border-radius: 5px;
}

.nav-items > button.active {
  color: var(--text);
}

.nav-items > button.active:not(.nav-add) .nav-icon {
  background: var(--primary-soft);
}

.nav-items > .nav-add {
  transform: translateY(-9px);
}

.nav-items > .nav-add .nav-icon {
  width: 50px;
  height: 50px;
  border: 3px solid var(--surface);
  border-radius: var(--radius);
  background: var(--primary);
  box-shadow: var(--shadow);
}

.nav-items > .nav-add .nav-icon img {
  width: 24px;
  height: 24px;
  filter: none;
}

.nav-items > .nav-add.active .nav-icon {
  background: var(--primary-hover);
}

.toast {
  position: fixed;
  z-index: 80;
  right: 14px;
  bottom: calc(92px + env(safe-area-inset-bottom));
  left: 14px;
  display: none;
  max-width: 520px;
  margin-inline: auto;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--text);
  color: var(--surface);
  box-shadow: var(--shadow);
  font-weight: 650;
}

.toast.show {
  display: block;
  animation: toast-in 180ms var(--ease-out);
}

.toast[data-type="error"] {
  background: var(--danger);
  color: #ffffff;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom));
  background: var(--canvas);
}

.auth-panel {
  display: grid;
  width: min(410px, 100%);
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-mark {
  width: 48px;
  height: 48px;
}

.auth-mark img {
  width: 24px;
  height: 24px;
}

.auth-copy {
  display: grid;
  gap: 6px;
}

.password-control {
  position: relative;
  display: block;
}

.password-control input {
  padding-right: 52px;
}

.password-toggle {
  position: absolute;
  top: 2px;
  right: 2px;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
}

.password-toggle img {
  filter: var(--icon-filter);
}

dialog.sheet-dialog {
  width: 100%;
  max-width: none;
  max-height: min(88dvh, 820px);
  margin: auto 0 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

dialog.sheet-dialog::backdrop {
  background: var(--backdrop);
}

dialog.sheet-dialog[open] .sheet-shell {
  animation: sheet-in 210ms var(--ease-out);
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.sheet-shell {
  display: grid;
  max-height: min(88dvh, 820px);
  grid-template-rows: auto minmax(0, 1fr);
}

.sheet-header {
  align-items: center;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

.sheet-content {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 14px max(18px, env(safe-area-inset-bottom));
}

.sheet-form {
  gap: 14px;
}

.sheet-copy {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.all-hours-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 18px;
}

.action-list {
  display: grid;
  gap: 4px;
}

.action-list button {
  display: flex;
  align-items: center;
  min-height: 52px;
  gap: 12px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--text);
  font-weight: 680;
  text-align: start;
}

.action-list img {
  filter: var(--icon-filter);
}

.action-list .danger-action {
  color: var(--danger);
}

.split-actions > * {
  flex: 1 1 140px;
}

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

.field:has(input:focus-visible, select:focus-visible, textarea:focus-visible) > span:first-child,
.field-group:has(button:focus-visible) > legend {
  color: var(--text);
}

@media (hover: hover) and (pointer: fine) {
  .primary-button:hover {
    border-color: var(--primary-hover);
    background: var(--primary-hover);
  }

  .secondary-button:hover,
  .hour-button:hover,
  .choice-chip:hover,
  .all-hours-button:hover,
  .suggestion-menu button:hover,
  .action-list button:hover {
    border-color: var(--line-strong);
    background: var(--surface-strong);
  }

  .nav-items > button:hover .nav-icon {
    background: var(--surface-subtle);
  }
}

:is(button, .primary-button, .secondary-button, .danger-button):active {
  transform: scale(0.98);
}

@media (min-width: 560px) {
  .quick-hours {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .download-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 720px) {
  .app-shell {
    padding-inline: 22px;
  }

  .save-bar {
    right: 22px;
    left: 22px;
    width: min(720px, calc(100% - 44px));
  }

  .two-columns,
  .report-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  dialog.sheet-dialog {
    width: min(620px, calc(100% - 32px));
    margin: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }

  .sheet-content {
    padding: 20px;
  }

  .all-hours-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .rate-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
  }

  .rate-actions {
    grid-column: auto;
    padding-top: 0;
  }
}

@media (min-width: 900px) {
  .app-shell {
    display: grid;
    min-height: 100dvh;
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    padding: 0;
  }

  .app-navigation {
    position: sticky;
    top: 0;
    right: auto;
    bottom: auto;
    left: auto;
    display: flex;
    height: 100dvh;
    grid-column: 1;
    grid-row: 1 / 3;
    flex-direction: column;
    gap: 24px;
    padding: 22px 14px;
    border-top: 0;
    border-right: 1px solid var(--line);
    background: var(--surface);
    box-shadow: none;
  }

  .nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 6px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
  }

  .nav-brand > span:last-child {
    display: grid;
    min-width: 0;
  }

  .nav-brand small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-brand strong {
    display: -webkit-box;
    overflow: hidden;
    line-height: 1.2;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .nav-brand small {
    color: var(--text-muted);
  }

  .nav-items {
    display: flex;
    flex-direction: column;
    gap: 5px;
  }

  .nav-items > button {
    display: flex;
    min-height: 48px;
    place-items: initial;
    justify-content: flex-start;
    gap: 10px;
    padding: 6px 10px;
    font-size: 0.9rem;
  }

  .nav-items > button[data-view="add"] {
    order: -1;
  }

  .nav-items > .nav-add {
    transform: none;
  }

  .nav-items > .nav-add .nav-icon,
  .nav-icon {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 6px;
    box-shadow: none;
  }

  .nav-items > .nav-add .nav-icon img {
    width: 20px;
    height: 20px;
  }

  .nav-items > button.active {
    background: var(--surface-subtle);
  }

  .nav-items > .nav-add.active {
    background: var(--primary);
    color: var(--primary-contrast);
  }

  .nav-items > .nav-add.active .nav-icon {
    background: transparent;
  }

  .top-bar {
    width: min(1184px, 100%);
    grid-column: 2;
    margin: 0 auto;
    padding: 28px 32px 14px;
  }

  .view {
    width: min(1184px, 100%);
    grid-column: 2;
    margin: 0 auto;
    padding: 0 32px 40px;
  }

  .save-bar,
  .settings-save {
    bottom: 16px;
  }

  .save-bar {
    position: sticky;
    right: auto;
    left: auto;
    z-index: 10;
    width: auto;
  }

  .toast {
    right: 24px;
    bottom: 24px;
    left: auto;
    width: min(440px, calc(100% - 48px));
  }
}

@media (min-width: 1180px) {
  .day-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

@media (max-width: 479px) {
  .compact-heading,
  .screen-tools,
  .rate-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .date-control {
    width: 100%;
  }

  .save-bar {
    grid-template-columns: minmax(106px, 0.8fr) minmax(140px, 1.2fr);
  }

  .summary-hero {
    align-items: flex-end;
  }

  .summary-pay strong {
    font-size: 1.12rem;
  }

  .compact-metrics {
    grid-template-columns: 1fr;
  }

  .all-hours-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
