/* gudBro MDQMS - Custom Styles */
:root {
  --sidebar-bg:   #0d2137;
  --sidebar-text: #8db4d4;
  --sidebar-act:  #1e90ff;
  --primary:      #1565c0;
  --primary-lt:   #1976d2;
  --success:      #2e7d32;
  --warning:      #e65100;
  --danger:       #c62828;
  --bg:           #f0f2f5;
  --card-bg:      #ffffff;
  --border:       #dee2e6;
  --text:         #212529;
  --muted:        #6c757d;
  --sidebar-w:    255px;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
#sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  overflow-y: auto; overflow-x: hidden;
  z-index: 1000;
  display: flex; flex-direction: column;
}

.sidebar-brand {
  display: flex; flex-direction: column; align-items: center;
  padding: 22px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand img {
  width: 72px; height: 72px; object-fit: contain;
  border-radius: 12px; background: #fff; padding: 4px;
}
.sidebar-brand .brand-name {
  font-size: 1.15rem; font-weight: 700; letter-spacing: 3px;
  color: #fff; margin-top: 8px; text-align: center;
}
.sidebar-brand .brand-sub {
  font-size: 0.62rem; color: var(--sidebar-text); letter-spacing: 1px;
  text-transform: uppercase; margin-top: 2px;
}

.sidebar-section {
  padding: 18px 12px 4px;
  font-size: 0.65rem; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: rgba(255,255,255,0.3);
}

.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px; margin: 1px 8px;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none; font-size: 0.875rem;
  transition: all 0.15s;
}
.sidebar-link:hover  { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-link.active { background: rgba(30,144,255,0.2); color: var(--sidebar-act); font-weight: 600; }
.sidebar-link i { font-size: 1rem; width: 18px; flex-shrink: 0; }
.sidebar-link .clause-badge {
  margin-left: auto; font-size: 0.62rem;
  background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.5);
  padding: 1px 6px; border-radius: 20px;
}

/* ── Main Content ─────────────────────────────────────────────────────────── */
#main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
}

/* ── Top Navbar ───────────────────────────────────────────────────────────── */
.topbar {
  height: 58px; background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 900;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-title { font-size: 1rem; font-weight: 600; color: var(--text); }
.topbar-clause { font-size: 0.75rem; color: var(--primary); background: #e3f0ff; padding: 2px 8px; border-radius: 12px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.user-badge { display: flex; align-items: center; gap: 8px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem;
}
.user-info small { display: block; font-size: 0.7rem; color: var(--muted); }

/* ── Page Content ─────────────────────────────────────────────────────────── */
.page-body { padding: 24px; flex: 1; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card { border: 1px solid var(--border); border-radius: 10px; background: var(--card-bg); box-shadow: 0 1px 4px rgba(0,0,0,0.04); }
.card-header-custom {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card-bg); border-radius: 10px 10px 0 0;
}
.card-header-custom h6 { margin: 0; font-weight: 600; font-size: 0.9rem; }

/* ── KPI Cards ────────────────────────────────────────────────────────────── */
.kpi-card {
  border-radius: 10px; padding: 18px 20px;
  display: flex; align-items: center; gap: 16px;
  background: #fff; border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  transition: transform 0.15s, box-shadow 0.15s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.kpi-icon {
  width: 48px; height: 48px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.kpi-icon.blue   { background: #e3f0ff; color: #1565c0; }
.kpi-icon.green  { background: #e8f5e9; color: #2e7d32; }
.kpi-icon.orange { background: #fff3e0; color: #e65100; }
.kpi-icon.red    { background: #ffebee; color: #c62828; }
.kpi-icon.purple { background: #ede7f6; color: #6a1b9a; }
.kpi-icon.teal   { background: #e0f2f1; color: #00695c; }
.kpi-val { font-size: 1.8rem; font-weight: 700; line-height: 1; color: var(--text); }
.kpi-lbl { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.kpi-sub { font-size: 0.7rem; color: var(--muted); }

/* ── Tables ───────────────────────────────────────────────────────────────── */
.table { font-size: 0.835rem; margin-bottom: 0; }
.table thead th {
  background: #f8f9fa; font-weight: 600; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted);
  border-bottom: 2px solid var(--border); padding: 10px 12px; white-space: nowrap;
}
.table td { padding: 10px 12px; vertical-align: middle; }
.table-hover tbody tr:hover { background: #f8faff; }

/* ── Status Badges ────────────────────────────────────────────────────────── */
.badge-status {
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 600; white-space: nowrap;
}
.s-approved, .s-released, .s-completed, .s-calibrated, .s-closed, .s-pass, .s-operational, .s-active { background:#e8f5e9; color:#2e7d32; }
.s-in-progress, .s-under-review, .s-under-investigation, .s-pending { background:#fff3e0; color:#e65100; }
.s-draft, .s-scheduled, .s-open, .s-conditional, .s-due-soon { background:#e3f0ff; color:#1565c0; }
.s-rejected, .s-overdue, .s-failed, .s-major { background:#ffebee; color:#c62828; }
.s-on-hold, .s-hold { background:#f3e5f5; color:#6a1b9a; }
.s-default { background:#f5f5f5; color:#555; }

/* Severity badges */
.sev-critical, .sev-major { background:#ffebee; color:#c62828; }
.sev-moderate, .sev-high  { background:#fff3e0; color:#e65100; }
.sev-minor, .sev-low      { background:#e8f5e9; color:#2e7d32; }

/* RPN badges */
.rpn-high   { color:#c62828; font-weight:700; }
.rpn-medium { color:#e65100; font-weight:600; }
.rpn-low    { color:#2e7d32; font-weight:600; }

/* ── Action Buttons ───────────────────────────────────────────────────────── */
.btn-act { padding: 3px 8px; font-size: 0.78rem; border-radius: 6px; }

/* ── Search Bar ───────────────────────────────────────────────────────────── */
.search-bar { max-width: 280px; }
.search-bar .form-control { font-size: 0.85rem; border-radius: 8px 0 0 8px; }

/* ── Login Page ───────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh; background: linear-gradient(135deg, #0d2137 0%, #1565c0 100%);
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  width: 100%; max-width: 420px;
  background: #fff; border-radius: 16px;
  padding: 40px 36px; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo img { width: 80px; height: 80px; object-fit: contain; border-radius: 12px; }
.login-logo .app-name { font-size: 1.4rem; font-weight: 800; letter-spacing: 3px; color: #0d2137; margin-top: 10px; }
.login-logo .app-sub  { font-size: 0.75rem; color: var(--muted); letter-spacing: 1px; }

/* ── Modals ───────────────────────────────────────────────────────────────── */
.modal-header { border-bottom: 1px solid var(--border); background: #f8f9fa; border-radius: 8px 8px 0 0; }
.modal-title  { font-size: 0.95rem; font-weight: 700; }
.modal-body label { font-size: 0.8rem; font-weight: 600; color: #444; margin-bottom: 3px; }
.modal-body .form-control, .modal-body .form-select { font-size: 0.85rem; }
.form-label-sm { font-size: 0.78rem; font-weight: 600; color: #555; }

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert { font-size: 0.875rem; border-radius: 8px; }

/* ── Dashboard Charts ─────────────────────────────────────────────────────── */
.chart-container { position: relative; height: 220px; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #sidebar { width: 200px; }
  #main { margin-left: 200px; }
}
