/* Shared palette for the operational app. The guest site and printed paper use
   their own styles. The workspace supplies --brand from its saved settings. */
:root {
  --ui-bg: #f6f5f1;
  --ui-surface: #fffefa;
  --ui-soft: #efeee8;
  --ui-text: #242521;
  --ui-muted: #62645c;
  --ui-line: #d9d9cf;
  --ui-control-line: #adafa3;
  --ui-fill: var(--brand);
  --ui-fill-hover: color-mix(in srgb, var(--brand) 84%, #161511);
  --ui-accent: var(--brand);
  --ui-tint: color-mix(in srgb, var(--ui-accent) 8%, var(--ui-surface));
  --ui-accent-line: color-mix(in srgb, var(--ui-accent) 35%, var(--ui-surface));
  --ui-focus: var(--ui-accent);
  --ui-success: #316047;
  --ui-success-bg: #e5eee4;
  --ui-warning: #78551b;
  --ui-warning-bg: #f7ecd2;
  --ui-error: #9e302f;
  --ui-error-bg: #f9e5df;
  --ui-info: #375b68;
  --ui-info-bg: #e3eced;
  --ui-radius: 5px;
  --ui-shadow: 0 12px 36px rgb(46 42 30 / 14%);
}

@media screen {
  :root[data-theme="dark"]:not(:has(body:is([data-mode="guest"],[data-surface="guest"]))) {
    color-scheme: dark;
    --ui-bg: #181918;
    --ui-surface: #212320;
    --ui-soft: #2c2e2a;
    --ui-text: #eeefe7;
    --ui-muted: #b0b2a8;
    --ui-line: #393d36;
    --ui-control-line: #64695f;
    --ui-fill: color-mix(in srgb, var(--brand) 90%, #ba7659);
    --ui-fill-hover: color-mix(in srgb, var(--ui-fill) 88%, #dfafa0);
    --ui-accent: color-mix(in srgb, var(--brand) 32%, #fff2e7);
    --ui-tint: color-mix(in srgb, var(--ui-accent) 12%, var(--ui-surface));
    --ui-accent-line: color-mix(in srgb, var(--ui-accent) 45%, var(--ui-surface));
    --ui-success: #9ed3ad;
    --ui-success-bg: #263c30;
    --ui-warning: #e1bb78;
    --ui-warning-bg: #403623;
    --ui-error: #ffb4a9;
    --ui-error-bg: #482c29;
    --ui-info: #aecfd9;
    --ui-info-bg: #283a40;
    --ui-shadow: 0 12px 40px rgb(0 0 0 / 35%);
  }

  body {
    --ink: var(--ui-text);
    --muted: var(--ui-muted);
    --line: var(--ui-line);
    --panel: var(--ui-surface);
    --sand: var(--ui-soft);
    --brand-soft: var(--ui-tint);
    --brand-wash: color-mix(in srgb, var(--ui-accent) 5%, var(--ui-surface));
    --brand-line: var(--ui-accent-line);
    --brand-focus: var(--ui-focus);
    --brand-ink: var(--ui-accent);
    --accent: var(--ui-accent);
    --danger: var(--ui-error);
    background: var(--ui-bg);
    color: var(--ui-text);
    font-family: system-ui, "Segoe UI", sans-serif;
    font-variant-numeric: lining-nums;
    -webkit-font-smoothing: antialiased;
    scrollbar-color: var(--ui-control-line) var(--ui-bg);
  }
  body:is([data-mode="guest"],[data-surface="guest"]), #od-voucher-dialog, dialog.ov-mail { color-scheme: light; }

  /* Navigation and workspace chrome */
  #side { background: var(--ui-surface); border-color: var(--ui-line); padding: 25px 14px 16px; }
  .sideTop { padding: 0 8px 22px; }
  .wordmark { gap: 10px; }
  .wordmark strong { font-weight: 750; font-size: 29px; letter-spacing: -.07em; }
  .tenant { border: 0; border-block: 1px solid var(--ui-line); border-radius: 0; margin-bottom: 15px; padding: 13px 4px; background: transparent; }
  .tenantIcon { background: var(--ui-soft); color: var(--ui-text); border-radius: 0; }
  .tenant small, .navGroup > small, .groupTitle, .desktopCrumb, .crumbSep { color: var(--ui-muted); }
  .navGroup { gap: 2px; margin-bottom: 13px; }
  .navGroup > small { font-size: 10px; letter-spacing: .125em; padding: 7px 10px 5px; }
  .navItem { position: relative; min-height: 38px; font-size: 13px; border-radius: var(--ui-radius); font-weight: 530; }
  .navItem .ico { color: var(--ui-muted); }
  .navItem.selected, .navItem.selected .ico, #bottom .active { color: var(--ui-accent); }
  .navItem.selected { background: var(--ui-tint); font-weight: 680; }
  .navItem.selected::before { content: ""; position: absolute; inset: 8px auto 8px 0; width: 3px; background: var(--ui-accent); }
  .navItem:hover:not(.selected) { background: var(--ui-soft); }
  .sideFoot { border-color: var(--ui-line); }
  .top, #bottom:not(:empty), .skip, .dlghead { background: var(--ui-surface); color: var(--ui-text); }
  .crumbPage { font-size: 13px; font-weight: 650; }
  .profileChip { min-height: 40px; }
  .profileChip > .ico { width: 13px; height: 13px; color: var(--ui-muted); }
  .noticeBell { position: relative; }
  .noticeDot { position: absolute; inset: 7px 8px auto auto; width: 8px; height: 8px; border: 1px solid var(--ui-surface); border-radius: 50%; background: var(--ui-accent); }
  body[data-mode="access"] #side { display: none; }
  body[data-mode="access"] .appBody { margin: 0; }
  body[data-mode="access"] .crumbBrand { display: flex; }
  body[data-mode="access"] :is(.desktopCrumb, .crumbSep, .crumbPage) { display: none; }
  .avatar { color: var(--ui-text); background: var(--ui-soft); border: 1px solid var(--ui-line); }
  .viewSwitch, .iconbtn { border-color: var(--ui-line); background: var(--ui-surface); border-radius: var(--ui-radius); color: var(--ui-text); }
  .viewSwitch { min-height: 39px; }
  .iconbtn { width: 40px; height: 40px; }
  .viewSwitch:hover, .iconbtn:hover { color: var(--ui-accent); background: var(--ui-tint); border-color: var(--ui-accent-line); }
  .pageEyebrow { color: var(--ui-accent); }
  .pageHead h1 { font-size: clamp(31px,3.1vw,46px); font-weight: 700; letter-spacing: -.05em; line-height: 1.1; }
  .pageHead p { max-width: 68ch; margin-top: 7px; }
  .moduleCard, .viewChoice, #dialog { color: var(--ui-text); background: var(--ui-surface); }
  .moduleCard, .viewChoice, #dialog, .panel, .rc-picker, .rc-agenda, .rc-load, .wc-panel, .wc-hero, .kioskTile { border-radius: 0; box-shadow: none; }
  .moduleCard i, .viewChoice i { color: var(--ui-accent); background: var(--ui-tint); border-radius: 0; }
  .moduleCard > .ico, .viewChoice > .ico, .viewChoice > b { color: var(--ui-muted); }
  .moduleCard:hover, .viewChoice:hover, .viewChoice.here { background: var(--ui-tint); border-color: var(--ui-accent-line); }
  #dialog { box-shadow: var(--ui-shadow); }
  #dialog::backdrop { background: rgb(15 17 15 / 62%); }
  #toast { background: var(--ui-text); color: var(--ui-bg); }
  a, .foot button:hover { color: var(--ui-accent); }

  /* Shared controls and status colors */
  .btn, .photoBtns label, .rc-control, .sv-tabs button, .cc-tab, .wc-tabs button { min-height: 42px; border-radius: var(--ui-radius); }
  .btn, .photoBtns label, .rc-control { background: var(--ui-surface); color: var(--ui-text); border-color: var(--ui-control-line); font-weight: 620; }
  .btn:not(:disabled):hover, .photoBtns label:hover, .rc-control:hover { color: var(--ui-accent); border-color: var(--ui-accent-line); background: var(--ui-tint); }
  .btn.primary, .rc-control.rc-primary, .rc-day[aria-pressed=true], .rs-day[aria-pressed=true] { color: #fff; background: var(--ui-fill); border-color: var(--ui-fill); }
  .btn.primary:not(:disabled):hover, .rc-control.rc-primary:hover { color: #fff; background: var(--ui-fill-hover); border-color: var(--ui-fill-hover); }
  .btn.danger, .btn.destructive { color: var(--ui-error); border-color: var(--ui-error); background: transparent; }
  .btn.danger:hover, .btn.destructive:hover { color: var(--ui-error); background: var(--ui-error-bg); }
  .field :is(input:not([type="checkbox"]):not([type="radio"]), textarea, select),
  .wc-field :is(input, textarea, select), .wc-filter select {
    color: var(--ui-text); background: var(--ui-surface); border-color: var(--ui-control-line); border-radius: var(--ui-radius);
  }
  .field input::placeholder, .field textarea::placeholder { color: var(--ui-muted); }
  :is(.pill,.sv-status,.cc-tag) { background: var(--ui-soft); color: var(--ui-muted); border-radius: 3px; }
  .pill:is(.green,.good,.success,.sv-active), .sv-active, .sv-sent, .cc-tag:is(.active,.good) { color: var(--ui-success); background: var(--ui-success-bg); }
  .pill:is(.amber,.warn,.sv-pending), .sv-pending, .sv-paid, .wc-state { color: var(--ui-warning); background: var(--ui-warning-bg); }
  .pill:is(.red,.danger,.sv-expired), .sv-warning, .sv-failed { color: var(--ui-error); background: var(--ui-error-bg); }
  .pill:is(.blue,.indigo) { color: var(--ui-info); background: var(--ui-info-bg); }
  .sv-warning { border-color: var(--ui-error); }
  .kioskError,.punchError,.ops-inv .ops-warn { color: var(--ui-error); }

  /* Compact appearance selector works in a profile, at a shared station, or in a dialog. */
  .appearanceField { min-width: 0; border: 0; margin: 0; padding: 0; }
  .appearanceField legend { margin-bottom: 10px; padding: 0; color: var(--ui-text); font-size: .95rem; font-weight: 650; }
  .themeChoices { display: flex; flex-wrap: wrap; align-items: stretch; gap: 3px; width: fit-content; max-width: 100%; padding: 3px; background: var(--ui-soft); border: 1px solid var(--ui-line); border-radius: var(--ui-radius); }
  .themeChoice { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 39px; flex: 1 1 auto; font: inherit; font-weight: 600; font-size: .84rem; line-height: 1.25; white-space: nowrap; color: var(--ui-muted); background: transparent; border: 1px solid transparent; padding: 6px 10px; border-radius: 3px; }
  .themeChoice .ico { width: 16px; height: 16px; }
  .themeChoice:hover { color: var(--ui-text); }
  .themeChoice[aria-pressed="true"] { color: var(--ui-accent); border-color: var(--ui-accent-line); background: var(--ui-surface); }

  /* Reservation and shift calendars */
  .rc-mode, .sv-tabs, .rs-mode { border-color: var(--ui-line); background: var(--ui-soft); }
  .rc-mode button[aria-pressed="true"], .sv-tabs button[aria-pressed="true"], .rs-choice[aria-pressed="true"] { color: var(--ui-accent); background: var(--ui-surface); box-shadow: none; }
  .sv-tabs b, .rc-track { background: var(--ui-line); }
  .rc-day:not([aria-pressed="true"]), .rs-day:not([aria-pressed="true"]), .rc-table.assigned { background: var(--ui-soft); }
  .rc-table.unassigned { color: var(--ui-warning); border-color: var(--ui-warning); background: var(--ui-warning-bg); }
  .rc-empty > .ico, .rc-control.rc-find, .rs-table thead small, .rs-plan { color: var(--ui-accent); }
  .rc-day-state i, .rc-time::after, .rc-track i { background: var(--ui-accent); }
  .rs-panel { --rs-paper: var(--ui-soft); --rs-actual: var(--ui-success); --rs-actual-soft: var(--ui-success-bg); }
  .rs-nav button:hover, .rs-choice:hover { background: var(--ui-tint); }
  .rs-table thead th { background: var(--ui-soft); }
  .rs-table .rs-sector th, .rs-agenda h3 { background: var(--ui-soft); color: var(--ui-muted); }
  .rs-open { color: var(--ui-warning); background: var(--ui-warning-bg); border-left-color: var(--ui-warning); }

  /* Messaging, team, kiosk, cash and content management */
  .cc-channel, .cc-tabs, .cc-taskrow, .cc-taskpart, .cc-compose, .wc-tabs, .wc-form fieldset, .wc-list article { border-color: var(--ui-line); }
  .cc-channel small, .cc-taskmain small, .cc-messagehead small, .cc-detailnote, .cc-thread .muted,
  .wc-hero small, .wc-list small, .wc-list article p, .wc-gallery p { color: var(--ui-muted); }
  .cc-channel.is-current, .cc-tab.is-current, .wc-tabs button.active { color: var(--ui-accent); background: var(--ui-tint); }
  .cc-avatar, .cc-taskmark, .cc-context { color: var(--ui-accent); background: var(--ui-tint); }
  .cc-unread, .cc-send { color: #fff; background: var(--ui-fill); }
  .cc-chat .panel { border-radius: 0; }
  .cc-bubble { color: var(--ui-text); border: 0; background: var(--ui-soft); border-radius: 0 6px 6px; }
  .cc-message.mine .cc-bubble { background: var(--ui-tint); border: 0; border-radius: 6px 0 6px 6px; }
  .kioskTile:hover, .kioskTile:focus-visible, .kioskTile.kioskPunchEntry { background: var(--ui-tint); border-color: var(--ui-accent); }
  .kioskMark, .kioskInfo > .ico { color: var(--ui-accent); }
  .peoplePunchControl .btn { min-height: 56px; font-size: 1.08rem; }
  .wc-panel, .wc-hero { border-color: var(--ui-line); background: var(--ui-surface); }
  .id-card .id-error { color: var(--ui-error); }
  .id-bubble { color: var(--ui-text); border-color: var(--ui-line); background: var(--ui-success-bg); }
  #dialogBody .cash-example { background: var(--ui-soft); border-color: var(--ui-line); }
  #dialogBody .cash-notes span { background: var(--ui-surface); color: var(--ui-text); border-color: var(--ui-control-line); }

  body :is(button, a, summary, input, select, textarea, [tabindex="0"]):focus-visible,
  .photoBtns label:focus-within { outline: 3px solid var(--ui-focus); outline-offset: 2px; }
}

@media screen and (min-width:821px) {
  #side .mobileThemeSettings { display: none; }
}
@media screen and (max-width:820px) {
  #toolbar .themeToggle { display: none; }
  .navItem, .viewSwitch, .iconbtn, .profileChip, .cc-tab, .wc-tabs button, .btn, .photoBtns label, .themeChoice { min-height: 44px; }
  .iconbtn, .profileChip { min-width: 44px; }
  #bottom:not(:empty) { background: var(--ui-surface); }
  #bottom button { color: var(--ui-muted); min-height: 50px; }
  #bottom .active { color: var(--ui-accent); box-shadow: inset 0 2px var(--ui-accent); }
  .topLeft, .topRight { gap: 5px; }
  .themeChoice { padding-inline: 7px; }
}
@media screen and (max-width:540px) {
  .pageHead h1 { font-size: 32px; }
  #dialog:has(.punchForm) { border-radius: 0; }
}

/* Appearance controls remain compact on a phone and visibly selected without color alone. */
.appearanceNote { font-size: .84rem; line-height: 1.5; color: var(--ui-muted); margin: 10px 0 0; max-width: 74ch; }
.accountAppearance > .btn { margin-top: 16px; }
.paletteChoices { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin-top: 15px; }
.paletteChoice { display: grid; gap: 9px; min-width: 0; padding: 8px; border: 2px solid var(--ui-line); background: var(--ui-surface); color: var(--ui-text); border-radius: 11px; text-align: left; font: inherit; cursor: pointer; }
.paletteChoice:hover { border-color: var(--ui-control-line); background: var(--ui-soft); }
.paletteChoice[aria-pressed="true"] { border-color: var(--ui-accent); background: var(--ui-tint); }
.paletteMock { display: grid; grid-template-columns: 23% minmax(0,1fr); height: 70px; border: 1px solid #00000017; background: var(--sample-bg); overflow: hidden; border-radius: 5px; }
.paletteMock > i { background: var(--sample-rail); }
.paletteMock > span { padding: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.paletteMock b { background: var(--sample-rail); grid-column: 1/-1; border-radius: 3px; }
.paletteMock em { background: var(--sample-surface); border-top: 3px solid var(--sample-fill); border-radius: 2px; }
.paletteLabel { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-height: 22px; font-weight: 650; font-size: .88rem; }
.paletteCheck { visibility: hidden; display: inline-grid; place-items: center; height: 20px; width: 20px; border-radius: 50%; background: var(--ui-fill); color: white; flex: none; }
.paletteCheck .ico { width: 13px; height: 13px; }
.paletteChoice[aria-pressed="true"] .paletteCheck { visibility: visible; }
.businessAppearancePanel, .businessBrandPanel { margin-top: 24px; }
.businessMode { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--ui-line); }
.businessBrandLayout { display: grid; grid-template-columns: minmax(120px,190px) minmax(0,1fr); align-items: start; gap: 24px; }
.businessBrandPreview { display: grid; place-items: center; padding: 20px; min-height: 150px; border-radius: 12px; border: 1px solid var(--ui-control-line); background: #f7f7f7; }
.businessBrandPreview img { display: block; object-fit: contain; width: 100%; height: 110px; filter: none; }
.businessBrandCopy p { margin: 0 0 12px; }
.businessBrandCopy > small { color: var(--ui-muted); display: block; margin-top: 10px; font-size: .82rem; }
.businessBrandCopy .appearanceNote { margin-top: 9px; margin-bottom: 0; }
.businessBrandCopy .actions { margin-top: 12px; }
.businessLogoInput { position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.businessLogoInput input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.businessLogoInput:focus-within { outline: 3px solid var(--ui-focus); outline-offset: 3px; }
.businessLogoInput:has(input:disabled) { opacity: .65; cursor: wait; }
.businessBrandCopy .businessBrandStatus { color: var(--ui-text); margin: 12px 0 0; font-size: .85rem; font-weight: 550; }
.businessBrandStatus.is-error { color: var(--ui-error); }
.businessBrandStatus:empty { display: none; }
@media (max-width:540px) {
  .paletteChoices { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .paletteChoice { padding: 7px; }
  .paletteLabel { font-size: .82rem; }
  .businessBrandLayout { grid-template-columns: minmax(0,1fr); gap: 16px; }
  .businessBrandPreview { max-width: 220px; min-height: 120px; padding: 15px; }
  .businessBrandPreview img { height: 85px; }
}

.accentChoices { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin-top: 15px; }
.accentChoice { display: flex; gap: 9px; align-items: center; min-width: 0; min-height: 50px; padding: 8px 10px; border: 2px solid var(--ui-line); border-radius: 9px; color: var(--ui-text); background: var(--ui-surface); font: inherit; font-size: .85rem; text-align: left; }
.accentChoice[aria-pressed="true"] { border-color: var(--ui-accent); background: var(--ui-tint); font-weight: 650; }
.accentSample { width: 25px; height: 25px; display: inline-grid; place-items: center; border-radius: 50%; flex: none; color: white; }
.accentSample .ico { width: 16px; height: 16px; }
.backgroundAvailability { display: flex; align-items: center; gap: 10px; margin: 15px 0; font-size: .9rem; min-height: 32px; }
.backgroundAvailability input { width: 20px; height: 20px; accent-color: var(--ui-fill); }
.backgroundChoices { display: grid; grid-template-columns: repeat(2,minmax(0,180px)); gap: 10px; }
.backgroundChoice { display: grid; gap: 8px; padding: 8px; border: 2px solid var(--ui-line); border-radius: 10px; background: var(--ui-surface); color: var(--ui-text); font: inherit; text-align: left; font-size: .88rem; }
.backgroundChoice[aria-pressed="true"] { border-color: var(--ui-accent); background: var(--ui-tint); }
.backgroundSample { display: block; width: 100%; height: 70px; border-radius: 5px; position: relative; overflow: hidden; background: var(--ui-bg); }
/* The seasonal preview reflects the full cream / fir / champagne environment. */
.backgroundSample.christmas { background: #f9f7ef; border: 1px solid #dedccb; }
.backgroundSample.christmas::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 23%; background: #1d3d31; }
.backgroundSample.christmas::after { content: "✦"; position: absolute; right: 12%; top: 12px; color: #d2bc88; font-size: 19px; }
.backgroundSample.christmas i { position: absolute; top: 10px; right: 8px; left: 29%; height: 25px; border-radius: 3px; background: #2c4c3d; border: 1px solid #9e8e62; }
.backgroundSample.christmas b { position: absolute; top: 42px; left: 29%; width: 25%; height: 17px; border-radius: 3px; background: #fffef9; border: 1px solid #ddcfad; }
.backgroundSample.christmas em { position: absolute; top: 42px; right: 8px; width: 32%; height: 17px; border-radius: 3px; background: #285747; }
.paletteChoice,.accentChoice,.backgroundChoice { transition: border-color .15s ease, box-shadow .15s ease; }
.paletteChoice:hover,.accentChoice:hover,.backgroundChoice:hover { border-color: var(--ui-control-line); box-shadow: 0 2px 8px #182b3b09; }
.paletteChoice:focus-visible,.accentChoice:focus-visible,.backgroundChoice:focus-visible { outline: 3px solid var(--ui-focus); outline-offset: 3px; }
.businessBrandPreview img { border-radius: 50%; width: 100px; height: 100px; background: white; padding: 5px; }
@media (max-width:540px) { .accentChoices { grid-template-columns: repeat(2,minmax(0,1fr)); } }
