:root {
  color-scheme: light;
  --paper: #f7f4ee;
  --surface: #fffefa;
  --surface-soft: #f2eee8;
  --ink: #292729;
  --muted: #625d5d;
  --line: #ded7d0;
  --accent: #792e42;
  --accent-strong: #5f2133;
  --accent-soft: #f3e6e9;
  --danger: #a0303c;
  --success: #246b4a;
  --shadow: 0 14px 42px rgba(41, 31, 32, .07);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
input, select, textarea { color: var(--ink); }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { line-height: 1.15; }
h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 7vw, 3.15rem); letter-spacing: -.035em; margin-bottom: .55rem; }
h2 { font-family: Georgia, "Times New Roman", serif; font-size: 1.38rem; letter-spacing: -.015em; margin-bottom: 1.1rem; }
small { font-size: .875rem; }
:focus-visible { outline: 3px solid #bb7286; outline-offset: 3px; }

.boot-screen { min-height: 100dvh; display: grid; place-items: center; color: var(--muted); }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .13em; font-size: .875rem; font-weight: 800; margin-bottom: .6rem; }
.intro { color: var(--muted); margin-bottom: 1.7rem; }
.brand-mark {
  display: inline-block;
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: .62rem;
  background: repeating-linear-gradient(137deg, var(--accent) 0 7px, #f9ede7 7px 11px, var(--accent) 11px 18px);
  box-shadow: inset 0 0 0 2px rgba(121,46,66,.14);
  transform: rotate(-8deg);
}
.brand-mark.large { width: 3.5rem; height: 3.5rem; border-radius: 1rem; }

.login-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: max(1.25rem, env(safe-area-inset-top)) 1rem max(1.5rem, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 84% 12%, #f0dfe3 0, transparent 34%),
    linear-gradient(150deg, #fcfaf6, var(--paper) 74%);
}
.login-art { text-align: center; margin-bottom: 1.5rem; }
.login-card {
  width: min(100%, 27rem);
  margin-inline: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  padding: clamp(1.4rem, 5vw, 2.25rem);
  box-shadow: var(--shadow);
}
.login-card h1 { margin-bottom: .35rem; }
.login-card .intro { margin-bottom: 1.6rem; }
.login-foot { color: var(--muted); font-size: .875rem; margin: 1.35rem 0 0; text-align: center; }

.field { display: flex; flex-direction: column; gap: .42rem; margin-bottom: 1rem; min-width: 0; }
.field label, .payment-field legend { color: var(--ink); font-size: .9rem; font-weight: 700; }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 3.1rem;
  padding: .7rem .9rem;
  background: #fff;
  border: 1.5px solid #cfc6bf;
  border-radius: .75rem;
  outline: none;
}
.field textarea { min-height: 6.3rem; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(121,46,66,.12); }
.field input::placeholder { color: #8e8583; }
.password-control { position: relative; }
.password-control input { padding-right: 5.1rem; }
.password-toggle { position: absolute; right: .4rem; top: 50%; transform: translateY(-50%); min-width: 4.2rem; min-height: 2.35rem; padding: .2rem .45rem; border: 0; border-radius: .55rem; background: var(--surface-soft); color: var(--accent-strong); font-size: .875rem; font-weight: 750; }
.password-toggle:hover { background: var(--accent-soft); }
.field select {
  appearance: none;
  padding-right: 2.8rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m3.5 6 4.5 4 4.5-4' fill='none' stroke='%235f2133' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .9rem center;
}
.field small, .field-help { color: var(--muted); font-size: .875rem; }
.field-help { margin: -.2rem 0 1rem; }
.form-message {
  border-radius: .7rem;
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: .8rem .9rem;
  font-size: .9rem;
  margin: .3rem 0 1rem;
}
.form-message.success { background: #e7f3eb; color: #18583a; }

.button {
  min-height: 2.9rem;
  border: 1px solid transparent;
  border-radius: .75rem;
  padding: .66rem 1rem;
  font-size: .95rem;
  font-weight: 750;
  line-height: 1.2;
  transition: background .15s ease, transform .15s ease, border-color .15s ease;
}
.button:active:not(:disabled) { transform: translateY(1px); }
.button.primary { background: var(--accent); color: white; }
.button.primary:hover:not(:disabled) { background: var(--accent-strong); }
.button.secondary { background: #fff; color: var(--accent-strong); border-color: #bda8ae; }
.button.secondary:hover:not(:disabled) { background: var(--accent-soft); }
.button.subtle { background: transparent; color: var(--muted); border-color: var(--line); }
.button.text-button { background: transparent; color: var(--accent-strong); padding-inline: .45rem; min-height: 2.5rem; }
.button.text-button:hover { background: var(--accent-soft); }
.button.danger { color: var(--danger); background: #fff; border-color: #dcadb3; }
.button.danger:hover { background: #f9ecee; }
.button.full { width: 100%; }
.icon-button { width: 2.6rem; height: 2.6rem; border: 1px solid var(--line); border-radius: .7rem; background: #fff; font-size: 1.6rem; line-height: 1; color: var(--muted); }

.app-shell { min-height: 100dvh; }
.topbar { position: relative; z-index: 10; background: rgba(255,254,250,.97); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 78rem; min-height: 4.6rem; padding: .7rem 1rem; margin: auto; display: grid; grid-template-columns: minmax(0,1fr) auto; grid-template-areas: "brand logout" "user user"; align-items: center; gap: .25rem .75rem; }
.brand { grid-area: brand; display: inline-flex; align-items: center; gap: .7rem; font-family: Georgia, "Times New Roman", serif; font-weight: 700; font-size: 1.45rem; letter-spacing: -.03em; white-space: nowrap; }
.account-copy { grid-area: user; display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .5rem; min-width: 0; line-height: 1.25; }
.account-copy strong, .account-copy small { display: block; }
.account-copy strong { font-size: .94rem; overflow-wrap: anywhere; }
.account-copy small { color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
#logout-button { grid-area: logout; }
.app-layout { max-width: 78rem; margin: auto; }
.content { width: 100%; min-width: 0; padding: 1.7rem 1rem calc(7rem + env(safe-area-inset-bottom)); }
.view { max-width: 62rem; margin-inline: auto; }
.page-heading { margin-bottom: 1.6rem; }
.page-heading h1 { margin-bottom: .55rem; }
.page-heading > p:last-child { color: var(--muted); max-width: 43rem; margin-bottom: 0; }
.global-message { border-radius: .8rem; padding: .8rem 1rem; margin: 0 auto 1.2rem; max-width: 62rem; background: #e7f3eb; color: #18583a; font-weight: 600; }
.global-message.error { background: #f9e9eb; color: #842637; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 1.15rem; padding: clamp(1.2rem, 4vw, 1.7rem); box-shadow: var(--shadow); }
.panel h2 { margin-bottom: 1.1rem; }
.work-entry { max-width: 38rem; }
.support-note { max-width: 38rem; color: var(--muted); font-size: .88rem; margin: 1rem 0 0; }
.payment-field { padding: 0; border: 0; margin: 0 0 1rem; }
.payment-field legend { margin-bottom: .5rem; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
.segmented label { position: relative; display: block; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span { display: grid; place-items: center; min-height: 3.1rem; border-radius: .75rem; border: 1.5px solid #cfc6bf; background: #fff; font-weight: 700; }
.segmented input:checked + span { color: var(--accent-strong); background: var(--accent-soft); border-color: var(--accent); }
.segmented input:focus-visible + span { outline: 3px solid #bb7286; outline-offset: 3px; }
.amount-control { display: flex; align-items: center; border: 1.5px solid #cfc6bf; border-radius: .75rem; background: #fff; overflow: hidden; }
.amount-control:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(121,46,66,.12); }
.amount-control span { padding-left: .95rem; font-size: 1.2rem; font-weight: 750; color: var(--accent); }
.amount-control input { border: 0; box-shadow: none !important; font-size: 1.45rem; font-weight: 700; min-height: 3.6rem; }

.filter-toggle-row { display: flex; margin-bottom: 1rem; }
.filter-toggle { min-width: 11rem; }
.filters { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .25rem .75rem; align-items: end; background: var(--surface); border: 1px solid var(--line); border-radius: 1rem; padding: 1rem; margin-bottom: 1.75rem; }
.filters .field { margin-bottom: .55rem; }
.filters .field:first-child, .filters .field:nth-child(4) { grid-column: 1 / -1; }
.filter-help { grid-column: 1 / -1; color: var(--muted); font-size: .875rem; margin: -.5rem 0 .4rem; }
.filters .button { margin-bottom: .55rem; }
.section-line { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .8rem; }
.section-line h2 { margin: 0; }
.count-label { color: var(--muted); font-size: .875rem; }
.work-list, .stack-list { display: grid; gap: .7rem; }
.work-card, .stack-card { background: var(--surface); border: 1px solid var(--line); border-radius: 1rem; padding: 1rem; }
.work-card { border-left: 4px solid var(--accent); padding: 1.05rem 1.1rem; box-shadow: 0 5px 20px rgba(41,31,32,.035); }
.work-card.void { border-left-color: #aaa29f; background: var(--surface-soft); }
.work-primary { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .2rem .8rem; margin-bottom: .55rem; }
.work-barber { min-width: 0; margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.25rem, 4.5vw, 1.5rem); line-height: 1.2; font-weight: 700; overflow-wrap: anywhere; }
.work-amount { margin-left: auto; color: var(--accent-strong); font-size: clamp(1.25rem, 4.5vw, 1.5rem); font-weight: 850; line-height: 1.2; white-space: nowrap; letter-spacing: -.025em; }
.work-card.void .work-amount { color: var(--muted); text-decoration: line-through; }
.work-service { margin: 0 0 .55rem; font-size: 1rem; font-weight: 700; overflow-wrap: anywhere; }
.work-details { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .7rem; }
.work-time { color: var(--ink); font-size: 1rem; font-weight: 750; }
.tag { display: inline-flex; align-items: center; border-radius: 99px; padding: .26rem .62rem; background: #ece8e2; color: #4e4948; font-size: .875rem; font-weight: 800; letter-spacing: .02em; }
.tag.qr { background: var(--accent-soft); color: var(--accent-strong); }
.tag.void { background: #f3e6e9; color: #8b3346; }
.work-actions { display: flex; justify-content: flex-end; margin-top: .15rem; }
.button.work-action { min-height: 2.4rem; color: var(--muted); font-size: .875rem; font-weight: 650; }
.button.work-action:hover { color: var(--accent-strong); }
.empty-state { border: 1px dashed #c7bab4; border-radius: 1rem; color: var(--muted); background: rgba(255,255,255,.55); padding: 2.2rem 1.1rem; text-align: center; }
.load-more { margin-top: 1rem; }
.two-column { display: grid; gap: 1.5rem; }
.stack-card { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: .8rem; }
.stack-card h3 { margin: 0; font-size: 1rem; }
.stack-card p { margin: .2rem 0 0; color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.stack-card .actions { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: flex-end; }
.stack-card .button { min-height: 2.65rem; padding: .35rem .55rem; font-size: .875rem; }
.stack-card.inactive { opacity: .7; }
.status-text { color: var(--success); font-size: .875rem; font-weight: 800; }
.status-text.inactive { color: var(--muted); }

.main-nav {
  position: fixed;
  z-index: 20;
  inset: auto 0 0;
  display: flex;
  justify-content: space-around;
  gap: .15rem;
  padding: .35rem .4rem calc(.35rem + env(safe-area-inset-bottom));
  background: rgba(255,254,250,.98);
  border-top: 1px solid var(--line);
  box-shadow: 0 -5px 25px rgba(41,31,32,.05);
}
.nav-item { display: grid; gap: .05rem; place-items: center; flex: 1; min-height: 3.3rem; border: 0; border-radius: .7rem; color: var(--muted); background: transparent; font-size: .875rem; font-weight: 750; }
.nav-item.active { color: var(--accent-strong); background: var(--accent-soft); }
.nav-icon { font-size: 1.37rem; line-height: 1.2; font-weight: 500; }

.modal { width: min(calc(100% - 1.4rem), 31rem); max-height: min(90dvh, 50rem); overflow: auto; padding: 1.35rem; border: 1px solid var(--line); border-radius: 1.15rem; background: var(--surface); color: var(--ink); box-shadow: 0 25px 80px rgba(27,18,22,.22); }
.modal::backdrop { background: rgba(26,20,22,.55); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .7rem; }
.modal-head h2 { margin-bottom: .7rem; }
.modal-help { color: var(--muted); font-size: .86rem; margin-bottom: 1.2rem; }
.modal-actions { display: flex; justify-content: space-between; gap: .7rem; margin-top: 1.1rem; }
.modal-actions .button { flex: 1; }

@media (min-width: 650px) {
  .topbar-inner { display: flex; gap: 1rem; padding-inline: 2rem; }
  .account-copy { display: block; margin-left: auto; text-align: right; }
  .content { padding: 2.4rem 2rem 5rem; }
  .filters { grid-template-columns: repeat(4, minmax(0,1fr)); gap: .7rem; }
  .filters .field:first-child, .filters .field:nth-child(4) { grid-column: auto; }
  .work-card { padding: 1.3rem 1.45rem; }
  .two-column { grid-template-columns: minmax(18rem, .85fr) minmax(19rem, 1.15fr); align-items: start; }
}
@media (min-width: 900px) {
  .app-layout { display: grid; grid-template-columns: 13rem minmax(0,1fr); }
  .main-nav { position: sticky; top: 0; align-self: start; display: grid; justify-content: stretch; gap: .3rem; padding: 1.6rem 1rem; border-top: 0; border-right: 1px solid var(--line); box-shadow: none; background: transparent; }
  .nav-item { display: flex; justify-content: flex-start; gap: .7rem; padding: .55rem .9rem; font-size: .94rem; min-height: 3rem; }
  .content { padding-top: 2.7rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
