:root{
  --primary:#69435A;
  --primary-foreground:#ffffff;
  --background:#FFFFFF;
  --card:#ffffff;
  --foreground:#1B2130;
  --muted-foreground:#6B7280;
  --border:#E4E6EC;
  --accent:#F0ECEE;
  --accent-foreground:#69435A;
  --warning:#B8863C;
  --warning-soft:#F5EBD8;
  --info:#3B6FB0;
  --info-soft:#E5EEF9;
  --destructive:#B3402F;
  --destructive-soft:#F6E4E0;
  --success:#2F7D5A;
  --success-soft:#E4F1EA;
  --radius:10px;
}

*{box-sizing:border-box;}
html{background:var(--background);}
body{
  margin:0; background:var(--background); color:var(--foreground);
  font-family:'Inter',-apple-system,'Segoe UI',sans-serif;
  min-height:100vh;
}
body.app-shell{padding-bottom:76px;}
[dir="rtl"] body{font-family:'IBM Plex Sans Arabic','Inter',sans-serif;}
h1,h2,h3{font-family:'Fraunces',Georgia,serif; font-weight:600; margin:0;}

a{color:inherit; text-decoration:none;}
button, input, select, textarea{font-family:inherit; font-size:14px;}

.topbar{
  position:sticky; top:0; z-index:20; background:var(--primary);
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 20px;
}
.brand{display:flex; align-items:center; gap:10px;}
.brand-badge{
  width:36px; height:36px; border-radius:8px; background:#fff;
  display:flex; align-items:center; justify-content:center; flex:none; padding:3px;
}
.brand-badge img{width:100%; height:100%; object-fit:contain; display:block;}
.brand-text{display:flex; flex-direction:column; line-height:1.2;}
.brand-name{font-size:13.5px; font-weight:600; color:#fff;}
.brand-school{font-size:11px; color:rgba(255,255,255,.75);}
.topbar-actions{display:flex; align-items:center; gap:6px;}
.icon-btn{position:relative; padding:8px; border-radius:8px; font-size:16px; color:#fff;}
.icon-btn:hover{background:rgba(255,255,255,.15);}
.badge{
  position:absolute; top:2px; right:2px; background:#fff; color:var(--destructive);
  font-size:9px; font-weight:700; border-radius:100px; min-width:15px; height:15px;
  display:flex; align-items:center; justify-content:center; padding:0 3px;
}
.lang-btn{font-size:12px; font-weight:500; padding:8px 10px; border-radius:8px; color:#fff; background:none; border:none; appearance:none; cursor:pointer; font-family:inherit;}
.lang-btn:hover{background:rgba(255,255,255,.15);}

.page-content{max-width:720px; margin:0 auto; padding:20px;}
.page-content-auth{max-width:none; padding:0;}

.messages{margin-bottom:16px; display:flex; flex-direction:column; gap:8px;}
.message{padding:10px 14px; border-radius:var(--radius); font-size:13.5px;}
.message-success{background:var(--success-soft); color:var(--success);}
.message-error{background:var(--destructive-soft); color:var(--destructive);}

.bottom-nav{
  position:fixed; bottom:0; left:0; right:0; background:rgba(255,255,255,.96); backdrop-filter:blur(8px);
  border-top:1px solid var(--border); display:flex; z-index:20;
}
.nav-item{flex:1; display:flex; flex-direction:column; align-items:center; gap:3px; padding:9px 4px; color:var(--muted-foreground); font-size:10px;}
.nav-item-active{color:var(--primary);}
.nav-icon{font-size:17px;}

@media (min-width: 768px){
  body.app-shell{
    display:grid;
    grid-template-columns:220px 1fr;
    grid-template-rows:auto 1fr;
    grid-template-areas:"topbar topbar" "nav main";
    min-height:100vh;
    padding-bottom:0;
  }
  body.app-shell .topbar{grid-area:topbar;}
  body.app-shell .bottom-nav{
    grid-area:nav; position:sticky; top:66px; flex-direction:column; align-items:stretch; gap:6px;
    border-top:none; border-right:1px solid var(--border); backdrop-filter:none;
    padding:20px 12px; height:calc(100vh - 66px); overflow-y:auto;
  }
  body.app-shell .nav-item{
    flex:none; flex-direction:row; justify-content:flex-start; gap:12px;
    padding:12px 16px; font-size:13.5px; border-radius:var(--radius);
  }
  body.app-shell .nav-item:hover{background:var(--border);}
  body.app-shell .nav-item-active{background:var(--accent); color:var(--accent-foreground);}
  body.app-shell .nav-icon{font-size:17px;}
  body.app-shell .page-content{grid-area:main; max-width:1200px; width:100%; padding:28px 36px;}
  body.app-shell .page-content-auth{grid-area:main;}
}
[dir="rtl"] body.app-shell .bottom-nav{border-right:none; border-left:1px solid var(--border);}
[dir="rtl"] body.app-shell .nav-item{justify-content:flex-end;}

.card{background:var(--card); border:1px solid var(--border); border-radius:var(--radius); padding:18px;}
a.card:hover{border-color:var(--primary);}
.card + .card{margin-top:12px;}
.stack{display:flex; flex-direction:column; gap:12px;}
.row-between{display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap;}
.grid-3{display:grid; grid-template-columns:repeat(3,1fr); gap:10px;}
.grid-4{display:grid; grid-template-columns:repeat(4,1fr); gap:10px;}
@media (max-width:640px){.grid-4{grid-template-columns:repeat(2,1fr);}}
.grid-2{display:grid; grid-template-columns:1fr 1fr; gap:12px;}
@media (max-width:520px){.grid-2{grid-template-columns:1fr;}}

.stat-tile .stat-value{font-family:'Fraunces',serif; font-size:24px; font-weight:600;}
.stat-tile .stat-label{font-size:10.5px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted-foreground); margin-top:4px;}

.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  border-radius:8px; padding:9px 16px; font-size:13.5px; font-weight:600; border:1px solid transparent;
  cursor:pointer;
}
.btn-primary{background:var(--primary); color:#fff;}
.btn-primary:hover{background:#513347;}
.btn-outline{background:transparent; border-color:var(--border); color:var(--foreground);}
.btn-outline:hover{background:var(--background); border-color:var(--primary);}
.btn-block{width:100%;}
.btn-sm{padding:6px 12px; font-size:12.5px;}
.btn:disabled{opacity:.5; cursor:not-allowed;}
.btn:focus-visible, .icon-btn:focus-visible, .lang-btn:focus-visible, .nav-item:focus-visible{outline:2px solid var(--primary); outline-offset:2px;}

label{font-size:12.5px; font-weight:500; display:block; margin-bottom:5px;}
input[type=text],input[type=email],input[type=password],input[type=date],input[type=datetime-local],textarea,select{
  width:100%; border:1px solid var(--border); border-radius:8px; padding:9px 11px; background:#fff; color:var(--foreground);
}
input[type=text]:focus,input[type=email]:focus,input[type=password]:focus,input[type=date]:focus,input[type=datetime-local]:focus,textarea:focus,select:focus{
  outline:none; border-color:var(--primary); box-shadow:0 0 0 3px rgba(105,67,90,.12);
}
input[type=checkbox]:focus-visible{outline:2px solid var(--primary); outline-offset:2px;}
textarea{resize:vertical;}
.field{margin-bottom:14px;}

.pill{display:inline-flex; align-items:center; gap:5px; padding:3px 10px; border-radius:100px; font-size:11px; font-weight:600;}
.pill::before{content:""; width:6px; height:6px; border-radius:100px; background:currentColor; flex:none;}
.pill-low, .pill-success{background:var(--success-soft); color:var(--success);}
.pill-medium, .pill-info{background:var(--info-soft); color:var(--info);}
.pill-high, .pill-warning{background:var(--warning-soft); color:var(--warning);}
.pill-critical, .pill-destructive{background:var(--destructive-soft); color:var(--destructive);}

.filter-bar{display:flex; gap:8px; flex-wrap:wrap; margin:14px 0;}
.filter-bar select{width:auto; min-width:140px; padding:8px 10px; font-size:13px;}

.list-item{display:flex; align-items:center; justify-content:between; gap:10px; padding:13px 16px; border-bottom:1px solid var(--border);}
.list-item:last-child{border-bottom:none;}
.list-item:hover{background:var(--background);}

.wizard-steps{display:flex; gap:6px; margin:14px 0 20px;}
.wizard-step{flex:1;}
.wizard-step-bar{height:4px; border-radius:100px; background:var(--border);}
.wizard-step-bar.active{background:var(--primary);}
.wizard-step-label{font-size:9.5px; color:var(--muted-foreground); text-align:center; margin-top:5px;}

.option-grid{display:grid; grid-template-columns:1fr 1fr; gap:8px;}
.option-btn{
  text-align:start; padding:12px 14px; border-radius:8px; border:1px solid var(--border);
  background:#fff; font-size:13.5px; font-weight:500;
}
.option-btn.selected{border-color:var(--primary); background:var(--info-soft);}

.review-row{display:flex; justify-content:space-between; gap:10px; padding:9px 0; border-bottom:1px solid var(--border); font-size:13.5px;}
.review-row .label{color:var(--muted-foreground); font-size:11px; text-transform:uppercase; letter-spacing:.04em;}

.auth-shell{min-height:100vh; display:grid; grid-template-columns:1fr 1fr;}
@media (max-width:840px){.auth-shell{grid-template-columns:1fr;}}
.auth-side{background:var(--primary); color:#fff; padding:48px; display:flex; flex-direction:column; justify-content:space-between;}
.auth-side h1{color:#fff; font-size:32px; line-height:1.2;}
.auth-form-wrap{display:flex; align-items:center; justify-content:center; padding:32px;}
.auth-card{max-width:400px; width:100%; background:#fff; border:1px solid var(--border); border-radius:14px; padding:32px;}

.chart-placeholder{
  height:200px; border:1px dashed var(--border); border-radius:8px;
  display:flex; align-items:center; justify-content:center; color:var(--muted-foreground); font-size:12.5px;
}
