:root {
  --bg: #f5f7f8;
  --panel: #ffffff;
  --line: #dce4e7;
  --text: #142426;
  --muted: #687c80;
  --teal: #0e8f94;
  --teal-dark: #09676b;
  --mint: #dff6f3;
  --blue: #2f6fed;
  --amber: #d98910;
  --red: #c94141;
  --green: #1f9d64;
  --shadow: 0 18px 50px rgba(23, 42, 45, 0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

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

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

.sidebar {
  background: #102a2d;
  color: #fff;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--teal);
  font-weight: 800;
}

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

.brand span {
  color: #b5cacc;
  font-size: 13px;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 4px;
  overflow-y: auto;
  padding-right: 4px;
}

.nav button {
  border: 0;
  background: transparent;
  color: #d7e5e7;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
}

.nav button:hover,
.nav button.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav svg,
.top-actions svg,
.icon-button svg,
.primary-button svg,
.secondary-button svg {
  width: 18px;
  height: 18px;
}

.plan-box {
  margin-top: auto;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 14px;
}

.plan-box span,
.plan-box small {
  display: block;
  color: #b5cacc;
}

.plan-box strong {
  display: block;
  margin: 4px 0;
}

.workspace {
  min-width: 0;
}

.topbar {
  min-height: 86px;
  padding: 18px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  background: rgba(245, 247, 248, 0.9);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 1px solid var(--line);
}

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

h1 {
  font-size: 26px;
}

h2 {
  font-size: 22px;
}

h3 {
  font-size: 16px;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  margin-bottom: 3px;
}

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

.search {
  min-width: min(420px, 42vw);
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  height: 42px;
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
}

.view {
  padding: 24px 28px 48px;
}

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

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button {
  border: 0;
  border-radius: 8px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.primary-button {
  background: var(--teal);
  color: #fff;
  padding: 0 14px;
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.secondary-button {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  padding: 0 12px;
}

.danger-button {
  background: #fff0f0;
  color: var(--red);
  border: 1px solid #ffd0d0;
  padding: 0 12px;
}

.icon-button {
  width: 40px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text);
}

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

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

.two-col {
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
}

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

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(20, 36, 38, 0.03);
}

.card-head {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-body {
  padding: 16px;
}

.stat-card {
  padding: 16px;
}

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

.stat-card strong {
  display: block;
  font-size: 28px;
  margin-top: 8px;
}

.stat-card small {
  display: block;
  color: var(--green);
  margin-top: 8px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 740px;
}

th,
td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  background: #fbfcfc;
}

td {
  font-size: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 650;
}

.pill.green {
  color: #126642;
  background: #dcf7e9;
}

.pill.blue {
  color: #214c9f;
  background: #e2ebff;
}

.pill.amber {
  color: #7c4c0a;
  background: #fff1d7;
}

.pill.red {
  color: #923434;
  background: #ffe3e3;
}

.pill.gray {
  color: #536266;
  background: #eef2f3;
}

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

.quick-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.quick-item span,
.muted {
  color: var(--muted);
}

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

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

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

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #fff;
  outline: 0;
}

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

.modal {
  width: min(760px, calc(100vw - 24px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(10, 23, 25, 0.38);
}

.modal form {
  margin: 0;
}

.modal-head,
.modal-actions {
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-head {
  border-bottom: 1px solid var(--line);
}

.modal-body {
  padding: 18px;
}

.modal-actions {
  border-top: 1px solid var(--line);
  justify-content: flex-end;
}

.face-chart {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
}

.face-canvas {
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 28%, transparent 0 64px, #dce4e7 65px 66px, transparent 67px),
    radial-gradient(circle at 39% 44%, #dce4e7 0 5px, transparent 6px),
    radial-gradient(circle at 61% 44%, #dce4e7 0 5px, transparent 6px),
    radial-gradient(ellipse at 50% 70%, transparent 0 64px, #dce4e7 65px 66px, transparent 67px),
    #fff;
  position: relative;
  overflow: hidden;
}

.mark {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--teal);
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--teal);
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: #edf2f3;
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  background: var(--teal);
}

.sales-page {
  background: linear-gradient(135deg, #e8fbf8, #ffffff);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}

.sales-page h2 {
  font-size: 30px;
  margin-bottom: 10px;
}

.sales-page p {
  color: var(--muted);
  max-width: 780px;
}

.empty {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
}

.review-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 12px;
  background: #fff;
}

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

.review-photo,
.review-placeholder {
  margin: 0;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f3f7f7;
  position: relative;
}

.review-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.review-photo figcaption,
.review-placeholder span {
  position: absolute;
  left: 8px;
  bottom: 8px;
  background: rgba(16, 42, 45, 0.82);
  color: #fff;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
}

.review-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  background: repeating-linear-gradient(135deg, #f7fafb, #f7fafb 12px, #edf3f4 12px, #edf3f4 24px);
}

.review-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.upload-field {
  display: grid;
  gap: 8px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfc;
}

.upload-preview {
  width: 140px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.opd-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
}

.opd-timeline {
  display: grid;
  gap: 12px;
  padding: 16px;
}

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

.opd-card-head,
.opd-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

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

.opd-section > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfc;
  min-height: 76px;
}

.opd-section span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.opd-section p {
  font-size: 14px;
  line-height: 1.45;
}

.mobile-only {
  display: none;
}

@media (max-width: 1040px) {
  .stats,
  .three-col,
  .two-col,
  .face-chart,
  .review-grid,
  .opd-layout {
    grid-template-columns: 1fr;
  }

  .search {
    min-width: 240px;
  }
}

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

  .sidebar {
    position: fixed;
    z-index: 20;
    inset: 0 auto 0 0;
    width: 290px;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-only {
    display: inline-flex;
  }

  .topbar,
  .top-actions,
  .toolbar,
  .form-grid {
    flex-direction: column;
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .topbar {
    position: static;
    padding: 14px;
  }

  .view {
    padding: 14px;
  }

  .search {
    width: 100%;
    min-width: 0;
  }

  .opd-card-head,
  .opd-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .opd-section {
    grid-template-columns: 1fr;
  }
}

/* Demo login gate */
.login-gate {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #102a2d;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.login-card .brand-mark {
  background: var(--teal);
  color: #fff;
}

.login-card h1 {
  margin: 0;
  font-size: 20px;
}

.login-sub {
  margin: -6px 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.login-card label {
  width: 100%;
  text-align: left;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-card input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
}

.login-card input:focus {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
}

.login-card .primary-button {
  width: 100%;
  margin-top: 6px;
}

.login-error {
  color: var(--red);
  font-size: 13px;
  margin: 0;
}

.login-demo-hint {
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--mint);
  border-radius: 8px;
  font-size: 13px;
  color: var(--teal-dark);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.login-demo-hint code {
  background: #fff;
  border-radius: 4px;
  padding: 1px 6px;
  font-weight: 700;
}
