:root {
  --ink: #162023;
  --muted: #667276;
  --line: #dfe6e4;
  --soft: #f4f7f2;
  --paper: #ffffff;
  --brand: #16765c;
  --brand-dark: #0e4e40;
  --accent: #db7d2d;
  --danger: #b94040;
  --shadow: 0 18px 50px rgba(19, 38, 34, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(238, 243, 239, 0.92), rgba(231, 239, 234, 0.88)),
    url("assets/repair-workbench-bg.png") center / cover fixed;
}

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

button {
  cursor: pointer;
}

.login-screen {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 42px;
  align-items: center;
  min-height: 100vh;
  padding: 42px;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(247, 250, 245, 0.96) 0%, rgba(247, 250, 245, 0.88) 42%, rgba(231, 240, 234, 0.64) 100%),
    url("assets/repair-workbench-bg.png") center right / cover no-repeat;
}

.login-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 22%, rgba(22, 118, 92, 0.12), transparent 32%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.34), transparent 48%),
    repeating-linear-gradient(90deg, rgba(18, 55, 47, 0.045) 0 1px, transparent 1px 54px);
}

.login-screen > * {
  position: relative;
  z-index: 1;
}

.login-screen.hidden,
.app-shell.locked {
  display: none;
}

.public-customer .sidebar,
.public-customer .topbar,
.public-customer #dashboard,
.public-customer #records,
.public-customer #customers,
.public-customer #business,
.public-customer #plan,
.public-customer #messages,
.public-customer #reports {
  display: none;
}

.public-customer .app-shell {
  grid-template-columns: 1fr;
}

.public-customer .main {
  max-width: 920px;
  width: 100%;
  margin: 0 auto;
}

.public-customer .customer-layout {
  grid-template-columns: minmax(320px, 440px) minmax(280px, 1fr);
}

.login-copy {
  max-width: 780px;
}

.brand-dark {
  color: var(--ink);
  margin-bottom: 34px;
}

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

.login-copy h1 {
  margin-bottom: 18px;
}

.login-copy p {
  max-width: 620px;
  color: #465255;
  font-size: 1.08rem;
  line-height: 1.7;
}

.login-points {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.login-points span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
}

.login-points span {
  padding: 10px 12px;
  font-weight: 850;
}

.login-card {
  display: grid;
  gap: 15px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.auth-tab {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-weight: 850;
}

.auth-tab.active {
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 8px 22px rgba(19, 38, 34, 0.08);
}

.auth-panel {
  display: none;
  gap: 15px;
}

.auth-panel.active {
  display: grid;
}

.login-card h2 {
  margin-bottom: 8px;
  font-size: 1.6rem;
}

.login-card small {
  color: var(--muted);
  line-height: 1.5;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px;
  color: #f7fbf8;
  background: #12372f;
}

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

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 8px;
  color: #12372f;
  background: #a7e0c0;
  font-weight: 900;
}

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

.brand span,
.account-box span,
.account-box small {
  color: rgba(247, 251, 248, 0.72);
}

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

.nav-item {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: rgba(247, 251, 248, 0.86);
  text-align: left;
  background: transparent;
}

.nav-item.active,
.nav-item:hover {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.11);
}

.account-box {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.account-box strong,
.account-box span,
.account-box small {
  display: block;
}

.account-box strong {
  margin: 6px 0;
}

.main {
  min-width: 0;
  padding: 28px;
  position: relative;
  isolation: isolate;
}

.main::before {
  content: "";
  position: fixed;
  inset: 0 0 0 280px;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(238, 243, 239, 0.88), rgba(247, 250, 245, 0.82)),
    url("assets/repair-workbench-bg.png") center / cover no-repeat;
  opacity: 0.18;
  filter: saturate(0.75) blur(1px);
}

.main::after {
  content: "";
  position: fixed;
  inset: 0 0 0 280px;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 78% 18%, rgba(219, 125, 45, 0.1), transparent 28%),
    repeating-linear-gradient(0deg, rgba(18, 55, 47, 0.035) 0 1px, transparent 1px 42px),
    repeating-linear-gradient(90deg, rgba(18, 55, 47, 0.026) 0 1px, transparent 1px 42px);
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 780px;
  margin-bottom: 0;
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.04rem;
}

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

.primary,
.secondary,
.ghost {
  min-height: 42px;
  padding: 0 15px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 800;
}

.primary {
  color: #fff;
  background: var(--brand);
}

.primary:hover {
  background: var(--brand-dark);
}

.secondary {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--line);
}

.ghost {
  width: 100%;
  margin-top: 12px;
  color: #f7fbf8;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.13);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.metrics article,
.panel,
.plan,
.phone-frame {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.metrics article {
  padding: 18px;
}

.metrics span,
.panel-heading span,
.record-meta,
.record-foot,
.plan span,
.phone-header small {
  color: var(--muted);
  font-size: 0.88rem;
}

.metrics strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
}

.dashboard-grid,
.workbench,
.customer-layout,
.business-profile-grid,
.messages-grid,
.reports-grid,
.plan-status-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
  gap: 18px;
  align-items: start;
}

.panel {
  padding: 18px;
}

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

.timeline,
.record-list,
.business-flow,
.info-list,
.message-templates {
  display: grid;
  gap: 12px;
}

