:root {
  color-scheme: light;
  --ink: #241a33;
  --muted: #746b80;
  --page: #f5f1fa;
  --surface: #ffffff;
  --surface-2: #faf7fd;
  --line: #e8dff0;
  --primary: #a98bd7;
  --primary-dark: #7353a6;
  --primary-ink: #241a33;
  --green: #2c8b62;
  --amber: #b87913;
  --red: #b64d58;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body[data-theme="aubergine"] {
  --page: #f7f0f8;
  --surface: #ffffff;
  --surface-2: #fcf7fd;
  --line: #e7d8eb;
  --primary: #5a2d70;
  --primary-dark: #421e54;
  --primary-ink: #fff8ff;
}
body[data-theme="plum"] {
  --page: #f8f1f7;
  --surface: #ffffff;
  --surface-2: #fdf8fc;
  --line: #ead9e6;
  --primary: #713f78;
  --primary-dark: #522b58;
  --primary-ink: #fff8ff;
}
body[data-theme="slate"] {
  --page: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f7fafc;
  --line: #d9e2ec;
  --primary: #355070;
  --primary-dark: #243b53;
  --primary-ink: #f8fbff;
}
body[data-theme="teal"] {
  --page: #eef7f6;
  --surface: #ffffff;
  --surface-2: #f7fcfb;
  --line: #d5e8e5;
  --primary: #2f5d62;
  --primary-dark: #204448;
  --primary-ink: #f5ffff;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font-size: 16px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); padding: 12px 13px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--primary-dark); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 24%, transparent); }
textarea { resize: vertical; }

.topbar { min-height: 68px; display: flex; align-items: center; gap: 25px; padding: 0 28px; border-bottom: 1px solid var(--line); background: var(--surface); }
.brand { display: inline-flex; align-items: center; gap: 9px; font-size: 22px; font-weight: 500; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--primary); color: var(--primary-ink); font-size: 19px; }
.topnav { display: flex; gap: 5px; align-self: stretch; }
.topnav a { display: flex; align-items: center; padding: 0 15px; color: var(--muted); border-bottom: 3px solid transparent; }
.topnav a.active { color: var(--ink); border-bottom-color: var(--primary); }
.user-menu { display: flex; align-items: center; gap: 9px; margin-left: auto; color: var(--muted); font-size: 13px; }
.user-initials, .avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: var(--primary-ink); font-size: 12px; font-weight: 500; }
.role-badge { padding: 4px 8px; border-radius: 999px; background: color-mix(in srgb, var(--primary) 18%, transparent); color: var(--primary-dark); font-size: 11px; }
.link-button { border: 0; background: transparent; color: var(--primary-dark); padding: 8px; cursor: pointer; }
.page-shell { width: min(1080px, 100%); margin: 0 auto; padding: 30px 24px 60px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 23px; }
.page-heading h1 { margin: 0; font-size: clamp(26px, 4vw, 34px); font-weight: 500; letter-spacing: -0.03em; }
.page-heading p { margin: 4px 0 0; }
.eyebrow { color: var(--primary-dark); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.muted { color: var(--muted); }
.helper, .field-help { color: var(--muted); font-size: 12px; line-height: 1.5; }
.flash { margin-bottom: 20px; padding: 12px 15px; border-radius: 12px; background: color-mix(in srgb, var(--green) 12%, var(--surface)); color: var(--green); }
.flash.error { background: color-mix(in srgb, var(--red) 12%, var(--surface)); color: var(--red); }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 12px; padding: 0 16px; border: 1px solid transparent; cursor: pointer; white-space: nowrap; }
.primary-button { background: var(--primary); color: var(--primary-ink); }
.primary-button:hover, .primary-button:focus-visible { background: var(--primary-dark); color: #fff; }
.secondary-button { background: var(--surface); color: var(--ink); border-color: var(--line); }
.secondary-button:hover, .secondary-button:focus-visible { border-color: var(--primary-dark); }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.search-form { display: flex; flex: 1; gap: 9px; }
.search-form input { min-width: 0; }
.view-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 25px; }
.view-tabs a { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 13px; border-radius: 999px; color: var(--muted); white-space: nowrap; }
.view-tabs a.active { background: var(--primary); color: var(--primary-ink); }
.view-tabs span { display: inline-grid; place-items: center; min-width: 20px; min-height: 20px; padding: 0 6px; border-radius: 999px; background: color-mix(in srgb, currentColor 12%, transparent); font-size: 11px; }
.group-toolbar { display: flex; align-items: center; gap: 10px; margin: -10px 0 22px; color: var(--muted); font-size: 13px; }
.group-toolbar select { width: auto; min-width: 130px; padding: 9px 12px; }
.order-group { margin-bottom: 27px; }
.section-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.section-heading h2 { margin: 0; font-size: 16px; font-weight: 500; }
.section-heading > span { display: inline-grid; place-items: center; min-width: 22px; min-height: 22px; padding: 0 7px; border-radius: 999px; background: color-mix(in srgb, var(--primary) 20%, transparent); color: var(--primary-dark); font-size: 11px; }
.order-list { display: grid; gap: 10px; }
.order-card { display: block; padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.order-card:hover, .order-card:focus-visible { border-color: var(--primary); background: var(--surface-2); }
.order-card-top, .order-card-bottom { display: flex; align-items: center; gap: 10px; }
.order-card-top strong { font-size: 15px; font-weight: 500; }
.order-client { margin-top: 6px; color: var(--muted); font-size: 13px; }
.order-card-bottom { justify-content: space-between; margin-top: 12px; color: var(--muted); font-size: 12px; }
.priority { margin-left: auto; color: var(--muted); font-size: 12px; }
.status { display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px; border-radius: 999px; font-size: 11px; font-weight: 500; white-space: nowrap; }
.status.not-started { background: color-mix(in srgb, var(--amber) 14%, transparent); color: var(--amber); }
.status.dispatched { background: color-mix(in srgb, var(--amber) 14%, transparent); color: var(--amber); }
.status.finished { background: color-mix(in srgb, var(--primary) 18%, transparent); color: var(--primary-dark); }
.status.payment-received { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.status.large { min-height: 30px; font-size: 12px; }
.durations { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 10px; color: var(--muted); font-size: 11px; }
.durations span { display: inline-flex; align-items: center; }
.empty-state { padding: 45px 20px; text-align: center; border: 1px dashed var(--line); border-radius: 15px; background: var(--surface-2); }
.empty-state h2 { margin: 0 0 5px; font-size: 18px; font-weight: 500; }
.form-panel { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 14px; }
.form-grid label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid input, .form-grid select, .form-grid textarea { color: var(--ink); }
.aligned-help { display: flex; align-items: end; padding-bottom: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.timing-panel { margin-top: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
.timing-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.timing-heading strong { font-size: 14px; font-weight: 500; }
.timing-heading span { color: var(--muted); font-size: 12px; }
.timing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.timing-grid > div { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.timing-grid span, .summary-grid span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.timing-grid strong { display: block; font-size: 16px; font-weight: 500; }
.timing-grid small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.timing-panel p { margin: 11px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.summary-grid > div { padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.summary-grid strong { font-size: 14px; font-weight: 500; }
.photo-section { margin-top: 27px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photo-card { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.photo-card img, .photo-placeholder { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.photo-placeholder { display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-size: 12px; }
.photo-card > span { display: block; overflow: hidden; padding: 9px; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.customer-list { display: grid; gap: 9px; }
.customer-row { display: flex; align-items: center; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.customer-row:hover, .customer-row:focus-visible { border-color: var(--primary); background: var(--surface-2); }
.customer-row > span:nth-child(2) { display: grid; gap: 4px; min-width: 0; }
.customer-row strong { font-size: 14px; font-weight: 500; }
.customer-row small { color: var(--muted); font-size: 12px; }
.row-action { margin-left: auto; color: var(--primary-dark); font-size: 12px; }
.login-shell { min-height: calc(100vh - 90px); display: grid; place-items: center; padding: 30px 0; }
.login-panel { width: min(430px, 100%); padding: 30px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: 0 18px 45px color-mix(in srgb, var(--primary) 15%, transparent); }
.login-brand { margin-bottom: 28px; }
.login-panel h1 { margin: 0; font-size: 29px; font-weight: 500; }
.stack-form { display: grid; gap: 15px; margin-top: 23px; }
.stack-form label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
.check-line { display: flex !important; grid-template-columns: auto 1fr; align-items: center; gap: 8px !important; }
.check-line input { width: auto; }
.stack-form .primary-button { width: 100%; }
.first-login-signout { margin-top: 12px; text-align: center; }
.settings-heading { margin-bottom: 34px; }
.settings-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.settings-card { display: flex; min-height: 230px; flex-direction: column; padding: 26px 27px 25px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 2px 4px color-mix(in srgb, var(--ink) 4%, transparent); transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.settings-card:hover, .settings-card:focus-visible { border-color: var(--primary); box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 12%, transparent); transform: translateY(-2px); }
.card-kicker { color: var(--primary-dark); font-size: 12px; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; }
.settings-card h2 { margin: 14px 0 10px; font-size: 21px; font-weight: 500; letter-spacing: -.02em; }
.settings-card p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.5; }
.card-link { margin-top: auto; padding-top: 26px; color: var(--primary-dark); font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.settings-grid { display: grid; gap: 18px; }
.settings-panel h2 { margin: 0; font-size: 18px; font-weight: 500; }
.settings-detail-panel { margin-bottom: 18px; }
.theme-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.theme-option { display: flex; align-items: center; gap: 11px; min-height: 72px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); color: var(--ink); cursor: pointer; }
.theme-option:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 13%, transparent); }
.theme-option input { width: auto; margin: 0; accent-color: var(--primary-dark); }
.theme-option > span:last-child { display: grid; gap: 3px; min-width: 0; }
.theme-option strong { font-size: 13px; font-weight: 500; }
.theme-option small { color: var(--muted); font-size: 11px; line-height: 1.35; }
.theme-swatch { flex: 0 0 42px; width: 42px; height: 42px; border-radius: 11px; background: var(--theme-color); box-shadow: inset 0 0 0 1px color-mix(in srgb, #fff 22%, transparent); }
.theme-lavender { --theme-color: #a98bd7; }
.theme-aubergine { --theme-color: #5a2d70; }
.theme-plum { --theme-color: #713f78; }
.theme-slate { --theme-color: #355070; }
.theme-teal { --theme-color: #2f5d62; }
.toast-check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; margin-bottom: 26px; }
.toast-check-grid .check-line { color: var(--ink); font-size: 15px; }
.toast-settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; }
.toast-settings-grid label { display: grid; gap: 8px; color: var(--ink); font-size: 14px; }
.select-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toast-stack { position: fixed; z-index: 30; display: grid; gap: 10px; width: min(380px, calc(100vw - 28px)); pointer-events: none; }
.toast-stack.position-top-right { top: 84px; right: 22px; }
.toast-stack.position-center-right { top: 50%; right: 22px; transform: translateY(-50%); }
.toast-stack.position-bottom-right { right: 22px; bottom: 22px; }
.toast-stack.position-top-left { top: 84px; left: 22px; }
.toast-stack.position-bottom-left { bottom: 22px; left: 22px; }
.toast { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 11px; min-height: 58px; padding: 12px 13px; border: 1px solid color-mix(in srgb, var(--toast-accent) 28%, var(--line)); border-radius: 14px; background: color-mix(in srgb, var(--toast-accent) 10%, var(--surface)); color: var(--ink); box-shadow: 0 14px 32px color-mix(in srgb, var(--ink) 15%, transparent); pointer-events: auto; animation: toast-in .2s ease both; }
.toast.no-animation { animation: none; }
.toast.is-closing { opacity: 0; transform: translateX(15px); transition: opacity .18s ease, transform .18s ease; }
.toast-symbol { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; background: var(--toast-accent); color: #fff; font-size: 14px; font-weight: 700; }
.toast-message { font-size: 13px; line-height: 1.4; }
.toast-dismiss { border: 0; background: transparent; color: var(--muted); padding: 5px; font-size: 20px; line-height: 1; cursor: pointer; }
.toast-dismiss:hover, .toast-dismiss:focus-visible { color: var(--ink); }
.toast-success.tone-green, .toast-warning.tone-green, .toast-error.tone-green { --toast-accent: #2c8b62; }
.toast-success.tone-amber, .toast-warning.tone-amber, .toast-error.tone-amber { --toast-accent: #b87913; }
.toast-success.tone-red, .toast-warning.tone-red, .toast-error.tone-red { --toast-accent: #b64d58; }
.toast-success.tone-purple, .toast-warning.tone-purple, .toast-error.tone-purple { --toast-accent: var(--primary-dark); }
@keyframes toast-in { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: translateX(0); } }
.user-list { display: grid; gap: 9px; margin-top: 22px; }
.user-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.user-summary { display: grid; gap: 4px; min-width: 0; }
.user-summary strong { font-size: 14px; font-weight: 500; }
.user-summary span { color: var(--muted); font-size: 12px; }
.user-actions { display: flex; align-items: center; gap: 9px; }
.user-actions .secondary-button { min-height: 36px; padding: 0 11px; font-size: 12px; }
.user-actions button:disabled { cursor: not-allowed; opacity: .55; }
.user-actions details { position: relative; }
.user-actions summary { cursor: pointer; color: var(--primary-dark); font-size: 12px; }
.reset-form { position: absolute; right: 0; z-index: 2; display: grid; gap: 8px; width: 230px; margin-top: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 12px 30px color-mix(in srgb, var(--primary) 15%, transparent); }
.reset-form input { padding: 9px 10px; font-size: 12px; }
.reset-form .primary-button { min-height: 36px; font-size: 12px; }

@media (max-width: 680px) {
  .topbar { padding: 0 15px; gap: 12px; }
  .topnav { order: 3; width: 100%; height: 43px; }
  .topbar { flex-wrap: wrap; min-height: 112px; }
  .user-menu { margin-left: auto; }
  .user-name, .user-menu form { display: none; }
  .role-badge { display: none; }
  .page-shell { padding: 22px 14px 45px; }
  .page-heading { align-items: start; flex-direction: column; gap: 13px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search-form { width: 100%; }
  .form-grid, .summary-grid, .timing-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .aligned-help { padding: 0; margin-top: -9px; }
  .summary-grid > div { padding: 12px; }
  .settings-card-grid { grid-template-columns: 1fr; }
  .settings-card { min-height: 190px; }
  .toast-check-grid, .toast-settings-grid { grid-template-columns: 1fr; }
  .toast-stack { width: calc(100vw - 28px); }
  .toast-stack.position-top-right, .toast-stack.position-center-right, .toast-stack.position-bottom-right { right: 14px; }
  .toast-stack.position-top-left, .toast-stack.position-bottom-left { left: 14px; }
  .toast-stack.position-center-right { top: 50%; }
  .form-actions { justify-content: stretch; }
  .form-actions > * { flex: 1; }
  .order-card-top { flex-wrap: wrap; }
  .priority { margin-left: 0; }
  .login-panel { padding: 24px 18px; }
  .user-row { grid-template-columns: 1fr; }
  .user-actions { justify-content: space-between; }
}
