:root {
	--bg: #f1f5f9;
	--card: #ffffff;
	--line: #e2e8f0;
	--text: #0f172a;
	--muted: #64748b;
	--accent: #2563eb;
	--ok: #047857;
	--warn: #b45309;
	--err: #b91c1c;
	--radius: 10px;
	--mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
	margin: 0;
	font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	background: var(--bg);
	color: var(--text);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 22px 18px 64px; }

/* ---------- rolebar ---------- */
.rolebar { position: sticky; top: 0; z-index: 30; background: #0f172a; color: #e2e8f0; font-size: 13px; }
.rolebar .inner { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; gap: 14px; padding: 8px 18px; flex-wrap: wrap; }
.rolebar a, .rolebar button.link { color: #93c5fd; background: none; border: 0; font: inherit; cursor: pointer; padding: 0; }
.rolebar a:hover, .rolebar button.link:hover { text-decoration: underline; }
.rolebar .brand { font-weight: 700; color: #fff; }
.rolebar .spacer { flex: 1 1 auto; }
.rolebar .pill { background: #1d4ed8; color: #fff; padding: 2px 9px; border-radius: 999px; font-weight: 700; letter-spacing: .05em; font-size: 11px; text-transform: uppercase; }
.rolebar form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.rolebar select { background: #1e293b; color: #e2e8f0; border: 1px solid #334155; border-radius: 6px; padding: 4px 6px; font-size: 12px; max-width: 210px; }
.rolebar.impersonating { background: #92400e; }
.rolebar.impersonating .pill { background: #fbbf24; color: #1f2937; }
.rolebar.impersonating a, .rolebar.impersonating button.link { color: #fde68a; }

/* ---------- layout ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 6px 0 20px; flex-wrap: wrap; }
.top h1 { font-size: 24px; margin: 0; }
.brandline { display: flex; align-items: center; gap: 10px; }
.brandline img { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; background: #fff; }
.sub { color: var(--muted); font-size: 13px; margin: 4px 0 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.card h2 { font-size: 17px; margin: 0 0 12px; }
.card h3 { font-size: 15px; margin: 16px 0 8px; }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .n { font-size: 26px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- tables ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th, table.tbl td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tbl th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: #f8fafc; }
.tbl-wrap { overflow-x: auto; }
.mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; background: #e2e8f0; color: #334155; }
.badge.ok { background: #d1fae5; color: #065f46; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.err { background: #fee2e2; color: #991b1b; }
.badge.info { background: #dbeafe; color: #1e40af; }

/* ---------- forms ---------- */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=file], select, textarea {
width: 100%; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; background: #fff; color: var(--text);
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--accent); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .field { flex: 1 1 180px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.check input { width: auto; margin-top: 3px; }

.btn { display: inline-block; padding: 8px 14px; border-radius: 8px; border: 1px solid transparent; background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; line-height: 1.2; }
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
.btn.ghost { background: #fff; color: var(--text); border-color: #cbd5e1; }
.btn.danger { background: var(--err); }
.btn.warn { background: var(--warn); }
.btn.ok { background: var(--ok); }
.inline { display: inline; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ---------- flash ---------- */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.flash.ok { background: #d1fae5; color: #065f46; }
.flash.error { background: #fee2e2; color: #991b1b; }
.flash.info { background: #dbeafe; color: #1e40af; }

/* ---------- auth ---------- */
.authbox { max-width: 420px; margin: 40px auto; }
.authbox .card { padding: 22px; }
.authbox h1 { font-size: 21px; margin: 0 0 6px; }
.authfoot { text-align: center; font-size: 13px; color: var(--muted); margin-top: 14px; }

/* ---------- products ---------- */
.ptile { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ptile:last-child { border-bottom: 0; }
.ptile img, .plogo-ph { width: 34px; height: 34px; border-radius: 8px; object-fit: contain; background: #f1f5f9; display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--muted); }
.ptile .grow { flex: 1 1 auto; }
.bar { height: 6px; background: #e2e8f0; border-radius: 999px; overflow: hidden; margin-top: 6px; }
.bar > span { display: block; height: 100%; background: var(--accent); }

footer.site { color: var(--muted); font-size: 12px; text-align: center; padding: 18px 0 40px; }
footer.site a { color: var(--muted); }
