/* ============================================================
   Task & Learn — Design System  v2.0
   A cohesive, premium, mobile-first system.
   - Light is default; dark via html[data-theme="dark"].
   - RTL/LTR driven by <html dir> + logical CSS properties.
   - Class names match the live markup (kanban / chat fixed).
   ============================================================ */

/* ---- Design tokens ---------------------------------------- */
:root {
  /* Brand */
  --primary:        #4F46E5;   /* Indigo — trust / focus           */
  --primary-600:    #4338CA;
  --primary-700:    #3730A3;
  --primary-050:    #EEF2FF;
  --secondary:      #0D9488;   /* Teal — clarity / growth          */
  --secondary-600:  #0F766E;
  --accent:         #F59E0B;   /* Amber — action / streak          */
  --accent-600:     #D97706;

  /* States */
  --success:        #16A34A;
  --warning:        #D97706;
  --error:          #DC2626;
  --info:           #0EA5E9;

  /* Surfaces (light) */
  --bg:             #F6F8FC;
  --bg-tint:        #EEF2FB;
  --surface:        #FFFFFF;
  --surface-2:      #F1F5F9;
  --surface-3:      #E8EEF6;
  --text:           #0E1525;
  --text-2:         #51607A;
  --text-3:         #8190A8;
  --border:         #E4E9F2;
  --border-2:       #D5DCEA;
  --ring:           rgba(79, 70, 229, .35);

  /* Brand gradients */
  --grad-brand:     linear-gradient(135deg, #6366F1 0%, #4F46E5 45%, #0D9488 110%);
  --grad-brand-soft:linear-gradient(135deg, #EEF2FF 0%, #E7FBF7 100%);
  --grad-accent:    linear-gradient(135deg, #FBBF24, #F97316);
  --grad-text:      linear-gradient(120deg, #4F46E5, #0D9488);

  /* Shape & motion */
  --radius:         16px;
  --radius-sm:      11px;
  --radius-lg:      24px;
  --radius-pill:    999px;
  --shadow-xs:      0 1px 2px rgba(15,23,42,.06);
  --shadow-sm:      0 1px 2px rgba(15,23,42,.05), 0 2px 6px rgba(15,23,42,.06);
  --shadow:         0 4px 14px rgba(15,23,42,.07), 0 2px 6px rgba(15,23,42,.05);
  --shadow-lg:      0 18px 44px rgba(15,23,42,.14), 0 6px 14px rgba(15,23,42,.07);
  --shadow-brand:   0 12px 30px rgba(79,70,229,.30);
  --speed:          .2s;
  --ease:           cubic-bezier(.22,.61,.36,1);

  /* Type */
  --font-ar: "Cairo", "Tajawal", system-ui, sans-serif;
  --font-en: "Inter", system-ui, -apple-system, sans-serif;
  --font:    var(--font-en);
  --maxw:    1160px;
}

html[lang="ar"] { --font: var(--font-ar); }

html[data-theme="dark"] {
  --bg:         #0B1120;
  --bg-tint:    #0E1628;
  --surface:    #151E30;
  --surface-2:  #1C2840;
  --surface-3:  #243150;
  --text:       #E8EDF6;
  --text-2:     #9FB0CC;
  --text-3:     #6F809E;
  --border:     #25324C;
  --border-2:   #31415F;
  --primary:    #818CF8;
  --primary-600:#6366F1;
  --primary-700:#4F46E5;
  --primary-050:#1E293B;
  --secondary:  #2DD4BF;
  --ring:       rgba(129,140,248,.45);
  --grad-brand-soft: linear-gradient(135deg, #18223A 0%, #142b2c 100%);
  --shadow-xs:  0 1px 2px rgba(0,0,0,.5);
  --shadow-sm:  0 2px 6px rgba(0,0,0,.45);
  --shadow:     0 6px 18px rgba(0,0,0,.5);
  --shadow-lg:  0 22px 50px rgba(0,0,0,.6);
  --shadow-brand:0 14px 34px rgba(99,102,241,.4);
}

/* ---- Reset / base ----------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background var(--speed), color var(--speed);
}
h1,h2,h3,h4 { line-height: 1.22; margin: 0 0 .5em; font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 4.2vw, 2.55rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.85rem); }
h3 { font-size: 1.15rem; font-weight: 700; }
p  { margin: 0 0 1rem; }
a  { color: var(--primary); text-decoration: none; transition: color var(--speed); }
a:hover { color: var(--primary-600); text-decoration: none; }
img { max-width: 100%; height: auto; }
small { color: var(--text-2); }
hr { border: 0; border-block-start: 1px solid var(--border); }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 6px; }
::selection { background: color-mix(in srgb, var(--primary) 22%, transparent); }

/* ---- Layout ----------------------------------------------- */
.container { max-width: var(--maxw); margin-inline: auto; padding-inline: 20px; }
.stack > * + * { margin-block-start: var(--gap, 1rem); }
.grid { display: grid; gap: 20px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.muted { color: var(--text-2); }
.tiny  { font-size: .76rem; }
.center { text-align: center; }
.mono { font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace !important;
  font-size: .85rem; line-height: 1.55; }
.mt-0{margin-top:0}.mt-1{margin-top:.5rem}.mt-2{margin-top:1rem}.mt-3{margin-top:1.5rem}
.hidden { display: none !important; }

/* ---- Top navigation --------------------------------------- */
.nav {
  position: sticky; inset-block-start: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-block-end: 1px solid var(--border);
  width: 100%;
  max-width: 100%;
}
.nav .container { display: flex; align-items: center; gap: 14px; min-height: 64px; max-width: 100%; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; color: var(--text); font-size: 1.12rem; }
.brand:hover { color: var(--text); }
.brand .logo {
  inline-size: 34px; block-size: 34px; border-radius: 10px;
  background: var(--grad-brand);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 0.9rem; /* تقليل حجم الخط قليلًا ليناسب الحروف المتعددة دون تداخل */
  box-shadow: var(--shadow-brand); overflow: hidden;
  letter-spacing: -0.5px; /* تقريب المسافة بين الحروف للتناسق البصري */
}
.nav-spacer { flex: 1; }
.nav-links { display: flex; align-items: center; gap: 7px; }
.iconbtn {
  display: inline-grid; place-items: center; inline-size: 40px; block-size: 40px;
  border-radius: 11px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; font-size: 1rem;
  transition: background var(--speed), border-color var(--speed), transform var(--speed);
}
.iconbtn:hover { background: var(--surface-2); border-color: var(--border-2); transform: translateY(-1px); }

/* ---- Buttons ---------------------------------------------- */
.btn {
  --bg: var(--primary); --fg: #fff;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 19px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--bg); color: var(--fg); font: inherit; font-weight: 700;
  cursor: pointer; text-decoration: none; line-height: 1.2; white-space: nowrap;
  box-shadow: var(--shadow-xs);
  transition: transform var(--speed) var(--ease), box-shadow var(--speed), filter var(--speed), background var(--speed);
}
.btn:not(.ghost):not(.accent) { box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 28%, transparent); }
.btn:hover { filter: brightness(1.04); transform: translateY(-2px); color: var(--fg); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; filter: none; box-shadow: none; }
.btn.secondary { --bg: var(--secondary); box-shadow: 0 6px 18px color-mix(in srgb, var(--secondary) 30%, transparent); }
.btn.accent    { --bg: var(--accent); --fg: #3a2606; background: var(--grad-accent);
  box-shadow: 0 8px 20px rgba(245,158,11,.36); }
.btn.ghost     { --bg: var(--surface); --fg: var(--text); border-color: var(--border); box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--border-2); }
.btn.danger    { --bg: var(--error); box-shadow: 0 6px 18px rgba(220,38,38,.3); }
.btn.success   { --bg: var(--success); box-shadow: 0 6px 18px rgba(22,163,74,.3); }
.btn.block     { display: flex; inline-size: 100%; }
.btn.sm        { padding: 8px 13px; font-size: .85rem; border-radius: 9px; }
.btn.lg        { padding: 14px 26px; font-size: 1.05rem; border-radius: 13px; }

/* ---- Cards ------------------------------------------------ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 22px;
  transition: box-shadow var(--speed), border-color var(--speed), transform var(--speed);
}
.card.pad-lg { padding: 30px; }
.card.lift:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); border-color: var(--border-2); }
.card-title { display: flex; align-items: center; gap: 10px; margin-block-end: 14px; flex-wrap: wrap; }
.card-title h3 { margin: 0; }

/* ---- Badges / pills --------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: var(--radius-pill); font-size: .78rem; font-weight: 700;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
  line-height: 1.4;
}
.badge.tiny { padding: 2px 8px; font-size: .68rem; }
.badge.primary { background: color-mix(in srgb, var(--primary) 13%, transparent); color: var(--primary); border-color: transparent; }
.badge.teal    { background: color-mix(in srgb, var(--secondary) 15%, transparent); color: var(--secondary-600); border-color: transparent; }
.badge.amber   { background: color-mix(in srgb, var(--accent) 20%, transparent); color: #92600a; border-color: transparent; }
.badge.green   { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); border-color: transparent; }
.badge.red     { background: color-mix(in srgb, var(--error) 13%, transparent); color: var(--error); border-color: transparent; }
.badge.gray    { background: var(--surface-2); color: var(--text-2); }
html[data-theme="dark"] .badge.amber { color: #fbbf24; }
html[data-theme="dark"] .badge.teal  { color: #2dd4bf; }

/* Streak flame badge — a small signature element */
.streak {
  display: inline-flex; align-items: center; gap: 7px; font-weight: 800;
  padding: 6px 14px; border-radius: var(--radius-pill); color: #fff;
  background: var(--grad-accent);
  box-shadow: 0 6px 16px rgba(245,158,11,.4);
}
.streak .flame { font-size: 1.05rem; filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); animation: flick 1.8s ease-in-out infinite; }
@keyframes flick { 0%,100%{transform:rotate(-3deg) scale(1)} 50%{transform:rotate(3deg) scale(1.12)} }

/* ---- Progress ring (signature) ---------------------------- */
.ring { --size: 116px; inline-size: var(--size); block-size: var(--size); position: relative; }
.ring svg { transform: rotate(-90deg); inline-size: 100%; block-size: 100%; }
.ring .track { stroke: var(--surface-2); }
.ring .bar { stroke: url(#tlgrad); stroke-linecap: round;
  transition: stroke-dashoffset 1s var(--ease); filter: drop-shadow(0 2px 6px color-mix(in srgb,var(--primary) 35%,transparent)); }
.ring .pct { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 1.5rem; color: var(--text); }

/* Linear progress */
.progress { block-size: 10px; border-radius: var(--radius-pill); background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; block-size: 100%; border-radius: inherit;
  background: var(--grad-text); transition: inline-size .8s var(--ease); }

/* ---- Forms ------------------------------------------------ */
label { font-weight: 600; font-size: .92rem; display: block; margin-block-end: 7px; color: var(--text); }
.input, input[type=text], input[type=email], input[type=tel], input[type=password],
input[type=number], select, textarea {
  inline-size: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; transition: border-color var(--speed), box-shadow var(--speed), background var(--speed);
}
.input::placeholder, input::placeholder, textarea::placeholder { color: var(--text-3); }
.input:focus, input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring);
}
textarea { resize: vertical; min-block-size: 100px; line-height: 1.6; }
.field { margin-block-end: 16px; }
.field .err { color: var(--error); font-size: .82rem; margin-block-start: 5px; font-weight: 600; }
.checkbox { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.checkbox input { inline-size: 19px; block-size: 19px; margin-block-start: 2px; accent-color: var(--primary); flex: none; }
.help { font-size: .82rem; color: var(--text-2); }
.choice-group { display: grid; gap: 10px; }
.choice {
  display: flex; gap: 11px; align-items: center; padding: 13px 15px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
  background: var(--surface); transition: border-color var(--speed), background var(--speed), transform var(--speed);
}
.choice:hover { background: var(--surface-2); border-color: var(--border-2); }
.choice.selected { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, transparent);
  box-shadow: 0 0 0 1px var(--primary) inset; }
.choice input { inline-size: 19px; block-size: 19px; accent-color: var(--primary); flex: none; }
/* choice-card — used on the activation screen */
.choice-card {
  display: flex; gap: 12px; align-items: center; padding: 14px 16px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface);
  transition: border-color var(--speed), background var(--speed);
}
.choice-card:hover { border-color: var(--border-2); background: var(--surface-2); }
.choice-card input { inline-size: 19px; block-size: 19px; accent-color: var(--primary); flex: none; }

/* ---- Alerts ----------------------------------------------- */
.alert { padding: 13px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: .92rem; margin-block-end: 14px; display: flex; gap: 9px; align-items: flex-start; }
.alert.info    { background: color-mix(in srgb, var(--info) 11%, transparent); color: #075985; border-color: color-mix(in srgb, var(--info) 28%, transparent); }
.alert.success { background: color-mix(in srgb, var(--success) 11%, transparent); color: #14532d; border-color: color-mix(in srgb, var(--success) 28%, transparent); }
.alert.warn    { background: color-mix(in srgb, var(--warning) 13%, transparent); color: #92400e; border-color: color-mix(in srgb, var(--warning) 28%, transparent); }
.alert.error   { background: color-mix(in srgb, var(--error) 11%, transparent); color: #991b1b; border-color: color-mix(in srgb, var(--error) 28%, transparent); }
.alert.teal    { background: color-mix(in srgb, var(--secondary) 12%, transparent); color: var(--secondary-600); border-color: color-mix(in srgb, var(--secondary) 28%, transparent); }
html[data-theme="dark"] .alert.info{color:#7dd3fc}
html[data-theme="dark"] .alert.success{color:#86efac}
html[data-theme="dark"] .alert.warn{color:#fcd34d}
html[data-theme="dark"] .alert.error{color:#fca5a5}
html[data-theme="dark"] .alert.teal{color:#5eead4}

/* ---- Auth pages ------------------------------------------- */
.auth-wrap { min-block-size: calc(100vh - 64px); display: grid; place-items: center; padding: 36px 16px; position: relative; overflow: hidden; }
.auth-wrap::before { content:""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(620px 420px at 12% 0%, color-mix(in srgb,var(--primary) 14%, transparent), transparent 70%),
    radial-gradient(560px 420px at 100% 100%, color-mix(in srgb,var(--secondary) 14%, transparent), transparent 70%); }
.auth-card { inline-size: 100%; max-inline-size: 460px; box-shadow: var(--shadow-lg); }
.auth-card.wide { max-inline-size: 640px; }
.brand-hero { text-align: center; margin-block-end: 24px; }
.brand-hero .logo-lg {
  inline-size: 60px; block-size: 60px; border-radius: 17px; margin-inline: auto;
  background: var(--grad-brand); box-shadow: var(--shadow-brand);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 1.5rem;
}

/* ---- Hero (landing) --------------------------------------- */
.hero { padding: clamp(46px, 8vw, 96px) 0 clamp(34px,6vw,60px); position: relative; }
.hero h1 { max-inline-size: 18ch; }
.hero h1 .grad { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: clamp(1.05rem,2.2vw,1.22rem); color: var(--text-2); max-inline-size: 58ch; }
.hero-wrap { position: relative; overflow: clip; }
.hero-wrap::after {
  content: ""; position: absolute; inset-block-start: -22%; inset-inline-end: -12%;
  inline-size: min(560px,80vw); block-size: min(560px,80vw); border-radius: 50%; z-index: -1; pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--secondary) 22%, transparent), transparent 62%);
  filter: blur(6px);
  animation: float-slow-1 20s infinite alternate ease-in-out;
  will-change: transform;
}
.hero-wrap::before {
  content: ""; position: absolute; inset-block-start: 30%; inset-inline-start: -10%;
  inline-size: min(440px,70vw); block-size: min(440px,70vw); border-radius: 50%; z-index: -1; pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--primary) 18%, transparent), transparent 62%);
  filter: blur(8px);
  animation: float-slow-2 22s infinite alternate ease-in-out;
  will-change: transform;
}
.feature-icon { inline-size: 46px; block-size: 46px; border-radius: 13px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); font-size: 1.3rem; }

/* Landing building blocks (used by the rebuilt landing page) */
.eyebrow { display:inline-flex; align-items:center; gap:7px; font-weight:700; font-size:.82rem;
  letter-spacing:.04em; text-transform:uppercase; color:var(--primary);
  background:color-mix(in srgb,var(--primary) 11%, transparent); padding:6px 13px; border-radius:var(--radius-pill); }
.section { padding-block: clamp(40px, 7vw, 76px); }
.section-tint { background:
  linear-gradient(180deg, transparent, color-mix(in srgb,var(--primary) 4%, transparent) 40%, transparent),
  var(--bg-tint); }
.stat-row { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; }
.stat-card { text-align:center; padding:22px 16px; }
.stat-card .big { font-size: clamp(1.8rem,4vw,2.6rem); font-weight:800; background:var(--grad-text);
  -webkit-background-clip:text; background-clip:text; color:transparent; line-height:1.1; }
.step { display:flex; gap:16px; align-items:flex-start; }
.step .n { inline-size:42px; block-size:42px; border-radius:12px; flex:none; display:grid; place-items:center;
  font-weight:800; color:#fff; background:var(--grad-brand); box-shadow:var(--shadow-brand); }
.feature-card { padding:24px; border-radius:var(--radius); border:1px solid var(--border); background:var(--surface);
  transition:transform var(--speed), box-shadow var(--speed), border-color var(--speed); }
.feature-card:hover { transform:translateY(-4px); box-shadow:var(--shadow-lg); border-color:var(--border-2); }
.cta-band { background:var(--grad-brand); color:#fff; border-radius:var(--radius-lg); padding:clamp(28px,5vw,52px);
  text-align:center; box-shadow:var(--shadow-brand); position:relative; overflow:hidden; }
.cta-band h2, .cta-band p { color:#fff; }
.cta-band::after { content:""; position:absolute; inset-block-start:-40%; inset-inline-end:-10%;
  inline-size:360px; block-size:360px; border-radius:50%; background:rgba(255,255,255,.12); }
.faq-item { border:1px solid var(--border); border-radius:var(--radius-sm); padding:16px 18px; background:var(--surface); }
.faq-item summary { font-weight:700; cursor:pointer; list-style:none; display:flex; justify-content:space-between; gap:10px; }
.faq-item summary::-webkit-details-marker { display:none; }
.faq-item summary::after { content:"+"; color:var(--primary); font-weight:800; }
.faq-item[open] summary::after { content:"−"; }
.price-tag { display:inline-flex; align-items:baseline; gap:10px; }
.price-tag .now { font-size: clamp(2rem,5vw,3rem); font-weight:800; color:var(--primary); }
.price-tag .was { text-decoration:line-through; color:var(--text-3); font-size:1.1rem; }

/* ---- Dashboard -------------------------------------------- */
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .num { font-size: 1.9rem; font-weight: 800; background: var(--grad-text);
  -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1.1; }
.archive-item {
  display: flex; align-items: center; gap: 13px; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  transition: box-shadow var(--speed), border-color var(--speed), transform var(--speed); color: var(--text);
}
a.archive-item:hover { box-shadow: var(--shadow); border-color: var(--border-2); transform: translateX(2px); }
html[dir="rtl"] a.archive-item:hover { transform: translateX(-2px); }
.archive-item .ico { inline-size: 40px; block-size: 40px; border-radius: 11px; display: grid; place-items: center;
  background: var(--surface-2); font-size: 1.15rem; flex: none; }

/* ---- Sandboxed presentation iframe ------------------------ */
.present-frame { inline-size: 100%; min-block-size: 360px; border: 1px solid var(--border);
  border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-sm); }

/* ---- Countdown -------------------------------------------- */
.countdown { display: inline-flex; gap: 8px; font-variant-numeric: tabular-nums; }
.countdown .unit { background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px;
  padding: 8px 12px; text-align: center; min-inline-size: 56px; }
.countdown .unit b { display: block; font-size: 1.45rem; font-weight: 800; line-height: 1.1; }
.countdown .unit span { font-size: .68rem; color: var(--text-2); }
.countdown.urgent .unit { background: color-mix(in srgb, var(--error) 13%, transparent);
  border-color: color-mix(in srgb,var(--error) 30%,transparent); color: var(--error); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.62} }

/* ============================================================
   Kanban (admin board)  — class names matched to live markup
   markup: .kanban > .kan-col > (.kan-head[.accent] + .kan-body > .kan-card)
   ============================================================ */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(286px, 1fr);
  gap: 16px; overflow-x: auto; padding-block-end: 14px; scroll-snap-type: x proximity;
  scrollbar-width: thin; }
.kanban::-webkit-scrollbar { height: 9px; }
.kanban::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 999px; }
.kan-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; min-block-size: 130px; scroll-snap-align: start; overflow: hidden; }
.kan-head { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 13px 15px; font-weight: 800; font-size: .92rem; color: var(--text);
  background: var(--surface); border-block-end: 1px solid var(--border); position: relative; }
