/* KBT RUVIA Pharma — design system */
:root {
    --navy-900: #071d4f;
    --navy-800: #0a2a6e;
    --navy-700: #0f3a8c;
    --navy-600: #1747a6;
    --primary: #1663f0;
    --primary-600: #0f55d8;
    --primary-50: #eaf2ff;
    --primary-100: #d6e5ff;
    --bg: #eef4fc;
    --card: #ffffff;
    --border: #e2e9f3;
    --border-strong: #cfd9e8;
    --text: #13213d;
    --text-2: #4a5873;
    --muted: #7c89a3;
    --green: #12a150;
    --green-50: #e6f7ee;
    --red: #e23d3d;
    --red-50: #fdecec;
    --amber: #e48a0c;
    --amber-50: #fff4e2;
    --purple: #7a4cf0;
    --purple-50: #f1ebff;
    --teal: #0e9f9a;
    --teal-50: #e3f7f6;
    --radius: 10px;
    --radius-sm: 7px;
    --shadow: 0 1px 2px rgba(16, 38, 84, .05), 0 2px 8px rgba(16, 38, 84, .05);
    --shadow-lg: 0 10px 30px rgba(10, 42, 110, .12);
    --sidebar-w: 236px;
    --header-h: 60px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 13.5px;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; color: var(--text); }
h1 { font-size: 21px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }
.icon-xl { width: 30px; height: 30px; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w);
    flex: none;
    background: linear-gradient(180deg, var(--navy-800), var(--navy-900));
    color: #c9d6f2;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}
