/* ===== DESIGN TOKENS ===== */
:root {
  --bg:              #F0F4F8;
  --panel:           #FFFFFF;
  --panel-alt:       #F8FAFC;
  --card:            #FFFFFF;

  --border:          #CBD5E1;
  --border-light:    #E2E8F0;

  --input-bg:        #FFFFFF;
  --input-focus:     #EFF6FF;
  --input-border:    #93C5FD;

  --primary:         #3B82F6;
  --primary-hover:   #2563EB;
  --primary-pressed: #1D4ED8;
  --primary-light:   #DBEAFE;
  --primary-text:    #1E40AF;

  --secondary:       #E2E8F0;
  --secondary-hover: #CBD5E1;

  --success:         #059669;
  --success-light:   #D1FAE5;
  --success-text:    #065F46;
  --warning:         #D97706;
  --warning-light:   #FEF3C7;
  --warning-text:    #92400E;
  --error:           #DC2626;
  --error-light:     #FEE2E2;
  --error-text:      #991B1B;
  --info:            #0284C7;
  --info-light:      #E0F2FE;
  --info-text:       #0C4A6E;

  --text:            #0F172A;
  --text-2:          #475569;
  --text-3:          #94A3B8;
  --text-white:      #FFFFFF;

  --nav-bg:          #FFFFFF;
  --nav-border:      #E2E8F0;
  --radius:          8px;
  --radius-lg:       12px;
  --shadow-sm:       0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:       0 4px 12px rgba(0,0,0,0.08);
}

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

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
  min-height: 100vh;
}

/* ===== NAVBAR ===== */
.navbar-simple {
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  gap: 1.5rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.nav-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 6px;
}

.brand-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  line-height: 1.1;
}

.brand-sub {
  font-size: 0.7rem;
  color: var(--text-3);
  display: block;
  font-weight: 400;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.nav-toggle span {
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.25s;
}

.nav-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px,5px); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px,-5px); }

.nav-menu {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex: 1;
}

.nav-center {
  display: flex;
  gap: 0.25rem;
  flex: 1;
  justify-content: center;
}

.nav-link {
  color: var(--text-2);
  text-decoration: none;
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
}

.nav-link:hover { color: var(--text); background: var(--panel-alt); }
.nav-link.active { color: var(--primary); background: var(--primary-light); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--text-white);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-details {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.user-name {
  color: var(--text);
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.2;
}

.user-role {
  color: var(--text-3);
  font-size: 0.75rem;
  line-height: 1.2;
}

.btn-logout-nav {
  background: transparent;
  color: var(--text-2);
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border);
  transition: all 0.15s;
  white-space: nowrap;
}

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

/* ===== MAIN ===== */
.app-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
}

.simple-layout .app-main { max-width: 100%; }

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-header h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
}

