/* PEM – Painel Externo de Mídias | IBRAFE */

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #1a3a6e;
  --primary-light: #2a5298;
  --accent: #f5a623;
  --green: #27ae60;
  --red: #e74c3c;
  --orange: #e67e22;
  --sidebar-w: 240px;
  --header-h: 64px;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.15);
  --transition: .2s ease;
}

/* LIGHT MODE */
body {
  --bg: #f0f2f7;
  --surface: #ffffff;
  --surface2: #f7f8fc;
  --sidebar-bg: #1a3a6e;
  --sidebar-text: rgba(255,255,255,.8);
  --sidebar-active: rgba(255,255,255,.15);
  --text: #1a1a2e;
  --text2: #64748b;
  --border: #e2e8f0;
  --input-bg: #f8fafc;
  --badge-bg: #eef2ff;
  --badge-text: #3730a3;
  --hover: #f1f5f9;
  --overlay: rgba(0,0,0,.5);
  --notification-unread: #eff6ff;
}

/* DARK MODE */
body.dark {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #232635;
  --sidebar-bg: #111827;
  --sidebar-text: rgba(255,255,255,.7);
  --sidebar-active: rgba(255,255,255,.12);
  --text: #f1f5f9;
  --text2: #94a3b8;
  --border: #2d3748;
  --input-bg: #2d3748;
  --badge-bg: #1e3a5f;
  --badge-text: #93c5fd;
  --hover: #2d3748;
  --overlay: rgba(0,0,0,.7);
  --notification-unread: #1e3a5f;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

/* ===== SPLASH SCREEN ===== */
#splash {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(135deg, #1a3a6e 0%, #2a5298 50%, #1a3a6e 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 24px;
  transition: opacity .5s ease, visibility .5s ease;
}
#splash.hide { opacity: 0; visibility: hidden; }
#splash .splash-logo {
  background: white; border-radius: 16px; padding: 20px 32px;
  box-shadow: 0 16px 48px rgba(0,0,0,.3);
  animation: splashPulse 1.5s ease-in-out infinite alternate;
}
#splash .splash-logo img { height: 80px; display: block; }
#splash h1 { color: white; font-size: 28px; font-weight: 700; letter-spacing: 2px; }
#splash p { color: rgba(255,255,255,.7); font-size: 14px; }
#splash .splash-loader {
  width: 48px; height: 4px; background: rgba(255,255,255,.2); border-radius: 4px; overflow: hidden;
}
#splash .splash-loader-bar {
  height: 100%; width: 0; background: var(--accent);
  animation: splashLoad 2s ease-in-out forwards;
}
@keyframes splashPulse { from { transform: scale(1); } to { transform: scale(1.03); } }
@keyframes splashLoad { 0% { width: 0; } 80% { width: 90%; } 100% { width: 100%; } }

/* ===== AUTH SCREENS ===== */
#auth-screen {
  min-height: 100vh;
  background: linear-gradient(135deg, #1a3a6e 0%, #2a5298 60%, #1e5799 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.auth-card {
  background: white; border-radius: 20px; padding: 40px;
  width: 100%; max-width: 460px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  animation: slideUp .4s ease;
}
body.dark .auth-card { background: #1a1d27; }
@keyframes slideUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
.auth-logo-area { text-align: center; margin-bottom: 28px; }
.auth-logo-area img { height: 60px; }
.auth-logo-area h2 { font-size: 22px; font-weight: 700; color: var(--primary); margin-top: 12px; }
.auth-logo-area p { color: var(--text2); font-size: 13px; margin-top: 4px; }
.auth-tabs { display: flex; gap: 4px; background: var(--surface2); border-radius: 8px; padding: 4px; margin-bottom: 24px; }
.auth-tab {
  flex: 1; padding: 8px; border: none; background: transparent; border-radius: 6px;
  font-size: 14px; font-weight: 500; cursor: pointer; color: var(--text2);
  transition: all var(--transition);
}
.auth-tab.active { background: var(--primary); color: white; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text); }
.form-group label .required { color: var(--red); margin-left: 2px; }
.form-control {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 14px; background: var(--input-bg); color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,58,110,.1); }
select.form-control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Photo upload */
.photo-upload-area {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 20px; border: 2px dashed var(--border); border-radius: 12px;
  cursor: pointer; transition: all var(--transition);
  background: var(--surface2);
}
.photo-upload-area:hover { border-color: var(--primary); background: rgba(26,58,110,.04); }
.photo-preview-circle {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--border); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; color: var(--text2);
  border: 3px solid var(--border);
  position: relative;
}
.photo-preview-circle img { width: 100%; height: 100%; object-fit: cover; }
.photo-upload-area p { font-size: 13px; color: var(--text2); text-align: center; }
.photo-upload-area small { font-size: 11px; color: var(--text2); }
.photo-required-badge {
  background: #fef3cd; color: #856404; font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 20px; border: 1px solid #ffc107;
}

