/* ==========================================================================
   D.A.I.O. — look layer (v204)
   Loads after brand.css. Holds the "hand-built" look shared with DAIO Home v8:
   plain solid surfaces, modest corners, no stripes, glows, or gradients, accents
   used with purpose. Also the phone header, the one button pattern on phones,
   the spacing scale (8 / 12 / 16 / 24 / 32), 16px fields, 44px targets, and the
   parts of dark mode that brand.css cannot reach through tokens.
   ========================================================================== */

/* ---------- Base ---------- */
/* Page, text, and links follow the active palette. */
html {
  background: var(--page-bg);
}
body {
  background: var(--page-bg);
  color: var(--ink);
}
a {
  color: var(--link);
}
.muted,
.hint {
  color: var(--muted);
}
.error-text,
.hint.error-text {
  color: var(--danger-text);
}
::placeholder {
  color: var(--faint);
  opacity: 1;
}
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- Fields ---------- */
/* Every field is 16px (so iOS never zooms) and at least 44px tall, on the field color. */
html input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]),
html select,
html textarea {
  font-size: 16px !important;
  min-height: 44px;
  border-radius: var(--radius-ctl);
  background-color: var(--field-bg);
  color: var(--ink);
  border-color: var(--line-2);
}
html textarea {
  min-height: 88px;
}
html select option {
  background: var(--field-bg);
  color: var(--ink);
}
html input:focus,
html select:focus,
html textarea:focus {
  background-color: var(--field-bg);
  border-color: var(--blue);
  box-shadow: var(--focus);
}
/* Autofill keeps the field color and text color instead of yellow or white. */
html input:-webkit-autofill,
html input:-webkit-autofill:hover,
html input:-webkit-autofill:focus,
html textarea:-webkit-autofill,
html select:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
  -webkit-box-shadow: 0 0 0 1000px var(--field-bg) inset;
  box-shadow: 0 0 0 1000px var(--field-bg) inset;
  transition: background-color 9999s ease-out 0s;
}
html input:autofill {
  -webkit-text-fill-color: var(--ink);
  box-shadow: 0 0 0 1000px var(--field-bg) inset;
}

/* A password field with our own Show / Hide button. */
.pass-wrap {
  position: relative;
  display: block;
}
.pass-wrap input {
  width: 100%;
  padding-right: 76px;
}
.pass-wrap .show-pass {
  position: absolute;
  top: 0;
  right: 0;
  height: 44px;
  min-width: 64px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--link);
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  border-radius: var(--radius-ctl);
}

