/* =====================================================================
   Bonyan ERP — "Blueprint Luxe" design system
   Navy ink · champagne gold · drafting-paper grid · crop-mark corners
   Logical properties everywhere → RTL / LTR mirror automatically.
   ===================================================================== */

:root {
	--font: "Almarai", system-ui, -apple-system, "Segoe UI", sans-serif;
	--r-sm: 10px; --r: 16px; --r-lg: 22px;
	--ease: cubic-bezier(.22, 1, .36, 1);
	--side-w: 272px;

	--navy-900: #050d1c; --navy-800: #0a1730; --navy-700: #0f2346; --navy-600: #16305c; --navy-500: #2b5490; --navy-300: #8fa6c9;
	--gold: #c8a24a; --gold-2: #e7cf8a; --gold-3: #f6e7bd; --orange: #e8871a;
	--ok: #1f9d63; --warn: #d98a0b; --bad: #d9473a; --info: #2b72d9;

	/* light: warm drafting paper */
	--bg: #f4f2ec;
	--bg-grid: rgba(15, 35, 70, .055);
	--bg-grid-strong: rgba(15, 35, 70, .09);
	--surface: rgba(255, 255, 255, .78);
	--surface-solid: #ffffff;
	--surface-2: #faf8f3;
	--text: #0b1a33;
	--muted: #5f6b80;
	--line: rgba(11, 26, 51, .1);
	--line-strong: rgba(11, 26, 51, .18);
	--shadow: 0 1px 0 rgba(255,255,255,.8) inset, 0 18px 40px -24px rgba(11, 26, 51, .35);
	--shadow-lg: 0 40px 80px -40px rgba(11, 26, 51, .45);
	--accent: var(--navy-700);
	--accent-ink: #fff;
	--crop: rgba(200, 162, 74, .75);
	color-scheme: light;
}

