
:root {
  --bg: #071422;
  --bg-2: #0b1c30;
  --panel: #10263d;
  --panel-2: #17344f;
  --line: rgba(232, 239, 247, 0.14);
  --text: #e8eef6;
  --muted: #9eb0c4;
  --orange: #ff7a1a;
  --orange-2: #ffb07a;
  --ink: #1b0d04;
  --good: #3ddc97;
  --good-bg: #12382c;
  --warn: #ffc857;
  --bad: #ff6d6d;
  --info: #8ec8ff;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --radius: 16px;
  --sidebar: 248px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; max-width: 100%; }
html { background: var(--bg); }
body {
  min-height: 100dvh;
  background:
    radial-gradient(900px 420px at 10% -10%, rgba(255, 122, 26, 0.16), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Avenir Next", system-ui, sans-serif;
  font-size: 16.5px;
  line-height: 1.45;
  overflow-x: hidden;
}
img, svg { max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.7rem; line-height: 1.15; letter-spacing: -0.03em; }
h2 { font-size: 1.2rem; letter-spacing: -0.02em; }
h3 { font-size: 1.05rem; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

.shell { display: block; min-height: 100dvh; }
.sidebar {
  display: none;
  background: rgba(8, 20, 34, 0.92);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  flex-direction: column;
  gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand svg { width: 34px; height: 34px; flex: none; }
.wordmark { font-weight: 750; letter-spacing: -0.03em; font-size: 1.05rem; }
.wordmark i { color: var(--orange); font-style: normal; }
.side-nav, .menu-links { display: grid; gap: 4px; }
.side-nav a, .menu-links a, .bottomnav a {
  display: flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 8px 12px; border-radius: 12px;
  text-decoration: none; color: var(--muted);
}
.side-nav a.active, .menu-links a.active, .bottomnav a.active { background: var(--panel-2); color: var(--text); }
.who { margin-top: auto; color: var(--muted); font-size: 0.95rem; }
.who strong { display: block; color: var(--text); }

.main { min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: rgba(7, 20, 34, 0.92); backdrop-filter: blur(10px); z-index: 5;
}
.topbar h1 { font-size: 1.15rem; }
.company-chip { color: var(--muted); font-size: 0.95rem; }
.content { padding: 16px 16px 104px; max-width: 1180px; }
.mobile-menu { padding: 0 16px; }
.mobile-menu summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--orange-2); }
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: #0b1a2b; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a { justify-content: center; flex-direction: column; gap: 0; font-size: 0.85rem; min-height: 58px; padding: 6px; }

.card, .stat, .slot, .day-card, .line, .person {
  background: linear-gradient(180deg, rgba(23, 52, 79, 0.55), rgba(16, 38, 61, 0.9));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card, .day-card { padding: 16px; }
.stack { display: grid; gap: 12px; }
.cluster { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.spread { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.muted { color: var(--muted); }
.stats { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.stat { padding: 14px; min-width: 0; }
.stat b { display: block; font-size: 1.55rem; letter-spacing: -0.03em; }
.stat span { color: var(--muted); }

.btn, button.btn, a.btn {
  min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 0;
  background: var(--orange); color: var(--ink); font-weight: 750;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; cursor: pointer;
}
.btn.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.good { background: var(--good-bg); color: var(--good); }
.btn.danger { background: transparent; color: var(--bad); border: 1px solid rgba(255, 109, 109, 0.45); }
.btn.block { width: 100%; }
.actions-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

label.field, .field { display: grid; gap: 6px; min-width: 0; }
label.field span, .check { display: flex; align-items: center; gap: 10px; min-height: 48px; color: var(--text); }
.check input { width: 1.25rem; min-width: 1.25rem; min-height: 1.25rem; flex: none; }
input, select, textarea {
  width: 100%; max-width: 100%; min-width: 0; min-height: 48px;
  background: #0b1a2c; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
textarea { min-height: 110px; resize: vertical; }
.form-grid { display: grid; gap: 12px; }
.err { color: #ffb4b4; font-style: normal; }
.flash { background: #2a2112; border: 1px solid rgba(255, 200, 87, 0.4); color: var(--warn); padding: 12px 14px; border-radius: 12px; }
.banner-error { background: #2a1418; border: 1px solid rgba(255, 109, 109, 0.4); color: #ffd0d0; padding: 12px 14px; border-radius: 12px; }

.badge { display: inline-flex; align-items: center; min-height: 28px; padding: 2px 8px; border-radius: 999px; font-size: 0.92rem; background: #1c3348; color: var(--text); }
.badge.new { background: #24384c; }
.badge.sched { background: #163654; color: var(--info); }
.badge.run { background: #3a2614; color: var(--orange-2); }
.badge.done { background: var(--good-bg); color: var(--good); }
.badge.billed { background: #12343a; color: #9aefe0; }
.badge.stop { background: #2a2430; color: var(--muted); }
.badge.hot { background: #4a2014; color: #ffd0b8; }
.badge.repair, .badge.install, .badge.maintenance, .badge.estimate { background: #1a3148; }

.list-link, .job-row {
  display: grid; gap: 4px; padding: 14px; text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.list-link:last-child, .job-row:last-child { border-bottom: 0; }
.job-row strong, .list-link strong { font-size: 1.05rem; }
.search { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

.day-card { display: grid; gap: 12px; }
.day-card.emergency { border-color: rgba(255, 122, 26, 0.7); }
.kicker { color: var(--orange-2); font-weight: 700; }
.equip { color: var(--muted); }

.week-board { display: none; }
.day-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.slot { min-height: 84px; padding: 8px; display: grid; align-content: start; gap: 6px; }
.slot .when { color: var(--muted); font-size: 0.92rem; }
.job-chip {
  display: grid; gap: 2px; padding: 8px; border-radius: 10px; text-decoration: none;
  background: #0d2236; border: 1px solid var(--line); min-height: 44px; min-width: 0;
  overflow-wrap: anywhere;
}
.slot { overflow: hidden; }
.job-chip.emergency { border-color: var(--orange); }
.job-chip small { color: var(--muted); }
.drop-over { outline: 2px dashed var(--orange); }
.unscheduled { display: grid; gap: 10px; }
.person { padding: 12px; display: grid; gap: 8px; }

details.edit { background: rgba(0,0,0,0.15); border-radius: 12px; padding: 8px 12px; }
details.edit summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }

.sheet-wrap { padding: 16px 16px 40px; }
.sheet {
  background: white; color: #172033; border-radius: 12px; padding: 20px;
  max-width: 800px; margin: 0 auto;
}
.sheet h1 { color: #10263d; }
.sheet table { width: 100%; border-collapse: collapse; }
.sheet th, .sheet td { text-align: left; padding: 8px 0; border-bottom: 1px solid #e6ebf2; vertical-align: top; }
.sheet .right { text-align: right; }
.tiers { display: grid; gap: 12px; }
.tier { border: 1px solid var(--line); border-radius: 16px; padding: 14px; background: var(--panel); }
.tier.better { border-color: var(--orange); }
.paid-stamp { display: inline-block; border: 3px solid #14804a; color: #14804a; font-weight: 800; padding: 4px 8px; transform: rotate(-6deg); }

.auth {
  min-height: 100dvh; display: grid; align-items: center; padding: 24px 16px;
}
.auth-card { max-width: 460px; margin: 0 auto; width: 100%; display: grid; gap: 16px; }
.auth-card h1 { font-size: 2.1rem; }
.auth-card h1 em { color: var(--orange); font-style: normal; }
.lede { color: var(--muted); font-size: 1.05rem; }

@media (min-width: 720px) {
  .stats { grid-template-columns: repeat(4, 1fr); }
  .form-grid.two { grid-template-columns: 1fr 1fr; }
  .form-grid.three { grid-template-columns: 1fr 1fr 1fr; }
  h1 { font-size: 2rem; }
  .content { padding: 24px 28px 48px; }
}
@media (min-width: 960px) {
  .shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
  .sidebar { display: flex; position: sticky; top: 0; height: 100dvh; }
  .mobile-menu, .bottomnav { display: none; }
  .week-board {
    display: grid;
    grid-template-columns: 132px repeat(7, minmax(0, 1fr));
    gap: 6px;
    align-items: start;
  }
  .week-board > * { min-width: 0; }
  .day-agenda { display: none; }
  .tiers { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media print {
  body { background: white; color: black; }
  .sidebar, .topbar, .bottomnav, .mobile-menu, .noprint { display: none !important; }
  .shell { display: block; }
  .sheet { box-shadow: none; max-width: none; }
  .content, .sheet-wrap { padding: 0; }
}
