:root {
	--bg: #E7EAF2;
	--surface: #FFFFFF;
	--ink: #2C2A4A;
	--ink-2: #4C4A6B;
	--muted: #9AA1C0;
	--faint: #C3C8DD;
	--line: #EDEFF7;
	--primary: #4B3FA8;
	--primary-600: #5B4CC7;
	--primary-050: #EFEDFB;
	--cyan: #6ED3E0;
	--cyan-050: #E2F7FA;
	--coral: #F58A6F;
	--coral-050: #FDEDE8;
	--green: #3FBF95;
	--green-050: #E4F7F1;
	--amber: #F0B54B;
	--amber-050: #FDF3E2;
	--r-lg: 22px;
	--r-md: 14px;
	--r-sm: 10px;
	--shadow: 0 10px 30px rgba(72, 66, 140, .07);
	--shadow-sm: 0 4px 14px rgba(72, 66, 140, .06);
	--shadow-lg: 0 20px 46px rgba(60, 55, 120, .18);
	--topbar-h: 72px;
	--sidebar-w: 248px;
	--closedbar-h: 0px;
}

* { box-sizing: border-box; }
html, body {
	margin: 0;
	padding: 0;
	height: 100%;
	height: 100dvh;
	overflow: hidden;
	font-family: 'Poppins', ui-sans-serif, -apple-system, "Segoe UI", sans-serif;
	background: var(--bg);
	color: var(--ink);
	-webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--primary-600); outline-offset: 2px; border-radius: 6px; }
.mono, .num, td.num, th.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.tiny { font-size: 11.5px; }

