:root {
  --bg: #050505;
  --surface: #070707;
  --panel: #101010;
  --panel-2: #171717;
  --line: #303030;
  --line-soft: #303030;
  --text: #f5f5f5;
  --muted: #a8a8a8;
  --soft: #dcdcdc;
  --accent: #f5f5f5;
  --accent-2: #dcdcdc;
  --green: #30c46b;
  --red: #e5484d;
  --ease: cubic-bezier(.2,.8,.2,1);
  --sidebar-width: clamp(196px, 18vw, 240px);
  --page-pad: clamp(16px, 2vw, 26px);
  --calendar-time-width: 64px;
  --calendar-day-width: clamp(112px, 13vw, 150px);
  --radius: 0;
  --shadow: 0 16px 40px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html { overflow-x: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
  font-size: 14px;
  line-height: 1.45;
  max-width: 100vw;
  overflow-x: hidden;
}
button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; border-radius: 0; }
button { cursor: pointer; }
.app { min-height: 100vh; }
.boot { animation: pageIn .25s var(--ease); }

.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: clamp(24px, 5vw, 56px);
  align-items: center;
  padding: clamp(22px, 8vw, 96px);
}
.brand-block h1 { font-size: clamp(48px, 9vw, 116px); line-height: .86; margin: 24px 0 8px; font-weight: 900; }
.brand-block p { color: var(--muted); text-transform: uppercase; letter-spacing: 4px; }
.brand-mark {
  width: 72px; height: 72px; border: 2px solid var(--text);
  color: var(--text);
  display: grid; place-items: center; font-weight: 900; font-size: 24px;
}
.auth-card, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: clamp(16px, 2vw, 24px);
  min-width: 0;
  border-radius: var(--radius);
}
.auth-card h2, .panel h2, .panel h3 { margin: 0 0 10px; text-transform: uppercase; letter-spacing: .04em; }
.section-head { display: flex; justify-content: space-between; gap: 12px; align-items: end; margin-bottom: 10px; }
.section-head h2 { margin-bottom: 0; }
.section-head label { min-width: min(280px, 100%); margin: 0; }
.client-details { border-top: 1px solid var(--line); padding-top: 10px; }
.client-details summary { cursor: pointer; color: var(--muted); font-size: 12px; text-transform: uppercase; font-weight: 800; letter-spacing: .04em; }
.client-details .form-grid { margin-top: 12px; }
.auth-card p, .muted { color: var(--muted); }
label { display: grid; gap: 7px; color: var(--muted); font-size: 11px; text-transform: uppercase; margin: 8px 0; letter-spacing: .04em; }
.check-row { display: flex; align-items: center; gap: 8px; align-self: center; color: var(--text); }
.check-row input { width: auto; min-height: 0; }
input, select, textarea {
  width: 100%;
  background: #050505;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 9px 11px;
  outline: none;
  min-height: 38px;
  transition: border-color .16s var(--ease), background .16s var(--ease), box-shadow .16s var(--ease);
}
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--soft); background: #050505; box-shadow: none; }
.primary, .ghost, .danger {
  min-height: 36px;
  border: 1px solid var(--text);
  background: var(--text);
  color: #050505;
  padding: 8px 12px;
  text-transform: uppercase;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .03em;
  transition: transform .15s var(--ease), background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.danger { border-color: var(--red); background: var(--red); color: white; }
button:hover { transform: translateY(-1px); }
.ghost:hover { border-color: var(--text); color: var(--text); background: transparent; }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  border-right: 1px solid var(--line);
  padding: clamp(16px, 1.7vw, 22px);
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--sidebar-width);
  height: 100vh;
  height: 100dvh;
  background: var(--surface);
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.side-brand { display: flex; align-items: center; gap: 12px; font-weight: 900; margin-bottom: 30px; }
.side-brand .brand-mark { width: 42px; height: 42px; font-size: 15px; }
.nav { display: grid; gap: 18px; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.nav-group { display: grid; gap: 3px; }
.nav-group-label { color: #747474; font-size: 10px; font-weight: 900; letter-spacing: .13em; padding: 0 9px 5px; text-transform: uppercase; }
.nav button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  text-align: left;
  padding: 10px 9px;
  border-radius: 0;
  text-transform: uppercase;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .04em;
  display: flex;
  align-items: center;
  gap: 9px;
  transition: color .16s var(--ease), background .16s var(--ease), border-color .16s var(--ease);
}
.nav-dot { width: 6px; height: 6px; border: 1px solid currentColor; border-radius: 50%; opacity: .65; }
.nav button:hover { color: var(--text); background: #101010; transform: none; }
.nav button.active { color: var(--text); border-color: var(--line); background: #151515; transform: none; }
.nav button.active .nav-dot { background: currentColor; opacity: 1; }
.session { margin-top: auto; padding-top: 18px; color: var(--muted); font-size: 12px; }
.account-menu { position: relative; }
.account-menu summary { display: flex; align-items: center; gap: 9px; min-height: 48px; padding: 7px; border: 1px solid transparent; border-radius: 0; cursor: pointer; list-style: none; }
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu summary:hover, .account-menu[open] summary { border-color: var(--line); background: #151515; }
.account-avatar { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 50%; color: var(--text); font-size: 12px; font-weight: 900; }
.account-copy { display: grid; min-width: 0; gap: 1px; }
.account-copy strong { color: var(--text); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.account-copy small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-chevron { margin-left: auto; color: var(--muted); font-size: 16px; transition: transform .16s var(--ease); }
.account-menu[open] .account-chevron { transform: rotate(180deg); }
.account-actions { position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 60; width: max(190px, 100%); display: grid; gap: 8px; padding: 9px; border: 1px solid var(--line); background: #101010; box-shadow: var(--shadow); }
.account-actions > span { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-actions .ghost { width: 100%; }
.main { grid-column: 2; padding: var(--page-pad); min-width: 0; overflow: hidden; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 18px; }
.topbar h1 { margin: 0; text-transform: uppercase; font-size: clamp(28px, 3.2vw, 36px); line-height: 1; }
.topbar p { margin: 7px 0 0; color: var(--muted); }
.dashboard-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.dashboard-focus { margin-bottom: 16px; }
.run-list { display: grid; gap: 6px; }
.run-item { display: flex; gap: 8px; align-items: stretch; background: #0b0b0b; border: 1px solid var(--line); padding: 6px; }
.run-item-main { display: grid; gap: 3px; min-width: 0; flex: 1; text-align: left; color: var(--text); background: transparent; border: 0; padding: 4px; }
.run-item span, .attention-panel p { color: var(--muted); font-size: 12px; }
.run-item:hover { border-color: var(--soft); background: #151515; }
.run-pay { flex: 0 0 auto; align-self: center; }
.run-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: end; }
.page { animation: pageIn .22s var(--ease); }

.grid { display: grid; gap: 12px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.forecast-widget-panel { grid-column: 1 / -1; overflow-x: auto; }
.windguru-widget { min-width: 720px; }
.windguru-frame { display: block; width: 100%; height: 360px; border: 0; background: #fff; }
.dashboard-financials { margin-bottom: 16px; }
.dashboard-unpaid-panel, .dashboard-calendar-panel, .finance-income { margin-top: 16px; }
.dashboard-calendar-tabs { margin-bottom: 0; }
.dashboard-unpaid-list { display: grid; gap: 8px; }
.dashboard-unpaid-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: start; border: 1px solid var(--line); background: #0b0b0b; padding: 10px; }
.dashboard-unpaid-item strong, .dashboard-unpaid-item span { display: block; overflow-wrap: anywhere; }
.dashboard-unpaid-item span { color: var(--muted); margin-top: 4px; font-size: 12px; }
.dashboard-unpaid-item .row-actions { justify-content: end; min-width: min(420px, 100%); }
.booking-payment-note { align-self: end; margin: 8px 0; color: var(--muted); font-size: 12px; }
.form-note { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; text-transform: none; letter-spacing: 0; }
.staff-account-panel, .account-panel { margin-bottom: 16px; }
.stat {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 14px;
  min-height: 92px;
  border-radius: var(--radius);
  animation: cardIn .25s var(--ease);
}
.stat span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.stat strong { display: block; font-size: clamp(22px, 2.4vw, 28px); margin-top: 10px; }
.green { color: var(--green); }
.red { color: var(--red); }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.toolbar label { margin: 0; min-width: 180px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); max-width: 100%; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; min-width: 720px; table-layout: auto; }
th, td { padding: 10px 11px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; background: rgba(255,255,255,.015); }
tr { transition: background .15s var(--ease); }
tbody tr:hover { background: #191919; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.row-actions button { flex: 1 1 104px; }
.hidden { display: none !important; }
.badge { display: inline-block; border: 1px solid var(--line); padding: 3px 6px; text-transform: uppercase; font-size: 11px; color: var(--muted); border-radius: 999px; }
.badge.green { border-color: rgba(48, 196, 107, .45); color: var(--green); }
.badge.red { border-color: rgba(229, 72, 77, .5); color: var(--red); }
.client-panel { min-width: 0; }
.client-cards { display: none; }
.client-table table { min-width: 880px; }
.client-table th:nth-child(1), .client-table td:nth-child(1) { width: 22%; }
.client-table th:nth-child(2), .client-table td:nth-child(2) { width: 30%; }
.client-table th:nth-child(6), .client-table td:nth-child(6) { width: 180px; }
.client-name strong, .client-name span, .client-age small { display: block; }
.client-name span, .client-age small { color: var(--muted); margin-top: 5px; line-height: 1.35; overflow-wrap: anywhere; }
.client-age div { margin-top: 6px; }
.client-metrics-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; flex: 1 1 100%; min-width: min(320px, 100%); }
.client-metrics-form label { margin: 0; }
.client-metrics-form .full { grid-column: 1 / -1; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs .active-tab { background: var(--text); color: #050505; border-color: var(--text); }
.booking-pane { animation: pageIn .2s var(--ease); }
.booking-pane > h2 { margin-bottom: 16px; }
.booking-form {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}
.booking-section {
  min-width: 0;
  border: 1px solid var(--line);
  background: #0b0b0b;
  padding: 14px;
  animation: cardIn .22s var(--ease);
}
.booking-section h3 {
  margin: 0 0 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text);
  font-size: 12px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.booking-main { grid-column: span 8; }
.booking-rentals { grid-column: span 4; grid-row: span 2; }
.booking-pricing { grid-column: span 4; }
.booking-extras { grid-column: span 4; }
.booking-status { grid-column: span 8; }
.booking-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 2px;
}
.booking-actions .primary { min-width: min(220px, 100%); }
.booking-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.booking-section .form-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
  gap: 10px 12px;
}
.booking-section .compact-grid { grid-template-columns: 1fr; }
.booking-section label:first-child { margin-top: 0; }
.booking-section label:last-child { margin-bottom: 0; }
.booking-rentals label { margin-bottom: 10px; }
.booking-rentals .tag-row,
.booking-extras .tag-row { margin-bottom: 10px; }
.compact-options { max-height: 174px; }
.booking-rentals .compact-options { max-height: 328px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); gap: 8px 12px; align-items: end; }
.form-grid .wide { grid-column: span 2; }
.form-grid .full { grid-column: 1 / -1; }
.client-search { position: relative; }
.dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  z-index: 20;
  background: #050505;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transform-origin: top;
  animation: dropdownIn .18s var(--ease);
  max-height: 220px;
  overflow: auto;
}
.dropdown button {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  text-align: left;
  padding: 10px;
  display: grid;
  gap: 4px;
}
.dropdown button strong { font-size: 13px; }
.dropdown button span, .dropdown button small { color: var(--muted); font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; }
.dropdown button small.green { color: var(--green); }
.dropdown button small.red { color: var(--red); }
.dropdown .suggestion-empty { color: var(--muted); cursor: default; }

.calendar-controls { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.calendar-controls label { min-width: min(190px, 100%); }
.calendar-toolbar { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.calendar-toolbar h2 { margin-bottom: 2px; }
.calendar-suggestion { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); background: #0b0b0b; padding: 10px; margin-bottom: 10px; }
.calendar-suggestion span { color: var(--muted); }
.calendar-touch-hint { display: none; }
.week-calendar {
  border: 1px solid var(--line);
  background: #060606;
  overflow: auto;
  scroll-behavior: smooth;
  scroll-padding-left: var(--calendar-time-width);
  border-radius: var(--radius);
}
.week-head {
  min-width: calc(var(--calendar-time-width) + (7 * var(--calendar-day-width)));
  display: grid;
  grid-template-columns: var(--calendar-time-width) repeat(7, minmax(var(--calendar-day-width), 1fr));
  position: sticky;
  top: 0;
  z-index: 4;
  background: #080808;
  border-bottom: 1px solid var(--line);
}
.time-head, .day-head {
  min-height: 46px;
  padding: 9px;
  border-right: 1px solid var(--line-soft);
}
.time-head {
  position: sticky;
  left: 0;
  z-index: 5;
  background: #080808;
}
.day-head strong { display: block; text-transform: uppercase; font-size: 11px; letter-spacing: .04em; }
.day-head span { color: var(--muted); font-size: 12px; }
.day-head.today { background: #171717; box-shadow: inset 0 -2px 0 var(--text); }
.week-scroll {
  min-width: calc(var(--calendar-time-width) + (7 * var(--calendar-day-width)));
  display: grid;
  grid-template-columns: var(--calendar-time-width) repeat(7, minmax(var(--calendar-day-width), 1fr));
}
.time-rail {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #080808;
  border-right: 1px solid var(--line);
}
.time-rail div {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 11px;
}
.week-day {
  position: relative;
  border-right: 1px solid var(--line-soft);
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 63px, var(--line) 64px);
  overflow: hidden;
  cursor: crosshair;
}
.week-day.today { background-color: rgba(255,255,255,.018); }
.week-calendar.dragging-days .week-day { overflow: visible; }
.empty-state {
  border: 1px solid var(--line);
  padding: 22px;
  color: var(--muted);
  text-transform: uppercase;
  border-radius: var(--radius);
}
.calendar {
  display: grid;
  grid-template-columns: 62px repeat(7, minmax(120px, 1fr));
  border: 1px solid var(--line);
  overflow: auto;
  background: #070707;
}
.cal-head, .time-cell, .day-cell {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.cal-head { min-height: 46px; padding: 10px; color: var(--muted); text-transform: uppercase; font-size: 12px; position: sticky; top: 0; background: #080808; z-index: 2; }
.time-cell { min-height: 64px; padding: 6px; color: var(--muted); font-size: 12px; }
.day-cell { min-height: 64px; position: relative; }
.booking-block {
  position: absolute;
  background: var(--text);
  color: #050505;
  border: 1px solid var(--text);
  border-left: 1px solid var(--text);
  border-radius: 0;
  padding: 8px 9px 10px;
  overflow: hidden;
  font-size: 11px;
  text-align: left;
  min-height: 30px;
  animation: blockIn .25s var(--ease);
  transition: transform .22s var(--ease), opacity .18s var(--ease), top .2s var(--ease), left .2s var(--ease), width .2s var(--ease), height .2s var(--ease), box-shadow .2s var(--ease);
  will-change: transform, top, height;
  touch-action: none;
  cursor: grab;
  box-shadow: none;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-content: stretch;
  gap: 3px;
}
.booking-block.is-unpaid { border-color: var(--text); }
.booking-block:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0,0,0,.35); }
.booking-block.dragging {
  z-index: 8;
  cursor: grabbing;
  box-shadow: 0 16px 38px rgba(0,0,0,.45);
  transition: top .07s linear, left .07s linear, height .07s linear, width .07s linear, transform .12s var(--ease), box-shadow .12s var(--ease), opacity .12s var(--ease);
}
.booking-block.settling { transition: transform .24s var(--ease), top .24s var(--ease), left .24s var(--ease), width .24s var(--ease), height .24s var(--ease), box-shadow .24s var(--ease); }
.booking-block.cancelled { opacity: .45; background: transparent; color: var(--muted); text-decoration: line-through; border-style: dashed; }
.booking-block .block-head { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; white-space: nowrap; overflow: hidden; min-width: 0; }
.booking-block .block-head span, .booking-block .block-client, .booking-block .block-service { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.booking-block .block-client, .booking-block .block-service { display: block; white-space: nowrap; }
.booking-block .block-client { align-self: center; font-weight: 800; }
.booking-block .block-service { align-self: end; opacity: .72; padding-bottom: 2px; }
.booking-block em {
  flex: 0 0 auto;
  font-style: normal;
  text-transform: uppercase;
  font-size: 9px;
  font-weight: 900;
  opacity: .75;
  line-height: 1;
  margin-top: 2px;
}
.resize-handle {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 10px;
  border-bottom: 0;
  cursor: ns-resize;
}
.resize-handle::after {
  content: '';
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: 4px;
  height: 2px;
  background: rgba(5,5,5,.32);
  opacity: 0;
  transition: opacity .14s var(--ease);
}
.booking-block:hover .resize-handle::after,
.booking-block.dragging .resize-handle::after { opacity: 1; }
.calendar-draft {
  position: absolute;
  left: 6px;
  right: 6px;
  z-index: 6;
  display: grid;
  place-items: center;
  border: 1px dashed var(--soft);
  background: rgba(245,245,245,.12);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  pointer-events: none;
  animation: blockIn .14s var(--ease);
  border-radius: 0;
}
.rental-picker { align-self: stretch; }
.rental-options {
  max-height: 190px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.rental-option {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  background: #050505;
  color: var(--text);
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  min-height: 58px;
}
.rental-option.selected { background: var(--text); color: #050505; }
.rental-option span { min-width: 0; overflow-wrap: anywhere; }
.rental-option small { display: block; color: var(--muted); margin-top: 3px; }
.rental-option.selected small { color: #333; }
.rental-option b { flex: 0 0 auto; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; min-height: 28px; }
.tag {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 5px 8px;
  font-size: 12px;
  text-transform: uppercase;
  border-radius: 999px;
}
.price-preview {
  border: 1px solid var(--line);
  background: #050505;
  padding: 12px;
  margin-top: 4px;
  display: grid;
  gap: 6px;
}
.price-preview p {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}
.price-preview span { flex: 0 0 74px; }
.price-preview strong { color: var(--text); text-align: right; overflow-wrap: anywhere; }
.price-preview .price-total {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  margin-top: 2px;
}
.price-preview .price-warning {
  color: var(--red);
  display: block;
  text-align: left;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 92vw);
  height: 100vh;
  background: #080808;
  border-left: 1px solid var(--line);
  padding: 24px;
  z-index: 80;
  transform: translateX(104%);
  transition: transform .22s var(--ease);
  overflow: auto;
  box-shadow: var(--shadow);
}
.drawer.open { transform: translateX(0); }
.drawer h2 { text-transform: uppercase; margin: 18px 0 8px; }
.drawer-close { width: 100%; }
.detail-list { display: grid; grid-template-columns: 120px 1fr; gap: 10px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 14px 0; }
.detail-list dt { color: var(--muted); text-transform: uppercase; font-size: 12px; }
.detail-list dd { margin: 0; }

.chart { height: 230px; width: 100%; }
.chart path.line {
  fill: none;
  stroke: var(--text);
  stroke-width: 2.5;
  stroke-linecap: square;
  animation: drawLine .9s var(--ease);
}
.skeleton {
  min-height: 100px;
  background: linear-gradient(90deg, #101010 0%, #1d1d1d 50%, #101010 100%);
  background-size: 200% 100%;
  animation: shimmer 1s linear infinite;
  border: 1px solid var(--line);
}
.toast {
  position: fixed;
  right: 22px; bottom: 22px;
  z-index: 100;
  background: var(--text);
  color: #050505;
  padding: 12px 14px;
  transform: translateY(20px);
  opacity: 0;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
  max-width: 360px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--red); color: white; }

@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes cardIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes blockIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes dropdownIn { from { opacity: 0; transform: scaleY(.96); } to { opacity: 1; transform: scaleY(1); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes drawLine { from { stroke-dasharray: 900; stroke-dashoffset: 900; } to { stroke-dasharray: 900; stroke-dashoffset: 0; } }

@media (max-width: 980px) {
  .auth-screen, .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; inset: auto; z-index: auto; width: auto; height: auto; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .side-brand { margin-bottom: 16px; }
  .nav { grid-auto-flow: column; grid-auto-columns: max-content; flex: none; overflow-x: auto; overflow-y: hidden; padding-bottom: 4px; gap: 8px; }
  .nav-group { display: flex; gap: 5px; }
  .nav-group-label { display: none; }
  .nav button { white-space: nowrap; }
  .session { margin-top: 20px; padding-top: 0; }
  .main { grid-column: auto; }
  .cols-3, .cols-4, .cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calendar-toolbar { display: grid; }
  .booking-main, .booking-status { grid-column: 1 / -1; }
  .booking-rentals, .booking-pricing, .booking-extras { grid-column: span 6; grid-row: auto; }
  .booking-rentals .compact-options { max-height: 240px; }
}
@media (max-width: 620px) {
  :root { --calendar-time-width: 56px; --calendar-day-width: 92px; --page-pad: 12px; }
  html { -webkit-text-size-adjust: 100%; }
  body { font-size: 15px; }
  input, select, textarea { font-size: 16px; min-height: 44px; }
  button, .primary, .ghost, .danger { min-height: 44px; }
  .auth-screen { align-items: start; min-height: 100dvh; padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom)); gap: 30px; }
  .auth-card { width: 100%; padding: 18px; }
  .brand-mark { width: 58px; height: 58px; }
  .brand-block h1 { font-size: 42px; line-height: .92; }
  .shell { display: block; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 7px 8px;
    align-items: center;
    padding: max(8px, env(safe-area-inset-top)) 10px 7px;
    box-shadow: 0 8px 22px rgba(0,0,0,.35);
    max-width: 100vw;
    overflow: hidden;
  }
  .side-brand { margin: 0; gap: 0; }
  .side-brand .brand-mark { width: 36px; height: 36px; font-size: 12px; }
  .side-brand > div:last-child { display: none; }
  .session {
    position: static;
    margin: 0;
    display: block;
    justify-self: end;
  }
  .account-menu summary { min-height: 34px; padding: 2px; }
  .account-avatar { width: 30px; height: 30px; }
  .account-copy, .account-chevron { display: none; }
  .account-actions { top: calc(100% + 7px); bottom: auto; right: 0; width: min(190px, calc(100vw - 20px)); }
  .nav {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    padding: 0 10px 2px;
    margin: 0 -10px;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-group { display: flex; gap: 6px; }
  .nav button { flex: 0 0 auto; min-height: 36px; padding: 7px 9px; scroll-snap-align: start; font-size: 11px; gap: 6px; }
  .nav-dot { display: none; }
  .cols-2, .cols-3, .cols-4, .cols-5 { grid-template-columns: 1fr; }
  .dashboard-unpaid-item { grid-template-columns: 1fr; }
  .dashboard-unpaid-item .row-actions { justify-content: stretch; min-width: 0; }
  .forecast-widget-panel { overflow-x: hidden; }
  .windguru-widget { min-width: 0; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .windguru-frame { width: 100%; min-width: 0; height: 340px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .topbar { display: grid; }
  .section-head { display: grid; }
  .topbar h1 { font-size: 30px; }
  .topbar p { font-size: 13px; }
  .main { padding: var(--page-pad); overflow: visible; }
  .panel, .auth-card { padding: 14px; max-width: 100%; }
  .toolbar { display: grid; grid-template-columns: 1fr; }
  .dashboard-actions { display: grid; grid-template-columns: 1fr; }
  .toolbar label, .calendar-controls label { min-width: 0; width: 100%; }
  .toolbar > button, .toolbar > .actions, .toolbar > .primary, .toolbar > .ghost { width: 100%; }
  .actions { display: grid; grid-template-columns: 1fr; }
  .actions button { width: 100%; }
  .booking-form { grid-template-columns: 1fr; }
  .booking-main, .booking-rentals, .booking-pricing, .booking-extras, .booking-status { grid-column: 1 / -1; }
  .booking-section { padding: 12px; }
  .booking-split { grid-template-columns: 1fr; }
  .booking-actions { display: grid; }
  .booking-actions .primary, .booking-actions .ghost { width: 100%; }
  .price-preview p { display: grid; gap: 3px; }
  .price-preview strong { text-align: left; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; padding-bottom: 3px; }
  .tabs { scroll-snap-type: x proximity; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs .ghost { scroll-snap-align: start; }
  .tabs .ghost { flex: 0 0 auto; white-space: nowrap; }
  .calendar-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
  .calendar-suggestion { align-items: stretch; flex-direction: column; }
  .calendar-controls label { grid-column: 1 / -1; }
  .calendar-controls button { width: 100%; }
  .table-wrap, .week-calendar, .calendar { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  .table-wrap { margin-inline: -1px; max-width: calc(100vw - (var(--page-pad) * 2)); }
  .week-head, .week-scroll { grid-template-columns: var(--calendar-time-width) repeat(7, minmax(var(--calendar-day-width), 1fr)); min-width: calc(var(--calendar-time-width) + (7 * var(--calendar-day-width))); }
  .time-head, .day-head { padding: 8px 6px; }
  .week-calendar { scroll-snap-type: x proximity; }
  .day-head, .week-day { scroll-snap-align: start; }
  .week-day { cursor: pointer; }
  .calendar-touch-hint { display: block; margin: -2px 0 10px; color: var(--muted); font-size: 12px; line-height: 1.35; }
  .booking-block { padding: 6px 6px 12px; font-size: 11px; cursor: grab; touch-action: none; }
  .resize-handle { display: block; height: 18px; }
  .resize-handle::after { opacity: .58; bottom: 6px; left: 7px; right: 7px; }
  th, td { padding: 10px; }
  .client-table { display: none; }
  .client-cards { display: grid; gap: 10px; }
  .client-card { border: 1px solid var(--line); background: var(--panel); padding: 12px; display: grid; gap: 11px; }
  .client-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
  .client-card-head strong, .client-card-head span, .client-card-notes small { display: block; overflow-wrap: anywhere; }
  .client-card-head span, .client-card-notes small, .client-card-metrics small { color: var(--muted); margin-top: 4px; line-height: 1.35; }
  .client-card-meta { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; color: var(--muted); }
  .client-card-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .client-card-metrics > div { border: 1px solid var(--line-soft); padding: 9px; background: #0b0b0b; min-width: 0; }
  .client-card-metrics span { color: var(--muted); text-transform: uppercase; font-size: 10px; font-weight: 900; letter-spacing: .04em; }
  .client-card-metrics strong { display: block; margin-top: 4px; overflow-wrap: anywhere; }
  .client-metrics-form { grid-template-columns: 1fr; min-width: 0; width: 100%; }
  .client-metrics-form .actions { display: grid; grid-template-columns: 1fr; }
  .row-actions button { flex-basis: 100%; padding-inline: 10px; }
  .drawer { width: 100%; height: 100dvh; padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom)); }
  .detail-list { grid-template-columns: 1fr; gap: 4px; }
  .toast { left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); max-width: none; }
}

@media (max-width: 380px) {
  :root { --calendar-day-width: 86px; --page-pad: 10px; }
  .nav button { padding-inline: 8px; font-size: 10.5px; }
  .calendar-controls { grid-template-columns: 1fr; }
  .stat { padding: 12px; }
  .stat strong { font-size: 21px; }
  .windguru-frame { height: 320px; }
}

@media (hover: none) {
  button:hover, .booking-block:hover { transform: none; box-shadow: none; }
  .booking-block.dragging { box-shadow: 0 20px 42px rgba(0,0,0,.38); }
}
