/* Checkout app themes — use var(--token) in page styles */

:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg-page: #121212;
  --bg-surface: #1e1e1e;
  --bg-surface-alt: #1a1a1a;
  --bg-muted: #222;
  --bg-muted-darker: #2a2a2a;
  --bg-input: #111;
  --bg-btn: #333;
  --bg-btn-hover: #444;
  --bg-toolbar: #1f1f1f;
  --bg-modal: #161616;
  --bg-header: #1a1a1a;
  --bg-card: #1e1e1e;
  --bg-tooltip: rgba(0, 0, 0, 0.8);
  --bg-row-hover: #1e1e1e;
  --bg-message-success: #223322;
  --bg-snapshot: #1e2a24;

  --text: #fff;
  --text-muted: #aaa;
  --text-muted-light: #bbb;
  --text-dim: #888;
  --text-faint: #777;
  --text-dimmer: #666;
  --text-subtle: #ccc;
  --text-secondary: #ddd;
  --text-note: #cfcfcf;
  --text-start-end: #bfbfbf;
  --text-label: #ccc;
  --text-placeholder: #666;
  --text-on-today: #fff;
  --text-error: #ff6666;
  --text-error-bright: #f55;
  --text-delete-hover: #ff7777;
  --text-warning: #f39c12;
  --text-planned: #7dcea0;
  --text-planned-em: #7dcea0;
  --text-snapshot: #a8e6cf;
  --text-snapshot-ts: #7d9e8f;
  --text-signature: #aaa;
  --text-push-success: #81c784;
  --text-push-error: #e57373;

  --border: #444;
  --border-light: #333;
  --border-strong: #555;
  --border-input: #444;
  --border-card: #333;
  --border-divider: #222;
  --border-signature: #666;
  --border-focus: #6f42c1;

  --link: #7ec8ff;
  --link-action: #7ec8ff;
  --overlay: rgba(0, 0, 0, 0.65);
  --shadow-modal: 0 10px 30px rgba(0, 0, 0, 0.7);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.3);

  --btn-primary: #007bff;
  --btn-danger: #c00;
  --btn-danger-hover: #f00;
  --btn-success: #28a745;
  --btn-success-alt: #4caf50;
  --btn-neutral: #555;
  --btn-neutral-dark: #666;
  --btn-cancel: #444;
  --btn-menu: #c00;
  --btn-admin: #6a1b9a;
  --btn-push: #2e7d32;
  --btn-sick: #c0392b;
  --btn-dayoff: #f39c12;
  --btn-delete: #aa0000;
  --btn-copy: #34495e;
  --btn-copy-hover: #2980b9;
  --btn-checkout: #27ae60;
  --btn-checkout-hover: #43a047;
  --btn-checkout-active: #2e7d32;
  --btn-paycheck: #6f42c1;
  --btn-paycheck-border: #5a32a8;
  --btn-export: #007bff;
  --btn-export-border: #0069d9;

  --color-holiday: #ff5252;
  --color-holiday-today: #ff8a80;
  --color-holiday-other: #e57373;
  --color-holiday-legend: #ff5252;
  --color-holiday-print: #ff4444;
  --bg-today: #1c4220;
  --bg-other-month: #2a2a2a;
  --text-other-month: #888;
  --color-total-hours: #4caf50;
  --color-acc-in: #81c784;
  --color-acc-out: #e57373;
  --color-acc-in-other: #689f6a;
  --color-acc-out-other: #c67b7b;
  --color-acc-in-today: #c8e6c9;
  --color-acc-out-today: #ffcdd2;
  --color-emp-anm: #64b5f6;
  --color-emp-abm: #ffb74d;
  --color-emp-anm-other: #4a8fb8;
  --color-emp-abm-other: #c9923d;
  --color-emp-anm-today: #bbdefb;
  --color-emp-abm-today: #ffe0b2;
  --color-acc-rent: #7e57c2;
  --color-acc-rent-other: #5e4578;
  --color-acc-rent-today: #9575cd;
  --color-planned-badge-bg: #2a3a2a;
  --color-planned-badge-text: #9ccc9c;

  --status-k-bg: #c0392b;
  --status-x-bg: #555;

  --focus-ring: rgba(111, 66, 193, 0.35);
  --message-success-border: #335533;

  --text-bright: #eee;
  --text-link-alt: #90caf9;
  --text-meta: #999;
  --bg-deep: #181818;
  --bg-deep-alt: #151515;
  --bg-panel-header: #252525;
  --border-focus-purple: #6f42c1;
  --border-btn-primary: #1976d2;
  --border-btn-success: #388e3c;
  --border-btn-push: #1b5e20;
  --border-btn-admin: #4a148c;
  --btn-secondary: #1565c0;
  --btn-secondary-border: #0d47a1;
  --btn-secondary-hover: #1976d2;
  --btn-toolbar: #455a64;
  --btn-toolbar-border: #546e7a;
  --btn-toolbar-hover: #546e7a;
  --btn-apply-hover: #7b1fa2;
  --msg-ok-bg: #1b3d1b;
  --msg-ok-border: #2e7d32;
  --msg-err-bg: #3d1b1b;
  --msg-err-border: #c62828;
  --msg-error-bg: #3d1f1f;
  --msg-error-border: #a44;
  --msg-error-text: #ffcdd2;
  --msg-success-bg: #1b3d24;
  --msg-success-border: #3d8;
  --msg-success-text: #c8e6c9;
  --btn-danger-soft-bg: #5c2b2b;
  --btn-danger-soft-border: #733;
  --progress-bar: #42a5f5;
  --color-success-text: #0f0;
  --color-warn-orange: #ff9f6b;
  --color-summary: #9ab;
  --badge-prepared-bg: #3d3520;
  --badge-prepared-text: #ffd966;
  --badge-prepared-border: #665c33;
  --badge-signed-bg: #1e3a2a;
  --badge-signed-border: #2d5a40;
  --btn-paycheck-active: #5a32a8;
  --btn-paycheck-active-border: #4a2890;
  --btn-paycheck-pressed: #3d2270;
  --border-success-dark: #1e7e34;
  --primary-wage-border: #6a9f6a;
  --unlock-error: #e66;
  --shadow-modal-border: #333;

  --d-accent-border: #4a8fd4;
  --d-th-bg: #252525;
  --d-highlight: #ffeb3b;
  --d-highlight-bg: #2a2a18;
  --d-highlight-bg-alt: #3d3a1a;
  --d-drag-bg: #1a2a3a;
  --d-combine-text: #ce93d8;
  --d-combine-plus: #ab47bc;
  --d-empty: #555;
  --d-popup-bg: #2a2438;
  --d-popup-border: #7e57c2;
  --d-btn-purple: #4a148c;
  --d-btn-purple-border: #9c27b0;
  --d-btn-combine: #311b92;
  --d-propagate-bg: #2a4a2a;
  --d-propagate-neutral: #3a3a3a;
  --d-action-month: #90caf9;
  --d-action-unavail: #ff8a65;
  --d-pending-outline: #ffb74d;
  --d-reset-bg: #2a1f1f;
  --d-reset-border: #c62828;
  --d-reset-text: #ef9a9a;
  --d-reset-btn: #5c1a1a;
  --d-reset-btn-hover: #7a2323;
  --d-reset-prev: #4a2c1a;
  --d-reset-prev-border: #ef6c00;
  --d-reset-prev-hover: #6d3f22;
  --d-gold-text: #c9a227;
  --d-gold-bg: #2a2618;
  --d-gold-border: #6b5a3e;
  --d-gold-text-hover: #e8d48b;
  --d-gold-bg-hover: #332e1f;
  --d-gold-border-hover: #8b7340;
  --d-school-bg: #1a2e22;
  --d-school-border: #3d6b4f;
  --d-school-text-hover: #9fdfb8;
  --d-school-bg-hover: #223528;
  --d-school-border-hover: #4d8b63;
  --d-checkout-border: #2a4a35;
  --d-drop-active: #4a7c4a;
  --d-school-orange: #3d2e1f;
  --d-school-blue: #1f2a3d;
  --d-school-purple: #2e1f3d;
  --d-school-green: #1f3d2a;
  --d-warning-border: #e0a800;
  --d-metric-warn: #ef5350;
  --d-metric-warn-hover: #ff7961;
  --d-col-note: #b39ddb;
  --d-col-header-border: #5c4d7a;
  --d-col-header-text: #e1bee7;
  --d-pending-top-bg: #3d2f1a;
  --d-pending-top-border: #ffb74d;
  --d-pending-bottom-bg: #1a3d5c;
  --d-pending-bottom-border: #4fc3f7;
  --d-pending-bottom-text: #e1f5fe;
  --d-abm-bar-bg: #3d2f1a;
  --d-abm-bar-border: #ffb74d;
  --d-anm-bar-bg: #1a3d5c;
  --d-anm-bar-border: #4fc3f7;
  --d-anm-bar-text: #e1f5fe;

  --pool-adhoc-border: #6a1b9a;
  --pool-unknown-border: #8d6e63;
  --pool-dash-border: #444;
  --pool-active-bg: #1a221a;
  --pool-active-border: #4a7c4a;
  --chip-assigned-bg: #1b3d1f;
  --chip-assigned-border: #4a7c4a;
  --chip-duplicate-bg: #3d1f1f;
  --chip-partial-bg: #3d3018;
  --chip-partial-border: #ff8f00;
  --chip-partial-assigned-bg: #2e4620;
  --chip-partial-assigned-border: #7cb342;
  --chip-partial-assigned-text: #dcedc8;
  --chip-partial-dup-bg: #4a3018;
  --chip-partial-dup-text: #ffccbc;
  --chip-unknown-bg: #2a2420;
  --chip-unknown-text: #bcaaa4;
  --chip-unavail-bg: #2a2218;
  --chip-unavail-border: #ff8a65;
  --chip-unavail-text: #ffccbc;
  --chip-unavail-assigned-border: #ff7043;
  --chip-dummy-bg: #2a2030;
  --chip-dummy-assigned-border: #7cb342;
  --chip-match-border: #4caf50;
  --chip-match-bright: #69f0ae;
  --chip-match-light: #b9f6ca;
  --chip-match-pale: #e8f5e9;
  --chip-ring-warn: #ffb74d;
  --employment-badge-bg: #3d3018;
  --employment-badge-hover: #4a3818;
  --print-popup-bg: #1f2e1f;
  --print-popup-text: #a5d6a7;
  --print-popup-btn: #1b5e20;
  --print-popup-btn-border: #43a047;
  --print-stacked-bg: #33691e;
  --print-stacked-border: #689f38;
  --print-stacked-hover: #558b2f;
  --print-density-active: #42a5f5;
  --modal-section-border: #444;
  --timeline-border: #333;

  --bk-status-new: #e0a800;
  --bk-status-seen: #0d6efd;
  --bk-status-classified: #6f42c1;
  --bk-status-imported: #198754;
  --bk-status-ignored: #6c757d;
  --bk-row-new-bg: #1f1c10;
  --bk-stripe-a: #1a1a1e;
  --bk-stripe-b: #232328;
  --bk-shared-border: #5a8fc4;
  --bk-pre-text: #cdd;
  --bk-chip-active-bg: #fff;
  --bk-chip-active-text: #111;
  --bk-checklist-active: #9ec5ff;

  --ua-available-bg: #1b5e20;
  --ua-unavailable-bg: #b71c1c;
  --ua-unknown-bg: #424242;
  --ua-weekend-bg: #2a2a3a;
}

