@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Lora:ital,wght@0,500;0,600;0,700;1,500&display=swap');
@import 'tailwindcss';

:root {
  --c-primary: #B8641A;
  --c-primary-dark: #8B4513;
  --c-primary-light: #D2691E;
  --c-primary-faint: #F5EDE3;
  --c-bg: #F8F5F1;
  --c-surface: #FFFFFF;
  --c-border: #E8D8C8;
  --c-border-strong: #D4BAA0;
  --c-text: #2B211B;
  --c-text-secondary: #6F6259;
  --c-text-tertiary: #9E8B7E;
  --c-success: #3A7A5A;
  --c-success-bg: #EBF5EE;
  --c-warning: #A07010;
  --c-warning-bg: #FEF8E8;
  --c-danger: #B03030;
  --c-danger-bg: #FDEAEA;
  --c-info: #2A618C;
  --c-info-bg: #EAF2FA;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(43,33,27,0.06), 0 1px 2px rgba(43,33,27,0.04);
  --shadow-md: 0 4px 12px rgba(43,33,27,0.08), 0 2px 4px rgba(43,33,27,0.04);
}

html, body, #root {
  height: 100%;
}

body {
  font-family: 'Inter', sans-serif;
  color: var(--c-text);
  background-color: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

.font-display {
  font-family: 'Lora', serif;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--c-text-tertiary); }

/* Sidebar */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
}

.sidebar-group-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-text-tertiary);
  padding: 16px 16px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  margin: 1px 8px;
  font-size: 14px;
  color: var(--c-text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}

.nav-item:hover {
  background: var(--c-bg);
  color: var(--c-text);
}

.nav-item.active {
  background: var(--c-primary-faint);
  color: var(--c-primary);
  font-weight: 600;
}

.nav-item.active .nav-icon {
  color: var(--c-primary);
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--c-text-tertiary);
}

/* Cards */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.card-hover {
  transition: box-shadow 0.2s, border-color 0.2s;
}
.card-hover:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--c-border-strong);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
  white-space: nowrap;
}

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

.btn-secondary {
  background: var(--c-surface);
  color: var(--c-text);
  border-color: var(--c-border);
}
.btn-secondary:hover { background: var(--c-bg); border-color: var(--c-border-strong); }

.btn-ghost {
  background: transparent;
  color: var(--c-text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--c-bg); color: var(--c-text); }

.btn-danger {
  background: var(--c-surface);
  color: var(--c-danger);
  border-color: var(--c-border);
}
.btn-danger:hover { background: var(--c-danger-bg); border-color: var(--c-danger); }

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

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--c-text-tertiary);
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}

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

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

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

/* Badges / Status */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 20px;
}

.badge-success { background: var(--c-success-bg); color: var(--c-success); }
.badge-warning { background: var(--c-warning-bg); color: var(--c-warning); }
.badge-danger  { background: var(--c-danger-bg);  color: var(--c-danger); }
.badge-info    { background: var(--c-info-bg);    color: var(--c-info); }
.badge-neutral { background: var(--c-bg); color: var(--c-text-secondary); border: 1px solid var(--c-border); }

/* Form elements */
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text);
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--c-danger);
  margin-left: 2px;
}

.form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--c-text);
  background: var(--c-surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: 'Inter', sans-serif;
  outline: none;
}

.form-input:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(184,100,26,0.12);
}

.form-input::placeholder { color: var(--c-text-tertiary); }

.form-input:disabled {
  background: var(--c-bg);
  color: var(--c-text-secondary);
  cursor: not-allowed;
}

.form-error {
  font-size: 12px;
  color: var(--c-danger);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-hint {
  font-size: 12px;
  color: var(--c-text-tertiary);
  margin-top: 4px;
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236F6259' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea.form-input {
  resize: vertical;
  min-height: 90px;
}

/* Tabs */
.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--c-border);
  gap: 0;
}

