:root {
  --fire-1: #ffb547;
  --fire-2: #ff5a1f;
  --fire-3: #e8290b;
  --ink: #1a1410;
  --ink-2: #3d332c;
  --mute: #7a6c62;
  --line: #eadfd4;
  --warm: #fff7f1;
  --panel: #ffffff;
  --ok: #1f7a4c;
  --ok-bg: #e8f7ef;
  --warn: #9a6400;
  --warn-bg: #fff4d6;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --info: #175cd3;
  --info-bg: #eff4ff;
  --sidebar: #17110e;
  --sidebar-text: #f6ebe3;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(40, 20, 8, 0.04), 0 18px 40px -24px rgba(120, 50, 10, 0.35);
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Syne", "DM Sans", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(255, 90, 31, 0.12), transparent 55%),
    linear-gradient(180deg, #fffaf6 0%, #f4ebe3 100%);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }

.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #1d1410 0%, #120d0b 100%);
  color: var(--sidebar-text);
  padding: 1.25rem 1rem;
  display: flex; flex-direction: column; gap: 1.5rem;
  position: sticky; top: 0; height: 100vh;
}
.sidebar__brand {
  display: flex; gap: .85rem; align-items: center; padding: .35rem .5rem;
}
.sidebar__brand strong { display: block; font-family: var(--display); font-size: 1.15rem; }
.sidebar__brand small { color: #cbb7a8; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--fire-1), var(--fire-2) 45%, var(--fire-3));
  box-shadow: 0 10px 24px -10px rgba(255, 90, 31, .8);
}
.sidebar__nav { display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.nav-link {
  padding: .7rem .9rem; border-radius: 12px; color: #dccfc4;
  transition: background .2s, color .2s;
}
.nav-link:hover, .nav-link.is-active {
  background: rgba(255, 90, 31, .16); color: #fff;
}
.sidebar__foot { border-top: 1px solid rgba(255,255,255,.08); padding-top: 1rem; }
.user-chip { display: flex; justify-content: space-between; gap: .75rem; font-size: .92rem; color: #cbb7a8; }
.user-chip a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }

.shell { min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: 1.25rem 1.5rem .25rem;
}
.topbar h1 {
  margin: 0; font-family: var(--display); font-size: 1.55rem; font-weight: 700;
}
.nav-toggle {
  display: none; border: 0; background: var(--panel); width: 42px; height: 42px;
  border-radius: 12px; box-shadow: var(--shadow); cursor: pointer;
}
.main { padding: 1rem 1.5rem 2.5rem; }

.panel {
  background: var(--panel);
  border: 1px solid rgba(234, 223, 212, .9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.25rem;
  margin-bottom: 1.1rem;
}
.panel__head {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  margin-bottom: .85rem;
}
.panel__head h2, .panel h2, .panel h3 { margin: 0 0 .75rem; font-family: var(--display); font-size: 1.1rem; }
.panel__head h2, .panel__head h3 { margin: 0; }
.panel--alert { border-color: #f2c089; background: linear-gradient(180deg, #fff9f2, #fff); }

.stats {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; margin-bottom: 1.1rem;
}
.stats--compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 1100px) {
  .stats--compact { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.stat::after {
  content: ""; position: absolute; inset: auto -20% -40% auto; width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(255,90,31,.18), transparent 70%);
}
.stat span { display: block; color: var(--mute); font-size: .88rem; }
.stat strong { display: block; font-family: var(--display); font-size: 1.45rem; margin-top: .2rem; }
.stat small { color: var(--mute); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.toolbar {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.toolbar__search { display: flex; gap: .5rem; flex-wrap: wrap; flex: 1; }
.toolbar__search input, .toolbar__search select { min-width: 160px; }
.toolbar__actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.page-title { margin: 0; font-family: var(--display); font-size: 1.35rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 42px; padding: 0 1rem; border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; cursor: pointer; transition: transform .15s, box-shadow .2s, background .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn--primary {
  color: #fff;
  background: linear-gradient(100deg, var(--fire-1), var(--fire-2) 40%, var(--fire-3));
  box-shadow: 0 12px 24px -14px rgba(232, 41, 11, .8);
}
.btn--ghost { background: #fff; border-color: var(--line); }
.btn--danger { background: var(--danger-bg); color: var(--danger); border-color: #f3c1bc; }
.btn--block { width: 100%; }
.btn--sm { min-height: 34px; padding: 0 .7rem; font-size: .9rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .75rem .55rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--mute); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.actions { display: flex; gap: .75rem; white-space: nowrap; }
.actions a { color: var(--fire-2); font-weight: 600; }
.muted { color: var(--mute); }
.page-title + .muted { margin-top: .2rem; }

.badge {
  display: inline-flex; align-items: center; padding: .15rem .55rem; border-radius: 999px;
  font-size: .78rem; font-weight: 700; background: #f1ebe5; color: var(--ink-2);
}
.badge--ok { background: var(--ok-bg); color: var(--ok); }
.badge--warn { background: var(--warn-bg); color: var(--warn); }
.badge--danger { background: var(--danger-bg); color: var(--danger); }
.badge--info { background: var(--info-bg); color: var(--info); }
.badge--mute { background: #f1ebe5; color: var(--mute); }

.alert {
  padding: .85rem 1rem; border-radius: 12px; margin-bottom: 1rem; font-weight: 500;
}
.alert--ok { background: var(--ok-bg); color: var(--ok); }
.alert--danger { background: var(--danger-bg); color: var(--danger); }
.alert--info { background: var(--info-bg); color: var(--info); }

.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .85rem; }
.field span { font-size: .88rem; color: var(--ink-2); font-weight: 600; }
.field input, .field select, .field textarea,
.toolbar__search input, .toolbar__search select,
.items-table input {
  width: 100%; min-height: 42px; padding: .55rem .75rem;
  border: 1px solid #e2d5c9; border-radius: 12px; background: #fff;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus,
.toolbar__search input:focus, .toolbar__search select:focus {
  outline: 2px solid rgba(255, 90, 31, .35); border-color: var(--fire-2);
}
.fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem 1rem; }
.check { display: flex; align-items: center; gap: .55rem; margin: .5rem 0 1rem; }
.check-list { display: flex; flex-direction: column; gap: .45rem; margin-bottom: 1rem; }
.form-actions { display: flex; gap: .65rem; align-items: center; flex-wrap: wrap; margin: .25rem 0 1.5rem; }
.stack { display: flex; flex-direction: column; gap: .35rem; }
.dl { display: grid; gap: .55rem; margin: 0; }
.dl > div { display: grid; grid-template-columns: 140px 1fr; gap: .5rem; }
.dl dt { color: var(--mute); margin: 0; }
.dl dd { margin: 0; }
.activity { list-style: none; margin: 0; padding: 0; }
.activity li {
  display: grid; grid-template-columns: 140px 1fr auto; gap: .75rem;
  padding: .55rem 0; border-bottom: 1px solid var(--line); font-size: .92rem;
}
.pagination { display: flex; gap: .35rem; margin-top: 1rem; flex-wrap: wrap; }
.pagination a {
  min-width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--line); background: #fff;
}
.pagination a.is-active { background: var(--fire-2); color: #fff; border-color: var(--fire-2); }
.qr-box { margin-top: 1rem; text-align: center; }
.qr-box #qrcode { display: inline-block; padding: .5rem; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.empty-state { text-align: center; padding: 3rem 1rem; }
.items-table input { min-height: 38px; }

.guest {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; position: relative;
}
.guest__bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(900px 420px at 15% 10%, rgba(255, 90, 31, .22), transparent 60%),
    radial-gradient(700px 380px at 90% 80%, rgba(255, 181, 71, .2), transparent 55%),
    linear-gradient(160deg, #1a120e, #2a1812 45%, #1a120e);
}
.guest__card {
  position: relative; width: min(420px, 100%);
  background: rgba(255,255,255,.96); border-radius: 22px; padding: 1.6rem;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,.55);
}
.guest__brand { display: flex; gap: .9rem; align-items: center; margin-bottom: 1.25rem; }
.guest__brand strong { font-family: var(--display); font-size: 1.25rem; display: block; }
.guest__brand p { margin: 0; color: var(--mute); font-size: .92rem; }
.guest h1 { font-family: var(--display); margin: 0 0 .35rem; font-size: 1.5rem; }
.auth-links { margin-top: 1rem; text-align: center; }
.auth-links a { color: var(--fire-2); font-weight: 600; }

@media (max-width: 1100px) {
  .stats, .stats--compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .fields-2 { grid-template-columns: 1fr; }
  .activity li { grid-template-columns: 1fr; gap: .2rem; }
}
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.35rem; height: 1.35rem; padding: 0 .35rem; margin-left: .35rem;
  border-radius: 999px; font-size: .72rem; font-weight: 800;
  background: linear-gradient(100deg, var(--fire-1), var(--fire-2)); color: #fff;
}
.chip-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  display: inline-flex; padding: .45rem .85rem; border-radius: 999px;
  background: var(--warm); border: 1px solid var(--line); font-weight: 600; font-size: .9rem;
  transition: background .2s, border-color .2s, transform .15s;
}
.chip:hover { border-color: var(--fire-2); transform: translateY(-1px); background: #fff; }
.panel--soft { background: linear-gradient(180deg, #fff9f4, #fff); }
.recipient-box { margin: .5rem 0 1rem; padding: .85rem; border: 1px dashed #e2d5c9; border-radius: 14px; background: #fffaf6; }
.check-list--scroll { max-height: 220px; overflow: auto; padding-right: .25rem; }
.placeholders code {
  display: inline-block; padding: .1rem .4rem; margin-right: .25rem;
  background: var(--warm); border-radius: 6px; font-size: .82rem; color: var(--ink-2);
}
.mail-preview {
  padding: 1rem 1.15rem; border-radius: 14px; background: var(--warm);
  border: 1px solid var(--line); line-height: 1.65;
}
.mail-preview--client { background: #fff; }
.mail-preview p { margin: 0 0 .75rem; }
.inbox-table tr.is-unread td, tr.is-unread td { background: #fff7f1; }
.inbox-table .dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--fire-2); margin-right: .4rem; vertical-align: middle;
}
.thread { display: flex; flex-direction: column; gap: .85rem; }
.bubble {
  max-width: min(640px, 100%); padding: .9rem 1.05rem; border-radius: 16px;
  border: 1px solid var(--line); background: #fff;
}
.bubble--client { align-self: flex-start; background: #fffaf6; }
.bubble--admin {
  align-self: flex-end;
  background: linear-gradient(180deg, #fff, #fff4ec);
  border-color: #f0d2bf;
}
.bubble header {
  display: flex; justify-content: space-between; gap: 1rem;
  margin-bottom: .45rem; font-size: .85rem; color: var(--mute);
}
.bubble__body { white-space: pre-wrap; }
.dns-table code { font-size: .85rem; word-break: break-all; }
.dns-data { color: var(--ink-2); }
.access-links { display: flex; flex-wrap: wrap; gap: .5rem; }
.pay-copy dd { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.copy-toast {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: .55rem 1rem; border-radius: 999px;
  font-size: .88rem; font-weight: 600; z-index: 99; opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.copy-toast.is-on { opacity: 1; }
.access-links { display: flex; flex-wrap: wrap; gap: .5rem; }
.dns-table code { font-size: .88rem; }
.dns-data { word-break: break-all; }
.pay-copy dd { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
.copy-toast {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: .55rem 1rem; border-radius: 999px;
  font-size: .88rem; font-weight: 600; z-index: 50; opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.copy-toast.is-on { opacity: 1; }
.stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats--compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) {
  .stats--compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(280px, 86vw); z-index: 40;
    transform: translateX(-105%); transition: transform .25s ease; height: 100%;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .nav-toggle { display: inline-grid; place-items: center; }
  .stats, .stats--compact { grid-template-columns: 1fr; }
  .dl > div { grid-template-columns: 1fr; }
  .bubble--admin { align-self: stretch; }
}
