/* ============================================================
   Ilmu Portal — clean, professional backend styling (separate
   from the playful kid app).
   ============================================================ */
:root{
  --p-bg:#f4f6fb; --p-card:#fff; --p-ink:#1f2747; --p-soft:#6b7393;
  --p-line:#e6e9f2; --p-brand:#2ea59e; --p-brand2:#7c5cff;
  --p-shadow:0 8px 24px -16px rgba(31,39,71,.45);
}
*{ box-sizing:border-box; }
body{ margin:0; font-family:'Inter',system-ui,sans-serif; background:var(--p-bg); color:var(--p-ink); }
h1,h2,h3{ font-family:'Manrope','Inter',sans-serif; margin:0; }
a{ color:inherit; text-decoration:none; }
.muted{ color:var(--p-soft); }

/* ---------- Auth / login ---------- */
.auth-wrap{ min-height:100vh; display:grid; place-items:center; padding:20px;
  background:radial-gradient(120% 120% at 0% 0%, #eef0ff 0%, #f4f6fb 45%, #eafaf7 100%); }
.auth-card{ width:100%; max-width:420px; background:var(--p-card); border-radius:24px; padding:28px 26px;
  box-shadow:0 30px 60px -30px rgba(31,39,71,.4); position:relative; }
.auth-back{ position:absolute; top:18px; left:18px; font-size:12px; font-weight:800; color:var(--p-soft); }
.auth-brand{ text-align:center; margin:14px 0 18px; }
.auth-logo{ width:60px;height:60px; display:inline-grid; place-items:center; border-radius:18px; font-size:26px; color:#fff;
  background:linear-gradient(135deg,var(--p-brand),var(--p-brand2)); margin-bottom:10px; }
.auth-brand h1{ font-size:24px; }
.auth-brand p{ margin:2px 0 0; color:var(--p-soft); font-weight:700; }
.auth-form{ display:flex; flex-direction:column; gap:12px; }
.auth-form label{ font-weight:800; font-size:13px; display:flex; flex-direction:column; gap:6px; }
.auth-form input{ border:1.5px solid var(--p-line); border-radius:12px; padding:12px 14px; font-size:15px; font-weight:700;
  font-family:inherit; outline:none; }
.auth-form input:focus{ border-color:var(--p-brand); }
.auth-btn{ margin-top:6px; border:none; border-radius:12px; padding:13px; font-size:15px; font-weight:900; color:#fff;
  background:linear-gradient(135deg,var(--p-brand),var(--p-brand2)); cursor:pointer; font-family:inherit; }
.auth-error{ background:#ffeef0; color:#c0334d; font-weight:800; font-size:13px; padding:10px 12px; border-radius:12px; margin-bottom:6px; }
.auth-demo{ margin-top:18px; border-top:1px solid var(--p-line); padding-top:14px; display:flex; flex-direction:column; gap:8px; }
.auth-demo strong{ font-size:12px; color:var(--p-soft); text-transform:uppercase; letter-spacing:1px; }
.demo-chip{ text-align:left; border:1.5px solid var(--p-line); background:#fafbff; border-radius:12px; padding:10px 12px;
  font-weight:800; font-size:13px; cursor:pointer; font-family:inherit; color:var(--p-ink); }
.demo-chip:hover{ border-color:var(--p-brand); }

/* ---------- Portal chrome ---------- */
.portal{ max-width:1040px; margin:0 auto; padding:0 16px 40px; }
.p-top{ display:flex; align-items:center; justify-content:space-between; padding:16px 4px; }
.p-brand{ font-family:'Manrope',sans-serif; font-weight:800; font-size:20px; display:flex; align-items:center; gap:8px; }
.p-logo{ width:34px;height:34px; display:grid; place-items:center; border-radius:10px; color:#fff; font-size:16px;
  background:linear-gradient(135deg,var(--p-brand),var(--p-brand2)); }
.p-role{ font-size:12px; font-weight:800; color:var(--p-brand2); background:#efeaff; padding:3px 8px; border-radius:999px; }
.p-user{ display:flex; align-items:center; gap:14px; }
.p-name{ font-weight:800; font-size:13px; color:var(--p-soft); }
.p-signout{ font-weight:800; font-size:13px; color:#c0334d; }
.p-tabs{ display:flex; gap:8px; flex-wrap:wrap; margin:4px 0 18px; }
.p-tab{ font-weight:800; font-size:13.5px; padding:9px 14px; border-radius:12px; background:#fff; box-shadow:var(--p-shadow);
  color:var(--p-soft); }
.p-tab.on{ color:#fff; background:linear-gradient(135deg,var(--p-brand),var(--p-brand2)); }
.p-foot{ text-align:center; color:var(--p-soft); font-weight:800; font-size:12px; margin-top:28px; }

/* ---------- Cards / grid ---------- */
.p-grid{ display:grid; grid-template-columns:repeat(2,1fr); gap:14px; }
.p-card{ background:var(--p-card); border-radius:18px; padding:18px; box-shadow:var(--p-shadow); }
.p-card.span2{ grid-column:1 / -1; }
.p-card h3{ font-size:15px; display:flex; align-items:center; gap:8px; margin-bottom:12px; }
.p-card h3 i{ color:var(--p-brand); }
.p-card p{ line-height:1.5; font-weight:600; margin:0; }

.child-head{ display:flex; align-items:center; gap:14px; background:#fff; border-radius:18px; padding:16px 18px;
  box-shadow:var(--p-shadow); margin-bottom:14px; }
.child-ava{ width:52px;height:52px; border-radius:16px; display:grid; place-items:center; font-size:24px; font-weight:900; color:#fff;
  background:linear-gradient(135deg,var(--p-brand),var(--p-brand2)); }
.child-head h2{ font-size:20px; }
.child-head small{ color:var(--p-soft); font-weight:700; }
.goals-link{ margin-left:auto; font-weight:800; font-size:13px; color:#fff; background:var(--p-brand2);
  padding:9px 14px; border-radius:12px; }

.skill-row{ display:flex; gap:12px; align-items:flex-start; margin-bottom:14px; }
.skill-row > i{ width:34px;height:34px; flex:none; display:grid; place-items:center; border-radius:10px; background:#eef0ff; color:var(--p-brand2); }
.skill-row .sk{ flex:1; }
.sk-top{ display:flex; justify-content:space-between; font-weight:800; font-size:13.5px; margin-bottom:5px; }
.meter{ height:8px; border-radius:999px; background:#eef0f6; overflow:hidden; }
.meter span{ display:block; height:100%; border-radius:999px; background:linear-gradient(90deg,var(--p-brand),var(--p-brand2)); }
.meter.warn span{ background:linear-gradient(90deg,#ffb01f,#ff8a3d); }
.skill-row small{ display:block; margin-top:5px; }

.chart{ display:flex; align-items:flex-end; gap:8px; height:90px; }
.bar{ flex:1; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; height:100%; gap:5px; }
.bar-fill{ width:100%; max-width:26px; border-radius:8px 8px 3px 3px; background:linear-gradient(180deg,var(--p-brand2),var(--p-brand)); min-height:5px; }
.bar small{ font-size:11px; color:var(--p-soft); font-weight:800; }

.chips{ display:flex; flex-wrap:wrap; gap:8px; }
.chip{ background:#fff6e9; color:#b07400; font-weight:800; font-size:12.5px; padding:7px 11px; border-radius:999px; }
.act-row{ display:flex; gap:12px; align-items:center; padding:9px 0; border-bottom:1px solid var(--p-line); }
.act-row:last-child{ border-bottom:none; }
.ar-ic{ font-size:20px; }
.act-row strong{ display:block; font-size:13.5px; }
.act-row small{ color:var(--p-soft); font-weight:700; }
.ctrl{ display:flex; justify-content:space-between; align-items:center; padding:10px 0; border-bottom:1px solid var(--p-line); font-weight:700; }
.ctrl:last-child{ border-bottom:none; }
.ctrl i{ color:var(--p-brand); width:20px; }

/* ---------- Page intros ---------- */
.page-intro{ margin-bottom:16px; }
.page-intro.mt{ margin-top:26px; }
.page-intro h2{ font-size:20px; display:flex; align-items:center; gap:8px; }
.page-intro h2 i{ color:var(--p-brand2); }
.page-intro p{ margin:6px 0 0; line-height:1.5; font-weight:600; }
.badge-soft{ font-size:11px; font-weight:800; background:#efeaff; color:var(--p-brand2); padding:2px 8px; border-radius:999px; }
.badge-soft.soon{ background:#fff1e6; color:#c2710f; }

/* ---------- Goals ---------- */
.goal-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:12px; }
.goal-card{ position:relative; text-align:left; background:#fff; border:2px solid var(--p-line); border-radius:16px; padding:16px;
  cursor:pointer; transition:transform .12s, border-color .12s; font-family:inherit; color:var(--p-ink); }
.goal-card:hover{ transform:translateY(-2px); }
.goal-card.on{ border-color:var(--gc,var(--p-brand)); background:color-mix(in srgb, var(--gc,#2ea59e) 7%, #fff); }
.goal-ic{ width:42px;height:42px; display:grid; place-items:center; border-radius:12px; font-size:19px; color:#fff;
  background:var(--gc,var(--p-brand)); margin-bottom:10px; }
.goal-card strong{ display:block; font-size:15px; }
.goal-card small{ color:var(--p-soft); font-weight:700; }
.goal-check{ position:absolute; top:12px; right:12px; width:24px;height:24px; border-radius:50%; display:grid; place-items:center;
  background:var(--gc,var(--p-brand)); color:#fff; font-size:12px; opacity:0; transform:scale(.5); transition:.15s; }
.goal-card.on .goal-check{ opacity:1; transform:scale(1); }
.save-bar{ display:flex; align-items:center; gap:14px; margin-top:16px; }
.save-btn{ border:none; border-radius:12px; padding:12px 20px; font-weight:900; font-size:14px; color:#fff; cursor:pointer;
  background:linear-gradient(135deg,var(--p-brand),var(--p-brand2)); font-family:inherit; }
.save-hint{ font-weight:800; color:var(--p-brand); }
.rec-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:12px; }
.rec-card{ display:flex; align-items:center; gap:12px; background:#fff; border-radius:14px; padding:12px 14px; box-shadow:var(--p-shadow); }
.rec-emoji{ font-size:26px; }
.rec-body{ flex:1; } .rec-body strong{ display:block; font-size:14px; } .rec-body small{ color:var(--p-soft); font-weight:700; }
.rec-go{ width:34px;height:34px; border-radius:50%; display:grid; place-items:center; background:var(--p-brand); color:#fff; }

/* ---------- Skill games ---------- */
.game-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:14px; }
.game-card{ background:#fff; border-radius:18px; padding:16px; box-shadow:var(--p-shadow); border-top:4px solid var(--gc,var(--p-brand)); }
.game-top{ display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; }
.game-emoji{ font-size:26px; }
.game-skill{ font-size:11px; font-weight:800; color:var(--gc,var(--p-brand)); background:color-mix(in srgb,var(--gc,#2ea59e) 12%,#fff); padding:4px 9px; border-radius:999px; }
.game-title{ display:block; font-size:15.5px; margin-bottom:10px; }
.game-meter{ margin-bottom:7px; }
.game-meta{ display:flex; justify-content:space-between; color:var(--p-soft); font-weight:800; font-size:11.5px; }
.game-badge{ display:inline-flex; align-items:center; gap:6px; margin-top:10px; font-size:12px; font-weight:800; color:#b07400;
  background:#fff6e9; padding:5px 10px; border-radius:999px; }

/* ---------- Teacher content table ---------- */
.content-actions{ margin-bottom:14px; }
.add-btn{ border:none; border-radius:12px; padding:12px 18px; font-weight:900; color:#fff; cursor:pointer; font-family:inherit;
  background:linear-gradient(135deg,var(--p-brand),var(--p-brand2)); font-size:14px; }
.table-wrap{ background:#fff; border-radius:16px; box-shadow:var(--p-shadow); overflow:hidden; }
.content-table{ width:100%; border-collapse:collapse; }
.content-table th{ text-align:left; font-size:12px; text-transform:uppercase; letter-spacing:.5px; color:var(--p-soft);
  padding:13px 14px; background:#fafbff; border-bottom:1px solid var(--p-line); }
.content-table td{ padding:13px 14px; border-bottom:1px solid var(--p-line); font-weight:700; font-size:13.5px; }
.content-table tr:last-child td{ border-bottom:none; }
.ct-title{ font-weight:800; }
.tag{ font-size:11.5px; font-weight:800; padding:3px 9px; border-radius:999px; background:#eef0ff; color:var(--p-brand2); }
.tag.t-video{ background:#e6f6ff; color:#1d7fb0; } .tag.t-quiz{ background:#fff1e6; color:#c2710f; }
.tag.t-story{ background:#ffeef5; color:#c0337a; } .tag.t-activity{ background:#eafaf2; color:#10916b; }
.tag.t-game{ background:#efeaff; color:#7c5cff; }
.status{ font-size:12px; font-weight:800; padding:3px 10px; border-radius:999px; }
.status.ok{ background:#eafaf2; color:#10916b; } .status.draft{ background:#f0f1f6; color:#6b7393; }

/* ---------- Modal ---------- */
.modal{ position:fixed; inset:0; background:rgba(31,39,71,.45); display:none; place-items:center; padding:18px; z-index:50; }
.modal.open{ display:grid; }
.modal-card{ width:100%; max-width:520px; background:#fff; border-radius:20px; box-shadow:0 40px 80px -30px rgba(0,0,0,.5);
  max-height:92vh; overflow:auto; }
.modal-head{ display:flex; align-items:center; justify-content:space-between; padding:18px 20px; border-bottom:1px solid var(--p-line); }
.modal-head h3{ font-size:17px; display:flex; gap:8px; align-items:center; } .modal-head i{ color:var(--p-brand); }
.modal-x{ border:none; background:#f0f1f6; width:32px;height:32px; border-radius:10px; cursor:pointer; color:var(--p-soft); }
.modal-form{ padding:18px 20px; display:flex; flex-direction:column; gap:13px; }
.modal-form label{ font-weight:800; font-size:13px; display:flex; flex-direction:column; gap:6px; }
.modal-form input,.modal-form select,.modal-form textarea{ border:1.5px solid var(--p-line); border-radius:10px; padding:11px 12px;
  font-size:14px; font-weight:700; font-family:inherit; outline:none; color:var(--p-ink); }
.modal-form input:focus,.modal-form select:focus,.modal-form textarea:focus{ border-color:var(--p-brand); }
.form-row{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.modal-foot{ display:flex; justify-content:flex-end; gap:10px; margin-top:6px; }
.btn-ghost{ border:1.5px solid var(--p-line); background:#fff; border-radius:10px; padding:11px 16px; font-weight:800; cursor:pointer; font-family:inherit; color:var(--p-ink); }
.btn-solid{ border:none; border-radius:10px; padding:11px 18px; font-weight:900; color:#fff; cursor:pointer; font-family:inherit;
  background:linear-gradient(135deg,var(--p-brand),var(--p-brand2)); }

/* ---------- Classroom (coming soon) ---------- */
.soon-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:14px; margin-bottom:20px; }
.soon-card{ background:#fff; border-radius:16px; padding:18px; box-shadow:var(--p-shadow); }
.soon-ic{ font-size:30px; } .soon-card strong{ display:block; margin:8px 0 4px; font-size:15px; }
.soon-card p{ color:var(--p-soft); font-weight:600; font-size:13px; line-height:1.4; margin:0; }
.mock-host{ background:linear-gradient(135deg,#2b2350,#43306b); color:#fff; border-radius:20px; padding:24px; text-align:center; }
.host-code{ font-weight:800; letter-spacing:2px; font-size:14px; opacity:.85; }
.host-code b{ display:block; font-family:'Manrope',sans-serif; font-size:38px; letter-spacing:6px; margin-top:6px; }
.host-players{ display:flex; flex-wrap:wrap; gap:8px; justify-content:center; margin:18px 0; }
.player{ background:rgba(255,255,255,.16); padding:7px 14px; border-radius:999px; font-weight:800; font-size:13px; }
.player.ghost{ opacity:.5; }
.host-start{ border:none; border-radius:12px; padding:12px 22px; font-weight:900; font-size:15px; color:#43306b; background:#fff;
  opacity:.6; cursor:not-allowed; font-family:inherit; }

@media (max-width:640px){
  .p-grid{ grid-template-columns:1fr; }
  .form-row{ grid-template-columns:1fr; }
  .content-table th:nth-child(4),.content-table td:nth-child(4){ display:none; }
}
