*, *::before, *::after { box-sizing: border-box; }

:root {
  --primary:       #1B5E20;
  --primary-light: #4CAF50;
  --secondary:     #F9A825;
  --bg:            #F4F6F8;
  --paper:         #FFFFFF;
  --sidebar-bg:    #0F1923;
  --divider:       #E0E0E0;
  --text:          #1a1a1a;
  --text-muted:    #666;
  --text-disabled: #aaa;
}

body.dark {
  --primary:    #4CAF50;
  --bg:         #0F1923;
  --paper:      #1A2535;
  --divider:    rgba(255,255,255,0.08);
  --text:       #e0e0e0;
  --text-muted: rgba(255,255,255,0.55);
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background .2s, color .2s;
}

/* ── Login ───────────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--paper);
  border: 1px solid var(--divider);
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  padding: 40px;
}

.logo-circle {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--primary);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  padding: 4px;
}

.logo-circle img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 50%;
  display: block;
}

.login-title  { color: var(--primary); font-weight: 700; font-size: 1.25rem; }
.login-sub    { color: var(--text-muted); font-size: .875rem; }

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 .2rem rgba(27,94,32,.2);
}

.btn-primary {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  font-weight: 600;
}
.btn-primary:hover {
  background: #145214 !important;
  border-color: #145214 !important;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  min-height: 100vh;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(255,255,255,.06);
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-brand-name {
  font-weight: 700;
  color: #fff;
  letter-spacing: .5px;
  font-size: .9rem;
}

.sidebar-branch-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--primary-light);
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }

.sidebar-nav .nav-link {
  color: rgba(255,255,255,.55);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 8px;
  margin: 1px 8px;
  display: flex;
  align-items: center;
  transition: all .15s;
  text-decoration: none;
}
.sidebar-nav .nav-link:hover  { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-nav .nav-link.active { background: rgba(255,255,255,.12); color: #fff; }
.sidebar-nav .nav-link.soon   { opacity: .5; pointer-events: none; cursor: default; }

.sidebar-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: rgba(255,255,255,.3);
  padding: 10px 20px 3px;
  text-transform: uppercase;
}

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.06);
  padding: 8px;
}
.sidebar-footer .nav-link {
  color: rgba(255,255,255,.4);
  font-size: 13px;
  border-radius: 8px;
  padding: 7px 12px;
  display: flex;
  align-items: center;
  opacity: .5;
  pointer-events: none;
  text-decoration: none;
}

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  height: 56px;
  background: var(--paper);
  border-bottom: 1px solid var(--divider);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background .2s;
}

.branch-select {
  font-weight: 600;
  font-size: 13px;
  color: var(--primary);
  border-color: rgba(27,94,32,.3);
  max-width: 180px;
}
.branch-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 .2rem rgba(27,94,32,.15);
}

.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Stat cards ──────────────────────────────────────────── */
.stat-card {
  background: var(--paper);
  border: 1px solid var(--divider);
  border-radius: 10px;
  padding: 18px;
  transition: box-shadow .2s;
}
.stat-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.1); }

.stat-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.stat-label   { font-size: 11px; font-weight: 600; letter-spacing: .3px; color: var(--text-muted); text-transform: uppercase; }
.stat-value   { font-size: 22px; font-weight: 700; color: var(--text); margin: 4px 0 2px; }
.stat-sub     { font-size: 11px; color: var(--text-disabled); }

/* ── Panels ──────────────────────────────────────────────── */
.panel-card {
  background: var(--paper);
  border: 1px solid var(--divider);
  border-radius: 10px;
  padding: 18px;
  min-height: 180px;
}

.panel-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--divider);
  color: var(--text);
}

.upcoming-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100px;
  gap: 6px;
  color: var(--text-disabled);
}
.upcoming-panel i    { font-size: 28px; }
.upcoming-panel span { font-size: 12px; font-weight: 500; }

/* ── Soon badge ──────────────────────────────────────────── */
.badge-soon {
  font-size: 9px;
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.4);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: auto;
}

/* ── Dark mode overrides ─────────────────────────────────── */
body.dark .login-card,
body.dark .stat-card,
body.dark .panel-card  { background: var(--paper); border-color: var(--divider); }
body.dark .panel-title { border-color: var(--divider); }
body.dark .form-control { background: #1A2535; border-color: rgba(255,255,255,.15); color: #e0e0e0; }
body.dark .form-control:focus { border-color: var(--primary); }
body.dark .btn-outline-secondary { color: #aaa; border-color: rgba(255,255,255,.2); }
body.dark .branch-select { background: #1A2535; color: var(--primary); border-color: rgba(76,175,80,.3); }
body.dark .topbar .btn-light { background: rgba(255,255,255,.08); border-color: transparent; color: #ccc; }
body.dark #userName { color: #e0e0e0; }
body.dark #userRole  { color: rgba(255,255,255,.45); }
