/* =========================================================
   روضتي بلس — نظام التصميم
   إطار أسود، لوحة فاتحة، بطاقات بحواف سودة، لمسات ليموني وبنفسجي
   ========================================================= */

@font-face { font-family: "Rubik"; src: url("../assets/fonts/rubik-arabic.woff2") format("woff2"); font-weight: 300 900; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E, U+2010-2011, U+204F, U+2E41; }
@font-face { font-family: "Rubik"; src: url("../assets/fonts/rubik-latin.woff2") format("woff2"); font-weight: 300 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* لون الروضة (يتغير من الإعدادات) */
  --primary: #7C6CF2;
  --primary-2: #9F93FF;
  --primary-dark: #5443D6;
  --primary-soft: #ECE9FF;

  /* اللمسات الثابتة */
  --lime: #DCF24B;
  --lime-2: #ECFA94;
  --lime-soft: #F6FCD2;
  --yellow: #FFC93C;  --yellow-soft: #FFF5D6;
  --pink: #FF7A9A;    --pink-soft: #FFE7EE;
  --sky: #4DA8F0;     --sky-soft: #E3F1FD;
  --teal: #22C3B0;    --teal-soft: #DDF7F3;
  --leaf: #2FB36A;    --leaf-soft: #E2F6EA;
  --red: #F0566E;     --red-soft: #FEE7EA;
  --wa: #25D366;

  /* المحايدات */
  --page: #ECEAFB;
  --frame: #111113;
  --frame-2: #222226;
  --frame-ink: #A9A9B2;
  --panel: #F6F6F2;
  --card: #FFFFFF;
  --ink: #111111;
  --ink-2: #4A4A55;
  --muted: #8E8E99;
  --edge: #161616;          /* حدود البطاقات الأساسية */
  --line: #E6E4DE;          /* خطوط داخلية ناعمة */
  --soft: #F1F0EC;

  --r-frame: 30px;
  --r-panel: 26px;
  --r-card: 18px;
  --r-sm: 12px;
  --bw: 1.5px;
  --ease: cubic-bezier(.34, 1.56, .64, 1);
  --shadow: 0 10px 30px rgba(20, 16, 60, .10);
  --shadow-lg: 0 24px 70px rgba(20, 16, 60, .25);
}

