/* YASTRAV appearance system - Light, Dark and operating-system aware. */
html { color-scheme: light; }
html[data-theme="dark"] {
    color-scheme: dark;
    --ink: #dce8f2;
    --muted: #92a7b9;
    --line: #263c50;
    --surface: #101f2e;
    --canvas: #07111f;
    --sky: #123544;
    --danger: #ff8379;
    --shadow: 0 12px 30px rgba(0,0,0,.28),0 2px 5px rgba(0,0,0,.20);
    --ma-canvas: #07111f;
    --ma-surface: #101f2e;
    --ma-line: #263c50;
    --ma-ink: #dce8f2;
    --ma-muted: #92a7b9;
    --ma-shadow: 0 12px 30px rgba(0,0,0,.28),0 2px 5px rgba(0,0,0,.20);
}

.theme-switcher { position: relative; z-index: 80; flex: 0 0 auto; }
.theme-switcher-toggle {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    padding: 0;
    color: #47657b;
    background: linear-gradient(145deg,#fff,#edf3f7);
    border: 1px solid #d4e0e8;
    border-radius: 11px;
    box-shadow: inset 0 1px rgba(255,255,255,.95),inset 0 -1px rgba(10,48,76,.08),0 4px 10px rgba(8,39,64,.08);
    cursor: pointer;
    transition: color .15s ease,border-color .15s ease,box-shadow .15s ease,transform .15s ease;
}
.theme-switcher-toggle:hover,.theme-switcher-toggle:focus {
    color: #087f79;
    border-color: #84cfc7;
    box-shadow: inset 0 1px #fff,0 6px 14px rgba(8,74,91,.14);
    transform: translateY(-1px);
}
.theme-switcher.is-open .theme-switcher-toggle {
    color: #fff;
    background: linear-gradient(145deg,#18b3a4,#087b76);
    border-color: #25bbae;
    box-shadow: inset 0 1px rgba(255,255,255,.35),0 7px 16px rgba(7,111,108,.22);
}
.theme-current-icon { display: grid; width: 22px; height: 22px; place-items: center; }
.theme-icon,.theme-option-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.theme-current-icon .theme-icon { display: none; }
html[data-theme-mode="light"] .theme-current-icon .theme-icon-light,
html[data-theme-mode="dark"] .theme-current-icon .theme-icon-dark,
html[data-theme-mode="system"] .theme-current-icon .theme-icon-system { display: block; }
.theme-switcher-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 248px;
    overflow: hidden;
    padding: 7px;
    color: #17334b;
    background: linear-gradient(145deg,rgba(255,255,255,.99),rgba(239,245,248,.98));
    border: 1px solid #cbd9e2;
    border-radius: 14px;
    box-shadow: inset 0 1px #fff,0 18px 45px rgba(5,30,52,.22);
    backdrop-filter: blur(14px);
}
.theme-switcher-menu[hidden] { display: none; }
.theme-switcher-menu::before {
    position: absolute;
    top: -5px;
    right: 16px;
    width: 10px;
    height: 10px;
    content: "";
    background: #fff;
    border-top: 1px solid #cbd9e2;
    border-left: 1px solid #cbd9e2;
    transform: rotate(45deg);
}
.theme-menu-heading { padding: 9px 10px 10px; border-bottom: 1px solid #dce6ec; }
.theme-menu-heading span,.theme-menu-heading small { display: block; }
.theme-menu-heading span { color: #143650; font-size: 12px; font-weight: 850; }
.theme-menu-heading small { margin-top: 2px; color: #718595; font-size: 9.5px; }
.theme-switcher-menu > button {
    display: grid;
    width: 100%;
    grid-template-columns: 34px minmax(0,1fr) 20px;
    align-items: center;
    gap: 9px;
    margin-top: 4px;
    padding: 9px;
    color: #25455e;
    text-align: left;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 9px;
    cursor: pointer;
}
.theme-switcher-menu > button:hover,.theme-switcher-menu > button:focus {
    background: #edf5f7;
    border-color: #d5e5e9;
    outline: none;
}
.theme-switcher-menu > button.is-selected {
    color: #075f5d;
    background: linear-gradient(145deg,#e8f8f5,#dff1ef);
    border-color: #addbd5;
}
.theme-option-icon {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    color: #557488;
    background: linear-gradient(145deg,#f6fafc,#dfeaf0);
    border: 1px solid #d1dfe7;
    border-radius: 9px;
    box-shadow: inset 0 1px #fff;
}
.theme-switcher-menu > button.is-selected .theme-option-icon {
    color: #fff;
    background: linear-gradient(145deg,#18b3a4,#087872);
    border-color: #28b8aa;
    box-shadow: inset 0 1px rgba(255,255,255,.35);
}
.theme-switcher-menu strong,.theme-switcher-menu small { display: block; }
.theme-switcher-menu strong { font-size: 11px; }
.theme-switcher-menu small { margin-top: 2px; color: #758895; font-size: 9px; }
.theme-option-check { color: transparent; font-size: 13px; font-style: normal; font-weight: 900; }
.theme-switcher-menu > button.is-selected .theme-option-check { color: #0b8f85; }

/* Tenant ERP dark surfaces */
html[data-theme="dark"] body,
html[data-theme="dark"] body.app-body { background: radial-gradient(circle at 80% -15%,rgba(13,123,128,.10),transparent 32rem),#07111f; }
html[data-theme="dark"] .app-header {
    background: rgba(8,20,33,.94);
    border-bottom-color: #24384a;
    box-shadow: 0 4px 18px rgba(0,0,0,.22);
}
html[data-theme="dark"] .app-header strong,
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] .metric-card strong,
html[data-theme="dark"] .cart-total strong,
html[data-theme="dark"] .section-title h2,
html[data-theme="dark"] .booking-type-card strong,
html[data-theme="dark"] .booking-service-card strong,
html[data-theme="dark"] .company-logo-copy h2,
html[data-theme="dark"] .company-logo-copy h3 { color: #e9f2f8; }
html[data-theme="dark"] p,
html[data-theme="dark"] .muted { color: var(--muted); }
html[data-theme="dark"] .user-chip { color: #d9e7f1; background: #172a3c; border: 1px solid #2c4356; }
html[data-theme="dark"] .environment-pill { color: #f5d576; background: #332d19; border: 1px solid #504523; }
html[data-theme="dark"] .header-icon-button,
html[data-theme="dark"] .user-avatar-button {
    color: #b5c8d6;
    background: linear-gradient(145deg,#1a3042,#0d1c2a);
    border-color: #31495b;
    box-shadow: inset 0 1px rgba(255,255,255,.07),inset 0 -1px rgba(0,0,0,.25),0 5px 12px rgba(0,0,0,.24);
}
html[data-theme="dark"] .header-icon-button:hover,
html[data-theme="dark"] .header-icon-button:focus,
html[data-theme="dark"] .user-avatar-button:hover,
html[data-theme="dark"] .user-avatar-button:focus,
html[data-theme="dark"] .header-menu.is-open > .header-icon-button,
html[data-theme="dark"] .header-menu.is-open > .user-avatar-button { color: #5de2d6; border-color: #277f80; box-shadow: inset 0 1px rgba(255,255,255,.08),0 7px 16px rgba(0,0,0,.28); }
html[data-theme="dark"] .header-action-indicator { border-color: #132536; }
html[data-theme="dark"] .header-dropdown {
    color: #dce8f2;
    background: linear-gradient(145deg,rgba(21,40,55,.99),rgba(8,23,35,.99));
    border-color: #324b5e;
    box-shadow: inset 0 1px rgba(255,255,255,.06),0 18px 45px rgba(0,0,0,.46);
}
html[data-theme="dark"] .header-dropdown-heading strong,
html[data-theme="dark"] .user-account-summary strong,
html[data-theme="dark"] .notification-empty strong { color: #e2edf4; }
html[data-theme="dark"] .header-dropdown-heading small,
html[data-theme="dark"] .user-account-summary small,
html[data-theme="dark"] .notification-empty small { color: #8fa5b6; }
html[data-theme="dark"] .header-dropdown-heading em { color: #7aeee2; background: #123b3b; }
html[data-theme="dark"] .notification-empty,
html[data-theme="dark"] .header-dropdown-separator { border-color: #2a4052; background-color: #2a4052; }
html[data-theme="dark"] .notification-empty { background-color: transparent; }
html[data-theme="dark"] .notification-empty-icon { color: #62ded3; background: linear-gradient(145deg,#153a3c,#102930); border-color: #247f7d; box-shadow: inset 0 1px rgba(255,255,255,.06); }
html[data-theme="dark"] .user-account-dropdown > a,
html[data-theme="dark"] .header-signout-form button { color: #c9d9e5; }
html[data-theme="dark"] .user-account-dropdown > a:hover,
html[data-theme="dark"] .user-account-dropdown > a:focus,
html[data-theme="dark"] .header-signout-form button:hover,
html[data-theme="dark"] .header-signout-form button:focus { color: #75e6dc; background: #192f40; border-color: #304b5e; }
html[data-theme="dark"] .header-signout-form button { color: #f19ba2; }
html[data-theme="dark"] .header-mobile-logo .header-logo-light { display: none; }
html[data-theme="dark"] .header-mobile-logo .header-logo-dark { display: block; }
html[data-theme="dark"] .profile-command-bar,
html[data-theme="dark"] .profile-picture-card,
html[data-theme="dark"] .profile-settings-card,
html[data-theme="dark"] .profile-save-bar { background: linear-gradient(145deg,#132536,#0c1b29); border-color: #2b4254; box-shadow: inset 0 1px rgba(255,255,255,.04),0 7px 20px rgba(0,0,0,.24); }
html[data-theme="dark"] .profile-command-bar h1,
html[data-theme="dark"] .profile-picture-card h2,
html[data-theme="dark"] .profile-section-heading strong,
html[data-theme="dark"] .profile-save-bar strong { color: #e5eff5; }
html[data-theme="dark"] .profile-privacy-badge { color: #72e8dd; background: linear-gradient(145deg,#153a3c,#102930); border-color: #247f7d; box-shadow: inset 0 1px rgba(255,255,255,.06); }
html[data-theme="dark"] .profile-picture-frame { background: linear-gradient(145deg,#1a3444,#0e2635); border-color: #345263; box-shadow: inset 0 1px rgba(255,255,255,.06),0 10px 24px rgba(0,0,0,.28); }
html[data-theme="dark"] .profile-picture-status { border-color: #132536; }
html[data-theme="dark"] .profile-readonly-field input { color: #93a9b8; background: #0d1d2a; border-color: #2d4456; }
html[data-theme="dark"] .profile-security-note { color: #b9ced9; background: linear-gradient(145deg,#153036,#10252d); border-color: #2d4a53; }
html[data-theme="dark"] .metric-card,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .content-card,
html[data-theme="dark"] .pos-catalog,
html[data-theme="dark"] .pos-cart,
html[data-theme="dark"] .erp-settings-card,
html[data-theme="dark"] .settings-nav-card {
    background: linear-gradient(145deg,#132536,#0c1b29);
    border-color: var(--line);
    box-shadow: var(--shadow),inset 0 1px rgba(255,255,255,.035);
}
html[data-theme="dark"] .metric-accent { background: linear-gradient(135deg,#08736f,#12a99b); border-color: transparent; }
html[data-theme="dark"] .task-item,
html[data-theme="dark"] .service-card,
html[data-theme="dark"] .cart-line,
html[data-theme="dark"] .settings-nav-card a,
html[data-theme="dark"] .number-rule-grid article,
html[data-theme="dark"] .erp-module-launch-grid a {
    color: #d9e7f1;
    background: #102131;
    border-color: #263d50;
}
html[data-theme="dark"] .task-item:hover,
html[data-theme="dark"] .service-card:hover,
html[data-theme="dark"] .settings-nav-card a:hover,
html[data-theme="dark"] .erp-module-launch-grid a:hover { background: #162d40; border-color: #287b80; }
html[data-theme="dark"] .erp-module-launch-grid a strong { color: #e4eef5; }
html[data-theme="dark"] .erp-module-launch-grid a small { color: #90a5b5; }
html[data-theme="dark"] .button-secondary {
    color: #dce8f2;
    background: linear-gradient(145deg,#172a3b,#0e1d2b);
    border-color: #32495b;
}
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .form-control {
    color: #dce8f2;
    background-color: #0b1927;
    border-color: #30485b;
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: #70879a; }
html[data-theme="dark"] option { color: #dce8f2; background: #0d1c2a; }
html[data-theme="dark"] .hrm-editor .erp-field-grid > label,
html[data-theme="dark"] .hrm-editor .erp-field-grid > label > label { color: #a9bdcb; }
html[data-theme="dark"] .hrm-editor .erp-field-grid > label > small { color: #849aa9; }
html[data-theme="dark"] .branch-editor .erp-field-grid > label,
html[data-theme="dark"] .branch-editor .erp-field-grid > label > label { color: #a9bdcb; }
html[data-theme="dark"] .branch-editor .erp-field-grid > label > small { color: #849aa9; }
html[data-theme="dark"] .branch-metric-grid article,
html[data-theme="dark"] .branch-card-grid > article,
html[data-theme="dark"] .branch-identity-strip article {
    background: radial-gradient(circle at 100% 0,rgba(18,152,149,.12),transparent 34%),linear-gradient(145deg,#142838,#0d1d2b);
    border-color: #2c4556;
    box-shadow: inset 0 1px rgba(255,255,255,.04),0 6px 16px rgba(0,0,0,.22);
}
html[data-theme="dark"] .branch-metric-grid small,
html[data-theme="dark"] .branch-card-detail small,
html[data-theme="dark"] .branch-card-actions small,
html[data-theme="dark"] .branch-identity-strip small { color: #88a0af; }
html[data-theme="dark"] .branch-metric-grid strong,
html[data-theme="dark"] .branch-card-heading h3,
html[data-theme="dark"] .branch-card-detail strong,
html[data-theme="dark"] .branch-identity-strip strong { color: #e3eef5; }
html[data-theme="dark"] .branch-card-detail,
html[data-theme="dark"] .branch-search {
    color: #95adbc;
    background: linear-gradient(145deg,#0c1b28,#102333);
    border-color: #2d4658;
}
html[data-theme="dark"] .branch-policy-panel {
    background: radial-gradient(circle at 100% 0,rgba(18,152,149,.16),transparent 35%),linear-gradient(145deg,#132b35,#0d222c);
    border-color: #2b5c5c;
}
html[data-theme="dark"] .branch-policy-panel h2 { color: #e2eef2; }
html[data-theme="dark"] .branch-active-toggle { background: #102733; border-color: #2d5858; }
html[data-theme="dark"] .branch-active-toggle strong { color: #bce5df; }
html[data-theme="dark"] .branch-active-toggle small,
html[data-theme="dark"] .branch-policy-panel ul { color: #8da9aa; }
html[data-theme="dark"] .data-table td,
html[data-theme="dark"] .data-table th { border-bottom-color: #293e50; }
html[data-theme="dark"] .booking-type-card,
html[data-theme="dark"] .booking-service-card,
html[data-theme="dark"] .company-user-list > article,
html[data-theme="dark"] .branch-access-choice span,
html[data-theme="dark"] .toggle-grid > label {
    color: #d9e7f1;
    background: linear-gradient(145deg,#142738,#0c1b29);
    border-color: #2a4255;
    box-shadow: inset 0 1px rgba(255,255,255,.04),0 5px 14px rgba(0,0,0,.16);
}
html[data-theme="dark"] .booking-type-card:has(input:checked),
html[data-theme="dark"] .booking-service-card:has(input:checked),
html[data-theme="dark"] .branch-access-choice input:checked + span {
    background: linear-gradient(145deg,#123b3e,#10292f);
    border-color: #1a9b94;
}
html[data-theme="dark"] .booking-type-icon,
html[data-theme="dark"] .locked-field { color: #bcd3e2; background: #172d3e; border-color: #30485a; }
html[data-theme="dark"] .service-check { color: transparent; background: #102130; border-color: #385064; }
html[data-theme="dark"] .booking-service-card:has(input:checked) .service-check { color: #fff; background: var(--teal); border-color: var(--teal); }
html[data-theme="dark"] .icon-button { color: #ff9aa1; background: #3a2029; border: 1px solid #63313d; }
html[data-theme="dark"] .traveler-grid-wrap,
html[data-theme="dark"] .traveler-grid,
html[data-theme="dark"] .traveler-grid tbody { background: #0d1c2a; border-color: #293f52; }
html[data-theme="dark"] .traveler-grid th { color: #a8bac8; background: #182b3c; }
html[data-theme="dark"] .traveler-grid td { border-top-color: #263b4d; }
html[data-theme="dark"] .traveler-grid .traveler-row { background: linear-gradient(145deg,#132536,#0c1b29); border-color: #2a4052; }
html[data-theme="dark"] .booking-sticky-actions {
    background: rgba(13,28,42,.96);
    border-color: #30495d;
    box-shadow: 0 12px 30px rgba(0,0,0,.38);
}
html[data-theme="dark"] .company-logo-preview { background: linear-gradient(145deg,#172a3b,#0b1927); border-color: #2e4658; box-shadow: inset 0 1px rgba(255,255,255,.04); }
html[data-theme="dark"] .login-panel,
html[data-theme="dark"] .login-form-panel { background: #081522; }
html[data-theme="dark"] .login-card { background: #112131; border-color: #2b4255; box-shadow: 0 24px 70px rgba(0,0,0,.42); }
html[data-theme="dark"] .yastrav-loader-panel { background: linear-gradient(145deg,rgba(20,39,55,.98),rgba(8,23,36,.98)); border-color: #3a5264; box-shadow: inset 0 1px rgba(255,255,255,.08),0 18px 50px rgba(0,0,0,.50); }
html[data-theme="dark"] .yastrav-loader-copy strong { color: #e3eef5; }

/* MasterAdmin dark surfaces */
html[data-theme="dark"] body.master-body {
    background: radial-gradient(circle at 80% -15%,rgba(20,184,166,.10),transparent 32rem),linear-gradient(135deg,#081522,#07111f);
}
html[data-theme="dark"] .master-topbar {
    background: rgba(8,20,33,.95);
    border-bottom-color: #263b4e;
    box-shadow: 0 4px 18px rgba(0,0,0,.24);
}
html[data-theme="dark"] .master-title strong,
html[data-theme="dark"] .master-profile strong { color: #e7f1f7; }
html[data-theme="dark"] .master-search { color: #9bb0c1; background: #0d1d2b; border-color: #2b4356; }
html[data-theme="dark"] .master-search input { color: #dce8f2; background: transparent; }
html[data-theme="dark"] .master-search kbd { color: #91a6b7; background: #182b3b; border-color: #30485a; }
html[data-theme="dark"] .master-card,
html[data-theme="dark"] .master-stat,
html[data-theme="dark"] .master-table-card,
html[data-theme="dark"] .company-card,
html[data-theme="dark"] .subscription-card,
html[data-theme="dark"] .activity-card,
html[data-theme="dark"] .master-panel {
    color: #dce8f2;
    background: linear-gradient(145deg,#132536,#0c1b29);
    border-color: #293f52;
    box-shadow: var(--ma-shadow),inset 0 1px rgba(255,255,255,.035);
}
html[data-theme="dark"] .notification-drawer,
html[data-theme="dark"] .master-confirm { color: #dce8f2; background: #101f2e; border-color: #2d4558; }

/* Switcher dark appearance */
html[data-theme="dark"] .theme-switcher-toggle {
    color: #b5c8d6;
    background: linear-gradient(145deg,#1a3042,#0d1c2a);
    border-color: #31495b;
    box-shadow: inset 0 1px rgba(255,255,255,.07),inset 0 -1px rgba(0,0,0,.25),0 5px 12px rgba(0,0,0,.24);
}
html[data-theme="dark"] .theme-switcher-menu {
    color: #dce8f2;
    background: linear-gradient(145deg,rgba(21,40,55,.99),rgba(8,23,35,.99));
    border-color: #324b5e;
    box-shadow: inset 0 1px rgba(255,255,255,.06),0 18px 45px rgba(0,0,0,.46);
}
html[data-theme="dark"] .theme-switcher-menu::before { background: #14283a; border-color: #324b5e; }
html[data-theme="dark"] .theme-menu-heading { border-bottom-color: #2a4052; }
html[data-theme="dark"] .theme-menu-heading span { color: #e2edf4; }
html[data-theme="dark"] .theme-menu-heading small,
html[data-theme="dark"] .theme-switcher-menu small { color: #8fa5b6; }
html[data-theme="dark"] .theme-switcher-menu > button { color: #c9d9e5; }
html[data-theme="dark"] .theme-switcher-menu > button:hover,
html[data-theme="dark"] .theme-switcher-menu > button:focus { background: #192f40; border-color: #304b5e; }
html[data-theme="dark"] .theme-switcher-menu > button.is-selected { color: #cafff8; background: linear-gradient(145deg,#123c3e,#102b31); border-color: #247f7d; }
html[data-theme="dark"] .theme-option-icon { color: #9db2c2; background: linear-gradient(145deg,#1c3345,#102130); border-color: #30495b; box-shadow: inset 0 1px rgba(255,255,255,.06); }
html[data-theme="dark"] .theme-switcher-menu > button.is-selected .theme-option-check { color: #42d5c7; }

/* Module heroes deliberately retain a light metallic surface in dark mode. */
html[data-theme="dark"] .module-dashboard-hero h1 { color: #0b2d4b; }
html[data-theme="dark"] .module-dashboard-hero p { color: #687d8e; }

@media (max-width: 560px) {
    .theme-switcher-menu { position: fixed; top: 72px; right: 12px; width: min(248px,calc(100vw - 24px)); }
}

@media print {
    .theme-switcher { display: none !important; }
}
