:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-strong: #111214;
  --line: #dde2ea;
  --line-strong: #c6ceda;
  --text: #171a21;
  --muted: #667085;
  --faint: #98a2b3;
  --brand: #ec6a2c;
  --brand-strong: #c94d17;
  --teal: #0f766e;
  --blue: #315bca;
  --green: #167647;
  --red: #b42318;
  --amber: #a15c07;
  --shadow: 0 18px 42px rgba(17, 18, 20, 0.07);
}

* {
  box-sizing: border-box;
}

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

a {
  color: inherit;
  text-decoration: none;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 0.9fr) minmax(380px, 520px);
  background: var(--surface);
}

.auth-hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 72px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(236, 106, 44, 0.08), transparent 42%),
    #f7f8fa;
}

.auth-eyebrow {
  width: max-content;
  padding: 6px 10px;
  border: 1px solid #f2c5ad;
  border-radius: 999px;
  background: #fff7f2;
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 760;
}

.auth-hero h1 {
  max-width: 720px;
  margin: 22px 0 16px;
  font-size: 48px;
  line-height: 1.04;
  font-weight: 800;
}

.auth-hero p {
  max-width: 620px;
  margin: 0;
  color: #515b6b;
  font-size: 17px;
  line-height: 1.75;
}

.auth-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  max-width: 640px;
  margin-top: 34px;
}

.auth-metric {
  min-height: 108px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.auth-metric strong {
  display: block;
  font-size: 25px;
  line-height: 1;
}

.auth-metric span {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 36px;
  background: var(--surface);
}

.auth-box {
  width: 100%;
  max-width: 392px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.auth-box h2,
.page-title h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 800;
}

.auth-box p,
.page-title p {
  margin: 9px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 14px;
  border-right: 1px solid var(--line);
  background: #fbfcfd;
  color: var(--text);
}

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

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-strong);
  color: #fff;
  font-weight: 820;
}

.brand-name {
  font-size: 15px;
  font-weight: 800;
}

