:root {
  --ink: #17212b;
  --muted: #637083;
  --line: #dbe1e8;
  --panel: #ffffff;
  --page: #f3f6f8;
  --green: #0f766e;
  --blue: #2563eb;
  --amber: #b45309;
  --red: #b91c1c;
  --shadow: 0 12px 30px rgba(22, 34, 45, 0.08);
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--page);
}

body:not(.is-authenticated) .app {
  display: none;
}

body.is-authenticated .auth-screen {
  display: none;
}

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

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.13), rgba(37, 99, 235, 0.1)),
    var(--page);
}

.auth-card {
  width: min(460px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.auth-brand {
  color: var(--ink);
  margin-bottom: 20px;
}

.auth-brand span {
  color: var(--muted);
}

.auth-language {
  justify-content: center;
  margin: 0 0 18px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.auth-tab {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 40px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.auth-tab.active {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.auth-card .auth-form {
  display: none;
}

.auth-card .auth-form.active {
  display: grid;
}

.auth-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  margin: 14px 0 0;
}

.sidebar {
  background: #15202b;
  color: #edf4f8;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: #f6c85f;
  color: #15202b;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #aebbc6;
  font-size: 13px;
}

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

.nav-item {
  border: 0;
  color: #d6e0e8;
  background: transparent;
  padding: 12px 14px;
  text-align: left;
  border-radius: 6px;
  cursor: pointer;
}

.nav-item.active,
.nav-item:hover {
  background: #243341;
  color: #fff;
}

.workspace {
  padding: 28px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 30px;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 14px;
  color: var(--muted);
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.account-chip {
  max-width: 260px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.acting-chip {
  max-width: 320px;
  padding: 9px 11px;
  border: 1px solid #9fd4cd;
  border-radius: 6px;
  background: #ecfdf5;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.compact-button {
  min-height: 36px;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button,
.filter,
.lang-button {
  border-radius: 6px;
  border: 1px solid var(--line);
  min-height: 40px;
  cursor: pointer;
}

.language-switch {
  display: inline-flex;
  padding: 3px;
  background: #e8eef2;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.lang-button {
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 10px;
  font-weight: 800;
}

.lang-button.active {
  background: #fff;
  color: var(--green);
  box-shadow: 0 2px 8px rgba(22, 34, 45, 0.08);
}

.primary-button {
  background: var(--green);
  border-color: var(--green);
  color: white;
  padding: 0 16px;
  font-weight: 700;
}

.secondary-button {
  background: #fff;
  color: var(--green);
  border-color: #9fd4cd;
  padding: 0 14px;
  font-weight: 700;
}

.ghost-button,
.filter {
  background: #fff;
  color: var(--muted);
  padding: 0 12px;
}

.icon-button {
  width: 42px;
  background: #fff;
  color: var(--ink);
  font-size: 20px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.metric,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

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

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

.split,
.form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.8fr);
  gap: 18px;
}

.service-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 22px;
  margin-bottom: 18px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.service-hero h2 {
  font-size: 26px;
  margin-bottom: 8px;
}

.service-hero p {
  max-width: 760px;
  color: var(--muted);
  margin-bottom: 0;
}

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

.rate-panel {
  margin-bottom: 18px;
}

.oregon-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: 18px;
  margin-bottom: 18px;
}

.oregon-panel h2 {
  margin-bottom: 10px;
}

.oregon-panel p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.65;
}

.savings-examples {
  display: grid;
  gap: 10px;
}

.savings-examples div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  background: #f7fbff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.savings-examples span {
  color: var(--muted);
}

.savings-examples strong {
  color: var(--primary);
}

.clean-list,
.steps-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.clean-list li,
.steps-list li {
  margin: 9px 0;
}

.note {
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 0;
}

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

.panel {
  padding: 20px;
}

.history-panel,
.dispatch-panel {
  margin-top: 18px;
}

.payment-due-panel {
  margin-bottom: 18px;
  border-color: #f3c97a;
  background: #fffdf5;
}

.payment-due-list {
  display: grid;
  gap: 10px;
}

.payment-due-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid #f3d28b;
  border-radius: 8px;
  background: #fff;
}

.payment-due-card span,
.payment-due-card strong {
  display: block;
}

.payment-due-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.payment-due-action {
  display: grid;
  gap: 8px;
  justify-items: end;
}

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

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

.panel-head h2,
.quote h2 {
  margin-bottom: 0;
}

.accent {
  background: #f9fbfb;
}

.address-box {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px dashed #9fb0bd;
  background: #fff;
  margin-bottom: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 12px 8px;
  white-space: normal;
  min-width: 110px;
}

th {
  color: var(--muted);
  font-size: 12px;
}

.status {
  display: inline-flex;
  min-width: 118px;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.stored {
  background: #dcfce7;
  color: #166534;
}

.pay {
  background: #fef3c7;
  color: var(--amber);
}

.out {
  background: #dbeafe;
  color: #1d4ed8;
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter.active {
  color: var(--green);
  border-color: #8ccfc7;
  background: #ecfdf5;
}

.package-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.package-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.package-visual {
  height: 96px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.82), rgba(37, 99, 235, 0.78)),
    repeating-linear-gradient(45deg, #d8e4ea 0 8px, #edf3f6 8px 16px);
}

.package-body {
  padding: 14px;
}

.package-body strong,
.package-body span {
  display: block;
}

.package-body span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 5px;
}

.package-body .checkin-button {
  margin-top: 12px;
  width: 100%;
}

.customer-list {
  display: grid;
  gap: 12px;
}

.customer-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.customer-card.active {
  border-color: #8ccfc7;
  background: #f2fbf9;
}

.customer-card-main {
  display: grid;
  gap: 5px;
}

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

.payment-hint {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.form {
  display: grid;
  gap: 14px;
}

.empty-hint {
  margin: -4px 0 2px;
  padding: 12px 14px;
  border: 1px solid #dbe5ec;
  border-radius: 6px;
  background: #f7fafb;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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

.mode-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mode-options label {
  display: flex;
  align-items: center;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  min-height: 44px;
}

.mode-options input {
  width: auto;
}

.customer-label-fields {
  display: grid;
  gap: 10px;
}

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: 6px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}

select[multiple] {
  min-height: 126px;
}

.checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.checks label {
  display: flex;
  align-items: center;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.checks input {
  width: auto;
}

dl {
  margin: 16px 0;
}

dl div,
.field-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  font-weight: 800;
}

.ops-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.ops-column {
  min-height: 300px;
  background: #f7fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.ops-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}

.ops-item strong,
.ops-item span {
  display: block;
}

.ops-item span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.dispatch-card {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(260px, 1.4fr) 150px minmax(180px, 1.2fr) auto;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-top: 10px;
  background: #fff;
}

.dispatch-card strong,
.dispatch-card span {
  display: block;
}

.dispatch-card span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.pricing-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 8px;
  align-items: end;
}

.pricing-editor strong {
  grid-column: 1 / -1;
}

.field-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
}

.field-list strong {
  color: var(--green);
  text-align: right;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: #15202b;
  color: #fff;
  padding: 12px 14px;
  border-radius: 6px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 0.2s ease;
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(21, 32, 43, 0.46);
  z-index: 20;
}

.modal-backdrop.show {
  display: grid;
}

.modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(21, 32, 43, 0.24);
  padding: 20px;
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .nav,
  .metrics,
  .split,
  .form-layout,
  .service-grid,
  .package-grid,
  .ops-board,
  .dispatch-card,
  .customer-card,
  .payment-due-card {
    grid-template-columns: 1fr;
  }

  .payment-due-action {
    justify-items: stretch;
  }

  .service-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .oregon-panel {
    grid-template-columns: 1fr;
  }

  .topbar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }

  .language-switch {
    width: 100%;
  }

  .lang-button {
    flex: 1;
  }

  .inline-fields {
    grid-template-columns: 1fr;
  }
}
