/* ==========================================================================
   HelpLife - admin / dashboard / auth
   ========================================================================== */

:root {
  --bg:        #08090a;
  --bg-soft:   #0d1012;
  --panel:     #101417;
  --card:      #12181b;
  --card-2:    #161d20;
  --border:    #232d30;
  --border-2:  #2e3a3e;
  --text:      #e9f7ec;
  --muted:     #8fa39a;
  --muted-2:   #6a7d75;
  --neon:      #39ff14;
  --neon-dim:  rgba(57, 255, 20, .12);
  --neon-glow: rgba(57, 255, 20, .35);
  --gold:      #ffd24a;
  --blue:      #4ea8ff;
  --danger:    #ff4d5e;
  --radius:    14px;
  --mono:      'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  --sans:      'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    radial-gradient(1000px 500px at 10% -10%, rgba(57,255,20,.05), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.55;
}
a { color: var(--neon); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.muted-2 { color: var(--muted-2); }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ---------- auth ---------------------------------------------------------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 30px 20px; }
.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  box-shadow: 0 40px 80px -50px #000;
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand .mark {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(145deg, var(--neon), #1fbb0a); color: #04150a;
  font-family: var(--mono); font-weight: 800; box-shadow: 0 0 18px var(--neon-glow);
}
.auth-card h1 { margin: 0 0 6px; font-size: 21px; }
.auth-card p.sub { margin: 0 0 22px; color: var(--muted); font-size: 13.5px; }
.auth-note { margin-top: 18px; font-size: 12.5px; color: var(--muted-2); }

/* ---------- top nav ------------------------------------------------------- */
.a-top {
  position: sticky; top: 0; z-index: 40;
  background: rgba(8,9,10,.86); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.a-top .inner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 64px;
}
.a-brand { display: flex; align-items: center; gap: 11px; }
.a-brand .mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(145deg, var(--neon), #1fbb0a); color: #04150a;
  font-family: var(--mono); font-weight: 800; font-size: 13px;
}
.a-brand b { font-size: 15px; }
.a-nav { display: flex; align-items: center; gap: 14px; font-size: 13.5px; }
.a-nav a { color: var(--muted); }
.a-nav a:hover { color: var(--neon); text-decoration: none; }

/* ---------- kpis ---------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 24px 0; }
.kpi {
  padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius);
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
}
.kpi .k-lbl { font-size: 11.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted-2); }
.kpi .k-val { font-size: 27px; font-weight: 700; font-family: var(--mono); margin-top: 4px; }
.kpi .k-sub { font-size: 12px; color: var(--muted); }
.kpi.k-views .k-val { color: var(--neon); }
.kpi.k-likes .k-val { color: var(--gold); }
.kpi.k-shares .k-val { color: var(--blue); }

/* ---------- live KPI indicator -------------------------------------------- */
.kpis-head { display: flex; justify-content: flex-end; margin: 18px 0 -12px; }
.hl-live { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.hl-live .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--neon); box-shadow: 0 0 0 0 rgba(57, 255, 20, .55); animation: hlPulse 1.8s ease-out infinite; }
.hl-live.stale { color: var(--muted-2); }
.hl-live.stale .dot { background: var(--gold); box-shadow: none; animation: none; }
@keyframes hlPulse {
  0%   { box-shadow: 0 0 0 0 rgba(57, 255, 20, .55); }
  70%  { box-shadow: 0 0 0 7px rgba(57, 255, 20, 0); }
  100% { box-shadow: 0 0 0 0 rgba(57, 255, 20, 0); }
}
.kpi .k-val.is-up { animation: hlKpiUp .9s ease; }
@keyframes hlKpiUp {
  0%   { transform: translateY(-3px); opacity: .55; }
  100% { transform: translateY(0); opacity: 1; }
}

/* ---------- panels -------------------------------------------------------- */
.panel {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  margin-bottom: 20px; overflow: hidden;
}
.panel-h {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 18px; border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.015);
}
.panel-h h2 { margin: 0; font-size: 15.5px; letter-spacing: -.2px; }
.panel-h .hint { font-size: 12.5px; color: var(--muted-2); }
.panel-b { padding: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ---------- forms --------------------------------------------------------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; letter-spacing: .2px; }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border-2); background: var(--panel); color: var(--text);
  font-family: var(--sans); font-size: 14px; outline: none;
}
textarea.input { resize: vertical; min-height: 92px; line-height: 1.5; }
.input:focus { border-color: var(--neon); box-shadow: 0 0 0 3px var(--neon-dim); }
.row-inline { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row-inline .field { flex: 1 1 180px; margin-bottom: 0; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 10px 18px; border-radius: 10px; border: 1px solid var(--border-2);
  background: var(--panel); color: var(--text); font-family: var(--sans);
  font-size: 13.5px; font-weight: 600; cursor: pointer; transition: .15s;
}
.btn:hover { border-color: var(--neon); }
.btn-primary { background: linear-gradient(145deg, var(--neon), #21c30b); color: #04150a; border: 0; box-shadow: 0 8px 24px -14px var(--neon-glow); }
.btn-primary:hover { transform: translateY(-1px); }
.btn-danger { color: var(--danger); border-color: rgba(255,77,94,.4); }
.btn-danger:hover { background: rgba(255,77,94,.1); border-color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; }
.check input { accent-color: var(--neon); width: 15px; height: 15px; }

/* ---------- flash --------------------------------------------------------- */
.flash { padding: 12px 16px; border-radius: 10px; margin: 18px 0 0; font-size: 13.5px; }
.flash.ok { background: var(--neon-dim); border: 1px solid var(--neon-glow); color: var(--neon); }
.flash.err { background: rgba(255,77,94,.1); border: 1px solid rgba(255,77,94,.45); color: #ff8a94; }

/* ---------- charts -------------------------------------------------------- */
.chart { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.swatch { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- tables -------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data th { color: var(--muted-2); font-size: 11.5px; text-transform: uppercase; letter-spacing: .8px; font-weight: 600; }
table.data tr:hover td { background: rgba(255,255,255,.015); }
table.data td.wrapcell { white-space: normal; min-width: 220px; }
.thumb { width: 46px; height: 46px; object-fit: contain; border-radius: 8px; background: #0c1113; border: 1px solid var(--border); padding: 4px; }
.badge { display: inline-block; font-size: 11px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--border-2); color: var(--muted); }
.badge.on { color: var(--neon); border-color: var(--neon-glow); background: var(--neon-dim); }
.badge.off { color: var(--danger); border-color: rgba(255,77,94,.4); }
.badge.rank { font-family: var(--mono); font-weight: 700; color: var(--text); }

/* ---------- item editors -------------------------------------------------- */
.item-edit { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; background: var(--panel); }
.item-edit > summary {
  list-style: none; cursor: pointer; padding: 12px 16px;
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
}
.item-edit > summary::-webkit-details-marker { display: none; }
.item-edit > summary:hover { background: rgba(255,255,255,.02); }
.item-edit[open] > summary { border-bottom: 1px solid var(--border); }
.item-edit .sum-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.item-edit .sum-title { font-weight: 600; }
.item-edit .sum-meta { font-size: 12px; color: var(--muted-2); }
.item-edit .edit-body { padding: 16px; }
.caret { color: var(--muted-2); transition: transform .2s; }
.item-edit[open] .caret { transform: rotate(90deg); }

/* ---------- modal --------------------------------------------------------- */
body.hl-modal-open { overflow: hidden; }
.hl-modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 44px 16px; overflow-y: auto;
}
.hl-modal[hidden] { display: none; }
.hl-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(4, 6, 7, .72);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.hl-modal-card {
  position: relative;
  width: 100%; max-width: 720px;
  background: var(--panel);
  border: 1px solid var(--border-2);
  border-radius: 16px;
  box-shadow: 0 30px 80px -30px #000, 0 0 30px -14px var(--neon-glow);
  animation: hl-pop .18s ease-out;
}
@keyframes hl-pop {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
.hl-modal-h {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.hl-modal-h h2 { margin: 0; font-size: 15.5px; letter-spacing: -.2px; }
.hl-modal-x {
  background: none; border: 0; color: var(--muted);
  font-size: 24px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.hl-modal-x:hover { color: var(--danger); }
.hl-modal-b { padding: 18px 20px 4px; }
.hl-modal-f {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 0 18px; margin-top: 6px; border-top: 1px solid var(--border);
}

@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi .k-val { font-size: 21px; }
  .a-nav { gap: 10px; font-size: 12.5px; }
  .hl-modal { padding: 20px 12px; }
}