/* ---------- Buttons ---------- */
/* Solid fills, 8px corners, 44px tall. Green is the main action. No halos. */
html .btn {
  min-height: 44px;
  border-radius: var(--radius-ctl);
  box-shadow: none;
  font-size: 15px;
  padding: 10px 16px;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line-2);
}
html .btn.small {
  min-height: 44px;
  font-size: 14px;
  padding: 8px 14px;
}
html .btn.green {
  background: var(--green);
  border-color: var(--green);
  color: var(--on-green);
}
html .btn.green:hover {
  background: var(--green-2);
  border-color: var(--green-2);
}
html .btn.blue {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--on-blue);
}
html .btn.blue:hover {
  background: var(--blue-2);
  border-color: var(--blue-2);
}
html .btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-2);
}
html .btn.ghost:hover {
  background: var(--surface-2);
}
html .btn.ghost.danger,
html .btn.danger {
  color: var(--danger-text);
  border-color: var(--danger-line);
  background: transparent;
}
html .btn.ghost.on-dark,
html .hero .btn.ghost {
  color: var(--on-dark);
  border-color: rgba(244, 246, 248, 0.32);
  background: transparent;
}
html .btn.ghost.on-dark:hover {
  background: rgba(255, 255, 255, 0.08);
}
html .btn.ghost.danger.on-dark {
  color: #f3b4b4;
  border-color: rgba(243, 180, 180, 0.45);
}
html .btn:disabled,
html .btn[disabled] {
  opacity: 0.6;
  cursor: default;
}
.btn.wide {
  width: 100%;
}
/* A quiet secondary action: plain text, centered, still a 44px target. */
.text-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--link);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* ---------- Surfaces ---------- */
/* Cards are plain and solid with a 10px corner and a short shadow. An accent is a thin left edge. */
html .card,
html .panel,
html .lib-folder,
html .fact,
html .dash-stat,
html .dash-panel,
html .ready-add,
html .turn-cal,
html .ready-col,
html .turn-pane,
html .spec-card,
html .photo-tile,
html .empty-card,
html .desk-card,
html .callout {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background-color: var(--card);
  color: var(--ink);
}
html .callout.warn {
  background: var(--gold-soft);
}
html .card::before,
html .lib-folder::before,
html .ready-add::before {
  width: 3px;
  background: var(--green);
}
html .lib-folder:hover {
  transform: none;
  box-shadow: var(--shadow);
  border-color: var(--line-2);
}
html .desk-card:hover,
html .card:hover {
  transform: none;
  box-shadow: var(--shadow);
}
/* The brand stripe and the decorative bars are gone everywhere. */
.brand-stripe,
.print-stripe-screen {
  display: none !important;
}
html .hero {
  background: var(--hero-bg);
  box-shadow: none;
  border-left: var(--accent-edge);
  border-bottom: 0;
}
html .hero::before,
html .hero::after,
html .shell::before,
html .open-hero::before,
html .open-hero::after,
html .open-bar::before {
  display: none;
}
html .open-hero {
  background: var(--hero-bg);
  box-shadow: none;
}
html .shell,
html .open-bar {
  background: var(--bar-dark);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 1px solid var(--nav-line);
  box-shadow: none;
}
html .side-nav {
  background: var(--nav-bg);
}
html .side-nav a.active {
  background: var(--green);
  color: var(--on-green);
  box-shadow: none;
  border-radius: var(--radius-ctl);
}
html .side-nav a {
  min-height: 44px;
  display: flex;
  align-items: center;
  border-radius: var(--radius-ctl);
}
html footer.site-foot {
  background: transparent;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

/* ---------- Header ---------- */
/* Logo, then one cluster of equal 44px controls: Search, the bell, light/dark, and Menu. */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid rgba(244, 246, 248, 0.18);
  border-radius: var(--radius-ctl);
  background: transparent;
  color: var(--on-dark);
  cursor: pointer;
}
.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
}
.theme-toggle .sun {
  display: none;
}
html[data-theme="dark"] .theme-toggle .sun {
  display: block;
}
html[data-theme="dark"] .theme-toggle .moon {
  display: none;
}
html header.shell #search-toggle,
html header.shell #reorder-bell {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--radius-ctl);
  border: 1px solid rgba(244, 246, 248, 0.18);
  background: transparent;
  color: var(--on-dark);
  margin: 0;
}
html header.shell #nav-toggle {
  min-height: 44px;
  height: 44px;
  border-radius: var(--radius-ctl);
  margin: 0;
}
/* Saving status. It never sits in the control cluster: on a phone it is a small note at the
   bottom of the screen while a save runs, and "Saved" shows for a moment after. */
html header.shell > #save-state {
  border-radius: var(--radius-ctl);
  box-shadow: none;
}
@media (max-width: 900px) {
  html header.shell {
    gap: 8px;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
  }
  html header.shell > .brand {
    order: 1;
    flex: 1 1 auto;
    max-width: none;
    margin-right: auto;
  }
  html header.shell > #search-toggle {
    order: 2;
  }
  html header.shell > #reorder-bell {
    order: 3;
  }
  html header.shell > #theme-toggle {
    order: 4;
  }
  html header.shell > #nav-toggle {
    order: 5;
    display: inline-flex;
    padding: 0 14px;
  }
  html header.shell > .search {
    order: 6;
  }
  html header.shell > #save-state,
  html header.shell > #save-state:not(.hidden) {
    position: fixed;
    left: 50%;
    top: auto;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 90;
    min-height: 44px;
    min-width: 0;
    padding: 0 16px;
    font-size: 14px;
    box-shadow: var(--shadow-pop);
  }
  html header.shell > #save-state.hidden {
    display: none;
  }
  /* The open search row sits a full step under the bar. */
  html header.shell.search-open > .search:not(.hidden) {
    margin-top: 0;
    padding-bottom: 8px;
  }
}
html header.shell .search input,
html header.shell #q {
  font-size: 16px;
  min-height: 44px;
  height: 44px;
  border-radius: var(--radius-ctl);
  background: var(--navy-2);
  color: var(--on-dark);
  border: 1px solid #3a4652;
}
html header.shell #q::placeholder {
  color: #9aa6b2;
}
html .view-as select {
  border-radius: var(--radius-ctl);
}