/* ===== CARDS / PANELS ===== */
.card, .table-container, .filters-card, .admin-section, .search-card, .results {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

/* ===== BUTTONS ===== */
.btn-primary {
  padding: 0.55rem 1.25rem;
  background: var(--primary);
  color: var(--text-white);
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover  { background: var(--primary-hover); }
.btn-primary:active { background: var(--primary-pressed); transform: scale(0.98); }

.btn-secondary {
  padding: 0.55rem 1.1rem;
  background: var(--panel);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.875rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover { background: var(--primary-light); border-color: var(--input-border); color: var(--primary-hover); }

.primary-button   { @extend .btn-primary; border-radius: 999px; }
.secondary-button { @extend .btn-secondary; border-radius: 999px; }

.btn-filter {
  padding: 0.55rem 1.1rem;
  background: var(--primary);
  color: var(--text-white);
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s;
  height: 38px;
}
.btn-filter:hover { background: var(--primary-hover); }

.btn-clear {
  padding: 0.55rem 1.1rem;
  background: var(--panel);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  height: 38px;
  transition: background 0.15s;
}
.btn-clear:hover { background: var(--panel-alt); }

.btn-icon {
  background: var(--primary-light);
  border: none;
  color: var(--primary-text);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.3rem 0.7rem;
  border-radius: 5px;
  transition: all 0.15s;
  margin-right: 0.2rem;
}
.btn-icon:hover { background: var(--primary); color: var(--text-white); }
.btn-icon-green { background: #D1FAE5; color: var(--success-text); }
.btn-icon-green:hover { background: var(--success); color: var(--text-white); }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}
.badge-area    { background: var(--primary-light); color: var(--primary-text); border: 1px solid #BFDBFE; }
.badge-success { background: var(--success-light); color: var(--success-text); border: 1px solid #6EE7B7; }
.badge-error   { background: var(--error-light);   color: var(--error-text);   border: 1px solid #FCA5A5; }
.badge-info    { background: var(--info-light);    color: var(--info-text);    border: 1px solid #7DD3FC; }
.badge-warning { background: var(--warning-light); color: var(--warning-text); border: 1px solid #FCD34D; }
.badge-large   { padding: 0.3rem 0.75rem; font-size: 0.8rem; }

.status-badge    { display: inline-flex; align-items: center; padding: 0.25rem 0.65rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.status-active   { background: var(--success-light); color: var(--success-text); border: 1px solid #6EE7B7; }
.status-inactive { background: var(--error-light);   color: var(--error-text);   border: 1px solid #FCA5A5; }

/* ===== ALERTS ===== */
.alert {
  padding: 0.875rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.alert-success { background: var(--success-light); color: var(--success-text); border: 1px solid #6EE7B7; }
.alert-error   { background: var(--error-light);   color: var(--error-text);   border: 1px solid #FCA5A5; }

/* ===== FORMS ===== */
.form-field { display: flex; flex-direction: column; gap: 0.3rem; }
.form-field label { font-size: 0.82rem; color: var(--text-2); font-weight: 500; }

.form-field input,
.form-field select,
.form-field textarea,
.filter-group select,
.filter-group input {
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); background: var(--input-focus); }
.form-field input::placeholder { color: var(--text-3); }
.field-error { font-size: 0.78rem; color: var(--error); }

/* ===== TABLE ===== */
.table-container { overflow: hidden; }

.data-table { width: 100%; border-collapse: collapse; }

.data-table thead { background: var(--panel-alt); }

.data-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.data-table td {
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--panel-alt); }

/* ===== STATS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  padding: 1.25rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--primary); margin-bottom: 0.25rem; }
.stat-label { font-size: 0.8rem; color: var(--text-2); }

/* ===== FILTERS ===== */
.filters-card { padding: 1.1rem 1.25rem; }
.filters-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.75rem; align-items: end; }
.filter-group { display: flex; flex-direction: column; gap: 0.3rem; }
.filter-group label { font-size: 0.78rem; font-weight: 500; color: var(--text-2); }
.filter-actions { display: flex; gap: 0.5rem; }

/* ===== MODALS ===== */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  inset: 0;
  background: rgba(0,0,0,0.4);
  align-items: center;
  justify-content: center;
}
.modal.active { display: flex; }

.modal-content {
  background: var(--panel);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 20px 40px rgba(0,0,0,0.15);
  border: 1px solid var(--border-light);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--border-light);
}
.modal-header h3 { font-size: 1rem; font-weight: 600; color: var(--text); }

.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-3);
  cursor: pointer;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
  transition: all 0.15s;
}
.modal-close:hover { background: var(--panel-alt); color: var(--text); }

.modal-body   { padding: 1.25rem 1.4rem; }
.modal-footer { display: flex; justify-content: flex-end; gap: 0.6rem; padding: 1.1rem 1.4rem; border-top: 1px solid var(--border-light); }

/* ===== AUTH ===== */
.auth-page { display: flex; justify-content: center; align-items: flex-start; min-height: 100vh; background: var(--bg); }

.auth-card {
  max-width: 400px;
  width: 100%;
  margin: 3rem auto;
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
}

.auth-illustration { display: flex; justify-content: center; margin-bottom: 1.25rem; }
.auth-illustration-img { width: 64px; height: auto; }
.auth-title    { font-size: 1.25rem; font-weight: 700; color: var(--text); margin-bottom: 0.25rem; }
.auth-subtitle { font-size: 0.875rem; color: var(--text-2); margin-bottom: 1.25rem; }
.auth-form     { display: flex; flex-direction: column; gap: 1rem; }
.auth-actions  { margin-top: 0.5rem; display: flex; flex-direction: column; gap: 0.5rem; }

/* ===== ADMIN TABS ===== */
.tabs-container { background: var(--panel); border-radius: var(--radius-lg); border: 1px solid var(--border-light); overflow: hidden; }
.tabs { display: flex; border-bottom: 1px solid var(--border-light); }
.tab-btn {
  flex: 1;
  padding: 0.875rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
}
.tab-btn:hover  { background: var(--panel-alt); color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content        { display: none; }
.tab-content.active { display: block; }

.admin-section { padding: 1.25rem; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.section-header h2 { font-size: 1rem; font-weight: 600; color: var(--text); }

/* ===== MISC ===== */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--text-2); }

.search-filters-container {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  padding: 1.1rem 1.25rem;
}
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.875rem; color: var(--text-2); }
.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }

.id-badge { background: var(--panel-alt); color: var(--text-2); font-size: 0.75rem; font-weight: 700; padding: 0.2rem 0.5rem; border-radius: 4px; font-family: monospace; border: 1px solid var(--border-light); }

/* ===== BRAND ===== */
.brand { display: flex; align-items: center; gap: 0.75rem; }
.brand-mark { width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--primary); color: var(--text-white); font-weight: 700; font-size: 0.85rem; display: flex; align-items: center; justify-content: center; }
.brand-text h1 { font-size: 1.1rem; color: var(--text); }
.brand-text p  { font-size: 0.8rem; color: var(--text-2); }

/* ===== FOOTER ===== */
.app-footer { padding: 1rem 1.5rem; text-align: center; font-size: 0.75rem; color: var(--text-3); border-top: 1px solid var(--border-light); background: var(--panel); }

/* ===== ANIMATIONS ===== */
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.6; } }

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  .nav-container { padding: 0 1rem; }
  .app-main { padding: 1.25rem 1rem; }
}

@media (max-width: 1024px) {
  .nav-container { height: auto; min-height: 56px; padding: 0.75rem 1rem; }
  .nav-toggle { display: flex; }
  .nav-menu {
    position: fixed;
    top: 56px; left: 0; right: 0;
    background: var(--panel);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
    pointer-events: none;
  }
  .nav-menu.active { max-height: 600px; padding: 1rem; pointer-events: auto; }
  .nav-center { flex-direction: column; gap: 0; justify-content: flex-start; }
  .nav-link { padding: 0.875rem 1rem; width: 100%; border-radius: 4px; }
  .nav-actions { 
    flex-direction: column; 
    gap: 0.75rem; 
    padding-top: 1rem; 
    border-top: 1px solid var(--border-light); 
    width: 100%;
  }
  .user-info {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--panel-alt);
    border-radius: 6px;
  }
  .user-details { align-items: flex-start; width: 100%; }
  .btn-logout-nav { text-align: center; width: 100%; padding: 0.75rem 1rem; }
}