/* Color picker */
.color-picker-row { display: flex; flex-wrap: wrap; gap: 8px; }
.color-dot {
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
  border: 3px solid transparent; transition: all var(--transition);
}
.color-dot:hover { transform: scale(1.15); }
.color-dot.selected { border-color: var(--text); transform: scale(1.15); }
.color-dot.taken { opacity: 0.3; cursor: not-allowed; }

.btn {
  padding: 11px 20px; border: none; border-radius: 8px; font-size: 14px;
  font-weight: 600; cursor: pointer; transition: all var(--transition); display: inline-flex;
  align-items: center; justify-content: center; gap: 8px;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(26,58,110,.3); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #c0392b; }
.btn-success { background: var(--green); color: white; }
.btn-success:hover { background: #219a52; }
.btn-warn { background: var(--orange); color: white; }
.btn-warn:hover { background: #d35400; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 8px; }
.btn-full { width: 100%; }
.auth-link { text-align: center; font-size: 13px; color: var(--text2); cursor: pointer; }
.auth-link span { color: var(--primary); font-weight: 600; text-decoration: underline; }
.auth-link span:hover { color: var(--primary-light); }

/* ===== LAYOUT PRINCIPAL ===== */
#main-layout { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w); background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
  transition: width var(--transition);
  overflow: hidden;
}
.sidebar-header {
  padding: 20px 16px; border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-logo-wrap {
  background: white; border-radius: 10px; padding: 6px 10px;
  display: flex; align-items: center; justify-content: center;
  min-width: 44px;
}
.sidebar-logo-wrap img { height: 36px; width: auto; display: block; }
.sidebar-brand { display: flex; flex-direction: column; }
.sidebar-brand .brand-name { color: white; font-size: 16px; font-weight: 700; line-height: 1.2; }
.sidebar-brand .brand-sub { color: rgba(255,255,255,.5); font-size: 10px; line-height: 1.3; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.nav-section { padding: 8px 16px 4px; }
.nav-section-title { color: rgba(255,255,255,.4); font-size: 10px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; color: var(--sidebar-text);
  cursor: pointer; transition: all var(--transition);
  border-radius: 8px; margin: 2px 8px;
  font-size: 14px; font-weight: 500; white-space: nowrap;
  position: relative;
}
.nav-item:hover { background: var(--sidebar-active); color: white; }
.nav-item.active { background: var(--sidebar-active); color: white; }
.nav-item i { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; background: var(--red); color: white;
  font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 20px;
  min-width: 18px; text-align: center;
}
.sidebar-footer {
  padding: 16px; border-top: 1px solid rgba(255,255,255,.1);
  color: rgba(255,255,255,.4); font-size: 11px; text-align: center;
}

/* MAIN CONTENT */
.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* HEADER */
.app-header {
  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: 90;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.header-left { display: flex; align-items: center; gap: 16px; }
.page-title { font-size: 18px; font-weight: 700; color: var(--text); }
.header-right { display: flex; align-items: center; gap: 12px; }
.header-greeting { font-size: 14px; color: var(--text2); font-weight: 500; }
.header-greeting strong { color: var(--text); }

/* Theme toggle */
.theme-toggle {
  width: 36px; height: 36px; border-radius: 8px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text2); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  transition: all var(--transition);
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* Notification bell */
.notif-bell {
  position: relative; width: 36px; height: 36px; border-radius: 8px;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text2); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  transition: all var(--transition);
}
.notif-bell:hover { border-color: var(--primary); color: var(--primary); }
.notif-bell .notif-count {
  position: absolute; top: -6px; right: -6px;
  background: var(--red); color: white; font-size: 10px; font-weight: 700;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface);
}
.notif-count.hidden { display: none; }

/* User avatar header */
.header-user { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.header-avatar {
  width: 40px; height: 40px; border-radius: 50%; overflow: hidden;
  border: 3px solid transparent; flex-shrink: 0;
  background: var(--border);
}
.header-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ===== PAGE CONTENT ===== */
.page-content { flex: 1; padding: 24px; overflow-y: auto; }

/* ===== CARDS ===== */
.card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 15px; font-weight: 700; color: var(--text); }
.card-body { padding: 20px; }

/* ===== STATS GRID ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border-radius: var(--radius); padding: 20px;
  border: 1px solid var(--border); display: flex; align-items: center; gap: 16px;
}
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.stat-info .stat-value { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-info .stat-label { font-size: 12px; color: var(--text2); margin-top: 4px; }

/* ===== DEMANDS ===== */
.demands-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px;
  flex-wrap: wrap;
}
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 8px;
  padding: 8px 14px; min-width: 240px;
}
.search-box i { color: var(--text2); }
.search-box input { border: none; background: transparent; color: var(--text); font-size: 14px; outline: none; flex: 1; }
.filter-tabs { display: flex; gap: 4px; background: var(--surface2); border-radius: 8px; padding: 4px; }
.filter-tab {
  padding: 6px 14px; border: none; background: transparent; border-radius: 6px;
  font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text2); transition: all var(--transition);
}
.filter-tab.active { background: var(--primary); color: white; }
.view-btns { display: flex; gap: 4px; }
.view-btn {
  width: 32px; height: 32px; border: 1.5px solid var(--border); background: var(--surface);
  border-radius: 6px; cursor: pointer; color: var(--text2); font-size: 14px;
  display: flex; align-items: center; justify-content: center; transition: all var(--transition);
}
.view-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* Demand grid */
.demands-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.demands-list { display: flex; flex-direction: column; gap: 12px; }

