:root {
    --brand-primary: #087a4b;
    --brand-primary-light: #2fa66f;
    --brand-primary-dark: #045c38;
    --brand-primary-soft: #e1f2e8;
    --header-surface: #f3f8f5;
    --header-ink: #173528;
    --header-muted: #64796e;
    --header-blue: var(--brand-primary);
    --header-blue-soft: var(--brand-primary-soft);
    --header-line: #d9e8df;
    --app-background: #f7faf8;
    --app-surface: #ffffff;
    --app-surface-muted: #f0f6f2;
    --app-hover: #e6f1ea;
    --app-nav-hover: #dff0e6;
    --app-nav-text: #365947;
    --app-chevron: #587565;
    --app-border-soft: #e0ebe4;
    --app-header-shadow: 0 2px 16px rgba(16, 71, 45, .06);
    --app-popover-shadow: 0 16px 40px rgba(10, 67, 39, .14);
    --app-panel-shadow: 0 9px 25px rgba(12, 78, 46, .045);
    --app-card-shadow: 0 10px 28px rgba(12, 78, 46, .09);
    --app-mobile-shadow: 0 14px 18px rgba(16, 71, 45, .07);
    --rz-primary: var(--brand-primary);
    --rz-primary-light: var(--brand-primary-light);
    --rz-primary-dark: var(--brand-primary-dark);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Inter, "Segoe UI", Arial, sans-serif; color: var(--header-ink); }
body { background: var(--app-background); }
button, a { -webkit-tap-highlight-color: transparent; }

