:root {
  color-scheme: light;
  --bg: #f7f4f6;
  --surface: #ffffff;
  --surface-soft: #f1e9ef;
  --text: #211b20;
  --muted: #6f626c;
  --brand: #5d3a52;
  --brand-strong: #43263a;
  --border: #ded3da;
  --danger: #9a2f3f;
  --success: #2f6b4f;
  --shadow: 0 16px 42px rgba(61, 35, 53, .12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.app-shell { width: min(1180px, calc(100% - 28px)); margin: 0 auto; padding: 28px 0 56px; }
.loading-card, .auth-card { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); border-radius: 22px; padding: 28px; max-width: 520px; margin: 8vh auto 0; }
.spinner { display: block; width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.brand-mark { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; background: var(--brand); color: white; font-weight: 800; letter-spacing: .08em; }
h1, h2, h3 { margin-top: 0; }
p { line-height: 1.55; }
.muted { color: var(--muted); }
.form-grid { display: grid; gap: 15px; }
label { display: grid; gap: 7px; font-weight: 650; }
input, select { width: 100%; border: 1px solid var(--border); border-radius: 12px; background: white; color: var(--text); padding: 12px 13px; min-height: 46px; }
input:focus, select:focus, button:focus-visible { outline: 3px solid rgba(93, 58, 82, .22); outline-offset: 2px; }
.btn { border: 0; border-radius: 12px; padding: 12px 17px; min-height: 46px; font-weight: 750; background: var(--brand); color: white; }
.btn:hover { background: var(--brand-strong); }
.btn.secondary { background: var(--surface-soft); color: var(--brand-strong); border: 1px solid var(--border); }
.btn.danger { background: var(--danger); }
.btn.small { min-height: 38px; padding: 8px 12px; font-size: .92rem; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.error-box { background: #fff0f2; color: #7d2635; border: 1px solid #efc0c8; border-radius: 12px; padding: 12px 14px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0 22px; }
.brand-row { display: flex; align-items: center; gap: 13px; }
.brand-row h1 { margin: 0; font-size: 1.35rem; }
.brand-row p { margin: 2px 0 0; }
.user-chip { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 9px 12px; }
.layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 22px; }
.sidebar { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 12px; height: fit-content; position: sticky; top: 14px; }
.nav-btn { display: flex; width: 100%; border: 0; background: transparent; color: var(--text); padding: 12px; border-radius: 11px; text-align: left; font-weight: 700; }
.nav-btn:hover, .nav-btn.active { background: var(--surface-soft); color: var(--brand-strong); }
.content { min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 22px; box-shadow: 0 8px 26px rgba(61, 35, 53, .06); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.feature-card { border: 1px solid var(--border); border-radius: 15px; padding: 18px; background: var(--surface); }
.feature-card.locked { opacity: .68; background: #faf8f9; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; background: var(--surface-soft); color: var(--brand-strong); padding: 5px 9px; font-size: .78rem; font-weight: 800; }
.badge.success { color: var(--success); background: #e8f4ed; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; }
table { border-collapse: collapse; width: 100%; min-width: 720px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { background: #faf7f9; font-size: .84rem; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.offline-banner { position: sticky; top: 0; z-index: 20; background: #7c4a00; color: white; padding: 10px 16px; text-align: center; font-weight: 700; }
.toast { position: fixed; right: 18px; bottom: 18px; max-width: min(420px, calc(100% - 36px)); background: var(--text); color: white; padding: 13px 16px; border-radius: 12px; box-shadow: var(--shadow); z-index: 50; }
@media (max-width: 780px) {
  .app-shell { width: min(100% - 18px, 720px); padding-top: 12px; }
  .topbar { align-items: flex-start; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; display: flex; overflow-x: auto; gap: 6px; }
  .nav-btn { width: auto; white-space: nowrap; }
  .split { grid-template-columns: 1fr; }
  .user-chip { display: none; }
}
