:root {
  color-scheme: light;
  --ink: #17231f;
  --muted: #6b7873;
  --line: #dde5e1;
  --surface: #ffffff;
  --canvas: #f4f7f5;
  --brand: #1e40d8;
  --brand-dark: #1734b3;
  --brand-soft: #e9edff;
  --amber: #ed6e2d;
  --amber-soft: #fff0e8;
  --blue: #396e9f;
  --blue-soft: #e7f1f8;
  --coral: #ad584f;
  --shadow: 0 10px 28px rgba(27, 50, 42, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
.launch-warning { min-height: 100dvh; padding: 24px; display: grid; place-items: center; }
.launch-card { width: min(100%, 520px); padding: 30px; border: 1px solid var(--line); border-radius: 24px; background: white; box-shadow: var(--shadow); }
.launch-card .brand-mark { margin-bottom: 24px; }
.launch-card p { color: var(--muted); line-height: 1.65; }
.primary-link { min-height: 52px; margin-top: 20px; border-radius: 14px; display: grid; place-items: center; background: var(--brand); color: white; font-weight: 800; text-decoration: none; }
button, input, select { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100dvh; padding-bottom: 84px; }
.app-shell.logged-out { padding-bottom: 0; }
.app-shell.logged-out .topbar, .app-shell.logged-out .bottom-nav { display: none; }
.login-page { min-height: calc(100dvh - 50px); display: grid; align-items: center; max-width: 430px; margin: 0 auto; }
.login-card { padding: 26px 22px; border: 1px solid var(--line); border-radius: 24px; background: white; box-shadow: var(--shadow); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-brand .brand-mark { width: 52px; height: 52px; font-size: 23px; }
.login-card label { display: grid; gap: 7px; margin: 13px 0; color: #405049; font-size: 11px; font-weight: 750; }
.login-card input { width: 100%; min-height: 49px; padding: 0 13px; border: 1px solid var(--line); border-radius: 13px; outline: none; }
.login-card input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.login-help { margin: 14px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.login-error { min-height: 18px; color: #a63d35; font-size: 11px; }
.duplicate-box { padding: 12px; margin: 12px 0; border: 1px solid #efb697; border-radius: 13px; background: #fff4ed; color: #793d20; font-size: 11px; line-height: 1.5; }
.duplicate-box strong, .duplicate-box span { display: block; }
.topbar { position: sticky; top: 0; z-index: 10; min-height: 70px; padding: max(12px, env(safe-area-inset-top)) 18px 10px; display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,.94); border-bottom: 1px solid rgba(221,229,225,.85); backdrop-filter: blur(16px); }
.brand { border: 0; background: transparent; padding: 0; display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 13px; color: #f57a33; background: var(--brand); font-size: 19px; font-weight: 800; font-style: italic; letter-spacing: -.08em; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 1px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.sync-pill { min-height: 40px; display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border: 0; border-radius: 999px; color: var(--brand-dark); background: var(--brand-soft); font-size: 11px; font-weight: 700; cursor: pointer; }
.sync-pill i { width: 7px; height: 7px; border-radius: 50%; background: #2ba17c; }
.sync-pill.pending { background: var(--amber-soft); color: #87500f; }
.sync-pill.pending i { background: #d5872a; }
.icon-button, .avatar { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: white; display: grid; place-items: center; cursor: pointer; position: relative; }
.avatar { border: 0; border-radius: 50%; background: #25335d; color: white; font-size: 12px; font-weight: 800; }
.notification-dot { position: absolute; right: 8px; top: 8px; width: 7px; height: 7px; border-radius: 50%; background: #e36158; border: 1px solid white; }
main { max-width: 1180px; margin: 0 auto; padding: 22px 18px 28px; outline: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 18px; }
.eyebrow { display: block; margin-bottom: 6px; color: var(--brand); font-size: 10px; font-weight: 850; letter-spacing: .13em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(25px, 5vw, 38px); letter-spacing: -.04em; }
h2 { margin-bottom: 6px; font-size: 21px; letter-spacing: -.025em; }
h3 { margin-bottom: 4px; font-size: 15px; }
.subtle { color: var(--muted); font-size: 13px; margin-bottom: 0; }
.date-badge { display: none; color: var(--muted); font-size: 12px; }
.hero { background: linear-gradient(125deg, #1e40d8 0%, #253ab5 58%, #2e357f 100%); color: #fff9ec; border-radius: 22px; padding: 21px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; width: 190px; height: 190px; right: -70px; top: -95px; border: 34px solid rgba(255,255,255,.07); border-radius: 50%; }
.hero p { color: rgba(255,255,255,.73); font-size: 12px; }
.hero-row { display: flex; align-items: end; justify-content: space-between; gap: 15px; }
.hero strong { font-size: 31px; letter-spacing: -.04em; }
.hero .goal { text-align: right; font-size: 11px; color: rgba(255,255,255,.7); }
.progress { height: 7px; margin-top: 15px; background: rgba(255,255,255,.18); border-radius: 99px; overflow: hidden; }
.progress span { display: block; width: 68%; height: 100%; background: #f58242; border-radius: inherit; }
.metric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 12px 0 24px; }
.metric { padding: 15px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: 0 4px 14px rgba(27,50,42,.035); }
.report-metric { width: 100%; color: var(--ink); text-align: left; cursor: pointer; }
.report-metric:hover { border-color: #b9cbc5; }
.report-link { margin-top: 14px; padding: 6px 0; }
.metric-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 11px; }
.metric strong { display: block; margin-top: 9px; font-size: 24px; letter-spacing: -.035em; }
.metric strong.device-date { font-size: 18px; }
.metric small { color: var(--muted); font-size: 10px; }
.metric-icon { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 9px; background: var(--brand-soft); color: var(--brand); }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 10px; }
.section-head h2 { margin: 0; font-size: 17px; }
.text-button { border: 0; background: transparent; color: var(--brand); font-size: 12px; font-weight: 750; cursor: pointer; }
.card-list { display: grid; gap: 9px; }
.card { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); text-align: left; box-shadow: 0 4px 14px rgba(27,50,42,.03); cursor: pointer; }
.card:hover { border-color: #b9cbc5; transform: translateY(-1px); }
.card:active, .simple-stat:active, .device-map-main:active, .sync-pill:active { transform: scale(.985); }
.card:focus-visible, .simple-stat:focus-visible, .device-map-main:focus-visible, .sync-pill:focus-visible, .pin:focus-visible { outline: 3px solid rgba(30,64,216,.28); outline-offset: 2px; }
.time { align-self: stretch; width: 43px; padding-right: 11px; border-right: 1px solid var(--line); color: var(--brand); font-size: 12px; font-weight: 800; }
.card-body { min-width: 0; flex: 1; }
.order-main { min-width: 0; flex: 1; display: flex; align-items: center; gap: 12px; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.card-body h3, .card-body p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-body p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.tag { padding: 5px 8px; border-radius: 99px; background: var(--brand-soft); color: var(--brand-dark); font-size: 9px; font-weight: 800; white-space: nowrap; }
.tag.amber { background: var(--amber-soft); color: #8d5313; }
.search { display: flex; align-items: center; gap: 9px; padding: 0 13px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.search input { width: 100%; min-height: 46px; border: 0; outline: 0; background: transparent; }
.chips { display: flex; gap: 7px; overflow-x: auto; padding: 12px 0 4px; scrollbar-width: none; }
.chip { min-height: 36px; padding: 0 13px; border: 1px solid var(--line); border-radius: 99px; background: white; white-space: nowrap; font-size: 11px; font-weight: 700; cursor: pointer; }
.chip.active { border-color: var(--brand); background: var(--brand); color: white; }
.org-card { align-items: flex-start; }
.org-avatar { width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 13px; background: var(--brand-soft); color: var(--brand); font-weight: 850; }
.org-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 8px; color: var(--muted); font-size: 10px; }
.chevron { color: #9ca9a4; font-size: 20px; }
.map-placeholder { min-height: 440px; border-radius: 22px; position: relative; overflow: hidden; background-color: #e9eee9; background-image: linear-gradient(30deg, transparent 49%, rgba(255,255,255,.8) 50%, transparent 53%), linear-gradient(115deg, transparent 46%, rgba(255,255,255,.9) 47%, transparent 51%), linear-gradient(0deg, rgba(25,88,72,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(25,88,72,.08) 1px, transparent 1px); background-size: 190px 130px, 220px 170px, 42px 42px, 42px 42px; border: 1px solid var(--line); }
.map-toolbar { position: absolute; left: 12px; right: 12px; top: 12px; display: flex; gap: 8px; }
.map-toolbar .search { flex: 1; box-shadow: var(--shadow); }
.pin { position: absolute; width: 39px; height: 39px; border: 4px solid white; border-radius: 50% 50% 50% 10%; background: var(--brand); color: white; transform: rotate(-45deg); display: grid; place-items: center; box-shadow: 0 5px 14px rgba(10,71,58,.25); }
.pin span { transform: rotate(45deg); font-size: 10px; font-weight: 850; }
.pin.one { left: 24%; top: 31%; }.pin.two { left: 60%; top: 44%; background: var(--blue); }.pin.three { left: 43%; top: 67%; background: var(--amber); }
.pin.device-pin { border: 4px solid white; cursor: pointer; }
.pin.device-pin.demo { background: var(--amber); }
.pin.device-pin.selected { outline: 4px solid rgba(30,64,216,.24); outline-offset: 3px; z-index: 2; }
.map-device-list { position: absolute; left: 12px; right: 12px; bottom: 12px; max-height: 155px; display: grid; gap: 8px; overflow-y: auto; }
.device-map-card { padding: 13px; border-radius: 16px; background: white; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.device-map-main { min-width: 0; flex: 1; padding: 0; border: 0; background: transparent; text-align: left; cursor: pointer; }
.device-map-card h3 { margin: 7px 0 3px; }
.device-map-card p { margin: 0; color: var(--muted); font-size: 10px; }
.device-map-card a { color: var(--brand); font-size: 10px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.coordinate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.form-hint { color: var(--muted); font-size: 10px; line-height: 1.5; }
.quote-calculation { margin: 14px 0; padding: 14px; border-radius: 14px; background: var(--brand-soft); color: var(--brand-dark); font-size: 13px; font-weight: 800; }
.quote-preview { max-width: 760px; margin: 0 auto; padding: 24px; background: white; border: 1px solid var(--line); border-radius: 20px; }
.quote-preview-head, .quote-total-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.quote-line { margin: 20px 0; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
@media print { .topbar, .bottom-nav, .no-print, .toast { display: none !important; } main { padding: 0; } .quote-preview { border: 0; box-shadow: none; } body { background: white; } }
.map-card { position: absolute; left: 12px; right: 12px; bottom: 12px; padding: 15px; border-radius: 17px; background: white; box-shadow: var(--shadow); }
.detail-hero { padding: 20px; border-radius: 22px; background: white; border: 1px solid var(--line); }
.back-button { border: 0; background: transparent; color: var(--brand); padding: 0 0 14px; font-weight: 750; cursor: pointer; }
.detail-title { display: flex; gap: 13px; align-items: center; }
.detail-title > div { min-width: 0; flex: 1; }
.detail-edit { flex: 0 0 auto; padding: 8px; }
.detail-title .org-avatar { width: 54px; height: 54px; }
.action-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 17px; }
.action-row button, .action-row a { min-height: 54px; border: 1px solid var(--line); border-radius: 14px; background: var(--canvas); color: var(--brand); font-size: 11px; font-weight: 750; cursor: pointer; display: grid; place-items: center; text-align: center; text-decoration: none; }
.detail-grid { display: grid; gap: 10px; margin-top: 12px; }
.detail-panel { padding: 17px; border: 1px solid var(--line); border-radius: 17px; background: white; }
.detail-panel p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.bottom-nav { position: fixed; z-index: 15; left: 0; right: 0; bottom: 0; height: calc(72px + env(safe-area-inset-bottom)); padding: 8px 13px env(safe-area-inset-bottom); display: grid; grid-template-columns: 1fr 1fr 62px 1fr 1fr; align-items: center; background: rgba(255,255,255,.97); border-top: 1px solid var(--line); backdrop-filter: blur(18px); }
.nav-item { min-width: 0; height: 52px; border: 0; background: transparent; color: #7f8b87; cursor: pointer; }
.nav-item span, .nav-item small { display: block; }
.nav-item span { font-size: 19px; height: 25px; }
.nav-item small { font-size: 9px; font-weight: 700; }
.nav-item.active { color: var(--brand); }
.quick-add { width: 56px; height: 56px; align-self: end; margin-bottom: 14px; border: 5px solid var(--canvas); border-radius: 19px; background: var(--amber); color: white; font-size: 28px; box-shadow: 0 8px 18px rgba(237,110,45,.3); cursor: pointer; }
dialog { color: var(--ink); }
.sheet { width: min(100%, 520px); max-height: 88dvh; margin: auto auto 0; padding: 10px 18px max(22px, env(safe-area-inset-bottom)); border: 0; border-radius: 24px 24px 0 0; background: white; box-shadow: 0 -18px 50px rgba(22,46,38,.2); }
.sheet::backdrop { background: rgba(15,30,25,.45); backdrop-filter: blur(2px); }
.sheet-handle { width: 42px; height: 4px; margin: 0 auto 18px; border-radius: 9px; background: #d3dcd8; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 17px; }
.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.quick-grid button { min-height: 130px; padding: 16px; border: 1px solid var(--line); border-radius: 17px; background: var(--canvas); text-align: left; cursor: pointer; }
.quick-grid strong, .quick-grid small { display: block; }
.quick-grid strong { margin-top: 13px; font-size: 13px; }
.quick-grid small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.quick-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; font-size: 19px; }
.teal { background: var(--brand-soft); color: var(--brand); }.blue { background: var(--blue-soft); color: var(--blue); }.amber { background: var(--amber-soft); color: var(--amber); }.coral { background: #f8e9e6; color: var(--coral); }
.form-sheet label { display: grid; gap: 7px; margin: 13px 0; color: #405049; font-size: 11px; font-weight: 750; }
.form-sheet fieldset { margin: 13px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 13px; }
.form-sheet legend { padding: 0 5px; color: #405049; font-size: 11px; font-weight: 750; }
.form-sheet .check-label { grid-template-columns: 22px 1fr; align-items: center; margin: 8px 0; font-weight: 650; }
.form-sheet .check-label input { min-height: 20px; }
.user-status { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; }
.user-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #2ba17c; }
.user-status.passive::before, .user-status.locked::before { background: var(--coral); }
.form-sheet input, .form-sheet select, .form-sheet textarea { width: 100%; min-height: 49px; padding: 0 13px; border: 1px solid var(--line); border-radius: 13px; background: white; outline: none; }
.form-sheet textarea { padding-top: 12px; resize: vertical; }
.form-sheet input:focus, .form-sheet select:focus, .form-sheet textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.simple-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 22px; }
.simple-stat { padding: 17px; border: 0; border-radius: 18px; color: white; background: var(--brand); text-align: left; cursor: pointer; }
.simple-stat.warm { background: var(--amber); }
.simple-stat strong { display: block; font-size: 29px; }
.simple-stat span { font-size: 11px; opacity: .85; }
.offline-note { display: flex; gap: 10px; padding: 12px; margin: 15px 0; border-radius: 14px; background: var(--brand-soft); color: var(--brand-dark); }
.offline-note p { margin: 0; font-size: 10px; line-height: 1.45; }
.primary-button { width: 100%; min-height: 52px; border: 0; border-radius: 14px; background: var(--brand); color: white; font-weight: 800; cursor: pointer; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: 90px; max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 12px; background: #19382f; color: white; font-size: 12px; opacity: 0; transform: translate(-50%, 14px); pointer-events: none; transition: .25s ease; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 760px) {
  .topbar { padding-left: 28px; padding-right: 28px; }
  main { padding: 30px 28px 110px; }
  .date-badge { display: block; }
  .dashboard { display: grid; grid-template-columns: 1.25fr .75fr; gap: 18px; }
  .metric-grid { grid-template-columns: repeat(4, 1fr); }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
  .bottom-nav { left: 50%; right: auto; width: 540px; transform: translateX(-50%); bottom: 12px; height: 66px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
  .quick-add { margin-bottom: 8px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