[data-theme="light"] {
  color-scheme: light;
  --bg-page: #f4f4f5;
  --bg-surface: #ffffff;
  --bg-surface-alt: #fafafa;
  --bg-muted: #f0f0f0;
  --bg-muted-darker: #e8e8e8;
  --bg-input: #ffffff;
  --bg-btn: #e8e8e8;
  --bg-btn-hover: #d8d8d8;
  --bg-toolbar: #ffffff;
  --bg-modal: #ffffff;
  --bg-header: #ffffff;
  --bg-card: #ffffff;
  --bg-tooltip: rgba(0, 0, 0, 0.75);
  --bg-row-hover: #f5f5f5;
  --bg-message-success: #e8f5e9;
  --bg-snapshot: #e8f5e9;

  --text: #1a1a1a;
  --text-muted: #5c5c5c;
  --text-muted-light: #666;
  --text-dim: #777;
  --text-faint: #888;
  --text-dimmer: #999;
  --text-subtle: #444;
  --text-secondary: #333;
  --text-note: #555;
  --text-start-end: #666;
  --text-label: #444;
  --text-placeholder: #999;
  --text-on-today: #1a1a1a;
  --text-error: #c62828;
  --text-error-bright: #d32f2f;
  --text-delete-hover: #b71c1c;
  --text-warning: #e65100;
  --text-planned: #2e7d32;
  --text-planned-em: #2e7d32;
  --text-snapshot: #1b5e20;
  --text-snapshot-ts: #388e3c;
  --text-signature: #666;
  --text-push-success: #2e7d32;
  --text-push-error: #c62828;

  --border: #d0d0d0;
  --border-light: #e0e0e0;
  --border-strong: #bbb;
  --border-input: #ccc;
  --border-card: #ddd;
  --border-divider: #e8e8e8;
  --border-signature: #999;
  --border-focus: #6f42c1;

  --link: #1565c0;
  --link-action: #1565c0;
  --overlay: rgba(0, 0, 0, 0.4);
  --shadow-modal: 0 10px 30px rgba(0, 0, 0, 0.15);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.08);

  --btn-neutral: #6c757d;
  --btn-neutral-dark: #5a6268;
  --btn-cancel: #6c757d;

  /* Light theme buttons: same hue families as dark, brighter for white backgrounds */
  --btn-primary: #2196f3;
  --btn-danger: #f44336;
  --btn-danger-hover: #e53935;
  --btn-success: #4caf50;
  --btn-success-alt: #66bb6a;
  --btn-menu: #f44336;
  --btn-admin: #9c27b0;
  --btn-push: #43a047;
  --btn-sick: #f44336;
  --btn-dayoff: #ff9800;
  --btn-delete: #d32f2f;
  --btn-copy: #607d8b;
  --btn-copy-hover: #2196f3;
  --btn-checkout: #4caf50;
  --btn-checkout-hover: #66bb6a;
  --btn-checkout-active: #43a047;
  --btn-paycheck: #9c27b0;
  --btn-paycheck-border: #8e24aa;
  --btn-export: #2196f3;
  --btn-export-border: #1e88e5;
  --btn-secondary: #1e88e5;
  --btn-secondary-border: #1976d2;
  --btn-secondary-hover: #2196f3;
  --btn-toolbar: #607d8b;
  --btn-toolbar-border: #546e7a;
  --btn-toolbar-hover: #546e7a;
  --btn-apply-hover: #ab47bc;
  --border-btn-primary: #1e88e5;
  --border-btn-success: #43a047;
  --border-btn-push: #43a047;
  --border-btn-admin: #8e24aa;
  --btn-paycheck-active: #8e24aa;
  --btn-paycheck-active-border: #7b1fa2;
  --btn-paycheck-pressed: #7e57c2;
  --border-success-dark: #43a047;
  --status-k-bg: #f44336;
  --print-popup-btn: #388e3c;
  --print-popup-btn-border: #43a047;
  --print-stacked-bg: #43a047;
  --print-stacked-border: #66bb6a;
  --print-stacked-hover: #4caf50;
  --print-density-active: #1e88e5;
  --text-on-btn: #fff;

  --color-holiday: #c62828;
  --color-holiday-today: #d32f2f;
  --color-holiday-other: #e57373;
  --color-holiday-legend: #c62828;
  --color-holiday-print: #c62828;
  --bg-today: #e8f5e9;
  --bg-other-month: #f0f0f0;
  --text-other-month: #888;
  --color-total-hours: #2e7d32;
  --color-acc-in: #2e7d32;
  --color-acc-out: #c62828;
  --color-acc-in-other: #388e3c;
  --color-acc-out-other: #d32f2f;
  --color-acc-in-today: #1b5e20;
  --color-acc-out-today: #b71c1c;
  --color-emp-anm: #1565c0;
  --color-emp-abm: #e65100;
  --color-emp-anm-other: #1976d2;
  --color-emp-abm-other: #ef6c00;
  --color-emp-anm-today: #0d47a1;
  --color-emp-abm-today: #e65100;
  --color-acc-rent: #5e35b1;
  --color-acc-rent-other: #4527a0;
  --color-acc-rent-today: #7e57c2;
  --color-planned-badge-bg: #e8f5e9;
  --color-planned-badge-text: #2e7d32;

  --status-x-bg: #9e9e9e;

  --focus-ring: rgba(111, 66, 193, 0.25);
  --message-success-border: #a5d6a7;

  --text-bright: #1a1a1a;
  --text-link-alt: #1565c0;
  --text-meta: #666;
  --bg-deep: #f5f5f5;
  --bg-deep-alt: #eeeeee;
  --bg-panel-header: #e8e8e8;
  --shadow-modal-border: #ddd;

  --msg-ok-bg: #e8f5e9;
  --msg-err-bg: #ffebee;
  --msg-error-bg: #ffebee;
  --msg-error-text: #b71c1c;
  --msg-success-bg: #e8f5e9;
  --msg-success-text: #1b5e20;
  --btn-danger-soft-bg: #ffcdd2;
  --btn-danger-soft-border: #e57373;
  --badge-prepared-bg: #fff8e1;
  --badge-prepared-text: #f57f17;
  --badge-prepared-border: #ffe082;
  --badge-signed-bg: #e8f5e9;
  --badge-signed-border: #a5d6a7;

  --d-th-bg: #e8e8e8;
  --d-highlight-bg: #fffde7;
  --d-highlight-bg-alt: #fff9c4;
  --d-drag-bg: #e3f2fd;
  --d-popup-bg: #f3e5f5;
  --d-highlight: #f9a825;
  --d-empty: #bbb;
  --d-propagate-bg: #e8f5e9;
  --d-propagate-neutral: #eeeeee;
  --d-reset-bg: #ffebee;
  --d-reset-text: #c62828;
  --d-reset-btn: #f44336;
  --d-reset-btn-hover: #e53935;
  --d-reset-prev: #ef6c00;
  --d-reset-prev-hover: #e65100;
  --d-gold-bg: #fff8e1;
  --d-gold-bg-hover: #fffde7;
  --d-school-bg: #e8f5e9;
  --d-school-bg-hover: #c8e6c9;
  --d-school-orange: #fff3e0;
  --d-school-blue: #e3f2fd;
  --d-school-purple: #f3e5f5;
  --d-school-green: #e8f5e9;
  --d-pending-top-bg: #fff3e0;
  --d-pending-bottom-bg: #e3f2fd;
  --d-pending-bottom-text: #01579b;
  --d-abm-bar-bg: #fff3e0;
  --d-anm-bar-bg: #e3f2fd;
  --d-anm-bar-text: #01579b;

  --pool-dash-border: #ccc;
  --pool-active-bg: #e8f5e9;
  --chip-assigned-bg: #e8f5e9;
  --chip-duplicate-bg: #ffebee;
  --chip-partial-bg: #fff3e0;
  --chip-partial-assigned-bg: #f1f8e9;
  --chip-partial-assigned-text: #33691e;
  --chip-partial-dup-bg: #fbe9e7;
  --chip-partial-dup-text: #bf360c;
  --chip-unknown-bg: #efebe9;
  --chip-unknown-text: #5d4037;
  --chip-unavail-bg: #fbe9e7;
  --chip-unavail-text: #d84315;
  --chip-dummy-bg: #f3e5f5;
  --employment-badge-bg: #fff3e0;
  --employment-badge-hover: #ffe0b2;
  --print-popup-bg: #e8f5e9;
  --print-popup-text: #2e7d32;
  --print-popup-btn: #2e7d32;
  --timeline-border: #ddd;
  --modal-section-border: #ddd;

  --bk-row-new-bg: #fff8e1;
  --bk-stripe-a: #fafafa;
  --bk-stripe-b: #f0f0f0;
  --bk-pre-text: #333;
  --bk-chip-active-bg: var(--btn-primary);
  --bk-chip-active-text: #fff;
  --bk-checklist-active: var(--link);

  --ua-available-bg: #c8e6c9;
  --ua-unavailable-bg: #ffcdd2;
  --ua-unknown-bg: #e0e0e0;
  --ua-weekend-bg: #eeeeee;
}

