:root {
  color-scheme: light;
}

.theme-toggle {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--white);
  color: var(--ink);
  font-size: 10px;
  font-weight: 800;
  touch-action: manipulation;
}

.theme-toggle [data-theme-icon] {
  width: 14px;
  color: var(--forest);
  font-size: 14px;
}

.toggle-setting {
  margin-bottom: 16px;
}

.report-trend {
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.metric .report-trend.positive {
  color: #23775a;
}

.metric .report-trend.negative {
  color: #b4493a;
}

.metric .report-trend.neutral {
  color: #78837f;
}

.report-trend > span[aria-hidden="true"] {
  color: inherit !important;
  font-size: .78em;
  line-height: 1;
}

/* Improve application readability without changing the invoice document. */
.app-shell .workspace {
  font-size: 12px;
}

.app-shell .sidebar nav p,
.app-shell .topbar small,
.app-shell .eyebrow,
.auth-shell .eyebrow,
.modal-form .eyebrow {
  font-size: 11px;
}

.app-shell .sidebar a,
.app-shell .sidebar button {
  font-size: 14px;
}

.app-shell .sidebar a em,
.app-shell .pill,
.app-shell .metric small,
.app-shell .tiny,
.app-shell .attention-row small,
.app-shell .data-table small,
.app-shell .timesheet small,
.app-shell .inline-form select,
.app-shell .compliance,
.app-shell .vat-input button,
.app-shell .registry-link,
.app-shell .entity-button,
.app-shell .action-menu summary,
.app-shell .action-menu button {
  font-size: 10px;
}

.app-shell .client-card small,
.app-shell .quick-time button,
.app-shell .report-compare small,
.app-shell .toggle-setting small {
  font-size: 9px;
}

.app-shell .saved,
.app-shell .outline,
.app-shell .metric > span,
.app-shell .timer-panel label,
.app-shell .settings-card label,
.app-shell .attention .panel-head a,
.app-shell .attention-row,
.app-shell .empty p,
.app-shell .timesheet th,
.app-shell .timesheet input,
.app-shell .timesheet .row-total,
.app-shell .timesheet tfoot td,
.app-shell .client-card > p,
.app-shell .client-card b,
.app-shell .client-card footer,
.app-shell .data-table td,
.app-shell .week-nav .current-week,
.app-shell .report-controls > label,
.app-shell .report-range,
.app-shell .theme-toggle,
.app-shell .settings-save-bar span,
.modal-form label,
.auth-shell .auth-form label,
.auth-shell .auth-proof,
.auth-shell .auth-switch {
  font-size: 11px;
}

.app-shell .subtle,
.app-shell .alert,
.app-shell .settings-save-bar strong {
  font-size: 13px;
}

.app-shell .data-table th {
  font-size: 10px;
}

.settings-save-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 20px;
}

.settings-save-bar > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-save-bar strong {
  color: var(--ink);
  font-size: 12px;
}

.settings-save-bar span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.settings-save-bar .primary {
  flex: 0 0 auto;
}

.appearance-card {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  align-items: end;
  gap: 24px;
}

.appearance-card > label {
  margin-top: 0 !important;
}

.appearance-card > label small {
  color: var(--muted);
  font-weight: 400;
  line-height: 1.45;
}

.bank-accounts-card {
  grid-column: 1 / -1;
}

.bank-accounts-card .panel-head {
  align-items: center;
}

.bank-accounts-card .panel-head .subtle {
  max-width: 620px;
  margin-top: 5px;
  line-height: 1.45;
}

.bank-account-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.bank-account-row {
  display: grid;
  grid-template-columns: minmax(170px, .75fr) minmax(260px, 1.25fr) minmax(190px, 1fr) auto auto;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f9fbfa;
}

.bank-account-row label {
  margin-top: 0;
}

.bank-account-default {
  min-height: 40px;
  flex-direction: row !important;
  align-items: center;
  gap: 7px !important;
  padding: 0 4px;
  color: var(--ink) !important;
}

.bank-account-default input {
  width: 17px;
  height: 17px;
  min-height: 0;
  accent-color: var(--forest);
}

.bank-account-row > button {
  min-height: 40px;
}

.entity-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 6px;
}

.entity-actions form {
  margin: 0;
}

.data-table td > .entity-actions {
  width: 100%;
  justify-content: flex-start;
}

.avatar {
  color: #174c40;
}

.entity-button {
  min-height: 31px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--white);
  color: var(--forest);
  font-size: 9px;
  font-weight: 800;
}