[data-theme="dark"] {
	--bg: #050d1c;
	--bg-grid: rgba(120, 160, 230, .055);
	--bg-grid-strong: rgba(120, 160, 230, .09);
	--surface: rgba(14, 30, 58, .72);
	--surface-solid: #0c1a33;
	--surface-2: #0a1730;
	--text: #ecf1fa;
	--muted: #95a6c2;
	--line: rgba(150, 180, 230, .12);
	--line-strong: rgba(150, 180, 230, .22);
	--shadow: 0 1px 0 rgba(255,255,255,.05) inset, 0 20px 50px -28px rgba(0, 0, 0, .8);
	--shadow-lg: 0 40px 90px -40px rgba(0, 0, 0, .9);
	--accent: var(--gold);
	--accent-ink: #0b1a33;
	--crop: rgba(231, 207, 138, .6);
	color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.75; color: var(--text);
	background-color: var(--bg);
	background-image:
		linear-gradient(var(--bg-grid-strong) 1px, transparent 1px),
		linear-gradient(90deg, var(--bg-grid-strong) 1px, transparent 1px),
		linear-gradient(var(--bg-grid) 1px, transparent 1px),
		linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
	background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
	background-attachment: fixed;
	-webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; font-weight: 800; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.i3d { width: 22px; height: 22px; object-fit: contain; flex: none; filter: drop-shadow(0 3px 4px rgba(11, 26, 51, .22)); }
.glyph { width: 18px; height: 18px; flex: none; }
[dir="rtl"] .flip { transform: scaleX(-1); }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* ---------------- shell ---------------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side {
	position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin;
	color: #dbe4f3;
	background:
		linear-gradient(rgba(143, 166, 201, .06) 1px, transparent 1px) 0 0 / 22px 22px,
		linear-gradient(90deg, rgba(143, 166, 201, .06) 1px, transparent 1px) 0 0 / 22px 22px,
		linear-gradient(180deg, #0c1c38 0%, #071226 100%);
	border-inline-end: 1px solid rgba(231, 207, 138, .18);
	padding: 18px 14px 24px;
	display: flex; flex-direction: column; gap: 6px;
	z-index: 40;
}
.side-brand { display: flex; align-items: center; justify-content: center; padding: 8px 6px 16px; margin-bottom: 6px; border-bottom: 1px solid rgba(231, 207, 138, .16); }
.side-brand img { height: 64px; width: auto; }
.side-company { text-align: center; font-size: .78rem; color: var(--gold-2); letter-spacing: .02em; margin-top: -8px; margin-bottom: 8px; }
.nav-group { margin-top: 12px; }
.nav-group > span { display: flex; align-items: center; gap: 8px; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgba(219, 228, 243, .5); padding: 0 12px 6px; }
.nav-group > span::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(231, 207, 138, .3), transparent); }
[dir="rtl"] .nav-group > span::after { background: linear-gradient(270deg, rgba(231, 207, 138, .3), transparent); }
[lang="ar"] .nav-group > span { letter-spacing: 0; }
.nav-link {
	position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 12px;
	font-weight: 700; font-size: .92rem; color: #cfd9ea; transition: background .25s, color .25s;
}
.nav-link .i3d { width: 24px; height: 24px; }
.nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-link.active { background: linear-gradient(90deg, rgba(231, 207, 138, .16), rgba(231, 207, 138, .04)); color: #fff; box-shadow: inset 0 0 0 1px rgba(231, 207, 138, .22); }
[dir="rtl"] .nav-link.active { background: linear-gradient(270deg, rgba(231, 207, 138, .16), rgba(231, 207, 138, .04)); }
.nav-link.active::before { content: ""; position: absolute; inset-block: 9px; inset-inline-start: -14px; width: 3px; border-radius: 3px; background: var(--gold-2); box-shadow: 0 0 12px var(--gold); }
.nav-link.soon { opacity: .55; }
.nav-link.soon:hover { opacity: .85; }
.nav-link .tag { margin-inline-start: auto; font-size: .64rem; font-weight: 800; padding: 1px 7px; border-radius: 999px; background: rgba(231, 207, 138, .14); color: var(--gold-2); white-space: nowrap; }
.side-foot { margin-top: auto; padding-top: 18px; font-size: .72rem; color: rgba(219, 228, 243, .45); text-align: center; }

.scrim { display: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
	position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
	padding: 12px clamp(14px, 3vw, 28px);
	background: color-mix(in srgb, var(--bg) 78%, transparent);
	-webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%);
	border-bottom: 1px solid var(--line);
}
.icon-btn.menu-btn { display: none; }
.search {
	flex: 1; max-width: 520px; display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: 12px;
	background: var(--surface); border: 1px solid var(--line); color: var(--muted); cursor: pointer; box-shadow: var(--shadow); transition: border-color .25s;
}
.search:hover { border-color: var(--gold); }
.search kbd { margin-inline-start: auto; font: 700 .72rem var(--font); padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line-strong); color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }
.icon-btn {
	position: relative; width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 12px;
	border: 1px solid var(--line); background: var(--surface); cursor: pointer; transition: transform .25s var(--ease), border-color .25s;
}
.icon-btn:hover { transform: translateY(-1px); border-color: var(--gold); }
.icon-btn .dot { position: absolute; top: 7px; inset-inline-end: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 2px var(--bg); }
.theme-btn .i-moon { display: none; }
[data-theme="dark"] .theme-btn .i-sun { display: none; }
[data-theme="dark"] .theme-btn .i-moon { display: block; }
.me { display: flex; align-items: center; gap: 10px; padding: 4px; padding-inline-end: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.me b { display: block; font-size: .86rem; line-height: 1.2; }
.me small { display: block; font-size: .72rem; color: var(--muted); line-height: 1.2; }
.dropdown { position: relative; }
.menu {
	position: absolute; top: calc(100% + 8px); inset-inline-end: 0; min-width: 240px; z-index: 50; padding: 8px; border-radius: 16px;
	background: var(--surface-solid); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
	opacity: 0; visibility: hidden; transform: translateY(-6px); transition: .2s var(--ease);
}
.dropdown.open .menu { opacity: 1; visibility: visible; transform: none; }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; border: 0; background: none; cursor: pointer; font-weight: 700; font-size: .9rem; text-align: start; }
.menu a:hover, .menu button:hover { background: var(--surface-2); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.notif-list { max-height: 340px; overflow: auto; min-width: 320px; }
.notif { display: block !important; padding: 10px 12px !important; border-bottom: 1px solid var(--line); border-radius: 0 !important; }
.notif b { display: block; font-size: .88rem; }
.notif small { color: var(--muted); }

.content { padding: clamp(16px, 3vw, 32px); padding-bottom: 60px; width: 100%; max-width: 1560px; margin-inline: auto; }

/* ---------------- page header ---------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; color: var(--gold); font-weight: 800; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; }
[lang="ar"] .eyebrow { letter-spacing: 0; font-size: .85rem; }
.eyebrow::before { content: ""; width: 26px; height: 9px; border: 1px solid currentColor; border-top: 0; border-bottom: 0; background: linear-gradient(currentColor, currentColor) center / 100% 1px no-repeat; }
.page-head h1 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); margin-top: 6px; }
.page-head p { color: var(--muted); margin-top: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------------- cards ---------------- */
.card {
	position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow);
	-webkit-backdrop-filter: blur(14px) saturate(150%); backdrop-filter: blur(14px) saturate(150%);
	padding: 22px;
}
/* drafting crop-marks on two corners */
.card.crop::before, .card.crop::after { content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none; }
.card.crop::before { top: 8px; inset-inline-start: 8px; border-top: 1.5px solid var(--crop); border-inline-start: 1.5px solid var(--crop); }
.card.crop::after { bottom: 8px; inset-inline-end: 8px; border-bottom: 1.5px solid var(--crop); border-inline-end: 1.5px solid var(--crop); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h3 { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; }
.card-head h3 .i3d { width: 26px; height: 26px; }
.card-head a { color: var(--muted); font-weight: 700; font-size: .85rem; }
.card-head a:hover { color: var(--gold); }
.grid { display: grid; gap: 18px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
@media (max-width: 1200px) { .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-main { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .g-4, .g-3, .g-2 { grid-template-columns: 1fr; } }

/* hero welcome */
.hello {
	position: relative; overflow: hidden; color: #eef3fb; border: 1px solid rgba(231, 207, 138, .25);
	background:
		radial-gradient(70% 120% at 100% 0%, rgba(232, 135, 26, .22), transparent 60%),
		linear-gradient(rgba(143, 166, 201, .08) 1px, transparent 1px) 0 0 / 26px 26px,
		linear-gradient(90deg, rgba(143, 166, 201, .08) 1px, transparent 1px) 0 0 / 26px 26px,
		linear-gradient(135deg, #0f2346, #071226);
	--muted: #a9b8d2; --line: rgba(231, 207, 138, .18);
}
[dir="rtl"] .hello { background:
		radial-gradient(70% 120% at 0% 0%, rgba(232, 135, 26, .22), transparent 60%),
		linear-gradient(rgba(143, 166, 201, .08) 1px, transparent 1px) 0 0 / 26px 26px,
		linear-gradient(90deg, rgba(143, 166, 201, .08) 1px, transparent 1px) 0 0 / 26px 26px,
		linear-gradient(225deg, #0f2346, #071226); }
.hello h2 { font-size: clamp(1.3rem, 2.4vw, 1.9rem); }
.hello h2 em { font-style: normal; color: var(--gold-2); }
.hello .wire { position: absolute; inset-inline-end: -10px; bottom: -14px; width: 320px; opacity: .55; pointer-events: none; }
.role-chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; font-weight: 800; font-size: .8rem; background: rgba(255, 255, 255, .08); border: 1px solid rgba(231, 207, 138, .35); color: var(--gold-3); }
.role-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--gold)); box-shadow: 0 0 8px var(--c, var(--gold)); }
.authority { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.authority span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 10px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); font-size: .8rem; font-weight: 700; }
.authority span .i3d { width: 18px; height: 18px; }

/* KPI */
.kpi { display: flex; flex-direction: column; gap: 6px; overflow: hidden; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-top .ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); }
.kpi-top .ico .i3d { width: 30px; height: 30px; }
.kpi .label { color: var(--muted); font-weight: 700; font-size: .85rem; }
.kpi .value { font-size: clamp(1.7rem, 2.6vw, 2.3rem); font-weight: 800; line-height: 1.1; letter-spacing: -.01em; }
.kpi .sub { font-size: .8rem; color: var(--muted); }
.kpi .trend { font-size: .78rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; }
.trend.up { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.trend.down { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.spark { width: 100%; height: 40px; margin-top: 4px; }
.spark path.l { fill: none; stroke: var(--gold); stroke-width: 2; }
.spark path.a { fill: url(#sparkFill); stroke: none; }
/* dimension line under kpi values */
.dim { position: relative; height: 10px; margin-top: 2px; }
.dim::before { content: ""; position: absolute; inset-inline: 0; top: 50%; height: 1px; background: var(--line-strong); }
.dim::after { content: ""; position: absolute; inset-block: 0; inset-inline: 0; border-inline: 1px solid var(--line-strong); }
.dim i { position: absolute; top: 2px; height: 6px; inset-inline-start: 0; width: var(--w, 50%); background: linear-gradient(90deg, var(--gold), var(--orange)); border-radius: 3px; }

/* ---------------- buttons / badges / forms ---------------- */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 12px; border: 1px solid transparent;
	font-weight: 800; font-size: .9rem; cursor: pointer; white-space: nowrap; transition: transform .25s var(--ease), box-shadow .25s, background .25s;
	background: linear-gradient(180deg, var(--navy-600), var(--navy-700)); color: #fff;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 10px 22px -12px rgba(15, 35, 70, .7);
}
[data-theme="dark"] .btn { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #0b1a33; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 10px 24px -12px rgba(200, 162, 74, .7); }
.btn:hover { transform: translateY(-1px); }
.btn .i3d { width: 20px; height: 20px; filter: none; }
.btn-gold { background: linear-gradient(180deg, var(--gold-2), var(--gold)) !important; color: #0b1a33 !important; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), 0 10px 24px -12px rgba(200, 162, 74, .8) !important; }
.btn-ghost { background: var(--surface) !important; color: var(--text) !important; border-color: var(--line-strong) !important; box-shadow: none !important; }
.btn-danger { background: linear-gradient(180deg, #e25a4e, var(--bad)) !important; color: #fff !important; }
.btn-sm { padding: 6px 12px; font-size: .82rem; border-radius: 10px; }
.btn-block { width: 100%; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 800; white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.b-warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.b-bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.b-info { color: var(--info); background: color-mix(in srgb, var(--info) 12%, transparent); }
.b-mute { color: var(--muted); background: var(--surface-2); border-color: var(--line); }
.b-gold { color: #8a6a1c; background: color-mix(in srgb, var(--gold) 18%, transparent); }
[data-theme="dark"] .b-gold { color: var(--gold-2); }
.role-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 8px; font-size: .78rem; font-weight: 800; border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); color: var(--c); background: color-mix(in srgb, var(--c) 10%, transparent); }
[data-theme="dark"] .role-badge { color: color-mix(in srgb, var(--c) 55%, white); }

.form { display: grid; gap: 16px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.fields .full { grid-column: 1 / -1; }
@media (max-width: 760px) { .fields { grid-template-columns: 1fr; } }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 800; font-size: .84rem; }
.field small { color: var(--muted); font-size: .78rem; }
.input, select.input, textarea.input {
	width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface-solid); outline: none;
	transition: border-color .2s, box-shadow .2s;
}
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 18%, transparent); }
textarea.input { min-height: 96px; resize: vertical; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--gold); }
fieldset.section { border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin: 0; }
fieldset.section legend { padding: 0 8px; font-weight: 800; color: var(--gold); }

/* ---------------- tables ---------------- */
.table-wrap { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; min-width: 640px; }
.table th { text-align: start; font-size: .76rem; font-weight: 800; letter-spacing: .04em; color: var(--muted); padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
[lang="ar"] .table th { letter-spacing: 0; font-size: .82rem; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .2s; }
.table tbody tr:hover { background: color-mix(in srgb, var(--gold) 6%, transparent); }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person b { display: block; line-height: 1.3; }
.person small { color: var(--muted); font-size: .8rem; }
.avatar {
	--c: var(--navy-500); width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none;
	font-weight: 800; font-size: .9rem; color: #fff; background: linear-gradient(135deg, color-mix(in srgb, var(--c) 85%, white), var(--c));
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 6px 14px -8px var(--c); object-fit: cover;
}
.avatar.sm { width: 30px; height: 30px; border-radius: 9px; font-size: .72rem; }
.avatar.lg { width: 84px; height: 84px; border-radius: 22px; font-size: 1.6rem; }
.stack { display: flex; }
.stack .avatar { border: 2px solid var(--surface-solid); }
.stack .avatar + .avatar { margin-inline-start: -10px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar .input { width: auto; min-width: 180px; padding-block: 9px; }
.toolbar .grow { flex: 1; min-width: 220px; }
.pill-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.pill-tabs a { padding: 6px 14px; border-radius: 9px; font-weight: 800; font-size: .84rem; color: var(--muted); }
.pill-tabs a.on { background: var(--accent); color: var(--accent-ink); }

.progress { height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--orange)); width: var(--p, 0%); transition: width 1s var(--ease); }
.progress.ok i { background: linear-gradient(90deg, #35c483, var(--ok)); }
.progress.bad i { background: linear-gradient(90deg, #f07b6f, var(--bad)); }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .i3d { width: 64px; height: 64px; margin-bottom: 10px; }
.empty b { display: block; color: var(--text); font-size: 1.05rem; margin-bottom: 4px; }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; border: 1px solid; margin-bottom: 16px; font-weight: 700; }
.alert .i3d { width: 24px; height: 24px; }
.alert.success { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); background: color-mix(in srgb, var(--ok) 8%, var(--surface-solid)); }
.alert.error { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); background: color-mix(in srgb, var(--bad) 8%, var(--surface-solid)); }
.alert.info { color: var(--info); border-color: color-mix(in srgb, var(--info) 30%, transparent); background: color-mix(in srgb, var(--info) 8%, var(--surface-solid)); }
.alert code { background: var(--surface-2); padding: 2px 8px; border-radius: 6px; color: var(--text); font-size: .95em; }

/* lists */
.list { display: grid; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px dashed var(--line-strong); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item b { display: block; line-height: 1.35; }
.list-item small { color: var(--muted); font-size: .8rem; }
.insight { display: flex; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.insight .i3d { width: 28px; height: 28px; }
.insight b { display: block; font-size: .92rem; }
.insight p { color: var(--muted); font-size: .84rem; }
.insight + .insight { margin-top: 10px; }

/* ---------------- kanban ---------------- */
.board { display: grid; grid-template-columns: repeat(4, minmax(250px, 1fr)); gap: 16px; overflow-x: auto; padding-bottom: 8px; }
.col { background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px dashed var(--line-strong); border-radius: var(--r-lg); padding: 12px; min-height: 300px; display: flex; flex-direction: column; gap: 10px; }
.col.over { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 8%, var(--surface)); }
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 8px; font-weight: 800; }
.col-head .count { font-size: .78rem; padding: 1px 9px; border-radius: 99px; background: var(--surface-solid); border: 1px solid var(--line); }
.tcard { background: var(--surface-solid); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; box-shadow: 0 8px 18px -14px rgba(11, 26, 51, .5); cursor: grab; transition: transform .2s var(--ease), box-shadow .2s; border-inline-start: 3px solid var(--pc, var(--line-strong)); }
.tcard:hover { transform: translateY(-2px); box-shadow: 0 16px 26px -16px rgba(11, 26, 51, .55); }
.tcard.dragging { opacity: .45; }
.tcard b { display: block; font-size: .92rem; line-height: 1.45; }
.tcard .meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: .76rem; color: var(--muted); }
.tcard .due.late { color: var(--bad); font-weight: 800; }
.p-urgent { --pc: var(--bad); } .p-high { --pc: var(--orange); } .p-normal { --pc: var(--info); } .p-low { --pc: var(--line-strong); }

/* org chart */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-inline-start: 28px; border-inline-start: 1px dashed var(--line-strong); margin-inline-start: 19px; }
.tree li { position: relative; padding: 6px 0; }
.tree ul > li::before { content: ""; position: absolute; top: 26px; inset-inline-start: -28px; width: 24px; border-top: 1px dashed var(--line-strong); }
.node { display: inline-flex; align-items: center; gap: 12px; padding: 8px 14px 8px 8px; padding-inline: 8px 14px; border-radius: 14px; background: var(--surface-solid); border: 1px solid var(--line); box-shadow: 0 8px 18px -16px rgba(11, 26, 51, .5); }
.node b { display: block; font-size: .9rem; line-height: 1.3; }
.node small { color: var(--muted); font-size: .78rem; }

/* permission matrix */
.matrix th, .matrix td { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: start; }
.matrix select { padding: 6px 8px; border-radius: 9px; font-size: .8rem; min-width: 112px; }
.matrix tr.soon td:first-child { opacity: .7; }
.matrix .mod { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.scope-all { border-color: color-mix(in srgb, var(--ok) 55%, transparent) !important; }
.scope-department, .scope-team { border-color: color-mix(in srgb, var(--info) 55%, transparent) !important; }
.scope-own { border-color: color-mix(in srgb, var(--warn) 55%, transparent) !important; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 16px; font-weight: 800; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--text); border-color: var(--gold); }

/* command palette */
.palette { position: fixed; inset: 0; z-index: 90; display: grid; place-items: start center; padding-top: 12vh; background: rgba(5, 13, 28, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.palette-box { width: min(620px, calc(100vw - 24px)); border-radius: 20px; background: var(--surface-solid); border: 1px solid var(--line); box-shadow: var(--shadow-lg); overflow: hidden; }
.palette-box input { width: 100%; padding: 18px 20px; border: 0; border-bottom: 1px solid var(--line); background: transparent; font-size: 1.05rem; outline: none; }
.palette-list { max-height: 50vh; overflow: auto; padding: 8px; }
.palette-list a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; font-weight: 700; }
.palette-list a.on, .palette-list a:hover { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.palette-list a .tag { margin-inline-start: auto; font-size: .7rem; color: var(--muted); }

/* ---------------- auth / install ---------------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art {
	position: relative; overflow: hidden; color: #eaf0fa; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
	background:
		radial-gradient(60% 60% at 80% 10%, rgba(232, 135, 26, .25), transparent 60%),
		linear-gradient(rgba(143, 166, 201, .1) 1px, transparent 1px) 0 0 / 32px 32px,
		linear-gradient(90deg, rgba(143, 166, 201, .1) 1px, transparent 1px) 0 0 / 32px 32px,
		linear-gradient(160deg, #102650, #050d1c);
}
.auth-art .logo { height: 96px; width: auto; align-self: flex-start; }
.auth-art h1 { font-size: clamp(1.8rem, 3vw, 2.6rem); max-width: 16ch; }
.auth-art h1 em { font-style: normal; color: var(--gold-2); }
.auth-art p { color: #a9b8d2; max-width: 46ch; margin-top: 10px; }
.wireframe { position: absolute; inset-inline-end: -40px; bottom: 40px; width: min(560px, 70%); opacity: .9; }
.wireframe path, .wireframe line, .wireframe rect, .wireframe polyline { fill: none; stroke: rgba(231, 207, 138, .75); stroke-width: 1.4; stroke-dasharray: 1200; stroke-dashoffset: 1200; animation: draw 4.5s var(--ease) forwards; }
.wireframe .thin { stroke: rgba(143, 166, 201, .5); stroke-width: 1; animation-delay: .6s; }
.wireframe .dimtext { fill: rgba(231, 207, 138, .8); font: 700 11px var(--font); stroke: none; animation: fade 1s 3s both; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { from { opacity: 0; } }
.auth-feats { display: flex; flex-wrap: wrap; gap: 10px; position: relative; z-index: 1; }
.auth-feats span { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(231, 207, 138, .2); font-weight: 700; font-size: .85rem; }
.auth-form { display: grid; place-items: center; padding: 40px 20px; }
.auth-card { width: min(440px, 100%); }
.auth-card h2 { font-size: 1.7rem; }
.auth-card .muted { margin: 6px 0 24px; }
.lang-switch { position: absolute; top: 20px; inset-inline-end: 20px; display: flex; gap: 8px; z-index: 2; }
.install { max-width: 920px; margin: 0 auto; padding: 40px 18px 80px; }
.install-head { display: flex; align-items: center; gap: 18px; margin-bottom: 24px; }
.install-head img { height: 76px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 960px) {
	.auth { grid-template-columns: 1fr; }
	.auth-art { min-height: 300px; padding: 28px; }
	.wireframe { width: 60%; bottom: 10px; opacity: .5; }
}

/* ---------------- responsive shell ---------------- */
@media (max-width: 1080px) {
	.shell { grid-template-columns: 1fr; }
	.side { position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--side-w); transform: translateX(-105%); transition: transform .35s var(--ease); box-shadow: var(--shadow-lg); }
	[dir="rtl"] .side { transform: translateX(105%); }
	.side-open .side { transform: none !important; }
	.side-open .scrim { display: block; position: fixed; inset: 0; background: rgba(5, 13, 28, .5); z-index: 35; }
	.icon-btn.menu-btn { display: inline-grid; }
	.search kbd, .me div { display: none; }
}
@media (max-width: 560px) {
	.search span { display: none; }
	.search { flex: 0 0 auto; }
	.content { padding-inline: 14px; }
}

/* reveal */
.rise { animation: rise .7s var(--ease) both; animation-delay: var(--d, 0s); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } .wireframe * { stroke-dashoffset: 0 !important; } }

/* logo per theme */
.logo-l { display: inline-block; }
.logo-d { display: none; }
[data-theme="dark"] .logo-l { display: none; }
[data-theme="dark"] .logo-d { display: inline-block; }

/* grid/flex children never force the page wider than the screen */
.form > *, .grid > *, .content > * { min-width: 0; }
.matrix select { min-width: 96px; }

.content { overflow-x: clip; }

/* ---------------- AI center ---------------- */
.ai-card { border-inline-start: 3px solid var(--gold); }
.ai-note b { color: var(--gold); }
.ai-li { display: block; padding-inline-start: 14px; position: relative; margin-top: 4px; }
.ai-li::before { content: ""; position: absolute; inset-inline-start: 2px; top: .65em; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); }
.ai-dots { opacity: .75; animation: aiPulse 1.2s ease-in-out infinite; }
@keyframes aiPulse { 50% { opacity: .3; } }
.ai-filled { box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 45%, transparent); }
.ai-chat { display: grid; grid-template-rows: 1fr auto; min-height: 460px; }
.ai-log { overflow-y: auto; max-height: 56vh; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px 12px; }
.ai-msg { max-width: 86%; padding: 10px 14px; border-radius: 16px; line-height: 1.75; overflow-wrap: anywhere; }
.ai-msg.me { align-self: flex-end; background: var(--navy-600); color: #fff; border-end-end-radius: 4px; }
.ai-msg.bot { align-self: flex-start; background: color-mix(in srgb, var(--gold) 10%, transparent); border: 1px solid color-mix(in srgb, var(--gold) 25%, transparent); border-end-start-radius: 4px; }
.ai-msg.err { border-color: var(--bad); color: var(--bad); }
.ai-ask { display: flex; gap: 8px; align-items: flex-end; }
.ai-ask textarea { flex: 1; resize: vertical; min-height: 46px; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.ai-chips button { border: 1px solid var(--line); background: transparent; color: inherit; border-radius: 999px; padding: 5px 12px; font: inherit; font-size: .82rem; cursor: pointer; }
.ai-chips button:hover { border-color: var(--gold); }
.ai-tools { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.ai-tool { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 16px; border: 1px solid var(--line); text-decoration: none; color: inherit; transition: transform .15s, border-color .15s; }
.ai-tool:hover { transform: translateY(-2px); border-color: var(--gold); }
.ai-tool > :first-child { flex: 0 0 auto; width: 44px; height: 44px; }
.ai-tool b { display: block; margin-bottom: 2px; }
.ai-tool small { color: var(--muted); }
.ai-meter { height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--gold) 15%, transparent); overflow: hidden; }
.ai-meter i { display: block; height: 100%; width: var(--p); background: var(--gold); }
@media (max-width: 640px) { .ai-msg { max-width: 96%; } .ai-chat { min-height: 380px; } }
.ai-p { display: block; }
.ai-gap { margin-top: 10px !important; }
.ai-h { margin-top: 12px; }
.ai-msg .ai-li:first-child, .ai-msg .ai-p:first-child { margin-top: 0; }