.demand-card {
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border);
  overflow: hidden; cursor: pointer; transition: all var(--transition);
  box-shadow: var(--shadow);
}
.demand-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.demand-card-header {
  padding: 14px 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
}
.demand-card-body { padding: 0 16px 14px; }
.demand-card-footer {
  padding: 10px 16px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.demand-title { font-size: 14px; font-weight: 700; color: var(--text); line-height: 1.4; }
.demand-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* Avatar group */
.avatar-group { display: flex; align-items: center; }
.avatar-group .avatar-item {
  width: 28px; height: 28px; border-radius: 50%; overflow: hidden;
  border: 2px solid var(--surface); margin-left: -8px;
  background: var(--border); flex-shrink: 0;
  position: relative;
}
.avatar-group .avatar-item:first-child { margin-left: 0; }
.avatar-group .avatar-item img { width: 100%; height: 100%; object-fit: cover; }
.avatar-group .avatar-item .avatar-initial {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: white;
}
.avatar-group .avatar-more {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--border); border: 2px solid var(--surface);
  margin-left: -8px; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: var(--text2);
}

/* Large avatar for people selector */
.people-avatar {
  width: 40px; height: 40px; border-radius: 50%; overflow: hidden;
  background: var(--border); flex-shrink: 0; position: relative;
  display: flex; align-items: center; justify-content: center;
}
.people-avatar img { width: 100%; height: 100%; object-fit: cover; }
.people-avatar .avatar-initial {
  font-size: 14px; font-weight: 700; color: white;
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
}

/* People selector */
.people-selector {
  border: 1.5px solid var(--border); border-radius: 10px; background: var(--surface);
  max-height: 240px; overflow-y: auto;
}
.people-selector-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  cursor: pointer; transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}
.people-selector-item:last-child { border-bottom: none; }
.people-selector-item:hover { background: var(--hover); }
.people-selector-item.selected { background: rgba(26,58,110,.06); }
.people-selector-item .person-info { flex: 1; }
.people-selector-item .person-name { font-size: 14px; font-weight: 600; color: var(--text); }
.people-selector-item .person-role { font-size: 12px; color: var(--text2); }
.people-selector-item .check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 11px; transition: all var(--transition); }
.people-selector-item.selected .check { background: var(--primary); border-color: var(--primary); color: white; }

