:root{
  --bg:#f5f7fb;
  --panel:#ffffff;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --border:rgba(15,23,42,.08);

  --brand:#7c3aed;
  --brand2:#22c55e;
  --soft:rgba(124,58,237,.08);

  --shadow:0 12px 30px rgba(15,23,42,.08);
  --radius:18px;
}

*{ box-sizing:border-box; }

body{
  background:
    radial-gradient(900px 500px at 10% 0%, rgba(124,58,237,.08), transparent 60%),
    radial-gradient(800px 500px at 90% 10%, rgba(34,197,94,.06), transparent 55%),
    linear-gradient(180deg, #f7f9fd, #eef2f7);
  color:var(--text);
  font-smoothing:antialiased;
}

/* ===== SHELL ===== */

.app-shell{
  min-height:100vh;
  display:grid;
  grid-template-columns: 280px 1fr;
}

/* ===== SIDEBAR ===== */

.app-sidebar{
  border-right:1px solid var(--border);
  background: linear-gradient(180deg, #ffffff, #f3f6fb);
  padding:18px 14px;
  position:sticky;
  top:0;
  height:100vh;
  display:flex;
  flex-direction:column;
}

.brand{
  display:flex;
  gap:12px;
  align-items:center;
  padding:12px;
  border:1px solid var(--border);
  border-radius: var(--radius);
  background:#fff;
  box-shadow: var(--shadow);
}

.brand-icon{
  width:42px;height:42px;
  border-radius:14px;
  display:grid;place-items:center;
  background: linear-gradient(135deg, #7c3aed, #22c55e);
  color:#fff;
  font-size:20px;
}

.brand-name{ font-weight:900; }
.brand-sub{ color:var(--muted); font-size:12px; margin-top:2px; }

.nav-section{ margin-top:16px; }
.nav-title{
  color:var(--muted);
  font-size:11px;
  letter-spacing:.14em;
  text-transform:uppercase;
  padding:6px 12px;
}

.nav-item{
  display:flex;
  gap:10px;
  align-items:center;
  padding:10px 12px;
  border-radius:14px;
  color:#334155;
  text-decoration:none;
  border:1px solid transparent;
  font-weight:600;
}
.nav-item:hover{
  background:#f3f4f6;
}
.nav-item.active{
  background:var(--soft);
  border-color:rgba(124,58,237,.25);
  color:#4c1d95;
}

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

.user-chip{
  display:flex; gap:10px;
  align-items:center;
  padding:10px;
  border:1px solid var(--border);
  border-radius:16px;
  background:#fff;
  margin-bottom:10px;
}
.user-chip .avatar{
  width:34px;height:34px;
  border-radius:12px;
  display:grid; place-items:center;
  background:var(--soft);
  border:1px solid rgba(124,58,237,.25);
  font-weight:800;
  color:#4c1d95;
}
.user-chip .meta .name{ font-weight:800; font-size:13px; }
.user-chip .meta .role{ color:var(--muted); font-size:12px; }

/* ===== MAIN ===== */

.app-main{
  display:flex;
  flex-direction:column;
  min-height:100vh;
}

.app-topbar{
  padding:18px 22px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom:1px solid var(--border);
  background:rgba(255,255,255,.85);
  backdrop-filter: blur(6px);
  position:sticky;
  top:0;
  z-index:10;
}

.page-title{ font-size:20px; font-weight:900; }
.page-sub{ color:var(--muted); font-size:12px; margin-top:2px; }

.top-actions{ display:flex; gap:10px; align-items:center; }

.badge.soft{
  background:#f1f5f9;
  border:1px solid var(--border);
  color:#334155;
  font-weight:700;
  padding:8px 10px;
  border-radius:12px;
}

.app-content{ padding:22px; }

.app-footer{
  margin-top:auto;
  border-top:1px solid var(--border);
  padding:12px 22px;
  color:#64748b;
  display:flex;
  justify-content:space-between;
  background:#fff;
}

/* ===== CARDS ===== */

.card{
  background:var(--card)!important;
  border:1px solid var(--border)!important;
  border-radius:var(--radius)!important;
  box-shadow:var(--shadow);
  color:var(--text);
}
.card .text-muted{ color:var(--muted)!important; }

/* ===== FORMS ===== */

.form-control, .form-select{
  background:#fff!important;
  border:1px solid var(--border)!important;
  color:#0f172a!important;
  border-radius:14px!important;
}
.form-control:focus, .form-select:focus{
  border-color:#7c3aed!important;
  box-shadow:0 0 0 3px rgba(124,58,237,.12)!important;
}
.form-label{ color:#475569; font-weight:600; }

/* ===== BUTTONS ===== */

.btn-primary{
  background:linear-gradient(135deg, #7c3aed, #22c55e);
  border:0;
  border-radius:14px;
  font-weight:800;
}
.btn-outline-light{
  border-radius:14px;
  border-color:var(--border);
  color:#334155;
}

/* ===== TABLES (FIX PRINCIPAL) ===== */

.table-wrap{
  border:1px solid var(--border);
  border-radius:16px;
  overflow:hidden;
  background:#fff;
}

.table{
  margin:0;
  background:#fff;
  color:#0f172a;
}
.table thead th{
  background:#f8fafc;
  color:#475569;
  font-size:12px;
  letter-spacing:.04em;
  text-transform:uppercase;
  border-bottom:1px solid var(--border);
}
.table td{
  vertical-align:middle;
  border-color:var(--border)!important;
}
.table tbody tr:hover{
  background:#f8fafc;
}

/* ===== EMPTY STATE ===== */

.table-empty,
.empty-box{
  padding:36px;
  text-align:center;
  color:#64748b;
  background:#f8fafc;
  font-weight:600;
}

/* ===== ALERTS ===== */

.alert{
  border-radius:16px;
  border:1px solid var(--border);
  background:#f8fafc;
  color:#334155;
}

/* ===== LOGIN ===== */

.login-bg{
  min-height:100vh;
  display:grid;
  place-items:center;
}
.login-wrap{ width:min(440px, 92vw); }
.login-card{
  padding:26px;
  border-radius:22px;
  border:1px solid var(--border);
  background:#fff;
  box-shadow:var(--shadow);
}
.login-brand{
  display:flex;
  gap:12px;
  align-items:center;
}
