@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #120305;
  --bg-soft: #240609;
  --panel: rgba(39, 7, 11, .88);
  --panel-strong: #2b090d;
  --line: rgba(255, 171, 73, .16);
  --line-strong: rgba(255, 171, 73, .35);
  --text: #fffaf6;
  --muted: rgba(255, 239, 224, .68);
  --orange: #ff9810;
  --gold: #ffd52a;
  --red: #d92731;
  --red-dark: #7f0d18;
  --ok: #42d795;
  --err: #ff7078;
  --radius: 18px;
  --shadow: 0 20px 60px rgba(0, 0, 0, .34);
  --font: "Outfit", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--text);
  font-family: var(--font);
  background:
    linear-gradient(rgba(18, 3, 5, .92), rgba(18, 3, 5, .96)),
    url("bg-main.jpg") center / cover fixed,
    #120305;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background: radial-gradient(circle at 80% 5%, rgba(255, 152, 16, .16), transparent 28%),
              radial-gradient(circle at 18% 95%, rgba(217, 39, 49, .24), transparent 34%);
}
a { color: #ffc36c; text-decoration: none; }
a:hover { color: #fff; }
code, .mono { font-family: ui-monospace, Consolas, monospace; color: #ffe1ac; }
.muted { color: var(--muted); }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 278px; height: 100vh; flex: 0 0 278px; position: sticky; top: 0; z-index: 30;
  display: flex; flex-direction: column; padding: 1.2rem .95rem 1rem;
  background: linear-gradient(180deg, rgba(43, 6, 10, .98), rgba(18, 3, 5, .99));
  border-right: 1px solid var(--line); box-shadow: 18px 0 60px rgba(0,0,0,.28);
}
.brand { display: flex; align-items: center; gap: .8rem; padding: .3rem .45rem 1.15rem; border-bottom: 1px solid var(--line); }
.brand-logo { width: 48px; height: 48px; object-fit: contain; border-radius: 13px; box-shadow: 0 10px 30px rgba(255,152,16,.16); }
.brand strong { display: block; font-size: 1.08rem; letter-spacing: .01em; }
.brand small { display: block; color: var(--muted); margin-top: .08rem; font-size: .77rem; }
.sidebar-close { display: none; margin-left: auto; width: 36px; height: 36px; padding: 0; font-size: 1.5rem; }
.nav-label { color: rgba(255,239,224,.4); font-size: .67rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; padding: 1.1rem .8rem .45rem; }
.sidebar nav { display: flex; flex: 1; flex-direction: column; gap: .24rem; overflow-y: auto; scrollbar-width: thin; }
.sidebar nav a {
  display: flex; align-items: center; gap: .72rem; min-height: 44px; padding: .65rem .75rem;
  border-radius: 13px; color: var(--muted); font-size: .91rem; font-weight: 600;
  border: 1px solid transparent; transition: .16s ease;
}
.sidebar nav a:hover { color: #fff; background: rgba(255,152,16,.08); border-color: var(--line); transform: translateX(2px); }
.sidebar nav a.active { color: #fff; background: linear-gradient(110deg, rgba(217,39,49,.72), rgba(113,10,20,.72)); border-color: rgba(255,171,73,.3); box-shadow: 0 10px 26px rgba(132,12,24,.28); }
.nav-icon { width: 20px; height: 20px; display: grid; place-items: center; flex: 0 0 20px; color: #ffbd56; }
.nav-icon svg, .menu-btn svg { width: 100%; height: 100%; fill: currentColor; }
.sidebar nav a.active .nav-icon { color: var(--gold); }
.sidebar nav a.nav-exit { margin-top: auto; color: #ff9ba0; }
.sidebar-foot { border-top: 1px solid var(--line); padding: .85rem .7rem .05rem; color: var(--muted); font-size: .75rem; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .4rem; background: var(--ok); box-shadow: 0 0 14px rgba(66,215,149,.8); }

.main { flex: 1; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; min-height: 76px; padding: .85rem 1.6rem;
  display: flex; align-items: center; gap: .85rem;
  background: linear-gradient(90deg, rgba(31,4,7,.88), rgba(18,3,5,.7));
  backdrop-filter: blur(16px); border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: 1.35rem; line-height: 1.1; }
.eyebrow { display: block; color: #ffb345; font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; margin-bottom: .18rem; }
.topbar-status { margin-left: auto; color: var(--muted); font-size: .82rem; padding: .44rem .65rem; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.03); }
.menu-btn { display: none; width: 43px; height: 43px; padding: 11px; color: var(--gold); }
.sidebar-backdrop { display: none; }
.page { padding: 1.4rem 1.6rem 3rem; max-width: 1600px; margin: 0 auto; }

.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.15rem; }
.card, .panel {
  background: linear-gradient(150deg, rgba(55,10,16,.9), rgba(26,4,8,.94));
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.card { padding: 1.15rem 1.2rem; position: relative; overflow: hidden; }
.card::after { content: ""; position: absolute; left: 0; top: 0; width: 100%; height: 3px; background: linear-gradient(90deg, var(--orange), var(--red), transparent 75%); }
.card h3 { margin: 0; color: var(--muted); font-size: .74rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.card strong { display: block; margin-top: .5rem; font-size: 1.85rem; font-weight: 800; }
.card .hint { color: var(--muted); font-size: .83rem; margin-top: .3rem; }
.panel { padding: 1.25rem 1.3rem; margin-bottom: 1.1rem; }
.panel h2 { margin: 0 0 1rem; font-size: 1.1rem; }
.panel p.lead { color: var(--muted); margin: -.35rem 0 1rem; max-width: 760px; line-height: 1.55; }
.panel-hero { overflow: hidden; position: relative; padding: 1.55rem 1.5rem; }
.panel-hero::after { content: ""; position: absolute; width: 260px; height: 260px; right: -80px; top: -130px; border: 1px solid rgba(255,213,42,.18); border-radius: 50%; box-shadow: 0 0 70px rgba(255,152,16,.1); }
.panel-hero h2 { font-size: 1.4rem; margin: .2rem 0 .45rem; }
.section-kicker { color: #ffb64e; font-size: .67rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.panel-heading h2 { margin: .2rem 0 0; }
.count-pill { color: var(--muted); white-space: nowrap; font-size: .78rem; padding: .35rem .6rem; border: 1px solid var(--line); background: rgba(255,255,255,.035); border-radius: 999px; }

.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .95rem 1.05rem; }
.grid-form .full { grid-column: 1 / -1; }
.grid-form .actions { display: flex; gap: .65rem; align-items: end; flex-wrap: wrap; }
label { display: grid; gap: .38rem; color: var(--muted); font-size: .85rem; font-weight: 600; }
.label-hint { display: inline; color: rgba(255,239,224,.38); font-size: .72rem; font-weight: 500; }
input, select, textarea, button, .btn {
  min-width: 0; font: inherit; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(12,2,4,.74); color: var(--text); padding: .72rem .82rem;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255,152,16,.14); }
input::placeholder, textarea::placeholder { color: rgba(255,239,224,.28); }
textarea { resize: vertical; min-height: 90px; }
button, .btn {
  display: inline-flex; justify-content: center; align-items: center; border: 0; cursor: pointer;
  color: #341700; font-weight: 800; background: linear-gradient(135deg, var(--gold), var(--orange));
  box-shadow: 0 9px 24px rgba(255,152,16,.2); transition: transform .12s ease, filter .12s ease;
}
button:hover, .btn:hover { filter: brightness(1.07); transform: translateY(-1px); }
button.secondary, .btn.secondary, button.ghost, .btn.ghost { color: #fff; background: transparent; border: 1px solid var(--line-strong); box-shadow: none; }
button.ok, .btn.ok { color: #042617; background: linear-gradient(135deg, #72f0b2, #38c883); box-shadow: none; }
button.danger, .btn.danger { color: #fff; background: linear-gradient(135deg, #df3743, #81101a); }
.inline-form, .inline { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.inline { margin-bottom: .9rem; }
.inline input[type="search"] { flex: 1; min-width: 190px; }
button.link { padding: 0; color: #ffc064; background: none; border: 0; box-shadow: none; font-size: .82rem; font-weight: 700; }
button.link.danger { color: #ff8c94; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: rgba(0,0,0,.16); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .82rem .78rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { color: var(--muted); background: rgba(255,152,16,.06); font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: rgba(255,152,16,.035); }
.row-actions { display: flex; gap: .7rem; align-items: center; white-space: nowrap; }
.row-actions form { margin: 0; }
.server-cell { max-width: 280px; word-break: break-all; }
.empty-state { padding: 2.3rem 1rem; text-align: center; color: var(--muted); }
.badge { display: inline-flex; padding: .22rem .62rem; border-radius: 999px; font-size: .72rem; font-weight: 800; background: rgba(255,255,255,.08); }
.badge.active { color: #83ffc5; background: rgba(66,215,149,.14); }
.badge.pending { color: #ffd783; background: rgba(255,183,64,.15); }
.badge.blocked, .badge.inactive { color: #ffadb3; background: rgba(255,112,120,.14); }

.alert { padding: .85rem 1rem; margin-bottom: 1rem; border-radius: 13px; border: 1px solid var(--line); }
.alert.ok { color: #b6ffda; background: rgba(66,215,149,.12); border-color: rgba(66,215,149,.3); }
.alert.error { color: #ffc0c4; background: rgba(255,112,120,.12); border-color: rgba(255,112,120,.32); }
.info-box { padding: .95rem 1.05rem; margin-bottom: 1rem; color: var(--muted); background: rgba(255,152,16,.07); border: 1px solid var(--line); border-radius: 14px; }
.info-box strong { color: #fff; }
.info-box code { display: none; }
label.check { display: flex; align-items: center; flex-direction: row; gap: .55rem; }
label.check input { width: auto; }

.auth-body {
  min-height: 100vh; display: grid; place-items: center; padding: 1.2rem;
  background: linear-gradient(90deg, rgba(19,2,5,.85), rgba(28,4,8,.72)), url("bg-main.jpg") center / cover fixed, #160306;
}
.auth-card {
  width: min(450px, 100%); padding: 1.75rem; border-radius: 24px;
  background: linear-gradient(155deg, rgba(50,8,14,.94), rgba(18,3,6,.97));
  border: 1px solid var(--line-strong); box-shadow: 0 28px 90px rgba(0,0,0,.55), 0 0 60px rgba(217,39,49,.14); backdrop-filter: blur(18px);
}
.auth-brand { display: flex; align-items: center; gap: .85rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.auth-brand img { width: 60px; height: 60px; border-radius: 16px; }
.auth-brand h1 { margin: 0; font-size: 1.25rem; }
.auth-brand p { margin: .1rem 0 0; color: var(--muted); font-size: .8rem; }
.auth-copy { padding: 1.35rem 0 1rem; }
.auth-copy h2 { margin: .55rem 0 .3rem; font-size: 1.5rem; }
.auth-copy p { margin: 0; color: var(--muted); line-height: 1.5; }
.auth-badge { display: inline-flex; padding: .28rem .58rem; border-radius: 999px; color: #ffd789; background: rgba(255,152,16,.1); border: 1px solid var(--line); font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.auth-card form { display: grid; gap: .9rem; }
.auth-card button { width: 100%; padding: .88rem; margin-top: .2rem; }
.auth-foot { margin-top: 1.25rem; padding-top: 1rem; text-align: center; border-top: 1px solid var(--line); color: var(--muted); font-size: .76rem; }

.brand-editor { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); gap: 1.1rem; align-items: start; }
.brand-form-panel, .preview-panel { margin-bottom: 0; }
.preview-panel { position: sticky; top: 94px; }
.preview-live { color: var(--muted); font-size: .75rem; }
.upload-field input[type="file"] { padding: .52rem; }
.upload-field input[type="file"]::file-selector-button { border: 0; border-radius: 9px; margin-right: .7rem; padding: .48rem .68rem; font: inherit; font-weight: 700; color: #351700; background: linear-gradient(135deg, var(--gold), var(--orange)); cursor: pointer; }
.app-preview { min-height: 430px; display: grid; place-items: center; padding: 2rem 1.2rem; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 18px; background: linear-gradient(rgba(32,3,7,.35),rgba(32,3,7,.7)), url("bg-main.jpg") center / cover; }
.app-preview-content { width: min(260px, 100%); display: grid; justify-items: center; gap: .72rem; }
.preview-logo-box { width: 72px; height: 72px; display: grid; place-items: center; overflow: hidden; border-radius: 17px; background: rgba(255,255,255,.96); box-shadow: 0 16px 40px rgba(0,0,0,.32); }
.preview-logo-box img { width: 100%; height: 100%; object-fit: contain; }
.app-preview-content > strong { font-size: 1.1rem; margin-bottom: .25rem; text-shadow: 0 2px 10px #000; }
.preview-field { width: 100%; padding: .68rem .8rem; border-radius: 10px; color: rgba(255,255,255,.72); background: rgba(20,5,7,.78); border: 1px solid rgba(255,255,255,.12); font-size: .78rem; }
.preview-button { width: 100%; padding: .7rem; border-radius: 10px; text-align: center; color: #351700; background: linear-gradient(135deg,var(--gold),var(--orange)); font-size: .8rem; font-weight: 800; }
.app-preview-content small { color: rgba(255,255,255,.7); font-size: .68rem; }
.preview-note { margin: .8rem .15rem 0; color: var(--muted); font-size: .72rem; line-height: 1.45; }

@media (max-width: 1100px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-105%); transition: transform .22s ease; width: min(300px, 86vw); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close, .menu-btn { display: inline-flex; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 25; padding: 0; border-radius: 0; background: rgba(0,0,0,.62); box-shadow: none; opacity: 0; pointer-events: none; display: block; transition: opacity .2s ease; }
  body.menu-open { overflow: hidden; }
  body.menu-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  .topbar { min-height: 70px; padding: .75rem 1rem; }
  .topbar-status { display: none; }
  .page { padding: 1rem 1rem 2rem; }
  .grid-form { grid-template-columns: 1fr; }
  .grid-form .full { grid-column: auto; }
  .brand-editor { grid-template-columns: 1fr; }
  .preview-panel { position: static; }
}
@media (max-width: 620px) {
  .cards { grid-template-columns: 1fr; }
  .card, .panel { border-radius: 15px; }
  .panel { padding: 1rem; }
  .topbar h1 { font-size: 1.15rem; }
  .panel-heading { align-items: flex-start; }
  .table-wrap { border: 0; overflow: visible; background: transparent; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tr { margin-bottom: .75rem; padding: .45rem .75rem; border: 1px solid var(--line); border-radius: 13px; background: rgba(0,0,0,.18); }
  td { display: grid; grid-template-columns: minmax(88px, .38fr) minmax(0, .62fr); gap: .55rem; padding: .53rem .2rem; border-bottom: 1px solid var(--line); word-break: break-word; }
  td::before { content: attr(data-label); color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
  td:last-child { border-bottom: 0; }
  td.row-actions { display: flex; flex-wrap: wrap; padding-top: .7rem; }
  td.row-actions::before { width: 100%; }
  .empty-state { display: block; }
  .empty-state::before { display: none; }
  .auth-card { padding: 1.25rem; border-radius: 20px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
