:root {
  color-scheme: light;
  --bg: #eef4f5;
  --surface: #ffffff;
  --ink: #192229;
  --muted: #64717a;
  --line: #dfe7ea;
  --accent: #0f8a7b;
  --accent-strong: #08675c;
  --accent-soft: #dff3ef;
  --warning: #b7791f;
  --danger: #b42318;
  --info: #2563eb;
  --shadow: 0 16px 38px rgba(24, 38, 45, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  background:
    linear-gradient(135deg, rgba(15, 138, 123, 0.12), transparent 32%),
    linear-gradient(315deg, rgba(37, 99, 235, 0.08), transparent 28%),
    var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select,
textarea {
  font: inherit;
}

.sidebar {
  min-height: 100vh;
  padding: calc(24px + env(safe-area-inset-top)) 18px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #142128, #10181d);
  color: #f8fbfc;
  box-shadow: 16px 0 34px rgba(14, 25, 31, 0.16);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #18a999, #0f8a7b);
  box-shadow: 0 10px 22px rgba(15, 138, 123, 0.28);
  font-weight: 700;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: #a9bac2;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #d8e3e7;
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
  transition: 160ms ease;
}

.nav-item.active,
.nav-item:hover {
  background: #24333b;
  color: #ffffff;
}

.logout-button {
  width: 100%;
  min-height: 42px;
  margin-top: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #f8fbfc;
  cursor: pointer;
  font-weight: 700;
}

.logout-button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.developer-credit {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  padding: 12px;
}

.developer-credit span {
  display: block;
  margin-bottom: 5px;
  color: #9fb2bc;
  font-size: 12px;
}

.developer-credit strong {
  display: block;
  line-height: 1.25;
}

.app-shell {
  min-width: 0;
  padding: calc(28px + env(safe-area-inset-top)) calc(28px + env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom)) calc(28px + env(safe-area-inset-left));
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 24px;
  border: 1px solid rgba(223, 231, 234, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  padding: 20px;
  backdrop-filter: blur(12px);
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  font-size: 18px;
}

.topbar p {
  max-width: 720px;
  margin-top: 7px;
  color: var(--muted);
}

.section {
  display: none;
}

.section.active {
  display: block;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric,
.panel,
.job-card,
.customer-card,
.lookup-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.metric {
  position: relative;
  overflow: hidden;
  padding: 16px;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--accent);
}

.metric::after {
  content: "";
  position: absolute;
  right: -18px;
  top: -18px;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: rgba(15, 138, 123, 0.08);
}

.metric-2::before,
.metric-2::after {
  background: rgba(32, 166, 106, 0.14);
}

.metric-2::before {
  background: #20a66a;
}

.metric-3::before,
.metric-3::after {
  background: rgba(217, 153, 34, 0.14);
}

.metric-3::before {
  background: #d99922;
}

.metric-4::before,
.metric-4::after {
  background: rgba(61, 120, 216, 0.14);
}

.metric-4::before {
  background: #3d78d8;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.dashboard-grid,
.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  padding: 18px;
  backdrop-filter: blur(10px);
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 138, 123, 0.12);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.primary-action,
.secondary-action,
.ghost-button,
.small-button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 700;
}

.install-action[hidden] {
  display: none;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #12a18f, var(--accent-strong));
  color: white;
  box-shadow: 0 10px 18px rgba(15, 138, 123, 0.2);
}

.primary-action:hover {
  background: var(--accent-strong);
}

.secondary-action {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.ghost-button,
.small-button {
  background: #edf2f4;
  color: #33424a;
}

.small-button {
  min-height: 34px;
  padding: 0 10px;
}

.job-list,
.timeline,
.message-list,
.customer-grid,
.sent-log,
.user-list,
.status-chart {
  display: grid;
  gap: 12px;
}

.job-card,
.customer-card,
.user-card,
.lookup-card {
  padding: 14px;
  box-shadow: 0 10px 24px rgba(24, 38, 45, 0.06);
}

.user-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
}

.job-top,
.customer-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.job-title {
  display: grid;
  gap: 4px;
}

.plate {
  font-weight: 800;
  letter-spacing: 0;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
  background: #e9efff;
  color: var(--info);
}

.badge.wait {
  background: #fff4dc;
  color: var(--warning);
}

.badge.ready {
  background: #e5f6ed;
  color: var(--accent-strong);
}

.badge.done {
  background: #edf2f4;
  color: var(--muted);
}

.job-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 13px;
}

