/* 2nx Admin — Bootstrap-inspired custom theme (no purple AI defaults) */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,600;0,9..40,700;1,9..40,400&family=IBM+Plex+Sans+Arabic:wght@400;600;700&display=swap');

:root {
  --bg: #f3efe6;
  --bg-elev: #fffdf8;
  --ink: #14231c;
  --muted: #5c6b63;
  --line: #d9d2c4;
  --accent: #1f6f54;
  --accent-2: #c45c26;
  --danger: #a33b2b;
  --sidebar: #0f241c;
  --sidebar-ink: #e8f2ec;
  --radius: 12px;
  --shadow: 0 12px 40px rgba(20, 35, 28, .08);
  font-family: 'DM Sans', 'IBM Plex Sans Arabic', sans-serif;
}

[data-theme="dark"], .theme-dark {
  --bg: #0c1612;
  --bg-elev: #132019;
  --ink: #e8f2ec;
  --muted: #9bb0a4;
  --line: #24352c;
  --sidebar: #08140f;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.auth-body {
  display: grid; place-items: center; min-height: 100vh;
  background:
    radial-gradient(1000px 500px at 10% -10%, rgba(31,111,84,.25), transparent 60%),
    radial-gradient(800px 400px at 100% 0%, rgba(196,92,38,.18), transparent 50%),
    var(--bg);
}
.auth-card {
  width: min(420px, 92vw); background: var(--bg-elev); padding: 2rem;
  border: 1px solid var(--line); border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow);
}
.brand { font-weight: 700; letter-spacing: .08em; font-size: 1.4rem; color: var(--accent); }
.auth-card h1 { font-size: 1.35rem; margin: .4rem 0 1.2rem; }
.auth-card label, .form-grid label { display: block; font-size: .85rem; margin: .75rem 0 .35rem; color: var(--muted); }
.auth-card input, .form-grid input, .form-grid select, .inline-form select {
  width: 100%; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); font: inherit;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 0; border-radius: 8px; padding: .7rem 1rem; font: inherit; cursor: pointer;
  background: var(--line); color: var(--ink);
}
.btn-primary { background: var(--accent); color: #fff; width: 100%; margin-top: 1rem; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: .35rem .6rem; font-size: .8rem; }
.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.alert-danger { background: #fde8e4; color: var(--danger); }

.admin { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar); color: var(--sidebar-ink); padding: 1.25rem 1rem;
  display: flex; flex-direction: column; gap: 1rem;
}
.sidebar-brand { font-weight: 700; letter-spacing: .12em; font-size: 1.25rem; padding: .5rem; }
.sidebar nav { display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.sidebar a {
  color: inherit; opacity: .75; padding: .65rem .8rem; border-radius: 8px; text-decoration: none;
}
.sidebar a.active, .sidebar a:hover { background: rgba(255,255,255,.08); opacity: 1; text-decoration: none; }
.logout-form button {
  width: 100%; background: transparent; border: 1px solid rgba(255,255,255,.2);
  color: inherit; padding: .6rem; border-radius: 8px; cursor: pointer; font: inherit;
}
.content { padding: 1.5rem 2rem 3rem; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.topbar h1 { margin: 0; font-size: 1.6rem; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.kpi {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; box-shadow: var(--shadow);
}
.kpi-label { display: block; color: var(--muted); font-size: .85rem; margin-bottom: .35rem; }
.kpi strong { font-size: 1.8rem; }
.panel {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem; margin-bottom: 1.25rem; box-shadow: var(--shadow);
}
.panel h2 { margin: 0 0 1rem; font-size: 1.1rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem 1rem; }
.form-grid .checkbox { display: flex; align-items: center; gap: .5rem; margin-top: 1.6rem; }
.form-grid .btn { grid-column: 1 / -1; width: auto; justify-self: start; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: start; padding: .65rem .4rem; border-bottom: 1px solid var(--line); }
.table code { background: rgba(31,111,84,.1); padding: .15rem .4rem; border-radius: 4px; }

@media (max-width: 900px) {
  .admin { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
