
:root{
  --bg:#0b1020;
  --card:#131a2b;
  --muted:#9aa4b2;
  --text:#eef2ff;
  --green:#10b981;
  --blue:#3b82f6;
  --red:#ef4444;
  --yellow:#f59e0b;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, "Noto Kufi Arabic", "Noto Sans Arabic", Arial, sans-serif;
  background:linear-gradient(180deg,#0b1020,#0e1426);
  color:var(--text);
}

.app-bar{
  position:sticky; top:0; z-index:10;
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 16px;
  background:rgba(10,15,30,0.8);
  backdrop-filter: blur(8px);
  border-bottom:1px solid #1f2a44;
}
.app-bar h1{margin:0; font-size:20px}
.actions button{
  margin-inline-start:8px;
  background:#22304d; color:var(--text); border:1px solid #2b3a5c;
  border-radius:12px; padding:8px 12px; cursor:pointer;
}
.actions .danger{background:#3a1f28; border-color:#5b2b38}
.hidden{display:none !important}

#subjectsView{padding:16px; min-height:calc(100vh - 54px)}
.subject-list{display:flex; flex-direction:column; gap:12px}

.subject-card{
  display:flex; align-items:center; gap:12px;
  background:var(--card);
  border:1px solid #233155;
  border-inline-start:8px solid var(--subject-color, var(--green));
  padding:14px; border-radius:16px; cursor:pointer;
  box-shadow:0 4px 20px rgba(0,0,0,.2);
}
.subject-card .icon{font-size:22px}
.subject-card .meta{display:flex; gap:8px; font-size:12px; color:var(--muted)}
.subject-card .color-dot{
  width:14px; height:14px; border-radius:50%; border:1px solid #ffffff30;
}

.tabs{
  display:grid; grid-template-columns:repeat(4,1fr);
  gap:8px; padding:12px; background:transparent;
}
.tab{
  padding:10px; border-radius:12px; border:1px solid #2b3a5c;
  background:#172033; color:var(--text); cursor:pointer;
  box-shadow: inset 0 0 0 2px color-mix(in oklab, var(--tab-color) 25%, transparent);
}
.tab.active{ background: color-mix(in oklab, var(--tab-color) 15%, #172033); }

.tab-panel{ padding:12px 12px 80px; }
.grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(160px, 1fr)); gap:12px; }
.vlist{ display:flex; flex-direction:column; gap:10px; }

.note-card{
  background:#172033; border:1px solid #2b3a5c; border-radius:16px;
  padding:12px; cursor:pointer;
  display:flex; flex-direction:column; gap:6px;
}
.note-card h4{margin:0; font-size:14px}
.note-card p{margin:0; font-size:13px; color:#d7deef}

.item-row{
  display:flex; align-items:center; justify-content:space-between;
  gap:10px; padding:12px; border-radius:14px;
  background:#172033; border:1px solid #2b3a5c;
}
.item-row .title{display:flex; align-items:center; gap:10px;}
.item-row small{color:var(--muted)}

.image-thumb{
  width:100%; aspect-ratio:1/1; object-fit:cover;
  border-radius:16px; border:1px solid #2b3a5c;
  background:#0a0f1f;
  cursor:pointer;
}

.fab{
  position:fixed; right:16px; bottom:16px; z-index:20;
  width:56px; height:56px; border-radius:50%;
  background:#1f2a44; color:var(--text); border:1px solid #2b3a5c;
  font-size:24px; cursor:pointer; box-shadow:0 8px 30px rgba(0,0,0,.3);
}

dialog{
  border:none; border-radius:16px; padding:0; max-width:520px; width:min(92vw,520px);
  background:#0f1628; color:var(--text);
  box-shadow:0 20px 80px rgba(0,0,0,.6);
}
dialog::backdrop{background:rgba(0,0,0,.5)}
dialog form{padding:16px; display:flex; flex-direction:column; gap:12px}
dialog h3{margin:0}
dialog menu{display:flex; justify-content:flex-end; gap:8px; margin:0; padding-top:8px}
dialog button{padding:8px 12px; border-radius:12px; border:1px solid #2b3a5c; background:#172033; color:var(--text); cursor:pointer}
dialog .primary{background:#1f2a44}
input[type="text"], textarea, select, input[type="color"]{
  width:100%; padding:10px; border-radius:12px; border:1px solid #2b3a5c; background:#0b1222; color:var(--text);
}
textarea{min-height:120px}

#imageViewer{padding:0; background:rgba(0,0,0,.9)}
#imageViewer img{max-width:95vw; max-height:95vh}

.badge{padding:3px 8px; border-radius:999px; border:1px solid #2b3a5c; color:#d9e2ff; font-size:12px}

footer{color:#8a94a7; text-align:center; padding:30px 10px 50px}
