:root{color-scheme:light;--navy:#102b48;--blue:#087699;--teal:#09614c;--line:#d5e4ef;--paper:#f5f9fc}
*{box-sizing:border-box}
[hidden]{display:none!important}
body{margin:0;background:var(--paper);color:var(--navy);font:16px/1.65 system-ui,"Segoe UI",sans-serif}
.site-header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px max(18px,calc((100% - 940px)/2));background:#fff;border-bottom:1px solid var(--line)}
.site-header img{object-fit:contain}
main{width:min(940px,calc(100% - 36px));margin:28px auto 50px}
.intro{padding:clamp(24px,5vw,48px);border-radius:22px;background:linear-gradient(120deg,#102b48,#115377);color:#fff}
.intro p{margin:0;max-width:48ch}
.intro .kicker{color:#a9eafa;font-weight:700}
h1{margin:5px 0 8px;font-size:clamp(28px,5vw,46px);line-height:1.25}
h2,h3{margin:0 0 12px;line-height:1.35}
.card,.toolbar,.order{margin-top:18px;background:#fff;border:1px solid var(--line);border-radius:16px;padding:clamp(16px,3vw,26px)}
.toolbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.toolbar button{margin-inline-start:auto}
.badge{background:#edf7fb;color:#15546b;padding:4px 10px;border-radius:99px;font-size:13px;font-weight:700}
form{display:flex;align-items:end;gap:12px;flex-wrap:wrap}
label{display:grid;gap:6px;min-width:0;flex:1 1 160px;font-size:14px;font-weight:700}
input,select,textarea{width:100%;min-width:0;min-height:44px;padding:8px;border:1px solid #9fb8cc;border-radius:8px;background:#fff;color:var(--navy);font:inherit}
textarea{min-height:70px;resize:vertical}
button,.button{min-height:44px;padding:8px 14px;border:1px solid transparent;border-radius:8px;background:var(--teal);color:#fff;font:inherit;font-weight:700;text-decoration:none;cursor:pointer;display:inline-flex;align-items:center;justify-content:center}
button.secondary{background:#edf7fb;color:var(--navy);border-color:#c2d9e9}
button:disabled{opacity:.55;cursor:wait}
:focus-visible{outline:2px solid var(--blue);outline-offset:3px}
.orders{margin-top:26px}
.order header,.actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.order header h3{margin:0}
.order p{margin:8px 0}
.order .actions,.order form,#draft{margin-top:14px}
.work-dialog{width:min(560px,calc(100% - 24px));padding:20px;border:1px solid var(--line);border-radius:16px;color:var(--navy)}
.work-dialog::backdrop{background:#102b4870}
.work-dialog .dialog-close{float:inline-end;margin-inline-start:10px}
.work-dialog form:not(.dialog-close){clear:both}
.work-dialog form>p{flex-basis:100%;margin:0}
.customer-signup-button{margin-block:14px}
.account-heading,.account-controls{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px}
.account-heading h2{margin:0}
.account-controls{justify-content:flex-end}
.account-controls button{min-height:36px;padding:4px 9px;font-size:13px}
#admin-customers{margin:0;min-width:0}
@media(min-width:900px){body[data-role=admin] #admin-customers{grid-column:2;grid-row:2}}
#security p{margin-bottom:0}
#new-identity code{overflow-wrap:anywhere;unicode-bidi:isolate}
#identity-list{overflow-wrap:anywhere}
.thread{display:grid;gap:8px;background:#f4f8fc;border-radius:12px;padding:12px;margin:12px 0;max-height:360px;overflow:auto}
.thread article{background:#fff;border:1px solid var(--line);border-radius:10px;padding:8px 12px;white-space:pre-wrap;overflow-wrap:anywhere}
.thread article small{display:block;color:#315a75}
pre{white-space:pre-wrap;overflow-wrap:anywhere;background:#edf7fb;border-radius:8px;padding:12px;font:inherit}
#status{min-height:1.65em;color:#15546b;font-weight:650}
@media(max-width:540px){main{width:calc(100% - 24px);margin-top:14px}.site-header{padding:9px 12px}form>label{flex-basis:100%}form>button{width:100%}}
@media (min-width: 900px) {
  body[data-role=customer] main { width: min(1240px, calc(100% - 64px)); }
  body[data-role=customer] #workspace {
    display: grid; align-items: start; grid-template-columns: minmax(290px, .8fr) minmax(0, 1.7fr); gap: 16px 22px;
  }
  body[data-role] .toolbar { grid-column: 1 / -1; }
  body[data-role] #work-controls { grid-column: 1; min-width: 0; }
  body[data-role] #work-controls > :first-child,
  body[data-role=customer] #booking { margin-top: 0; }
  body[data-role] .orders { grid-column: 2; margin-top: 0; min-width: 0; }
}

body[data-portal=admin] {
  --paper: #edf2f8;
  --line: #d8e3ef;
  --navy: #152b46;
  --admin-blue: #075d9b;
  --admin-selected: #e5f1fb;
  --admin-muted: #536981;
  --admin-shadow: 0 8px 22px #1936550b;
}
body[data-portal=admin] .site-header { min-height: 68px; padding-inline: max(20px, calc((100% - 1300px) / 2)); }
body[data-portal=admin] main { width: min(1300px, calc(100% - 40px)); margin-top: 24px; }
body[data-portal=admin] .intro { padding: 0; background: transparent; color: var(--navy); }
body[data-portal=admin] h1 { margin: 0 0 16px; font-size: clamp(28px, 3vw, 39px); }
body[data-role=admin] .toolbar {
  min-height: 60px;
  margin: 0;
  padding: 9px 16px;
  border-radius: 13px;
  box-shadow: var(--admin-shadow);
}
body[data-portal=admin] button:not(.secondary) { background: var(--admin-blue); }
body[data-role=admin] #workspace { display: grid; gap: 16px; align-items: start; }
#admin-navigation, #staff-navigation { display: flex; gap: 6px; }
#admin-navigation {
  align-self: start;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--admin-shadow);
}
#admin-navigation button, #staff-navigation button {
  min-height: 42px;
  justify-content: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--navy);
  font-size: 14px;
  text-align: start;
}
#admin-navigation button[aria-selected=true], #staff-navigation button[aria-selected=true],
#admin-navigation button:hover, #staff-navigation button:not(:disabled):hover {
  background: var(--admin-selected);
  color: var(--admin-blue);
}
#admin-navigation button { flex: 1; }
#admin-navigation svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.admin-count { margin-inline-start: auto; min-width: 20px; text-align: center; border-radius: 9px; background: #f3f7fb; padding: 0 4px; font-size: 12px; }
body[data-role=admin] #work-orders, body[data-role=admin] #staff { margin: 0; min-width: 0; }
body[data-role=admin] #work-orders > h2 { margin: 2px 0 14px; }
body[data-role=admin] #staff { box-shadow: var(--admin-shadow); }
#staff-navigation { flex-wrap: wrap; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
#staff-navigation button:disabled { opacity: .5; cursor: default; }
.staff-panel { margin-top: 18px; }
.staff-panel form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  max-width: 780px;
}
.staff-panel form small { grid-column: 1 / -1; color: var(--admin-muted); }
.staff-panel form button { grid-column: 1 / -1; justify-self: start; }
#identity-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
#identity-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
}
#identity-list bdi { display: block; color: var(--admin-muted); font-size: 13px; }
.work-empty { padding: 22px; border: 1px dashed var(--line); border-radius: 14px; color: var(--admin-muted, var(--navy)); background: #fff; }
.admin-order { padding: 0; margin: 0 0 10px; box-shadow: var(--admin-shadow); }
.admin-order summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  cursor: pointer;
  list-style: none;
}
.admin-order summary::-webkit-details-marker { display: none; }
.admin-order summary::after { content: ''; width: 8px; height: 8px; border: solid var(--admin-blue); border-width: 0 2px 2px 0; transform: rotate(45deg); flex: none; }
.admin-order[open] summary::after { transform: rotate(225deg); }
.admin-order summary:hover { background: #f7fbff; border-radius: inherit; }
.admin-order-title { flex: 1; min-width: 0; }
.admin-order-title h3 { margin: 0; font-size: 16px; }
.admin-order-title p { margin: 3px 0 0; color: var(--admin-muted); font-size: 14px; }
.admin-order-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.admin-order-details { border-top: 1px solid var(--line); padding: 10px 18px 18px; }
@media (min-width: 850px) {
  body[data-role=admin] #workspace { grid-template-columns: 224px minmax(0, 1fr); gap: 18px 22px; }
  body[data-role=admin] .toolbar { grid-column: 1 / -1; }
  #admin-navigation { grid-column: 1; grid-row: 2; position: sticky; top: 16px; display: grid; }
  body[data-role=admin] #work-orders, body[data-role=admin] #work-controls, #admin-overview { grid-column: 2; grid-row: 2; min-width: 0; }
}
@media (max-width: 540px) {
  body[data-portal=admin] main { width: calc(100% - 24px); margin-top: 16px; }
  #admin-navigation button { padding-inline: 7px; gap: 5px; font-size: 13px; }
  #admin-navigation svg { width: 17px; height: 17px; }
  #staff-navigation button { flex: 1 1 42%; padding-inline: 8px; font-size: 13px; }
  .staff-panel form { grid-template-columns: 1fr; }
  .admin-order summary { flex-wrap: wrap; padding: 13px 14px; gap: 8px; }
  .admin-order-title { flex-basis: 100%; }
  .admin-order summary::after { margin-inline-start: auto; }
}

#admin-overview {
  --report-new: #0874bf;
  --report-done: #138471;
  min-width: 0;
}
.report-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}
.report-header h2 { margin: 0; }
#report-filters { flex: 0 1 460px; }
#report-filters label { flex: 1 1 110px; }
#report-filters input, #report-filters select, .report-sort select { border-color: var(--line); }
.report-muted, #report-status { color: var(--admin-muted); font-size: 13px; }
#report-status { margin: 0 0 12px; }
#report-status:empty { display: none; }
#report-content { display: grid; gap: 16px; min-width: 0; }
.report-kpis, .report-leaders {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 143px), 1fr));
  gap: 10px;
}
.report-metric {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--admin-shadow);
}
.report-metric span { font-size: 13px; font-weight: 700; }
.report-metric strong { font-size: clamp(19px, 2vw, 30px); color: var(--admin-blue); line-height: 1.25; overflow-wrap: anywhere; }
.report-metric[data-tone=green] strong { color: #08705e; }
.report-metric[data-tone=amber] strong { color: #905a16; }
.report-metric small { font-size: 12px; color: var(--admin-muted); }
.report-panel { padding: clamp(14px, 2.2vw, 23px); background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--admin-shadow); min-width: 0; }
.report-panel > h3 { margin: 0 0 6px; }
.report-panel > p { margin: 0 0 12px; }
.report-panel > p:last-child { margin-bottom: 0; }
.report-leaders { margin-bottom: 14px; }
.report-leaders .report-metric { box-shadow: none; background: #f7faff; }
.report-leaders .report-metric strong { font-size: clamp(17px, 1.7vw, 24px); }
.report-sort { max-width: 240px; margin: 9px 0 12px; }
.report-sort select { font-size: 14px; font-weight: 500; }
.report-legend { display: flex; flex-wrap: wrap; gap: 14px; color: var(--admin-muted); font-size: 13px; margin: 9px 0; }
.report-legend span::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-inline-end: 6px; border-radius: 3px; background: var(--report-new); }
.report-legend .report-series-done::before { background: var(--report-done); }
.report-chart { display: flex; direction: ltr; gap: clamp(2px, .6vw, 8px); padding: 8px 0 0; }
.report-column { display: grid; grid-template-rows: 110px 22px; flex: 1; min-width: 0; text-align: center; color: var(--admin-muted); }
.report-column small { font-size: 11px; white-space: nowrap; }
.report-bars { height: 100%; display: flex; align-items: end; justify-content: center; gap: 2px; border-bottom: 1px solid var(--line); }
.report-bars span { display: block; width: min(44%, 20px); border-radius: 3px 3px 0 0; background: var(--report-new); }
.report-bars .report-series-done { background: var(--report-done); }
.report-chart-skip { visibility: hidden; }
.report-table-wrap { overflow: auto; margin: 8px 0; border: 1px solid var(--line); border-radius: 10px; }
.report-table { border-spacing: 0; width: 100%; text-align: start; font-size: 13px; }
.report-table th, .report-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.report-table thead th { background: #edf4fb; color: var(--navy); }
.report-table th:first-child { position: sticky; inset-inline-start: 0; background: #f7faff; }
.report-table th small { display: block; }
.report-table tbody tr:last-child > * { border-bottom: 0; }
.report-follow, .report-groups { list-style: none; margin: 0; padding: 0; }
.report-follow li, .report-groups li { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; border-top: 1px solid var(--line); padding: 10px 0; }
.report-follow li small { display: block; color: var(--admin-muted); }
.report-follow button { min-height: 36px; font-size: 13px; }
.report-demand { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 540px) {
  #admin-navigation { flex-wrap: wrap; }
  #admin-navigation button { flex: 1 1 auto; }
  .report-header { align-items: start; }
  #report-filters { flex: 1 1 100%; }
  #report-filters label { flex: 1 1 36%; }
  #report-filters button { width: auto; }
  .report-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-demand { grid-template-columns: 1fr; }
}