.kan-head::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; inline-size: 4px;
  background: var(--primary); }
.kan-head.amber::before   { background: var(--accent); }
.kan-head.teal::before    { background: var(--secondary); }
.kan-head.gray::before    { background: var(--text-3); }
.kan-head.primary::before { background: var(--primary); }
.kan-body { padding: 12px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.kan-card { display: flex; flex-direction: column; gap: 3px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px 15px;
  box-shadow: var(--shadow-xs); color: var(--text);
  transition: box-shadow var(--speed), transform var(--speed), border-color var(--speed); }
a.kan-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--primary); }
.kan-card strong { font-weight: 700; }
.kan-card .muted { font-size: .82rem; }
.kan-card.static { cursor: default; }
.kan-empty { color: var(--text-3); text-align: center; font-size: .86rem; padding: 18px 8px; margin: 0; }

/* ============================================================
   Chat — class names matched to live markup
   markup: .chat > (.chat-stream > .bubble.(me|them) > .txt + .meta) + .chat-compose > .composer
   ============================================================ */
.chat { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; min-block-size: 60vh; }
.chat-stream { flex: 1; display: flex; flex-direction: column; gap: 12px; padding: 18px;
  overflow-y: auto; max-block-size: 64vh;
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb,var(--primary) 5%, transparent), transparent 40%),
    var(--bg); }
