:root {
  color-scheme: light;
  --bg: #f1f1f0;
  --surface: #fafafa;
  --section: #e2e2e2;
  --ink: #202020;
  --muted: #6f6f6f;
  --accent: #9c8752;
  --dark: #000000;
  --line: rgba(0, 0, 0, 0.09);
  --danger: #973e36;
  --danger-soft: #f3e1df;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.09);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(156, 135, 82, 0.42);
  outline-offset: 2px;
}
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3, .brand strong { font-family: Georgia, "Times New Roman", serif; font-weight: 500; }

.app-shell { width: min(1480px, 100%); min-height: 100vh; margin: 0 auto; padding: 0 34px 42px; }
.topbar {
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark, .login-brand-mark { display: grid; place-items: center; }
.brand-mark { width: 31px; height: 45px; }
.brand-emblem { display: block; width: 100%; height: 100%; object-fit: contain; filter: brightness(0); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 19px; letter-spacing: 0.03em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }

main { padding-top: 42px; }
.hero {
  position: relative;
  min-height: clamp(230px, 25vw, 340px);
  margin-bottom: 24px;
  overflow: hidden;
  border-bottom: 2px solid var(--accent);
  background: #1b1b1b;
}
.hero img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 38%;
}
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: 0.19em; text-transform: uppercase; }
h1 { max-width: 760px; margin-bottom: 12px; font-size: clamp(38px, 5vw, 66px); line-height: 1.02; letter-spacing: 0.01em; }

.button {
  display: inline-flex;
  min-height: 42px;
  padding: 0 18px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.045em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease, transform 150ms ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: 0.58; transform: none; }