/* ---------- Login ---------- */
.login-body {
	display: grid;
	place-items: center;
	background: linear-gradient(160deg, #E7EAF2 0%, #EFEDFB 50%, #E2F7FA 100%);
	overflow: auto;
}
.login-card {
	width: min(420px, 92vw);
	background: #fff;
	border-radius: 22px;
	padding: 32px 30px 28px;
	box-shadow: 0 20px 50px rgba(72, 66, 140, .12);
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.login-card .lead { font-size: 13px; color: var(--muted); line-height: 1.55; margin: 0 0 22px; }
.login-card .field { margin-bottom: 14px; }
.login-card label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.login-card input {
	width: 100%;
	border: 1px solid var(--line);
	border-radius: 12px;
	padding: 12px 14px;
	font-size: 14px;
	color: var(--ink);
	background: #F8F9FD;
}
.login-card input:focus { outline: none; border-color: var(--primary-600); background: #fff; }
.login-hint { font-size: 12.5px; color: var(--coral); min-height: 1.2em; margin: 12px 0 0; }
.login-dev { font-size: 11.5px; color: var(--faint); margin-top: 16px; text-align: center; }

/* ---------- Full-bleed app shell ---------- */
#app {
	height: 100vh;
	height: 100dvh;
	width: 100vw;
	display: grid;
	grid-template-rows: var(--topbar-h) var(--closedbar-h) 1fr;
	overflow: hidden;
	background: var(--surface);
}
#app.has-closedbar { --closedbar-h: 36px; }

.topbar {
	display: grid;
	grid-template-columns: var(--sidebar-w) 1fr auto;
	align-items: center;
	gap: 18px;
	padding: 0 30px 0 26px;
	border-bottom: 1px solid var(--line);
	background: #fff;
	z-index: 40;
	min-height: var(--topbar-h);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
	width: 42px; height: 42px; border-radius: 14px;
	background: linear-gradient(150deg, #6355DA, #4132A0);
	display: grid; place-items: center;
	box-shadow: 0 6px 16px rgba(75, 63, 168, .35);
	flex: none;
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: .14em; color: var(--primary); }
.brand-sub { font-size: 10px; letter-spacing: .14em; color: var(--faint); font-weight: 500; margin-top: -2px; }
.crumb { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.crumb h1 { font-size: 20px; font-weight: 600; margin: 0; white-space: nowrap; }
.crumb .ctx { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tools { display: flex; align-items: center; gap: 12px; position: relative; }
.period {
	display: flex; align-items: center; gap: 10px;
	background: #F6F7FC; border-radius: 12px; padding: 9px 12px;
	font-size: 12.5px; color: var(--ink-2); font-weight: 500;
}
.period .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex: none; }
.period .dot.closed { background: var(--faint); }
.period select { border: none; background: transparent; font-size: 12.5px; font-weight: 500; color: var(--ink); cursor: pointer; max-width: 140px; }
.searchbox {
	display: flex; align-items: center; gap: 8px;
	background: #F6F7FC; border-radius: 12px; padding: 9px 13px;
}
.searchbox input { border: none; background: transparent; outline: none; font-size: 12.5px; width: 160px; color: var(--ink); }
.icon-btn {
	position: relative; width: 38px; height: 38px; border-radius: 12px;
	display: grid; place-items: center; transition: background .15s;
}
.icon-btn:hover { background: #F3F4FA; }
.icon-btn .badge {
	position: absolute; top: 5px; right: 6px; width: 9px; height: 9px;
	border-radius: 50%; background: var(--coral); border: 2px solid #fff;
	display: none;
}
.icon-btn .badge.on { display: block; }
.avatar-btn {
	display: flex; align-items: center; gap: 8px;
	padding: 3px 6px 3px 3px; border-radius: 26px; transition: background .15s;
}
.avatar-btn:hover { background: #F3F4FA; }
.avatar {
	width: 40px; height: 40px; border-radius: 50%;
	display: grid; place-items: center; font-weight: 600; font-size: 13px; color: #fff; flex: none;
}
.pop {
	position: absolute; top: calc(100% + 10px); right: 0; width: 320px;
	background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg);
	padding: 8px; z-index: 60; display: none; max-height: min(420px, 70vh);
}
.pop.open { display: flex; flex-direction: column; animation: popin .16s ease-out; }
.pop-body { overflow-y: auto; min-height: 0; flex: 1; }
.pop h4 { margin: 8px 10px 6px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pop-item {
	display: flex; gap: 11px; padding: 10px; border-radius: 12px;
	align-items: flex-start; width: 100%; text-align: left;
}
.pop-item:hover { background: #F6F7FC; }
.pop-item .pi-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.pop-item p { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--ink-2); }
.pop-item span { font-size: 11px; color: var(--muted); }
.pop-foot {
	border-top: 1px solid var(--line); padding: 8px;
	text-align: center; font-size: 12.5px; font-weight: 600; color: var(--primary);
}

.closedbar {
	display: flex;
	align-items: center;
	justify-content: center;
	background: #F3F4FA;
	color: var(--ink-2);
	font-size: 12.5px;
	border-bottom: 1px solid var(--line);
	padding: 0 20px;
	overflow: hidden;
	/* Always stay in the #app grid so .app-body keeps the 1fr row.
	   Height comes from --closedbar-h (0 when open period). */
}
#app.has-closedbar .closedbar {
	border-bottom-color: var(--line);
}

.app-body {
	display: grid;
	grid-template-columns: var(--sidebar-w) 1fr;
	min-height: 0;
	overflow: hidden;
}
.side {
	border-right: 1px solid var(--line);
	padding: 18px 14px;
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-height: 0;
	overflow: hidden;
	background: #fff;
}
.side-nav {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.nav-label {
	font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
	color: var(--faint); font-weight: 600; margin: 14px 12px 8px;
}
.nav-item {
	display: flex; align-items: center; gap: 12px;
	padding: 11px 12px; border-radius: 13px;
	font-size: 13.5px; font-weight: 500; color: var(--muted);
	width: 100%; text-align: left; transition: .15s;
}
.nav-item:hover { background: #F6F7FC; color: var(--ink-2); }
.nav-item.active { background: var(--primary-050); color: var(--primary); font-weight: 600; }
.nav-item.active svg { stroke: var(--primary); }
.nav-item .n {
	margin-left: auto; font-size: 11px; background: var(--coral); color: #fff;
	border-radius: 20px; padding: 1px 7px; font-weight: 600; display: none;
}
.nav-item .n.on { display: inline-block; }
.side-card {
	margin-top: 12px; background: #F6F7FC; border-radius: 18px;
	padding: 16px; text-align: center; flex: none;
}
.side-card .cal-ico { margin: -36px auto 6px; display: block; }
.side-card h5 { margin: 2px 0 4px; font-size: 13px; font-weight: 600; }
.side-card p { margin: 0 0 12px; font-size: 11.5px; color: var(--muted); line-height: 1.5; }

.workspace {
	display: flex;
	flex-direction: column;
	min-height: 0;
	min-width: 0;
	overflow: hidden;
	background: linear-gradient(180deg, #FCFCFE, #fff);
}
.module-header {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	padding: 14px 30px 10px;
	background: transparent;
	z-index: 5;
	border-bottom: 1px solid transparent;
}
.module-header-left {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
	flex: 1;
}
.module-header-tools {
	display: flex;
	align-items: center;
	gap: 12px;
	flex: none;
}
.module-header-actions {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	justify-content: flex-end;
	flex: none;
}
#maincontent {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 10px 30px 40px;
}
.view-enter { animation: fadeup .2s ease-out; }
@keyframes fadeup {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: none; }
}
@keyframes popin {
	from { opacity: 0; transform: translateY(-6px); }
	to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
	.view-enter, .pop.open, * { animation: none !important; transition: none !important; }
}

/* ---------- Components ---------- */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	background: var(--primary); color: #fff; border-radius: 12px;
	padding: 11px 18px; font-size: 13px; font-weight: 600;
	box-shadow: 0 8px 18px rgba(75, 63, 168, .28); transition: .15s;
}
.btn:hover { background: var(--primary-600); }
.btn.sm { padding: 9px 14px; font-size: 12.5px; border-radius: 11px; }
.btn.ghost { background: #fff; color: var(--primary); box-shadow: inset 0 0 0 1.5px var(--primary-050); }
.btn.ghost:hover { background: var(--primary-050); }
.btn.quiet { background: #F3F4FA; color: var(--ink-2); box-shadow: none; }
.btn.quiet:hover { background: #EBEDF6; }
.btn.full { width: 100%; }
.btn.danger { background: var(--coral); box-shadow: 0 8px 18px rgba(245, 138, 111, .28); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.card { background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 20px; }
.card.flat { box-shadow: var(--shadow-sm); }
.grid-2 { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 14px; gap: 12px; flex-wrap: wrap; }
.section-head h2 { font-size: 16.5px; font-weight: 600; margin: 0; }
.section-head h3 { font-size: 14.5px; font-weight: 600; margin: 0; }

.chip {
	display: inline-flex; align-items: center; gap: 6px;
	font-size: 11px; font-weight: 600; padding: 5px 10px; border-radius: 20px;
}
.chip.pri { background: var(--primary-050); color: var(--primary); }
.chip.cy { background: var(--cyan-050); color: #2C93A3; }
.chip.co { background: var(--coral-050); color: #D2603F; }
.chip.gr { background: var(--green-050); color: #1E9773; }
.chip.am { background: var(--amber-050); color: #B9822A; }
.chip.gy { background: #F3F4FA; color: var(--muted); }

.hero {
	position: relative; overflow: hidden; border-radius: var(--r-lg); padding: 22px; color: #fff;
	background: linear-gradient(140deg, #5A4BC0 0%, #43368F 100%);
	box-shadow: 0 16px 34px rgba(67, 54, 143, .28);
	min-height: 214px; display: flex; flex-direction: column; justify-content: space-between;
}
.hero .arcs { position: absolute; right: -40px; bottom: -70px; opacity: .5; }
.hero .doc {
	width: 64px; height: 64px; border-radius: 20px;
	background: rgba(255, 255, 255, .16); display: grid; place-items: center;
}
.hero .see { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; opacity: .95; color: #fff; }
.hero .big { font-size: 40px; font-weight: 700; letter-spacing: -.02em; line-height: 1; position: relative; font-variant-numeric: tabular-nums; }
.hero .lbl { font-size: 13.5px; opacity: .82; margin-top: 8px; position: relative; }

.stat {
	display: flex; align-items: center; gap: 14px; padding: 18px 20px;
	background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow);
}
.stat.clickable { cursor: pointer; }
.stat.clickable:hover { background: #FAFAFE; }
.stat .sico { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.stat .num { font-size: 26px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .cap { font-size: 12.5px; color: var(--muted); }
.stat .go { margin-left: auto; color: var(--primary); opacity: .7; }

table.data { width: 100%; border-collapse: collapse; }
table.data thead th {
	font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
	color: var(--muted); text-align: left; padding: 12px 14px; background: #F8F9FD;
}
table.data thead th:first-child { border-radius: 12px 0 0 12px; }
table.data thead th:last-child { border-radius: 0 12px 12px 0; }
table.data tbody td { padding: 14px; font-size: 13px; border-bottom: 1px solid var(--line); color: var(--ink-2); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr.click { cursor: pointer; transition: background .12s; }
table.data tbody tr.click:hover { background: #FAFAFE; }
td.num, th.num { text-align: right; }
.name-cell { display: flex; align-items: center; gap: 11px; }
.name-cell strong { font-weight: 600; color: var(--ink); font-size: 13px; display: block; }
.name-cell span { font-size: 11px; color: var(--muted); }
.total-strong { font-weight: 600; color: var(--ink); }

.chart { display: flex; align-items: flex-end; gap: 0; height: 190px; padding-left: 8px; }
.axis {
	display: flex; flex-direction: column; justify-content: space-between;
	height: 170px; font-size: 11.5px; color: var(--faint); padding-right: 14px; font-weight: 500;
}
.groups { display: flex; flex: 1; justify-content: space-around; align-items: flex-end; height: 170px; border-left: 1px solid var(--line); }
.group { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.bars { display: flex; align-items: flex-end; gap: 9px; height: 170px; }
.bar { width: 26px; border-radius: 9px; transition: height .5s cubic-bezier(.2, .8, .2, 1); }
.group .glabel { font-size: 12px; color: var(--muted); }
.legend { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.legend span { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); }
.legend i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }

.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.cal { width: 100%; border-collapse: separate; border-spacing: 0 2px; }
.cal th {
	font-size: 11.5px; color: var(--ink-2); font-weight: 500; padding: 9px 0;
	background: #F6F7FC; text-align: center;
}
.cal th:first-child { border-radius: 9px 0 0 9px; }
.cal th:last-child { border-radius: 0 9px 9px 0; }
.cal td { text-align: center; font-size: 12.5px; color: var(--ink-2); padding: 7px 0; position: relative; }
.cal td.out { color: var(--faint); }
.cal td .d { width: 30px; height: 30px; line-height: 30px; border-radius: 50%; display: inline-block; }
.cal td.today .d { background: var(--primary); color: #fff; font-weight: 600; }
.cal td .marks { position: absolute; left: 50%; transform: translateX(-50%); bottom: 0; display: flex; gap: 3px; }
.cal td .marks i { width: 4px; height: 4px; border-radius: 50%; display: block; }
.cal td.clickday { cursor: pointer; }

.rail-item {
	display: flex; align-items: center; gap: 11px;
	background: #F8F9FD; border-radius: 14px; padding: 12px; margin-bottom: 9px;
}
.rail-item .meta { min-width: 0; flex: 1; }
.rail-item strong { display: block; font-size: 12.5px; font-weight: 600; }
.rail-item span { font-size: 11px; color: var(--muted); }
.rail-item .amt { font-size: 12.5px; font-weight: 600; color: var(--primary); white-space: nowrap; font-variant-numeric: tabular-nums; }
.progress { height: 5px; border-radius: 5px; background: #EBEDF7; overflow: hidden; margin-top: 6px; }
.progress i { display: block; height: 100%; border-radius: 5px; background: var(--primary-600); }

.tabs { display: flex; gap: 6px; background: #F6F7FC; padding: 5px; border-radius: 14px; width: fit-content; flex-wrap: wrap; }
.tab { padding: 9px 16px; border-radius: 11px; font-size: 12.5px; font-weight: 500; color: var(--muted); transition: .15s; }
.tab.on { background: #fff; color: var(--primary); font-weight: 600; box-shadow: var(--shadow-sm); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.fchip { padding: 8px 14px; border-radius: 20px; font-size: 12px; font-weight: 500; color: var(--muted); background: #F6F7FC; }
.fchip.on { background: var(--primary); color: #fff; }

.client-hero { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.client-hero .avatar { width: 60px; height: 60px; font-size: 18px; }
.client-hero h2 { margin: 0 0 5px; font-size: 21px; font-weight: 600; }
.back { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.back:hover { color: var(--primary); }
.kv { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; gap: 12px; }
.kv:last-child { border-bottom: none; }
.kv span { color: var(--muted); }
.kv strong { font-weight: 600; font-size: 12.5px; text-align: right; }
.block-title { display: flex; align-items: center; gap: 10px; margin: 22px 0 10px; }
.block-title h4 { margin: 0; font-size: 13.5px; font-weight: 600; }
.block-title .line { flex: 1; height: 1px; background: var(--line); }
.block-title .qual { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.sumrow {
	display: flex; justify-content: space-between; align-items: center;
	padding: 13px 16px; border-radius: 13px; background: #F8F9FD; margin-bottom: 8px; font-size: 13px;
}
.sumrow.amber { background: var(--amber-050); color: #8A6420; }
.sumrow.total { background: var(--primary-050); color: var(--primary); font-weight: 600; font-size: 15px; padding: 16px; }
.waived { text-decoration: line-through; color: var(--faint); }

.act { display: inline-flex; gap: 6px; }
.act button {
	width: 30px; height: 30px; border-radius: 9px;
	display: grid; place-items: center; background: #F3F4FA; transition: .15s;
}
.act button:hover { background: #E9EBF6; }
.act button.ok:hover { background: var(--green-050); }
.act button.no:hover { background: var(--coral-050); }
.qty-edit {
	width: 56px; border: 1px solid var(--line); border-radius: 8px;
	padding: 5px 7px; font-size: 12.5px; text-align: right; color: var(--ink);
}

.hint {
	display: flex; gap: 12px; background: var(--amber-050); border-radius: 14px;
	padding: 14px 16px; font-size: 12.5px; color: #8A6420; line-height: 1.55; margin-bottom: 18px;
}
.hint b { color: #6E4E12; }
.attention {
	display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap;
	background: var(--coral-050); border-radius: 14px; padding: 12px 16px;
	font-size: 12.5px; color: #D2603F; margin-bottom: 16px;
}
.attention span { background: #fff; border-radius: 20px; padding: 4px 10px; font-size: 11.5px; font-weight: 500; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); font-size: 13px; }
.empty p { margin: 0 0 14px; line-height: 1.5; }

.skeleton-wrap { display: flex; flex-direction: column; gap: 10px; }
.skeleton-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.skeleton-cell {
	height: 18px; border-radius: 8px;
	background: linear-gradient(90deg, #F3F4FA 25%, #EBEDF6 50%, #F3F4FA 75%);
	background-size: 200% 100%;
	animation: shimmer 1.2s infinite;
}
@keyframes shimmer {
	0% { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

.form-field { margin-bottom: 14px; }
.form-field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.form-field input, .form-field select, .form-field textarea {
	width: 100%; border: 1px solid var(--line); border-radius: 12px;
	padding: 11px 13px; font-size: 13px; color: var(--ink); background: #F8F9FD;
}
.form-field textarea { min-height: 80px; resize: vertical; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
	outline: none; border-color: var(--primary-600); background: #fff;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.preview-rate {
	background: var(--primary-050); color: var(--primary); border-radius: 12px;
	padding: 12px 14px; font-size: 12.5px; font-weight: 500; margin-top: 4px;
}
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
.toggle-row input[type="checkbox"] { width: 18px; height: 18px; }

.client-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.client-card {
	background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow);
	padding: 18px; cursor: pointer; transition: background .12s;
}
.client-card:hover { background: #FAFAFE; }
.client-card.archived { opacity: .65; }

.mono-block {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 11.5px; background: #F6F7FC; border-radius: 12px;
	padding: 14px; color: var(--ink-2); line-height: 1.6; overflow-x: auto;
}
.check {
	display: flex; align-items: center; gap: 12px; padding: 13px;
	border-radius: 13px; background: #F8F9FD; margin-bottom: 8px; font-size: 13px;
}
.check.am { background: var(--amber-050); color: #8A6420; }
.check .ci { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.steps { counter-reset: step; }
.steps li {
	list-style: none; position: relative; padding: 10px 0 10px 36px;
	font-size: 12.5px; color: var(--ink-2); line-height: 1.45; border-bottom: 1px solid var(--line);
}
.steps li::before {
	counter-increment: step; content: counter(step);
	position: absolute; left: 0; top: 10px;
	width: 24px; height: 24px; border-radius: 50%;
	background: var(--primary-050); color: var(--primary);
	font-size: 11px; font-weight: 600; display: grid; place-items: center;
}
.perm-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.perm-table th, .perm-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: center; }
.perm-table th:first-child, .perm-table td:first-child { text-align: left; }
.perm-table .yes { color: var(--green); font-weight: 600; }
.perm-table .no { color: var(--faint); }
.you-role { background: var(--primary-050); }

.delta-up { color: var(--coral); }
.delta-down { color: var(--green); }
.group-header {
	display: flex; align-items: center; justify-content: space-between;
	padding: 12px 14px; background: #F6F7FC; border-radius: 12px; margin: 14px 0 8px;
	font-size: 13px; font-weight: 600;
}
.expand-row { cursor: pointer; }
.expand-detail { padding: 8px 14px 16px; font-size: 12.5px; color: var(--muted); background: #FAFAFE; }

/* ---------- Drawer ---------- */
.drawer-scrim {
	position: fixed; inset: 0; background: rgba(44, 42, 74, .32);
	z-index: 70; display: none;
}
.drawer-scrim.open { display: block; }
.drawer {
	position: fixed; top: 0; right: 0; height: 100vh; height: 100dvh;
	width: min(440px, 100vw); background: #fff; z-index: 80;
	display: flex; flex-direction: column; box-shadow: -16px 0 40px rgba(40, 36, 90, .18);
	transform: translateX(105%); transition: transform .22s ease;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
	flex: none; display: flex; align-items: center; justify-content: space-between;
	padding: 20px 22px; border-bottom: 1px solid var(--line);
}
.drawer-head h3 { margin: 0; font-size: 17px; font-weight: 600; }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 22px; }
.drawer-foot {
	flex: none; display: flex; gap: 10px; justify-content: flex-end;
	padding: 16px 22px; border-top: 1px solid var(--line); background: #fff;
}

/* ---------- Sticky notes panel ---------- */
.sticky-scrim {
	position: fixed; inset: 0; background: rgba(44, 42, 74, .32);
	z-index: 72; display: none;
}
.sticky-scrim.open { display: block; }
.sticky-panel {
	position: fixed; top: 0; right: 0; height: 100vh; height: 100dvh;
	width: min(400px, 100vw); background: #FFFDF6; z-index: 82;
	display: flex; flex-direction: column; box-shadow: -16px 0 40px rgba(40, 36, 90, .18);
	transform: translateX(105%); transition: transform .22s ease;
	border-left: 1px solid #F0E6C8;
}
.sticky-panel.open { transform: translateX(0); }
.sticky-panel-head {
	flex: none; display: flex; align-items: center; justify-content: space-between;
	padding: 18px 20px; border-bottom: 1px solid #F0E6C8; background: #FFF9E8;
}
.sticky-panel-head h3 { margin: 0; font-size: 16px; font-weight: 600; color: #5C4A1F; }
.sticky-panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px; }
.sticky-panel-foot {
	flex: none; display: flex; gap: 10px; justify-content: flex-end;
	padding: 14px 18px; border-top: 1px solid #F0E6C8; background: #FFF9E8;
}
.sticky-note-btn {
	color: #C9A227;
	position: relative;
}
.sticky-note-btn:hover { color: #A88410; background: #FFF6D6; }
.sticky-note-btn.has-notes { color: #A88410; background: #FFF6D6; }
.sticky-note-badge {
	position: absolute;
	top: 2px;
	right: 2px;
	min-width: 14px;
	height: 14px;
	padding: 0 3px;
	border-radius: 8px;
	background: #C9A227;
	color: #fff;
	font-size: 9px;
	font-style: normal;
	font-weight: 700;
	line-height: 14px;
	text-align: center;
	pointer-events: none;
}
.sticky-card-mini {
	background: #FFF7C2;
	border: 1px solid #F0E08A;
	border-radius: 10px;
	padding: 12px 14px;
	margin-bottom: 10px;
	cursor: pointer;
	box-shadow: 0 1px 0 rgba(180, 140, 40, .12);
}
.sticky-card-mini:hover { background: #FFF3A8; }
.sticky-card-mini-title { font-weight: 600; font-size: 13px; color: #4A3B12; margin-bottom: 4px; }
.sticky-card-mini-body {
	font-size: 12px; color: #6B5A28; line-height: 1.45;
	max-height: 3.2em; overflow: hidden;
}
.sticky-card-mini-meta { margin-top: 8px; font-size: 11px; color: #9A8650; }

/* ---------- Modal ---------- */
.scrim {
	position: fixed; inset: 0; background: rgba(44, 42, 74, .42);
	backdrop-filter: blur(3px); display: none; place-items: center; z-index: 90;
}
.scrim.open { display: grid; }
.modal {
	background: #fff; border-radius: 24px; width: min(560px, 92vw);
	max-height: min(88vh, 720px); display: flex; flex-direction: column;
	box-shadow: 0 30px 70px rgba(40, 36, 90, .3); animation: popin .2s ease-out;
}
.modal-head { flex: none; padding: 26px 26px 0; }
.modal-head h3 { margin: 0 0 6px; font-size: 18px; }
.modal-head .sub { margin: 0 0 12px; font-size: 13px; color: var(--muted); line-height: 1.55; }
.modal-body { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 26px 8px; }
.modal-foot {
	flex: none; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
	padding: 16px 26px 26px;
}

/* ---------- Profile drawer (slides from right) ---------- */
.profile-backdrop {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(44, 42, 74, .32);
	z-index: 100;
}
.profile-backdrop.open { display: block; }
.profile-drawer {
	position: fixed;
	top: 0;
	right: 0;
	height: 100vh;
	height: 100dvh;
	width: min(400px, 100vw);
	background: #fff;
	box-shadow: -16px 0 40px rgba(40, 36, 90, .18);
	z-index: 110;
	transform: translateX(105%);
	transition: transform .25s ease;
	display: flex;
	flex-direction: column;
}
.profile-drawer.open { transform: translateX(0); }
.profile-drawer-head {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 22px;
	border-bottom: 1px solid var(--line);
}
.profile-drawer-head h3 { margin: 0; font-size: 17px; font-weight: 600; }
.profile-drawer-body {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	padding: 20px 22px 32px;
}
.profile-block { margin-bottom: 28px; }
.profile-block h4 {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: var(--muted);
	margin: 0 0 14px;
}
.profile-field { margin-bottom: 12px; }
.profile-field label {
	display: block;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: var(--muted);
	font-weight: 600;
	margin-bottom: 4px;
}
.profile-field .val {
	font-size: 13.5px;
	font-weight: 500;
	color: var(--ink);
}
.profile-hint {
	font-size: 12px;
	color: var(--muted);
	margin: 0 0 10px;
	line-height: 1.45;
}
.profile-avatar-row {
	display: flex;
	align-items: center;
	gap: 14px;
	margin-bottom: 12px;
}
.profile-avatar-preview {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	background: linear-gradient(140deg, #F58A6F, #E96A4E);
	color: #fff;
	font-weight: 600;
	font-size: 20px;
	display: grid;
	place-items: center;
	overflow: hidden;
	flex: none;
	background-size: cover;
	background-position: center;
}
.profile-block .form-field { margin-bottom: 12px; }
.profile-block .form-field label {
	display: block;
	font-size: 12px;
	color: var(--muted);
	margin-bottom: 6px;
	font-weight: 500;
	text-transform: none;
	letter-spacing: 0;
}
.profile-block .form-field input,
.profile-block .form-field select {
	width: 100%;
	border: 1px solid var(--line);
	border-radius: 12px;
	padding: 10px 12px;
	font-size: 13.5px;
	background: #F8F9FD;
	color: var(--ink);
}
.profile-block .btn { margin-top: 4px; }

.toast {
	position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 80px); opacity: 0;
	background: var(--ink); color: #fff; padding: 13px 20px; border-radius: 14px;
	font-size: 13px; z-index: 100; display: flex; align-items: center; gap: 14px;
	box-shadow: 0 16px 34px rgba(30, 28, 60, .3); transition: .28s; pointer-events: none;
}
.toast.on { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast-undo {
	background: transparent; color: var(--cyan); font-weight: 600; font-size: 13px;
	text-decoration: underline;
}

.role-hidden { display: none !important; }
.readonly-hide { display: none !important; }

@media (max-width: 1240px) {
	.grid-2 { grid-template-columns: 1fr; }
	.form-row { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
	:root { --sidebar-w: 74px; }
	.brand-name, .brand-sub, .crumb .ctx, .searchbox, .period span:not(.dot), .side-card, .nav-label, .nav-item .t { display: none; }
	.topbar { grid-template-columns: auto 1fr auto; padding: 0 14px; }
	.nav-item { justify-content: center; padding: 12px; }
	.nav-item .n { position: absolute; top: 4px; right: 4px; margin: 0; }
	.nav-item { position: relative; }
	#maincontent, .module-header { padding-left: 16px; padding-right: 16px; }
	.module-header { flex-wrap: wrap; }
	.module-header-tools .searchbox input { width: 110px; }
	.table-scroll { overflow-x: auto; }
	.mobile-cards .data { display: none; }
}
