:root {
  --bg: #f9f9ff;
  --surface: #ffffff;
  --surface-soft: #f0f3ff;
  --line: #d8e3fb;
  --line-strong: #c7c4d8;
  --text: #111c2d;
  --muted: #626577;
  --primary: #3525cd;
  --primary-2: #4f46e5;
  --blue: #006591;
  --green: #08784f;
  --red: #ba1a1a;
  --amber: #9a5d00;
  --shadow: 0 16px 44px rgba(24, 35, 70, 0.08);
  --radius: 8px;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.material-symbols-outlined {
  direction: ltr;
  display: inline-block;
  font-family: "Material Symbols Outlined";
  font-size: 20px;
  line-height: 1;
  font-feature-settings: "liga";
  font-variation-settings: "FILL" 0, "wght" 450, "GRAD" 0, "opsz" 24;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 18px;
  color: var(--primary);
  font-size: 18px;
  font-weight: 800;
}

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

.nav button {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  text-align: left;
}

.nav button.active {
  background: var(--surface-soft);
  color: var(--primary);
}

.main {
  min-width: 0;
  padding: 22px 26px 38px;
}

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

.topbar h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
}

.operator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(24, 35, 70, 0.04);
  white-space: nowrap;
}

.api-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -8px 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-weight: 800;
}

.api-banner.success {
  border-color: #b9ecd5;
  background: #edfdf5;
  color: var(--green);
}

.api-banner.warning {
  border-color: #ffe1a6;
  background: #fff8e9;
  color: var(--amber);
}

.api-banner.loading {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--primary);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.input,
.select {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: 0;
  background: var(--surface);
  padding: 0 12px;
  color: var(--text);
}

.input {
  min-width: 260px;
}

.input:focus,
.select:focus {
  border-color: var(--primary-2);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

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

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

.two-panel {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  align-items: start;
}

.card,
.stat,
.panel {
  border: 1px solid rgba(216, 227, 251, 0.9);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.stat {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stat strong {
  font-size: 24px;
  line-height: 1;
}

.stat small {
  color: var(--green);
  font-weight: 700;
}

.panel {
  padding: 16px;
}

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

.panel-head h2 {
  margin: 0;
  font-size: 16px;
}

.panel-head span {
  color: var(--muted);
  font-size: 12px;
}

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

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

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7f9ff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

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

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

.status {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef3ff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status.success {
  background: #def8ec;
  color: var(--green);
}

.status.warning {
  background: #fff1d7;
  color: var(--amber);
}

.status.danger {
  background: #ffdad6;
  color: var(--red);
}

.btn {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--primary);
  padding: 0 10px;
  font-weight: 800;
}

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

.btn.danger {
  border-color: #ffc1ba;
  color: var(--red);
}

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

.funnel {
  display: grid;
  gap: 10px;
}

.funnel-row {
  display: grid;
  grid-template-columns: 96px 1fr 44px;
  align-items: center;
  gap: 10px;
}

.bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--blue));
}

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

.review-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

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

.doc-tile {
  display: grid;
  min-height: 78px;
  place-items: center;
  gap: 6px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: #f8faff;
  color: var(--primary);
  text-align: center;
}

.doc-tile span:last-child {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

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

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

.config-card h3 {
  margin: 0;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  display: none;
  min-width: 220px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--text);
  color: #fff;
  box-shadow: var(--shadow);
}

.toast.show {
  display: block;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(17, 28, 45, 0.36);
  padding: 18px;
}

.modal-card {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(17, 28, 45, 0.22);
  padding: 18px;
}

.modal-card-wide {
  width: min(980px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
}

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

.detail-section {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  padding: 14px;
}

.detail-section h3 {
  margin: 0;
  color: var(--blue);
  font-size: 15px;
}

.detail-field {
  display: grid;
  gap: 3px;
}

.detail-field span {
  color: var(--muted);
  font-size: 12px;
}

.detail-field strong {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

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

.modal-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.modal-form .input {
  width: 100%;
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

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

@media (max-width: 1100px) {
  .admin-shell {
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .brand span,
  .nav button span:last-child {
    display: none;
  }

  .nav button {
    justify-content: center;
  }

  .kpi-grid,
  .two-panel,
  .config-grid,
  .detail-grid,
  .review-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .admin-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    z-index: 10;
    height: auto;
    overflow-x: auto;
    padding: 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    padding: 8px 10px;
  }

  .nav {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
  }

  .nav button span:last-child {
    display: inline;
  }

  .main {
    padding: 18px 14px 32px;
  }

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

  .input {
    min-width: 100%;
  }
}