.entity-button.danger {
  border-color: #e4c7c0;
  background: #fff5f2;
  color: #973f2e;
}

.entity-button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.client-card.archived {
  opacity: 1;
  border-style: dashed;
  background: #f1f4f2;
}

.data-table tr.archived-record td {
  background: #f1f4f2;
  color: #76827e;
}

.client-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #edf5f2;
  --muted: #a7b6b1;
  --line: #314740;
  --paper: #0c1513;
  --white: #14211e;
  --forest: #77c9ac;
  --mint: #15372e;
  --blue: #172f3a;
  --violet: #29253a;
  --sand: #392f20;
  --amber: #e2b66d;
}

html[data-theme="dark"] body,
html[data-theme="dark"] .invoice-body {
  background: var(--paper);
  color: var(--ink);
}

html[data-theme="dark"] .topbar {
  border-color: var(--line);
  background: rgba(12, 21, 19, .94);
}

html[data-theme="dark"] .avatar {
  color: #174c40;
}

html[data-theme="dark"] .timer-button:not(.stop) {
  color: #174c40;
}

html[data-theme="dark"] .panel,
html[data-theme="dark"] .auth-panel,
html[data-theme="dark"] .auth-form,
html[data-theme="dark"] dialog,
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .outline,
html[data-theme="dark"] .week-nav,
html[data-theme="dark"] .week-nav a,
html[data-theme="dark"] .quick-time button,
html[data-theme="dark"] .theme-toggle,
html[data-theme="dark"] .entity-button,
html[data-theme="dark"] .action-menu-trigger,
html[data-theme="dark"] .action-menu-popover,
html[data-theme="dark"] .action-menu-popover::before,
html[data-theme="dark"] dialog button:not(.primary),
html[data-theme="dark"] .vat-input button,
html[data-theme="dark"] .timesheet-footer button {
  border-color: var(--line);
  background: var(--white);
  color: var(--ink);
}

html[data-theme="dark"] .menu-button {
  border-color: #416057;
  background: #20332e;
  color: #f4faf8;
}

html[data-theme="dark"] .quick-time button:hover,
html[data-theme="dark"] .quick-time button:focus-visible {
  border-color: #77c9ac;
  background: #285446;
  color: #fff;
  outline: none;
}

html[data-theme="dark"] .quick-time button:active {
  background: #34705d;
  transform: translateY(1px);
}

html[data-theme="dark"] .primary {
  background: #246f5d;
  color: #fff !important;
}

html[data-theme="dark"] .primary:hover {
  background: #2d826e;
}

html[data-theme="dark"] .data-table th,
html[data-theme="dark"] .timesheet th,
html[data-theme="dark"] .timesheet tfoot td,
html[data-theme="dark"] .header-row,
html[data-theme="dark"] .totals-row {
  background: #101b18;
  color: #adbbb7;
}

html[data-theme="dark"] .data-table td,
html[data-theme="dark"] .timesheet td,
html[data-theme="dark"] .table-row,
html[data-theme="dark"] .attention-row {
  border-color: #263a34;
  color: #c6d2ce;
}

html[data-theme="dark"] .client-card.archived,
html[data-theme="dark"] .data-table tr.archived-record td {
  border-color: #49635b;
  background: #1b2925;
  color: #9fada8;
}

html[data-theme="dark"] .time-cell.today,
html[data-theme="dark"] .timesheet .today,
html[data-theme="dark"] .has-invoiced-time,
html[data-theme="dark"] .invoiced-time {
  background: #173029;
}

html[data-theme="dark"] .metric span,
html[data-theme="dark"] .metric small,
html[data-theme="dark"] .subtle,
html[data-theme="dark"] .tiny,
html[data-theme="dark"] .client-card > p,
html[data-theme="dark"] .client-card footer {
  color: var(--muted);
}

html[data-theme="dark"] .pill,
html[data-theme="dark"] .status-pill {
  border-color: #3d524c;
  background: #1b2a26;
  color: #bdc9c5;
}

html[data-theme="dark"] .pill.green,
html[data-theme="dark"] .status-pill.green {
  border-color: #3c6d5e;
  background: #193c32;
  color: #9ce0c7;
}

html[data-theme="dark"] .pill.amber,
html[data-theme="dark"] .status-pill.amber {
  border-color: #695433;
  background: #392e1f;
  color: #f0c980;
}

html[data-theme="dark"] .action-menu-popover button {
  color: #d4dfdb;
}

