:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --card-soft: #f8faff;
  --text: #132238;
  --muted: #607086;
  --line: #d8dfec;
  --line-strong: #b9c6da;
  --brand: #1a57ff;
  --brand-dark: #123fba;
  --danger: #ba1b1b;
  --ok: #0a7d41;
  --sidebar: #f8fbff;
  --sidebar-active: #e4ebff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: linear-gradient(180deg, #f8fbff 0%, #eef3f9 100%);
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
.wrap { width: min(1100px, calc(100% - 2rem)); margin: 0 auto; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; min-height: 68px; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: 0.75rem; font-size: 1.35rem; font-weight: 700; color: var(--text); }
.brand-admin { padding: 1rem 0.9rem; border-radius: 18px; background: rgba(255,255,255,0.6); }
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.9rem;
  background: linear-gradient(135deg, var(--brand), #65a0ff);
  color: white;
}
.eyebrow {
  margin: 0 0 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}
.nav { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
}
.admin-sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.sidebar-nav {
  display: grid;
  gap: 0.45rem;
}
.sidebar-nav a {
  padding: 0.9rem 1rem;
  border-radius: 14px;
  color: var(--text);
  font-weight: 700;
}
.sidebar-nav a.active {
  background: var(--sidebar-active);
  box-shadow: inset 0 0 0 1px rgba(26, 87, 255, 0.08);
}
.sidebar-status {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.95rem 1rem;
  border-radius: 16px;
  background: #dff7e8;
  color: #0d6b37;
  font-weight: 700;
}
.status-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.18);
}
.admin-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.admin-topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
}
.admin-topbar h1 {
  margin: 0;
  font-size: 1.15rem;
}
.admin-topbar-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.search-box {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.8rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: white;
  min-width: 300px;
}
.search-box input {
  border: 0;
  padding: 0;
  outline: none;
  width: 100%;
  background: transparent;
}
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
}
.user-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background: #d9ecdf;
  color: #0b5a2f;
  font-weight: 800;
}
.user-chip strong,
.user-chip small {
  display: block;
}
.workspace {
  padding: 1.5rem;
}
.stack > * + * { margin-top: 1rem; }
.stack-sm > * + * { margin-top: 0.65rem; }
.stack-lg > * + * { margin-top: 1.5rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.two-panels { grid-template-columns: 1.1fr 1fr; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.25rem;
  box-shadow: 0 10px 24px rgba(19, 34, 56, 0.06);
}
.card.soft { background: rgba(255,255,255,0.78); }
.narrow { width: min(640px, 100%); margin: 2rem auto; }
.page-head, .actions { display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap; }
.page-head {
  padding-bottom: 0.25rem;
}
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
label { display: grid; gap: 0.45rem; font-weight: 600; }
input, textarea, select, button {
  font: inherit;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
}
button, .button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  background: var(--brand);
  color: white;
  border: 0;
  cursor: pointer;
  font-weight: 700;
}
.button.secondary,
button.secondary {
  background: #e8eef8;
  color: var(--text);
}
button:hover, .button:hover { background: var(--brand-dark); text-decoration: none; }
.button.secondary:hover,
button.secondary:hover {
  background: #d9e3f1;
  color: var(--text);
}
.link-button { background: transparent; color: var(--brand); padding: 0; }
.checkbox {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.checkbox input {
  width: 1rem;
  height: 1rem;
  padding: 0;
}
small { color: var(--muted); font-weight: 400; }
.error { color: var(--danger); }
.ok { color: var(--ok); }
.cover-preview { border-radius: 14px; max-height: 260px; object-fit: cover; }
.hero {
  display: grid;
  grid-template-columns: 1.2fr 420px;
  gap: 1.5rem;
  align-items: start;
}
.ticket-row, .list-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
}
.ticket-row:last-child, .list-row:last-child { border-bottom: 0; }
.rich-text p:first-child { margin-top: 0; }
.result-box {
  min-height: 64px;
  padding: 1rem;
  border-radius: 14px;
  background: #eef3f9;
}
.result-box.ok { background: #dbf5e7; color: var(--ok); }
.result-box.error { background: #fde7e7; color: var(--danger); }
.custom-field-row {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(248, 250, 253, 0.95);
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: #ecf2ff;
  color: #2447b7;
  font-size: 0.85rem;
  font-weight: 700;
}
.stat-card {
  background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.1rem 1.2rem;
  box-shadow: 0 10px 24px rgba(19, 34, 56, 0.05);
}
.stat-card .value {
  display: block;
  font-size: 2rem;
  line-height: 1;
  font-weight: 800;
  margin-bottom: 0.35rem;
}
.admin-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1rem;
}
.admin-hero-panel {
  display: grid;
  gap: 1rem;
}
.soft-muted {
  color: var(--muted);
}
.qr-preview { width: 220px; margin: 1rem 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.8rem; border-bottom: 1px solid var(--line); }

@media (max-width: 1100px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }
  .admin-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .admin-topbar,
  .admin-hero {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }
  .admin-topbar-meta {
    flex-wrap: wrap;
  }
  .search-box {
    min-width: 0;
    width: 100%;
  }
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .hero,
  .two-panels,
  .two-col,
  .stat-grid {
    grid-template-columns: 1fr;
  }
}
