/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #f0f2f5; color: #202124; }

/* ── LOGIN PAGE ── */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: linear-gradient(135deg, #e8f0fe 0%, #f0f2f5 100%);
}
.login-card {
  background: white; border-radius: 16px; padding: 48px 40px;
  text-align: center; width: 100%; max-width: 400px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}
.login-logo { margin-bottom: 20px; }
.login-card h1 { font-size: 24px; font-weight: 600; color: #202124; margin-bottom: 8px; }
.login-subtitle { color: #5f6368; font-size: 14px; margin-bottom: 32px; }
.error-banner {
  background: #fce8e6; color: #c5221f; border-radius: 8px;
  padding: 12px 16px; font-size: 13px; margin-bottom: 20px;
}
.google-btn {
  display: inline-flex; align-items: center; gap: 12px;
  background: white; border: 1px solid #dadce0; border-radius: 8px;
  padding: 12px 24px; font-size: 15px; font-weight: 500; color: #202124;
  text-decoration: none; transition: background 0.2s, box-shadow 0.2s;
  width: 100%; justify-content: center;
}
.google-btn:hover { background: #f8f9fa; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.login-note { margin-top: 24px; font-size: 12px; color: #9aa0a6; }

/* ── APP LAYOUT ── */
.app-page { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
  width: 240px; min-height: 100vh; background: white;
  border-right: 1px solid #e8eaed; display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  transition: width 0.2s ease; overflow: hidden;
}
.sidebar-header {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 16px; font-size: 16px; font-weight: 600; color: #202124;
  border-bottom: 1px solid #f0f2f5; white-space: nowrap;
}
.sidebar-toggle {
  margin-left: auto; background: none; border: none; cursor: pointer;
  color: #9aa0a6; padding: 4px; border-radius: 6px; display: flex;
  align-items: center; flex-shrink: 0; transition: color 0.15s, background 0.15s;
}
.sidebar-toggle:hover { color: #202124; background: #f0f2f5; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; overflow-x: hidden; }
.nav-section-label {
  font-size: 11px; font-weight: 600; color: #9aa0a6; text-transform: uppercase;
  letter-spacing: 0.8px; padding: 16px 20px 6px; white-space: nowrap;
  transition: opacity 0.15s;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; font-size: 14px; color: #5f6368;
  text-decoration: none; border-radius: 0; transition: background 0.15s, padding 0.2s, justify-content 0.2s;
  position: relative; white-space: nowrap;
}
.nav-item:hover { background: #f0f2f5; color: #202124; }
.nav-item.active { background: #e8f0fe; color: #1a73e8; font-weight: 500; }
.nav-item.disabled { opacity: 0.5; pointer-events: none; }
.nav-label { transition: opacity 0.15s; }
.badge {
  margin-left: auto; font-size: 10px; background: #f0f2f5;
  color: #9aa0a6; border-radius: 4px; padding: 2px 6px;
}
.sidebar-footer {
  display: flex; align-items: center; gap: 10px; padding: 16px 20px;
  border-top: 1px solid #f0f2f5; white-space: nowrap;
}
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.user-info { flex: 1; min-width: 0; transition: opacity 0.15s; }
.user-name { font-size: 13px; font-weight: 500; color: #202124; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 11px; color: #9aa0a6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-btn {
  color: #9aa0a6; text-decoration: none; display: flex;
  align-items: center; padding: 4px; border-radius: 6px; transition: color 0.15s, background 0.15s; flex-shrink: 0;
}
.logout-btn:hover { color: #c5221f; background: #fce8e6; }

/* ── SIDEBAR COLLAPSED ── */
.sidebar.collapsed { width: 60px; }
.sidebar.collapsed .sidebar-header { padding: 20px 0 16px; justify-content: center; }
.sidebar.collapsed .sidebar-header > svg:first-child { display: none; }
.sidebar.collapsed .sidebar-header > span { display: none; }
.sidebar.collapsed .sidebar-toggle { margin-left: 0; }
.sidebar.collapsed .nav-section-label { opacity: 0; pointer-events: none; height: 0; padding: 0; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px 0; gap: 0; }
.sidebar.collapsed .nav-label { opacity: 0; width: 0; overflow: hidden; }
.sidebar.collapsed .user-info { opacity: 0; width: 0; overflow: hidden; }

/* ── SIDEBAR HOVER-EXPAND (overlay, no content shift) ── */
.sidebar.collapsed:hover {
  width: 240px;
  z-index: 200;
  box-shadow: 4px 0 16px rgba(0,0,0,0.10);
}
.sidebar.collapsed:hover .sidebar-header { padding: 20px 20px 16px; justify-content: flex-start; }
.sidebar.collapsed:hover .sidebar-header > svg:first-child { display: block; }
.sidebar.collapsed:hover .sidebar-header > span { display: block; }
.sidebar.collapsed:hover .sidebar-toggle { margin-left: auto; }
.sidebar.collapsed:hover .nav-section-label { opacity: 1; pointer-events: auto; height: auto; padding: 16px 20px 6px; }
.sidebar.collapsed:hover .nav-item { justify-content: flex-start; padding: 10px 20px; gap: 10px; }
.sidebar.collapsed:hover .nav-label { opacity: 1; width: auto; overflow: visible; }
.sidebar.collapsed:hover .user-info { opacity: 1; width: auto; overflow: visible; }

/* ── MAIN CONTENT ── */
.main-content { margin-left: 240px; flex: 1; display: flex; flex-direction: column; transition: margin-left 0.2s ease; }
.main-content.sidebar-collapsed { margin-left: 60px; }
.topbar {
  background: white; border-bottom: 1px solid #e8eaed;
  padding: 20px 32px; display: flex; align-items: center; justify-content: space-between;
}
.topbar h2 { font-size: 22px; font-weight: 600; color: #202124; }
.topbar-sub { font-size: 13px; color: #9aa0a6; margin-top: 2px; }

/* ── DASHBOARD GRID ── */
.dashboard-grid {
  padding: 28px 32px; display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: auto auto;
  gap: 20px;
}
.stat-card {
  background: white; border-radius: 12px; padding: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.stat-label { font-size: 13px; color: #9aa0a6; margin-bottom: 8px; }
.stat-value { font-size: 32px; font-weight: 700; color: #202124; }
.chart-card {
  background: white; border-radius: 12px; padding: 24px;
  grid-column: 1 / 3; box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.activity-card {
  background: white; border-radius: 12px; padding: 24px;
  grid-column: 3 / 5; box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.chart-title { font-size: 15px; font-weight: 600; color: #202124; margin-bottom: 20px; }
.chart-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 180px; color: #9aa0a6; gap: 12px;
}
.chart-placeholder p { font-size: 13px; }

/* ── TOOL PAGES ── */
.tool-body { padding: 28px 32px; display: flex; flex-direction: column; gap: 24px; }
.tool-card { background: white; border-radius: 12px; padding: 28px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.tool-card-title { font-size: 15px; font-weight: 600; color: #202124; margin-bottom: 20px; }
.tool-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }

/* Form */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group label { font-size: 13px; font-weight: 500; color: #3c4043; }
.label-hint { font-weight: 400; color: #9aa0a6; }
.form-input {
  padding: 10px 14px; border: 1px solid #dadce0; border-radius: 8px;
  font-size: 14px; color: #202124; outline: none; transition: border-color 0.15s;
}
.form-input:focus { border-color: #1a73e8; box-shadow: 0 0 0 3px rgba(26,115,232,0.12); }

/* File drop */
.file-drop {
  border: 2px dashed #dadce0; border-radius: 8px; padding: 28px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer; transition: border-color 0.15s, background 0.15s; color: #9aa0a6; font-size: 13px;
}
.file-drop:hover, .file-drop.drag-over { border-color: #1a73e8; background: #f0f6ff; }

/* Buttons */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  background: #1a73e8; color: white; border: none; border-radius: 8px;
  padding: 11px 28px; font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background 0.15s; text-decoration: none;
}
.btn-primary:hover { background: #1557b0; }
.btn-primary:disabled { background: #9aa0a6; cursor: not-allowed; }
.btn-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  background: white; color: #1a73e8; border: 1px solid #1a73e8; border-radius: 8px;
  padding: 8px 18px; font-size: 13px; font-weight: 500; cursor: pointer;
  text-decoration: none; transition: background 0.15s;
}
.btn-secondary:hover { background: #e8f0fe; }
.btn-ghost {
  background: none; border: 1px solid #dadce0; border-radius: 8px;
  padding: 11px 20px; font-size: 14px; cursor: pointer; color: #5f6368;
}
.btn-ghost:hover { background: #f0f2f5; }
.btn-danger {
  background: white; color: #c5221f; border: 1px solid #c5221f; border-radius: 8px;
  padding: 9px 20px; font-size: 14px; font-weight: 500; cursor: pointer; transition: background 0.15s;
}
.btn-danger:hover { background: #fce8e6; }
.conn-status { font-size: 13px; font-weight: 500; padding: 4px 12px; border-radius: 20px; }
.conn-on  { background: #e6f4ea; color: #137333; }
.conn-off { background: #f0f2f5; color: #9aa0a6; }

/* Error */
.tool-error { background: #fce8e6; color: #c5221f; border-radius: 8px; padding: 10px 14px; font-size: 13px; }

/* Results */
.results-summary { display: flex; gap: 10px; margin-bottom: 16px; }
.badge-ok   { background: #e6f4ea; color: #137333; border-radius: 6px; padding: 4px 12px; font-size: 13px; font-weight: 500; }
.badge-fail { background: #fce8e6; color: #c5221f; border-radius: 6px; padding: 4px 12px; font-size: 13px; font-weight: 500; }
.table-wrap { overflow-x: auto; }
.results-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.results-table th { text-align: left; padding: 10px 14px; border-bottom: 2px solid #e8eaed; color: #5f6368; font-weight: 500; }
.results-table td { padding: 10px 14px; border-bottom: 1px solid #f0f2f5; color: #202124; }
.results-table tr:last-child td { border-bottom: none; }
.mono { font-family: monospace; font-size: 12px; }
.msg  { color: #5f6368; font-size: 12px; }
.status-ok   { background: #e6f4ea; color: #137333; border-radius: 4px; padding: 2px 8px; font-weight: 500; }
.status-fail { background: #fce8e6; color: #c5221f; border-radius: 4px; padding: 2px 8px; font-weight: 500; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
  background: white; border-radius: 16px; padding: 32px;
  width: 100%; max-width: 400px; box-shadow: 0 8px 40px rgba(0,0,0,0.15);
}
.modal-title { font-size: 18px; font-weight: 600; color: #202124; margin-bottom: 6px; }
.modal-sub   { font-size: 13px; color: #5f6368; }

/* ── ACCOUNT TABS ── */
.account-tabs { display: flex; gap: 10px; margin-bottom: 4px; }
.acc-tab {
  padding: 10px 28px; border: 2px solid #dadce0; border-radius: 8px;
  background: white; font-size: 15px; font-weight: 500; cursor: pointer;
  color: #5f6368; transition: all 0.15s;
}
.acc-tab:hover { border-color: #1a73e8; color: #1a73e8; }
.acc-tab-active { border-color: #1a73e8; background: #e8f0fe; color: #1a73e8; }
.acc-status-msg { font-size: 13px; margin-top: 12px; padding: 8px 14px; border-radius: 8px; }
.acc-ok  { background: #e6f4ea; color: #137333; }
.acc-err { background: #fce8e6; color: #c5221f; }

/* ── ACPN BILLING DASHBOARD ─────────────────────────────────────────────────── */
.dashboard-region-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 900px) {
  .dashboard-region-grid { grid-template-columns: 1fr; }
}
.dashboard-region-col {
  background: white;
  border-radius: 12px;
  border: 1px solid #e8eaed;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dashboard-region-col--stale { border-color: #f9a825; }
.dashboard-region-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.dashboard-region-name { font-size: 15px; font-weight: 600; color: #202124; }
.badge-stale {
  background: #fff8e1; color: #7f6000;
  font-size: 11px; font-weight: 500;
  padding: 2px 8px; border-radius: 12px;
}
.dashboard-metric-card {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 12px 14px;
  border-left: 4px solid #dadce0;
}
.threshold--ok    { border-left-color: #137333; }
.threshold--warn  { border-left-color: #f9a825; }
.threshold--alert { border-left-color: #c5221f; }
.threshold--unknown { border-left-color: #dadce0; }
.dashboard-metric-label {
  font-size: 11px; font-weight: 500; color: #5f6368;
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px;
}
.dashboard-metric-value { font-size: 18px; font-weight: 600; color: #202124; }
.dashboard-currency { font-size: 13px; font-weight: 400; color: #5f6368; margin-left: 2px; }
.dashboard-metric-sub { font-size: 12px; color: #5f6368; margin-top: 4px; }
.dashboard-runway { font-weight: 500; margin-top: 6px; }
.dashboard-runway--ok    { color: #137333; }
.dashboard-runway--warn  { color: #b06000; }
.dashboard-runway--alert { color: #c5221f; }
.dashboard-metric-na { font-size: 12px; color: #9aa0a6; font-style: italic; }
.dashboard-progress {
  height: 6px; background: #e8eaed;
  border-radius: 3px; margin: 8px 0 4px; overflow: hidden;
}
.dashboard-progress-fill {
  height: 100%; width: 0;
  background: #137333; border-radius: 3px; transition: width 0.4s ease;
}
.threshold--warn  .dashboard-progress-fill { background: #f9a825; }
.threshold--alert .dashboard-progress-fill { background: #c5221f; }
.dashboard-footer {
  display: flex; align-items: center; padding: 12px 0 4px;
}
.dashboard-last-update { font-size: 13px; color: #5f6368; }
