/* ── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; color: #222; background: #f5f6f8; }
a { color: #003DA5; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ───────────────────────────────────────────── */
.navbar { background: #003DA5; color: #fff; display: flex; align-items: center; padding: 0 24px; height: 52px; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 4px rgba(0,0,0,.15); }
.nav-brand { display: flex; align-items: center; gap: 10px; margin-right: 32px; flex-shrink: 0; }
.nav-logo-box { background: #fff; color: #003DA5; font-weight: 800; font-size: 18px; width: 34px; height: 34px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; }
.nav-title { font-weight: 700; font-size: 16px; color: #fff; }
.nav-links { display: flex; align-items: center; gap: 4px; flex: 1; }
.nav-link { color: rgba(255,255,255,.85); padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 14px; }
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,.15); color: #fff; text-decoration: none; }
.nav-user { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.nav-user-name { color: rgba(255,255,255,.8); font-size: 13px; }
.nav-dropdown { position: relative; }
.nav-dropdown-menu { display: none; position: absolute; top: 100%; left: 0; background: #fff; border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,.15); min-width: 180px; padding: 4px 0; margin-top: 4px; }
.nav-dropdown:hover .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a { display: block; padding: 8px 16px; color: #222; font-size: 14px; }
.nav-dropdown-menu a:hover { background: #f5f6f8; color: #003DA5; text-decoration: none; }

/* ── Mobile hamburger ─────────────────────────────────── */
.nav-mobile-btn { display: none; flex-direction: column; justify-content: space-around; width: 28px; height: 28px; background: none; border: none; cursor: pointer; padding: 0; margin-left: auto; }
.nav-mobile-btn span { display: block; height: 2px; background: #fff; border-radius: 2px; }
@media (max-width: 640px) {
  .nav-mobile-btn { display: flex; }
  .nav-links { display: none; flex-direction: column; align-items: flex-start; position: absolute; top: 52px; left: 0; right: 0; background: #003DA5; padding: 8px 16px 16px; gap: 0; }
  .nav-links.nav-open { display: flex; }
  .nav-link { width: 100%; }
  .nav-dropdown-menu { position: static; box-shadow: none; background: rgba(0,0,0,.15); border-radius: 4px; min-width: 0; margin-top: 0; }
  .nav-user { flex-direction: column; align-items: flex-start; gap: 4px; margin-left: 0; width: 100%; }
}

/* ── Login ────────────────────────────────────────────── */
.login-page { background: #f5f6f8; min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: #fff; border-radius: 12px; box-shadow: 0 4px 24px rgba(0,0,0,.1); padding: 48px 40px; width: 360px; text-align: center; }
.login-logo { background: #003DA5; color: #fff; font-weight: 800; font-size: 28px; width: 60px; height: 60px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.login-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.login-sub { color: #666; margin-bottom: 28px; }
.btn-google { display: flex; align-items: center; justify-content: center; width: 100%; padding: 11px 16px; background: #fff; border: 1px solid #ddd; border-radius: 6px; color: #333; font-size: 14px; font-weight: 500; cursor: pointer; transition: background .15s; }
.btn-google:hover { background: #f8f8f8; text-decoration: none; }

/* ── Flash Messages ───────────────────────────────────── */
.flash-container { padding: 0 0 0; margin-top: 16px; margin-bottom: 8px; }
.flash { padding: 10px 16px; border-radius: 6px; margin-bottom: 8px; font-size: 14px; }
.flash-success { background: #d4edda; color: #155724; border-left: 4px solid #28a745; }
.flash-error   { background: #f8d7da; color: #721c24; border-left: 4px solid #dc3545; }
.flash-warn    { background: #fff3cd; color: #856404; border-left: 4px solid #ffc107; }
.flash-info    { background: #d1ecf1; color: #0c5460; border-left: 4px solid #17a2b8; }

/* ── Main Content ─────────────────────────────────────── */
.main-content { padding: 24px; max-width: 1600px; margin: 0 auto; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-size: 22px; font-weight: 700; }

/* ── Stat Cards ───────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.08); padding: 20px; text-align: center; }
.stat-card.danger { border-top: 3px solid #dc3545; }
.stat-card.warning { border-top: 3px solid #ffc107; }
.stat-card.success { border-top: 3px solid #28a745; }
.stat-number { font-size: 36px; font-weight: 700; color: #003DA5; }
.stat-card.danger .stat-number { color: #dc3545; }
.stat-card.warning .stat-number { color: #856404; }
.stat-card.success .stat-number { color: #198754; }
.stat-label { font-size: 12px; color: #666; margin-top: 4px; }

/* ── Filter bar ───────────────────────────────────────── */
.filter-bar { background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.08); padding: 14px 16px; margin-bottom: 16px; display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filter-bar label { font-size: 12px; color: #555; font-weight: 600; display: block; margin-bottom: 4px; }
.filter-bar select, .filter-bar input[type=text] { border: 1px solid #ddd; border-radius: 5px; padding: 6px 10px; font-size: 13px; background: #f9f9f9; }
.filter-bar select:focus, .filter-bar input[type=text]:focus { outline: none; border-color: #003DA5; background: #fff; }

/* ── Cards / Panels ───────────────────────────────────── */
.card { background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.08); margin-bottom: 16px; overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid #eee; }
.card-header h2 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

/* ── Tables ───────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { background: #f8f9fa; text-align: left; padding: 10px 14px; font-weight: 600; font-size: 12px; color: #555; border-bottom: 2px solid #eee; white-space: nowrap; }
.data-table td { padding: 9px 14px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(0,0,0,.02); }
.empty-state { color: #999; padding: 32px; text-align: center; font-style: italic; }
.result-count { font-size: 13px; color: #666; margin-bottom: 10px; }

/* Row highlights for cert expiry */
.row-expiring td { background: #fff8e1 !important; }
.row-expired td { background: #fdecea !important; }

/* ── Buttons ──────────────────────────────────────────── */
.btn { display: inline-block; padding: 7px 14px; border-radius: 5px; font-size: 13px; font-weight: 500; cursor: pointer; border: none; text-decoration: none; transition: opacity .15s; }
.btn:hover { opacity: .85; text-decoration: none; }
.btn-primary { background: #003DA5; color: #fff; }
.btn-secondary { background: #6c757d; color: #fff; }
.btn-danger { background: #dc3545; color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-outline { background: #fff; border: 1px solid #003DA5; color: #003DA5; }
.btn-outline:hover { background: #003DA5; color: #fff; opacity: 1; }

/* ── Forms ────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: #444; }
.form-control { width: 100%; border: 1px solid #ddd; border-radius: 5px; padding: 8px 12px; font-size: 14px; background: #fff; }
.form-control:focus { outline: none; border-color: #003DA5; box-shadow: 0 0 0 3px rgba(0,61,165,.1); }
.form-hint { font-size: 12px; color: #888; margin-top: 4px; }
.form-check { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.form-actions { margin-top: 20px; display: flex; gap: 10px; }

/* ── Badges ───────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; letter-spacing: .2px; }
.badge-success    { background: #d4edda; color: #155724; }
.badge-warning    { background: #fff3cd; color: #856404; }
.badge-danger     { background: #f8d7da; color: #721c24; }
.badge-info       { background: #d1ecf1; color: #0c5460; }
.badge-secondary  { background: #e2e3e5; color: #383d41; }
.badge-admin      { background: #003DA5; color: #fff; }

/* ── Admin stat grid ──────────────────────────────────── */
.admin-stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px; margin-bottom: 24px; }
.admin-stat { background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.08); padding: 18px; text-align: center; border-top: 3px solid #003DA5; }
.admin-stat-num { font-size: 30px; font-weight: 700; color: #003DA5; }
.admin-stat-label { font-size: 12px; color: #666; margin-top: 4px; }

/* ── Sync log table ───────────────────────────────────── */
.sync-badge-success { color: #155724; font-weight: 600; }
.sync-badge-error { color: #721c24; font-weight: 600; }
.sync-badge-running { color: #856404; font-weight: 600; }

/* ── Footer ───────────────────────────────────────────── */
footer { text-align: center; padding: 1rem; font-size: 0.72rem; color: #aaa; margin-top: 2rem; }
footer a { color: #aaa; }
footer a:hover { color: #003DA5; }

/* ── Utilities ────────────────────────────────────────── */
.text-muted { color: #888; }
.text-danger { color: #dc3545; }
.text-warning { color: #856404; }
.text-success { color: #198754; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.d-flex { display: flex; }
.gap-2 { gap: 8px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.no-wrap { white-space: nowrap; }
