/* ============ AD Watch & Chasmaghar — admin panel styles ============ */
:root {
  --a-bg: #f1f5f9;
  --a-card: #ffffff;
  --a-ink: #0f172a;
  --a-muted: #64748b;
  --a-line: #e2e8f0;
  --a-brand: #1e3a8a;
  --a-accent: #f59e0b;
  --a-ok: #16a34a;
  --a-danger: #dc2626;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--a-bg); color: var(--a-ink); }
a { text-decoration: none; color: inherit; }

.admin-layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

/* Sidebar */
.sidebar { background: #0f172a; color: #94a3b8; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { display: flex; gap: 10px; align-items: center; color: #fff; font-weight: 800; padding: 8px 10px 20px; }
.sidebar .brand img { width: 34px; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 10px;
  font-size: .93rem; font-weight: 600; margin-bottom: 3px; transition: .15s; }
.sidebar nav a:hover { background: #1e293b; color: #fff; }
.sidebar nav a.active { background: var(--a-brand); color: #fff; }
.sidebar .foot { margin-top: 22px; border-top: 1px solid #1e293b; padding-top: 14px; font-size: .85rem; }
.sidebar .foot button { width: 100%; margin-top: 10px; padding: 9px; border: none; border-radius: 8px;
  background: #1e293b; color: #fca5a5; cursor: pointer; font-weight: 700; }
.sidebar .foot button:hover { background: #7f1d1d; color: #fff; }

/* Main */
.main { padding: 24px 28px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; flex-wrap: wrap; gap: 10px; }
.topbar h1 { font-size: 1.45rem; }
.role-pill { background: #fef3c7; color: #92400e; font-size: .78rem; font-weight: 800; padding: 5px 13px; border-radius: 999px; }

/* Stat cards */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat { background: var(--a-card); border-radius: 14px; padding: 18px; box-shadow: 0 3px 14px rgba(15,23,42,.06);
  border-left: 4px solid var(--a-brand); }
.stat:nth-child(2) { border-color: var(--a-ok); }
.stat:nth-child(3) { border-color: var(--a-accent); }
.stat:nth-child(4) { border-color: #8b5cf6; }
.stat .num { font-size: 1.55rem; font-weight: 800; }
.stat .lbl { color: var(--a-muted); font-size: .82rem; margin-top: 2px; }

/* Cards / panels */
.panel { background: var(--a-card); border-radius: 14px; box-shadow: 0 3px 14px rgba(15,23,42,.06); padding: 20px; margin-bottom: 22px; }
.panel h2 { font-size: 1.05rem; margin-bottom: 14px; }
.panel-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 22px; }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--a-card); border-radius: 14px; box-shadow: 0 3px 14px rgba(15,23,42,.06); }
table.data { width: 100%; border-collapse: collapse; min-width: 700px; }
table.data th, table.data td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--a-line); font-size: .89rem; }
table.data th { background: #f8fafc; font-size: .72rem; text-transform: uppercase; letter-spacing: .6px; color: var(--a-muted); }
table.data tr:hover td { background: #fafcff; }
.t-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 9px; border: none;
  cursor: pointer; font: inherit; font-size: .88rem; font-weight: 700; transition: .15s; }
.btn-primary { background: var(--a-brand); color: #fff; }
.btn-primary:hover { background: #16307a; }
.btn-sm { padding: 6px 11px; font-size: .8rem; border-radius: 7px; }
.btn-ghost { background: #eef2ff; color: var(--a-brand); }
.btn-danger { background: #fee2e2; color: #991b1b; }
.btn-danger:hover { background: var(--a-danger); color: #fff; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; }
.search-input { padding: 10px 13px; border: 1.5px solid var(--a-line); border-radius: 9px; font: inherit; min-width: 230px; }

select.status-select, select.inline-edit { padding: 6px 9px; border-radius: 7px; border: 1.5px solid var(--a-line);
  font: inherit; font-size: .82rem; font-weight: 600; background: #fff; }

/* Chips */
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 800; }
.chip.ok { background: #dcfce7; color: #166534; }
.chip.warn { background: #fef3c7; color: #92400e; }
.chip.bad { background: #fee2e2; color: #991b1b; }
.chip.info { background: #dbeafe; color: #1e40af; }
.chip.mut { background: #e2e8f0; color: #334155; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 100;
  display: grid; place-items: center; padding: 18px; }
.modal { background: #fff; border-radius: 16px; width: min(620px, 100%); max-height: 92vh; overflow-y: auto; padding: 24px; }
.modal h3 { margin-bottom: 18px; }
.modal .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.field label { display: block; font-size: .8rem; font-weight: 700; margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; padding: 9px 11px; border: 1.5px solid var(--a-line);
  border-radius: 8px; font: inherit; font-size: .9rem; }
.field.full { grid-column: 1/-1; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--a-brand); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* Chart */
.bars { display: flex; align-items: flex-end; gap: 14px; height: 170px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar { width: 100%; max-width: 54px; background: linear-gradient(180deg, #3b82f6, #1e3a8a); border-radius: 7px 7px 0 0; min-height: 3px; }
.bar-lbl { font-size: .72rem; color: var(--a-muted); }
.bar-val { font-size: .68rem; font-weight: 700; color: var(--a-brand); }

.alert { padding: 12px 15px; border-radius: 10px; margin-bottom: 14px; font-size: .9rem; }
.alert-warn { background: #fef3c7; color: #92400e; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-ok { background: #dcfce7; color: #166534; }
.alert-info { background: #dbeafe; color: #1e40af; }

.empty { text-align: center; color: var(--a-muted); padding: 34px !important; }

.toast { position: fixed; bottom: 24px; right: 24px; background: var(--a-ink); color: #fff; padding: 12px 20px;
  border-radius: 10px; transform: translateY(140%); transition: .3s; z-index: 300; font-size: .9rem; }
.toast.show { transform: none; }
.toast.success { background: var(--a-ok); }
.toast.error { background: var(--a-danger); }

/* Login page */
.login-page { min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(130deg, #0f172a, #1e3a8a 70%, #2563eb); padding: 18px; }
.login-card { background: #fff; border-radius: 20px; padding: 38px; width: min(400px, 100%);
  box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.login-card img { width: 56px; margin: 0 auto 12px; }
.login-card h1 { font-size: 1.25rem; text-align: center; margin-bottom: 4px; }
.login-card .sub { text-align: center; color: var(--a-muted); font-size: .86rem; margin-bottom: 24px; }
.login-card .field { margin-bottom: 15px; }
.login-card .btn { width: 100%; padding: 12px; font-size: .98rem; }
.hint { background: #eff6ff; color: #1e40af; border-radius: 9px; padding: 10px 13px; font-size: .8rem; margin-top: 16px; }

@media (max-width: 1024px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .panel-grid { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .admin-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .sidebar nav { display: flex; overflow-x: auto; gap: 4px; }
  .sidebar nav a { white-space: nowrap; }
  .sidebar .foot { border: none; padding-top: 8px; }
  .main { padding: 16px; }
}
