/* === ADGREEN SOLAR ERP PRO V12 - BRAND THEME, MODERN UI & DARK MODE === */
:root {
  --primary: #0d7a36;
  --primary-dark: #16532d;
  --primary-soft: #ecfdf5;
  --accent-emerald: #10b981;
  --radius-lg: 14px;
  --radius-md: 10px;
  --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Scrollbar mảnh hiện đại */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* === MÀN HÌNH ĐĂNG NHẬP THƯƠNG HIỆU ADGREEN === */
.login-wrap {
  background:
    radial-gradient(circle at 18% 20%, rgba(16, 185, 129, 0.28), transparent 45%),
    radial-gradient(circle at 82% 80%, rgba(13, 122, 54, 0.34), transparent 48%),
    linear-gradient(135deg, #04120a 0%, #092215 52%, #0e3822 100%) !important;
}
.login-box {
  border-top: 4px solid #0d7a36 !important;
  border-radius: 20px !important;
}
.login-brand-wrap {
  text-align: center;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
}
.login-brand-logo {
  max-width: 230px;
  max-height: 62px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto 10px;
}
.login-brand-title {
  font-size: 13px;
  font-weight: 800;
  color: #16532d;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.login-brand-sub {
  font-size: 12px;
  color: #64748b;
  margin-top: 3px;
}

/* === SIDEBAR ADGREEN SANG TRỌNG === */
.sidebar {
  background: linear-gradient(180deg, #06180f 0%, #0a2417 55%, #071b11 100%) !important;
  border-right: 1px solid rgba(16, 185, 129, 0.14) !important;
  transition: width 0.22s ease;
}
.brand {
  padding: 14px 14px 12px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  display: flex;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 8px !important;
}
.sidebar-logo-card {
  background: #ffffff;
  border-radius: 11px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  min-height: 48px;
}
.sidebar-logo-img {
  max-width: 100%;
  max-height: 34px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.brand-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2px;
}
.brand-sub {
  color: #6ee7b7 !important;
  font-size: 11px !important;
  margin-top: 0 !important;
}
.nav-section {
  color: #6ee7b7 !important;
  opacity: 0.72;
}
.nav-btn {
  color: #cbd5e1 !important;
}
.nav-btn:hover {
  background: rgba(16, 185, 129, 0.14) !important;
  color: #ffffff !important;
}
.nav-btn.active {
  background: linear-gradient(90deg, #0d7a36 0%, #15803d 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 6px 16px rgba(13, 122, 54, 0.42) !important;
}

/* Thu gọn Sidebar để xem bảng rộng (Chấm công 31 ngày, Excel HCNS) */
body.sidebar-collapsed .sidebar {
  width: 74px;
}
body.sidebar-collapsed .sidebar .brand-meta,
body.sidebar-collapsed .sidebar .nav-section {
  display: none;
}
body.sidebar-collapsed .sidebar .sidebar-logo-card {
  padding: 6px 4px;
  min-height: 40px;
}
body.sidebar-collapsed .sidebar .sidebar-logo-img {
  max-height: 20px;
}
body.sidebar-collapsed .sidebar .nav-btn {
  justify-content: center;
  padding: 11px 6px;
  font-size: 0;
}
body.sidebar-collapsed .sidebar .nav-btn::first-letter {
  font-size: 18px;
}

/* === NÚT BẤM & THÀNH PHẦN CHỦ ĐẠO XANH ADGREEN === */
.btn-primary {
  background: linear-gradient(180deg, #0d7a36, #16532d) !important;
  box-shadow: 0 2px 8px rgba(13, 122, 54, 0.28) !important;
}
.btn-success {
  background: linear-gradient(180deg, #16a34a, #15803d) !important;
}
.avatar {
  background: linear-gradient(135deg, #0d7a36, #10b981) !important;
}
.prog-bar {
  background: linear-gradient(90deg, #0d7a36, #10b981) !important;
}
.subtab-btn.active {
  background: #0d7a36 !important;
  box-shadow: 0 3px 10px rgba(13, 122, 54, 0.28) !important;
}
.hr-tab-btn.active {
  color: #0d7a36 !important;
  border-bottom-color: #0d7a36 !important;
  background: #ecfdf5 !important;
}
input:focus, select:focus {
  border-color: #0d7a36 !important;
  box-shadow: 0 0 0 3px rgba(13, 122, 54, 0.14) !important;
}

/* Card & KPI mượt hơn */
.card {
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}
.kpi-card {
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

/* Sticky table header cho mọi bảng dữ liệu dài */
.table-wrap {
  max-height: 70vh;
  border-radius: 10px;
}
.table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  backdrop-filter: blur(6px);
}

/* Nút Search nhanh (Ctrl+K) trên Topbar */
.smart-search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f9;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.smart-search-trigger:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}
.kbd-hint {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
}

/* Command Palette Modal (Ctrl+K) */
.cmdk-box {
  background: var(--card);
  width: 100%;
  max-width: 640px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.42);
  border: 1px solid var(--border);
}
.cmdk-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.cmdk-input-wrap input {
  border: none !important;
  box-shadow: none !important;
  font-size: 15px;
  padding: 4px;
  background: transparent;
}
.cmdk-list {
  max-height: 390px;
  overflow-y: auto;
  padding: 8px;
}
.cmdk-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s;
}
.cmdk-item:hover {
  background: var(--primary-soft);
}

/* === SMART FACTORY INSIGHTS BANNER TRÊN DASHBOARD === */
.smart-banner {
  background: linear-gradient(135deg, #062112 0%, #0d5a2b 58%, #0d7a36 100%);
  color: #fff;
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: 0 12px 32px rgba(6, 33, 18, 0.22);
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 22px;
  align-items: center;
  border: 1px solid rgba(110, 231, 183, 0.2);
}
@media (max-width: 820px) {
  .smart-banner { grid-template-columns: 1fr; }
}
.health-ring-box {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 14px;
  border-radius: 14px;
}
.smart-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 10px;
}
.smart-action-card {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 11px;
  padding: 10px 13px;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}
.smart-action-card:hover {
  background: rgba(255, 255, 255, 0.19);
  transform: translateY(-1px);
}
.smart-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
}
.smart-pill {
  background: rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  padding: 4px 11px;
  color: #d1fae5;
}

/* Logo trong Báo cáo In A4 */
.a4-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
  margin-bottom: 6px;
  display: block;
}

/* === DARK MODE (DỊU MẮT CHO CA ĐÊM & PHÒNG ĐIỀU HÀNH) === */
body.dark-mode {
  --bg: #070d16;
  --card: #0f172a;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --border: #1e293b;
  --primary-soft: rgba(16, 185, 129, 0.16);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
body.dark-mode .topbar {
  background: rgba(15, 23, 42, 0.9);
}
body.dark-mode .page-heading,
body.dark-mode .card h3,
body.dark-mode .kpi-val,
body.dark-mode .hr-stat-num,
body.dark-mode .profile-item div {
  color: #f8fafc !important;
}
body.dark-mode input,
body.dark-mode select,
body.dark-mode .modal-box,
body.dark-mode .hr-stat-card,
body.dark-mode .subtabs,
body.dark-mode .att-matrix-wrap,
body.dark-mode .sticky-c1,
body.dark-mode .sticky-c2 {
  background: #0f172a !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}
body.dark-mode th,
body.dark-mode .att-matrix-table thead th,
body.dark-mode .profile-item,
body.dark-mode .perm-group,
body.dark-mode .user-pill,
body.dark-mode .smart-search-trigger {
  background: #1e293b !important;
  color: #cbd5e1 !important;
  border-color: #334155 !important;
}
body.dark-mode tbody tr:hover td {
  background: #1e293b;
}
body.dark-mode .btn-outline {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #334155;
}
body.dark-mode .kbd-hint {
  background: #0f172a;
  border-color: #475569;
  color: #cbd5e1;
}