/* ---------- Light and dark choice in the menu ---------- */
.theme-box {
  padding: 8px 6px 4px;
}
.theme-label {
  margin: 0 0 8px;
  color: var(--on-dark-muted);
  font-size: 13px;
  font-weight: 800;
}
.theme-choice {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--nav-line);
  border-radius: var(--radius-ctl);
}
.theme-choice button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--on-dark);
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.theme-choice button[aria-pressed="true"] {
  background: var(--green);
  color: var(--on-green);
}
@media (min-width: 901px) {
  html .side-nav-tools {
    display: block;
    margin-top: 16px;
  }
}

/* ---------- Spacing ---------- */
/* One scale: 8, 12, 16, 24, 32. Fields have 16px under them before the next card. */
.section-label {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--green-text);
}
html main.wrap > * + * {
  margin-top: 24px;
}
html main.wrap > .callout + *,
html main.wrap > .preview-banner + * {
  margin-top: 16px;
}
.hub-stack {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
html .office-search,
html .fleet-search,
html .unit-search {
  margin-bottom: 16px;
}
html .chips {
  gap: 8px;
}
html .lib-grid,
html .grid-2 {
  gap: 12px;
}
html .btn-row {
  gap: 8px;
}
html .field + .field,
html .field + .hint,
html .hint + .field {
  margin-top: 12px;
}

/* ---------- Phones: one button pattern and full-width leftovers ---------- */
@media (max-width: 720px) {
  /* Main actions are full width. Two actions are two equal buttons. */
  html main .btn-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    width: 100%;
  }
  html main .btn-row:has(> :nth-child(2):last-child) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  html main .btn-row > .btn,
  html main .btn-row > a.btn,
  html main .btn-row > button {
    width: 100%;
    margin: 0;
  }
  /* Hero actions: equal buttons, two to a row, never tiny pills. */
  html .hero .btn-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px !important;
  }
  html .hero .btn-row > .btn,
  html .hero .btn-row > .tip-wrap,
  html .hero .btn-row > .tip-wrap > .btn,
  html .hero .btn-row > .hero-more,
  html .hero .btn-row > .hero-more > .btn,
  html .hero .hero-more-btn {
    width: 100%;
    min-height: 44px;
    height: auto;
    padding: 8px 12px;
    font-size: 15px;
    border-radius: var(--radius-ctl);
  }
  html .hero .btn-row > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
  /* A card left alone on its row fills the row instead of leaving a dead gutter. */
  html .lib-grid > :last-child:nth-child(odd),
  html .grid-2 > :last-child:nth-child(odd),
  html .lib-grid > .lib-add,
  html .lib-grid > :nth-child(odd):has(+ .lib-add) {
    grid-column: 1 / -1;
  }
  /* The approval banner stacks: the sentence, then a full-width button. */
  html .preview-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  html .preview-banner > .btn {
    width: 100%;
  }
  html .hero-link {
    margin: 12px 0 0;
  }
  html .hero-link a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--on-dark-link);
    font-weight: 700;
  }
}
@media (max-width: 380px) {
  /* Narrow phones: one site or folder per row so names don't wrap hard. */
  html .lib-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Book did not load ---------- */
.load-error {
  padding-top: 24px;
}
.load-error-card {
  padding: 24px 16px;
  border: 1px solid var(--card-line);
  text-align: center;
}
.load-error-card h2 {
  margin: 0 0 8px;
}
.load-error-card p {
  margin: 0 0 16px;
  color: var(--muted);
}
.load-error-card .load-error-out {
  margin: 8px 0 0;
}

/* ---------- Site and company tiles ---------- */
/* Remove is a footer action on the tile, 44px tall, and still asks first. */
html .lib-folder .lib-remove {
  position: static;
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  min-height: 44px;
  margin-top: 8px;
  padding: 0 4px;
  opacity: 1;
  border: 0;
  background: transparent;
  color: var(--danger-text);
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Shop ---------- */
.place-form {
  display: grid;
  gap: 12px;
}
.place-form > .btn {
  width: 100%;
}

/* ---------- Footer links ---------- */
/* Legal links are real 44px targets. */
html footer.site-foot a,
html .open-foot a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 4px;
}

/* ---------- Calendar ---------- */
html .turn-nav .btn,
html .turn-cal .btn {
  min-height: 44px;
}

/* ---------- Pop-ups inside a dark band ---------- */
/* Menus that open from a hero sit on a card, so they use the page's accent shades again. */
.hero .hero-more-menu,
.hero .tip-pop,
.shell .results,
.shell .reorder-menu {
  --green-text: #0f6a45;
  --blue-text: #1f58c9;
  --gold-text: #8a5b00;
  --link: #1f58c9;
}
html[data-theme="dark"] .hero .hero-more-menu,
html[data-theme="dark"] .hero .tip-pop,
html[data-theme="dark"] .shell .results,
html[data-theme="dark"] .shell .reorder-menu {
  --green-text: #8ee0b8;
  --blue-text: #8cb4ff;
  --gold-text: #e8b84a;
  --link: #8cb4ff;
}

/* ---------- Logo ---------- */
html header.shell > .brand,
html .open-bar > .brand {
  min-height: 44px;
}
html #nav-toggle.nav-toggle {
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding-top: 0;
  padding-bottom: 0;
  align-items: center;
  justify-content: center;
}
html .bell-count {
  background: var(--danger);
  color: #ffffff;
}

