@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');
:root {
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
  --sidebar-bg: #12152e;
  --topbar-height: 65px;
  --body-bg: #f0f2f8;
  --primary: #4e73df;
  --primary-dark: #3756c0;
  --success: #1cc88a;
  --warning: #f6c23e;
  --danger: #e74a3b;
  --info: #36b9cc;
  --text-dark: #1a1d3a;
  --text-muted: #858796;
  --border: #e3e6f0;
  --card-shadow: 0 2px 15px rgba(0,0,0,0.06);
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Nunito', 'Segoe UI', sans-serif;
  background: var(--body-bg);
  color: #333;
  font-size: 14px;
}
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #12152e 0%, #1a2a6c 50%, #4e73df 100%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.auth-body::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: rgba(255,255,255,0.03);
  top: -200px; right: -150px;
}
.auth-body::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: rgba(255,255,255,0.03);
  bottom: -150px; left: -100px;
}
.auth-card {
  background: white;
  border-radius: 18px;
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 70px rgba(0,0,0,0.35);
  position: relative;
  z-index: 1;
}
.auth-brand {
  text-align: center;
  margin-bottom: 32px;
}
.brand-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, #4e73df, #6c63ff);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  box-shadow: 0 8px 24px rgba(78,115,223,0.4);
}
.brand-icon i { font-size: 26px; color: white; }
.auth-brand h4 {
  font-weight: 900;
  color: var(--text-dark);
  font-size: 22px;
  margin-bottom: 4px;
}
.auth-brand p {
  color: var(--text-muted);
  font-size: 13px;
}
.auth-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 4px;
}
.auth-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.form-label {
  font-weight: 700;
  font-size: 12px;
  color: #444;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.form-control {
  border: 2px solid #eaecf4;
  border-radius: 9px;
  padding: 11px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-dark);
  transition: border 0.2s, box-shadow 0.2s;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(78,115,223,0.14);
  outline: none;
}
.input-group .form-control { border-right: none; border-radius: 9px 0 0 9px; }
.input-group .btn-pass-toggle {
  border: 2px solid #eaecf4;
  border-left: none;
  border-radius: 0 9px 9px 0;
  background: white;
  color: var(--text-muted);
  padding: 0 14px;
  cursor: pointer;
  transition: color 0.2s;
}
.input-group .btn-pass-toggle:hover { color: var(--primary); }
.btn-auth {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 9px;
  background: linear-gradient(135deg, #4e73df, #6c63ff);
  color: white;
  font-weight: 800;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 6px 20px rgba(78,115,223,0.35);
  margin-top: 6px;
}
.btn-auth:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(78,115,223,0.45);
}
.btn-auth:active { transform: translateY(0); }
.auth-divider {
  text-align: center;
  position: relative;
  margin: 22px 0;
}
.auth-divider::before {
  content: '';
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 1px;
  background: #eaecf4;
}
.auth-divider span {
  position: relative;
  background: white;
  padding: 0 12px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}