.app-shell {
    min-height: 100vh;
    color: var(--header-ink);
    background: var(--app-background);
    transition: color .2s ease, background-color .2s ease;
}
.app-shell.theme-light,
body:has(.app-shell.theme-light),
.login-shell,
body:has(.login-shell) {
    --rz-primary: #087a4b;
    --rz-primary-light: #2fa66f;
    --rz-primary-lighter: #e1f2e8;
    --rz-primary-dark: #045c38;
    --rz-primary-darker: #033f27;
    --rz-on-primary: #ffffff;
    --rz-on-primary-lighter: #087a4b;
    --rz-border-primary: 1px solid #087a4b;
    --rz-checkbox-checked-background-color: #087a4b;
    --rz-checkbox-checked-border: 1px solid #087a4b;
    --rz-checkbox-checked-hover-background-color: #2fa66f;
    --rz-checkbox-checked-hover-border: 1px solid #2fa66f;
    --rz-radio-active-background-color: #087a4b;
    --rz-radio-checked-background-color: #087a4b;
    --rz-radio-checked-border: 1px solid #087a4b;
    --rz-radio-checked-hover-background-color: #2fa66f;
    --rz-switch-checked-background-color: #087a4b;
    --rz-pager-numeric-button-selected-background-color: #087a4b;
    --rz-pager-numeric-button-selected-border: 1px solid #087a4b;
    --rz-pager-numeric-button-selected-color: #ffffff;
}
.app-shell.theme-dark,
body:has(.app-shell.theme-dark) {
    --header-surface: #0f161e;
    --header-ink: #f3f6fb;
    --header-muted: #9aa8ba;
    --header-blue: #2f80ff;
    --header-line: #26313d;
    --app-background: #0a1016;
    --app-surface: #111922;
    --app-surface-muted: #1a232e;
    --app-hover: #18232e;
    --app-nav-hover: #152234;
    --app-nav-text: #bdc8d7;
    --app-chevron: #8fa0b4;
    --app-border-soft: #27333f;
    --app-header-shadow: 0 2px 18px rgba(0, 0, 0, .28);
    --app-popover-shadow: 0 18px 44px rgba(0, 0, 0, .38);
    --app-panel-shadow: 0 12px 30px rgba(0, 0, 0, .2);
    --app-card-shadow: 0 12px 30px rgba(0, 0, 0, .24);
    --app-mobile-shadow: 0 16px 22px rgba(0, 0, 0, .3);
    --rz-primary: #2f80ff;
    --rz-primary-light: #5c9aff;
    --rz-primary-dark: #1769d7;
    --rz-body-background-color: #0a1016;
    --rz-base-background-color: #111922;
    --rz-text-title-color: #f3f6fb;
    --rz-text-color: #dce4ef;
    --rz-text-secondary-color: #9aa8ba;
}
.app-shell.theme-light .rz-button.rz-primary.rz-variant-filled,
.login-shell .rz-button.rz-primary.rz-variant-filled {
    color: #ffffff;
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}
.app-shell.theme-light .rz-button.rz-primary.rz-variant-filled:hover,
.login-shell .rz-button.rz-primary.rz-variant-filled:hover {
    background-color: var(--brand-primary-dark);
    border-color: var(--brand-primary-dark);
}
body:has(.app-shell.theme-light) .queue-metric--blue { --metric-color: #087a4b; }
body:has(.app-shell.theme-light) .queue-metric--violet { --metric-color: #4e956b; }
body:has(.app-shell.theme-light) .bot-session-card__status.status-completed {
    color: #2e8158;
    background: color-mix(in srgb, #4ca878 14%, var(--app-surface));
    border-color: color-mix(in srgb, #4ca878 20%, var(--app-surface));
}
body:has(.app-shell.theme-light) .bot-session-card__status.status-not-finished {
    color: #557b3c;
    background: color-mix(in srgb, #7ca65c 14%, var(--app-surface));
    border-color: color-mix(in srgb, #7ca65c 20%, var(--app-surface));
}
body:has(.app-shell.theme-light) .session-details__status.status-completed {
    color: #2e8158;
    background: color-mix(in srgb, #4ca878 14%, var(--app-surface));
}
body:has(.app-shell.theme-light) .session-details__status.status-not-finished {
    color: #557b3c;
    background: color-mix(in srgb, #7ca65c 14%, var(--app-surface));
}
body:has(.app-shell.theme-light) .form-heading .form-create.rz-button:hover {
    background: color-mix(in srgb, var(--header-blue) 88%, #064e32);
    border-color: color-mix(in srgb, var(--header-blue) 88%, #064e32);
}
body:has(.app-shell.theme-light) .queue-item .queue-item__action.is-primary.rz-button:hover {
    background: color-mix(in srgb, var(--header-blue) 88%, #064e32);
}
.site-header { position: relative; z-index: 10; background: var(--header-surface); box-shadow: var(--app-header-shadow); transition: background-color .2s ease, border-color .2s ease; }
.header-top { min-height: 70px; padding: 0 clamp(20px, 3vw, 48px); display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--header-line); }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--header-ink); text-decoration: none; white-space: nowrap; }
.brand-logo { width: 40px; height: 40px; display: block; object-fit: contain; flex: none; border-radius: 50%; mix-blend-mode: multiply; }
.brand-name { font-size: 22px; line-height: 1; font-weight: 800; letter-spacing: -.045em; }
.header-actions { display: flex; align-items: center; gap: 18px; }
.header-popover-anchor { position: relative; }
.icon-button, .profile-button { border: 0; background: transparent; color: var(--header-ink); cursor: pointer; }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; }
.menu-toggle { display: none; }
.icon-button:hover, .profile-button:hover { background: var(--app-hover); }
.theme-toggle.rz-button { width: 36px; height: 36px; min-width: 36px; padding: 0; color: var(--header-ink) !important; background: transparent; border: 0; border-radius: 8px; box-shadow: none; }
.theme-toggle.rz-button:hover { color: var(--header-blue) !important; background: var(--app-hover); box-shadow: none; }
.theme-toggle.rz-button:focus-visible { outline: 3px solid color-mix(in srgb, var(--header-blue) 22%, transparent); outline-offset: 2px; }
.theme-toggle.rz-button .rzi { margin: 0; font-size: 19px; }
.header-icon { width: 17px; height: 17px; flex: none; }
.notification-button { position: relative; }
.notification-button .header-icon { width: 18px; height: 18px; }
.notification-dot { position: absolute; right: 6px; top: 5px; width: 7px; height: 7px; background: #e4505b; border: 1.5px solid var(--header-surface); border-radius: 50%; }
.header-divider { height: 30px; width: 1px; background: var(--header-line); }
.profile-button { min-height: 46px; display: flex; align-items: center; gap: 10px; padding: 4px 7px; border-radius: 9px; text-align: left; }
.profile-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #375f85, #9bb8ca); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; box-shadow: inset 0 0 0 2px #fff; }
.app-shell.theme-light .profile-avatar { background: linear-gradient(135deg, #087a4b, #8ac8a5); }
.profile-copy { display: grid; gap: 1px; min-width: 88px; }
.profile-copy strong { font-size: 11px; line-height: 1.15; font-weight: 700; }
.profile-copy small { color: var(--header-muted); font-size: 10px; }
.profile-button > .header-icon { width: 14px; height: 14px; margin-left: 7px; color: var(--app-chevron); }
.header-popover { position: absolute; top: calc(100% + 9px); right: 0; min-width: 235px; padding: 16px; border: 1px solid var(--header-line); border-radius: 12px; background: var(--app-surface); box-shadow: var(--app-popover-shadow); font-size: 13px; }
.header-popover strong { display: block; font-size: 13px; }
.header-popover p, .header-popover span { color: var(--header-muted); font-size: 12px; line-height: 1.5; }
.header-popover p { margin: 8px 0 0; }
.header-popover a { display: block; padding: 5px 0; color: var(--header-blue); text-decoration: none; }
.popover-rule { height: 1px; margin: 12px 0 8px; background: var(--header-line); }

.header-bottom { min-height: 58px; padding: 0 clamp(20px, 3vw, 48px); display: flex; align-items: stretch; justify-content: space-between; gap: 24px; }
.main-nav { display: flex; align-items: stretch; gap: clamp(10px, 1.8vw, 30px); min-width: 0; overflow-x: auto; scrollbar-width: none; }
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a { position: relative; display: inline-flex; align-items: center; gap: 8px; flex: none; padding: 0 3px; color: var(--app-nav-text); font-size: 12px; font-weight: 600; white-space: nowrap; text-decoration: none; transition: color .15s ease; }
.main-nav a:hover, .main-nav a.active { color: var(--header-blue); }
.main-nav a.active::after { content: ""; position: absolute; right: 0; bottom: 0; left: 0; height: 2px; border-radius: 2px 2px 0 0; background: var(--header-blue); }
.main-nav a .header-icon { width: 16px; height: 16px; }
.system-status { display: flex; align-items: center; flex: none; gap: 10px; padding-left: 10px; }
.system-status > span:last-child { display: grid; gap: 2px; }
.system-status strong { font-size: 11px; font-weight: 600; }
.system-status small { font-size: 10px; color: var(--header-muted); }
.status-dot { width: 7px; height: 7px; margin-top: -12px; background: #08a574; border-radius: 50%; box-shadow: 0 0 0 3px rgba(8, 165, 116, .11); }

.app-content { max-width: 1400px; margin: 0 auto; padding: 40px clamp(20px, 3vw, 48px); }
.page-eyebrow { margin: 0 0 8px; color: var(--header-blue); font-size: 11px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.page-title { margin: 0; font-size: clamp(27px, 3vw, 38px); font-weight: 750; letter-spacing: -.045em; }
.page-title:focus { outline: none; }
.page-description { max-width: 630px; margin: 10px 0 0; color: var(--header-muted); font-size: 14px; line-height: 1.6; }
.mock-panel { margin-top: 28px; padding: 28px; border: 1px solid var(--app-border-soft); border-radius: 18px; background: var(--app-surface); box-shadow: var(--app-panel-shadow); }
.mock-panel h2 { margin: 0 0 8px; font-size: 19px; letter-spacing: -.025em; }
.mock-panel p { margin: 0; color: var(--header-muted); font-size: 13px; }
.mock-badge { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 20px; padding: 7px 10px; border-radius: 999px; background: var(--app-nav-hover); color: var(--header-blue); font-size: 11px; font-weight: 700; }
.mock-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.dashboard-page { display: grid; gap: 28px; }
.dashboard-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; }
.dashboard-system-status { min-width: 275px; display: flex; align-items: center; gap: 11px; padding: 12px 12px 12px 14px; border: 1px solid color-mix(in srgb, #08a574 20%, var(--app-border-soft)); border-radius: 14px; background: color-mix(in srgb, #08a574 6%, var(--app-surface)); box-shadow: var(--app-panel-shadow); }
.dashboard-system-status__icon { width: 34px; height: 34px; display: grid; place-items: center; flex: none; border-radius: 10px; background: color-mix(in srgb, #08a574 13%, var(--app-surface)); color: #07845e; }
.dashboard-system-status__icon .rzi { font-size: 19px; }
.dashboard-system-status > span:nth-child(2) { min-width: 0; display: grid; gap: 2px; flex: 1; }
.dashboard-system-status strong { font-size: 12px; }
.dashboard-system-status small { color: var(--header-muted); font-size: 10px; }
.dashboard-system-status.has-warning { border-color: color-mix(in srgb, #d68a00 25%, var(--app-border-soft)); background: color-mix(in srgb, #d68a00 7%, var(--app-surface)); }
.dashboard-system-status.has-warning .dashboard-system-status__icon { background: color-mix(in srgb, #d68a00 14%, var(--app-surface)); color: #b47400; }
.dashboard-refresh.rz-button { width: 32px; height: 32px; min-width: 32px; padding: 0; border-radius: 9px; color: var(--header-muted); }
.dashboard-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.dashboard-metric { --metric-color: var(--header-blue); position: relative; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 20px; overflow: hidden; border: 1px solid var(--app-border-soft); border-radius: 17px; background: var(--app-surface); color: var(--header-ink); box-shadow: var(--app-panel-shadow); text-decoration: none; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.dashboard-metric::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--metric-color); opacity: .78; }
.dashboard-metric:hover { border-color: color-mix(in srgb, var(--metric-color) 28%, var(--app-border-soft)); box-shadow: var(--app-card-shadow); transform: translateY(-2px); }
.dashboard-metric--blue { --metric-color: var(--header-blue); }
.dashboard-metric--amber { --metric-color: #d68a00; }
.dashboard-metric--green { --metric-color: #08a574; }
.dashboard-metric--violet { --metric-color: #7857d6; }
.app-shell.theme-light .dashboard-metric--violet { --metric-color: #4e956b; }
.dashboard-metric__icon { width: 44px; height: 44px; display: grid; place-items: center; flex: none; border-radius: 13px; background: color-mix(in srgb, var(--metric-color) 10%, var(--app-surface)); color: var(--metric-color); }
.dashboard-metric__icon .rzi { font-size: 22px; }
.dashboard-metric__copy { min-width: 0; display: grid; gap: 3px; flex: 1; }
.dashboard-metric__copy small { overflow: hidden; color: var(--header-muted); font-size: 11px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-metric__copy strong { font-size: 26px; line-height: 1.05; letter-spacing: -.04em; }
.dashboard-metric__copy span { overflow: hidden; color: var(--header-muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-metric__arrow { flex: none; color: var(--app-chevron); font-size: 17px; opacity: .65; }
.dashboard-workspace { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .8fr); align-items: stretch; gap: 18px; }
.dashboard-workspace:has(> .dashboard-side:only-child) { grid-template-columns: 1fr; }
.dashboard-panel { overflow: hidden; border: 1px solid var(--app-border-soft); border-radius: 18px; background: var(--app-surface); box-shadow: var(--app-panel-shadow); }
.dashboard-panel__header { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 17px 20px; border-bottom: 1px solid var(--app-border-soft); }
.dashboard-panel__header h2 { margin: 0; font-size: 15px; letter-spacing: -.015em; }
.dashboard-panel__header p { margin: 4px 0 0; color: var(--header-muted); font-size: 11px; }
.dashboard-panel__header > a { display: inline-flex; align-items: center; gap: 5px; color: var(--header-blue); font-size: 11px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.dashboard-panel__header > a .rzi { font-size: 15px; }
.dashboard-session-list { display: grid; }
.dashboard-session { min-width: 0; min-height: 70px; display: grid; grid-template-columns: 38px minmax(130px, 1fr) auto 76px 18px; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--app-border-soft); color: var(--header-ink); text-decoration: none; transition: background-color .15s ease; }
.dashboard-session:last-child { border-bottom: 0; }
.dashboard-session:hover { background: color-mix(in srgb, var(--app-nav-hover) 42%, var(--app-surface)); }
.dashboard-session__avatar { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid color-mix(in srgb, var(--header-blue) 17%, var(--app-border-soft)); border-radius: 11px; background: color-mix(in srgb, var(--header-blue) 8%, var(--app-surface)); color: var(--header-blue); font-size: 11px; font-weight: 800; }
.dashboard-session__identity { min-width: 0; display: grid; gap: 3px; }
.dashboard-session__identity strong, .dashboard-session__identity small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-session__identity strong { font-size: 12px; }
.dashboard-session__identity small { color: var(--header-muted); font-size: 10px; }
.dashboard-session__status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 999px; background: color-mix(in srgb, #08a574 9%, var(--app-surface)); color: #07845e; font-size: 10px; font-weight: 700; }
.dashboard-session__status > span { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 12%, transparent); }
.dashboard-session time { color: var(--header-muted); font-size: 10px; text-align: right; }
.dashboard-session > .rzi { color: var(--app-chevron); font-size: 17px; }
.dashboard-side { height: 100%; display: grid; }
.dashboard-queue { height: 100%; display: grid; grid-template-rows: auto 1fr; }
.dashboard-queue__items { min-height: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dashboard-queue__items > span { min-height: 83px; display: grid; align-content: center; gap: 5px; padding: 15px 20px; border-right: 1px solid var(--app-border-soft); }
.dashboard-queue__items > span:last-child { border-right: 0; }
.dashboard-queue__items small { color: var(--header-muted); font-size: 10px; }
.dashboard-queue__items strong { font-size: 19px; letter-spacing: -.03em; }
.dashboard-shortcuts nav { display: grid; padding: 7px; }
.dashboard-shortcuts nav a { min-height: 43px; display: grid; grid-template-columns: 28px 1fr 18px; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; color: var(--header-ink); font-size: 11px; font-weight: 650; text-decoration: none; }
.dashboard-shortcuts nav a:hover { background: var(--app-nav-hover); color: var(--header-blue); }
.dashboard-shortcuts nav a > .rzi:first-child { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: var(--app-surface-muted); color: var(--header-blue); font-size: 16px; }
.dashboard-shortcuts nav a > .rzi:last-child { color: var(--app-chevron); font-size: 16px; }
.dashboard-loading, .dashboard-empty { min-height: 240px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 9px; padding: 28px; color: var(--header-muted); text-align: center; }
.dashboard-loading { flex-direction: row; font-size: 12px; }
.dashboard-loading > span { width: 18px; height: 18px; border: 2px solid var(--app-border-soft); border-top-color: var(--header-blue); border-radius: 50%; animation: dashboard-spin .7s linear infinite; }
.dashboard-empty > .rzi { color: #08a574; font-size: 30px; }
.dashboard-empty strong { color: var(--header-ink); font-size: 13px; }
.dashboard-empty span { font-size: 11px; }
@keyframes dashboard-spin { to { transform: rotate(360deg); } }
.theme-dark .brand-logo { mix-blend-mode: normal; }

.form-create-dialog.rz-dialog {
    max-height: calc(100vh - 32px);
    color: var(--header-ink);
    background: var(--app-surface);
    border: 1px solid var(--header-line);
    border-radius: 17px;
    box-shadow: var(--app-popover-shadow);
    overflow: hidden;
}
.form-create-dialog .rz-dialog-titlebar {
    padding: 20px 24px 12px;
    color: var(--header-ink);
    background: var(--app-surface);
    border: 0;
}
.form-create-dialog .rz-dialog-title {
    font-size: 19px;
    font-weight: 750;
    letter-spacing: -.025em;
}
.form-create-dialog .rz-dialog-titlebar-close {
    color: var(--header-muted);
    border-radius: 8px;
}
.form-create-dialog .rz-dialog-titlebar-close:hover {
    color: var(--header-blue);
    background: var(--app-nav-hover);
}
.form-create-dialog .rz-dialog-content {
    padding: 10px 24px 24px;
    background: var(--app-surface);
}

.parameter-edit-dialog.rz-dialog,
.allowed-phone-edit-dialog.rz-dialog,
.session-details-dialog.rz-dialog {
    color: var(--header-ink);
    background: var(--app-surface);
    border: 1px solid var(--header-line);
    border-radius: 16px;
    box-shadow: var(--app-popover-shadow);
    overflow: hidden;
}

.parameter-edit-dialog .rz-dialog-titlebar,
.parameter-edit-dialog .rz-dialog-content,
.allowed-phone-edit-dialog .rz-dialog-titlebar,
.allowed-phone-edit-dialog .rz-dialog-content,
.session-details-dialog .rz-dialog-titlebar,
.session-details-dialog .rz-dialog-content {
    color: var(--header-ink);
    background: var(--app-surface);
}

.parameter-edit-dialog .rz-dialog-titlebar,
.allowed-phone-edit-dialog .rz-dialog-titlebar,
.session-details-dialog .rz-dialog-titlebar {
    padding: 19px 22px 11px;
    border: 0;
}

.parameter-edit-dialog .rz-dialog-content,
.allowed-phone-edit-dialog .rz-dialog-content,
.session-details-dialog .rz-dialog-content {
    padding: 10px 22px 22px;
}

@media (max-width: 620px) {
    .form-create-dialog .rz-dialog-titlebar { padding: 17px 18px 10px; }
    .form-create-dialog .rz-dialog-content { padding: 8px 18px 18px; }
}

@media (max-width: 1050px) {
    .menu-toggle { display: grid; }
    .menu-toggle .header-icon { width: 21px; height: 21px; }
    .header-bottom { display: none; padding: 10px clamp(20px, 3vw, 48px) 18px; border-top: 1px solid var(--header-line); box-shadow: var(--app-mobile-shadow); }
    .header-bottom.mobile-open { display: block; }
    .main-nav { display: flex; flex-direction: column; gap: 2px; overflow: visible; }
    .main-nav a { min-height: 46px; padding: 0 14px; border-radius: 8px; font-size: 13px; }
    .main-nav a:hover, .main-nav a.active { background: var(--app-nav-hover); }
    .main-nav a.active::after { right: auto; bottom: 9px; left: 0; width: 3px; height: 28px; border-radius: 3px; }
    .main-nav a .header-icon { width: 18px; height: 18px; }
    .system-status { margin-top: 12px; padding: 17px 14px 0; border-top: 1px solid var(--header-line); }
    .status-dot { margin-top: -12px; }
    .dashboard-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-workspace { grid-template-columns: 1fr; }
}

@media (max-width: 580px) {
    .header-top { min-height: 64px; }
    .profile-copy, .header-divider { display: none; }
    .header-actions { gap: 7px; }
    .profile-button > .header-icon { margin-left: 0; }
    .app-content { padding-top: 30px; }
}

@media (max-width: 430px) {
    .header-top { padding-right: 12px; padding-left: 12px; }
    .brand { gap: 7px; }
    .brand-logo { width: 32px; height: 32px; }
    .brand-name { font-size: 17px; }
    .header-actions { gap: 3px; }
    .header-actions .icon-button, .theme-toggle.rz-button { width: 32px; height: 32px; min-width: 32px; }
    .profile-button { gap: 2px; padding: 2px; }
    .profile-avatar { width: 28px; height: 28px; }
}

.profile-action,
.profile-logout {
    width: 100%;
    padding: 7px 0;
    background: transparent;
    border: 0;
    text-align: left;
    cursor: pointer;
}

.profile-action { color: inherit; }
.profile-logout { color: #d3424f; }

.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    background: #fff;
}

.login-form-column {
    min-width: 0;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: clamp(32px, 4vw, 72px);
    background: #fff;
    box-shadow: 12px 0 38px rgba(4, 63, 37, .14);
    z-index: 1;
}

.login-visual {
    min-width: 0;
    min-height: 100vh;
    background:
        linear-gradient(110deg, rgba(4, 63, 37, .16), rgba(4, 63, 37, 0) 48%),
        url("../images/background_login.png") center center / cover no-repeat;
}

.login-panel {
    width: 100%;
    max-width: 420px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 36px; font-size: 20px; font-weight: 800; }
.login-brand img { width: 44px; height: 44px; object-fit: contain; border-radius: 50%; }
.login-copy h1 { margin: 0; font-size: 34px; letter-spacing: -.045em; }
.login-copy > p:last-child { margin: 10px 0 28px; color: #687892; line-height: 1.55; }
.login-fields { display: grid; gap: 10px; }
.login-fields > label:not(.login-remember) { margin-top: 7px; font-size: 13px; font-weight: 700; }
.login-remember { display: flex; align-items: center; gap: 9px; margin: 8px 0; color: #52637c; font-size: 13px; }
.login-submit.rz-button { width: 100%; margin-top: 8px; color: #fff !important; background: var(--brand-primary) !important; border-color: var(--brand-primary) !important; }
.login-submit.rz-button:hover { background: var(--brand-primary-dark) !important; border-color: var(--brand-primary-dark) !important; }
.login-error { padding: 11px 13px; border: 1px solid #f2c5ca; border-radius: 9px; background: #fff3f4; color: #9f2531; font-size: 13px; }

.security-page { display: grid; gap: 24px; }
.security-page__header { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.security-toolbar { display: flex; justify-content: flex-start; padding: 18px; border: 1px solid var(--app-border-soft); border-radius: 14px; background: var(--app-surface); }
.security-toolbar .rz-textbox { width: min(420px, 100%); }
.security-badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; background: var(--app-nav-hover); color: var(--header-blue); font-size: 11px; font-weight: 700; }
.security-list-card { overflow: hidden; border: 1px solid var(--app-border-soft); border-radius: 18px; background: var(--app-surface); box-shadow: var(--app-panel-shadow); }
.security-list-toolbar { min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 18px 22px; border-bottom: 1px solid var(--app-border-soft); }
.security-list-summary { min-width: 0; display: flex; align-items: center; gap: 12px; }
.security-list-summary__icon { width: 42px; height: 42px; display: grid; place-items: center; flex: none; border-radius: 12px; background: var(--app-nav-hover); color: var(--header-blue); }
.security-list-summary__icon .rzi { font-size: 21px; }
.security-list-summary__copy { min-width: 0; display: grid; gap: 3px; }
.security-list-summary__copy strong { font-size: 14px; }
.security-list-summary__copy small { color: var(--header-muted); font-size: 12px; }
.security-list-search { position: relative; width: min(390px, 100%); }
.security-list-search > .rzi { position: absolute; top: 50%; left: 14px; z-index: 1; color: var(--header-muted); font-size: 19px; transform: translateY(-50%); pointer-events: none; }
.security-list-search .rz-textbox { width: 100%; min-height: 44px; padding-left: 43px; border-color: var(--app-border-soft); border-radius: 11px; background: var(--app-surface-muted); }
.security-list-search .rz-textbox:focus { border-color: var(--header-blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--header-blue) 12%, transparent); }
.security-grid.rz-data-grid { border: 0; border-radius: 0; background: transparent; }
.security-grid .rz-grid-table thead th { height: 48px; padding: 0 22px; border-bottom: 1px solid var(--app-border-soft); background: var(--app-surface-muted); color: var(--header-muted); font-size: 11px; font-weight: 750; letter-spacing: .065em; text-transform: uppercase; }
.security-grid .rz-grid-table tbody td { padding: 16px 22px; border-bottom: 1px solid var(--app-border-soft); background: var(--app-surface); vertical-align: middle; }
.security-grid .rz-grid-table tbody tr:last-child td { border-bottom: 0; }
.security-grid .rz-grid-table tbody tr:hover td { background: color-mix(in srgb, var(--app-nav-hover) 42%, var(--app-surface)); }
.user-identity { min-width: 0; display: flex; align-items: center; gap: 13px; }
.user-avatar { width: 38px; height: 38px; display: grid; place-items: center; flex: none; border: 1px solid color-mix(in srgb, var(--header-blue) 18%, var(--app-border-soft)); border-radius: 11px; background: color-mix(in srgb, var(--header-blue) 9%, var(--app-surface)); color: var(--header-blue); font-size: 12px; font-weight: 800; letter-spacing: .02em; }
.user-identity__copy { min-width: 0; display: grid; gap: 3px; }
.user-identity__copy strong { overflow: hidden; color: var(--header-ink); font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.user-identity__copy small { overflow: hidden; color: var(--header-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.user-role-badge { width: fit-content; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid color-mix(in srgb, var(--header-blue) 16%, var(--app-border-soft)); border-radius: 999px; background: color-mix(in srgb, var(--header-blue) 8%, var(--app-surface)); color: var(--header-blue); font-size: 11px; font-weight: 700; }
.user-role-badge .rzi { font-size: 14px; }
.user-created-at { display: grid; gap: 2px; }
.user-created-at strong { font-size: 12px; font-weight: 650; }
.user-created-at small { color: var(--header-muted); font-size: 11px; }
.user-created-mobile { display: none; color: var(--header-muted); font-size: 10px; }
.user-row-actions { display: flex; justify-content: flex-end; gap: 4px; }
.user-row-action.rz-button { width: 34px; height: 34px; min-width: 34px; padding: 0; border-radius: 9px; }
.user-row-action.rz-button:hover { background: var(--app-hover); }
.role-identity { min-width: 0; display: flex; align-items: center; gap: 13px; }
.role-avatar { width: 38px; height: 38px; display: grid; place-items: center; flex: none; border: 1px solid var(--app-border-soft); border-radius: 11px; }
.role-avatar .rzi { font-size: 19px; }
.role-avatar.is-system { border-color: color-mix(in srgb, var(--header-blue) 18%, var(--app-border-soft)); background: color-mix(in srgb, var(--header-blue) 9%, var(--app-surface)); color: var(--header-blue); }
.role-avatar.is-custom { border-color: color-mix(in srgb, #08a574 20%, var(--app-border-soft)); background: color-mix(in srgb, #08a574 9%, var(--app-surface)); color: #07845e; }
.role-identity__copy { min-width: 0; display: grid; gap: 3px; }
.role-identity__copy strong { overflow: hidden; color: var(--header-ink); font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.role-identity__copy small { overflow: hidden; color: var(--header-muted); font-size: 11px; font-weight: 650; letter-spacing: .045em; text-overflow: ellipsis; white-space: nowrap; }
.role-type-badge { width: fit-content; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--app-border-soft); border-radius: 999px; font-size: 11px; font-weight: 700; }
.role-type-badge .rzi { font-size: 14px; }
.role-type-badge.is-system { border-color: color-mix(in srgb, var(--header-blue) 16%, var(--app-border-soft)); background: color-mix(in srgb, var(--header-blue) 8%, var(--app-surface)); color: var(--header-blue); }
.role-type-badge.is-custom { border-color: color-mix(in srgb, #08a574 20%, var(--app-border-soft)); background: color-mix(in srgb, #08a574 8%, var(--app-surface)); color: #07845e; }
.role-type-mobile { display: none; color: var(--header-muted); font-size: 10px; font-weight: 400; letter-spacing: 0; }
.role-row-actions { display: flex; justify-content: flex-end; gap: 4px; }
.role-row-action.rz-button { width: 34px; height: 34px; min-width: 34px; padding: 0; border-radius: 9px; }
.role-row-action.rz-button:hover { background: var(--app-hover); }
.security-form { display: grid; gap: 10px; }
.security-form > label { margin-top: 5px; font-size: 13px; font-weight: 700; }
.security-form__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.permission-list { margin: 14px 0 0; padding: 16px; border: 1px solid var(--app-border-soft); border-radius: 12px; }
.permission-list legend { padding: 0 7px; font-weight: 750; }
.permission-list > p { margin: 0 0 12px; color: var(--header-muted); font-size: 12px; }
.permission-list__toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 9px; padding-bottom: 12px; border-bottom: 1px solid var(--app-border-soft); }
.permission-select-all { display: inline-flex; align-items: center; gap: 8px; flex: none; color: var(--header-ink); font-size: 12px; font-weight: 700; cursor: pointer; }
.permission-select-all:has(input:disabled) { color: var(--header-muted); cursor: default; }
.permission-search { position: relative; width: min(280px, 100%); }
.permission-search > .rzi { position: absolute; top: 50%; left: 11px; color: var(--header-muted); font-size: 17px; transform: translateY(-50%); pointer-events: none; }
.permission-search input { width: 100%; min-height: 36px; padding: 7px 11px 7px 35px; border: 1px solid var(--app-border-soft); border-radius: 9px; outline: none; background: var(--app-surface-muted); color: var(--header-ink); font: inherit; font-size: 12px; }
.permission-search input:focus { border-color: var(--header-blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--header-blue) 12%, transparent); }
.permission-options { max-height: 230px; overflow: auto; padding-right: 4px; }
.permission-option { display: flex; align-items: center; gap: 9px; padding: 7px 4px; font-size: 13px; cursor: pointer; }
.permission-option > span { flex: 1; }
.permission-option.is-inherited { color: var(--header-muted); cursor: default; }
.permission-option.is-inherited input { cursor: not-allowed; accent-color: var(--header-blue); }
.permission-inherited { padding: 3px 7px; border-radius: 999px; background: var(--header-blue-soft); color: var(--header-blue); font-size: 10px; font-weight: 750; white-space: nowrap; }
.permission-empty { padding: 28px 12px; color: var(--header-muted); font-size: 12px; text-align: center; }
.access-denied { padding: 30px; border: 1px solid var(--app-border-soft); border-radius: 16px; background: var(--app-surface); }

@media (max-width: 700px) {
    .security-page__header { align-items: stretch; flex-direction: column; }
    .security-page__header .rz-button { width: 100%; }
    .security-list-toolbar { align-items: stretch; flex-direction: column; gap: 15px; padding: 17px; }
    .security-list-search { width: 100%; }
    .security-grid .rz-grid-table thead th,
    .security-grid .rz-grid-table tbody td { padding-right: 14px; padding-left: 14px; }
    .users-grid .rz-grid-table thead th:nth-child(3),
    .users-grid .rz-grid-table tbody td:nth-child(3) { display: none; }
    .user-created-mobile { display: block; }
    .roles-grid .rz-grid-table thead th:nth-child(2),
    .roles-grid .rz-grid-table tbody td:nth-child(2) { display: none; }
    .role-type-mobile { display: block; }
    .permission-list__toolbar { align-items: stretch; flex-direction: column; }
    .permission-search { width: 100%; }
    .dashboard-hero { align-items: stretch; flex-direction: column; }
    .dashboard-system-status { min-width: 0; }
    .dashboard-metrics { grid-template-columns: 1fr; }
    .dashboard-session { grid-template-columns: 38px minmax(0, 1fr) 18px; }
    .dashboard-session__status, .dashboard-session time { display: none; }
    .login-shell {
        grid-template-columns: 1fr;
        background:
            linear-gradient(rgba(3, 52, 30, .52), rgba(3, 52, 30, .52)),
            url("../images/background_login.png") 64% center / cover no-repeat;
    }
    .login-form-column { padding: 24px; background: rgba(255, 255, 255, .94); box-shadow: none; }
    .login-visual { display: none; }
}