.tab-item {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--c-text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.tab-item:hover { color: var(--c-text); }

.tab-item.active {
  color: var(--c-primary);
  border-bottom-color: var(--c-primary);
  font-weight: 600;
}

/* Filter bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* KPI card */
.kpi-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}

.kpi-value {
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  color: var(--c-text);
  margin: 8px 0 4px;
}

.kpi-label {
  font-size: 13px;
  color: var(--c-text-secondary);
}

.kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Rank badges */
.rank-1 { color: #8B6914; font-weight: 700; }
.rank-2 { color: #5A6878; font-weight: 700; }
.rank-3 { color: #7A4A2A; font-weight: 700; }

/* Timeline */
.timeline-item {
  display: flex;
  gap: 14px;
  padding-bottom: 20px;
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 28px;
  bottom: 0;
  width: 1px;
  background: var(--c-border);
}

.timeline-item:last-child::before { display: none; }

.timeline-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  border: 1.5px solid;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(43,33,27,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}

.modal {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(43,33,27,0.2);
  width: 440px;
  max-width: 95vw;
  padding: 28px;
}

/* Page header */
.page-header {
  margin-bottom: 24px;
}

.page-title {
  font-family: 'Lora', serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--c-text);
}

.page-subtitle {
  font-size: 14px;
  color: var(--c-text-secondary);
  margin-top: 4px;
}

/* Topbar */
.topbar {
  height: 60px;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--c-text-secondary);
}

.empty-state svg {
  margin: 0 auto 16px;
  opacity: 0.4;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text-secondary);
  transition: all 0.15s;
}

.page-btn:hover { border-color: var(--c-border-strong); color: var(--c-text); }
.page-btn.active { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Notification dot */
.notif-dot {
  width: 8px;
  height: 8px;
  background: var(--c-danger);
  border-radius: 50%;
  position: absolute;
  top: 2px;
  right: 2px;
  border: 1.5px solid white;
}

/* Simple bar chart */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 120px;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}

.bar-fill {
  width: 100%;
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: opacity 0.2s;
}

.bar-fill:hover { opacity: 0.8; }

.bar-label {
  font-size: 11px;
  color: var(--c-text-tertiary);
  white-space: nowrap;
}

