/* Manaya Chat Admin — dark-first, teal identity, zero dependencies. */
:root {
  --bg: #0f1518;
  --panel: #171f24;
  --panel-2: #1e282e;
  --border: #2a363d;
  --text: #e8edef;
  --muted: #93a3ab;
  --primary: #14b8a5;
  --primary-dim: #0d8577;
  --danger: #ef5350;
  --warn: #ffb300;
  --ok: #4caf50;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.5 system-ui, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0; }

/* ── Login ─────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, #123a35 0%, var(--bg) 60%);
}
.login-card {
  width: 360px; padding: 32px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex; flex-direction: column; gap: 14px;
  text-align: center;
}
.logo {
  width: 64px; height: 64px; margin: 0 auto;
  background: var(--primary);
  color: #06231f; font-size: 30px; font-weight: 800;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.logo.small { width: 28px; height: 28px; font-size: 15px; display: inline-flex; }
.login-card label { text-align: left; display: flex; flex-direction: column; gap: 6px; font-weight: 600; }

/* ── Inputs & buttons ──────────────────────────────── */
input, select, textarea {
  width: 100%; padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-dim); border-color: transparent; }
button {
  padding: 10px 16px;
  background: var(--primary);
  color: #06231f;
  border: none; border-radius: var(--radius);
  font-weight: 700; font-size: 14px;
  cursor: pointer;
}
button:hover { filter: brightness(1.1); }
button:disabled { opacity: 0.5; cursor: default; }
button.ghost {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border);
}
button.danger { background: var(--danger); color: #fff; }
button.small { padding: 5px 10px; font-size: 12.5px; }
.error {
  background: #3a1f1f; color: #ff9f9c;
  border: 1px solid #5c2b2b;
  padding: 10px; border-radius: var(--radius);
  font-size: 13px;
}

/* ── App shell ─────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px; font-weight: 800; font-size: 15px;
  border-bottom: 1px solid var(--border);
}
.sidebar nav { flex: 1; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
  padding: 9px 12px; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-weight: 600;
}
.sidebar nav a:hover { background: var(--panel-2); color: var(--text); }
.sidebar nav a.active { background: var(--primary-dim); color: #fff; }
.sidebar-footer {
  padding: 14px 16px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px; font-size: 13px;
}
main {
  flex: 1; padding: 28px 32px;
  max-width: 1200px;
  width: 100%;
}
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Cards / stats ─────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.stat .value { font-size: 26px; font-weight: 800; }
.stat .label { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.4px; }

/* ── Tables ────────────────────────────────────────── */
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 10px 14px; text-align: left; white-space: nowrap; }
th {
  color: var(--muted); font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.4px; border-bottom: 1px solid var(--border);
}
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--panel-2); }
td.wrap { white-space: normal; max-width: 380px; }

.badge {
  display: inline-block; padding: 2px 9px;
  border-radius: 999px; font-size: 11.5px; font-weight: 700;
}
.badge.ok { background: #143a24; color: #7bd88f; }
.badge.off { background: #333c42; color: var(--muted); }
.badge.warn { background: #3d3517; color: #ffd37a; }
.badge.danger { background: #3a1f1f; color: #ff9f9c; }

.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary-dim); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; margin-right: 8px;
  vertical-align: middle; object-fit: cover;
}

/* ── Modal & toast ─────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 20px;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  width: 440px; max-width: 100%;
  max-height: 90vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
}
.modal h2 { margin-bottom: 4px; }
.modal label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 13px; }
.modal .row { display: flex; gap: 10px; }
.modal .row > * { flex: 1; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 20px; border-radius: 999px;
  font-weight: 600; z-index: 60;
  box-shadow: 0 6px 24px rgba(0,0,0,0.4);
}

/* ── Sticker grid ──────────────────────────────────── */
.packs { display: flex; flex-direction: column; gap: 18px; }
.pack {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.pack-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.sticker-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.sticker-cell {
  width: 84px; height: 84px; position: relative;
  background: var(--panel-2); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.sticker-cell img { max-width: 72px; max-height: 72px; }
.sticker-cell .del {
  position: absolute; top: -6px; right: -6px;
  width: 20px; height: 20px; padding: 0;
  border-radius: 50%; font-size: 11px; line-height: 1;
  background: var(--danger); color: #fff;
}

@media (max-width: 760px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  main { padding: 18px; }
}