/* Base element styles (pages may override layout) */
body {
  background: var(--bg-page);
  color: var(--text);
}

a {
  color: var(--link);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="search"],
input[type="url"],
select,
textarea {
  background: var(--bg-input);
  color: var(--text);
  border-color: var(--border-input);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-placeholder);
}

/* Shared action buttons */
button,
input[type="submit"],
input[type="button"],
.btn,
.menu-button,
.submit-btn {
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

/* Theme toggle */
.theme-toggle-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.theme-toggle-btn {
  background: var(--bg-btn);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.theme-toggle-btn:hover {
  background: var(--bg-btn-hover);
}

.theme-toggle-btn--compact {
  padding: 4px 8px;
  font-size: 0.8rem;
}

.theme-toggle-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Light theme: white label on saturated action buttons */
[data-theme="light"] .menu-button,
[data-theme="light"] .menu-button.admin-daily,
[data-theme="light"] .menu-button.admin-settings,
[data-theme="light"] .submit-btn,
[data-theme="light"] .action-btn,
[data-theme="light"] .btn-primary,
[data-theme="light"] .btn-success,
[data-theme="light"] .btn-sick,
[data-theme="light"] .btn-dayoff,
[data-theme="light"] .btn-delete,
[data-theme="light"] .btn-reset-sheet,
[data-theme="light"] .btn-push-menu-btn,
[data-theme="light"] .modal-actions .btn-save,
[data-theme="light"] .modal-actions .btn-sick,
[data-theme="light"] .modal-actions .btn-dayoff,
[data-theme="light"] .save,
[data-theme="light"] .delete,
[data-theme="light"] .paycheck-toggle,
[data-theme="light"] .action-btn-invite,
[data-theme="light"] .action-btn-create,
[data-theme="light"] .action-btn-group,
[data-theme="light"] .action-btn-dummy-delete,
[data-theme="light"] .btn-apply,
[data-theme="light"] .btn-paycheck-form button[type="submit"],
[data-theme="light"] button[type="submit"].btn-primary {
  color: var(--text-on-btn);
}

/* Page header: title left, nav + theme toggle right */
.page-top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.page-top-bar h1 {
  margin: 0;
}

.page-top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.page-top-actions .theme-toggle-wrap {
  margin: 0;
}

.page-nav-btn {
  background: var(--bg-btn);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  text-decoration: none;
  border: 1px solid var(--border);
  display: inline-block;
  white-space: nowrap;
  line-height: 1.2;
}

.page-nav-btn:hover {
  background: var(--bg-btn-hover);
  color: var(--text);
}

.page-top-bar--menu {
  justify-content: flex-end;
  margin-bottom: 0;
}
