:root {
  --bg: #f3f5f7;
  --sidebar: #111827;
  --sidebar-2: #0b1220;
  --green: #16a34a;
  --green-dark: #12803a;
  --dark: #1a1a1a;
  --text: #1f2937;
  --muted: #6b7280;
  --card: #ffffff;
  --border: #e5e7eb;
  --danger: #dc2626;
  --warn: #d97706;
  --info: #2563eb;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(17, 24, 39, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
h1, h2, h3 { font-family: 'Oswald', sans-serif; letter-spacing: .3px; margin: 0; }
a { color: var(--green-dark); text-decoration: none; }
a:hover { color: var(--green); }

.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px;
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 22px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: rgba(22,163,74,.18); color: var(--green);
  display: grid; place-items: center; font-size: 1.1rem;
}
.brand strong { display: block; font-size: .95rem; }
.brand span { color: #9ca3af; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }

.nav { padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; overflow: auto; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  color: #d1d5db; padding: 11px 12px; border-radius: 10px; font-size: .92rem; font-weight: 500;
}
.nav a i { width: 18px; text-align: center; color: #9ca3af; }
.nav-count {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #d97706;
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav a:hover, .nav a.active {
  background: rgba(22,163,74,.15); color: #fff;
}
.nav a:hover i, .nav a.active i { color: var(--green); }

.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.logout-link {
  display: flex; align-items: center; gap: 10px; color: #fca5a5 !important;
  padding: 10px 12px; border-radius: 10px; font-weight: 600;
}
.logout-link:hover { background: rgba(220,38,38,.15); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 16px 22px;
  display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 1.45rem; }
.subtitle { margin: 2px 0 0; color: var(--muted); font-size: .85rem; }
.menu-toggle {
  display: none; border: 0; background: #f3f4f6; width: 40px; height: 40px;
  border-radius: 10px; cursor: pointer;
}
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--dark); color: var(--green);
  display: grid; place-items: center; font-weight: 700; font-size: .85rem;
}
.user-meta strong { display: block; font-size: .88rem; }
.user-meta span { color: var(--muted); font-size: .75rem; }

.content { padding: 22px; flex: 1; }
.app-footer {
  padding: 14px 22px; color: var(--muted); font-size: .8rem;
  border-top: 1px solid var(--border); background: #fff;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; gap: 12px; align-items: center; box-shadow: var(--shadow);
}
.stat-card span { display: block; color: var(--muted); font-size: .78rem; }
.stat-card strong { font-size: 1.5rem; font-family: Oswald, sans-serif; }
.stat-icon {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff;
}
.stat-icon.green { background: var(--green); }
.stat-icon.dark { background: var(--dark); }
.stat-icon.warn { background: var(--warn); }
.stat-icon.info { background: var(--info); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.card-head h2 { font-size: 1.1rem; }
.card-body { padding: 18px; }
.link { font-size: .85rem; font-weight: 600; }

.toolbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.search-form { display: flex; gap: 8px; }
.search-form input, .form-control, select, textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 12px; font: inherit; background: #fff; color: var(--text);
}
.search-form input { min-width: 220px; }
textarea { min-height: 140px; resize: vertical; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 6px; font-size: .85rem; font-weight: 600; color: #374151; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 10px; padding: 11px 16px; font-weight: 600; cursor: pointer;
  font-family: inherit; text-decoration: none; font-size: .9rem;
}
.btn-primary { background: var(--green); color: #fff !important; }
.btn-primary:hover { background: var(--green-dark); color: #fff !important; }
.btn-dark { background: var(--dark); color: #fff !important; }
.btn-dark:hover { filter: brightness(1.1); color: #fff !important; }
.btn-outline { background: #fff; border: 1px solid var(--border); color: var(--text) !important; }
.btn-danger { background: var(--danger); color: #fff !important; }
.btn-sm { padding: 7px 10px; font-size: .8rem; }
.btn-block { width: 100%; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: .9rem; vertical-align: middle; }
th { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; background: #fafafa; }
td.empty { text-align: center; color: var(--muted); padding: 28px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

.badge {
  display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
}
.badge-success { background: rgba(22,163,74,.12); color: #15803d; }
.badge-warning { background: rgba(217,119,6,.12); color: #b45309; }
.badge-danger { background: rgba(220,38,38,.12); color: #b91c1c; }
.badge-info { background: rgba(37,99,235,.12); color: #1d4ed8; }
.badge-muted { background: #f3f4f6; color: #6b7280; }

.alert {
  padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; font-size: .9rem; font-weight: 500;
}
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

.thumb {
  width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: #f3f4f6;
}
.msg-box {
  background: #f9fafb; border: 1px solid var(--border); border-radius: 12px; padding: 16px; white-space: pre-wrap;
}

/* Login */
.login-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 20%, rgba(22,163,74,.22), transparent 35%),
    linear-gradient(135deg, #0b1220 0%, #111827 45%, #0f172a 100%);
  display: grid; place-items: center; padding: 24px;
}
.login-shell {
  width: min(980px, 100%);
  display: grid; grid-template-columns: 1.05fr .95fr;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 22px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.45);
}
.login-panel { background: #fff; padding: 40px 36px; }
.login-brand { margin-bottom: 24px; }
.login-logo {
  width: 56px; height: 56px; border-radius: 16px; background: var(--dark); color: var(--green);
  display: grid; place-items: center; font-size: 1.4rem; margin-bottom: 14px;
}
.login-logo-img {
  width: 72px; height: 72px; padding: 6px; overflow: hidden; background: #fff;
  border: 1px solid var(--border);
}
.login-logo-img img {
  width: 100%; height: 100%; object-fit: contain; display: block;
}
.login-brand h1 { font-size: 1.8rem; color: var(--dark); }
.login-brand p { margin: 4px 0 0; color: var(--muted); }
.login-form label { display: block; font-size: .82rem; font-weight: 600; margin: 0 0 6px; color: #374151; }
.input-icon { position: relative; margin-bottom: 14px; }
.input-icon i {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #9ca3af;
}
.input-icon input {
  width: 100%; padding: 13px 14px 13px 42px; border-radius: 12px;
  border: 1px solid var(--border); font: inherit;
}
.input-icon input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(22,163,74,.15); }
.login-hint { text-align: center; color: var(--muted); font-size: .78rem; margin-top: 18px; }
.login-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 14px;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  color: #374151;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.login-back:hover {
  background: #f9fafb;
  border-color: var(--gold, #16A34A);
  color: var(--gold, #16A34A);
}
.login-aside {
  background-color: #111827;
  background-size: cover;
  background-position: center top;
  color: #fff; padding: 42px 36px; display: flex; align-items: flex-end;
  min-height: 100%;
}
.pill {
  display: inline-flex; gap: 8px; align-items: center;
  background: rgba(22,163,74,.2); border: 1px solid rgba(22,163,74,.45);
  color: #86efac; padding: 6px 12px; border-radius: 999px; font-size: .78rem; font-weight: 600;
  margin-bottom: 14px;
}
.login-aside h2 { font-size: 2rem; line-height: 1.15; margin-bottom: 10px; }
.login-aside p { color: #d1d5db; margin: 0; max-width: 34ch; }

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: -280px; transition: left .25s ease; }
  .sidebar.open { left: 0; }
  .menu-toggle { display: inline-grid; place-items: center; }
  .grid-2, .form-grid, .login-shell { grid-template-columns: 1fr; }
  .login-aside { min-height: 220px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .stats-grid { grid-template-columns: 1fr; }
  .content { padding: 14px; }
}
