/* ============================================================
   Maalomatia Entity Engagement Portal - Complete Stylesheet
   Inspired by Microsoft SharePoint / Enterprise Dashboard
   ============================================================ */

/* ============================================================
   CSS VARIABLES
   ============================================================ */
:root {
  --primary: #4F46E5;
  --primary-dark: #4338CA;
  --primary-light: #EEF2FF;
  --secondary: #475569;
  --success: #10B981;
  --success-light: #D1FAE5;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --info: #3B82F6;
  --info-light: #DBEAFE;
  --bg-main: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-sidebar: #FFFFFF;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --sidebar-width: 260px;
  --topbar-height: 72px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html {
  font-size: 14px;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: var(--primary);
}

a:hover {
  text-decoration: underline;
}

code {
  background: #f3f2f1;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0F172A 0%, #1E1B4B 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  padding: 40px;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-img {
  height: 64px;
  width: auto;

  display: block;
  object-fit: contain;
}

.login-logo-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #0078d4, #106ebe);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: white;
  font-size: 28px;
}

.login-logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.login-logo p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 4px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font-sans);
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
  color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.15);
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

.input-with-icon {
  position: relative;
}

.input-with-icon input {
  width: 100%;
  padding-right: 44px;
}

.toggle-pw {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
}

.btn-full {
  width: 100%;
}

.login-hints {
  margin-top: 24px;
  padding: 16px;
  background: var(--bg-main);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* ============================================================
   APP SHELL
   ============================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.sidebar-logo-img {
  height: 36px;
  width: auto;
  display: block;
  object-fit: contain;
}

.sidebar-logo>i {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #0078d4, #106ebe);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
}

/* .sidebar-title removed */

.sidebar-subtitle {
  font-size: 8px;
  font-weight: 900;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--primary-light);
  color: var(--primary);
  text-decoration: none;
}

.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}

.nav-item i {
  width: 18px;
  text-align: center;
  font-size: 14px;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-main);
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: capitalize;
}

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

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

/* .topbar-left removed */

.topbar-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.topbar-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.topbar-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

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

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-sans);
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-outline {
  background: #fff;
  color: var(--primary);
  border-color: var(--border-strong);
}

.btn-outline:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  font-size: 14px;
}

.btn-icon:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: #faf9f8;
}

.card-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-header h3 i {
  color: var(--primary);
}

.card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.card-body {
  padding: 16px;
}

.card-body.no-pad {
  padding: 0;
}

/* ============================================================
   KPI CARDS
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 20px;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.kpi-card:hover {
  box-shadow: var(--shadow-md);
}

.kpi-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.kpi-warning {
  color: var(--danger);
}

.kpi-alert-icon {
  font-size: 1.5rem;
  color: #d83b01;
}

.kpi-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
  font-weight: 500;
  line-height: 1.3;
}

.kpi-icon {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 24px;
  opacity: 0.2;
}

/* ============================================================
   DASHBOARD GRID
   ============================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
}

.dashboard-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dashboard-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap {
  overflow-x: auto;
  width: 100%;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead {
  background: #faf9f8;
}

.data-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: #faf9f8;
}

.empty-cell {
  text-align: center;
  color: var(--text-muted);
  padding: 24px !important;
}

/* ============================================================
   BADGES & CHIPS
   ============================================================ */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.status-large {
  padding: 6px 16px;
  font-size: 13px;
}

.sector-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.priority-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.priority-low {
  background: #D1FAE5;
  color: #065F46;
}

.priority-medium {
  background: #FEF3C7;
  color: #92400E;
}

.priority-high {
  background: #FEE2E2;
  color: #991B1B;
}

.priority-critical {
  background: #FEE2E2;
  color: #7F1D1D;
  font-weight: 800;
}

.level-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.level-high {
  background: #FEE2E2;
  color: #991B1B;
}

.level-medium {
  background: #FEF3C7;
  color: #92400E;
}

.level-low {
  background: #D1FAE5;
  color: #065F46;
}

.risk-badge {
  background: #FEE2E2;
  color: #991B1B;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.ok-badge {
  background: #D1FAE5;
  color: #065F46;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.risk-large {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 800;
}