.job-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.timeline-item,
.message-item,
.sent-item {
  border-left: 3px solid var(--accent);
  padding: 8px 0 8px 12px;
  background: linear-gradient(90deg, rgba(15, 138, 123, 0.06), transparent);
}

.status-analytics {
  margin-top: 18px;
}

.status-chart {
  grid-template-columns: repeat(6, minmax(80px, 1fr));
  align-items: end;
  min-height: 220px;
}

.chart-column {
  display: grid;
  gap: 7px;
  align-items: end;
  text-align: center;
  min-width: 0;
}

.chart-bar-track {
  display: flex;
  align-items: end;
  justify-content: center;
  height: 132px;
  border-radius: 8px;
  background: #edf4f5;
  padding: 8px;
}

.chart-bar {
  width: 100%;
  min-height: 8px;
  border-radius: 7px;
  background: linear-gradient(180deg, #41b8a8, #0f8a7b);
  box-shadow: inset 0 -8px 16px rgba(0, 0, 0, 0.08);
}

.chart-bar.wait {
  background: linear-gradient(180deg, #efbd58, #b7791f);
}

.chart-bar.ready {
  background: linear-gradient(180deg, #33bd78, #08675c);
}

.chart-bar.done {
  background: linear-gradient(180deg, #aab7bd, #64717a);
}

.chart-column strong {
  font-size: 20px;
}

.chart-column span,
.chart-column small {
  color: var(--muted);
  font-size: 12px;
}

.message-composer {
  display: grid;
  gap: 12px;
  max-width: 760px;
}

.lookup-panel {
  max-width: 920px;
}

.login-panel {
  max-width: 980px;
  overflow: hidden;
  padding: 0;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(300px, 1fr);
  min-height: 480px;
}

.login-visual {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  padding: 34px;
  background:
    linear-gradient(145deg, rgba(15, 138, 123, 0.94), rgba(20, 33, 40, 0.98)),
    #142128;
  color: #ffffff;
}

.login-mark {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 24px;
  font-weight: 800;
}

.login-visual h2 {
  font-size: 30px;
}

.login-visual p {
  max-width: 360px;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.55;
}

.login-stats {
  display: grid;
  gap: 10px;
}

.login-stats span {
  min-height: 38px;
  display: flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  padding: 0 12px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
  font-weight: 700;
}

.login-form {
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 34px;
}

.login-form .primary-action {
  justify-content: center;
  margin-top: 4px;
}

.lookup-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.lookup-result {
  display: grid;
  gap: 12px;
}

.status-progress {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.status-step {
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfdfd;
  padding: 0 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.status-step.complete {
  border-color: rgba(15, 138, 123, 0.32);
  background: #e7f3f1;
  color: var(--accent-strong);
}

.status-step.current {
  background: var(--accent);
  color: #ffffff;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(420px, calc(100vw - 44px));
  border-radius: 8px;
  background: #162026;
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 20px;
  text-align: center;
}

@media (max-width: 1050px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    position: sticky;
    top: 0;
    z-index: 5;
    padding: calc(14px + env(safe-area-inset-top)) 14px 14px;
  }

  .brand {
    margin-bottom: 12px;
  }

  .developer-credit {
    margin-top: 12px;
    padding: 9px 10px;
  }

  .nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-item {
    text-align: center;
  }

  .dashboard-grid,
  .workspace {
    grid-template-columns: 1fr;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .status-chart {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  body {
    overflow-x: hidden;
  }

  .app-shell {
    width: 100%;
    padding: 16px 12px calc(20px + env(safe-area-inset-bottom));
  }

  .topbar,
  .panel-heading,
  .job-top,
  .customer-top {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .topbar-actions .primary-action,
  .topbar-actions .secondary-action {
    width: 100%;
    justify-content: center;
  }

  .nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .nav-item {
    width: auto;
    min-width: 0;
    text-align: center;
    padding: 0 8px;
  }

  .brand {
    align-items: flex-start;
  }

  .developer-credit {
    font-size: 13px;
  }

  .topbar {
    padding: 16px;
  }

  .metrics,
  .field-grid,
  .job-meta,
  .lookup-form,
  .status-progress,
  .status-chart {
    grid-template-columns: 1fr;
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-visual,
  .login-form {
    padding: 22px;
  }

  .chart-bar-track {
    height: 82px;
  }

  h1 {
    font-size: 24px;
  }
}
