/* CodeCraft Studio — design system */
:root {
    --bg: #070b18;
    --bg-soft: #0d1326;
    --surface: #121a33;
    --surface-2: #16203d;
    --line: rgba(148, 163, 184, 0.16);
    --text: #eef2ff;
    --muted: #94a3b8;
    --brand: #6366f1;
    --brand-2: #22d3ee;
    --good: #34d399;
    --warn: #fbbf24;
    --bad: #fb7185;
    --info: #60a5fa;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 24px 60px -30px rgba(2, 6, 23, 0.9);
    --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    --font-ar: "Cairo", "Noto Kufi Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
}

[dir="rtl"] {
    --font: var(--font-ar);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    background: radial-gradient(1200px 600px at 85% -10%, rgba(99, 102, 241, 0.22), transparent 60%),
                radial-gradient(900px 500px at 5% 10%, rgba(34, 211, 238, 0.14), transparent 55%),
                var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -0.02em; }
h1 { font-size: clamp(2rem, 4vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 2.6vw, 2.2rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1rem; color: #cbd5f5; }
small { color: var(--muted); }
hr { border: none; border-top: 1px solid var(--line); margin: 1.5rem 0; }

.container { width: min(1180px, 92vw); margin-inline: auto; }
.container-wide { width: min(1400px, 94vw); margin-inline: auto; }
.section { padding: 5rem 0; }
.section-sm { padding: 3rem 0; }
.center { text-align: center; }
.muted { color: var(--muted); }
.mono { font-family: "JetBrains Mono", ui-monospace, "SF Mono", monospace; font-size: .85em; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; gap: 1rem; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.flex-center { display: flex; align-items: center; gap: .6rem; }
.check-row { display: flex; align-items: center; gap: .55rem; margin-bottom: .35rem; }
.check-row input { flex: 0 0 auto; width: 16px; height: 16px; }
.check-row span { flex: 1 1 auto; }
.wrap { flex-wrap: wrap; }
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.split > * { min-width: 0; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ branding */
.logo { display: inline-flex; align-items: center; gap: .65rem; font-weight: 700; letter-spacing: -0.03em; }
.logo-mark {
    width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    box-shadow: 0 10px 30px -12px rgba(99, 102, 241, .9);
    font-weight: 800; color: #04101f; font-size: 1.05rem;
}
img.logo-mark { width: auto; background: none; box-shadow: none; object-fit: contain; border-radius: 0; }
.logo span small { display: block; font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); font-weight: 600; }

/* -------------------------------------------------------------------- navbar */
.nav {
    position: sticky; top: 0; z-index: 40;
    backdrop-filter: blur(14px);
    background: rgba(7, 11, 24, .78);
    border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; padding: .9rem 0; gap: 1rem; }
.nav-links { display: flex; align-items: center; gap: 1.4rem; }
.nav-links a { color: #c7d2fe; font-size: .95rem; font-weight: 500; }
.nav-links a:hover, .nav-links a.active { color: #fff; }
.nav-actions { display: flex; align-items: center; gap: .6rem; }
.nav-links-actions { display: none; }
.nav-toggle {
    display: none; background: none; border: 1px solid var(--line); color: var(--text);
    border-radius: 10px; width: 44px; height: 44px; padding: 0; place-items: center; cursor: pointer;
}
.nav-toggle .burger, .nav-toggle .burger::before, .nav-toggle .burger::after {
    display: block; width: 18px; height: 2px; border-radius: 2px; background: currentColor;
    transition: transform .18s ease, opacity .18s ease;
}
.nav-toggle .burger { position: relative; }
.nav-toggle .burger::before, .nav-toggle .burger::after { content: ''; position: absolute; inset-inline-start: 0; }
.nav-toggle .burger::before { top: -6px; }
.nav-toggle .burger::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .burger { background: transparent; }
.nav-toggle[aria-expanded="true"] .burger::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .burger::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 880px) {
    .nav-toggle { display: grid; }
    .nav-inner { position: relative; }
    .nav-links {
        display: flex; flex-direction: column; align-items: stretch; gap: 0;
        position: absolute; inset-inline: 0; top: calc(100% + .55rem);
        background: #0b1020; border: 1px solid var(--line); border-radius: 14px;
        box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .85);
        padding: .4rem; max-height: 0; overflow: hidden; opacity: 0; visibility: hidden;
        transition: max-height .22s ease, opacity .18s ease;
    }
    .nav-links.open { max-height: 80vh; overflow-y: auto; opacity: 1; visibility: visible; }
    .nav-links a { padding: .85rem .9rem; border-radius: 10px; font-size: 1rem; }
    .nav-links a.active, .nav-links a:hover { background: rgba(99, 102, 241, .16); color: #fff; }
    .nav-links-actions { display: grid; gap: .5rem; padding: .6rem .3rem .3rem; border-top: 1px solid var(--line); margin-top: .35rem; }
    .nav-actions > .btn { display: none; }
}

/* ------------------------------------------------------------ language switch */
.lang-switch {
    display: inline-flex; align-items: center; border: 1px solid var(--line);
    border-radius: 999px; overflow: hidden; background: rgba(148, 163, 184, .08);
}
.lang-switch a {
    padding: .34rem .72rem; font-size: .8rem; font-weight: 600; color: #c7d2fe;
    transition: .15s ease; white-space: nowrap;
}
.lang-switch a:hover { color: #fff; background: rgba(99, 102, 241, .22); }
.lang-switch a.active { background: linear-gradient(135deg, var(--brand), #4f46e5); color: #fff; }
.lang-switch.compact a { padding: .28rem .6rem; font-size: .74rem; }

/* ------------------------------------------------------------------- buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .7rem 1.15rem; border-radius: 12px; border: 1px solid transparent;
    font-weight: 600; font-size: .94rem; cursor: pointer; transition: .18s ease;
    background: linear-gradient(135deg, var(--brand), #4f46e5); color: #fff;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 14px 30px -18px rgba(99, 102, 241, 1); }
.btn-ghost { background: rgba(148, 163, 184, .1); border-color: var(--line); color: var(--text); }
.btn-outline { background: transparent; border-color: rgba(99, 102, 241, .55); color: #c7d2fe; }
.btn-light { background: #fff; color: #0b1120; }
.btn-danger { background: linear-gradient(135deg, #f43f5e, #be123c); }
.btn-good { background: linear-gradient(135deg, #10b981, #047857); }
.btn-sm { padding: .42rem .75rem; font-size: .82rem; border-radius: 9px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

/* --------------------------------------------------------------------- cards */
.card {
    background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.015));
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.4rem; box-shadow: var(--shadow);
}
.card-tight { padding: 1rem 1.15rem; }
.card h3 { margin-bottom: .35rem; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.card-title h3 { margin: 0; }
.stat { display: grid; gap: .2rem; }
.stat .value { font-size: 1.85rem; font-weight: 700; letter-spacing: -.03em; }
.stat .label { font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.kpi-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(99,102,241,.16); font-size: 1.1rem; }

/* --------------------------------------------------------------------- badges */
.badge {
    display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .6rem;
    border-radius: 999px; font-size: .74rem; font-weight: 700; letter-spacing: .04em;
    text-transform: uppercase; background: rgba(148,163,184,.16); color: #cbd5f5;
}
.badge.good { background: rgba(52,211,153,.16); color: #6ee7b7; }
.badge.warn { background: rgba(251,191,36,.16); color: #fcd34d; }
.badge.bad { background: rgba(251,113,133,.18); color: #fda4af; }
.badge.info { background: rgba(96,165,250,.18); color: #93c5fd; }
.badge.muted { background: rgba(148,163,184,.14); color: var(--muted); }
.pill { display: inline-block; padding: .28rem .7rem; border-radius: 999px; border: 1px solid var(--line); font-size: .8rem; color: #c7d2fe; }
.pill.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip { display: inline-block; padding: .2rem .55rem; border-radius: 7px; background: rgba(148,163,184,.13); font-size: .76rem; color: #c7d2fe; }

/* ---------------------------------------------------------------------- forms */
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .35rem; color: #dbe2fb; }
input, select, textarea {
    width: 100%; padding: .72rem .85rem; border-radius: 11px; font: inherit; font-size: .94rem;
    background: rgba(8, 12, 26, .75); border: 1px solid var(--line); color: var(--text);
    transition: .15s ease;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(99,102,241,.22); }
textarea { min-height: 120px; resize: vertical; }
select option { background: #0d1326; }
.field { margin-bottom: 1rem; }
.field-error { color: #fda4af; font-size: .8rem; margin-top: .3rem; }
.field-hint { color: var(--muted); font-size: .8rem; margin-top: .3rem; }
.input-error { border-color: rgba(251,113,133,.7) !important; }
.checkbox { display: flex; align-items: flex-start; gap: .6rem; font-weight: 500; font-size: .9rem; }
.checkbox input { width: auto; margin-top: .25rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
td.truncate { max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
th, td { padding: .8rem 1rem; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); background: rgba(148,163,184,.05); }
tbody tr:hover { background: rgba(99,102,241,.07); }
td.wrap-text, th.wrap-text { white-space: normal; }

/* ------------------------------------------------------------------- progress */
.progress { height: 8px; border-radius: 999px; background: rgba(148,163,184,.18); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.progress.good > span { background: linear-gradient(90deg, #10b981, #34d399); }
.progress.warn > span { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.progress.bad > span { background: linear-gradient(90deg, #f43f5e, #fb7185); }
.progress.info > span { background: linear-gradient(90deg, #3b82f6, #60a5fa); }

/* ------------------------------------------------------------------- timeline */
.timeline { list-style: none; margin: 0; padding: 0; padding-inline-start: 1.4rem; border-inline-start: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 1.4rem; padding-inline-start: 1rem; }
.timeline li::before {
    content: ""; position: absolute; inset-inline-start: -1.72rem; top: .35rem;
    width: 11px; height: 11px; border-radius: 50%; background: var(--brand);
    box-shadow: 0 0 0 4px rgba(99,102,241,.2);
}
.timeline li.done::before { background: var(--good); box-shadow: 0 0 0 4px rgba(52,211,153,.18); }
.timeline li.warn::before { background: var(--warn); box-shadow: 0 0 0 4px rgba(251,191,36,.18); }
.timeline .t-title { font-weight: 600; }
.timeline .t-meta { font-size: .8rem; color: var(--muted); }

/* -------------------------------------------------------------------- alerts */
.alert { border-radius: 12px; padding: .85rem 1rem; margin-bottom: 1rem; border: 1px solid; font-size: .92rem; }
.alert.success { background: rgba(52,211,153,.12); border-color: rgba(52,211,153,.35); color: #a7f3d0; }
.alert.error { background: rgba(251,113,133,.12); border-color: rgba(251,113,133,.35); color: #fecdd3; }
.alert.info { background: rgba(96,165,250,.12); border-color: rgba(96,165,250,.35); color: #bfdbfe; }

/* ---------------------------------------------------------------------- hero */
.hero { padding: 5.5rem 0 4rem; }
.hero .eyebrow { display: inline-flex; align-items: center; gap: .5rem; padding: .35rem .8rem; border-radius: 999px; border: 1px solid rgba(99,102,241,.4); background: rgba(99,102,241,.12); font-size: .8rem; color: #c7d2fe; margin-bottom: 1.2rem; }
.hero h1 span { background: linear-gradient(120deg, #a5b4fc, #22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 1.1rem; max-width: 620px; }
.hero-actions { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 1.6rem; }
.hero-stats { display: flex; gap: 2.5rem; margin-top: 3rem; flex-wrap: wrap; }
.hero-stats .value { font-size: 1.6rem; font-weight: 700; }

.mockup { border-radius: 18px; border: 1px solid var(--line); background: var(--surface); overflow: hidden; box-shadow: var(--shadow); }
.mockup-bar { display: flex; gap: .4rem; padding: .7rem .9rem; background: rgba(148,163,184,.08); border-bottom: 1px solid var(--line); }
.mockup-bar i { width: 10px; height: 10px; border-radius: 50%; background: #475569; display: block; }
.mockup-body { padding: 1.1rem; display: grid; gap: .7rem; }
.skeleton { height: 10px; border-radius: 6px; background: linear-gradient(90deg, rgba(148,163,184,.25), rgba(148,163,184,.1)); }

/* ------------------------------------------------------------------- catalog */
.work-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.4rem; }
.work-card { border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; background: var(--surface); transition: .2s ease; display: flex; flex-direction: column; }
.work-card:hover { transform: translateY(-4px); border-color: rgba(99,102,241,.6); box-shadow: 0 30px 60px -35px rgba(0,0,0,.95); }
.work-thumb { aspect-ratio: 16 / 10; position: relative; display: grid; place-items: center; overflow: hidden; }
.work-thumb .browser {
    position: absolute; inset: 12% 8% -4%; border-radius: 12px 12px 0 0; background: rgba(2,6,23,.55);
    border: 1px solid rgba(255,255,255,.18); backdrop-filter: blur(3px);
}
.work-thumb .browser b { display: block; height: 22px; border-radius: 11px 11px 0 0; background: rgba(255,255,255,.16); }
.work-thumb .label { position: relative; z-index: 2; font-weight: 800; font-size: 1.35rem; letter-spacing: -.03em; text-shadow: 0 6px 24px rgba(0,0,0,.6); padding: 0 1rem; text-align: center; }
.work-body { padding: 1.1rem 1.2rem 1.3rem; display: flex; flex-direction: column; gap: .55rem; flex: 1; }
.work-body .work-actions { margin-top: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------- live demo bar */
.live-shell { height: 100vh; display: flex; flex-direction: column; background: #05070f; }
.live-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .55rem 1rem; background: linear-gradient(90deg, rgba(15,23,42,.98), rgba(30,27,75,.98));
    border-bottom: 1px solid rgba(148,163,184,.25);
}
.live-bar .meta { display: flex; align-items: center; gap: .8rem; min-width: 0; flex: 1; }
.live-bar .meta .logo, .live-bar .meta .logo * { white-space: nowrap; }
.live-bar .badge { white-space: nowrap; }
.live-bar .demo-name { font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-bar .actions { display: flex; align-items: center; gap: .5rem; flex: 0 0 auto; }
.live-bar .actions .btn { white-space: nowrap; }
.live-frame { flex: 1; border: none; width: 100%; background: #fff; }
@media (max-width: 820px) {
    .live-shell { height: 100dvh; }
    .live-bar { flex-wrap: wrap; gap: .45rem; padding: .5rem .6rem; }
    .live-bar .demo-name, .live-bar .badge { display: none; }
    .live-bar .meta { flex: 0 0 auto; }
    /* The action buttons scroll inside the bar instead of pushing the page wide. */
    .live-bar .actions {
        flex: 1 1 100%; gap: .4rem; overflow-x: auto; -webkit-overflow-scrolling: touch;
        scrollbar-width: none; padding-bottom: 2px;
    }
    .live-bar .actions::-webkit-scrollbar { display: none; }
    .live-bar .actions .btn { flex: 0 0 auto; font-size: .8rem; padding: .38rem .6rem; }
}

/* ------------------------------------------------------------------ dashboard */
.app-shell { display: grid; grid-template-columns: 262px 1fr; min-height: 100vh; }
.sidebar { background: rgba(8, 12, 26, .92); border-inline-end: 1px solid var(--line); padding: 1.3rem 1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-nav { display: grid; gap: .2rem; margin-top: 1.4rem; }
.side-nav a { display: flex; align-items: center; gap: .7rem; padding: .62rem .8rem; border-radius: 11px; color: #c7d2fe; font-size: .93rem; font-weight: 500; }
.side-nav a:hover { background: rgba(99,102,241,.14); color: #fff; }
.side-nav a.active { background: linear-gradient(135deg, rgba(99,102,241,.32), rgba(34,211,238,.16)); color: #fff; }
.side-nav .group { font-size: .7rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin: 1.1rem .8rem .4rem; }
.app-main { padding: 1.4rem clamp(1rem, 3vw, 2.2rem) 3rem; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.6rem; flex-wrap: wrap; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; color: #04101f; }
.bell { position: relative; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); }
.bell b { position: absolute; top: -5px; inset-inline-end: -5px; min-width: 18px; height: 18px; border-radius: 999px; background: var(--bad); color: #fff; font-size: .68rem; display: grid; place-items: center; padding: 0 4px; }
.drawer-toggle { margin-inline-end: .2rem; }
.drawer-veil { display: none; }

@media (max-width: 900px) {
    /* Sidebar becomes a slide-in drawer so the workspace starts at the top. */
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 60;
        width: min(84vw, 300px); height: 100vh; overflow-y: auto;
        transform: translateX(-115%); transition: transform .22s ease;
        background: #080c1a;
    }
    [dir="rtl"] .sidebar { transform: translateX(115%); }
    .sidebar.open, [dir="rtl"] .sidebar.open { transform: translateX(0); }
    .drawer-veil {
        display: block; position: fixed; inset: 0; z-index: 50;
        background: rgba(2, 6, 23, .6); backdrop-filter: blur(2px);
    }
    .drawer-veil[hidden] { display: none; }
    .drawer-toggle { display: grid; }
    .topbar { position: sticky; top: 0; z-index: 30; background: var(--bg); padding-block: .7rem; margin-bottom: 1rem; }
    .topbar h2 { font-size: 1.15rem; }
    .topbar > .flex-center { flex-wrap: wrap; }
}

/* ---------------------------------------------------------------- mini chart */
.bars { display: flex; align-items: flex-end; gap: .55rem; height: 120px; }
.bars .bar { flex: 1; background: linear-gradient(180deg, var(--brand), rgba(34,211,238,.55)); border-radius: 8px 8px 3px 3px; min-height: 4px; position: relative; }
.bars .bar span { position: absolute; inset: auto 0 -1.5rem; text-align: center; font-size: .7rem; color: var(--muted); }
.chart-legend { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); margin-top: 2rem; }

.tabs { display: flex; gap: .4rem; border-bottom: 1px solid var(--line); margin-bottom: 1.2rem; flex-wrap: wrap; }
.tabs button, .tabs a { background: none; border: none; padding: .6rem .9rem; color: var(--muted); font: inherit; font-size: .92rem; cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button.active, .tabs a.active { color: #fff; border-bottom-color: var(--brand); }

.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty h3 { color: var(--text); }

footer.site {
    border-top: 1px solid var(--line); padding: 3rem 0 2rem; margin-top: 4rem;
    background: rgba(8, 12, 26, .6);
}
.footer-grid { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: 2rem; }
.footer-grid h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.footer-grid a { display: block; padding: .2rem 0; color: #c7d2fe; font-size: .92rem; }
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr 1fr; } }

/* --------------------------------------------------------------- auth screen */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { padding: 3rem; display: flex; flex-direction: column; justify-content: center; gap: 1rem; background: linear-gradient(160deg, rgba(99,102,241,.22), rgba(34,211,238,.08)); border-inline-end: 1px solid var(--line); }
.auth-main { display: grid; place-items: center; padding: 2.5rem 1.5rem; }
.auth-card { width: min(460px, 100%); }
@media (max-width: 900px) { .auth-wrap { grid-template-columns: 1fr; } .auth-side { display: none; } }

.invoice-sheet { background: #fff; color: #0f172a; border-radius: 14px; padding: 2.5rem; }
.invoice-sheet table th, .invoice-sheet table td { border-color: #e2e8f0; color: #0f172a; }
.invoice-sheet .muted { color: #64748b; }
@media print { .no-print { display: none !important; } body { background: #fff; } }

/* ------------------------------------------------------------ rtl adjustments */
[dir="rtl"] .badge,
[dir="rtl"] .stat .label,
[dir="rtl"] th,
[dir="rtl"] .side-nav .group,
[dir="rtl"] .footer-grid h4 { letter-spacing: 0; }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4 { letter-spacing: 0; }
[dir="rtl"] .bars { flex-direction: row-reverse; }
[dir="rtl"] .progress > span { background: linear-gradient(270deg, var(--brand), var(--brand-2)); }
[dir="rtl"] .mono { direction: ltr; unicode-bidi: embed; display: inline-block; }

/* ----------------------------------------------------------------- polish */
:where(a, button, input, select, textarea, summary):focus-visible {
    outline: 2px solid var(--brand-2); outline-offset: 2px;
}
.card { transition: border-color .18s ease, transform .18s ease; }
.section-head { max-width: 700px; margin-bottom: 2rem; }
.section-head p { color: var(--muted); }
.stack { display: grid; gap: .75rem; }
@media (max-width: 640px) {
    body { font-size: 15.5px; }
    .section { padding: 3.2rem 0; }
    .card { padding: 1.15rem; }
    .hero { padding: 3.5rem 0 2.5rem; }
    .hero-stats { gap: 1.5rem; }
    .btn { padding: .62rem 1rem; }
    .nav-actions { gap: .4rem; }
    .lang-switch a { padding: .3rem .55rem; font-size: .74rem; }
}
@media (max-width: 720px) {
    /* The wordmark logo carries the brand on its own on narrow screens. */
    .nav .logo > span { display: none; }
    .nav img.logo-mark { height: 30px; }
}

@media (max-width: 520px) {
    .nav-inner { gap: .35rem; }
    .nav-actions { gap: .25rem; }
    .nav-actions > .btn-ghost { display: none; }
    .nav-actions > .btn { padding-inline: .75rem; }
    .logo span small { display: none; }
}

/* ---------------------------------------------------------------- messaging */
.dot {
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    background: var(--bad); color: #fff; font-size: .68rem; font-weight: 700;
    display: inline-grid; place-items: center; margin-inline-start: auto;
}

.chat-layout { display: grid; grid-template-columns: 320px 1fr; gap: 1.2rem; align-items: start; }
.chat-aside { max-height: 78vh; overflow: auto; }

.thread-list { display: grid; gap: .35rem; margin-top: .6rem; }
.thread {
    display: flex; gap: .7rem; align-items: flex-start; padding: .7rem .75rem;
    border-radius: 12px; border: 1px solid transparent; color: inherit;
}
.thread:hover { background: rgba(99,102,241,.1); }
.thread.active { background: rgba(99,102,241,.18); border-color: rgba(99,102,241,.45); }
.thread .avatar { width: 34px; height: 34px; font-size: .75rem; flex: none; }
.thread-body { display: grid; gap: .15rem; min-width: 0; flex: 1; }
.thread-top { display: flex; align-items: center; gap: .5rem; }
.thread-top strong { font-size: .92rem; }
.thread .preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chat-panel { display: flex; flex-direction: column; }
.chat { display: grid; gap: .9rem; padding: .4rem 0; max-height: 58vh; overflow: auto; }
.chat-compact { max-height: none; margin-top: .6rem; }

.bubble-row { display: flex; gap: .6rem; align-items: flex-end; }
.bubble-row .avatar { width: 30px; height: 30px; font-size: .7rem; flex: none; }
.bubble-row.mine { flex-direction: row-reverse; }
.bubble {
    max-width: min(560px, 78%); padding: .7rem .9rem; border-radius: 16px;
    background: rgba(148,163,184,.12); border: 1px solid var(--line);
}
.bubble p { margin: .25rem 0 0; font-size: .93rem; line-height: 1.65; }
.bubble-meta { display: flex; gap: .5rem; align-items: baseline; font-size: .78rem; }
.bubble-row.mine .bubble {
    background: linear-gradient(135deg, rgba(99,102,241,.3), rgba(34,211,238,.16));
    border-color: rgba(99,102,241,.4);
    border-end-end-radius: 6px;
}
.bubble-row.theirs .bubble { border-end-start-radius: 6px; }

.chat-composer { display: grid; grid-template-columns: 1fr auto; gap: .6rem; align-items: end; margin-top: 1rem; }
.chat-composer textarea { min-height: 62px; resize: vertical; }
.chat-composer .field-error { grid-column: 1 / -1; }

@media (max-width: 900px) {
    .chat-layout { grid-template-columns: 1fr; }
    .chat-aside { max-height: 240px; }
}
@media (max-width: 620px) {
    .chat { max-height: none; overflow: visible; }
    .bubble { max-width: 88%; }
    .bubble-row .avatar { display: none; }
    .chat-composer { grid-template-columns: 1fr; }
    .chat-composer .btn { width: 100%; }
}

/* Rich, photographic portfolio cards */
.work-thumb { background-size: cover; background-position: center; transition: transform .25s ease, filter .25s ease; }
.work-card:hover .work-thumb { filter: saturate(1.08); }
.work-thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 30%, transparent), transparent 55%); }
.work-thumb .browser { opacity: .7; }
.case-cover { display: grid; place-items: center; aspect-ratio: 16/9; background-size: cover; background-position: center; color: #fff; }
.case-cover span { font-size: clamp(1.15rem, 3vw, 1.7rem); font-weight: 800; padding: 1rem; text-align: center; text-shadow: 0 5px 25px rgba(0,0,0,.75); }
.team-photo { width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); }