.bubble { max-inline-size: 80%; padding: 11px 15px; border-radius: 18px; box-shadow: var(--shadow-xs);
  word-break: break-word; line-height: 1.55; animation: bubin .25s var(--ease); }
@keyframes bubin { from { opacity: 0; transform: translateY(6px); } }
.bubble.them { background: var(--surface); border: 1px solid var(--border); align-self: flex-start; border-start-start-radius: 5px; }
.bubble.me   { background: var(--grad-brand); color: #fff; align-self: flex-end; border-start-end-radius: 5px; }
.bubble .txt { font-size: .96rem; }
.bubble .meta { font-size: .68rem; opacity: .72; margin-block-start: 5px; }
.bubble.me a { color: #fff; text-decoration: underline; }
.chat-compose { padding: 12px 14px; border-block-start: 1px solid var(--border); background: var(--surface); }
.composer { display: flex; gap: 9px; align-items: flex-end; }
.composer textarea { min-block-size: 44px; max-block-size: 140px; border-radius: var(--radius-sm); resize: none; }

/* ---- Tables ----------------------------------------------- */
.table { inline-size: 100%; border-collapse: collapse; }
.table th, .table td { text-align: start; padding: 11px 13px; border-block-end: 1px solid var(--border); }
.table th { font-size: .76rem; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.table tbody tr { transition: background var(--speed); }
.table tbody tr:hover { background: var(--surface-2); }

/* ---- Misc ------------------------------------------------- */
.divider { block-size: 1px; background: var(--border); margin-block: 18px; border: 0; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.codebox, textarea.mono { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.toast-host { position: fixed; inset-block-end: 22px; inset-inline-end: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  animation: toastin .25s var(--ease); font-weight: 600; }
@keyframes toastin { from { opacity: 0; transform: translateY(10px); } }
footer.site { border-block-start: 1px solid var(--border); margin-block-start: 56px; padding-block: 28px; color: var(--text-2); font-size: .88rem; }
footer.site a { font-weight: 600; }

/* ============================================================
   RESPONSIVE — mobile first. The !important rules below also
   override page-level inline grid-template-columns so every
   2/3-column layout stacks cleanly on phones (key fix).
   ============================================================ */
@media (max-width: 860px) {
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr !important; gap: 16px; }
  .stat-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  body { font-size: 15.5px; }
  .container { padding-inline: 12px; } /* تقليل طفيف لزيادة المساحة الجانبية المتوفرة */
  main.container { padding-block: 18px !important; }
  .card { padding: 18px; }
  .card.pad-lg { padding: 20px; }
  .grid { gap: 14px; }

  /* Navigation compresses to the essentials */
  .nav .container { gap: 6px; min-height: 54px; }
  .brand { gap: 8px; }
  .brand span:not(.logo) { font-size: 0.95rem; }
  .nav-links { gap: 4px; }
  .nav-links .btn.sm, .nav-links .btn.ghost.sm { padding: 6px 10px; font-size: 0.78rem; }
  .iconbtn { inline-size: 36px; block-size: 36px; font-size: 0.9rem; }

  /* Buttons go full-width inside button rows for easy tapping */
  .btn.lg { padding: 13px 20px; font-size: 1rem; inline-size: 100%; }
  .auth-wrap { padding: 20px 14px; min-block-size: calc(100vh - 58px); }

  /* Tables scroll horizontally instead of squashing */
  .card > .table, section .table { display: block; overflow-x: auto; white-space: nowrap; }

  /* Two-up tool consoles (prompt/paste) stack */
  .countdown .unit { min-inline-size: 48px; padding: 7px 10px; }
  .countdown .unit b { font-size: 1.2rem; }

  /* Sticky action bars get breathing room above the thumb */
  .card.spread[style*="sticky"], .card[style*="sticky"] { inset-block-end: 8px !important; }

  /* Kanban columns size to the viewport for comfortable swiping */
  .kanban { grid-auto-columns: 84%; }
  .bubble { max-inline-size: 88%; }
  .stat-row { grid-template-columns: 1fr; }
  .step { gap: 12px; }

  h1 { font-size: clamp(1.5rem, 7vw, 2rem); }
}

@media (max-width: 480px) {
  .brand span:not(.logo) { display: none; } /* إخفاء النص لإفساح مجال كافٍ للأزرار على الجوال */
  .nav-links .btn.sm, .nav-links .btn.ghost.sm { padding: 5px 8px; font-size: 0.75rem; }
}

@media (max-width: 380px) {
  .nav-links .btn { display: none; }            /* keep only icons + login on tiny screens */
  .nav-links .iconbtn, .nav-links #notifBell { display: inline-grid; }
  .nav .container { padding-inline: 8px; }       /* تقليص إضافي للهامش الداخلي لضمان الاحتواء التام */
}

/* ---- Reduced motion --------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important;
      transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---- Print (PDF export via browser) ----------------------- */
@media print {
  .nav, .site, footer.site, .no-print, .btn, .composer, .chat-compose, .toast-host { display: none !important; }
  body { background: #fff; color: #000; }
  .print-brand { display: flex !important; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  @page { margin: 18mm 14mm; }
}
.print-brand { display: none; align-items: center; gap: 10px; border-block-end: 2px solid var(--primary);
  padding-block-end: 10px; margin-block-end: 16px; }
.print-foot { display: none; }
@media print { .print-foot { display: block; text-align: center; color: #666; font-size: 11px; margin-block-start: 20px; border-block-start: 1px solid #ccc; padding-block-start: 8px; } }


/* ============================================================
   Animated Glowing Background for Landing Page (High Performance)
   ============================================================ */
.bg-glow-container {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}
.bg-glow-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.12;
  will-change: transform;
}
html[data-theme="dark"] .bg-glow-blob {
  opacity: 0.06;
}
.bg-glow-1 {
  top: -10%;
  right: -10%;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, var(--secondary) 0%, transparent 70%);
  animation: float-slow-1 25s infinite alternate ease-in-out;
}
.bg-glow-2 {
  bottom: -15%;
  left: -10%;
  width: 65vw;
  height: 65vw;
  background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
  animation: float-slow-2 30s infinite alternate ease-in-out;
}
.bg-glow-3 {
  top: 45%;
  left: 35%;
  width: 45vw;
  height: 45vw;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
  opacity: 0.05;
  animation: float-slow-3 35s infinite alternate ease-in-out;
}
html[data-theme="dark"] .bg-glow-3 {
  opacity: 0.03;
}

@keyframes float-slow-1 {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(80px, 100px, 0) scale(1.15); }
  100% { transform: translate3d(-40px, -50px, 0) scale(0.9); }
}
@keyframes float-slow-2 {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-90px, 80px, 0) scale(1.1); }
  100% { transform: translate3d(50px, -40px, 0) scale(0.9); }
}
@keyframes float-slow-3 {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); }
  100% { transform: translate3d(20px, -20px, 0) rotate(360deg); }
}

.landing-main {
  width: 100%;
  max-width: 100%;
  padding-block: 0;
  overflow-x: hidden;
}