.badge-primary {
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.badge-count {
  background: #FEE2E2;
  color: #991B1B;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}

.type-badge {
  background: #EDE9FE;
  color: #5B21B6;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.escalated-badge {
  background: #FEE2E2;
  color: #7F1D1D;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.role-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}

.role-admin {
  background: #FEE2E2;
  color: #991B1B;
}

.role-manager {
  background: #DBEAFE;
  color: #1E40AF;
}

.role-analyst {
  background: #D1FAE5;
  color: #065F46;
}

.role-viewer {
  background: #F3F4F6;
  color: #374151;
}

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-bar-wrap {
  display: inline-block;
  width: 80px;
  height: 8px;
  background: #f3f2f1;
  border-radius: 4px;
  overflow: hidden;
  vertical-align: middle;
  margin-right: 6px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}

.progress-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ============================================================
   AVATARS
   ============================================================ */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.avatar-xs {
  width: 28px;
  height: 28px;
  font-size: 10px;
}

.avatar-sm {
  width: 30px;
  height: 30px;
  font-size: 11px;
}

.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 18px;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============================================================
   OWNER CHIP
   ============================================================ */
.owner-chip {
  display: inline-block;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.comment-cell {
  max-width: 200px;
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sub-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================================
   TIMELINE WIDGET
   ============================================================ */
.timeline-widget {
  font-size: 12px;
}

.timeline-header {
  display: flex;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.timeline-entity-col {
  width: 80px;
  flex-shrink: 0;
}

.timeline-month {
  flex: 1;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.timeline-row {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  gap: 8px;
}

.timeline-entity-name {
  width: 80px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-bar-area {
  flex: 1;
  height: 20px;
  background: #f3f2f1;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.timeline-bar {
  height: 100%;
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding: 0 6px;
  min-width: 30px;
  transition: width 0.5s ease;
}

.timeline-bar-label {
  font-size: 10px;
  color: white;
  font-weight: 700;
  white-space: nowrap;
}

/* ============================================================
   WORKSHOP TRACKER
   ============================================================ */
.workshop-tracker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.workshop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: #faf9f8;
  border: 1px solid var(--border);
}

.workshop-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f2f1;
  color: var(--text-muted);
  font-size: 12px;
  flex-shrink: 0;
}

.workshop-check.done {
  background: var(--success-light);
  color: var(--success);
}

.workshop-check.in-progress {
  background: var(--primary-light);
  color: var(--primary);
}

.workshop-type {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
}

/* ============================================================
   CONTACTS
   ============================================================ */
.contacts-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contact-card-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: #faf9f8;
  border: 1px solid var(--border);
}

/* .contact-info removed */

.contact-name {
  font-size: 12px;
  font-weight: 600;
}

.contact-org {
  font-size: 11px;
  color: var(--text-muted);
}

.contacts-directory {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.contact-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.contact-card:hover {
  box-shadow: var(--shadow-md);
}

.contact-avatar {
  position: relative;
}

.contact-role-badge {
  position: absolute;
  bottom: -2px;
  right: -8px;
  background: var(--primary-light);
  color: var(--primary);
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: capitalize;
  white-space: nowrap;
}

.contact-details {
  flex: 1;
  min-width: 0;
}

.contact-details h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}

.contact-details>div {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ============================================================
   ACTIVITY FEED
   ============================================================ */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: #faf9f8;
  border: 1px solid var(--border);
}

.activity-text {
  flex: 1;
  font-size: 12px;
  line-height: 1.5;
}

.activity-user {
  font-weight: 700;
}

.activity-action {
  color: var(--text-secondary);
}

.activity-entity {
  font-weight: 600;
  color: var(--primary);
}

.activity-comment {
  color: var(--text-secondary);
  margin-top: 2px;
  font-style: italic;
}

.activity-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ============================================================
   ENTITY DETAIL
   ============================================================ */
.entity-header-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.entity-header-left {
  flex: 1;
}

.entity-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.entity-header-left h2 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 8px;
}

.entity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 8px;
}

.entity-meta span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.entity-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
}

.entity-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.progress-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.progress-kpi-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.progress-kpi-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.progress-kpi-value {
  font-size: 28px;
  font-weight: 800;
  margin: 6px 0;
}

.progress-kpi-bar {
  background: #f3f2f1;
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
}

/* ============================================================
   DETAIL TABS
   ============================================================ */
.detail-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 10px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: -2px;
  font-family: var(--font-sans);
}

.tab-btn:hover {
  color: var(--primary);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ============================================================
   INFO GRID
   ============================================================ */
.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-item label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.info-item span {
  font-size: 13px;
  color: var(--text-primary);
}

.info-item.full-width {
  grid-column: 1 / -1;
}

/* ============================================================
   COMMENT LIST
   ============================================================ */
.comment-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comment-item {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: #faf9f8;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.comment-body {
  flex: 1;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.comment-header strong {
  font-size: 12px;
}

.comment-header span {
  font-size: 11px;
  color: var(--text-muted);
}

.comment-body p {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ============================================================
   RISK MATRIX
   ============================================================ */
.risk-matrix {
  font-size: 12px;
  position: relative;
}

.matrix-grid {
  display: grid;
  grid-template-columns: 60px repeat(3, 1fr);
  gap: 3px;
}

.matrix-corner,
.matrix-col-header,
.matrix-row-header {
  padding: 8px;
  font-weight: 700;
  font-size: 11px;
  text-align: center;
  color: var(--text-secondary);
}

.matrix-cell {
  padding: 10px;
  border-radius: 4px;
  min-height: 60px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.matrix-risk-dot {
  font-size: 18px;
  cursor: default;
  color: #EF4444;
}

.matrix-y-label {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.matrix-x-label {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ============================================================
   WORKSHOP SUMMARY
   ============================================================ */
.workshop-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.workshop-summary-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.workshop-summary-card.card-done {
  border-color: #A7F3D0;
  background: #F0FDF4;
}

.ws-icon {
  font-size: 20px;
  color: var(--text-muted);
}

.ws-icon.done {
  color: var(--success);
}

.ws-type {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

.ws-count {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ============================================================
   REPORTS PAGE
   ============================================================ */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.report-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
}

.report-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.report-info {
  flex: 1;
}

.report-info h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}

.report-info p {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ============================================================
   CHARTS
   ============================================================ */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.chart-wrap {
  position: relative;
  height: 250px;
}

/* ============================================================
   TWO COLUMN GRID
   ============================================================ */
.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ============================================================
   FILTERS
   ============================================================ */
.page-filters {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-input {
  padding: 8px 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-sans);
  min-width: 200px;
  transition: border-color 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
}

.filter-select {
  padding: 8px 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-sans);
  background: #fff;
  cursor: pointer;
}

/* ============================================================
   ENTITY LINK
   ============================================================ */
.entity-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.entity-link:hover {
  text-decoration: none;
}

.entity-link strong {
  color: var(--primary);
  font-size: 13px;
}

.entity-code {
  font-size: 11px;
  color: var(--text-muted);
}

/* ============================================================
   STATUS DOT
   ============================================================ */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.risk-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  font-size: 10px;
  margin-right: 4px;
  background: #FEE2E2;
  color: #991B1B;
}

.risk-icon.escalated {
  background: #FEE2E2;
}

.color-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

/* ============================================================
   ACTIONS CELL
   ============================================================ */
.actions-cell {
  white-space: nowrap;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-box {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #faf9f8;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid .form-group.full-width {
  grid-column: 1 / -1;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 350px;
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.3s;
  border-left: 4px solid var(--primary);
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-success {
  border-left-color: var(--success);
}

.toast-success i {
  color: var(--success);
}

.toast-error {
  border-left-color: var(--danger);
}

.toast-error i {
  color: var(--danger);
}

/* ============================================================
   LOADING STATE
   ============================================================ */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--text-muted);
  font-size: 14px;
  gap: 12px;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 32px;
  font-size: 13px;
}

.error-state {
  text-align: center;
  padding: 60px;
  color: var(--danger);
}

.error-state i {
  font-size: 32px;
  display: block;
  margin-bottom: 12px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1400px) {
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .workshop-summary-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1100px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .progress-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .two-col-grid {
    grid-template-columns: 1fr;
  }

  .reports-grid {
    grid-template-columns: 1fr;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
  }

  .sidebar {
    display: none;
  }

  .main-content {
    margin-left: 0;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .progress-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .page-content {
    padding: 12px;
  }

  .entity-header-card {
    flex-direction: column;
    gap: 12px;
  }

  .entity-header-right {
    align-items: flex-start;
  }
}

/* ============================================================
   SCROLLBAR STYLING
   ============================================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #d2d0ce;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a19f9d;
}

/* ============================================================
   PUBLIC DASHBOARD & INTERNAL LOGIN
   ============================================================ */
.dashboard-charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.chart-card {
  height: 350px;
}

.chart-card .card-body {
  height: 280px;
  position: relative;
}

.login-container-internal {
  padding: 48px 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
}

.guest-card {
  padding: 16px;
  text-align: center;
}

@media (max-width: 768px) {
  .dashboard-charts-row {
    grid-template-columns: 1fr;
  }
}