/* Selected people chips */
.selected-people { display: flex; flex-wrap: wrap; gap: 8px; min-height: 40px; }
.person-chip {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 20px;
}
.person-chip .chip-avatar { width: 28px; height: 28px; border-radius: 50%; overflow: hidden; flex-shrink: 0; }
.person-chip .chip-avatar img { width: 100%; height: 100%; object-fit: cover; }
.person-chip .chip-avatar .avatar-initial { font-size: 11px; font-weight: 700; color: white; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.person-chip .chip-name { font-size: 13px; font-weight: 600; color: var(--text); }
.person-chip .chip-remove { background: none; border: none; cursor: pointer; color: var(--text2); font-size: 12px; padding: 0; margin-left: 2px; }
.person-chip .chip-remove:hover { color: var(--red); }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
}
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
body.dark .badge-blue { background: #1e3a5f; color: #93c5fd; }
body.dark .badge-green { background: #14532d; color: #86efac; }
body.dark .badge-red { background: #7f1d1d; color: #fca5a5; }
body.dark .badge-orange { background: #7c2d12; color: #fdba74; }
body.dark .badge-purple { background: #3b0764; color: #c4b5fd; }
body.dark .badge-gray { background: #374151; color: #d1d5db; }
body.dark .badge-yellow { background: #451a03; color: #fcd34d; }

/* ===== NOTIFICATIONS PANEL ===== */
.notif-panel {
  position: fixed; top: var(--header-h); right: 0; width: 380px;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg); z-index: 200; height: calc(100vh - var(--header-h));
  display: flex; flex-direction: column; transform: translateX(100%);
  transition: transform var(--transition);
}
.notif-panel.open { transform: translateX(0); }
.notif-panel-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.notif-panel-header h3 { font-size: 16px; font-weight: 700; }
.notif-list { flex: 1; overflow-y: auto; }
.notif-item {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background var(--transition);
  display: flex; gap: 12px; align-items: flex-start;
  text-decoration: none;
}
.notif-item:hover { background: var(--hover); }
.notif-item.unread { background: var(--notification-unread); }
.notif-item.unread::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--primary);
}
.notif-item { position: relative; }
.notif-icon {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.notif-icon.blue { background: #dbeafe; color: #1d4ed8; }
.notif-icon.red { background: #fee2e2; color: #991b1b; }
.notif-icon.green { background: #dcfce7; color: #166534; }
.notif-icon.orange { background: #ffedd5; color: #9a3412; }
.notif-content { flex: 1; }
.notif-title { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.4; }
.notif-desc { font-size: 12px; color: var(--text2); margin-top: 2px; line-height: 1.4; }
.notif-time { font-size: 11px; color: var(--text2); margin-top: 4px; }
.notif-demand-link {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 6px; padding: 4px 10px; border-radius: 6px;
  background: var(--primary); color: white; font-size: 11px; font-weight: 600;
  border: none; cursor: pointer; transition: all var(--transition);
}
.notif-demand-link:hover { background: var(--primary-light); }
.notif-empty { text-align: center; padding: 48px 20px; color: var(--text2); }
.notif-empty i { font-size: 48px; margin-bottom: 12px; display: block; }

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed; inset: 0; background: var(--overlay); z-index: 300;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; visibility: hidden; transition: all var(--transition);
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  background: var(--surface); border-radius: 16px; width: 100%; max-width: 720px;
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); transform: scale(.95) translateY(16px);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-sm .modal { max-width: 440px; }
.modal-lg .modal { max-width: 900px; }
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h2 { font-size: 18px; font-weight: 700; }
.modal-close { width: 32px; height: 32px; border-radius: 8px; border: none; background: var(--hover); color: var(--text2); font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all var(--transition); }
.modal-close:hover { background: var(--red); color: white; }
.modal-body { flex: 1; overflow-y: auto; padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ===== DEMAND DETAIL ===== */
.demand-detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 24px; }
@media (max-width: 768px) { .demand-detail-grid { grid-template-columns: 1fr; } }
.detail-section { margin-bottom: 20px; }
.detail-label { font-size: 11px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 6px; }
.detail-value { font-size: 14px; color: var(--text); line-height: 1.6; }

/* Material preview */
.material-preview-box {
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  background: var(--surface2); margin-bottom: 12px;
}
.material-preview-box img {
  width: 100%; max-height: 300px; object-fit: contain;
  background: #000; display: block;
}
.material-preview-box video {
  width: 100%; max-height: 300px; background: #000; display: block;
}
.material-preview-box audio { width: 100%; padding: 12px; display: block; }
.material-preview-box .file-icon-preview {
  padding: 32px; text-align: center; color: var(--text2);
}
.material-preview-box .file-icon-preview i { font-size: 48px; margin-bottom: 8px; display: block; }
.material-preview-box .file-icon-preview p { font-size: 13px; }
.material-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Approval steps */
.approval-steps { display: flex; flex-direction: column; gap: 12px; }
.approval-step {
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
}
.approval-step-header {
  padding: 12px 16px; display: flex; align-items: center; gap: 10px;
  background: var(--surface2);
}
.step-number {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.step-number.approved { background: var(--green); border-color: var(--green); color: white; }
.step-number.rejected { background: var(--red); border-color: var(--red); color: white; }
.step-number.pending { background: var(--border); color: var(--text2); }
.step-number.active { background: var(--primary); border-color: var(--primary); color: white; }
.step-title { font-size: 14px; font-weight: 600; flex: 1; }
.step-status { font-size: 12px; font-weight: 600; }
.approval-step-body { padding: 12px 16px; display: none; }
.approval-step.expanded .approval-step-body { display: block; }
.feedback-box {
  background: #fff3cd; border: 1px solid #ffc107; border-radius: 8px;
  padding: 10px 14px; margin-top: 8px;
  font-size: 13px; color: #856404;
}
body.dark .feedback-box { background: #451a03; border-color: #f59e0b; color: #fcd34d; }
.approval-restricted-msg {
  text-align: center; padding: 24px; color: var(--text2);
  border: 1.5px dashed var(--border); border-radius: 10px;
}
.approval-restricted-msg i { font-size: 32px; margin-bottom: 8px; display: block; }

/* ===== HISTORY LOG ===== */
.history-panel {
  position: fixed; top: 0; right: 0; width: 400px; height: 100vh;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg); z-index: 400;
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform var(--transition);
}
.history-panel.open { transform: translateX(0); }
.history-header { padding: 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.history-body { flex: 1; overflow-y: auto; padding: 20px; }
.history-timeline { position: relative; }
.history-timeline::before {
  content: ''; position: absolute; left: 16px; top: 0; bottom: 0;
  width: 2px; background: var(--border);
}
.timeline-item { display: flex; gap: 16px; margin-bottom: 20px; position: relative; }
.timeline-dot {
  width: 32px; height: 32px; border-radius: 50%; background: var(--surface);
  border: 2px solid var(--border); display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0; z-index: 1;
}
.timeline-dot.create { border-color: var(--primary); color: var(--primary); }
.timeline-dot.approve { border-color: var(--green); color: var(--green); }
.timeline-dot.reject { border-color: var(--red); color: var(--red); }
.timeline-dot.upload { border-color: var(--orange); color: var(--orange); }
.timeline-dot.assign { border-color: #8b5cf6; color: #8b5cf6; }
.timeline-content { flex: 1; padding-top: 4px; }
.timeline-action { font-size: 13px; font-weight: 600; color: var(--text); }
.timeline-meta { font-size: 12px; color: var(--text2); margin-top: 2px; }
.timeline-time { font-size: 11px; color: var(--text2); margin-top: 4px; }

/* ===== CALENDAR ===== */
.calendar-wrap { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.calendar-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.calendar-nav { display: flex; align-items: center; gap: 12px; }
.calendar-nav button { width: 32px; height: 32px; border: 1.5px solid var(--border); background: var(--surface); border-radius: 6px; cursor: pointer; color: var(--text2); font-size: 14px; display: flex; align-items: center; justify-content: center; transition: all var(--transition); }
.calendar-nav button:hover { border-color: var(--primary); color: var(--primary); }
.calendar-month { font-size: 16px; font-weight: 700; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.calendar-day-header { padding: 10px; text-align: center; font-size: 12px; font-weight: 700; color: var(--text2); border-bottom: 1px solid var(--border); }
.calendar-day {
  min-height: 80px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 6px; position: relative; cursor: pointer; transition: background var(--transition);
}
.calendar-day:hover { background: var(--hover); }
.calendar-day.other-month .day-num { color: var(--text2); opacity: .4; }
.calendar-day.today .day-num {
  background: var(--primary); color: white; border-radius: 50%;
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.day-num { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.cal-event {
  font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 4px;
  margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: white; cursor: pointer;
}

/* ===== PROFILE ===== */
.profile-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: var(--radius); padding: 32px; color: white;
  display: flex; align-items: center; gap: 24px; margin-bottom: 24px;
}
.profile-avatar-large {
  width: 96px; height: 96px; border-radius: 50%; overflow: hidden;
  border: 4px solid white; flex-shrink: 0;
}
.profile-avatar-large img { width: 100%; height: 100%; object-fit: cover; }
.profile-info h2 { font-size: 22px; font-weight: 700; }
.profile-info p { opacity: .8; font-size: 14px; margin-top: 4px; }

/* ===== ADMIN ===== */
.user-table { width: 100%; border-collapse: collapse; }
.user-table th { padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .6px; border-bottom: 2px solid var(--border); }
.user-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 14px; color: var(--text); }
.user-table tr:hover td { background: var(--hover); }
.user-status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ===== UTILITIES ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text2); }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.separator { height: 1px; background: var(--border); margin: 16px 0; }
.tag { display: inline-flex; padding: 2px 8px; background: var(--surface2); border: 1px solid var(--border); border-radius: 4px; font-size: 11px; color: var(--text2); }

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--border); border-radius: 10px; padding: 32px;
  text-align: center; cursor: pointer; transition: all var(--transition);
  background: var(--surface2);
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--primary); background: rgba(26,58,110,.04); }
.upload-zone i { font-size: 36px; color: var(--text2); margin-bottom: 10px; display: block; }
.upload-zone p { font-size: 14px; color: var(--text2); }
.upload-zone small { font-size: 12px; color: var(--text2); }
.uploaded-files { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.uploaded-file {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
.uploaded-file i { color: var(--primary); font-size: 18px; }
.uploaded-file-info { flex: 1; }
.uploaded-file-info .file-name { font-size: 13px; font-weight: 600; color: var(--text); }
.uploaded-file-info .file-size { font-size: 11px; color: var(--text2); }
.file-preview-thumb { width: 40px; height: 40px; border-radius: 6px; overflow: hidden; flex-shrink: 0; }
.file-preview-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-preview-thumb video { width: 100%; height: 100%; object-fit: cover; }

/* Toast notifications */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 16px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px;
  min-width: 300px; animation: toastIn .3s ease;
  font-size: 14px; color: var(--text);
}
.toast.success { border-left: 4px solid var(--green); }
.toast.error { border-left: 4px solid var(--red); }
.toast.info { border-left: 4px solid var(--primary); }
.toast.warn { border-left: 4px solid var(--orange); }
@keyframes toastIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }

/* Password toggle */
.input-with-toggle { position: relative; }
.input-with-toggle .form-control { padding-right: 40px; }
.input-with-toggle .toggle-pass { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--text2); font-size: 15px; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text2); }

/* Responsive */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-240px); width: 240px; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
}

/* Demand status bar */
.demand-status-bar { height: 4px; width: 100%; }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text2); }
.empty-state i { font-size: 56px; margin-bottom: 16px; display: block; opacity: .4; }
.empty-state h3 { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

/* Pending approval badge */
.pending-approval-banner {
  background: #fef9c3; border: 1px solid #fcd34d; border-radius: 8px;
  padding: 14px 16px; display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px; font-size: 14px; color: #92400e;
}
body.dark .pending-approval-banner { background: #451a03; border-color: #d97706; color: #fcd34d; }
