@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@300;400;500;600;700&family=Barlow+Condensed:wght@400;600;700&display=swap');

:root {
  --primary: #1a3a2a;
  --primary-light: #2d5c42;
  --accent: #e8a020;
  --accent-light: #f5bc50;
  --danger: #c0392b;
  --warning: #e67e22;
  --success: #27ae60;
  --info: #2980b9;
  --bg: #f4f5f0;
  --surface: #ffffff;
  --surface2: #f0f2ed;
  --border: #d8dbd2;
  --text: #1a1f18;
  --text-muted: #6b7566;
  --sidebar-w: 240px;
  --header-h: 60px;
  --radius: 6px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: auto; }
body { font-family: 'Barlow', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--primary);
  position: fixed; top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column;
  z-index: 100; overflow-y: auto;
}
.sidebar-logo { padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-logo .company { font-family: 'Barlow Condensed', sans-serif; font-size: 18px; font-weight: 700; color: var(--accent); }
.sidebar-logo .sub { font-size: 11px; color: rgba(255,255,255,0.5); margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section { padding: 8px 20px 4px; font-size: 10px; font-weight: 600; color: rgba(255,255,255,0.35); letter-spacing: 1.5px; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px; color: rgba(255,255,255,0.7);
  text-decoration: none; font-size: 13.5px; font-weight: 500;
  transition: all 0.15s; border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: rgba(232,160,32,0.15); color: var(--accent); border-left-color: var(--accent); }
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.1); }
.sidebar-footer .user-name { color: #fff; font-size: 13px; font-weight: 600; }
.sidebar-footer .user-role { color: rgba(255,255,255,0.5); font-size: 11px; }
.sidebar-footer a { color: rgba(255,255,255,0.5); font-size: 12px; text-decoration: none; }
.sidebar-footer a:hover { color: var(--accent); }

.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-family: 'Barlow Condensed', sans-serif; font-size: 20px; font-weight: 600; color: var(--primary); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.page-content { padding: 24px; flex: 1; }

.card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); margin-bottom: 20px; }
.card-header { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-family: 'Barlow Condensed', sans-serif; font-size: 16px; font-weight: 600; color: var(--primary); }
.card-body { padding: 20px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); padding: 18px 20px; box-shadow: var(--shadow); }
.stat-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; }
.stat-value { font-family: 'Barlow Condensed', sans-serif; font-size: 32px; font-weight: 700; color: var(--primary); margin: 4px 0; }
.stat-sub { font-size: 12px; color: var(--text-muted); }
.stat-card.accent { border-left: 4px solid var(--accent); }
.stat-card.danger { border-left: 4px solid var(--danger); }
.stat-card.success { border-left: 4px solid var(--success); }
.stat-card.warning { border-left: 4px solid var(--warning); }
.stat-card.info { border-left: 4px solid var(--info); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { background: var(--surface2); padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; border-bottom: 2px solid var(--border); white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; white-space: nowrap; }
.badge-ok, .badge-success, .badge-active { background: #d5f5e3; color: #1a7a40; }
.badge-warning { background: #fdebd0; color: #a04000; }
.badge-danger, .badge-overdue, .badge-expired { background: #fadbd8; color: #922b21; }
.badge-grounded { background: #fadbd8; color: #922b21; }
.badge-info, .badge-garage { background: #d6eaf8; color: #1a5276; }
.badge-workshop { background: #e8daef; color: #6c3483; }
.badge-secondary { background: var(--surface2); color: var(--text-muted); }
.badge-accent { background: #fef3d7; color: #7d5a00; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 600; cursor: pointer; border: none; text-decoration: none; transition: all 0.15s; font-family: 'Barlow', sans-serif; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-accent { background: var(--accent); color: #1a1f18; }
.btn-accent:hover { background: var(--accent-light); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 11.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
input, select, textarea {
  padding: 9px 12px; border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 13.5px; font-family: 'Barlow', sans-serif; color: var(--text);
  background: var(--surface); transition: border-color 0.15s; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary-light); }
textarea { resize: vertical; min-height: 80px; }

.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13.5px; display: flex; align-items: center; gap: 10px; }
.alert-success { background: #d5f5e3; color: #1a7a40; border-left: 4px solid var(--success); }
.alert-danger { background: #fadbd8; color: #922b21; border-left: 4px solid var(--danger); }
.alert-warning { background: #fdebd0; color: #a04000; border-left: 4px solid var(--warning); }
.alert-info { background: #d6eaf8; color: #1a5276; border-left: 4px solid var(--info); }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-family: 'Barlow Condensed', sans-serif; font-size: 26px; font-weight: 700; color: var(--primary); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-right { text-align: right; }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.flag-banner { background: #fadbd8; border: 1px solid #f1948a; border-radius: var(--radius); padding: 10px 16px; display: flex; align-items: center; gap: 10px; color: var(--danger); font-weight: 600; font-size: 13px; margin-bottom: 16px; }

.comp-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.comp-row:last-child { border-bottom: none; }
.comp-name { font-weight: 500; font-size: 13px; }
.comp-meta { font-size: 11.5px; color: var(--text-muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.dot-ok { background: var(--success); }
.dot-warning { background: var(--warning); }
.dot-overdue { background: var(--danger); }

.login-page { min-height: 100vh; background: var(--primary); display: flex; align-items: center; justify-content: center; }
.login-box { background: var(--surface); border-radius: 12px; padding: 48px 40px; width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .co-name { font-family: 'Barlow Condensed', sans-serif; font-size: 24px; font-weight: 700; color: var(--primary); }
.login-logo .sys-name { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.login-box h2 { font-family: 'Barlow Condensed', sans-serif; font-size: 22px; font-weight: 700; color: var(--primary); margin-bottom: 24px; }

.search-bar { display: flex; gap: 8px; margin-bottom: 16px; }
.search-bar input { flex: 1; }

@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}


/* ── PRINT STYLES ──────────────────────────────────────────────────────────── */
@media print {
  .sidebar,
  .topbar,
  .btn,
  .nav-item,
  .sidebar-footer,
  form[method="get"],
  .topbar-actions { display: none !important; }

  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }

  .page-content {
    padding: 0 !important;
  }

  .layout {
    display: block !important;
  }

  body {
    background: white !important;
    font-size: 12px !important;
  }

  .card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
  }

  table { font-size: 11px !important; }

  a { color: inherit !important; text-decoration: none !important; }

  @page {
    margin: 15mm;
    size: A4;
  }
}
/* ─── MOBILE RESPONSIVE (drawer nav) ─────────────────────────── */
/* Hamburger button — hidden on desktop, shown on mobile */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--primary);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 10px 4px 0;
  margin-right: 4px;
}
/* Dark overlay behind the drawer — hidden by default */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 90;
}

@media (max-width: 900px) {
  /* Sidebar becomes an off-screen drawer that slides in */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    width: 260px;
    z-index: 100;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .nav-overlay { display: block; }

  /* Content fills the screen — kills the sideways scroll */
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100%;
    overflow-x: hidden;
  }
  .page-content { padding: 14px !important; }

  /* Show the hamburger, tighten the topbar */
  .nav-toggle { display: inline-block; }
  .topbar { padding: 0 12px; }
  .topbar-title { font-size: 16px; }
  .topbar-actions { font-size: 11px; }

  /* Wide tables scroll inside their own box, not the whole page */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 560px; }

  /* Cards + grids go full width and stack */
  .card { margin-bottom: 14px; }
  .grid-2, .stats-grid { grid-template-columns: 1fr !important; }
}
