:root {
  --brand-primary: #262324;
  --brand-secondary: #4B5054;
  --brand-accent: #FD4F00;
  --surface: #F5F5F5;
  --surface-card: #FFFFFF;
  --border: #E0E0E0;
  --text-primary: #262324;
  --text-muted: #4B5054;
  --status-pending: #E8A000;
  --status-approved: #2D8A4E;
  --status-rejected: #C0392B;
  --status-failed: #7B2D8B;
  --status-withdrawn: #4B5054;
  --font: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── NAVBAR ── */
nav {
  background: var(--brand-primary);
  display: flex;
  align-items: center;
  padding: 0 28px;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 0;
}
.nav-logo { display: flex; align-items: center; gap: 12px; text-decoration: none; margin-right: 36px; }
.nav-logo img { height: 28px; object-fit: contain; }
.nav-divider { width: 1px; height: 20px; background: #444; margin-right: 36px; }
.nav-label { color: #aaa; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; margin-right: 28px; white-space: nowrap; }
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-link {
  color: #ccc; text-decoration: none; font-size: 14px; font-weight: 600;
  padding: 0 14px; height: 60px; display: flex; align-items: center;
  border-bottom: 3px solid transparent; transition: color 0.15s, border-color 0.15s;
  cursor: pointer; background: none; border-top: none; border-left: none; border-right: none;
  font-family: var(--font);
}
.nav-link:hover { color: #fff; }
.nav-link.active { color: #fff; border-bottom-color: var(--brand-accent); }
.nav-right { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.nav-role-badge { background: rgba(253,79,0,0.18); color: var(--brand-accent); font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; letter-spacing: 0.06em; text-transform: uppercase; }
.nav-user { color: #ccc; font-size: 13px; font-weight: 600; }

/* ── PAGES ── */
section.page { display: none; flex: 1; }
section.page.active { display: block; }

/* ── PAGE HEADER ── */
.page-header { background: var(--brand-primary); padding: 36px 40px 32px; border-bottom: 3px solid var(--brand-accent); }
.page-header h1 { font-size: 28px; font-weight: 700; color: #fff; letter-spacing: -0.02em; }
.page-header p { color: #aaa; font-size: 14px; margin-top: 4px; font-weight: 400; }

/* ── LAYOUT ── */
.container { max-width: 1160px; margin: 0 auto; padding: 32px 40px; }
.card { background: var(--surface-card); border: 1px solid var(--border); border-radius: 6px; padding: 24px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ── STATUS PILLS ── */
.status-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; padding: 3px 10px; border-radius: 20px; }
.status-pill.pending { background: #FFF3CD; color: #7A5800; }
.status-pill.approved { background: #D4EDDA; color: #155724; }
.status-pill.rejected { background: #F8D7DA; color: #721C24; }
.status-pill.upload_failed { background: #E8D5F5; color: #4A1070; }
.status-pill.withdrawn { background: #E9ECEF; color: #495057; }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font); font-size: 14px; font-weight: 600; padding: 9px 20px; border-radius: 5px; border: none; cursor: pointer; transition: opacity 0.15s, background 0.15s; text-decoration: none; white-space: nowrap; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--brand-accent); color: #fff; }
.btn-primary:hover:not(:disabled) { opacity: 0.88; }
.btn-dark { background: var(--brand-primary); color: #fff; }
.btn-dark:hover:not(:disabled) { background: #3a3536; }
.btn-outline { background: transparent; color: var(--brand-primary); border: 1.5px solid var(--brand-primary); }
.btn-outline:hover:not(:disabled) { background: var(--brand-primary); color: #fff; }
.btn-danger { background: #C0392B; color: #fff; }
.btn-danger:hover:not(:disabled) { opacity: 0.88; }
.btn-success { background: #2D8A4E; color: #fff; }
.btn-success:hover:not(:disabled) { opacity: 0.88; }
.btn-sm { font-size: 12px; padding: 6px 14px; }

/* ── FORMS ── */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; letter-spacing: 0.01em; }
.form-label span.req { color: var(--brand-accent); margin-left: 2px; }
.form-control { width: 100%; padding: 9px 13px; border: 1.5px solid var(--border); border-radius: 5px; font-family: var(--font); font-size: 14px; color: var(--text-primary); background: #fff; transition: border-color 0.15s; outline: none; }
.form-control:focus { border-color: var(--brand-accent); }
.form-control.error { border-color: #C0392B; }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: #C0392B; margin-top: 4px; font-weight: 600; }
.char-count { font-size: 11px; color: var(--text-muted); text-align: right; margin-top: 2px; }

/* ── FILE DROP ── */
.file-drop { border: 2px dashed var(--border); border-radius: 6px; padding: 32px 20px; text-align: center; cursor: pointer; transition: border-color 0.15s, background 0.15s; background: #fafafa; position: relative; }
.file-drop:hover, .file-drop.dragover { border-color: var(--brand-accent); background: #fff8f5; }
.file-drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.file-drop-icon { margin-bottom: 10px; color: var(--brand-secondary); }
.file-drop p { font-size: 14px; color: var(--text-muted); }
.file-drop p strong { color: var(--brand-accent); }
.file-drop .file-types { font-size: 11px; color: #999; margin-top: 6px; }
.file-selected { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #f0f8f3; border: 1.5px solid #2D8A4E; border-radius: 5px; margin-top: 10px; }
.file-selected-name { font-size: 13px; font-weight: 600; color: #155724; flex: 1; }
.file-selected-size { font-size: 12px; color: #2D8A4E; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); padding: 10px 14px; border-bottom: 2px solid var(--border); white-space: nowrap; }
td { padding: 13px 14px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }
.td-title { font-weight: 600; color: var(--text-primary); }
.td-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── STAT CARDS ── */
.stat-card { background: var(--surface-card); border: 1px solid var(--border); border-radius: 6px; padding: 20px 22px; }
.stat-card .stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 8px; }
.stat-card .stat-value { font-size: 32px; font-weight: 700; color: var(--text-primary); line-height: 1; }
.stat-card .stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.stat-card.accent-left { border-left: 4px solid var(--brand-accent); }
.stat-card.accent-green { border-left: 4px solid #2D8A4E; }
.stat-card.accent-yellow { border-left: 4px solid #E8A000; }
.stat-card.accent-red { border-left: 4px solid #C0392B; }

/* ── MODALS ── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 500; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: #fff; border-radius: 8px; width: 90%; max-width: 640px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
.modal-wide { max-width: 820px; }
.modal-header { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px; display: flex; align-items: center; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── ALERTS ── */
.alert { padding: 12px 16px; border-radius: 5px; font-size: 13px; font-weight: 600; display: flex; align-items: flex-start; gap: 10px; margin-bottom: 20px; }
.alert-success { background: #D4EDDA; color: #155724; border-left: 4px solid #2D8A4E; }
.alert-error { background: #F8D7DA; color: #721C24; border-left: 4px solid #C0392B; }
.alert-info { background: #D1ECF1; color: #0C5460; border-left: 4px solid #17A2B8; }
.alert-warning { background: #FFF3CD; color: #7A5800; border-left: 4px solid #E8A000; }

/* ── FILTER BAR ── */
.filter-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.filter-bar select, .filter-bar input { padding: 8px 12px; border: 1.5px solid var(--border); border-radius: 5px; font-family: var(--font); font-size: 13px; background: #fff; color: var(--text-primary); outline: none; }
.filter-bar select:focus, .filter-bar input:focus { border-color: var(--brand-accent); }

/* ── AUDIT LOG ── */
.audit-row { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.audit-row:last-child { border-bottom: none; }
.audit-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; }
.audit-action { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.audit-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.audit-notes { font-size: 12px; color: var(--text-primary); margin-top: 4px; font-style: italic; }

/* ── MISC ── */
.sub-id { font-family: monospace; font-size: 12px; color: var(--text-muted); background: #f0f0f0; padding: 2px 7px; border-radius: 3px; }
.days-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.days-badge.fresh { background: #D4EDDA; color: #155724; }
.days-badge.warning { background: #FFF3CD; color: #7A5800; }
.days-badge.danger { background: #F8D7DA; color: #721C24; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state svg { margin-bottom: 16px; opacity: 0.4; }
.empty-state p { font-size: 15px; font-weight: 600; }
.empty-state small { font-size: 13px; }
.category-chip { display: inline-block; background: #EEF2FF; color: #3730A3; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 20px; letter-spacing: 0.03em; }

/* ── META LIST ── */
.meta-list { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; }
.meta-list dt { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); padding-top: 2px; }
.meta-list dd { font-size: 14px; color: var(--text-primary); }

/* ── TOAST ── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 999; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--brand-primary); color: #fff; padding: 12px 18px; border-radius: 6px; font-size: 13px; font-weight: 600; box-shadow: 0 4px 20px rgba(0,0,0,0.2); display: flex; align-items: center; gap: 10px; min-width: 260px; animation: slideIn 0.25s ease; border-left: 4px solid var(--brand-accent); }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── ROLE SWITCHER ── */
.role-switcher { display: flex; align-items: center; gap: 8px; }
.role-switcher label { font-size: 12px; color: #aaa; }
.role-switcher select { background: #3a3536; color: #fff; border: 1px solid #555; padding: 4px 8px; border-radius: 4px; font-size: 12px; font-family: var(--font); cursor: pointer; }

/* ── HOME HERO ── */
.home-hero { background: var(--brand-primary); padding: 56px 40px 48px; border-bottom: 3px solid var(--brand-accent); }
.home-hero h1 { font-size: 36px; font-weight: 900; color: #fff; letter-spacing: -0.03em; line-height: 1.1; }
.home-hero h1 span { color: var(--brand-accent); }
.home-hero p { color: #aaa; font-size: 16px; margin-top: 12px; max-width: 560px; font-weight: 400; }
.home-hero-actions { display: flex; gap: 12px; margin-top: 28px; }
.home-flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 0; background: var(--brand-primary); border-top: 1px solid #333; }
.flow-step { padding: 24px 28px; border-right: 1px solid #333; position: relative; }
.flow-step:last-child { border-right: none; }
.flow-step-num { font-size: 11px; font-weight: 700; color: var(--brand-accent); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 8px; }
.flow-step-title { font-size: 14px; font-weight: 700; color: #fff; margin-bottom: 4px; }
.flow-step-desc { font-size: 12px; color: #888; line-height: 1.5; }

/* ── KB LIBRARY ── */
.kb-card { background: var(--surface-card); border: 1px solid var(--border); border-radius: 6px; padding: 20px; transition: box-shadow 0.15s, border-color 0.15s; cursor: pointer; }
.kb-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); border-color: #ccc; }
.kb-card-type { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 5px; font-size: 10px; font-weight: 800; letter-spacing: 0.04em; margin-bottom: 12px; }
.kb-card-type.pdf { background: #FDECEA; color: #C0392B; }
.kb-card-type.docx { background: #E3F2FD; color: #1565C0; }
.kb-card-type.pptx { background: #FFF3E0; color: #E65100; }
.kb-card-type.xlsx { background: #E8F5E9; color: #2E7D32; }
.kb-card-type.txt { background: #F3E5F5; color: #6A1B9A; }
.kb-card-type.mp4 { background: #FCE4EC; color: #880E4F; }
.kb-card-title { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; line-height: 1.3; }
.kb-card-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; }
.kb-card-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kb-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.kb-doc-id { font-family: monospace; font-size: 10px; color: #aaa; background: #f5f5f5; padding: 2px 6px; border-radius: 3px; }

/* ── REVIEW SPLIT ── */
.review-split { display: grid; grid-template-columns: 1fr 340px; gap: 20px; }
.doc-preview-panel { background: #f7f7f7; border: 1px solid var(--border); border-radius: 6px; min-height: 440px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 32px 20px; }

/* ── SKELETONS ── */
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
.skeleton-line { height: 18px; border-radius: 4px; margin-bottom: 12px; background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%); background-size: 800px 100%; animation: shimmer 1.4s infinite; }
.skeleton-card { height: 100px; border-radius: 6px; background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%); background-size: 800px 100%; animation: shimmer 1.4s infinite; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4, .home-flow { grid-template-columns: 1fr; }
  .container { padding: 20px; }
  .page-header { padding: 24px 20px; }
  .meta-list { grid-template-columns: 1fr; }
  .review-split { grid-template-columns: 1fr; }
  nav { padding: 0 16px; }
  .nav-label, .nav-divider { display: none; }
  .home-hero { padding: 36px 20px 32px; }
}