@media (max-width: 768px) {
  .app-main { padding: 1rem 0.75rem; }
  .page-header { flex-direction: column; align-items: stretch; gap: 0.75rem; }
  .page-header h1 { font-size: 1.15rem; }
  
  .stats-grid { grid-template-columns: repeat(2,1fr); gap: 0.75rem; }
  .stat-card { padding: 1rem 1.25rem; }
  .stat-value { font-size: 1.5rem; }
  .stat-label { font-size: 0.75rem; }
  
  .filters-form { grid-template-columns: 1fr; gap: 0.75rem; }
  .filter-actions { flex-direction: column; }
  .btn-filter, .btn-clear { width: 100%; }
  
  .data-table { min-width: 800px; font-size: 0.8rem; }
  .data-table th, .data-table td { padding: 0.6rem 0.75rem; }
  .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  
  .tabs { flex-wrap: wrap; }
  .tab-btn { flex: 1 1 auto; min-width: 120px; padding: 0.75rem 0.75rem; font-size: 0.8rem; }
  
  .modal-content { width: 95%; max-width: none; }
  .modal-header, .modal-body, .modal-footer { padding: 1rem; }
  
  .admin-section { padding: 1rem; }
  .section-header { flex-direction: column; align-items: stretch; gap: 0.75rem; }
  
  .filters-card { padding: 1rem; }
  .search-filters-container { padding: 1rem; }
  
  .btn-primary, .btn-secondary { padding: 0.65rem 1rem; font-size: 0.85rem; }
}

@media (max-width: 640px) {
  .nav-logo { width: 28px; height: 28px; }
  .brand-name { font-size: 0.85rem; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
  .brand-sub { display: none; }
  
  .app-main { padding: 0.75rem 0.5rem; }
  
  .stats-grid { grid-template-columns: 1fr; gap: 0.75rem; }
  
  .card, .table-container, .filters-card, .admin-section, .search-card, .results {
    border-radius: var(--radius);
    margin-left: -0.5rem;
    margin-right: -0.5rem;
  }
  
  .page-header h1 { font-size: 1rem; }
  
  .data-table { font-size: 0.75rem; }
  .data-table th, .data-table td { padding: 0.5rem 0.5rem; }
  
  .badge, .status-badge { font-size: 0.7rem; padding: 0.2rem 0.5rem; }
  
  .btn-icon { font-size: 0.7rem; padding: 0.25rem 0.5rem; }
  
  .modal-content { width: 100%; height: 100%; max-height: 100vh; border-radius: 0; }
  
  .auth-card { margin: 1rem; padding: 1.5rem; }
  
  .empty-state { padding: 2rem 1rem; font-size: 0.875rem; }
}

@media (max-width: 480px) {
  .brand-name { max-width: 140px; font-size: 0.8rem; }
  .nav-logo { width: 26px; height: 26px; }
  
  .user-name { font-size: 0.85rem; }
  .user-role { font-size: 0.7rem; }
  
  .btn-primary, .btn-secondary { font-size: 0.8rem; }
  
  .stat-value { font-size: 1.35rem; }
  .stat-label { font-size: 0.7rem; }
  
  .tab-btn { font-size: 0.75rem; padding: 0.65rem 0.5rem; min-width: 100px; }
}