.auth-footer {
  text-align: center;
  margin-top: 22px;
  font-size: 13px;
  color: var(--text-muted);
}
.auth-footer a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}
.auth-footer a:hover { text-decoration: underline; }
.email-prefill-notice {
  background: rgba(78,115,223,0.08);
  border: 1px solid rgba(78,115,223,0.2);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 18px;
  display: none;
}
.email-prefill-notice.show { display: flex; align-items: center; gap: 8px; }
.wrapper {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: width 0.3s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
}
.sidebar.collapsed { width: var(--sidebar-collapsed-width); }
.sidebar-header {
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  height: var(--topbar-height);
  flex-shrink: 0;
}
.sidebar-logo {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, #4e73df, #6c63ff);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(78,115,223,0.4);
}
.sidebar-logo i { color: white; font-size: 17px; }
.sidebar-brand {
  overflow: hidden;
  white-space: nowrap;
}
.sidebar-brand .brand-name {
  color: white;
  font-weight: 900;
  font-size: 15px;
  line-height: 1.2;
}
.sidebar-brand .brand-sub {
  color: rgba(255,255,255,0.38);
  font-size: 11px;
  font-weight: 600;
}
.sidebar-nav {
  flex: 1;
  padding: 18px 0 10px;
  list-style: none;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
.nav-section {
  padding: 8px 20px 6px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.25);
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-nav .nav-item { margin: 2px 10px; }
.sidebar-nav .nav-item a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 700;
  transition: all 0.18s;
  white-space: nowrap;
}
.sidebar-nav .nav-item a .nav-icon {
  font-size: 15px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.sidebar-nav .nav-item a .nav-label { overflow: hidden; }
.sidebar-nav .nav-item a:hover {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.9);
}
.sidebar-nav .nav-item.active a {
  background: linear-gradient(135deg, rgba(78,115,223,0.85), rgba(108,99,255,0.85));
  color: white;
  box-shadow: 0 4px 15px rgba(78,115,223,0.35);
}
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
}
.user-avatar-sm {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f6c23e, #e67e22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: white;
  font-size: 14px;
  flex-shrink: 0;
}
.sidebar-user-info { overflow: hidden; flex: 1; }
.sidebar-user-info .s-name {
  color: white;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-info .s-email {
  color: rgba(255,255,255,0.35);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-sidebar-logout {
  background: none;
  border: none;
  color: rgba(255,255,255,0.3);
  font-size: 15px;
  cursor: pointer;
  padding: 5px;
  border-radius: 6px;
  transition: color 0.2s;
  flex-shrink: 0;
}
.btn-sidebar-logout:hover { color: var(--danger); }
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  transition: margin-left 0.3s cubic-bezier(0.4,0,0.2,1);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.main-content.expanded { margin-left: var(--sidebar-collapsed-width); }
.topbar {
  height: var(--topbar-height);
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 8px rgba(0,0,0,0.05);
}
.topbar-left { display: flex; align-items: center; gap: 18px; }
.btn-toggle-sidebar {
  background: none;
  border: none;
  color: #666;
  font-size: 19px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background 0.2s;
  line-height: 1;
}
.btn-toggle-sidebar:hover { background: #f0f2f8; color: var(--primary); }
.topbar-title h5 {
  margin: 0;
  font-weight: 900;
  color: var(--text-dark);
  font-size: 17px;
  line-height: 1.2;
}
.topbar-title p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-date {
  background: rgba(78,115,223,0.08);
  color: var(--primary);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}
.realtime-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(28,200,138,0.1);
  color: var(--success);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}
.live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  animation: livePulse 2s infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.4); }
}
.topbar-divider {
  width: 1px; height: 28px;
  background: var(--border);
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.topbar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f6c23e, #e67e22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: white;
  font-size: 13px;
}
.topbar-user-info .t-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.2;
}
.topbar-user-info .t-role {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}
.btn-logout-top {
  background: none;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 700;
  color: #666;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-logout-top:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(231,74,59,0.05);
}
.page-content { padding: 26px 28px; flex: 1; }
.summary-cards { display: grid; grid-template-columns: repeat(4,1fr); gap: 20px; margin-bottom: 24px; }
.s-card {
  background: white;
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  border-left: 4px solid transparent;
  transition: transform 0.25s, box-shadow 0.25s;
}
.s-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}
.s-card.c-primary { border-left-color: var(--primary); }
.s-card.c-success { border-left-color: var(--success); }
.s-card.c-warning { border-left-color: var(--warning); }
.s-card.c-info    { border-left-color: var(--info);    }
.s-card-icon {
  width: 52px; height: 52px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  flex-shrink: 0;
}
.s-card-icon.primary { background: rgba(78,115,223,0.1);  color: var(--primary); }
.s-card-icon.success { background: rgba(28,200,138,0.1);  color: var(--success); }
.s-card-icon.warning { background: rgba(246,194,62,0.1);  color: var(--warning); }
.s-card-icon.info    { background: rgba(54,185,204,0.1);  color: var(--info);    }
.s-card-body { flex: 1; min-width: 0; }
.s-card-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.s-card-value {
  font-size: 23px;
  font-weight: 900;
  color: var(--text-dark);
  line-height: 1;
  margin-bottom: 7px;
}
.s-card-trend {
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}
.s-card-trend.up   { color: var(--success); }
.s-card-trend.down { color: var(--danger);  }
.s-card-trend.neutral { color: var(--text-muted); }
.chart-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
}
.chart-card-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid #f0f2f8;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.chart-card-header .chart-title h6 {
  font-weight: 900;
  color: var(--text-dark);
  font-size: 15px;
  margin: 0 0 3px;
}
.chart-card-header .chart-title p {
  color: var(--text-muted);
  font-size: 12px;
  margin: 0;
  font-weight: 600;
}
.chart-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-filter {
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid var(--border);
  background: transparent;
  color: #666;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.18s;
}
.btn-filter.active,
.btn-filter:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(78,115,223,0.07);
}
.branch-legend {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  padding: 14px 24px;
  border-bottom: 1px solid #f0f2f8;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #555;
}
.legend-color {
  width: 28px; height: 4px;
  border-radius: 2px;
}
.legend-value {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
}
.chart-body {
  padding: 20px 24px 24px;
  height: 340px;
  position: relative;
}
.page-header {
  margin-bottom: 24px;
}
.page-header h4 {
  font-weight: 900;
  color: var(--text-dark);
  font-size: 20px;
  margin-bottom: 5px;
}
.page-header p {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0;
  font-weight: 600;
}
.section-heading {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.branch-card {
  background: white;
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  border: 2px solid transparent;
  transition: all 0.2s;
}
.branch-card:hover {
  border-color: var(--primary);
  box-shadow: 0 6px 22px rgba(78,115,223,0.12);
}
.branch-dot {
  width: 44px; height: 44px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
  font-weight: 900;
  color: white;
}
.branch-info { flex: 1; min-width: 0; }
.branch-info h6 {
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 3px;
  font-size: 14px;
}
.branch-info .proj-id {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
  font-weight: 600;
}
.branch-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.status-badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.status-badge.connected   { background: rgba(28,200,138,0.12); color: var(--success); }
.status-badge.disconnected{ background: rgba(231,74,59,0.12);  color: var(--danger);  }
.status-badge.pending     { background: rgba(246,194,62,0.12); color: var(--warning); }
.branch-actions { display: flex; gap: 6px; }
.btn-icon {
  width: 33px; height: 33px;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.18s;
  color: #777;
}
.btn-icon.edit:hover  { border-color: var(--primary); color: var(--primary); background: rgba(78,115,223,0.07); }
.btn-icon.del:hover   { border-color: var(--danger);  color: var(--danger);  background: rgba(231,74,59,0.07);  }
.add-branch-btn {
  background: white;
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: var(--card-shadow);
  border: 2px dashed #d0d5e8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  width: 100%;
}
.add-branch-btn:hover {
  border-color: var(--primary);
  background: rgba(78,115,223,0.03);
}
.add-branch-btn .add-inner i {
  font-size: 26px;
  color: var(--primary);
  opacity: 0.7;
  margin-bottom: 8px;
}
.add-branch-btn .add-inner p {
  font-size: 13px;
  font-weight: 800;
  color: var(--primary);
  margin: 0;
}
.add-branch-btn .add-inner span {
  font-size: 12px;
  color: var(--text-muted);
}
.account-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}
.account-card-header {
  background: linear-gradient(135deg, #12152e, #1a2a6c);
  padding: 28px 28px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.account-avatar {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f6c23e, #e67e22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 900;
  color: white;
  flex-shrink: 0;
  border: 3px solid rgba(255,255,255,0.2);
}
.account-card-header .acc-name {
  color: white;
  font-weight: 900;
  font-size: 17px;
  margin-bottom: 3px;
}
.account-card-header .acc-email {
  color: rgba(255,255,255,0.55);
  font-size: 13px;
  font-weight: 600;
}
.account-card-body { padding: 24px 28px; }
.modal-content {
  border-radius: 16px;
  border: none;
  box-shadow: 0 25px 70px rgba(0,0,0,0.2);
}
.modal-header {
  border-bottom: 1px solid #f0f2f8;
  padding: 20px 24px;
  align-items: center;
}
.modal-title { font-weight: 900; color: var(--text-dark); font-size: 17px; }
.modal-body { padding: 24px; }
.modal-footer {
  border-top: 1px solid #f0f2f8;
  padding: 16px 24px;
  gap: 10px;
}
.config-info-box {
  background: #f5f7ff;
  border: 1px solid #dce4ff;
  border-radius: 9px;
  padding: 12px 15px;
  margin-bottom: 20px;
  display: flex;
  gap: 10px;
  font-size: 12.5px;
  color: #555;
  font-weight: 600;
  line-height: 1.5;
}
.config-info-box i { color: var(--primary); flex-shrink: 0; margin-top: 2px; }
.color-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.color-swatch {
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: border 0.15s, transform 0.15s;
}
.color-swatch:hover,
.color-swatch.selected { border-color: #333; transform: scale(1.1); }
#authLoader {
  position: fixed;
  inset: 0;
  background: var(--body-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.28s ease;
}
#authLoader .loader-inner { text-align: center; }
#authLoader .loader-logo {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, #4e73df, #6c63ff);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 8px 24px rgba(78,115,223,0.35);
}
#authLoader .loader-logo i { color: white; font-size: 22px; }
#authLoader p {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin: 10px 0 0;
}
#authLoader .spinner-border { color: var(--primary); width: 32px; height: 32px; }
.page-protected #mainContent { visibility: hidden; }
.company-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}
.company-card-header {
  background: linear-gradient(135deg, #12152e 0%, #1a2a6c 100%);
  padding: 24px 28px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.company-logo-wrap {
  width: 60px; height: 60px;
  border-radius: 14px;
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.company-logo-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.company-logo-wrap .logo-placeholder { color: rgba(255,255,255,0.4); font-size: 24px; }
.company-header-info .c-name {
  color: white;
  font-weight: 900;
  font-size: 18px;
  margin-bottom: 4px;
}
.company-header-info .c-sub {
  color: rgba(255,255,255,0.4);
  font-size: 12px;
  font-weight: 600;
}
.company-card-body { padding: 24px 28px; }
.section-divider {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin: 6px 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.company-branch-header {
  background: white;
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--card-shadow);
  border-left: 4px solid var(--primary);
}
.company-branch-logo {
  width: 56px; height: 56px;
  border-radius: 13px;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--border);
  background: #f8f9ff;
}
.company-branch-logo img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.branch-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-left: 6px;
  vertical-align: middle;
}
.branch-type-badge.main {
  background: rgba(246,194,62,0.15);
  color: #c9920a;
}
.branch-type-badge.sub {
  background: rgba(133,135,150,0.1);
  color: var(--text-muted);
}
.logo-upload-area {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}
.logo-drop-zone {
  width: 110px; height: 110px;
  border-radius: 14px;
  border: 2px solid #d0d5ee;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
  background: #f8f9ff;
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative;
}
.logo-drop-zone:hover { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(78,115,223,0.12); }
.logo-drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(78,115,223,0.06);
  box-shadow: 0 0 0 4px rgba(78,115,223,0.18);
}
.logo-drop-zone img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}
.logo-drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(78,115,223,0.82);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  opacity: 0;
  transition: opacity 0.18s;
  pointer-events: none;
}
.logo-drop-overlay i    { color: white; font-size: 22px; }
.logo-drop-overlay span { color: white; font-size: 11px; font-weight: 800; }
.logo-drop-zone.drag-over .logo-drop-overlay { opacity: 1; }
.logo-upload-controls { flex: 1; min-width: 160px; }
.btn-change-logo {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: white;
  font-size: 13px;
  font-weight: 700;
  color: #555;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.btn-change-logo:hover { border-color: var(--primary); color: var(--primary); }
.upload-progress { display: none; margin-top: 10px; }
.upload-status { margin-top: 7px; font-size: 12px; font-weight: 700; }
.upload-status.success { color: var(--success); }
.upload-status.error   { color: var(--danger);  }
.contact-row {
  background: #f8f9ff;
  border-radius: 10px;
  padding: 12px 14px;
  border: 1px solid #e5e9f7;
  margin-bottom: 10px;
}
.contact-row:last-child { margin-bottom: 0; }
.btn-remove-contact {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 2px solid #e9ecef;
  background: white;
  color: #aaa;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.18s;
  flex-shrink: 0;
}
.btn-remove-contact:hover { border-color: var(--danger); color: var(--danger); background: rgba(231,74,59,0.06); }
.btn-add-contact {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 9px 18px;
  border-radius: 8px;
  border: 2px dashed #c8cfe8;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.btn-add-contact:hover { border-color: var(--primary); background: rgba(78,115,223,0.05); }
.branch-type-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 4px 22px 4px 9px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23858796'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 7px center;
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.18s, color 0.18s;
  min-width: 76px;
}
.branch-type-select:focus {
  outline: none;
  border-color: var(--primary);
  color: var(--primary);
}
.branch-type-select option { font-weight: 700; }
body.dark-theme .branch-type-select {
  background-color: #1c2235;
  border-color: #2a2f4a;
  color: #7880a4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%237880a4'/%3E%3C/svg%3E");
}
body.dark-theme .branch-type-select option { background: #1c2235; color: #dde1f0; }
.type-option {
  flex: 1;
}
.type-option input[type="radio"] { display: none; }
.type-option label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: #666;
  transition: all 0.18s;
  text-align: center;
  width: 100%;
}
.type-option label i { font-size: 20px; opacity: 0.6; }
.type-option input[type="radio"]:checked + label {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(78,115,223,0.06);
}
.type-option input[type="radio"]:checked + label i { opacity: 1; }
.type-option input[type="radio"]#typeMain:checked + label {
  border-color: #f6c23e;
  color: #c9920a;
  background: rgba(246,194,62,0.07);
}
.type-option.disabled label {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.date-bar-sticky-wrap {
  position: sticky;
  top: var(--topbar-height);
  z-index: 99;
  background: var(--body-bg);
  padding: 10px 28px;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 3px 12px rgba(0,0,0,0.07);
  transition: box-shadow 0.2s;
}
.date-bar {
  background: white;
  border-radius: var(--radius);
  padding: 12px 20px;
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}
.date-bar-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.btn-date-preset {
  padding: 7px 15px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid var(--border);
  background: transparent;
  color: #666;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.18s;
  white-space: nowrap;
}
.btn-date-preset:hover:not(.active) {
  border-color: var(--primary);
  color: var(--primary);
}
.btn-date-preset.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 3px 10px rgba(78,115,223,0.28);
}
.date-bar-custom {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.date-input-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #f8f9ff;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  transition: border-color 0.18s;
}
.date-input-wrap:focus-within { border-color: var(--primary); }
.date-input-wrap i { color: var(--text-muted); font-size: 12px; }
.date-input-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.date-input-wrap input[type="date"] {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dark);
  outline: none;
  cursor: pointer;
  width: 118px;
}
.date-separator {
  color: var(--text-muted);
  font-weight: 800;
  font-size: 13px;
}
.btn-apply-range {
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--primary);
  border: none;
  color: white;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.btn-apply-range:hover {
  background: var(--primary-dark);
  box-shadow: 0 3px 10px rgba(78,115,223,0.3);
}
@keyframes cardFlash {
  0%   { opacity: 0.35; transform: translateY(-5px); }
  100% { opacity: 1;    transform: translateY(0);    }
}
.card-flash { animation: cardFlash 0.32s ease-out; }
body.dark-theme .date-bar-sticky-wrap {
  background: #0f1117;
  border-bottom-color: #1e2340;
  box-shadow: 0 3px 12px rgba(0,0,0,0.3);
}
body.dark-theme .date-bar { background: #161b27; }
body.dark-theme .btn-date-preset { border-color: #2a2f4a; color: #8892b0; }
body.dark-theme .btn-date-preset:hover:not(.active) { border-color: var(--primary); color: var(--primary); }
body.dark-theme .btn-date-preset.active { background: var(--primary); border-color: var(--primary); color: white; }
body.dark-theme .date-input-wrap { background: #1c2235; border-color: #2a2f4a; }
body.dark-theme .date-input-wrap input[type="date"] { color: #dde1f0; color-scheme: dark; }
@media (max-width: 1200px) {
  .summary-cards { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 768px) {
  .sidebar { width: var(--sidebar-collapsed-width); }
  .sidebar .sidebar-brand,
  .sidebar .nav-label,
  .sidebar .nav-section,
  .sidebar-user-info { display: none; }
  .main-content { margin-left: var(--sidebar-collapsed-width); }
  .page-content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .topbar-date, .realtime-pill, .topbar-divider { display: none; }
  .summary-cards { grid-template-columns: 1fr 1fr; gap: 12px; }
  .chart-body { height: 260px; }
}
@media (max-width: 480px) {
  .summary-cards { grid-template-columns: 1fr; }
  .auth-card { padding: 30px 22px; }
}
.remember-row { display: flex; align-items: center; }
.remember-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.remember-toggle input[type="checkbox"] { display: none; }
.remember-slider {
  width: 38px; height: 21px;
  background: #d0d5e8;
  border-radius: 11px;
  position: relative;
  flex-shrink: 0;
  transition: background 0.22s;
}
.remember-slider::after {
  content: '';
  position: absolute;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: white;
  top: 3px; left: 3px;
  transition: transform 0.22s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.remember-toggle input:checked ~ .remember-slider { background: var(--primary); }
.remember-toggle input:checked ~ .remember-slider::after { transform: translateX(17px); }
.remember-label {
  font-size: 13px;
  font-weight: 700;
  color: #555;
}
.remember-label small { color: var(--text-muted); font-weight: 600; }
.btn-theme-toggle {
  width: 36px; height: 36px;
  border-radius: 9px;
  border: 2px solid var(--border);
  background: transparent;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  transition: all 0.2s;
  flex-shrink: 0;
}
.btn-theme-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(78,115,223,0.08);
}
.topbar-user-wrap { position: relative; }
.topbar-user { cursor: pointer; }
.user-popup {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.14);
  border: 1px solid var(--border);
  min-width: 210px;
  z-index: 500;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.user-popup.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}
.user-popup-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: #f8f9ff;
}
.user-popup-header .popup-name  { font-weight: 800; font-size: 14px; color: var(--text-dark); }
.user-popup-header .popup-email { font-size: 11px; color: var(--text-muted); font-weight: 600; margin-top: 2px; word-break: break-all; }
.user-popup-actions { padding: 8px; }
.popup-action {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #555;
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.popup-action:hover { background: #f0f2f8; color: var(--text-dark); }
.popup-action.danger:hover { background: rgba(231,74,59,0.07); color: var(--danger); }
.popup-action i { width: 16px; text-align: center; font-size: 14px; }
body.dark-theme {
  --body-bg:     #0f1117;
  --border:      #2a2f4a;
  --card-shadow: 0 2px 15px rgba(0,0,0,0.4);
  --text-dark:   #dde1f0;
  --text-muted:  #7880a4;
  background: #0f1117;
  color: #dde1f0;
}
body.dark-theme .topbar {
  background: #141726;
  border-bottom-color: #1e2340;
}
body.dark-theme .topbar-title h5 { color: #dde1f0; }
body.dark-theme .btn-toggle-sidebar { color: #8892b0; }
body.dark-theme .btn-toggle-sidebar:hover { background: #1e2340; color: var(--primary); }
body.dark-theme .topbar-date { background: rgba(78,115,223,0.15); }
body.dark-theme .topbar-divider { background: #1e2340; }
body.dark-theme .btn-logout-top {
  border-color: #1e2340;
  color: #8892b0;
}
body.dark-theme .btn-logout-top:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(231,74,59,0.08);
}
body.dark-theme .btn-theme-toggle { border-color: #2a2f4a; color: #f6c23e; }
body.dark-theme .btn-theme-toggle:hover { border-color: #f6c23e; background: rgba(246,194,62,0.1); }
body.dark-theme .s-card,
body.dark-theme .chart-card,
body.dark-theme .branch-card,
body.dark-theme .account-card,
body.dark-theme .company-card,
body.dark-theme .company-branch-header {
  background: #161b27;
  border-color: #1e2340;
}
body.dark-theme .s-card-value,
body.dark-theme .branch-info h6 { color: #dde1f0; }
body.dark-theme .chart-card-header { border-bottom-color: #1e2340; }
body.dark-theme .branch-legend     { border-bottom-color: #1e2340; }
body.dark-theme .add-branch-btn {
  background: #161b27;
  border-color: #2a2f4a;
}
body.dark-theme .add-branch-btn:hover { border-color: var(--primary); background: rgba(78,115,223,0.05); }
body.dark-theme .form-control {
  background: #1c2235;
  border-color: #2a2f4a;
  color: #dde1f0;
}
body.dark-theme .form-control:focus {
  background: #202640;
  border-color: var(--primary);
  color: #dde1f0;
}
body.dark-theme .form-control[readonly],
body.dark-theme .form-control:disabled { background: #141726; color: #7880a4; }
body.dark-theme .form-label  { color: #a0a8c8; }
body.dark-theme .form-text   { color: #7880a4; }
body.dark-theme .invalid-feedback { color: #f88080; }
body.dark-theme .input-group .btn-pass-toggle { background: #1c2235; border-color: #2a2f4a; color: #7880a4; }
body.dark-theme .section-heading { color: #7880a4; }
body.dark-theme .section-heading::after { background: #1e2340; }
body.dark-theme .section-divider { color: #7880a4; }
body.dark-theme .section-divider::after { background: #1e2340; }
body.dark-theme .btn-filter {
  border-color: #2a2f4a;
  color: #8892b0;
  background: transparent;
}
body.dark-theme .btn-filter.active,
body.dark-theme .btn-filter:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(78,115,223,0.1);
}
body.dark-theme .btn-icon { border-color: #2a2f4a; color: #7880a4; }
body.dark-theme .btn-icon.edit:hover { background: rgba(78,115,223,0.1); }
body.dark-theme .btn-icon.del:hover  { background: rgba(231,74,59,0.1);  }
body.dark-theme .btn-change-logo { background: #1c2235; border-color: #2a2f4a; color: #a0a8c8; }
body.dark-theme .btn-change-logo:hover { border-color: var(--primary); color: var(--primary); }
body.dark-theme .config-info-box {
  background: rgba(78,115,223,0.07);
  border-color: rgba(78,115,223,0.2);
  color: #a0a8c8;
}
body.dark-theme .contact-row { background: #1c2235; border-color: #2a2f4a; }
body.dark-theme .btn-remove-contact { background: #202640; border-color: #2a2f4a; color: #7880a4; }
body.dark-theme .logo-drop-zone { background: #1c2235; border-color: #2a2f4a; }
body.dark-theme .logo-drop-zone:hover { border-color: var(--primary); }
body.dark-theme .btn-add-contact { border-color: #2a2f4a; color: #7880a4; }
body.dark-theme .btn-add-contact:hover { border-color: var(--primary); color: var(--primary); background: rgba(78,115,223,0.06); }
body.dark-theme .modal-content { background: #161b27; border-color: #2a2f4a; }
body.dark-theme .modal-header  { border-bottom-color: #1e2340; }
body.dark-theme .modal-footer  { border-top-color: #1e2340;   }
body.dark-theme .modal-title   { color: #dde1f0; }
body.dark-theme .btn-close     { filter: invert(1) brightness(0.6); }
body.dark-theme .user-popup { background: #161b27; border-color: #2a2f4a; box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
body.dark-theme .user-popup-header { background: #1c2235; border-bottom-color: #2a2f4a; }
body.dark-theme .user-popup-header .popup-name  { color: #dde1f0; }
body.dark-theme .popup-action { color: #a0a8c8; }
body.dark-theme .popup-action:hover { background: #202640; color: #dde1f0; }
body.dark-theme .popup-action.danger:hover { background: rgba(231,74,59,0.1); color: #f88080; }
body.dark-theme .auth-body {
  background: linear-gradient(135deg, #06080f 0%, #0d1420 50%, #1a2a5e 100%);
}
body.dark-theme .auth-card {
  background: #161b27;
  box-shadow: 0 25px 70px rgba(0,0,0,0.5);
}
body.dark-theme .auth-brand h4   { color: #dde1f0; }
body.dark-theme .auth-title      { color: #dde1f0; }
body.dark-theme .auth-subtitle   { color: #7880a4; }
body.dark-theme .auth-footer     { color: #7880a4; }
body.dark-theme .auth-footer a   { color: #6c9eff; }
body.dark-theme .email-prefill-notice {
  background: rgba(78,115,223,0.12);
  border-color: rgba(78,115,223,0.25);
}
body.dark-theme .remember-label       { color: #a0a8c8; }
body.dark-theme .remember-label small { color: #7880a4; }
body.dark-theme .remember-slider      { background: #2a2f4a; }
body.dark-theme .btn-auth {
  box-shadow: 0 6px 20px rgba(78,115,223,0.25);
}
body.dark-theme .sidebar { background: #0d1020; }
body.dark-theme .sidebar-header { border-bottom-color: rgba(255,255,255,0.05); }
body.dark-theme .sidebar-footer { border-top-color: rgba(255,255,255,0.05); }
body.dark-theme .realtime-pill { background: rgba(28,200,138,0.12); }
body.dark-theme .page-header h4 { color: #dde1f0; }
body.dark-theme #authLoader { background: #0f1117; }
body.dark-theme .text-muted      { color: #7880a4 !important; }
body.dark-theme .form-text       { color: #7880a4 !important; }
body.dark-theme hr               { border-color: #2a2f4a; }
body.dark-theme code             { background: rgba(78,115,223,0.12); color: #90b4ff; padding: 1px 5px; border-radius: 4px; }
