/* ==========================================================================
   NEGA – admin panel
   ========================================================================== */
:root {
  --bg: #0c0d11;
  --panel: #13151b;
  --panel-2: #191c24;
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .13);
  --text: #e9ebf0;
  --muted: #8d94a1;
  --accent: #e5140a;
  --accent-2: #ff5a36;
  --accent-soft: rgba(229, 20, 10, .13);
  --ok: #22c55e; --ok-soft: rgba(34, 197, 94, .13);
  --warn: #f59e0b; --warn-soft: rgba(245, 158, 11, .14);
  --info: #3b82f6; --info-soft: rgba(59, 130, 246, .14);
  --radius: 14px;
  --sidebar: 256px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.3; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
code { background: var(--panel-2); padding: .1em .4em; border-radius: 6px; font-size: .88em; }

/* ---------- Layout ---------- */
.sidebar {
  position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--sidebar); background: var(--panel);
  border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; z-index: 40; transition: transform .25s;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.sidebar .brand img { height: 32px; width: auto; }
.sidebar .brand span { font-size: .72rem; font-weight: 800; letter-spacing: .12em; color: var(--accent-2); background: var(--accent-soft); padding: .15em .6em; border-radius: 999px; }
.menu { flex: 1; overflow-y: auto; padding: 14px 12px 24px; }
.menu h6 { margin: 18px 12px 6px; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: #5f6673; }
.menu a {
  display: flex; align-items: center; gap: 12px; padding: .6em .9em; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: .92rem;
}
.menu a i { width: 18px; text-align: center; font-size: .95rem; }
.menu a:hover { color: #fff; background: rgba(255, 255, 255, .04); }
.menu a.active { color: #fff; background: linear-gradient(90deg, var(--accent-soft), transparent); box-shadow: inset 3px 0 0 var(--accent); }
.menu .pill { margin-inline-start: auto; background: var(--accent); color: #fff; font-size: .7rem; font-weight: 800; border-radius: 999px; padding: .05em .55em; }
.sidebar .foot { padding: 14px 16px; border-top: 1px solid var(--line); font-size: .8rem; color: var(--muted); }

.main { margin-inline-start: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 12px 28px;
  background: rgba(12, 13, 17, .85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.topbar .title { font-weight: 800; font-size: 1.05rem; }
.topbar .spacer { flex: 1; }
.icon-btn {
  position: relative; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--line-2); background: transparent; color: var(--text); font-size: 1rem;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn .dot { position: absolute; top: -5px; inset-inline-end: -5px; min-width: 19px; height: 19px; border-radius: 999px; background: var(--accent); font-size: .68rem; font-weight: 800; display: grid; place-items: center; padding: 0 5px; }
.menu-toggle { display: none; }
.content { padding: 28px; flex: 1; width: 100%; max-width: 1400px; }
.demo-strip {
  display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; padding: 10px 28px; font-size: .85rem;
  background: linear-gradient(90deg, #2a0705, #150708); border-bottom: 1px solid rgba(229, 20, 10, .3); color: #ffd6d2;
}
.demo-strip b { color: #fff; }
.demo-strip form { display: inline-flex; gap: 6px; align-items: center; }
.demo-strip select { background: rgba(0, 0, 0, .4); color: #fff; border: 1px solid rgba(255, 255, 255, .2); border-radius: 8px; padding: .25em .5em; font: inherit; }
.demo-strip a { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .55); }
  .main { margin-inline-start: 0; }
  .menu-toggle { display: grid; }
  .content { padding: 20px 16px; }
  .topbar, .demo-strip { padding-inline: 16px; }
}

/* ---------- Dropdown ---------- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); width: 340px; background: var(--panel-2); border: 1px solid var(--line-2);
  border-radius: var(--radius); box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .8); display: none; overflow: hidden; z-index: 60;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu .head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
.dropdown-menu a.item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: .88rem; }
.dropdown-menu a.item:hover { background: rgba(255, 255, 255, .03); }
.dropdown-menu a.item.unread { background: rgba(229, 20, 10, .06); }
.dropdown-menu .foot { display: block; text-align: center; padding: 10px; font-weight: 700; font-size: .85rem; color: var(--accent-2); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border: 1px solid var(--line-2); border-radius: 999px; cursor: pointer; background: none; color: var(--text); font: inherit; }
.user-chip img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.user-chip small { display: block; color: var(--muted); font-size: .72rem; line-height: 1.1; }
.user-chip b { font-size: .85rem; line-height: 1.2; display: block; text-align: start; }
.dropdown-menu.narrow { width: 220px; }
.dropdown-menu .link { display: flex; gap: 10px; align-items: center; padding: 11px 16px; font-size: .9rem; }
.dropdown-menu .link:hover { background: rgba(255, 255, 255, .04); }
@media (max-width: 640px) { .user-chip div { display: none; } .user-chip { padding: 4px; } .dropdown-menu { width: 300px; } }

/* ---------- Page header ---------- */
.page-title { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-title h1 { font-size: 1.55rem; margin: 0; }
.page-title p { margin: 4px 0 0; color: var(--muted); }
.crumbs { font-size: .8rem; color: var(--muted); margin-bottom: 4px; }
.crumbs a:hover { color: #fff; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5em; padding: .6em 1.1em; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 700; font-size: .88rem; cursor: pointer; white-space: nowrap; transition: .15s; color: var(--text); background: var(--panel-2);
}
.btn:hover { border-color: var(--line-2); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-danger { background: var(--accent-soft); color: #ff8a80; border-color: rgba(229, 20, 10, .35); }
.btn-danger:hover { background: var(--accent); color: #fff; }
.btn-ok { background: var(--ok-soft); color: #86efac; border-color: rgba(34, 197, 94, .35); }
.btn-sm { padding: .4em .75em; font-size: .8rem; border-radius: 8px; }
.btn-icon { width: 32px; height: 32px; padding: 0; justify-content: center; border-radius: 8px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.actions form { margin: 0; display: inline; }

/* ---------- Cards / grid ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 1rem; margin: 0; display: flex; gap: .5em; align-items: center; }
.card-head h3 i { color: var(--accent-2); }
.card-body { padding: 20px; }
.row { display: grid; gap: 20px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1200px) { .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .cols-2, .cols-3, .cols-main { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .cols-4 { grid-template-columns: 1fr; } }

.stat { padding: 20px; display: flex; gap: 16px; align-items: center; }
.stat .ico { width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; font-size: 1.2rem; flex: none; }
.stat b { display: block; font-size: 1.7rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat small { display: block; margin-top: 2px; font-size: .78rem; }
.t-red { background: var(--accent-soft); color: var(--accent-2); }
.t-green { background: var(--ok-soft); color: var(--ok); }
.t-amber { background: var(--warn-soft); color: var(--warn); }
.t-blue { background: var(--info-soft); color: #60a5fa; }

/* ---------- Chart ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: url(#barGrad); }
.chart .bar:hover { fill: var(--accent-2); }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid-line { stroke: var(--line); }
.hbar { display: grid; gap: 12px; }
.hbar .lbl { display: flex; justify-content: space-between; font-size: .88rem; margin-bottom: 4px; }
.hbar .track { height: 8px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: start; font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: rgba(255, 255, 255, .02); }
.table .thumb { width: 64px; height: 42px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); }
.table .avatar-sm { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.cell-main { display: flex; gap: 12px; align-items: center; min-width: 220px; }
.cell-main b { display: block; line-height: 1.35; }
.cell-main small { color: var(--muted); }
.clip { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tr.unread td { background: rgba(229, 20, 10, .04); }
tr.unread b { color: #fff; }

.badge { display: inline-flex; align-items: center; gap: .35em; padding: .2em .65em; border-radius: 999px; font-size: .74rem; font-weight: 800; white-space: nowrap; }
.b-green { background: var(--ok-soft); color: #86efac; }
.b-gray { background: rgba(255, 255, 255, .07); color: var(--muted); }
.b-red { background: var(--accent-soft); color: #ff8a80; }
.b-amber { background: var(--warn-soft); color: #fcd34d; }
.b-blue { background: var(--info-soft); color: #93c5fd; }

.toggle-form button { background: none; border: 0; padding: 0; cursor: pointer; }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.toolbar .grow { flex: 1; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a { padding: .45em .95em; border-radius: 9px; color: var(--muted); font-weight: 700; font-size: .85rem; }
.tabs a.active, .tabs a:hover { background: var(--panel-2); color: #fff; }
.tabs a .n { margin-inline-start: .35em; color: var(--accent-2); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .form-grid { grid-template-columns: 1fr; } }
.field { margin-bottom: 18px; }
.field label, .label { display: block; font-weight: 700; font-size: .85rem; margin-bottom: 6px; }
.field .hint { font-size: .78rem; color: var(--muted); margin-top: 5px; }
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select, .field textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; padding: .65em .9em;
}
.field textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
.field textarea.tall { min-height: 360px; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .9rem; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }
.field-validation-error, .text-danger { color: #ff8a80; font-size: .8rem; }
.input-validation-error { border-color: var(--accent) !important; }

.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 700; font-size: .9rem; margin-bottom: 14px; }
.switch input { appearance: none; -webkit-appearance: none; width: 42px; height: 24px; border-radius: 99px; background: #2a2e38; position: relative; cursor: pointer; transition: .2s; flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { inset-inline-start: 21px; }

.image-field .preview { aspect-ratio: 16/10; border-radius: 12px; border: 1px dashed var(--line-2); overflow: hidden; display: grid; place-items: center; background: var(--bg); margin-bottom: 10px; color: var(--muted); }
.image-field .preview img { width: 100%; height: 100%; object-fit: cover; }
.image-field.round .preview { aspect-ratio: 1; width: 140px; border-radius: 50%; }
.image-field input[type=file] { width: 100%; font-size: .85rem; color: var(--muted); }
.image-field input[type=file]::file-selector-button { font: inherit; font-weight: 700; margin-inline-end: 10px; padding: .45em .9em; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); cursor: pointer; }

.form-actions { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 6px; }
.sticky-side { position: sticky; top: 84px; display: grid; gap: 20px; }

/* ---------- Alerts / toasts ---------- */
.alert { display: flex; gap: .7em; align-items: flex-start; padding: 12px 16px; border-radius: 12px; margin-bottom: 20px; font-weight: 600; font-size: .9rem; }
.alert i { margin-top: .25em; }
.alert-ok { background: var(--ok-soft); border: 1px solid rgba(34, 197, 94, .35); color: #bbf7d0; }
.alert-err { background: var(--accent-soft); border: 1px solid rgba(229, 20, 10, .4); color: #fecaca; }
.alert-info { background: var(--info-soft); border: 1px solid rgba(59, 130, 246, .35); color: #bfdbfe; }
.alert ul { margin: 0; padding-inline-start: 1.1em; }

/* ---------- Lists / feed ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed .ic { width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center; font-size: .9rem; }
.feed b { font-size: .9rem; }
.feed p { margin: 2px 0 0; color: var(--muted); font-size: .85rem; }
.feed small { color: var(--muted); font-size: .76rem; }
.avatar { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 800; font-size: .8rem; background: var(--panel-2); border: 1px solid var(--line-2); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.thread { display: grid; gap: 14px; }
.msg { padding: 16px 18px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.msg.team { background: linear-gradient(135deg, rgba(229, 20, 10, .10), var(--panel-2)); border-color: rgba(229, 20, 10, .3); margin-inline-start: 36px; }
.msg.reply { margin-inline-start: 36px; }
.msg .top { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.msg .top small { color: var(--muted); }
.msg p { margin: 0; white-space: pre-line; }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.item-card { overflow: hidden; display: flex; flex-direction: column; }
.item-card .cover { aspect-ratio: 16/10; object-fit: cover; width: 100%; border-bottom: 1px solid var(--line); }
.item-card .body { padding: 16px; flex: 1; }
.item-card .body b { display: block; }
.item-card .foot { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); gap: 8px; }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty i { font-size: 2rem; color: var(--accent-2); margin-bottom: 10px; }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 10px 16px; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

.profile-head { display: flex; gap: 20px; align-items: center; padding: 24px; }
.profile-head img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 3px solid var(--accent); }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 20% 10%, rgba(229, 20, 10, .25), transparent 45%), var(--bg); }
.auth .card { width: min(440px, 100%); padding: 34px; }
.auth .brand { display: flex; justify-content: center; margin-bottom: 22px; }
.auth .brand img { height: 44px; width: auto; }
.demo-accounts { display: grid; gap: 8px; margin-top: 16px; }
.demo-accounts button { text-align: start; width: 100%; justify-content: flex-start; }
.form-grid > *, .row > * { min-width: 0; }