[data-theme="mint"]  { --primary: #12A594; --primary-2: #4FD1C1; --primary-dark: #0B7A6E; --primary-soft: #DDF5F1; }
[data-theme="coral"] { --primary: #F2665F; --primary-2: #FF9C8E; --primary-dark: #C2423C; --primary-soft: #FEE6E2; }
[data-theme="sky"]   { --primary: #3B82F6; --primary-2: #7CB4FF; --primary-dark: #2257C2; --primary-soft: #E2EDFE; }
[data-theme="sun"]   { --primary: #F08C00; --primary-2: #FFB547; --primary-dark: #B06600; --primary-soft: #FFF0D9; }

[data-mode="dark"] {
  --page: #0B0B0E; --panel: #18181C; --card: #212127; --ink: #F3F3F5; --ink-2: #C4C4CE; --muted: #84848F;
  --edge: #3A3A44; --line: #2E2E36; --soft: #2A2A31;
  --primary-soft: color-mix(in srgb, var(--primary) 22%, #212127);
  --yellow-soft: #3A3220; --pink-soft: #3B2630; --sky-soft: #1E2F40; --teal-soft: #1B3532; --leaf-soft: #1E3527; --red-soft: #3D2229; --lime-soft: #2E331A;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Rubik", "Segoe UI", Tahoma, Arial, sans-serif;
  background: var(--page);
  color: var(--ink);
  font-size: 15px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 8px; font-weight: 700; letter-spacing: -.01em; }
h1 { font-weight: 800; }
h3 { font-size: 18px; }
h4 { font-size: 15px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.red { color: var(--red); }
.green { color: var(--leaf); }
.ltr { direction: ltr; unicode-bidi: embed; }
.pre { white-space: pre-wrap; line-height: 1.8; }
.spacer { flex: 1; }
::selection { background: var(--lime); color: #111; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #D5D3CC; border-radius: 10px; border: 3px solid var(--panel); }


/* =================== الإطار =================== */
.app-wrap { height: 100vh; padding: 16px; }
.frame { height: 100%; background: var(--frame); border-radius: var(--r-frame); display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-lg); }

.topbar { display: flex; align-items: center; gap: 14px; padding: 12px 22px 16px; color: #fff; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -.02em; white-space: nowrap; }
.logo .mark { width: 34px; height: 34px; border-radius: 11px; background: var(--lime); color: #111; display: grid; place-items: center; transform: rotate(-8deg); transition: transform .4s var(--ease); }
.logo:hover .mark { transform: rotate(8deg) scale(1.08); }
.logo small { display: block; font-size: 11px; color: var(--frame-ink); font-weight: 400; }

.nav { display: flex; align-items: center; gap: 2px; margin: 0 auto; }
.nav a, .nav button {
  position: relative; display: flex; align-items: center; gap: 7px; padding: 9px 13px; border-radius: 12px; color: var(--frame-ink);
  font: inherit; font-size: 14px; font-weight: 500; background: none; border: 0; cursor: pointer; white-space: nowrap; transition: color .2s, background .2s;
}
.nav a:hover, .nav button:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav a.active { color: #fff; background: var(--frame-2); }
.nav a.active::after {
  content: ""; position: absolute; left: 50%; bottom: -17px; width: 22px; height: 11px; transform: translateX(-50%);
  background: var(--panel); clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.more { position: relative; }
.more-menu {
  position: absolute; top: calc(100% + 10px); inset-inline-end: 0; min-width: 210px; background: var(--frame); border: 1px solid #2A2A30; border-radius: 16px;
  padding: 6px; z-index: 40; box-shadow: var(--shadow-lg); display: none; animation: popIn .2s var(--ease);
}
.more.open .more-menu { display: block; }
.more-menu a { display: flex; padding: 10px 12px; border-radius: 10px; }
.more-menu a.active::after { display: none; }

.top-tools { display: flex; align-items: center; gap: 8px; }
.dark-btn {
  height: 38px; min-width: 38px; border-radius: 99px; border: 1px solid #2C2C32; background: var(--frame-2); color: #E6E6EA; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 12px; font: inherit; font-size: 13px; transition: .2s;
}
.dark-btn:hover { border-color: #4A4A52; color: #fff; }
.dark-btn kbd { font: 11px inherit; background: #2E2E34; border-radius: 6px; padding: 1px 6px; color: var(--frame-ink); }
.dark-btn.search { min-width: 210px; justify-content: flex-start; color: var(--frame-ink); }

.sync-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.sync-badge.s-ok .dot { background: var(--lime); box-shadow: 0 0 0 3px rgba(220, 242, 75, .2); }
.sync-badge.s-offline .dot { background: var(--yellow); }
.sync-badge.s-syncing .dot { background: var(--sky); animation: pulse 1s infinite; }
.sync-badge.s-error .dot, .sync-badge.s-expired .dot { background: var(--red); }
.sync-badge .pill { background: var(--lime); color: #111; border-radius: 99px; padding: 0 7px; font-size: 11px; font-weight: 700; }
@keyframes pulse { 50% { opacity: .3; } }

.user-chip { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 4px 4px 10px; border-radius: 99px; transition: .2s; }
.user-chip:hover { background: rgba(255,255,255,.06); }
.user-chip b { display: block; font-size: 14px; color: #fff; }
.user-chip small { display: block; font-size: 11px; color: var(--frame-ink); }
.user-chip .av { border: 2px solid var(--lime); }

.panel { flex: 1; margin: 0 10px 10px; background: var(--panel); border-radius: var(--r-panel); overflow-y: auto; position: relative; }
#main { padding: 26px 30px 40px; }
.page-head { margin-bottom: 20px; display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 30px; margin: 0; display: flex; align-items: center; gap: 12px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
#page > * { animation: rise .35s ease both; }
#page > *:nth-child(2) { animation-delay: .04s; }
#page > *:nth-child(3) { animation-delay: .08s; }
#page > *:nth-child(4) { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px; margin: 16px 30px 0; font-size: 14px; border: var(--bw) solid var(--edge); }
.banner.warn { background: var(--yellow-soft); }
.banner.bad { background: var(--red-soft); }

/* =================== البطاقات =================== */
.card { background: var(--card); border-radius: var(--r-card); padding: 18px 20px; margin-bottom: 16px; border: var(--bw) solid var(--edge); position: relative; }
.card.soft { background: var(--soft); border-color: transparent; }
.card.hover { transition: transform .25s var(--ease), box-shadow .25s; }
.card.hover:hover { transform: translateY(-3px); box-shadow: 4px 4px 0 var(--edge); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-title .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--soft); }
.card-title h3 { margin: 0; }
.sec-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 12px; flex-wrap: wrap; }
.sec-title h2 { font-size: 20px; margin: 0; }

/* ===== الرئيسية ===== */
.dash { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); gap: 22px; align-items: start; }
.greet-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.greet-row h1 { font-size: 36px; margin: 0 0 6px; }
.greet-row p { margin: 0; color: var(--ink-2); }
.chips-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.chip-stat {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 10px; min-width: 128px; padding: 10px 14px; border-radius: 14px;
  border: var(--bw) solid var(--tone); background: var(--tone-soft); transition: transform .25s var(--ease);
}
.chip-stat:hover { transform: translateY(-3px); }
.chip-stat b { display: block; font-size: 20px; font-weight: 800; line-height: 1.1; position: relative; color: var(--ink); }
.chip-stat span { font-size: 12px; color: var(--ink-2); position: relative; }
.t-yellow { --tone: #E8B400; --tone-soft: var(--yellow-soft); }
.t-purple { --tone: var(--primary); --tone-soft: var(--primary-soft); }
.t-lime   { --tone: #9DB500; --tone-soft: var(--lime-soft); }
.t-pink   { --tone: var(--pink); --tone-soft: var(--pink-soft); }
.t-sky    { --tone: var(--sky); --tone-soft: var(--sky-soft); }
.t-teal   { --tone: var(--teal); --tone-soft: var(--teal-soft); }

.focus-card { display: flex; align-items: stretch; gap: 0; padding: 0; overflow: hidden; min-height: 170px; }
/* الافتراضي RTL: الرسمة يمين، والانحناء يواجه النص (يسار) */
.focus-card .body { flex: 1; padding: 22px 24px; display: flex; flex-direction: column; gap: 8px; }
.focus-card .kicker { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.focus-card .kicker .ico { color: var(--primary); }
.focus-card h2 { font-size: 28px; margin: 0; }
.focus-card .prog-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: auto; }
.focus-card .prog { flex: 1; min-width: 180px; }
.focus-card .prog small { color: var(--muted); }
.focus-card .prog small b { color: var(--ink); }
.focus-card .corner { position: absolute; top: 14px; inset-inline-end: 14px; display: flex; gap: 8px; }

.pbar { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.pbar i { display: block; height: 100%; background: var(--primary); border-radius: 99px; animation: barIn .9s ease both; transform-origin: right; }
.sbar { height: 16px; border: var(--bw) solid var(--edge); border-radius: 99px; overflow: hidden; background: var(--card); }
.sbar i { display: block; height: 100%; border-radius: 99px; background: repeating-linear-gradient(-45deg, var(--teal) 0 6px, #63DACB 6px 12px); animation: barIn .9s ease both; transform-origin: right; }
@keyframes barIn { from { transform: scaleX(0); } }

.tabs-text { display: flex; gap: 4px; }
.tabs-text button { font: inherit; font-size: 13px; background: none; border: 0; padding: 6px 10px; border-radius: 99px; cursor: pointer; color: var(--muted); }
.tabs-text button.on { color: var(--ink); font-weight: 700; background: var(--card); border: var(--bw) solid var(--edge); }

.rec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-bottom: 14px; }
.rec {
  position: relative; overflow: hidden; display: flex; align-items: center; min-height: 112px; padding: 16px 18px; border-radius: var(--r-card);
  background: var(--card); border: var(--bw) solid var(--edge); cursor: pointer; text-align: start; font: inherit; color: var(--ink);
  transition: transform .25s var(--ease), box-shadow .25s;
}
.rec:hover { transform: translateY(-3px); box-shadow: 4px 4px 0 var(--edge); }
.rec:active { transform: scale(.98); }
.rec .txt { flex: 1; position: relative; z-index: 1; }
.rec .kind { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-2); }
.rec .kind .ico { width: 14px; height: 14px; color: var(--primary); }
.rec h4 { font-size: 17px; margin: 4px 0 10px; }
.rec .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.rec.hidden { display: none; }
.wide-btn { width: 100%; justify-content: center; }

.streak {
  transform: rotate(-2.5deg); transition: transform .35s var(--ease); box-shadow: 6px 6px 0 var(--edge); padding: 20px 22px;
}
.streak:hover { transform: rotate(0); }
.streak h3 { font-size: 22px; line-height: 1.3; margin: 0; }
.streak .big { display: flex; align-items: center; gap: 4px; font-size: 34px; font-weight: 800; }
.days { display: flex; gap: 6px; margin: 16px 0 18px; justify-content: space-between; }
.day { width: 38px; height: 38px; border-radius: 50%; border: var(--bw) solid var(--edge); display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--card); }
.day.on { background: var(--lime); color: #111; }
.day.on .ico { width: 16px; height: 16px; fill: #111; stroke: #111; }
.day.today { outline: 3px solid var(--primary-soft); outline-offset: 2px; }
.cls-rows { display: flex; flex-direction: column; gap: 12px; }
.cls-row { display: grid; grid-template-columns: 96px 1fr 52px; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.cls-row small { font-weight: 500; color: var(--muted); text-align: end; }

.promo {
  position: relative; overflow: hidden; border-radius: var(--r-card); padding: 22px; color: #fff; border: var(--bw) solid var(--edge);
  background: radial-gradient(120% 120% at 100% 0%, var(--primary-2) 0%, var(--primary) 45%, var(--primary-dark) 100%);
}
.promo h3 { font-size: 22px; line-height: 1.35; margin-bottom: 6px; }
.promo p { margin: 0 0 14px; opacity: .85; font-size: 13px; }
.promo .glass { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.promo .glass span { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-radius: 10px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); backdrop-filter: blur(6px); font-size: 13px; }
.promo .btn { background: #fff; color: #111; border-color: #fff; }

/* ===== إحصائيات الصفحات ===== */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  position: relative; overflow: hidden; border-radius: var(--r-card); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px;
  background: var(--tone-soft, var(--card)); border: var(--bw) solid var(--tone, var(--edge)); transition: transform .25s var(--ease);
}
a.stat:hover { transform: translateY(-3px); }
.stat .s-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--card); border: var(--bw) solid var(--edge); margin-bottom: 4px; }
.stat span { font-size: 13px; color: var(--ink-2); }
.stat b { font-size: 24px; font-weight: 800; color: var(--ink); }
.stat b small { font-size: 14px; color: var(--muted); font-weight: 500; }
.stat em { font-style: normal; font-size: 12px; color: var(--ink-2); font-weight: 600; }
.c0 { --tone: var(--sky); --tone-soft: var(--sky-soft); }
.c1 { --tone: var(--primary); --tone-soft: var(--primary-soft); }
.c2 { --tone: var(--leaf); --tone-soft: var(--leaf-soft); }
.c3 { --tone: var(--pink); --tone-soft: var(--pink-soft); }
.c4 { --tone: #E8B400; --tone-soft: var(--yellow-soft); }
.c5 { --tone: var(--teal); --tone-soft: var(--teal-soft); }

.class-card { overflow: hidden; }
.class-card::after { content: ""; position: absolute; width: 120px; height: 120px; border-radius: 50%; inset-inline-end: -50px; top: -60px; background: var(--tone, var(--lime)); opacity: .9; }
.class-card > * { position: relative; z-index: 1; }
.class-card.color-0 { --tone: var(--lime); }
.class-card.color-1 { --tone: var(--yellow); }
.class-card.color-2 { --tone: var(--pink); }
.class-card.color-3 { --tone: var(--sky); }
.class-card.color-4 { --tone: var(--primary-2); }
.class-card h3 { margin: 0; }
.class-card p { margin: 6px 0; color: var(--ink-2); }
.big-num { font-size: 30px; font-weight: 800; }
.big-num small { font-size: 13px; color: var(--muted); font-weight: 400; }
.bar { height: 10px; background: var(--soft); border-radius: 99px; overflow: hidden; margin: 8px 0; border: 1px solid var(--line); }
.bar div { height: 100%; background: var(--primary); border-radius: 99px; animation: barIn .8s ease both; transform-origin: right; }

/* =================== الأزرار =================== */
.btn {
  font: inherit; font-size: 14px; font-weight: 600; border: var(--bw) solid var(--edge); background: var(--card); color: var(--ink); padding: 9px 18px; border-radius: 99px; cursor: pointer;
  transition: transform .2s var(--ease), background .2s, box-shadow .2s; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); box-shadow: 3px 3px 0 var(--edge); }
.btn:active { transform: translateY(0) scale(.97); box-shadow: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn .ico { width: 16px; height: 16px; }
.btn.primary { background: var(--ink); color: var(--card); border-color: var(--ink); }
.btn.primary:hover { box-shadow: 3px 3px 0 var(--lime); }
.btn.lime { background: var(--lime); color: #111; }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-soft); }
.btn.wa { background: #E3F9EC; color: #0C7A3E; }
[data-mode="dark"] .btn.wa { background: #173A27; color: #74E6A5; }
.btn.wa:hover { background: var(--wa); color: #fff; }
.btn.wa.sent { background: var(--soft); color: var(--muted); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { box-shadow: none; background: var(--soft); }
.btn.small { padding: 6px 13px; font-size: 13px; }
.btn.tiny { padding: 4px 10px; font-size: 12px; border-width: 1px; }
.btn.tiny .ico { width: 14px; height: 14px; }
.btn.big { padding: 13px 22px; font-size: 15px; }
.circle-btn { width: 40px; height: 40px; border-radius: 50%; border: var(--bw) solid var(--edge); background: var(--card); display: inline-grid; place-items: center; cursor: pointer; color: var(--ink); transition: transform .25s var(--ease); }
.circle-btn:hover { transform: rotate(-12deg) scale(1.08); }
.circle-btn.lime { background: var(--lime); color: #111; }
.icon-btn { border: 0; background: transparent; cursor: pointer; padding: 5px 8px; border-radius: 10px; color: var(--muted); transition: .2s; display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--soft); color: var(--ink); }
.icon-btn.small .ico { width: 14px; height: 14px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
td .actions { margin: 0; flex-wrap: nowrap; }

.seg { display: inline-flex; background: var(--card); border: var(--bw) solid var(--edge); border-radius: 99px; padding: 3px; }
.seg button { font: inherit; font-size: 14px; border: 0; background: transparent; padding: 7px 15px; border-radius: 99px; cursor: pointer; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; transition: .2s; }
.seg button.on { background: var(--ink); color: var(--card); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-size: 13px; border: 1px solid var(--edge); background: var(--card); padding: 6px 13px; border-radius: 99px; cursor: pointer; transition: transform .2s var(--ease), background .15s; color: var(--ink); display: inline-flex; align-items: center; gap: 5px; }
.chip:hover { background: var(--soft); }
.chip:active { transform: scale(.92); }
.chip.on { background: var(--ink); color: var(--card); animation: pop .3s var(--ease); }
.chip.ok.on { background: var(--leaf); border-color: var(--leaf); color: #fff; }
.chip.warn.on { background: var(--yellow); border-color: var(--edge); color: #111; }
.chip.bad.on { background: var(--red); border-color: var(--red); color: #fff; }
.chip.info.on { background: var(--sky); border-color: var(--sky); color: #fff; }
.chip.wa { background: #E3F9EC; }
.chip.check input { display: none; }
.chip.check.on { background: var(--lime); color: #111; }

.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 9px; border-radius: 7px; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); font-weight: 500; }
.tag.ok { border-color: #9ED9B4; background: var(--leaf-soft); color: #1C7A42; }
.tag.warn { border-color: #EBCB73; background: var(--yellow-soft); color: #8A5C00; }
.tag.bad { border-color: #F2A5B1; background: var(--red-soft); color: #B23246; }
.tag.info { border-color: #9CCBF2; background: var(--sky-soft); color: #1C6487; }
[data-mode="dark"] .tag.ok { color: #7EE2A6; } [data-mode="dark"] .tag.warn { color: var(--yellow); }
[data-mode="dark"] .tag.bad { color: #FF9AAA; } [data-mode="dark"] .tag.info { color: #8CCDF5; }
.link { color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--lime); text-decoration-thickness: 3px; text-underline-offset: 3px; }
.link:hover { text-decoration-color: var(--primary); }

/* =================== الأفاتار =================== */
.av {
  --s: 38px; width: var(--s); height: var(--s); border-radius: 50%; flex-shrink: 0; display: inline-grid; place-items: center;
  font-weight: 700; font-size: calc(var(--s) * .36); color: var(--av-ink); background: var(--av-bg); vertical-align: middle; border: 1px solid rgba(0,0,0,.08);
}
.av.sm { --s: 32px; }
.av.lg { --s: 72px; border: var(--bw) solid var(--edge); }
.name-cell { display: inline-flex; align-items: center; gap: 10px; }

/* =================== أدوات وجداول =================== */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar p { margin: 0; }
input, select, textarea {
  font: inherit; border: var(--bw) solid var(--line); background: var(--card); border-radius: 12px; padding: 9px 13px; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--edge); box-shadow: 0 0 0 4px var(--lime-soft); }
.toolbar input, .toolbar select { border-color: var(--edge); border-radius: 99px; }
input.invalid, select.invalid, textarea.invalid { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-soft); animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.toolbar input[type=search] { min-width: 250px; }
.full-input { width: 100%; margin: 10px 0; }
[data-mode="dark"] input[type=date], [data-mode="dark"] input[type=month], [data-mode="dark"] input[type=time] { color-scheme: dark; }

.table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--r-card); border: var(--bw) solid var(--edge); }
table { width: 100%; border-collapse: collapse; }
th { background: var(--soft); font-weight: 600; font-size: 12.5px; color: var(--ink-2); text-align: right; padding: 12px 14px; white-space: nowrap; }
td { padding: 10px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background .15s; }
tbody tr:hover td { background: var(--lime-soft); }
table.simple td { border: 0; padding: 7px 0; }

.mini-stats { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin: 8px 0 14px; }
.mini-stats.big { font-size: 15px; background: var(--card); border: var(--bw) solid var(--edge); border-radius: var(--r-card); padding: 14px 18px; }

.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty-icon { font-size: 52px; margin-bottom: 8px; display: inline-block; animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-5deg); } }

.alert { background: var(--red-soft); color: #9B2A3C; border-radius: 12px; padding: 10px 14px; margin: 8px 0; border: 1px solid #F2A5B1; }
.alert.okay { background: var(--lime-soft); color: var(--ink); border-color: #C9DD5C; }
.alert.small { padding: 4px 10px; font-size: 13px; }
[data-mode="dark"] .alert { color: #FF9AAA; } [data-mode="dark"] .alert.okay { color: var(--ink); }

/* =================== النماذج =================== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field > span { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.field small { color: var(--muted); font-size: 12px; }
.req { color: var(--red); }
select.picker { height: auto; padding: 6px; }
select.picker option { padding: 6px 8px; border-radius: 8px; }
.picker-search { margin-bottom: 4px; }

/* =================== النوافذ =================== */
.modal-back { position: fixed; inset: 0; background: rgba(17, 17, 19, .5); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 50; padding: 20px; animation: fade .2s; }
.modal { min-width: 0; max-width: 100%; background: var(--panel); border-radius: 24px; width: min(580px, 100%); max-height: 92vh; display: flex; flex-direction: column; box-shadow: 8px 8px 0 var(--frame), var(--shadow-lg); border: var(--bw) solid var(--edge); animation: popIn .3s var(--ease); }
.modal.wide { width: min(920px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 19px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes popIn { from { transform: scale(.94) translateY(10px); opacity: 0; } }
@keyframes pop { 50% { transform: scale(1.12); } }

.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.profile-head h2 { margin: 0; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.kv span { color: var(--muted); }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 8px 0; border-bottom: 1px dashed var(--line); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
ul.plain li:last-child { border-bottom: 0; }
.note { position: relative; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.note p { margin: 4px 0 0; }
.note .icon-btn { position: absolute; left: 0; top: 6px; }

/* =================== الحضور =================== */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile {
  position: relative; background: var(--card); border: var(--bw) solid var(--edge); border-radius: var(--r-card); padding: 18px 10px 12px; text-align: center; cursor: pointer; user-select: none;
  transition: transform .25s var(--ease), background .2s, box-shadow .2s;
}
.tile:hover { transform: translateY(-3px); box-shadow: 4px 4px 0 var(--edge); }
.tile:active { transform: scale(.95); box-shadow: none; }
.tile .av { --s: 58px; margin-bottom: 8px; }
.tile.bump .av { animation: pop .4s var(--ease); }
.tile b { display: block; font-size: 14px; line-height: 1.4; }
.tile small { color: var(--muted); font-size: 12px; }
.tile .st { position: absolute; top: 8px; left: 8px; font-size: 11px; padding: 2px 8px; border-radius: 99px; font-weight: 700; border: 1px solid var(--edge); }
.tile .st:empty { display: none; }
.tile .allergy { position: absolute; top: 8px; right: 10px; color: var(--red); }
.tile .allergy .ico { width: 16px; height: 16px; }
.tile.present { background: var(--lime-soft); }
.tile.present .st { background: var(--lime); color: #111; }
.tile.late { background: var(--yellow-soft); }
.tile.late .st { background: var(--yellow); color: #111; }
.tile.absent { background: var(--red-soft); }
.tile.absent .st { background: var(--red); color: #fff; }
.tile.absent .av { filter: grayscale(.8); opacity: .6; }
.tile.excused { background: var(--sky-soft); }
.tile.excused .st { background: var(--sky); color: #fff; }
.tile .tile-wa { position: absolute; bottom: 8px; left: 8px; border: 1px solid var(--edge); background: #E3F9EC; color: #0C7A3E; border-radius: 99px; padding: 3px 7px; cursor: pointer; display: grid; place-items: center; }
.tile .tile-wa .ico { width: 14px; height: 14px; }
.progress-strip { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--soft); margin: 10px 0 4px; border: var(--bw) solid var(--edge); }
.progress-strip i { display: block; height: 100%; transition: width .5s ease; }
.att-help { font-size: 13px; color: var(--muted); }

/* =================== التقرير اليومي =================== */
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.report-card { transition: box-shadow .2s; }
.report-card:hover { box-shadow: 4px 4px 0 var(--edge); }
.report-card.sent { background: var(--lime-soft); }
.opt-row { display: flex; flex-direction: column; gap: 5px; margin: 10px 0; }
.opt-row > span { font-size: 13px; color: var(--muted); }
.note-input { width: 100%; margin-top: 6px; }

.send-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; max-height: 50vh; overflow-y: auto; }
.send-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.ann h3 { margin: 0; }

/* =================== التقارير =================== */
.hbar { display: grid; grid-template-columns: 130px 1fr 120px; align-items: center; gap: 10px; margin: 10px 0; }
.hbar.inline { grid-template-columns: 1fr 50px; margin: 0; min-width: 160px; }
.hbar > div { height: 14px; background: var(--card); border: var(--bw) solid var(--edge); border-radius: 99px; overflow: hidden; }
.hbar i { display: block; height: 100%; background: repeating-linear-gradient(-45deg, var(--primary) 0 6px, var(--primary-2) 6px 12px); border-radius: 99px; animation: barIn .8s ease both; transform-origin: right; }
.hbar b { font-size: 13px; }

.sync-box { border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; background: var(--soft); border: 1px solid var(--line); }
.sync-box.state-ok { background: var(--lime-soft); border-color: #C9DD5C; }
.sync-box.state-error, .sync-box.state-expired { background: var(--red-soft); border-color: #F2A5B1; }
.sync-box.state-offline { background: var(--yellow-soft); }
.sync-box.state-syncing { background: var(--sky-soft); }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: var(--bw) solid var(--edge); cursor: pointer; transition: transform .25s var(--ease); }
.swatch:hover { transform: scale(1.1) rotate(-6deg); }
.swatch.on { box-shadow: 0 0 0 4px var(--panel), 0 0 0 6px var(--edge); }

/* =================== تسجيل الدخول =================== */
.auth { height: 100vh; padding: 16px; }
.auth .frame { flex-direction: row; padding: 10px; gap: 10px; }
.auth-form { flex: 1; background: var(--panel); border-radius: var(--r-panel); display: grid; place-items: center; padding: 30px; }
.auth-box { width: min(400px, 100%); }
.auth-box h2 { font-size: 32px; margin-bottom: 6px; font-weight: 800; }
.auth-box .field { margin-bottom: 14px; }
.auth-box input { width: 100%; padding: 12px 14px; border-color: var(--edge); }
.auth-box .btn.primary { width: 100%; justify-content: center; padding: 13px; font-size: 16px; }
.auth-box .alt { text-align: center; margin-top: 18px; }
.auth-box .alt button { background: none; border: 0; font: inherit; cursor: pointer; color: var(--ink); text-decoration: underline; text-decoration-color: var(--lime); text-decoration-thickness: 3px; text-underline-offset: 4px; }
.auth-box .logo { color: var(--ink); margin-bottom: 30px; }
.auth-box .logo small { color: var(--muted); }
.auth-art { flex: 1.1; position: relative; overflow: hidden; border-radius: var(--r-panel); color: #fff; padding: 46px; display: flex; flex-direction: column; justify-content: flex-end; background: var(--frame); }
.auth-art::before { content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%; background: var(--lime); top: -140px; inset-inline-start: -120px; }
.auth-art::after { content: ""; position: absolute; width: 300px; height: 300px; border-radius: 50%; background: var(--primary); bottom: 120px; inset-inline-end: -120px; opacity: .9; }
.auth-art h1 { font-size: 42px; margin: 0 0 12px; position: relative; z-index: 2; line-height: 1.25; }
.auth-art h1 mark { background: var(--lime); color: #111; padding: 0 10px; border-radius: 12px; }
.auth-art p { font-size: 16px; color: #C9C9D1; max-width: 430px; line-height: 1.8; position: relative; z-index: 2; margin: 0; }
@keyframes drift { 50% { transform: translateY(-16px) rotate(8deg); } }
.auth-art .feat { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 22px; position: relative; z-index: 2; }
.auth-art .feat span { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #3A3A42; padding: 6px 14px; border-radius: 99px; font-size: 13px; color: #E6E6EA; }
.auth-art .feat .ico { color: var(--lime); width: 15px; height: 15px; }
.kg-choice { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.kg-choice button { font: inherit; text-align: right; padding: 14px; border-radius: 16px; border: var(--bw) solid var(--edge); background: var(--card); cursor: pointer; color: var(--ink); transition: .2s; }
.kg-choice button:hover { transform: translateY(-2px); box-shadow: 4px 4px 0 var(--edge); }

/* =================== البحث السريع =================== */
.palette-back { position: fixed; inset: 0; background: rgba(17,17,19,.45); backdrop-filter: blur(4px); z-index: 60; display: flex; justify-content: center; padding-top: 12vh; animation: fade .15s; }
.palette { width: min(600px, 92vw); background: var(--panel); border-radius: 22px; overflow: hidden; animation: popIn .25s var(--ease); align-self: flex-start; border: var(--bw) solid var(--edge); box-shadow: 8px 8px 0 var(--frame); }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 18px 22px; font-size: 17px; box-shadow: none !important; background: var(--card); }
.palette .results { max-height: 52vh; overflow-y: auto; padding: 8px; }
.palette .res { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; cursor: pointer; }
.palette .res.sel, .palette .res:hover { background: var(--lime-soft); }
.palette .res .r-ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--card); border: 1px solid var(--edge); }
.palette .res small { color: var(--muted); margin-inline-start: auto; font-size: 12px; }
.palette .group { font-size: 11px; color: var(--muted); padding: 8px 12px 4px; font-weight: 600; }
.palette .foot { padding: 8px 16px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }

/* =================== التنبيهات والاحتفال =================== */
#toasts { position: fixed; bottom: 26px; left: 26px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--frame); color: #fff; padding: 12px 18px; border-radius: 99px; box-shadow: var(--shadow-lg); transition: .4s; max-width: 420px; animation: toastIn .4s var(--ease); }
.toast::before { content: "✓"; width: 22px; height: 22px; border-radius: 50%; background: var(--lime); color: #111; display: grid; place-items: center; font-size: 12px; font-weight: 800; flex-shrink: 0; }
.toast.error::before { content: "!"; background: var(--red); color: #fff; }
.toast.hide { opacity: 0; transform: translateY(10px); }
@keyframes toastIn { from { transform: translateY(20px) scale(.9); opacity: 0; } }
.confetti { position: fixed; top: -12px; width: 10px; height: 14px; z-index: 200; pointer-events: none; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); opacity: .8; } }

@media (max-width: 1500px) {
  .dark-btn.search { min-width: 0; }
  .dark-btn.search span, .dark-btn.search kbd { display: none; }
}
@media (max-width: 1400px) {
  .nav a span.lbl, .nav #morelbl { display: none; }
  .nav a.active span.lbl, .nav #morebtn.active-more #morelbl { display: inline; }
  .nav a { padding: 9px 11px; }
}
@media (max-width: 1000px) {
  .dash { grid-template-columns: 1fr; }
  .user-chip div { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
