:root {
  color-scheme: light;
  --graphite-950: #151d22;
  --graphite-900: #202a31;
  --graphite-800: #2d383f;
  --graphite-700: #445159;
  --gray-50: #f7f9fa;
  --gray-100: #eef2f4;
  --gray-200: #dde4e8;
  --gray-300: #cbd4d9;
  --gray-500: #74818a;
  --white: #ffffff;
  --orange: #d84b00;
  --orange-strong: #bf3f00;
  --orange-soft: #fff1e8;
  --blue: #287bd3;
  --blue-soft: #eaf4ff;
  --amber: #d69712;
  --amber-soft: #fff7dc;
  --green: #2f9b4d;
  --green-soft: #ebf8ee;
  --red: #c73b3b;
  --red-soft: #fff0f0;
  --shadow-sm: 0 1px 3px rgba(21, 29, 34, .10), 0 1px 2px rgba(21, 29, 34, .06);
  --shadow-md: 0 14px 38px rgba(21, 29, 34, .16);
  --radius: 10px;
  --sidebar: 220px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body, #app { min-height: 100%; margin: 0; }
body { background: var(--gray-100); color: var(--graphite-950); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 480px) minmax(0, 1fr);
  background: var(--white);
}
.auth-panel { padding: clamp(36px, 8vw, 96px); display: flex; flex-direction: column; justify-content: center; }
.auth-visual { position: relative; overflow: hidden; background: linear-gradient(145deg, var(--graphite-950), #34434c); color: white; padding: 8vw; display: flex; align-items: flex-end; }
.auth-visual::before { content: ""; position: absolute; inset: 8% -20% auto 25%; height: 55%; transform: rotate(-7deg); background: linear-gradient(90deg, transparent, rgba(255,255,255,.07)); border-block: 1px solid rgba(255,255,255,.12); }
.auth-copy { position: relative; max-width: 680px; }
.auth-copy h2 { font-size: clamp(32px, 4vw, 60px); margin: 0 0 18px; line-height: 1.02; }
.auth-copy p { color: #d7e0e4; font-size: 18px; max-width: 580px; }

.brand { display: inline-flex; flex-direction: column; line-height: 1; letter-spacing: -.05em; font-weight: 800; font-size: 29px; }
.brand small { margin-top: 4px; font-size: 7px; letter-spacing: .08em; font-weight: 600; }
.brand-dark { color: var(--graphite-950); margin-bottom: 38px; }
.eyebrow { color: var(--orange); text-transform: uppercase; letter-spacing: .12em; font-weight: 750; font-size: 12px; }
.auth-panel h1 { margin: 8px 0 10px; font-size: 30px; letter-spacing: -.03em; }
.muted { color: var(--gray-500); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; color: #e7ecef; background: linear-gradient(180deg, var(--graphite-900), var(--graphite-950)); padding: 24px 14px 18px; display: flex; flex-direction: column; z-index: 20; }
.sidebar .brand { color: white; margin: 4px 14px 32px; }
.nav { display: grid; gap: 4px; }
.nav-button { width: 100%; min-height: 44px; border: 0; border-left: 3px solid transparent; border-radius: 6px; background: transparent; color: #cad3d8; display: flex; align-items: center; gap: 12px; padding: 0 13px; text-align: left; }
.nav-button:hover { color: white; background: rgba(255,255,255,.05); }
.nav-button.active { color: white; border-left-color: var(--orange); background: rgba(255,255,255,.09); }
.nav-button svg { width: 19px; height: 19px; stroke-width: 1.8; }
.sidebar-spacer { flex: 1; }
.sidebar-user { border-top: 1px solid rgba(255,255,255,.1); padding: 15px 12px 0; font-size: 13px; color: #bac5cb; }
.sidebar-user strong { display: block; color: white; margin-bottom: 3px; }

.workspace { min-width: 0; }
.topbar { height: 66px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; gap: 18px; padding: 0 24px; position: sticky; top: 0; z-index: 15; backdrop-filter: blur(10px); }
.global-search { width: min(460px, 45vw); position: relative; }
.global-search input { width: 100%; height: 38px; border: 1px solid var(--gray-200); border-radius: 7px; padding: 0 14px 0 39px; background: var(--gray-50); }
.global-search svg { position: absolute; left: 12px; top: 10px; width: 18px; color: var(--gray-500); }
.topbar-spacer { flex: 1; }
.topbar-service { color: var(--gray-700); font-size: 13px; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--graphite-800); color: white; font-size: 12px; font-weight: 750; }
.mobile-title { display: none; }

.main { width: min(1500px, 100%); margin: 0 auto; padding: 26px clamp(18px, 3vw, 42px) 60px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-header h1 { font-size: 27px; letter-spacing: -.035em; margin: 0; }
.page-header p { margin: 5px 0 0; color: var(--gray-500); }
.header-actions { display: flex; gap: 9px; flex-wrap: wrap; }

.button { min-height: 40px; border: 1px solid var(--gray-300); background: var(--white); color: var(--graphite-900); border-radius: 7px; padding: 0 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 680; text-decoration: none; transition: .15s ease; }
.button:hover { border-color: var(--graphite-700); transform: translateY(-1px); }
.button.primary { color: white; border-color: var(--orange); background: linear-gradient(#e75a0e, var(--orange)); box-shadow: 0 4px 10px rgba(216,75,0,.18); }
.button.primary:hover { background: var(--orange-strong); }
.button.danger { color: var(--red); border-color: #e6b9b9; background: var(--red-soft); }
.button.small { min-height: 32px; padding: 0 10px; font-size: 13px; }
.button.icon { width: 40px; padding: 0; }
.button:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { background: var(--white); border: 1px solid #e8ecef; border-radius: var(--radius); min-height: 88px; padding: 17px 20px; display: flex; align-items: center; gap: 15px; box-shadow: var(--shadow-sm); }
.stat-icon { width: 42px; height: 42px; border-radius: 9px; display: grid; place-items: center; color: var(--graphite-800); background: var(--gray-100); }
.stat-icon.orange { color: var(--orange); background: var(--orange-soft); }
.stat-icon.blue { color: var(--blue); background: var(--blue-soft); }
.stat-icon.green { color: var(--green); background: var(--green-soft); }
.stat-label { font-size: 12px; color: var(--gray-500); font-weight: 680; }
.stat-value { font-size: 25px; font-weight: 780; line-height: 1.1; }

.panel { min-width: 0; background: var(--white); border: 1px solid #e3e8eb; border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.panel-header { padding: 16px 18px; border-bottom: 1px solid var(--gray-200); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel-header h2, .panel-header h3 { margin: 0; font-size: 16px; }
.panel-body { min-width: 0; padding: 18px; overflow-wrap: anywhere; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 18px; }
.grid-2 > * { min-width: 0; }
.stack { min-width: 0; display: grid; gap: 16px; }

.kanban { display: grid; grid-template-columns: repeat(5, minmax(225px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.kanban-column { min-width: 225px; background: #e8edf0; border-radius: 8px; padding: 8px; }
.kanban-column[data-state="V_PRACI"] { background: #e6f0fb; }
.kanban-column[data-state="CEKA_NA_DILY"] { background: #fbf2d9; }
.kanban-column[data-state="K_PREDANI"] { background: #e7f4ea; }
.kanban-title { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 760; padding: 4px 5px 10px; text-transform: uppercase; letter-spacing: .035em; }
.kanban-title::before { content: ""; width: 4px; height: 18px; border-radius: 5px; background: var(--gray-500); }
.kanban-column[data-state="V_PRACI"] .kanban-title::before { background: var(--blue); }
.kanban-column[data-state="CEKA_NA_DILY"] .kanban-title::before { background: var(--amber); }
.kanban-column[data-state="K_PREDANI"] .kanban-title::before { background: var(--green); }
.count { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; background: rgba(255,255,255,.75); display: grid; place-items: center; color: var(--gray-700); }
.job-card { display: block; width: 100%; border: 1px solid #d9e0e4; border-radius: 7px; background: white; color: inherit; padding: 12px; margin-bottom: 7px; text-align: left; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.job-card:hover { border-color: #aab7bf; box-shadow: var(--shadow-sm); }
.job-card strong { display: block; font-size: 13px; margin-bottom: 3px; }
.job-card .vehicle { font-weight: 720; font-size: 13px; }
.job-card .subject { color: var(--gray-700); margin: 6px 0; font-size: 12px; }
.job-card footer { display: flex; justify-content: space-between; gap: 8px; color: var(--gray-500); font-size: 11px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 10px 12px; text-align: left; color: var(--gray-500); font-size: 11px; text-transform: uppercase; letter-spacing: .045em; border-bottom: 1px solid var(--gray-200); background: var(--gray-50); }
td { padding: 12px; border-bottom: 1px solid var(--gray-200); vertical-align: middle; font-size: 13px; }
tbody tr:hover { background: #fafcfd; }
tbody tr:last-child td { border-bottom: 0; }
.row-link { cursor: pointer; }
.numeric { text-align: right; font-variant-numeric: tabular-nums; }

.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 25px; padding: 0 9px; border-radius: 999px; font-size: 11px; font-weight: 730; color: var(--graphite-800); background: var(--gray-100); white-space: nowrap; }
.badge.blue { color: #1661ad; background: var(--blue-soft); }
.badge.amber { color: #8a5e00; background: var(--amber-soft); }
.badge.green { color: #247a3d; background: var(--green-soft); }
.badge.orange { color: var(--orange-strong); background: var(--orange-soft); }
.badge.red { color: var(--red); background: var(--red-soft); }

.form { display: grid; gap: 15px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; font-weight: 720; color: var(--graphite-700); }
.field input, .field select, .field textarea { width: 100%; min-height: 41px; border: 1px solid var(--gray-300); background: white; border-radius: 7px; padding: 9px 11px; color: var(--graphite-950); }
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid rgba(40,123,211,.15); border-color: var(--blue); }
.check { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.check input { width: 18px; height: 18px; accent-color: var(--orange); }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 4px; }
.help { color: var(--gray-500); font-size: 12px; line-height: 1.45; }

.modal { width: min(680px, calc(100vw - 28px)); max-height: calc(100vh - 28px); padding: 0; border: 0; border-radius: 12px; box-shadow: var(--shadow-md); }
.modal::backdrop { background: rgba(15, 22, 27, .55); backdrop-filter: blur(2px); }
.modal-header { padding: 18px 21px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--gray-200); }
.modal-header h2 { margin: 0; font-size: 19px; }
.modal-body { padding: 20px 21px 24px; max-height: calc(100vh - 110px); overflow-y: auto; }
.close { border: 0; background: transparent; font-size: 24px; color: var(--gray-500); }

.detail-head { background: white; border-bottom: 1px solid var(--gray-200); margin: -26px calc(clamp(18px, 3vw, 42px) * -1) 24px; padding: 22px clamp(18px, 3vw, 42px); }
.detail-head-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.detail-head h1 { margin: 0; font-size: 24px; }
.detail-tabs { display: flex; gap: 22px; margin-top: 20px; font-size: 13px; }
.detail-tabs span { padding-bottom: 10px; border-bottom: 2px solid transparent; }
.detail-tabs .active { color: var(--orange); border-color: var(--orange); font-weight: 720; }
.task { display: flex; gap: 10px; align-items: flex-start; padding: 11px 0; border-bottom: 1px solid var(--gray-200); }
.task input { width: 19px; height: 19px; accent-color: var(--orange); }
.task.done span { text-decoration: line-through; color: var(--gray-500); }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.metric { padding: 13px; background: var(--gray-50); border-radius: 8px; }
.metric small { color: var(--gray-500); }
.metric strong { display: block; margin-top: 3px; }
.timeline { display: grid; gap: 0; }
.timeline-item { position: relative; padding: 0 0 18px 22px; border-left: 2px solid var(--gray-200); margin-left: 5px; }
.timeline-item::before { content: ""; position: absolute; left: -6px; top: 2px; width: 10px; height: 10px; border-radius: 50%; background: var(--orange); border: 2px solid white; }
.timeline-item time { display: block; color: var(--gray-500); font-size: 11px; margin-top: 3px; }
.empty { min-height: 150px; display: grid; place-items: center; text-align: center; color: var(--gray-500); padding: 25px; }

.toast-region { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 100; }
.toast { min-width: 280px; max-width: 430px; color: white; background: var(--graphite-900); border-left: 4px solid var(--green); border-radius: 8px; box-shadow: var(--shadow-md); padding: 13px 15px; animation: toast-in .2s ease-out; }
.toast.error { border-left-color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.skeleton { min-height: 100px; border-radius: 8px; background: linear-gradient(90deg,#eef2f4 25%,#f8fafb 50%,#eef2f4 75%); background-size: 200% 100%; animation: loading 1.2s infinite; }
@keyframes loading { to { background-position: -200% 0; } }

.public-page { min-height: 100vh; background: var(--gray-100); }
.public-top { height: 88px; background: var(--graphite-900); color: white; display: flex; align-items: center; justify-content: space-between; padding: 0 max(24px, calc((100vw - 760px)/2)); }
.public-content { max-width: 760px; margin: 0 auto; padding: 30px 18px 70px; }
.public-card { background: white; border: 1px solid var(--gray-200); border-radius: 12px; padding: 21px; margin-bottom: 14px; box-shadow: var(--shadow-sm); }
.public-hero { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.public-hero h1 { margin: 0 0 5px; font-size: 23px; }
.public-action { width: 100%; min-height: 52px; font-size: 16px; }
.scanner video { width: 100%; min-height: 180px; max-height: 360px; object-fit: cover; background: var(--graphite-950); border-radius: 9px; margin-bottom: 12px; }

.calendar-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 16px; align-items: start; }
.calendar-panel { overflow: hidden; }
.calendar-toolbar { min-height: 62px; padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 15px; border-bottom: 1px solid var(--gray-200); }
.calendar-toolbar h2 { margin: 0; font-size: 19px; text-transform: capitalize; }
.calendar-toolbar span { color: var(--gray-500); font-size: 12px; }
.calendar-weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); color: var(--gray-500); background: var(--gray-50); border-bottom: 1px solid var(--gray-200); }
.calendar-weekdays span { padding: 9px 10px; font-size: 11px; font-weight: 760; text-transform: uppercase; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-day { min-width: 0; min-height: 126px; padding: 8px; border-right: 1px solid var(--gray-200); border-bottom: 1px solid var(--gray-200); background: white; }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day:nth-last-child(-n+7) { border-bottom: 0; }
.calendar-day.outside-month { background: var(--gray-50); }
.calendar-day.outside-month .calendar-date { opacity: .45; }
.calendar-date { min-height: 24px; display: flex; align-items: center; justify-content: space-between; color: var(--gray-700); font-size: 12px; font-weight: 760; }
.calendar-date small { display: none; color: var(--gray-500); font-size: 10px; text-transform: uppercase; }
.calendar-day.today .calendar-date span { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--orange); }
.calendar-events { display: grid; gap: 5px; }
.calendar-event, .unscheduled-job { min-width: 0; width: 100%; border: 0; border-left: 3px solid var(--gray-500); border-radius: 5px; color: var(--graphite-900); background: var(--gray-100); text-align: left; }
.calendar-event { padding: 6px 7px; display: grid; grid-template-columns: auto 1fr; gap: 2px 6px; font-size: 10px; }
.calendar-event time { color: var(--gray-500); font-variant-numeric: tabular-nums; }
.calendar-event strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-event span { grid-column: 1 / -1; overflow: hidden; color: var(--gray-700); text-overflow: ellipsis; white-space: nowrap; }
.calendar-event.state-V_PRACI { border-left-color: var(--blue); background: var(--blue-soft); }
.calendar-event.state-CEKA_NA_DILY { border-left-color: var(--amber); background: var(--amber-soft); }
.calendar-event.state-K_PREDANI, .calendar-event.state-UZAVRENO { border-left-color: var(--green); background: var(--green-soft); }
.calendar-event.state-PREDOBJEDNAVKA, .calendar-event.state-PRIJATO { border-left-color: var(--orange); background: var(--orange-soft); }
.unscheduled-panel { position: sticky; top: 82px; }
.unscheduled-panel .panel-header > div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; width: 100%; }
.unscheduled-list { display: grid; gap: 8px; max-height: calc(100vh - 190px); overflow-y: auto; }
.unscheduled-job { padding: 10px 11px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.unscheduled-job-main { min-width: 0; padding: 0; display: grid; gap: 3px; border: 0; color: inherit; background: transparent; text-align: left; }
.unscheduled-job strong { font-size: 12px; }
.unscheduled-job span { font-size: 12px; font-weight: 700; }
.unscheduled-job small { color: var(--gray-500); font-size: 11px; }
.empty.compact { min-height: 90px; padding: 15px; font-size: 12px; }

.mobile-nav { display: none; }
.export-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(210px,1fr)); gap: 12px; }
.export-card { padding: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--gray-200); border-radius: 8px; }
.capacity-grid { display: grid; grid-template-columns: repeat(7,minmax(190px,1fr)); gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.capacity-grid.capacity-single { grid-template-columns: minmax(280px,600px); }
.capacity-day { min-height: 420px; padding: 12px; background: white; border: 1px solid var(--gray-200); border-radius: 9px; }
.capacity-day h3 { margin: 0 0 12px; text-transform: capitalize; }
.capacity-tech { min-height: 62px; margin-bottom: 10px; padding: 9px; background: var(--gray-50); border-radius: 7px; display: grid; gap: 6px; }
.capacity-tech > button { padding: 8px; display: grid; gap: 3px; text-align: left; color: white; background: var(--blue); border: 0; border-radius: 6px; cursor: pointer; }
.capacity-tech small { color: var(--gray-500); }.capacity-tech > button small { color: rgba(255,255,255,.8); }
.attachment-grid { margin-top: 15px; display: grid; grid-template-columns: repeat(auto-fit,minmax(170px,1fr)); gap: 8px; }
.attachment-card { padding: 11px; display: grid; gap: 4px; color: var(--graphite-900); text-decoration: none; border: 1px solid var(--gray-200); border-radius: 7px; }
.signature-pad { width: 100%; height: 150px; touch-action: none; background: white; border: 1px dashed var(--gray-300); border-radius: 7px; }
.report-row { padding: 10px 0; display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--gray-200); }
.mobile-menu-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }.mobile-menu-grid .button { justify-content: flex-start; }.mobile-menu-grid svg { width: 19px; height: 19px; }

.admin-shell { min-height: 100vh; }
.admin-topbar { min-height: 70px; padding: 12px clamp(18px, 4vw, 56px); color: white; background: var(--graphite-900); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.admin-user { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.admin-main { width: min(1500px, 100%); margin: 0 auto; padding: 34px clamp(18px, 4vw, 56px) 70px; }
.domain-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; border: 1px solid var(--gray-300); border-radius: 7px; overflow: hidden; }
.domain-field input { border: 0; border-radius: 0; }
.domain-field span { padding: 0 11px; color: var(--gray-500); font-size: 13px; }

@media (max-width: 1050px) {
  :root { --sidebar: 78px; }
  .sidebar .brand { margin-inline: auto; }
  .sidebar .brand small, .nav-button span, .sidebar-user { display: none; }
  .nav-button { justify-content: center; padding: 0; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .calendar-layout { grid-template-columns: 1fr; }
  .unscheduled-panel { position: static; }
  .unscheduled-list { max-height: none; }
}

@media (max-width: 720px) {
  .auth-layout { display: block; }
  .auth-visual { display: none; }
  .auth-panel { min-height: 100vh; padding: 30px 22px; }
  .app-shell { display: block; }
  .sidebar { display: none; }
  .topbar { height: 64px; padding: 0 16px; background: var(--graphite-900); color: white; }
  .global-search, .topbar-service { display: none; }
  .mobile-title { display: block; font-size: 17px; font-weight: 760; }
  .main { padding: 20px 14px 90px; }
  .page-header { align-items: stretch; flex-direction: column; gap: 14px; }
  .page-header h1 { font-size: 23px; }
  .page-header > .button { align-self: flex-start; }
  .header-actions { width: 100%; gap: 7px; }
  .header-actions .button { flex: 1 1 auto; min-width: 0; }
  .button { min-height: 38px; max-width: 100%; padding: 7px 11px; font-size: 13px; line-height: 1.2; text-align: center; white-space: normal; }
  .button.small { min-height: 34px; padding-inline: 9px; font-size: 12px; }
  .panel-header { align-items: flex-start; flex-wrap: wrap; padding: 14px; }
  .panel-header .button { flex-shrink: 0; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat { min-height: 75px; padding: 12px; }
  .stat-icon { display: none; }
  .stat-value { font-size: 22px; }
  .kanban { grid-template-columns: 86vw 86vw 86vw 86vw 86vw; scroll-snap-type: x mandatory; }
  .kanban-column { scroll-snap-align: start; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .detail-head { margin: -20px -14px 18px; padding: 18px 14px; }
  .detail-head-row { gap: 10px; }
  .detail-head-row h1 { min-width: 0; flex: 1 1 calc(100% - 54px); font-size: 20px; overflow-wrap: anywhere; }
  .detail-head-row .topbar-spacer { display: none; }
  .detail-head-row > select, .detail-head-row > .button:not(.icon) { flex: 1 1 auto; min-width: 0; max-width: 100%; }
  .detail-tabs { gap: 18px; overflow-x: auto; white-space: nowrap; scrollbar-width: thin; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .button { flex: 1 1 auto; min-width: min(135px, 100%); }
  .modal { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .modal-header { padding: 14px 15px; }
  .modal-header h2 { min-width: 0; font-size: 17px; overflow-wrap: anywhere; }
  .modal-body { padding: 15px; max-height: calc(100dvh - 76px); }
  .metric-grid { grid-template-columns: 1fr; }
  .calendar-toolbar { min-height: 56px; padding: 12px; align-items: flex-start; }
  .calendar-toolbar h2 { font-size: 17px; }
  .calendar-toolbar span { max-width: 115px; text-align: right; }
  .calendar-weekdays { display: none; }
  .calendar-grid { display: block; }
  .calendar-day { min-height: 54px; padding: 7px 9px; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 8px; border-right: 0; border-bottom: 1px solid var(--gray-200); }
  .calendar-day:nth-last-child(-n+7) { border-bottom: 1px solid var(--gray-200); }
  .calendar-day:last-child { border-bottom: 0; }
  .calendar-day.outside-month { display: none; }
  .calendar-date { align-content: start; justify-content: start; gap: 3px; }
  .calendar-date small { display: inline; }
  .calendar-event { padding: 7px 8px; grid-template-columns: 38px minmax(0, 1fr); font-size: 11px; }
  .unscheduled-panel { order: -1; }
  .mobile-nav { position: fixed; inset: auto 0 0; height: 68px; padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5,1fr); background: rgba(255,255,255,.97); border-top: 1px solid var(--gray-200); z-index: 30; backdrop-filter: blur(10px); }
  .mobile-nav button { min-width: 0; border: 0; background: transparent; color: var(--gray-500); display: grid; place-items: center; align-content: center; gap: 3px; font-size: 9px; }
  .mobile-nav button.active { color: var(--orange); }
  .mobile-nav svg { width: 21px; height: 21px; }
  .table-wrap.mobile-cards table, .table-wrap.mobile-cards thead, .table-wrap.mobile-cards tbody, .table-wrap.mobile-cards tr, .table-wrap.mobile-cards td { display: block; }
  .table-wrap.mobile-cards thead { display: none; }
  .table-wrap.mobile-cards tr { padding: 13px; border-bottom: 1px solid var(--gray-200); }
  .table-wrap.mobile-cards td { padding: 3px 0; border: 0; }
  .table-wrap.mobile-cards td .button { margin: 3px 3px 3px 0; }
  .public-top { padding: 0 18px; height: 78px; }
  .public-content { padding-top: 18px; }
  .public-hero { display: grid; }
  .admin-topbar { align-items: flex-start; }
  .admin-user span { display: none; }
  .admin-main { padding: 22px 14px 60px; }
  .domain-field { grid-template-columns: 1fr; }
  .domain-field span { padding: 0 11px 10px; }
}

@media (max-width: 420px) {
  .main { padding-inline: 10px; }
  .page-header { margin-bottom: 16px; }
  .page-header > .button, .header-actions .button { width: 100%; }
  .header-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .header-actions .button:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .button { min-height: 36px; padding-inline: 9px; gap: 5px; font-size: 12px; }
  .button svg { width: 17px; height: 17px; flex: 0 0 auto; }
  .panel-header { padding: 12px; gap: 8px; }
  .panel-header > .button { max-width: 100%; }
  .detail-head { margin-inline: -10px; padding-inline: 10px; }
  .form-actions { display: grid; grid-template-columns: 1fr; }
  .form-actions .button { width: 100%; }
  .toast-region { inset: auto 10px calc(78px + env(safe-area-inset-bottom)) 10px; }
  .toast { min-width: 0; width: 100%; }
}
