:root {
  --bg: #eef4f8;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #d9e2ec;
  --card: #ffffff;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --accent: #2563eb;
  --good: #16a34a;
  --warn: #f59e0b;
  --bad: #dc2626;
  --blue: #2563eb;
  --soft: #f8fafc;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at top left, #dff8f2 0, transparent 30%),
    linear-gradient(135deg, #f8fafc 0%, #e8f1f6 45%, #eef2ff 100%);
  color: var(--ink);
}

a {
  color: inherit;
}

.shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(18px, 4vw, 56px);
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(16px);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  box-shadow: 0 12px 30px rgba(15, 118, 110, 0.26);
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.26);
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

.nav a,
.nav button,
.btn,
button {
  border: 0;
  border-radius: 12px;
  padding: 11px 16px;
  background: var(--ink);
  color: white;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.14);
}

.btn.secondary,
.nav a.secondary,
.nav button.secondary {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
}

.btn.warn {
  background: var(--warn);
  color: #111827;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  gap: clamp(26px, 4vw, 54px);
  align-items: center;
  padding: clamp(36px, 6vw, 82px) clamp(18px, 5vw, 72px);
}

.hero h1 {
  margin: 0;
  font-size: clamp(42px, 7vw, 78px);
  line-height: 0.95;
  letter-spacing: 0;
}

.hero p {
  max-width: 720px;
  color: #334155;
  font-size: 18px;
  line-height: 1.7;
}

.hero-logo {
  display: block;
  width: min(230px, 52vw);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 26px;
  margin-bottom: 18px;
  box-shadow: 0 26px 70px rgba(37, 99, 235, 0.24);
}

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

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.1);
  color: #0f766e;
  border: 1px solid rgba(15, 118, 110, 0.18);
  font-weight: 800;
  font-size: 13px;
}

.panel,
.card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.1);
}

.panel {
  padding: clamp(20px, 3vw, 34px);
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

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

label {
  color: #0f2f5f;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 12px 13px;
  background: white;
  color: var(--ink);
  font: inherit;
  outline: none;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.color-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  align-items: center;
  gap: 12px;
}

.color-row input[type="range"] {
  padding: 0;
  accent-color: var(--accent);
}

.color-preview {
  width: 54px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.section {
  padding: 30px clamp(18px, 5vw, 72px);
}

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

.feature {
  padding: 22px;
}

.feature h3,
.card h3,
.panel h2 {
  margin: 0 0 10px;
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  background: #0f172a;
  color: white;
}

.sidebar .brand {
  margin-bottom: 24px;
}

.side-link {
  display: block;
  width: 100%;
  margin: 6px 0;
  padding: 12px;
  border-radius: 12px;
  background: transparent;
  color: #cbd5e1;
  box-shadow: none;
  text-align: left;
}

.side-link.active,
.side-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.content {
  padding: 24px;
}

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

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

.soft-panel {
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(37, 99, 235, 0.08));
}

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

.info-grid div {
  border: 1px solid #dbeafe;
  border-radius: 14px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.info-grid strong,
.info-grid span {
  display: block;
}

.info-grid span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

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

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

.rule-card {
  display: grid;
  gap: 10px;
  border: 1px solid #dbeafe;
  border-radius: 16px;
  padding: 14px;
  background: #f8fafc;
}

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

.rule-meta span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #334155;
  font-weight: 800;
  font-size: 13px;
}

.metric {
  padding: 18px;
  border-radius: 16px;
  background: white;
  border: 1px solid var(--line);
}

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

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

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid #e5edf5;
  text-align: left;
  vertical-align: top;
}

th {
  color: #334155;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.status {
  display: inline-flex;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  background: #e2e8f0;
  color: #334155;
}

.status.approved,
.status.active,
.status.paid {
  background: #dcfce7;
  color: #166534;
}

.status.pending_payment,
.status.pending,
.status.paid_pending_fulfillment {
  background: #fef3c7;
  color: #92400e;
}

.status.rejected,
.status.overdue,
.status.cancelled,
.status.failed {
  background: #fee2e2;
  color: #991b1b;
}

.status.issued,
.status.sent {
  background: #dbeafe;
  color: #1e40af;
}

.qr-box {
  display: grid;
  gap: 18px;
  justify-items: center;
  padding: 24px;
  background: white;
  border-radius: 20px;
  border: 1px solid var(--line);
}

.qr-box img {
  width: min(320px, 90vw);
  height: auto;
}

.notice {
  padding: 14px 16px;
  border-radius: 14px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  line-height: 1.55;
}

.notice code {
  display: inline-block;
  max-width: 100%;
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
  overflow-wrap: anywhere;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.hidden {
  display: none !important;
}

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

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

  .cards,
  .info-grid,
  .rules-list,
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .topbar,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .form-grid,
  .cards,
  .info-grid,
  .rules-list,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: 42px;
  }

  th,
  td {
    font-size: 13px;
  }
}
