:root {
  --ink: #13211b;
  --muted: #63716b;
  --line: #dfe6e1;
  --canvas: #f3f5f1;
  --paper: #ffffff;
  --forest: #123d2b;
  --forest-2: #1d5a41;
  --mint: #dff2e8;
  --lime: #b9de63;
  --amber: #f3b746;
  --red: #c84b48;
  --shadow: 0 20px 60px rgba(24, 53, 41, 0.09);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; min-height: 100vh; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.9rem, 4vw, 3.3rem); line-height: 1.05; letter-spacing: -0.045em; }
h2 { font-size: clamp(1.35rem, 2vw, 1.9rem); letter-spacing: -0.03em; }
h3 { font-size: 1.02rem; }

.boot-screen, .empty-state, .error-state {
  min-height: 60vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--muted);
  text-align: center;
  padding: 32px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--lime);
  color: var(--forest);
  font-weight: 900;
  font-size: 1.4rem;
  box-shadow: inset 0 0 0 1px rgba(18, 61, 43, 0.1);
}

.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; letter-spacing: -0.02em; }
.brand small { display: block; color: var(--muted); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }

.btn {
  border: 0;
  border-radius: 12px;
  padding: 11px 16px;
  min-height: 43px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 750;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--forest); color: white; box-shadow: 0 8px 18px rgba(18, 61, 43, .18); }