.brand-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.account-mini {
  margin: 0 8px 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.account-mini strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.account-mini span {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.nav-label {
  padding: 12px 10px 6px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.nav {
  display: grid;
  gap: 3px;
  margin-top: 4px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 9px 10px;
  border-radius: 8px;
  color: #4c5565;
  font-size: 14px;
  font-weight: 640;
}

.nav a:hover,
.nav a.active {
  background: #111214;
  color: #fff;
}

.nav-icon {
  width: 18px;
  height: 18px;
  color: currentColor;
}

.sidebar-footer {
  position: absolute;
  right: 14px;
  bottom: 18px;
  left: 14px;
  padding: 12px;
  border: 1px solid #f0d1c2;
  border-radius: 8px;
  background: #fff7f2;
  color: #8a421a;
  font-size: 12px;
  line-height: 1.5;
}

.main {
  min-width: 0;
  padding: 28px 34px 54px;
}

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

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

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.lang-switch a {
  min-width: 38px;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  text-align: center;
  text-decoration: none;
}

.lang-switch a.active {
  background: var(--surface-strong);
  color: #fff;
}

.auth-lang-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.page-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 820;
  text-transform: uppercase;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.badge.green {
  border-color: #abefc6;
  background: #ecfdf3;
  color: var(--green);
}

.badge.amber {
  border-color: #fedf89;
  background: #fffaeb;
  color: var(--amber);
}

.badge.red {
  border-color: #fecdca;
  background: #fef3f2;
  color: var(--red);
}

.badge.blue {
  border-color: #c7d7fe;
  background: #eef4ff;
  color: var(--blue);
}

.flash-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.flash {
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

.flash.success {
  border-color: #abefc6;
  background: #ecfdf3;
}

.flash.error {
  border-color: #fecdca;
  background: #fef3f2;
}

.flash.warning {
  border-color: #fedf89;
  background: #fffaeb;
}

.section {
  margin-top: 22px;
}

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

.section-head h2 {
  margin: 0;
  font-size: 17px;
}

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

.panel.plain {
  box-shadow: none;
}

.command-panel {
  padding: 20px;
  border: 1px solid #ead8ce;
  border-radius: 8px;
  background: #fffaf6;
}

.command-panel.subtle {
  border-color: var(--line);
  background: var(--surface);
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.15fr);
  gap: 16px;
  align-items: start;
}

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

.stat-card {
  min-height: 116px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  text-transform: uppercase;
}

.stat-value {
  margin-top: 11px;
  font-size: 27px;
  line-height: 1;
  font-weight: 820;
}

.stat-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

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

.metric-row .stat-card {
  min-height: 104px;
}

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

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

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

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

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

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #cfd6e1;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

input:disabled,
select:disabled,
textarea:disabled {
  background: #f8fafc;
  color: #667085;
  cursor: not-allowed;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  outline: 3px solid rgba(236, 106, 44, 0.16);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 740;
}

.btn svg,
.btn [data-lucide] {
  width: 16px;
  height: 16px;
}

.btn.primary {
  border-color: var(--surface-strong);
  background: var(--surface-strong);
  color: #fff;
}

.btn.primary:hover {
  background: #2a2c31;
}

.btn.accent {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.btn.accent:hover {
  background: var(--brand-strong);
}

.btn.ghost {
  background: transparent;
}

.btn.small {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 12px;
}

.link-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.copy-value {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  padding: 10px 12px;
  border: 1px solid #d2d8e2;
  border-radius: 8px;
  background: #fff;
  color: #344054;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
}

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

.rule-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.rule-item:last-child {
  border-bottom: 0;
}

.rule-item strong {
  font-size: 22px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

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

.table-action {
  display: grid;
  gap: 8px;
  min-width: 220px;
}

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

th,
td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  background: #f8fafc;
  color: #475467;
  font-weight: 780;
}

tr:last-child td {
  border-bottom: 0;
}

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

.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.empty {
  padding: 26px;
  border: 1px dashed #cfd6e1;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  text-align: center;
}

.empty strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

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

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

.material {
  min-height: 164px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.material h3 {
  margin: 9px 0 8px;
  font-size: 16px;
}

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

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

.material-footer {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-flow {
  display: grid;
  gap: 10px;
}

.status-step {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.status-dot {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #111214;
  color: #fff;
  font-size: 11px;
  font-weight: 820;
}

.status-step strong {
  display: block;
  font-size: 13px;
}

.status-step span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.account-card {
  display: grid;
  gap: 10px;
}

.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.account-row:last-child {
  border-bottom: 0;
}

.account-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 740;
}

.inline-form input,
.inline-form select {
  min-height: 34px;
}

.admin-row-form {
  display: grid;
  grid-template-columns: 1fr 110px 90px 90px 1.4fr auto;
  gap: 8px;
  align-items: start;
}

.qr-box {
  max-width: 170px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.settlement-card {
  padding: 16px;
  border: 1px solid #fedf89;
  border-radius: 8px;
  background: #fffbeb;
}

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

  .auth-hero {
    min-height: 320px;
    padding: 36px;
  }

  .auth-panel {
    order: -1;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .sidebar-footer {
    position: static;
    margin-top: 16px;
  }

  .stat-grid,
  .grid-3,
  .material-list,
  .auth-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .work-grid {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar {
    padding: 14px 14px 10px;
  }

  .brand-lockup {
    padding: 4px 4px 10px;
  }

  .account-mini,
  .nav-label,
  .sidebar-footer {
    display: none;
  }

  .nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .nav a {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 8px 10px;
    white-space: nowrap;
  }

  .topbar,
  .section-head,
  .link-line {
    align-items: stretch;
    flex-direction: column;
  }

  .link-line .btn {
    width: 100%;
    min-width: 0;
  }

  .copy-value {
    max-width: 100%;
    overflow-wrap: anywhere;
    text-overflow: clip;
    white-space: normal;
  }

  .stat-grid,
  .metric-row,
  .grid-2,
  .grid-3,
  .form-grid,
  .material-list,
  .auth-metrics {
    grid-template-columns: 1fr;
  }

  .auth-panel {
    padding: 34px 20px;
  }

  .auth-hero h1 {
    font-size: 36px;
  }
}