/* ---------- Small controls get real targets ---------- */
/* Chips stay pill-shaped (they are tags), but a chip you can tap is 44px tall. */
html button.chip,
html a.chip,
html .chip-x,
html .btn.fact-btn,
html a.btn.fact-btn,
html .occ-pick,
html .turn-tab,
html .ready-move,
html .lib-remove {
  min-height: 44px;
}
html button.chip,
html .chip-x {
  border-radius: var(--radius-pill);
  padding: 0 14px;
}
html .btn.fact-btn {
  padding: 8px 14px;
}

/* ---------- Unit status picks ---------- */
/* Solid fills with text that passes AA on each color. */
html .occ-pick.on.occ-occupied,
html .occ-pick.on.go {
  background: var(--green);
  border-color: var(--green);
  color: var(--on-green);
}
html .occ-pick.on.occ-make-ready {
  background: #e8b84a;
  border-color: #e8b84a;
  color: #0b0f14;
}
html .occ-pick.on.occ-ready {
  background: #148f9a;
  border-color: #148f9a;
  color: #0b0f14;
}
html .occ-pick.on.occ-vacant {
  background: var(--blue-2);
  border-color: var(--blue-2);
  color: #ffffff;
}

/* ---------- Every button and field is at least 44px tall ---------- */
/* Older rules set fixed heights on a few controls; this keeps them all finger-sized. */
html .btn,
html .btn.small,
html .fact-kill,
html input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]),
html select {
  min-height: 44px !important;
}
html select {
  height: auto;
}
html .fact-kill {
  min-width: 44px;
}

/* ---------- Spacing fixes ---------- */
/* A card that follows a two-column grid keeps its 16px gap. */
html .grid-2 + .fact,
html .grid-2 + .card {
  margin-top: 16px;
}
/* The remove × on an extra fact is a 44px target that sits clear of the content. */
html .fact.extra-fact {
  padding-right: 56px;
}
html .fact-kill {
  top: 4px;
  right: 4px;
  width: 44px;
  height: 44px;
}
html .site-pick-item {
  min-height: 44px;
}
/* Button text on green uses the mode's on-green color (white in light, near-black in dark). */
html header.open-bar a.btn,
html .open-hero a.btn.green,
html .btn.green {
  color: var(--on-green);
}

/* ---------- Calendar and shelf counts ---------- */
/* Back / Today / Next sit in one row of three equal buttons. */
html .turn-cal-h .btn-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
/* Shelf count: the number box on top, then Add one and Take one at equal width. */
@media (max-width: 720px) {
  html .qty-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  html .qty-box > input {
    grid-column: 1 / -1;
    width: 100%;
  }
  html .qty-box > .qty-bumps {
    display: contents;
  }
  html .qty-bumps .btn {
    width: 100%;
  }
}

/* ---------- No colored top stripes ---------- */
/* Pop-ups, the footer, and the work-order counts used a thick colored top edge. They get a plain
   edge; the counts keep their color as a thin left border. */
html .access-peek,
html .modal,
html .reorder-menu {
  border-top: 1px solid var(--card-line);
}
html footer.site-foot {
  border-top: 1px solid var(--line);
}
html .wo-tile {
  border-top: 1px solid var(--card-line);
  border-left: 3px solid var(--green);
}
html .wo-tile:nth-child(2) {
  border-left-color: var(--blue);
}
html .wo-tile:nth-child(3) {
  border-left-color: var(--gold);
}
html .wo-tile:nth-child(4) {
  border-left-color: var(--warn);
}
