/* ===================================================
   AUDIT MANAGEMENT SYSTEM – MAIN STYLESHEET
   =================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #f0f2f5;
  --sidebar-w: 240px;
  --primary:   #2563eb;
  --primary-h: #1d4ed8;
  --text:      #1e293b;
  --muted:     #64748b;
  --border:    #e2e8f0;
  --white:     #ffffff;
  --radius:    8px;
  --shadow:    0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
}

body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }

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

.sidebar {
  width: var(--sidebar-w);
  background: #1e293b;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
}
.sidebar-brand {
  padding: 20px 16px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid #334155;
  display: flex; align-items: center; gap: 10px;
}
.brand-icon { font-size: 22px; }
.sidebar-nav { padding: 12px 0; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 13.5px;
  transition: all .15s;
  border-left: 3px solid transparent;
}
.nav-item:hover, .nav-item.active {
  background: #334155;
  color: #f1f5f9;
  border-left-color: var(--primary);
}
.nav-logout { margin-top: auto; color: #f87171; }
.nav-logout:hover { background: #450a0a; color: #fca5a5; border-left-color: #ef4444; }

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

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow);
}
.page-title { font-size: 18px; font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.user-badge {
  background: #e0e7ff; color: #3730a3;
  padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}

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

/* ── CARDS ──────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 18px; }

/* ── STAT CARDS ─────────────────────────────────── */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  text-align: center;
  border-top: 4px solid var(--border);
}
.stat-blue  { border-top-color: #3b82f6; }
.stat-green { border-top-color: #10b981; }
.stat-red   { border-top-color: #ef4444; }
.stat-value { font-size: 36px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* ── CHARTS ─────────────────────────────────────── */
.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.chart-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.chart-card h3 { font-size: 14px; font-weight: 600; margin-bottom: 14px; color: var(--muted); }

/* ── ADMIN QUICK LINKS ──────────────────────────── */
.admin-quick-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-top: 20px; }
.quick-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow);
  transition: box-shadow .15s;
}
.quick-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.12); }

/* ── FORMS ──────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; color: var(--text); }
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
  background: var(--white);
  transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.form-control:disabled { background: #f8fafc; color: var(--muted); }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.req { color: #ef4444; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 20px; }

.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.inline-form .form-control { width: auto; flex: 1; min-width: 140px; }
.search-form { display: flex; gap: 10px; max-width: 400px; }

.password-wrap { position: relative; display: flex; }
.password-wrap .form-control { padding-right: 40px; }
.toggle-pwd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 16px; color: var(--muted);
}

.checkbox-list { display: flex; flex-wrap: wrap; gap: 10px; }
.checkbox-item { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; }

/* ── BUTTONS ─────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  border: none; border-radius: 6px;
  font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all .15s;
  text-decoration: none;
}
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-h); }
.btn-secondary { background: #f1f5f9; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e2e8f0; }
.btn-success   { background: #10b981; color: #fff; }
.btn-warning   { background: #f59e0b; color: #fff; }
.btn-danger    { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ── ALERTS ─────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin: 0 28px 16px;
  font-size: 13.5px;
  border-left: 4px solid;
}
.alert-success { background: #f0fdf4; border-color: #22c55e; color: #15803d; }
.alert-error   { background: #fef2f2; border-color: #ef4444; color: #991b1b; }
.alert-info    { background: #eff6ff; border-color: #3b82f6; color: #1d4ed8; }

/* ── TABLES ─────────────────────────────────────── */
.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  background: #f8fafc;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.data-table tbody tr:hover { background: #f8fafc; }
.row-disabled td { opacity: .55; }

.doc-icons { display: flex; gap: 6px; align-items: center; }
.doc-icon { font-size: 20px; text-decoration: none; transition: transform .1s; }
.doc-icon:hover { transform: scale(1.2); }
.action-btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── BADGES ─────────────────────────────────────── */
.badge { padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-submitted       { background: #fef3c7; color: #92400e; }
.badge-under-review    { background: #dbeafe; color: #1e40af; }
.badge-reviewed        { background: #d1fae5; color: #065f46; }
.badge-pending-approval{ background: #fce7f3; color: #9d174d; }

/* ── MODALS ─────────────────────────────────────── */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 40px rgba(0,0,0,.2);
}
.modal-box h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

/* ── FORWARD BAR ────────────────────────────────── */
.forward-bar {
  display: flex; align-items: center; gap: 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 12px 16px;
  margin-top: 16px;
}

/* ── PAGINATION ─────────────────────────────────── */
.pagination { display: flex; gap: 6px; margin-top: 16px; justify-content: flex-end; }
.page-btn {
  padding: 6px 12px; border-radius: 4px;
  border: 1px solid var(--border);
  text-decoration: none; color: var(--text); font-size: 13px;
}
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── COMMENTS ───────────────────────────────────── */
.comment-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.comment-item:last-child { border-bottom: none; }
.comment-date { font-size: 11px; color: var(--muted); margin-left: 8px; }
.comment-item p { margin-top: 4px; color: var(--text); }

/* ── LINKS ──────────────────────────────────────── */
.link { color: var(--primary); text-decoration: none; cursor: pointer; }
.link:hover { text-decoration: underline; }

/* ── AUTH ────────────────────────────────────────── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e293b 0%, #1e40af 100%); padding: 20px; }
.auth-card { background: var(--white); border-radius: 12px; padding: 40px; width: 100%; max-width: 400px; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.auth-logo { text-align: center; font-size: 48px; margin-bottom: 12px; }
.auth-title { text-align: center; font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.auth-subtitle { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.auth-form .form-group { margin-bottom: 18px; }

/* ── EMPTY STATE ────────────────────────────────── */
.empty-state { text-align: center; padding: 40px; color: var(--muted); font-size: 15px; }

/* ── RESPONSIVE ─────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .content-area { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .alert { margin: 0 16px 12px; }
}

/* ── Additional styles ───────────────────────────── */
.doc-link {
  display: inline-block;
  padding: 2px 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  color: #1d4ed8;
  font-size: 12px;
  text-decoration: none;
  margin-right: 4px;
}
.doc-link:hover { background: #dbeafe; }

.auth-logo-text {
  text-align: center;
  font-size: 42px;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: 4px;
  margin-bottom: 8px;
}

/* Review doc links */
.doc-link-review { background:#f0fdf4; border-color:#86efac; color:#15803d; }
.doc-link-review:hover { background:#dcfce7; }

/* ── Auth logo image ─────────────────────────────── */
.auth-logo-wrap {
  text-align: center;
  margin-bottom: 18px;
}
.auth-logo-img {
  max-width: 100%;
  height: auto;
  max-height: 90px;
  object-fit: contain;
}
.auth-footer-text {
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
  margin-top: 20px;
}

/* ── Rejected status badge ──────────────────────── */
.badge-rejected { background:#fee2e2; color:#991b1b; }