.bar-value {
  font-size: 11px;
  font-weight: 600;
  color: var(--c-text-secondary);
}
 
 / *   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =   * /  
 / *   M O B I L E   R E S P O N S I V E   ( M A X - W I D T H :   7 6 8 p x )   * /  
 / *   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =   * /  
  
 . s i d e b a r - o v e r l a y   {  
         p o s i t i o n :   f i x e d ;  
         t o p :   0 ;  
         l e f t :   0 ;  
         w i d t h :   1 0 0 v w ;  
         h e i g h t :   1 0 0 v h ;  
         b a c k g r o u n d :   r g b a ( 0 ,   0 ,   0 ,   0 . 4 ) ;  
         z - i n d e x :   9 9 9 ;  
         o p a c i t y :   0 ;  
         v i s i b i l i t y :   h i d d e n ;  
         t r a n s i t i o n :   0 . 3 s   e a s e ;  
 }  
 . s i d e b a r - o v e r l a y . a c t i v e   {  
         o p a c i t y :   1 ;  
         v i s i b i l i t y :   v i s i b l e ;  
 }  
  
 . t a b l e - r e s p o n s i v e   {  
         o v e r f l o w - x :   a u t o ;  
         - w e b k i t - o v e r f l o w - s c r o l l i n g :   t o u c h ;  
         w i d t h :   1 0 0 % ;  
         m a r g i n - b o t t o m :   1 r e m ;  
 }  
 . t a b l e - r e s p o n s i v e   . d a t a - t a b l e   {  
         m i n - w i d t h :   6 0 0 p x ;   / *   F o r c e   s c r o l l   i f   s c r e e n   i s   t o o   s m a l l   * /  
 }  
  
 / *   B a s e   s t y l e   f o r   m o b i l e   b u t t o n   * /  
 . m o b i l e - m e n u - b t n   {  
         d i s p l a y :   n o n e ;  
         b a c k g r o u n d :   t r a n s p a r e n t ;  
         b o r d e r :   n o n e ;  
         f o n t - s i z e :   2 0 p x ;  
         c o l o r :   v a r ( - - c - t e x t ) ;  
         c u r s o r :   p o i n t e r ;  
         p a d d i n g :   8 p x ;  
         m a r g i n - r i g h t :   1 2 p x ;  
 }  
  
 @ m e d i a   ( m a x - w i d t h :   7 6 8 p x )   {  
         . s i d e b a r   {  
                 p o s i t i o n :   f i x e d   ! i m p o r t a n t ;  
                 l e f t :   - 2 6 0 p x ;  
                 t o p :   0 ;  
                 h e i g h t :   1 0 0 v h ;  
                 z - i n d e x :   1 0 0 0 ;  
                 t r a n s i t i o n :   l e f t   0 . 3 s   e a s e ;  
                 b o x - s h a d o w :   2 p x   0   8 p x   r g b a ( 0 , 0 , 0 , 0 . 1 ) ;  
         }  
          
         . s i d e b a r . o p e n   {  
                 l e f t :   0 ;  
         }  
  
         . t o p b a r   {  
                 p a d d i n g :   0   1 6 p x   ! i m p o r t a n t ;  
         }  
  
         / *   C o n v e r t   G r i d s   t o   s i n g l e   c o l u m n   * /  
         d i v [ s t y l e * = " g r i d - t e m p l a t e - c o l u m n s " ]   {  
                 g r i d - t e m p l a t e - c o l u m n s :   1 f r   ! i m p o r t a n t ;  
         }  
          
         / *   R e s p o n s i v e   M o d a l   * /  
         . m o d a l - c o n t e n t   {  
                 w i d t h :   9 5 %   ! i m p o r t a n t ;  
                 m a x - w i d t h :   9 5 %   ! i m p o r t a n t ;  
                 m a r g i n :   2 0 p x   a u t o ;  
         }  
          
         . m o b i l e - m e n u - b t n   {  
                 d i s p l a y :   b l o c k   ! i m p o r t a n t ;  
         }  
 }  
 
/* ========================================================= */
/* MOBILE RESPONSIVE (MAX-WIDTH: 768px) */
/* ========================================================= */

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s ease;
}
.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    margin-bottom: 1rem;
}
.table-responsive .data-table {
    min-width: 600px; /* Force scroll if screen is too small */
}

/* Base style for mobile button */
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    font-size: 20px;
    color: var(--c-text);
    cursor: pointer;
    padding: 8px;
    margin-right: 12px;
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed !important;
        left: -260px;
        top: 0;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 2px 0 8px rgba(0,0,0,0.1);
    }
    
    .sidebar.open {
        left: 0;
    }

    .topbar {
        padding: 0 16px !important;
    }

    /* Convert Grids to single column */
    div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
    
    /* Responsive Modal */
    .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 20px auto;
    }
    
    .mobile-menu-btn {
        display: block !important;
    }
}

/* CSS Fixes for mobile Topbar and Sidebar close button */
@media (max-width: 768px) {
    /* Hide breadcrumbs on mobile to save space */
    .topbar > div:first-of-type > div:nth-child(2) {
        display: none !important;
    }
    
    /* Hide role text on mobile in topbar */
    #topbar-role, .topbar-role-text {
        display: none !important;
    }
    
    /* Make topbar name smaller */
    #topbar-name {
        font-size: 11px !important;
    }
    
    .sidebar-close-btn {
        display: block !important;
        position: absolute;
        top: 15px;
        right: 15px;
        background: transparent;
        border: none;
        font-size: 20px;
        color: var(--c-text);
        cursor: pointer;
    }
}
.sidebar-close-btn { display: none; }
