/* SafeTrack — Main Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --c-bg:        #F4F3F0;
  --c-surface:   #FFFFFF;
  --c-border:    #E2E0DA;
  --c-border2:   #CCCAC2;
  --c-text:      #1A1916;
  --c-muted:     #6B6960;
  --c-accent:    #1B4332;
  --c-accent-lt: #D8F3DC;
  --c-accent-md: #52B788;
  --c-amber:     #92400E;
  --c-amber-lt:  #FEF3C7;
  --c-red:       #991B1B;
  --c-red-lt:    #FEE2E2;
  --c-blue:      #1E3A5F;
  --c-blue-lt:   #DBEAFE;
  --c-orange:    #9A3412;
  --c-orange-lt: #FFEDD5;
  --sidebar-w:   220px;
  --radius:      6px;
  --radius-lg:   10px;
  --shadow:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'IBM Plex Sans', sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ─── Layout ─────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--c-accent);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.sidebar-logo .brand {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.3px;
  color: #fff;
}
.sidebar-logo .sub {
  font-size: 11px;
  color: rgba(255,255,255,.5);
  margin-top: 2px;
  font-family: 'IBM Plex Mono', monospace;
}

.nav-section {
  padding: 10px 0 4px;
}
.nav-label {
  padding: 4px 18px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.35);
  font-weight: 500;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: 14px;
  transition: all .15s;
  border-left: 3px solid transparent;
}
.nav-item:hover {
  background: rgba(255,255,255,.07);
  color: #fff;
}
.nav-item.active {
  background: rgba(255,255,255,.12);
  color: #fff;
  border-left-color: var(--c-accent-md);
  font-weight: 500;
}
.nav-item .icon { font-size: 16px; flex-shrink: 0; }

.sidebar-footer {
  margin-top: auto;
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: 12px;
  color: rgba(255,255,255,.4);
}

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.topbar-title { font-size: 16px; font-weight: 600; color: var(--c-text); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-user { font-size: 13px; color: var(--c-muted); }

.page-body { padding: 28px; flex: 1; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header-text h1 { font-size: 22px; font-weight: 600; }
.page-header-text p { color: var(--c-muted); font-size: 14px; margin-top: 2px; }

/* ─── Cards ──────────────────────────────── */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--c-border);
}

/* ─── Stats grid ─────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.stat-card .s-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-muted);
  font-weight: 500;
}
.stat-card .s-val {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
  margin: 4px 0;
  font-family: 'IBM Plex Mono', monospace;
}
.stat-card .s-sub { font-size: 12px; color: var(--c-muted); }

/* ─── Forms ──────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group.full { grid-column: 1 / -1; }
label {
  font-size: 12px;
  font-weight: 500;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
input, select, textarea {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 14px;
  padding: 8px 11px;
  border: 1px solid var(--c-border2);
  border-radius: var(--radius);
  background: var(--c-surface);
  color: var(--c-text);
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--c-accent-md);
  box-shadow: 0 0 0 3px rgba(82,183,136,.15);
}
textarea { resize: vertical; min-height: 80px; }

/* ─── Buttons ────────────────────────────── */
.btn {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--c-border2);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .15s;
  background: var(--c-surface);
  color: var(--c-text);
}
.btn:hover { background: var(--c-bg); }
.btn-primary {
  background: var(--c-accent);
  color: #fff;
  border-color: var(--c-accent);
}
.btn-primary:hover { background: #163829; }
.btn-danger {
  background: var(--c-red-lt);
  color: var(--c-red);
  border-color: #FECACA;
}
.btn-danger:hover { background: #FEE2E2; }
.btn-pdf {
  background: var(--c-blue-lt);
  color: var(--c-blue);
  border-color: #BFDBFE;
}
.btn-pdf:hover { background: #DBEAFE; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-row { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }

/* ─── Table ──────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-muted);
  font-weight: 500;
  padding: 8px 12px;
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}
tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--c-bg); }
.ref-no { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--c-muted); }

/* ─── Badges ─────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: 20px;
  white-space: nowrap;
}
.badge-low      { background: var(--c-accent-lt); color: var(--c-accent); }
.badge-med      { background: var(--c-amber-lt);  color: var(--c-amber); }
.badge-high     { background: var(--c-orange-lt); color: var(--c-orange); }
.badge-critical { background: var(--c-red-lt);    color: var(--c-red); }
.badge-open     { background: var(--c-red-lt);    color: var(--c-red); }
.badge-inprog   { background: var(--c-amber-lt);  color: var(--c-amber); }
.badge-closed   { background: var(--c-accent-lt); color: var(--c-accent); }
.badge-blue     { background: var(--c-blue-lt);   color: var(--c-blue); }

/* ─── Flash messages ─────────────────────── */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  font-size: 14px;
  font-weight: 500;
}
.flash-success { background: var(--c-accent-lt); color: var(--c-accent); border: 1px solid #B7E4C7; }
.flash-error   { background: var(--c-red-lt);    color: var(--c-red);    border: 1px solid #FECACA; }
.flash-warning { background: var(--c-amber-lt);  color: var(--c-amber);  border: 1px solid #FDE68A; }

/* ─── Progress bar ───────────────────────── */
.progress { height: 6px; background: var(--c-border); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; background: var(--c-accent-md); transition: width .4s; }

/* ─── Filter bar ─────────────────────────── */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-bar input, .filter-bar select { max-width: 200px; }

/* ─── Dashboard chart placeholder ───────── */
.mini-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 60px;
}
.mini-bar {
  flex: 1;
  border-radius: 3px 3px 0 0;
  background: var(--c-accent-md);
  opacity: .75;
}

/* ─── Extinguisher status dot ───────────── */
.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  flex-shrink: 0;
}
.dot-green  { background: #15803D; }
.dot-red    { background: #B91C1C; }
.dot-amber  { background: #B45309; }
.dot-gray   { background: #9CA3AF; }

/* ─── Login page ─────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-bg);
}
.login-box {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 16px rgba(0,0,0,.06);
}
.login-box h1 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
}
.login-box .sub { font-size: 13px; color: var(--c-muted); margin-bottom: 28px; }

/* ─── Two column layout ──────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }

/* ─── Responsive ─────────────────────────── */
@media (max-width: 900px) {
  .sidebar { width: 60px; }
  .sidebar .brand, .sidebar .sub, .nav-label, .nav-item span.text, .sidebar-footer { display: none; }
  .main-content { margin-left: 60px; }
  .nav-item { padding: 12px; justify-content: center; }
  .form-grid, .two-col { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .page-body { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-grid-3 { grid-template-columns: 1fr; }
}