html[data-theme="dark"] .action-menu-popover button:hover,
html[data-theme="dark"] .action-menu-popover button:focus-visible {
  background: #20322d;
}

html[data-theme="dark"] .action-menu-popover form + form {
  border-color: var(--line);
}

html[data-theme="dark"] .entity-button.danger,
html[data-theme="dark"] .action-menu-popover button.danger {
  border-color: #68443d;
  background: #34221f;
  color: #ffb3a3;
}

html[data-theme="dark"] .modal-form,
html[data-theme="dark"] .settings-card,
html[data-theme="dark"] .timer-panel,
html[data-theme="dark"] .attention {
  color: var(--ink);
}

html[data-theme="dark"] .bank-account-row {
  background: #101b18;
}

html[data-theme="dark"] .metric .report-trend.positive {
  color: #72d0ad;
}

html[data-theme="dark"] .metric .report-trend.negative {
  color: #ff9a88;
}

html[data-theme="dark"] .metric .report-trend.neutral {
  color: #a7b6b1;
}

html[data-theme="dark"] .toggle-setting,
html[data-theme="dark"] .settings-toggle {
  border-color: var(--line);
  background: #101b18;
  color: var(--ink);
}

html[data-theme="dark"] .invoice-preview {
  background: #101b18;
}

html[data-theme="dark"] .invoice-actions {
  color: var(--ink);
}

html[data-theme="dark"] .invoice-sheet {
  background: #fff;
  color: #333;
  color-scheme: light;
}

/* Keep examples readable while entered VAT IDs remain normalized to uppercase. */
input[name="vat_id"]::placeholder,
input[name="tax_id"]::placeholder,
.vat-input input::placeholder {
  text-transform: none;
}

.cookie-notice {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10000;
  width: min(640px, calc(100% - 40px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 16px 18px;
  border: 1px solid var(--line, var(--landing-line, #dce5e1));
  border-radius: 15px;
  background: var(--white, var(--landing-card, #fff));
  color: var(--ink, var(--landing-ink, #14211e));
  box-shadow: 0 18px 55px rgba(20, 48, 40, .18);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
}

.cookie-notice strong {
  display: block;
  margin-bottom: 3px;
  font-size: 14px;
}

.cookie-notice p {
  max-width: 445px;
  margin: 0;
  color: var(--muted, var(--landing-muted, #64726d));
  font-size: 13px;
}

.cookie-notice-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.cookie-notice-actions a {
  color: var(--forest, var(--landing-forest, #174c40));
  font-size: 12px;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cookie-notice-actions button {
  min-height: 38px;
  padding: 8px 14px;
  border: 0;
  border-radius: 9px;
  background: var(--forest, var(--landing-forest, #174c40));
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

html[data-theme="dark"] .cookie-notice {
  border-color: #3a514a;
  background: #14211e;
  color: #edf5f2;
  box-shadow: 0 18px 55px rgba(0, 0, 0, .38);
}

html[data-theme="dark"] .cookie-notice p {
  color: #a7b6b1;
}

html[data-theme="dark"] .cookie-notice-actions a {
  color: #8ddabd;
}

html[data-theme="dark"] .cookie-notice-actions button {
  background: #d6f36b;
  color: #174c40;
}

/* Native select controls must remain inside narrow dialogs on mobile. */
dialog label,
dialog .form-grid > label,
dialog .vat-input {
  min-width: 0;
}

dialog select {
  width: 100%;
  max-width: 100%;
}

@media (max-width: 1100px) {
  .bank-account-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 740px) {
  .theme-toggle [data-theme-label] {
    display: none;
  }

  .theme-toggle {
    width: 36px;
    padding: 7px;
  }

  .bank-accounts-card .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .appearance-card {
    grid-template-columns: 1fr;
  }

  .bank-account-row {
    grid-template-columns: 1fr;
  }

  .bank-account-default {
    min-height: 28px;
  }

  .settings-save-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-save-bar .primary {
    width: 100%;
  }

  .cookie-notice {
    right: 12px;
    bottom: 12px;
    width: calc(100% - 24px);
    align-items: stretch;
    flex-direction: column;
    gap: 13px;
    padding: 15px;
  }

  .cookie-notice-actions {
    justify-content: space-between;
  }
}

@media print {
  .theme-toggle,
  .cookie-notice {
    display: none !important;
  }

  html[data-theme="dark"] body,
  html[data-theme="dark"] .invoice-body {
    background: #fff;
    color: #333;
  }
}