.button-primary { color: #fff; border-color: var(--accent); background: var(--dark); }
.button-primary:hover { background: #1d1d1d; }
.button-secondary { color: var(--ink); border-color: rgba(156, 135, 82, 0.7); background: transparent; }
.button-secondary:hover { color: var(--accent); border-color: var(--accent); }
.button-quiet { color: var(--muted); background: transparent; }
.button-danger { color: #fff; background: var(--danger); }

.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin-bottom: 22px; background: var(--line); border: 1px solid var(--line); }
.summary-card { position: relative; min-height: 124px; padding: 20px 22px; overflow: hidden; background: var(--surface); }
.summary-card::after { position: absolute; right: 0; bottom: 0; width: 54px; height: 3px; background: var(--summary-accent, var(--accent)); content: ""; }
.summary-label { display: block; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.summary-card strong { display: block; margin: 10px 0 3px; font-family: Georgia, "Times New Roman", serif; font-size: 39px; font-weight: 500; line-height: 1; }
.summary-card small { color: var(--muted); font-size: 11px; }
.summary-waiting { --summary-accent: #a34d43; }
.summary-today { --summary-accent: #ba8747; }
.summary-completed { --summary-accent: #71806a; }
.summary-open { --summary-accent: #667c8a; }

.workshop-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.tool-card { min-width: 0; padding: 23px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.tool-card h2 { margin-bottom: 9px; font-size: 25px; }
.tool-description, .tool-footnote { color: var(--muted); font-size: 11px; line-height: 1.6; }
.tool-description { margin-bottom: 18px; }
.tool-footnote { margin: 14px 0 0; }
.tool-input-label { display: block; margin-bottom: 8px; font-size: 11px; font-weight: 800; }
#hubLength { width: min(100%, 220px); height: 44px; padding: 0 12px; border: 1px solid #cfcfcd; background: #fff; font: inherit; font-size: 17px; }
.tool-error { margin: 12px 0; color: var(--danger); font-size: 12px; }
.hub-interval { margin: 16px 0 10px; color: var(--muted); font-size: 12px; }
.hub-interval strong { color: var(--ink); }
.hub-marks { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.hub-marks li, .hub-margins { display: flex; justify-content: space-between; gap: 15px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.hub-marks strong, .hub-margins strong { font-variant-numeric: tabular-nums; }
.hub-margins { margin-top: 9px; color: var(--muted); font-size: 11px; border: 0; }
.pay-navigation { display: flex; align-items: center; gap: 10px; margin: 12px 0 16px; }
.pay-navigation > strong { min-width: 0; font-family: Georgia, "Times New Roman", serif; font-size: 19px; }
.pay-navigation .text-button { margin-left: auto; }
.pay-total { padding: 15px 16px; background: var(--section); border-left: 3px solid var(--accent); }
.pay-total > span, .pay-total small { display: block; color: var(--muted); font-size: 11px; }
.pay-total > strong { display: block; margin: 8px 0 4px; font-family: Georgia, "Times New Roman", serif; font-size: 31px; font-weight: 500; }
.pay-orders { max-height: 250px; overflow-y: auto; }
.pay-entry { display: flex; align-items: center; gap: 14px; border-bottom: 1px solid var(--line); }
.pay-entry .pay-order { flex: 1; min-width: 0; border-bottom: 0; }
.pay-transfer { display: flex; align-items: center; gap: 6px; min-height: 44px; cursor: pointer; font-size: 11px; }
.pay-transfer input { width: 20px; height: 20px; accent-color: var(--accent); }
.pay-transfer:has(input:disabled) { opacity: 0.6; cursor: wait; }
@media (max-width: 420px) { .pay-transfer { flex-direction: column; justify-content: center; gap: 3px; } }
.pay-order { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; text-align: left; }
.pay-order:hover { color: var(--accent); }
.pay-order span { min-width: 0; }
.pay-order span strong, .pay-order small { display: block; }
.pay-order span strong { font-size: 12px; }
.pay-order small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.pay-order > strong { white-space: nowrap; font-size: 13px; }
.pay-empty { padding: 14px 0 0; color: var(--muted); font-size: 11px; }
@media (max-width: 900px) { .workshop-tools { grid-template-columns: 1fr; } }
@media (max-width: 680px) { .tool-card { padding: 17px; } .pay-navigation { gap: 5px; } .pay-navigation > strong { font-size: 17px; } }

.workspace { overflow: hidden; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.workspace-toolbar { display: flex; min-height: 88px; padding: 18px 22px; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.month-navigation, .toolbar-actions { display: flex; align-items: center; }
.month-navigation { gap: 10px; }
.month-navigation h2 { min-width: 180px; margin: 0; font-size: 26px; letter-spacing: 0.02em; }
.month-navigation .eyebrow { margin-bottom: 2px; }
.toolbar-actions { gap: 18px; }
.icon-button, .text-button, .view-toggle button { border: 0; cursor: pointer; }
.icon-button { display: grid; width: 38px; height: 38px; place-items: center; color: var(--ink); border: 1px solid var(--line); background: #fff; font-size: 25px; line-height: 1; }
.icon-button:hover { color: var(--accent); border-color: var(--accent); }
.text-button { margin-left: 3px; padding: 8px 9px; color: var(--accent); background: transparent; font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.completed-toggle { display: flex; align-items: center; gap: 8px; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 650; }
.completed-toggle input { width: 17px; height: 17px; accent-color: var(--accent); }
.view-toggle { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border: 1px solid var(--line); background: var(--bg); }
.view-toggle button { min-width: 64px; padding: 7px 11px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.view-toggle button.is-active { color: #fff; background: var(--dark); }

.weekday-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); background: var(--section); }
.weekday-row span { padding: 12px; color: #565656; font-size: 9px; font-weight: 850; letter-spacing: 0.14em; text-align: center; text-transform: uppercase; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-day { min-width: 0; min-height: 144px; padding: 10px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day:nth-last-child(-n + 7) { border-bottom: 0; }
.calendar-day.is-outside { background: #f4f4f3; }
.calendar-day.is-outside .day-number { color: #a8a8a8; }
.calendar-day.is-today { background: #f8f8f6; box-shadow: inset 0 0 0 2px rgba(156, 135, 82, 0.52); }
.day-header { display: flex; min-height: 27px; align-items: center; justify-content: space-between; }
.day-number { display: grid; width: 27px; height: 27px; place-items: center; color: var(--muted); font-size: 11px; font-weight: 800; }
.is-today .day-number { color: #fff; background: var(--accent); }
.day-count { color: var(--muted); font-size: 9px; font-weight: 750; }
.day-orders { display: grid; gap: 5px; margin-top: 6px; }
.order-chip { width: 100%; min-width: 0; padding: 7px 8px; color: #333; border: 0; border-left: 3px solid var(--stage-color, var(--accent)); border-radius: 0; background: var(--stage-bg, #eeeeec); cursor: pointer; text-align: left; }
.order-chip strong, .order-chip small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-chip strong { font-size: 11px; }
.order-chip small { margin-top: 2px; color: rgba(32, 32, 32, 0.68); font-size: 9px; }
.order-chip .leather-date { color: #4f4a3d; font-weight: 750; }
.stage-not_started { --stage-color: #303030; --stage-bg: #ededed; }
.stage-scheduled { --stage-color: #647c8a; --stage-bg: #e7ecef; }
.stage-in_progress { --stage-color: #a87836; --stage-bg: #f2eadc; }
.stage-waiting { --stage-color: #9b594e; --stage-bg: #f1e4e2; }
.stage-ready { --stage-color: #667d5f; --stage-bg: #e6ebe3; }
.stage-complete { --stage-color: #787f79; --stage-bg: #ebedeb; opacity: 0.7; }
.more-orders { padding: 2px 4px; color: var(--muted); font-size: 9px; font-weight: 750; }

.order-list { padding: 8px 22px 24px; }
.list-group { padding-top: 18px; }
.list-group h3 { margin-bottom: 8px; color: var(--muted); font-family: inherit; font-size: 9px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.list-order { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; width: 100%; padding: 13px 4px; align-items: center; gap: 12px; color: var(--ink); border: 0; border-bottom: 1px solid var(--line); background: transparent; cursor: pointer; text-align: left; }
.list-order:hover { background: rgba(156, 135, 82, 0.045); }
.list-date { display: grid; width: 48px; height: 58px; padding: 4px 0; place-items: center; border: 1px solid var(--line); background: var(--bg); line-height: 1; }
.list-date strong, .list-date span { display: block; text-align: center; }
.list-date strong { font-family: Georgia, "Times New Roman", serif; font-size: 20px; font-weight: 500; }
.list-date .list-date-label { color: var(--accent); font-size: 7px; font-weight: 900; letter-spacing: 0.03em; text-transform: uppercase; }
.list-date .list-date-month { color: var(--muted); font-size: 8px; font-weight: 850; text-transform: uppercase; }
.list-main { min-width: 0; }
.list-main strong, .list-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-main strong { font-size: 13px; }
.list-main small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.stage-pill { padding: 5px 8px; color: var(--stage-color, var(--accent)); background: var(--stage-bg, #eeeeec); font-size: 9px; font-weight: 850; white-space: nowrap; text-transform: uppercase; }

.empty-state, .loading-panel, .error-panel { display: grid; min-height: 360px; padding: 44px 20px; place-content: center; color: var(--muted); text-align: center; }
.empty-state h3, .error-panel h3 { margin-bottom: 6px; color: var(--ink); font-size: 24px; }
.empty-state p, .error-panel p, .loading-panel p { max-width: 420px; margin-bottom: 0; line-height: 1.55; }
.error-panel .button { margin: 18px auto 0; }
.spinner { width: 30px; height: 30px; margin: 0 auto 14px; border: 3px solid var(--section); border-top-color: var(--accent); border-radius: 50%; animation: spin 850ms linear infinite; }
.privacy-note { margin: 18px 0 0; color: var(--muted); font-size: 10px; letter-spacing: 0.04em; text-align: center; }

.order-dialog { width: min(660px, calc(100% - 28px)); max-height: calc(100vh - 32px); padding: 0; overflow: hidden; border: 0; border-top: 3px solid var(--accent); border-radius: 0; background: var(--surface); box-shadow: 0 30px 100px rgba(0, 0, 0, 0.38); }
.order-dialog::backdrop { background: rgba(0, 0, 0, 0.68); backdrop-filter: blur(4px); }
.dialog-card { max-height: calc(100vh - 32px); overflow-y: auto; }
.dialog-header { display: flex; padding: 24px 26px 18px; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin-bottom: 4px; font-size: 29px; }
.dialog-header p:last-child { margin-bottom: 0; color: var(--muted); font-size: 12px; }
.dialog-close { width: 38px; height: 38px; flex: 0 0 auto; color: var(--muted); border: 1px solid var(--line); border-radius: 50%; background: transparent; cursor: pointer; font-size: 25px; line-height: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 22px 26px; }
.form-grid label > span { display: block; margin-bottom: 7px; font-size: 11px; font-weight: 800; letter-spacing: 0.025em; }
.form-grid input[type="date"], .form-grid input[type="text"], .form-grid input[type="number"], .form-grid select, .form-grid textarea { width: 100%; color: var(--ink); border: 1px solid #cfcfcd; border-radius: 0; background: #fff; }
.form-grid input[type="date"], .form-grid input[type="text"], .form-grid input[type="number"], .form-grid select { height: 45px; padding: 0 12px; }
.form-grid textarea { min-height: 116px; padding: 12px; resize: vertical; line-height: 1.5; }
.form-grid label small { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; }
.notes-field, .complete-check { grid-column: 1 / -1; }
.order-status-checks { grid-column: 1 / -1; display: grid; gap: 14px; min-width: 0; margin: 0; padding: 18px 0 0; border: 0; border-top: 1px solid var(--line); }
.order-status-checks legend { padding: 0 8px 0 0; font-size: 12px; font-weight: 800; }
.complete-check { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.complete-check input { width: 19px; height: 19px; accent-color: var(--accent); }
.complete-check span { margin: 0 !important; }
.dialog-actions { display: flex; padding: 17px 26px calc(17px + env(safe-area-inset-bottom)); justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); background: var(--bg); }
.dialog-actions #deleteOrder { margin-right: auto; }
.toast { position: fixed; z-index: 100; right: 24px; bottom: 24px; max-width: min(380px, calc(100% - 32px)); padding: 12px 16px; color: #fff; border-left: 3px solid var(--accent); background: var(--dark); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28); font-size: 12px; font-weight: 700; opacity: 0; pointer-events: none; transform: translateY(12px); transition: opacity 180ms ease, transform 180ms ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast.is-error { background: var(--danger); }

.login-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(0, 0, 0, 0.96), rgba(16, 16, 16, 0.9)),
    radial-gradient(circle at 72% 18%, rgba(156, 135, 82, 0.5), transparent 32rem),
    var(--dark);
}
.login-shell { width: min(460px, 100%); padding: 0; }
.login-card { padding: clamp(30px, 7vw, 54px); border-top: 3px solid var(--accent); background: rgba(250, 250, 250, 0.98); box-shadow: 0 30px 90px rgba(0, 0, 0, 0.36); text-align: center; }
.login-brand-mark { width: 52px; height: 78px; margin: 0 auto 20px; }
.login-card h1 { margin-bottom: 14px; font-size: clamp(32px, 7vw, 44px); line-height: 1.08; }
.login-copy { margin: 0 auto 26px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.login-card form { display: grid; gap: 10px; text-align: left; }
.login-card label { color: var(--ink); font-size: 10px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.login-card input { width: 100%; height: 50px; padding: 0 14px; color: var(--ink); border: 1px solid #bdbdb9; border-radius: 0; background: #fff; font-size: 21px; letter-spacing: 0.16em; text-align: center; }
.login-card .button { width: 100%; min-height: 48px; margin-top: 7px; }
.login-error { margin: 3px 0 0; color: var(--danger); font-size: 12px; line-height: 1.45; text-align: center; }

.is-hidden { display: none !important; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calendar-day { min-height: 126px; padding: 7px; }
  .order-chip { padding: 6px; }
  .toolbar-actions { gap: 10px; }
}

@media (max-width: 680px) {
  .app-shell { padding: 0 14px 28px; }
  .topbar { min-height: 70px; }
  .brand-mark { width: 27px; height: 40px; }
  .brand strong { font-size: 16px; }
  .brand small { font-size: 8px; }
  .topbar-actions { gap: 6px; }
  .topbar-actions .button { min-height: 38px; padding: 0 11px; font-size: 9px; }
  main { padding-top: 22px; }
  .hero { min-height: 210px; margin-bottom: 16px; }
  .summary-grid { gap: 1px; margin-bottom: 16px; }
  .summary-card { min-height: 108px; padding: 15px; }
  .summary-card strong { font-size: 32px; }
  .workspace-toolbar { display: block; padding: 15px; }
  .month-navigation { display: grid; grid-template-columns: auto 1fr auto auto; }
  .month-navigation h2 { min-width: 0; font-size: 22px; }
  .toolbar-actions { margin-top: 14px; justify-content: space-between; }
  .weekday-row, .calendar-panel { display: none !important; }
  .order-list { display: block !important; padding: 4px 15px 18px; }
  .view-toggle { display: none; }
  .list-order { grid-template-columns: 48px minmax(0, 1fr); }
  .stage-pill { grid-column: 2; justify-self: start; margin-top: -5px; }
  .order-dialog { width: 100%; max-width: none; max-height: calc(100vh - 12px); margin: auto 0 0; border-top-width: 3px; }
  .dialog-card { max-height: calc(100vh - 12px); }
  .dialog-header { padding: 21px 19px 16px; }
  .dialog-header h2 { font-size: 25px; }
  .form-grid { grid-template-columns: 1fr; padding: 19px; }
  .notes-field, .complete-check { grid-column: auto; }
  .dialog-actions { position: sticky; bottom: 0; padding-right: 19px; padding-left: 19px; }
  .dialog-actions .button { flex: 1; padding: 0 10px; }
  .toast { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); left: 16px; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

.expedited-badge { display: inline-block; width: fit-content; margin-top: 4px; padding: 3px 7px; border: 1px solid #a85a12; border-radius: 6px; background: #fff0d6; color: #713b08; font-size: 11px; font-weight: 750; line-height: 1.3; }