.timeline-item,
.business-flow div,
.info-list p,
.message-templates article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.timeline-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.timeline-item p,
.business-flow p,
.info-list p,
.message-templates p {
  margin-bottom: 0;
}

.helper-text {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.report-policy {
  padding: 14px;
  border: 1px solid #f1c27d;
  border-radius: 8px;
  color: #70420d;
  background: #fff6e8;
}

.report-policy strong {
  display: block;
  margin-bottom: 7px;
  color: #4f2f08;
}

.report-policy p {
  margin-bottom: 0;
  color: inherit;
  font-size: 0.92rem;
  line-height: 1.55;
}

.report-policy.complete {
  border-color: #9bc8b9;
  color: #174438;
  background: #edf8f3;
}

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

.report-metrics {
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  margin-bottom: 14px;
}

.report-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.report-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.report-table th,
.report-table td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.report-table th {
  color: #3d494c;
  background: var(--soft);
  font-size: 0.88rem;
}

.plan-alert {
  display: none;
  margin-bottom: 18px;
  padding: 13px 15px;
  border: 1px solid #f1c27d;
  border-radius: 8px;
  color: #70420d;
  background: #fff6e8;
  font-weight: 800;
}

.plan-alert.active {
  display: block;
}

.plan-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.plan-summary article,
.package-list article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.plan-summary span,
.package-list span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.88rem;
}

.plan-summary strong {
  font-size: 1.35rem;
}

.usage-bar {
  height: 10px;
  margin-bottom: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe6e4;
}

.usage-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.package-list {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.brand-preview {
  display: grid;
  gap: 16px;
}

.preview-card {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

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

.preview-card p {
  margin: 5px 0;
  color: var(--muted);
}

.preview-logo {
  display: grid;
  flex: 0 0 auto;
  width: 76px;
  height: 76px;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  font-size: 1.4rem;
  font-weight: 900;
}

.preview-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.business-flow b {
  display: grid;
  width: 28px;
  height: 28px;
  margin-bottom: 8px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
}

.form-panel,
.lookup-form {
  display: grid;
  gap: 13px;
}

label {
  display: grid;
  gap: 7px;
  color: #3d494c;
  font-weight: 760;
}

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

textarea {
  min-height: 92px;
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.search {
  max-width: 320px;
}

.record-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.record-main,
.record-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.record-title,
.record-meta {
  display: block;
}

.record-issue {
  margin: 12px 0;
  color: #3e4a4d;
}

.record-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.record-actions select {
  max-width: 210px;
}

.price-input {
  max-width: 130px;
}

.record-foot {
  margin-top: 10px;
}

.status-pill {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  color: #12372f;
  background: #dcefe6;
  font-size: 0.78rem;
  font-weight: 900;
}

.status-pill.waiting {
  color: #70420d;
  background: #ffe4bd;
}

.status-pill.done {
  color: #31510f;
  background: #e2f5c8;
}

.phone-frame {
  max-width: 410px;
  min-height: 680px;
  padding: 18px;
  background: #101817;
}

.phone-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 18px;
  color: #f7fbf8;
}

.lookup-form,
.customer-result {
  padding: 16px;
  border-radius: 8px;
  background: #f8fbf8;
}

.customer-result {
  margin-top: 14px;
}

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

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

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.step::before {
  content: "";
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid #bdc9c6;
}

.step.active {
  color: var(--ink);
  font-weight: 850;
}

.step.active::before {
  border-color: var(--brand);
  background: var(--brand);
}

.approval-box {
  padding: 13px;
  border-radius: 8px;
  background: #fff6e8;
}

.approval-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.danger {
  color: #fff;
  border: 0;
  border-radius: 8px;
  background: var(--danger);
  font-weight: 850;
}

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

.plan {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.plan h2 {
  font-size: 1.7rem;
}

.plan p {
  min-height: 72px;
  color: var(--muted);
}

.plan.current {
  border-color: #b0d9c3;
  background: #eef8f1;
}

.billing-note p {
  margin-bottom: 0;
  color: #3e4a4d;
}

@media (max-width: 980px) {
  .login-screen {
    grid-template-columns: 1fr;
    padding: 22px;
  }

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

  .sidebar {
    position: static;
    padding: 18px;
  }

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

  .account-box {
    margin-top: 0;
  }

  .topbar,
  .record-main {
    display: grid;
  }

  .metrics,
  .dashboard-grid,
  .workbench,
  .customer-layout,
  .business-profile-grid,
  .messages-grid,
  .reports-grid,
  .plan-status-grid,
  .billing-grid {
    grid-template-columns: 1fr;
  }

  .phone-frame {
    max-width: none;
    min-height: auto;
  }
}

@media (max-width: 560px) {
  .main {
    padding: 16px;
  }

  .main::before,
  .main::after {
    inset: 0;
  }

  .nav,
  .form-row,
  .approval-actions,
  .plan-summary {
    grid-template-columns: 1fr;
  }

  .record-actions > * {
    max-width: none;
    width: 100%;
  }
}

.admin-only {
  display: none;
}

.is-platform-admin .admin-only {
  display: block;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.admin-hero .panel-heading {
  align-items: flex-start;
}

.admin-tenant-list {
  display: grid;
  gap: 14px;
}

.admin-tenant-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.admin-tenant-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1.02rem;
}

.admin-tenant-card span {
  color: var(--muted);
}

.admin-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-badges span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 800;
}

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