.sidebar-brand { height: var(--header-h); display: flex; align-items: center; gap: 10px; padding: 0 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 10px 20px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
.nav-group { margin-bottom: 2px; }
.nav-group > summary {
    list-style: none;
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    color: #d6e1f7;
    user-select: none;
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary:hover { background: rgba(255,255,255,.07); }
.nav-group > summary .chev { margin-left: auto; width: 14px; height: 14px; opacity: .6; transition: transform .15s; }
.nav-group[open] > summary .chev { transform: rotate(90deg); }
.nav-group.active > summary { background: var(--primary); color: #fff; }
.nav-sub { padding: 3px 0 6px 38px; display: flex; flex-direction: column; }
.nav-sub a { color: #aebde0; padding: 5px 8px; border-radius: 6px; font-size: 12.5px; }
.nav-sub a:hover { color: #fff; background: rgba(255,255,255,.06); text-decoration: none; }
.nav-sub a.active { color: #fff; background: rgba(22, 99, 240, .45); }
.nav-heading { font-size: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: #6f84b5; padding: 10px 8px 4px; }
.nav-heading:first-child { padding-top: 2px; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 11.5px; color: #8fa2cc; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    height: var(--header-h);
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 14px;
    padding: 0 22px;
    position: sticky; top: 0; z-index: 20;
}
.topbar-search { flex: 1; max-width: 520px; position: relative; }
.topbar-search input[type=search] { width: 100%; padding-left: 36px; padding-right: 60px; background: #f5f8fd; }
.topbar-search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.topbar-search kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
    position: relative;
    width: 36px; height: 36px;
    border-radius: 9px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--text-2);
    background: transparent; border: 0; cursor: pointer;
}
.icon-btn:hover { background: var(--primary-50); color: var(--primary); text-decoration: none; }
.icon-btn .dot { position: absolute; top: 5px; right: 5px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 10px; margin-left: 6px; color: var(--text); }
.user-chip:hover { background: var(--primary-50); text-decoration: none; }
.user-chip .name { font-weight: 600; font-size: 13px; line-height: 1.2; }
.user-chip .role { font-size: 11.5px; color: var(--muted); }

.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #1747a6);
    color: #fff; font-weight: 650; font-size: 13px;
    display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 84px; height: 84px; font-size: 28px; }
.avatar.c2 { background: linear-gradient(135deg, #14b8a6, #0e7490); }
.avatar.c3 { background: linear-gradient(135deg, #a855f7, #6d28d9); }
.avatar.c4 { background: linear-gradient(135deg, #f59e0b, #c2410c); }
.avatar.c5 { background: linear-gradient(135deg, #f43f5e, #be123c); }

.content { padding: 20px 22px 32px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 3px; font-size: 12.5px; }
.crumbs { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand-name { font-weight: 800; letter-spacing: -.2px; font-size: 15px; line-height: 1.1; }
.brand-name small { display: block; font-size: 10.5px; font-weight: 500; letter-spacing: 0; opacity: .75; }
.sidebar .brand-name { color: #fff; }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 10px; }
.card-head .meta { color: var(--muted); font-size: 12px; }
.card-body { padding: 4px 16px 16px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12.5px; }

.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-side { grid-template-columns: 280px minmax(0, 1fr); }
.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mb-16 { margin-bottom: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 650; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.text-green { color: var(--green); } .text-red { color: var(--red); } .text-amber { color: var(--amber); } .text-primary { color: var(--primary); }

/* ---------- KPI tiles ---------- */
.kpi { padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; }
.kpi-icon { width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex: none; }
.kpi-label { color: var(--text-2); font-size: 12px; font-weight: 500; }
.kpi-value { font-size: 21px; font-weight: 750; margin-top: 2px; letter-spacing: -.3px; }
.kpi-delta { font-size: 11.5px; font-weight: 600; margin-top: 2px; }
.kpi-delta .muted { font-weight: 400; }
.tone-blue { background: var(--primary-50); color: var(--primary); }
.tone-green { background: var(--green-50); color: var(--green); }
.tone-red { background: var(--red-50); color: var(--red); }
.tone-amber { background: var(--amber-50); color: var(--amber); }
.tone-purple { background: var(--purple-50); color: var(--purple); }
.tone-teal { background: var(--teal-50); color: var(--teal); }
.tone-gray { background: #eef1f6; color: var(--text-2); }

/* ---------- Forms ---------- */
label.lbl { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.input, input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], input[type=number], select, textarea {
    font: inherit;
    font-size: 13px;
    color: var(--text);
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: #fff;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 10px 12px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(22, 99, 240, .15); }
.input-sm, select.input-sm { height: 32px; font-size: 12.5px; padding: 0 10px; }
.field { margin-bottom: 14px; }
.field input, .field select { width: 100%; }
.input-icon { position: relative; }
.input-icon > .icon:first-child { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon input[type] { padding-left: 38px; }
.input-icon .trail { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); color: var(--muted); background: none; border: 0; cursor: pointer; padding: 4px; display: flex; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.err { color: var(--red); font-size: 12px; margin-top: 5px; }
kbd { font: 600 10.5px/1 inherit; color: var(--muted); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; padding: 3px 5px; background: #fff; }

.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cdd6e4; border-radius: 22px; cursor: pointer; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(16px); }

/* ---------- Buttons ---------- */
.btn {
    font: inherit; font-weight: 600; font-size: 13px;
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: 38px; padding: 0 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer; white-space: nowrap;
    text-decoration: none !important;
    transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(22,99,240,.3); }
.btn-primary:hover { background: var(--primary-600); }
.btn-outline { background: #fff; color: var(--text); border-color: var(--border-strong); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-soft { background: var(--primary-50); color: var(--primary); }
.btn-soft:hover { background: var(--primary-100); }
.btn-danger { background: #fff; color: var(--red); border-color: #f3c3c3; }
.btn-danger:hover { background: var(--red-50); }
.btn-success { background: var(--green); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--primary-50); color: var(--primary); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; height: 42px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.b-blue { background: var(--primary-50); color: var(--primary); }
.b-green { background: var(--green-50); color: var(--green); }
.b-red { background: var(--red-50); color: var(--red); }
.b-amber { background: var(--amber-50); color: #b86a00; }
.b-purple { background: var(--purple-50); color: var(--purple); }
.b-gray { background: #eef1f6; color: var(--text-2); }
.b-teal { background: var(--teal-50); color: var(--teal); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { text-align: left; font-weight: 600; color: var(--text-2); background: #f5f8fd; padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; font-size: 12px; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr:hover { background: #f8fbff; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .mono, .mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12px; }

/* ---------- Tabs / filters ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 16px; }
.tabs a, .tabs button { font: inherit; background: none; border: 0; cursor: pointer; padding: 10px 12px; color: var(--text-2); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover, .tabs button:hover { color: var(--primary); text-decoration: none; }
.tabs .active { color: var(--primary); border-bottom-color: var(--primary); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 13px; border-radius: 8px; border: 1px solid var(--border-strong); background: #fff; color: var(--text-2); cursor: pointer; }
.pill:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.pill.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pill .count { opacity: .75; margin-left: 3px; }
.filter-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 16px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.filter-bar .lbl-inline { font-size: 12px; color: var(--muted); font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.seg a, .seg button { font: inherit; font-size: 12.5px; font-weight: 600; padding: 0 12px; height: 32px; display: flex; align-items: center; color: var(--text-2); border: 0; background: none; cursor: pointer; border-right: 1px solid var(--border); }
.seg a:last-child, .seg button:last-child { border-right: 0; }
.seg .active { background: var(--primary-50); color: var(--primary); }
.seg a:hover { text-decoration: none; color: var(--primary); }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); align-items: flex-start; }
.list-item:first-child { border-top: 0; }
.list-item.unread { background: #f7faff; }
.li-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex: none; }
.li-title { font-weight: 600; font-size: 13px; }
.li-sub { color: var(--text-2); font-size: 12.5px; margin-top: 2px; }
.li-time { color: var(--muted); font-size: 11.5px; white-space: nowrap; margin-left: auto; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex: none; margin-top: 6px; }

/* ---------- Progress / bars ---------- */
.bar { height: 7px; border-radius: 4px; background: #e8eef7; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 4px; background: var(--primary); }

/* ---------- Charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: inherit; fill: var(--muted); font-size: 10.5px; }
.chart .grid-line { stroke: #e8eef7; stroke-width: 1; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1fr) minmax(0, 1.15fr); background: #fff; }
.auth-form { display: flex; flex-direction: column; justify-content: center; padding: 40px clamp(32px, 7vw, 110px); }
.auth-form .inner { width: 100%; max-width: 400px; margin: 0 auto; }
.auth-form .brand-block { text-align: center; margin-bottom: 28px; }
.auth-form .brand-block .brand-mark { width: 52px; height: 52px; margin: 0 auto 10px; display: block; }
.auth-form .brand-block .t { font-size: 22px; font-weight: 800; color: var(--navy-800); letter-spacing: -.3px; }
.auth-form .brand-block .s { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.auth-title { text-align: center; margin-bottom: 22px; }
.auth-title h1 { font-size: 22px; }
.auth-title p { color: var(--text-2); margin-top: 6px; line-height: 1.5; }
.auth-icon { width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; background: var(--primary-50); color: var(--primary); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 16px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-aside {
    position: relative; overflow: hidden;
    background:
        radial-gradient(circle at 85% 15%, rgba(96, 165, 250, .35), transparent 45%),
        radial-gradient(circle at 10% 90%, rgba(22, 99, 240, .45), transparent 50%),
        linear-gradient(150deg, #0f3a8c, #071d4f);
    color: #fff;
    padding: 56px clamp(32px, 5vw, 72px);
    display: flex; flex-direction: column; justify-content: center;
}
.auth-aside h2 { color: #fff; font-size: 34px; line-height: 1.15; letter-spacing: -.6px; font-weight: 750; max-width: 480px; }
.auth-aside .lead { color: #c6d6f5; margin-top: 14px; font-size: 14.5px; line-height: 1.6; max-width: 460px; }
.aside-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; max-width: 520px; }
.aside-chips span { padding: 6px 12px; border-radius: 20px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); font-size: 12.5px; }
.aside-features { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-top: 36px; max-width: 560px; }
.aside-features div { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); border-radius: 12px; padding: 14px 10px; text-align: center; font-size: 12.5px; font-weight: 600; }
.aside-features .icon { display: block; margin: 0 auto 8px; width: 24px; height: 24px; color: #93c5fd; }
.aside-preview { margin-top: 36px; max-width: 560px; background: rgba(255,255,255,.96); border-radius: 14px; padding: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.3); color: var(--text); }
.aside-foot { position: absolute; bottom: 22px; left: clamp(32px, 5vw, 72px); right: 32px; font-size: 12px; color: #9fb4de; display: flex; justify-content: space-between; }
.otp { display: flex; gap: 10px; justify-content: center; margin: 6px 0 14px; }
.otp input { width: 50px; height: 56px; padding: 0; text-align: center; font-size: 22px; font-weight: 700; border-radius: 10px; }
.pw-rules { list-style: none; padding: 0; margin: 4px 0 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: 12.5px; color: var(--text-2); }
.pw-rules li { display: flex; align-items: center; gap: 6px; }
.pw-rules li .icon { width: 15px; height: 15px; color: #b6c1d4; }
.pw-rules li.ok { color: var(--green); }
.pw-rules li.ok .icon { color: var(--green); }
.strength { display: flex; gap: 4px; margin: 8px 0 4px; }
.strength span { flex: 1; height: 5px; border-radius: 3px; background: #e3e9f2; }
.strength.s1 span:nth-child(-n+1) { background: var(--red); }
.strength.s2 span:nth-child(-n+2) { background: var(--amber); }
.strength.s3 span:nth-child(-n+3) { background: #84cc16; }
.strength.s4 span:nth-child(-n+4) { background: var(--green); }
.alert { padding: 10px 12px; border-radius: 8px; font-size: 12.5px; display: flex; gap: 8px; align-items: flex-start; line-height: 1.45; }
.alert-info { background: var(--primary-50); color: #18438f; }
.alert-ok { background: var(--green-50); color: #0c6e37; }
.alert-warn { background: var(--amber-50); color: #8a5300; }
.alert-err { background: var(--red-50); color: #a52828; }

/* ---------- Misc ---------- */
.empty { text-align: center; padding: 30px; color: var(--muted); }
.qr { width: 168px; height: 168px; padding: 8px; background: #fff; border: 1px solid var(--border); border-radius: 10px; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps > li { counter-increment: s; position: relative; padding-left: 36px; margin-bottom: 18px; }
.steps > li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.dl { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.dl dt { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.dl dd { margin: 0; font-weight: 550; }
.hl { background: #fff3b0; color: inherit; padding: 0 1px; border-radius: 2px; }
.search-hero { position: relative; }
.search-hero input[type=search] { width: 100%; height: 48px; font-size: 15px; padding-left: 46px; border-radius: 10px; }
.search-hero > .icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 20px; height: 20px; }
.result { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 12px; align-items: center; }
.result:first-child { border-top: 0; }
.result:hover { background: #f8fbff; }
.sla { font-size: 11.5px; font-weight: 600; }
.branch-row { display: grid; grid-template-columns: 150px 1fr 90px; gap: 12px; align-items: center; padding: 7px 0; font-size: 12.5px; }
.timeline { list-style: none; margin: 0; padding: 0 16px 8px; }
.timeline li { position: relative; padding: 0 0 14px 22px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.timeline li::after { content: ""; position: absolute; left: 7.5px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline .t-green::before { background: var(--green); box-shadow: 0 0 0 3px var(--green-50); }
.timeline .t-red::before { background: var(--red); box-shadow: 0 0 0 3px var(--red-50); }
.timeline .t-amber::before { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-50); }
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.pagination .pg { display: flex; gap: 4px; }
.pagination .pg a { min-width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 6px; color: var(--text-2); font-weight: 600; }
.pagination .pg a.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- Step 2: administration & RBAC ---------- */
.perm { width: 26px; height: 26px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; border: 0; cursor: pointer; font: inherit; }
.perm .icon { width: 14px; height: 14px; stroke-width: 2.4; }
.perm.on { background: var(--green-50); color: var(--green); }
.perm.off { background: #f2f4f8; color: #b3bdcd; }
.perm.scoped { background: var(--primary-50); color: var(--primary); }
.perm.sod { background: var(--red-50); color: var(--red); cursor: not-allowed; }
.perm.na { background: transparent; color: #cfd6e2; cursor: default; }
.tbl.matrix td, .tbl.matrix th { text-align: center; padding: 7px 8px; }
.tbl.matrix td:first-child, .tbl.matrix th:first-child { text-align: left; padding-left: 16px; }
.tbl.matrix tr.group td { background: #f7f9fd; font-weight: 700; color: var(--navy-800); text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; }
.legend-perm { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); align-items: center; }
.legend-perm span { display: inline-flex; align-items: center; gap: 6px; }
.legend-perm .perm { width: 20px; height: 20px; cursor: default; }
.scope { display: inline-flex; width: 30px; height: 26px; border-radius: 6px; align-items: center; justify-content: center; font-weight: 700; font-size: 11.5px; }
.scope-F { background: var(--primary); color: #fff; }
.scope-O { background: var(--primary-100); color: var(--primary-600); }
.scope-R { background: #eef1f6; color: var(--text-2); }
.scope-N { background: transparent; color: #cfd6e2; border: 1px dashed #dbe2ec; }
.tree { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.tree ul { list-style: none; margin: 0 0 0 8px; padding-left: 22px; border-left: 1px dashed var(--border-strong); }
.tree li { padding: 4px 0; }
.tree .node { display: inline-flex; align-items: center; gap: 7px; }
.tree .node .icon { width: 15px; height: 15px; color: var(--primary); }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 6px; background: var(--primary-50); color: var(--primary-600); font-size: 11.5px; font-weight: 600; margin: 2px 4px 2px 0; white-space: nowrap; }
.chip.gray { background: #eef1f6; color: var(--text-2); }
.chip.red { background: var(--red-50); color: var(--red); }
.risk-Critical { background: var(--red-50); color: var(--red); }
.risk-High { background: var(--amber-50); color: #b86a00; }
.risk-Medium { background: var(--primary-50); color: var(--primary); }
.risk-Low { background: var(--green-50); color: var(--green); }
.callout { border: 1px solid #f3c3c3; background: #fff8f8; border-radius: var(--radius); padding: 12px 14px; }
.callout.amber { border-color: #f5d9a8; background: #fffaf1; }
.callout.blue { border-color: var(--primary-100); background: #f7faff; }
.stepper { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.stepper .st { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.stepper .st b { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border-strong); display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px; }
.stepper .st.done b { background: var(--green); border-color: var(--green); color: #fff; }
.stepper .st.cur { color: var(--primary); }
.stepper .st.cur b { background: var(--primary); border-color: var(--primary); color: #fff; }
.stepper .line { flex: 1; height: 2px; background: var(--border); margin: 0 12px; min-width: 20px; }
.flow { display: flex; flex-direction: column; align-items: center; padding: 18px 16px 24px; background-image: radial-gradient(#d6e0ee 1px, transparent 1px); background-size: 16px 16px; }
.flow-node { width: 100%; max-width: 520px; background: #fff; border: 1px solid var(--border-strong); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); }
.flow-node.sel { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(22,99,240,.15); }
.flow-node.trigger { border-left: 4px solid var(--purple); }
.flow-node.cond { border-left: 4px solid var(--amber); }
.flow-node.step { border-left: 4px solid var(--primary); }
.flow-node.end { border-left: 4px solid var(--green); max-width: 280px; text-align: center; }
.flow-arrow { width: 2px; height: 22px; background: var(--border-strong); position: relative; flex: none; }
.flow-arrow::after { content: ""; position: absolute; bottom: -4px; left: -4px; border: 5px solid transparent; border-top-color: var(--border-strong); }
.flow-branches { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; width: 100%; }
.flow-branches > div { display: flex; flex-direction: column; align-items: center; }
.flow-branches .flow-node { max-width: none; }
.flow-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-bottom: 4px; }
.health { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 12.5px; }
.health:first-child { border-top: 0; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.sd-green { background: var(--green); } .sd-red { background: var(--red); } .sd-amber { background: var(--amber); } .sd-gray { background: #b3bdcd; }
.int-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.int-card .top { display: flex; gap: 12px; align-items: flex-start; }
.diff { font-family: ui-monospace, Consolas, monospace; font-size: 12px; border-radius: 6px; padding: 6px 10px; }
.diff.del { background: var(--red-50); color: #a52828; }
.diff.add { background: var(--green-50); color: #0c6e37; }
.var { font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; background: var(--amber-50); color: #8a5300; padding: 1px 5px; border-radius: 4px; }
.preview-mail { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.preview-mail .hd { background: var(--navy-800); color: #fff; padding: 12px 16px; display: flex; align-items: center; gap: 10px; font-weight: 700; }
.preview-mail .bd { padding: 16px; line-height: 1.6; font-size: 13px; }
.vtabs { display: flex; flex-direction: column; padding: 8px; gap: 2px; }
.vtabs a { padding: 9px 12px; border-radius: 8px; color: var(--text-2); font-weight: 550; display: flex; align-items: center; gap: 10px; }
.vtabs a:hover { background: var(--primary-50); color: var(--primary); text-decoration: none; }
.vtabs a.active { background: var(--primary-50); color: var(--primary); }
.setting-row { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; padding: 13px 0; border-top: 1px solid var(--border); align-items: center; }
.setting-row:first-child { border-top: 0; }
.setting-row .t { font-weight: 600; }
.setting-row .d { font-size: 12px; color: var(--muted); margin-top: 2px; }
.setting-row select, .setting-row input[type] { width: 100%; }
.g-side-r { grid-template-columns: minmax(0, 1fr) 320px; }

/* ---------- Step 3: locations ---------- */
.hier { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; box-shadow: var(--shadow); font-size: 12.5px; }
.hier-node { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 7px; background: #f3f6fb; color: var(--text-2); font-weight: 600; }
a.hier-node:hover { background: var(--primary-50); color: var(--primary); text-decoration: none; }
.hier-node.cur { background: var(--primary-50); color: var(--primary); }
.type-tile { display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: inherit; }
a.type-tile:hover { text-decoration: none; border-color: var(--primary); }
.type-tile .kpi-value { font-size: 19px; }
.donut-legend { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.donut-legend li { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.week { display: grid; grid-template-columns: 110px repeat(24, minmax(0, 1fr)); align-items: center; font-size: 11.5px; }
.week .hr { color: var(--muted); text-align: left; border-left: 1px solid var(--border); padding-left: 2px; height: 18px; }
.week .day { font-weight: 600; padding: 8px 0; }
.week .slot { height: 22px; position: relative; border-left: 1px solid #f0f3f8; }
.week .open { position: absolute; top: 3px; bottom: 3px; background: var(--primary); border-radius: 4px; color: #fff; font-size: 10.5px; font-weight: 600; display: flex; align-items: center; padding-left: 6px; white-space: nowrap; overflow: hidden; }
.week .open.alt { background: #7aa7f7; }
.week .open.closed { background: #eef1f6; color: var(--muted); }
.inherit { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 5px; background: #eef1f6; color: var(--text-2); white-space: nowrap; }
.inherit.ovr { background: var(--amber-50); color: #8a5300; }
.plan { width: 100%; height: auto; display: block; background: #f8fafd; border-radius: 10px; }
.plan text { font-family: inherit; font-size: 12px; font-weight: 600; fill: var(--text); }
.plan .z { stroke-width: 1.5; }
.zone-chip { display: flex; align-items: center; gap: 8px; padding: 7px 0; font-size: 12.5px; border-top: 1px solid var(--border); }
.zone-chip:first-child { border-top: 0; }
.zone-chip i { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.queue-item { display: grid; grid-template-columns: 70px 1fr auto; gap: 12px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--border); }
.queue-item:first-child { border-top: 0; }

/* ---------- Step 4: catalogue ---------- */
.uom-flow { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 4px; }
.uom-step { flex: 1; text-align: center; }
.uom-step .ic { width: 64px; height: 64px; margin: 0 auto 8px; border-radius: 16px; display: flex; align-items: center; justify-content: center; background: var(--primary-50); color: var(--primary); }
.uom-step .t { font-weight: 700; }
.uom-step .s { font-size: 12px; color: var(--muted); }
.uom-arrow { color: var(--primary); font-size: 22px; font-weight: 700; }
.stages { display: flex; gap: 0; }
.stages .stg { flex: 1; text-align: center; position: relative; padding-top: 34px; font-size: 12px; font-weight: 600; color: var(--muted); }
.stages .stg::before { content: ""; position: absolute; top: 12px; left: 0; right: 0; height: 3px; background: var(--border); }
.stages .stg:first-child::before { left: 50%; }
.stages .stg:last-child::before { right: 50%; }
.stages .stg b { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 3px solid var(--border-strong); z-index: 1; }
.stages .stg.done { color: var(--text); }
.stages .stg.done::before { background: var(--green); }
.stages .stg.done b { background: var(--green); border-color: var(--green); }
.stages .stg.cur { color: var(--primary); }
.stages .stg.cur b { background: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-100); }
.placeholder-text { background: repeating-linear-gradient(135deg, #fbfcfe, #fbfcfe 8px, #f4f7fb 8px, #f4f7fb 16px); border: 1px dashed var(--border-strong); border-radius: 8px; padding: 10px 12px; color: var(--text-2); font-size: 12.5px; line-height: 1.55; }
.barcode { display: flex; align-items: flex-end; gap: 1px; height: 48px; }
.barcode i { display: block; background: #13213d; height: 100%; }
.cond { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--border); }
.cond:first-child { border-top: 0; }

/* ---------- Step 5: inventory ---------- */
.src-doc { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 6px; font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; font-weight: 600; white-space: nowrap; text-decoration: none !important; }
.src-doc:hover { filter: brightness(.95); box-shadow: 0 0 0 2px rgba(22,99,240,.18); }
.stack-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: #e8eef7; min-width: 90px; }
.stack-bar span { display: block; height: 100%; }
.bucket-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-2); }
.bucket-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.qty-in { color: var(--green); font-weight: 650; }
.qty-out { color: var(--red); font-weight: 650; }
.bucket-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.bucket-tiles > div { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
h1 .mono { font-size: inherit; }
.bucket-tiles .v { font-size: 20px; font-weight: 750; }
.bucket-tiles .l { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .d { border: 1px solid var(--border); border-radius: 8px; min-height: 74px; padding: 6px 7px; font-size: 11px; background: #fff; }
.cal .d .n { font-weight: 700; color: var(--text-2); margin-bottom: 4px; }
.cal .d.today { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(22,99,240,.15); }
.cal .d.muted-day { background: #f7f9fc; color: var(--muted); }
.cal .ev { display: block; border-radius: 4px; padding: 2px 5px; margin-bottom: 3px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .h { font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; }

/* ---------- Board (design overview) ---------- */
.board { background: #e6eefa; min-height: 100vh; padding: 22px; }
.board-head { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.board-title { background: linear-gradient(135deg, var(--navy-700), var(--navy-900)); color: #fff; border-radius: 14px; padding: 12px 28px; text-align: center; flex: 1; min-width: 320px; }
.board-title h1 { color: #fff; font-size: 24px; }
.board-title p { color: #c6d6f5; margin-top: 3px; }
.board-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.frame { background: #fff; border-radius: 12px; overflow: hidden; border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); }
.frame-title { background: linear-gradient(90deg, var(--navy-700), var(--primary)); color: #fff; padding: 9px 14px; font-weight: 700; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.frame-title a { color: #dbe7ff; font-size: 12px; font-weight: 500; }
.frame-view { position: relative; width: 100%; aspect-ratio: 16 / 10; overflow: hidden; background: var(--bg); }
.frame-view iframe { position: absolute; top: 0; left: 0; width: 1440px; height: 900px; border: 0; transform-origin: 0 0; pointer-events: none; }

@media (max-width: 1200px) {
    .g-4, .g-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .g-main { grid-template-columns: 1fr; }
    .board-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .auth { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
    .sidebar { display: none; }
    .g-2, .g-3, .g-side { grid-template-columns: 1fr; }
    .board-grid { grid-template-columns: 1fr; }
}

/* Shared screen actions (public/js/actions.js) */
#kbt-toasts { position: fixed; right: 18px; bottom: 18px; z-index: 9999; display: grid; gap: 8px; max-width: 420px; }
.kbt-toast { display: flex; gap: 10px; align-items: flex-start; background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--green, #1e9e5a); border-radius: 8px; padding: 10px 14px; box-shadow: 0 8px 24px rgba(15,35,70,.18); font-size: 13px; transition: opacity .4s, transform .4s; }
.kbt-toast.err { border-left-color: var(--red, #c62828); }
.kbt-toast > span { font-weight: 800; color: var(--green, #1e9e5a); }
.kbt-toast.err > span { color: var(--red, #c62828); }
.kbt-toast.out { opacity: 0; transform: translateY(8px); }
.kbt-last { display: inline-block; margin-top: 6px; font-size: 11.5px; color: var(--muted); background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; text-decoration: none; }
.kbt-last:hover { color: var(--primary); }
@media print { .sidebar, .topbar, #kbt-toasts, .kbt-last, .btn { display: none !important; } .main, main.content { margin: 0 !important; padding: 0 !important; } }
#kbt-details { position: fixed; inset: 0; background: rgba(10,25,50,.35); z-index: 9998; display: flex; align-items: center; justify-content: center; }
.kbt-details-card { background: #fff; border-radius: 10px; width: min(520px, 92vw); max-height: 80vh; overflow: auto; box-shadow: 0 20px 50px rgba(10,25,50,.3); font-size: 13px; }
.kbt-details-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.kbt-details-head button { border: 0; background: none; font-size: 16px; cursor: pointer; }
.kbt-details-row { display: grid; grid-template-columns: 40% 60%; gap: 10px; padding: 8px 18px; border-bottom: 1px solid var(--border); }
.kbt-details-row span:first-child { color: var(--muted); }
.kbt-details-foot { padding: 12px 18px; }

/* disabled controls must look disabled */
.btn:disabled,.btn[disabled]{opacity:.45;cursor:not-allowed;filter:grayscale(.2)}