.btn-primary:hover { background: var(--forest-2); }
.btn-lime { background: var(--lime); color: var(--forest); }
.btn-ghost { color: var(--ink); background: #edf1ee; }
.btn-danger { color: #8f2826; background: #fae8e7; }
.btn-small { min-height: 34px; padding: 7px 11px; border-radius: 9px; font-size: .82rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; pointer-events: none; }

.field { display: grid; gap: 7px; }
.field > span, .field > label { font-size: .79rem; font-weight: 750; color: #47544e; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid #d7dfda;
  background: #fbfcfb;
  color: var(--ink);
  border-radius: 11px;
  padding: 11px 12px;
  outline: 0;
  transition: border .15s, box-shadow .15s, background .15s;
}
.field textarea { min-height: 105px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--forest-2); background: white; box-shadow: 0 0 0 3px rgba(29, 90, 65, .1); }
.field-hint { color: var(--muted); font-size: .75rem; line-height: 1.45; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(420px, 1.15fr);
  background: var(--paper);
}
.login-panel { display: grid; align-content: center; padding: clamp(32px, 8vw, 110px); }
.login-panel .brand { margin-bottom: 70px; }
.login-copy { max-width: 460px; }
.login-copy > p { color: var(--muted); line-height: 1.7; margin-bottom: 32px; }
.login-form { display: grid; gap: 16px; max-width: 430px; }
.login-switch {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
  max-width: 430px;
  margin-bottom: 18px;
  padding: 5px;
  border-radius: 13px;
  background: #edf1ee;
}
.login-switch button {
  border: 0;
  border-radius: 9px;
  padding: 10px 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}
.login-switch button.active {
  background: white;
  color: var(--forest);
  box-shadow: 0 3px 10px rgba(24, 53, 41, .09);
}
.field .access-code-input {
  font: 800 1.3rem ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: .45em;
}
.login-visual {
  margin: 14px;
  border-radius: 28px;
  overflow: hidden;
  position: relative;
  display: grid;
  align-items: end;
  padding: clamp(28px, 5vw, 70px);
  color: white;
  background:
    radial-gradient(circle at 78% 20%, rgba(185, 222, 99, .8) 0 7%, transparent 7.4%),
    radial-gradient(circle at 80% 22%, transparent 0 20%, rgba(255,255,255,.08) 20.4% 21%, transparent 21.4%),
    linear-gradient(145deg, #153f2e, #09251a);
}
.login-visual::before {
  content: "";
  position: absolute;
  width: 430px; height: 430px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%;
  left: -120px; top: -120px;
  box-shadow: 0 0 0 70px rgba(255,255,255,.025), 0 0 0 140px rgba(255,255,255,.018);
}
.visual-card { position: relative; z-index: 1; max-width: 500px; }
.visual-card h2 { font-size: clamp(2rem, 4vw, 4rem); line-height: .98; margin-bottom: 22px; }
.visual-card p { color: #c8d7d0; line-height: 1.65; }
.feature-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 30px; }
.feature-pill { padding: 9px 12px; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; font-size: .76rem; color: #e9f1ed; }

.dashboard { min-height: 100vh; display: grid; grid-template-columns: 245px minmax(0, 1fr); }
.sidebar { background: var(--forest); color: white; padding: 26px 18px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { padding: 0 9px; margin-bottom: 34px; }
.sidebar .brand small { color: #a9c1b5; }
.nav-list { display: grid; gap: 5px; }
.nav-item { border: 0; background: transparent; color: #c6d5ce; padding: 11px 12px; border-radius: 10px; text-align: left; font-weight: 650; display: flex; align-items: center; gap: 11px; }
.nav-item::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .5; }
.nav-item:hover { background: rgba(255,255,255,.07); color: white; }
.nav-item.active { background: var(--lime); color: var(--forest); }
.sidebar-user { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding: 20px 8px 0; }
.sidebar-user strong, .sidebar-user span { display: block; }
.sidebar-user span { color: #a9c1b5; font-size: .74rem; margin: 4px 0 12px; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .btn { color: white; background: rgba(255,255,255,.08); width: 100%; }

.main-area { min-width: 0; }
.topbar { min-height: 80px; padding: 18px clamp(20px, 4vw, 48px); display: flex; justify-content: space-between; align-items: center; background: rgba(243,245,241,.9); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 20; border-bottom: 1px solid rgba(215,223,218,.75); }
.topbar h1 { font-size: 1.35rem; margin: 0; letter-spacing: -.03em; }
.topbar p { color: var(--muted); font-size: .77rem; margin: 3px 0 0; }
.topbar-badge { padding: 8px 11px; border-radius: 999px; background: var(--mint); color: var(--forest); font-size: .74rem; font-weight: 800; }
.content { padding: 28px clamp(20px, 4vw, 48px) 60px; max-width: 1500px; width: 100%; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 24px; }
.page-heading h2 { margin-bottom: 5px; }
.page-heading p { margin: 0; color: var(--muted); font-size: .86rem; }

.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.stat-card, .panel, .service-card, .public-card { background: var(--paper); border: 1px solid rgba(215,223,218,.8); border-radius: var(--radius); box-shadow: 0 4px 18px rgba(24,53,41,.035); }
.stat-card { padding: 20px; min-height: 130px; display: flex; flex-direction: column; justify-content: space-between; }
.stat-card span { color: var(--muted); font-size: .77rem; font-weight: 650; }
.stat-card strong { font-size: 2rem; letter-spacing: -.06em; }
.stat-card.highlight { background: var(--forest); color: white; border-color: var(--forest); }
.stat-card.highlight span { color: #bcd0c6; }
.panel { padding: 22px; }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.panel-head h3 { margin: 0; }
.two-columns { display: grid; grid-template-columns: minmax(290px, .72fr) minmax(500px, 1.3fr); gap: 18px; align-items: start; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; }
table { width: 100%; border-collapse: collapse; font-size: .83rem; }
th { padding: 11px 13px; background: #f6f8f6; color: var(--muted); text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .045em; white-space: nowrap; }
td { padding: 13px; border-top: 1px solid var(--line); vertical-align: middle; }
tr:hover td { background: #fbfcfb; }
.cell-main { display: block; font-weight: 750; color: var(--ink); }
.cell-sub { display: block; color: var(--muted); font-size: .74rem; margin-top: 3px; }
.table-actions { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.table-actions select { max-width: 155px; border: 1px solid var(--line); border-radius: 8px; padding: 7px; background: white; }

.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 5px 9px; font-size: .67rem; font-weight: 850; letter-spacing: .02em; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-active, .badge-completed { background: #dff2e8; color: #18603f; }
.badge-expired, .badge-cancelled { background: #f8e5e3; color: #a33b38; }
.badge-pending, .badge-new { background: #fff1d5; color: #98640d; }
.badge-assigned { background: #e5edfa; color: #315d9d; }
.badge-in_progress { background: #e9e5fa; color: #5b42a4; }
.badge-void { background: #eceeed; color: #5c6661; }
.badge-warranty { background: #e2f0e8; color: var(--forest-2); }
.badge-non_warranty { background: #f3e9dc; color: #845728; }

.modal { border: 0; border-radius: 20px; padding: 0; width: min(760px, calc(100vw - 28px)); max-height: calc(100vh - 28px); box-shadow: 0 30px 90px rgba(5,25,16,.3); }
.modal::backdrop { background: rgba(9, 25, 18, .6); backdrop-filter: blur(3px); }
.modal-head { position: sticky; top: 0; z-index: 2; background: white; border-bottom: 1px solid var(--line); padding: 18px 22px; display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { margin: 0; font-size: 1.25rem; }
.modal-body { padding: 22px; }
.close-btn { border: 0; background: #edf1ee; width: 34px; height: 34px; border-radius: 10px; font-size: 1.1rem; }
.qr-layout { display: grid; grid-template-columns: 280px 1fr; gap: 24px; align-items: start; }
.qr-image { width: 100%; border-radius: 14px; border: 1px solid var(--line); }
.token-box { background: #f3f6f4; border-radius: 10px; padding: 11px; font: 500 .72rem ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.detail-list { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.detail-row { display: grid; grid-template-columns: 150px 1fr; gap: 15px; padding: 11px 13px; border-bottom: 1px solid var(--line); }
.detail-row:last-child { border: 0; }
.detail-row span { color: var(--muted); font-size: .75rem; }
.detail-row strong { font-size: .82rem; }
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.media-grid img, .media-grid video { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; background: #e9eeeb; }

.technician-page { min-height: 100vh; background: #eef2ef; }
.tech-header { background: var(--forest); color: white; padding: 18px clamp(20px, 5vw, 70px); display: flex; align-items: center; justify-content: space-between; }
.tech-header .brand small { color: #a9c1b5; }
.tech-user { display: flex; align-items: center; gap: 12px; }
.tech-user-copy { text-align: right; }
.tech-user-copy strong, .tech-user-copy span { display: block; }
.tech-user-copy span { color: #a9c1b5; font-size: .7rem; margin-top: 3px; }
.tech-main { max-width: 1200px; margin: 0 auto; padding: 40px 22px 70px; }
.filter-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.filter-tab { border: 1px solid var(--line); background: white; border-radius: 999px; padding: 9px 14px; font-weight: 750; color: var(--muted); }
.filter-tab.active { background: var(--forest); color: white; border-color: var(--forest); }
.service-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.service-card { padding: 20px; }
.service-card-top { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.service-number { color: var(--muted); font-size: .73rem; }
.service-card h3 { font-size: 1.15rem; margin: 4px 0 5px; }
.service-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 16px 0; }
.meta-box { padding: 10px; background: #f5f7f5; border-radius: 10px; }
.meta-box span, .meta-box strong { display: block; }
.meta-box span { color: var(--muted); font-size: .68rem; margin-bottom: 4px; }
.meta-box strong { font-size: .78rem; }
.problem-preview { color: #425049; font-size: .84rem; line-height: 1.55; padding-top: 14px; border-top: 1px solid var(--line); }

.public-page { min-height: 100vh; background: #f0f3ef; }
.public-header { background: var(--forest); color: white; padding: 18px clamp(20px, 5vw, 80px); display: flex; justify-content: space-between; align-items: center; }
.public-header .brand small { color: #a9c1b5; }
.verified-pill { border: 1px solid rgba(255,255,255,.18); border-radius: 999px; padding: 8px 12px; color: #d6e3dc; font-size: .72rem; font-weight: 700; }
.public-main { max-width: 1180px; margin: 0 auto; padding: 32px 20px 70px; }
.boiler-hero { background: var(--forest); border-radius: 26px; padding: clamp(26px, 5vw, 52px); color: white; position: relative; overflow: hidden; display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: end; }
.boiler-hero::after { content: ""; position: absolute; width: 310px; height: 310px; border-radius: 50%; border: 1px solid rgba(255,255,255,.1); right: -70px; top: -120px; box-shadow: 0 0 0 55px rgba(255,255,255,.025); }
.eyebrow { color: var(--lime); font-size: .72rem; letter-spacing: .13em; text-transform: uppercase; font-weight: 850; }
.boiler-hero h1 { margin: 12px 0 10px; max-width: 680px; }
.serial { color: #b9cec3; font: 500 .85rem ui-monospace, SFMono-Regular, Consolas, monospace; }
.warranty-seal { position: relative; z-index: 1; min-width: 175px; padding: 18px; border: 1px solid rgba(255,255,255,.16); border-radius: 16px; background: rgba(255,255,255,.06); backdrop-filter: blur(5px); }
.warranty-seal span, .warranty-seal strong { display: block; }
.warranty-seal span { color: #b9cec3; font-size: .7rem; margin-bottom: 7px; }
.warranty-seal strong { font-size: 1rem; }
.public-section-title { margin: 34px 0 16px; }
.public-section-title p { color: var(--muted); font-size: .84rem; }
.action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.public-card { padding: clamp(20px, 3vw, 28px); }
.public-card-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 20px; }
.card-number { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px; background: var(--mint); color: var(--forest); display: grid; place-items: center; font-weight: 900; }
.public-card h2 { font-size: 1.18rem; margin: 1px 0 5px; }
.public-card-head p { color: var(--muted); margin: 0; font-size: .77rem; line-height: 1.45; }
.warranty-ticket { border-radius: 14px; background: #f2f6f3; padding: 16px; display: grid; gap: 11px; }
.ticket-row { display: flex; justify-content: space-between; gap: 12px; font-size: .8rem; }
.ticket-row span { color: var(--muted); }
.ticket-row strong { text-align: right; }
.public-form { display: grid; gap: 12px; }
.public-form .form-actions { margin: 2px 0 0; }
.stars { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; }
.stars input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  overflow: hidden;
  clip-path: inset(50%);
}
.stars label { color: #ccd2ce; font-size: 2rem; line-height: 1; cursor: pointer; transition: color .15s, transform .15s; }
.stars label:hover, .stars label:hover ~ label, .stars input:checked ~ label { color: var(--amber); }
.stars label:hover { transform: scale(1.08); }
.history-list { display: grid; gap: 10px; }
.history-item { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.history-item strong, .history-item span { display: block; }
.history-item span { color: var(--muted); font-size: .72rem; margin-top: 4px; }

.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: grid; gap: 9px; width: min(360px, calc(100vw - 36px)); }
.toast { background: var(--ink); color: white; padding: 13px 15px; border-radius: 12px; box-shadow: var(--shadow); font-size: .82rem; animation: toast-in .2s ease; }
.toast.success { background: var(--forest-2); }
.toast.error { background: #942e2c; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.muted { color: var(--muted); }
.small { font-size: .76rem; }
.stack { display: grid; gap: 14px; }
.divider { height: 1px; background: var(--line); margin: 20px 0; }
.mobile-brand { display: none; }

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .two-columns { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .login-page { grid-template-columns: 1fr; }
  .login-panel { min-height: 100vh; padding: 32px 24px; }
  .login-panel .brand { margin-bottom: 50px; }
  .login-visual { display: none; }
  .dashboard { display: block; }
  .sidebar { height: auto; position: fixed; z-index: 50; bottom: 0; left: 0; right: 0; top: auto; padding: 8px; display: block; }
  .sidebar .brand, .sidebar-user { display: none; }
  .nav-list { display: flex; overflow-x: auto; gap: 5px; }
  .nav-item { flex: 0 0 auto; padding: 10px 12px; font-size: .74rem; }
  .nav-item::before { display: none; }
  .topbar { top: 0; padding: 14px 20px; }
  .content { padding-bottom: 110px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .action-grid, .service-grid { grid-template-columns: 1fr; }
  .boiler-hero { grid-template-columns: 1fr; }
  .warranty-seal { width: 100%; }
  .qr-layout { grid-template-columns: 1fr; }
  .qr-image { max-width: 310px; margin: auto; }
}

@media (max-width: 520px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { min-height: 105px; padding: 16px; }
  .stat-card strong { font-size: 1.55rem; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .panel { padding: 17px; }
  .public-header, .tech-header { padding: 14px 17px; }
  .verified-pill, .tech-user-copy { display: none; }
  .public-main { padding: 18px 13px 50px; }
  .boiler-hero { border-radius: 20px; }
  .public-card { border-radius: 15px; }
  .modal-body { padding: 17px; }
  .detail-row { grid-template-columns: 1fr; gap: 4px; }
  .media-grid { grid-template-columns: repeat(2, 1fr); }
}
