:root {
    --navy: #123746;
    --navy-dark: #0b2b37;
    --teal: #08718b;
    --teal-dark: #07566d;
    --cyan: #15a7bd;
    --blue-soft: #e6f4f7;
    --bg: #f3f6f8;
    --surface: #ffffff;
    --border: #dce5e9;
    --text: #17252d;
    --muted: #687b84;
    --green: #16845b;
    --green-soft: #e5f6ef;
    --red: #c73d4d;
    --red-soft: #fff0f2;
    --amber: #a86b00;
    --amber-soft: #fff6de;
    --primary: #07566d;
    --primary-strong: #06485b;
    --line: #dce5e9;
    --success-soft: #e5f6ef;
    --danger: #c73d4d;
    --danger-soft: #fff0f2;
    --warning: #a86b00;
    --warning-soft: #fff6de;
    --shadow: 0 12px 30px rgba(23, 52, 64, .07);
    --radius: 16px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: flex; }
.sidebar {
    width: 260px;
    flex: 0 0 260px;
    background: linear-gradient(180deg, var(--navy-dark), var(--navy));
    color: #fff;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    position: fixed;
    z-index: 40;
    inset: 0 auto 0 0;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 25px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-accent), var(--primary));
    color: white;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: .5px;
    box-shadow: 0 8px 18px rgba(var(--primary-rgb),.25);
}
.brand-mark.large { width: 54px; height: 54px; border-radius: 15px; font-size: 17px; margin: 0 auto 18px; }
.brand-mark-image { overflow: hidden; background: #fff; }
.brand-mark-image img { width: 100%; height: 100%; object-fit: contain; }
.brand strong { display: block; font-size: 19px; letter-spacing: -.3px; }
.brand span { color: rgba(255,255,255,.6); font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; }
.nav-list { display: grid; gap: 6px; padding: 24px 0; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 45px; padding: 10px 13px; border-radius: 11px; color: rgba(255,255,255,.72); font-weight: 600; transition: .18s ease; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav-item.active { color: #fff; background: rgba(var(--primary-rgb),.28); box-shadow: inset 3px 0 var(--primary-accent); }
.nav-icon { display: grid; place-items: center; width: 24px; height: 24px; font-size: 20px; }
.sidebar-footer { margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.1); }
.user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; min-width: 0; }
.avatar { width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.12); font-weight: 800; }
.user-chip div { min-width: 0; }
.user-chip strong, .user-chip small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip strong { font-size: 13px; }
.user-chip small { color: rgba(255,255,255,.55); font-size: 10px; }

.main-wrap { width: calc(100% - 260px); min-height: 100vh; margin-left: 260px; }
.topbar { height: 84px; padding: 0 32px; display: flex; align-items: center; gap: 18px; background: rgba(255,255,255,.93); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 25; backdrop-filter: blur(12px); }
.topbar h1 { font-size: 20px; line-height: 1.2; margin: 0 0 4px; letter-spacing: -.3px; }
.topbar p { margin: 0; color: var(--muted); font-size: 12px; }
.topbar-status { margin-left: auto; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: 11px; font-weight: 700; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(22,132,91,.12); }
.menu-toggle { display: none; border: 0; background: transparent; font-size: 22px; color: var(--navy); padding: 5px; }
.content { max-width: 1580px; margin: 0 auto; padding: 28px 32px 50px; }
.page-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.eyebrow { display: inline-block; color: var(--teal); text-transform: uppercase; letter-spacing: 1.2px; font-weight: 800; font-size: 10px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.card-header h2 { margin: 0 0 3px; font-size: 16px; letter-spacing: -.2px; }
.card-header p { margin: 0; color: var(--muted); font-size: 11px; }
.text-link { color: var(--teal); font-weight: 700; font-size: 12px; }
.text-link:hover { color: var(--teal-dark); }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; display: flex; align-items: center; gap: 14px; box-shadow: 0 8px 24px rgba(23,52,64,.05); }
.stat-icon { width: 43px; height: 43px; flex: 0 0 43px; display: grid; place-items: center; border-radius: 12px; font-size: 20px; font-weight: 800; }
.stat-icon.blue { color: #246aa5; background: #e9f3fd; }
.stat-icon.cyan { color: var(--teal); background: var(--blue-soft); }
.stat-icon.green { color: var(--green); background: var(--green-soft); }
.stat-icon.red { color: var(--red); background: var(--red-soft); }
.stat-card strong { display: block; font-size: 25px; line-height: 1.1; letter-spacing: -.7px; }
.stat-card span:last-child { color: var(--muted); font-size: 11px; }
.grid-main-side { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(280px, .9fr); gap: 18px; align-items: start; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 18px; text-align: left; border-bottom: 1px solid #edf1f3; vertical-align: middle; }
th { color: var(--muted); background: #f9fbfc; font-size: 10px; text-transform: uppercase; letter-spacing: .6px; white-space: nowrap; }
td { font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdfe; }
.table-title { display: block; font-weight: 700; color: var(--text); }
a.table-title:hover { color: var(--teal); }
td small, .table-title + small { display: block; color: var(--muted); margin-top: 3px; font-size: 10px; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; word-break: break-all; }
.error-cell { max-width: 310px; color: var(--red); }
.target-count { color: var(--teal); font-weight: 700; }
.table-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; white-space: nowrap; }
.table-actions form { display: inline-flex; }
.muted-text { color: var(--muted); }
.inline-search { display: flex; align-items: center; gap: 8px; width: min(100%, 560px); }
.inline-search input {
    width: 100%;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid #ccd9de;
    border-radius: 9px;
    outline: none;
}
.inline-search input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(var(--primary-rgb),.12); }

.badge { display: inline-flex; align-items: center; justify-content: center; padding: 5px 9px; border-radius: 999px; font-size: 9px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; white-space: nowrap; }
.badge-large { padding: 7px 12px; font-size: 10px; }
.badge-forwarded, .badge-sent { color: #087653; background: var(--success-soft); }
.badge-failed { color: var(--danger); background: var(--danger-soft); }
.badge-partial, .badge-pending, .badge-sending { color: var(--warning); background: var(--warning-soft); }
.badge-ignored { color: #697a82; background: #edf1f3; }
.badge-processing { color: #14728d; background: #e4f3f7; }
.role-super_admin { color: #7042a2; background: #f1eafa; }
.role-admin { color: #0b6485; background: #e3f2f8; }
.role-operator { color: #8a5d00; background: #fff3d6; }
.role-viewer { color: #64757d; background: #edf1f3; }

.status-card { padding-bottom: 18px; }
.status-hero { margin: 18px; padding: 20px 15px; text-align: center; border-radius: 13px; background: var(--success-soft); color: #0a7654; }
.status-hero.danger { background: var(--danger-soft); color: var(--danger); }
.status-hero strong, .status-hero small { display: block; }
.status-hero small { margin-top: 4px; opacity: .72; font-size: 10px; word-break: break-all; }
.pulse { display: block; width: 13px; height: 13px; margin: 0 auto 10px; border: 3px solid #fff; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 5px rgba(15,139,97,.14); }
.status-hero.danger .pulse { box-shadow: 0 0 0 5px rgba(198,62,72,.14); }
.detail-list { margin: 0; }
.detail-list > div { display: grid; grid-template-columns: 145px minmax(0, 1fr); gap: 18px; padding: 14px 20px; border-bottom: 1px solid #edf1f3; }
.detail-list dt { color: var(--muted); font-size: 11px; }
.detail-list dd { margin: 0; font-weight: 650; font-size: 12px; word-break: break-word; }
.detail-list dd small { display: block; margin-top: 3px; color: var(--muted); font-weight: 400; }
.detail-list.compact { padding: 0 18px 13px; }
.detail-list.compact > div { grid-template-columns: 1fr auto; padding: 10px 0; }
.mini-error { margin: 0 18px 14px; padding: 10px; border-radius: 9px; background: var(--danger-soft); color: var(--danger); font-size: 10px; }
.status-card > .btn { margin: 0 18px; width: calc(100% - 36px); }

.btn { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border: 1px solid transparent; border-radius: 9px; font-weight: 700; font-size: 11px; transition: .16s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { color: #fff; background: var(--primary); box-shadow: 0 5px 14px rgba(var(--primary-rgb),.22); }
.btn-primary:hover { background: var(--primary-strong); }
.btn-secondary { color: #425861; background: #fff; border-color: #cfdade; }
.btn-secondary:hover { border-color: #99adb5; }
.btn-ghost { color: rgba(255,255,255,.74); background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.1); }
.btn-danger-ghost { color: var(--danger); background: #fff; border-color: #f1c7cb; }
.btn-small { min-height: 30px; padding: 5px 10px; font-size: 10px; }
.btn-lg { min-height: 48px; font-size: 13px; }
.btn-block { width: 100%; }

.alert { margin-bottom: 17px; padding: 12px 15px; border: 1px solid; border-radius: 11px; font-size: 12px; }
.alert ul { margin: 7px 0 0; padding-left: 20px; }
.alert-success { color: #087653; background: var(--success-soft); border-color: #bce6d6; }
.alert-danger { color: #a92d38; background: var(--danger-soft); border-color: #f2c7cb; }

.rule-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.rule-card { min-width: 0; padding: 19px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.rule-card.inactive { opacity: .72; box-shadow: none; }
.rule-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.rule-card h2 { margin: 3px 0 8px; font-size: 16px; }
.rule-card > p { color: var(--muted); font-size: 11px; min-height: 34px; margin: 0 0 14px; }
.priority { color: var(--teal); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .7px; }
.switch { width: 40px; height: 22px; border: 0; padding: 3px; border-radius: 99px; background: #cbd5da; }
.switch span { display: block; width: 16px; height: 16px; border-radius: 50%; background: white; transition: .2s ease; box-shadow: 0 2px 5px rgba(0,0,0,.15); }
.switch.on { background: var(--green); }
.switch.on span { transform: translateX(18px); }
.rule-section { padding: 12px 0; border-top: 1px solid #edf1f3; }
.rule-section small, .detail-block small { display: block; color: var(--muted); margin-bottom: 7px; font-size: 9px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; padding: 5px 8px; border-radius: 7px; background: #edf4f6; color: var(--navy); font-size: 10px; font-weight: 650; }
.tag.highlight { color: var(--teal-dark); background: var(--blue-soft); }
.email-target { margin-top: 4px; color: var(--teal); font-size: 11px; font-weight: 700; word-break: break-all; }
.rule-meta { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 12px; color: var(--muted); font-size: 10px; }
.rule-actions { display: flex; gap: 8px; padding-top: 14px; }
.rule-actions .btn { flex: 1; }

.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 17px; }
.form-card { padding-bottom: 21px; }
.form-card > .form-group, .form-card > .two-cols, .form-card > .info-box { margin-left: 22px; margin-right: 22px; }
.span-full { grid-column: 1 / -1; }
.form-group { display: grid; gap: 7px; margin-top: 17px; }
.form-group > span { font-size: 11px; font-weight: 750; }
.form-group b { color: var(--red); }
.form-group small { color: var(--muted); font-size: 10px; }
.form-group input, .form-group select, .form-group textarea, .compact-form input {
    width: 100%;
    color: var(--text);
    background: #fff;
    border: 1px solid #ccd9de;
    border-radius: 10px;
    padding: 11px 12px;
    outline: none;
    transition: .15s ease;
}
.form-group textarea { resize: vertical; min-height: 86px; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus, .compact-form input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(var(--primary-rgb),.12); }
.field-error { color: var(--red) !important; }
.two-cols { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.toggle-group { align-content: start; }
.check-panel { min-height: 43px; display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; color: var(--muted); font-weight: 500 !important; }
.check-panel input, .check-row input { accent-color: var(--teal); }
.info-box { display: flex; gap: 12px; margin-top: 18px; padding: 13px 15px; border-radius: 11px; color: var(--teal-dark); background: var(--blue-soft); font-size: 11px; }
.info-box strong { flex: 0 0 auto; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.form-actions-padded { margin: 18px 22px 0; }
.profile-grid { display: grid; grid-template-columns: minmax(0,.85fr) minmax(0,1.15fr); gap: 18px; align-items: start; }
.profile-summary-card, .profile-security-card { overflow: hidden; }
.profile-banner {
    position: relative;
    height: 112px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--navy-dark), var(--primary) 70%, var(--primary-accent));
}
.profile-banner::before, .profile-banner::after {
    content: "";
    position: absolute;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 50%;
}
.profile-banner::before { width: 210px; height: 210px; right: -66px; top: -102px; }
.profile-banner::after { width: 116px; height: 116px; left: -35px; bottom: -62px; }
.profile-person { position: relative; margin-top: -44px; padding: 0 24px 23px; text-align: center; }
.profile-avatar {
    width: 88px;
    height: 88px;
    display: grid;
    place-items: center;
    margin: 0 auto 13px;
    border: 5px solid #fff;
    border-radius: 26px;
    color: #fff;
    background: linear-gradient(145deg, var(--primary-accent), var(--primary));
    box-shadow: 0 12px 25px rgba(var(--primary-rgb),.24);
    font-size: 29px;
    font-weight: 850;
}
.profile-person h2 { margin: 13px 0 3px; font-size: 20px; letter-spacing: -.45px; }
.profile-person p { margin: 0; color: var(--muted); font-size: 11px; word-break: break-all; }
.profile-meta-list { padding: 8px 22px 18px; border-top: 1px solid var(--border); }
.profile-meta-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #edf1f3; }
.profile-meta-row:last-child { border-bottom: 0; }
.profile-meta-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 10px;
    font-weight: 850;
}
.profile-meta-row div { min-width: 0; }
.profile-meta-row small, .profile-meta-row strong { display: block; }
.profile-meta-row small { margin-bottom: 2px; color: var(--muted); font-size: 9px; }
.profile-meta-row strong { font-size: 11px; word-break: break-word; }
.security-icon {
    min-width: 39px;
    height: 39px;
    display: inline-grid;
    place-items: center;
    padding: 0 9px;
    border-radius: 11px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 10px;
    font-weight: 850;
}
.profile-password-form { padding: 4px 24px 24px; }
.security-note {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    margin-top: 18px;
    padding: 13px 14px;
    border: 1px solid rgba(var(--primary-rgb),.14);
    border-radius: 11px;
    color: var(--primary-strong);
    background: var(--primary-soft);
}
.security-note > span {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: var(--primary);
    font-size: 10px;
    font-weight: 850;
}
.security-note p { margin: 1px 0 0; font-size: 10px; line-height: 1.55; }
.profile-password-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.profile-password-field input { min-height: 46px; padding-right: 62px; }
.password-requirements {
    margin-top: 18px;
    padding: 14px 15px;
    border: 1px dashed #c8d6dc;
    border-radius: 11px;
    background: #f9fbfc;
}
.password-requirements > strong { display: block; margin-bottom: 9px; font-size: 10px; }
.password-requirements > div { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px 12px; }
.password-requirements span { color: var(--muted); font-size: 9px; }
.profile-form-actions { display: flex; justify-content: flex-end; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }
.profile-form-actions .btn { min-width: 176px; }
.profile-sso-state { display: flex; align-items: flex-start; gap: 14px; margin: 22px 24px 24px; padding: 18px; border: 1px solid var(--border); border-radius: 12px; background: #f9fbfc; }
.profile-sso-state strong { display: block; margin-bottom: 4px; font-size: 12px; }
.profile-sso-state p { margin: 0; color: var(--muted); font-size: 10px; }

.filter-card { padding: 0 18px 18px; margin-bottom: 17px; }
.filter-grid { display: grid; grid-template-columns: minmax(240px,2fr) repeat(3,minmax(130px,1fr)) auto; gap: 12px; align-items: end; }
.filter-actions { display: flex; flex-wrap: wrap; gap: 7px; padding-bottom: 1px; }
.detail-grid { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(300px,.6fr); gap: 17px; margin-bottom: 17px; }
.detail-block { padding: 18px 20px 0; }
.error-panel { display: grid; gap: 5px; margin: 18px 20px; padding: 13px; color: var(--red); background: var(--red-soft); border-radius: 10px; font-size: 10px; word-break: break-word; }

.settings-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 17px; margin-bottom: 17px; }
.settings-source {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 17px;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: #fff;
}
.settings-source strong, .settings-source span { display: block; }
.settings-source strong { font-size: 12px; }
.settings-source div > span { margin-top: 2px; color: var(--muted); font-size: 10px; }
.settings-section { margin-bottom: 17px; }
.settings-form { padding: 0 22px 22px; }
.settings-form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 14px; }
.connection-config-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; margin-top: 18px; }
.settings-fieldset { min-width: 0; margin: 0; padding: 0 16px 18px; border: 1px solid var(--border); border-radius: 13px; }
.settings-fieldset legend { padding: 0 8px; color: var(--navy); font-size: 12px; font-weight: 800; }
.color-input { display: flex; align-items: center; gap: 10px; }
.color-input input[type="color"] { width: 52px; height: 43px; flex: 0 0 52px; padding: 4px; }
.color-input code { color: var(--teal); background: var(--blue-soft); border-radius: 7px; padding: 7px 9px; font-size: 10px; }
.branding-preview { display: flex; align-items: center; gap: 11px; margin-top: 5px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #f9fbfc; }
.branding-preview-image { flex: 0 0 auto; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--border); border-radius: 9px; background: #fff; }
.branding-preview-image.logo { width: 52px; height: 52px; }
.branding-preview-image.favicon { width: 42px; height: 42px; }
.branding-preview-image img { width: 100%; height: 100%; object-fit: contain; }
.branding-preview > span:last-child { min-width: 0; }
.branding-preview strong, .branding-preview small { display: block; }
.branding-preview strong { color: var(--text); font-size: 10px; }
.branding-preview small { margin-top: 2px; }
.compact-check { margin: 2px 0 0; }
.settings-error-hint { margin: 15px 0 0; color: var(--danger); font-size: 10px; }
.setting-card { display: flex; gap: 16px; padding: 20px; }
.setting-icon { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; border-radius: 12px; font-weight: 850; font-size: 12px; }
.setting-icon.blue { color: #246aa5; background: #e9f3fd; }
.setting-icon.green { color: var(--green); background: var(--green-soft); }
.setting-icon.cyan { color: var(--teal); background: var(--blue-soft); }
.setting-icon.amber { color: var(--amber); background: var(--amber-soft); }
.setting-content { min-width: 0; flex: 1; }
.setting-content h2 { margin: 1px 0 4px; font-size: 15px; }
.setting-content > p { margin: 0 0 12px; color: var(--muted); font-size: 10px; }
.mini-list { margin: 0 0 13px; }
.mini-list div { display: flex; justify-content: space-between; gap: 15px; padding: 6px 0; border-bottom: 1px solid #edf1f3; font-size: 10px; }
.mini-list dt { color: var(--muted); }
.mini-list dd { margin: 0; font-weight: 650; text-align: right; word-break: break-all; }
.compact-form { display: grid; gap: 8px; }
.compact-form input { padding: 9px 10px; font-size: 11px; }
.activity-list { padding: 5px 20px 12px; }
.activity-item { display: grid; grid-template-columns: 10px minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 12px 0; border-bottom: 1px solid #edf1f3; }
.activity-item:last-child { border: 0; }
.activity-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); }
.activity-item strong, .activity-item small { display: block; }
.activity-item strong { font-size: 11px; }
.activity-item small { color: var(--muted); margin-top: 3px; font-size: 9px; }
.activity-item code { color: var(--teal); background: var(--blue-soft); border-radius: 6px; padding: 4px 6px; font-size: 9px; }

.data-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 18px;
    border-top: 1px solid var(--border);
    background: linear-gradient(180deg, #fbfdfe, #f7fafb);
    border-radius: 0 0 var(--radius) var(--radius);
}
.data-pagination.standalone {
    margin-top: 18px;
    border: 1px solid var(--border);
    border-radius: 13px;
    box-shadow: 0 8px 22px rgba(23,52,64,.05);
}
.data-pagination-info { display: flex; align-items: center; gap: 18px; color: var(--muted); font-size: 11px; }
.data-pagination-info > span strong { color: var(--text); font-size: 13px; }
.per-page-form, .per-page-form label { display: flex; align-items: center; gap: 8px; }
.per-page-form label > span { white-space: nowrap; }
.per-page-form select {
    height: 34px;
    min-width: 66px;
    padding: 0 28px 0 10px;
    border: 1px solid #cbd8dd;
    border-radius: 8px;
    color: var(--navy);
    background: #fff;
    font-size: 11px;
    font-weight: 750;
    outline: none;
}
.per-page-form select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(var(--primary-rgb),.12); }
.data-pagination-nav { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.pagination-button {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 11px;
    border: 1px solid #cbd8dd;
    border-radius: 8px;
    color: var(--teal-dark);
    background: #fff;
    font-size: 10px;
    font-weight: 750;
    transition: .16s ease;
}
a.pagination-button:hover { color: #fff; background: var(--teal); border-color: var(--teal); transform: translateY(-1px); }
.pagination-button.disabled { color: #9aabb2; background: #f2f5f6; border-color: #e0e7ea; cursor: not-allowed; }
.pagination-current { min-width: 92px; color: var(--muted); text-align: center; font-size: 10px; }
.pagination-current strong { color: var(--text); font-size: 12px; }

.auth-page { background: #eef3f5; }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(460px,1.1fr) minmax(400px,.9fr); }
.auth-visual { position: relative; overflow: hidden; color: white; background: linear-gradient(145deg, var(--navy-dark), var(--navy) 65%, var(--primary)); padding: 42px 7vw; display: flex; flex-direction: column; }
.auth-visual::before, .auth-visual::after { content: ""; position: absolute; border: 1px solid rgba(255,255,255,.1); border-radius: 50%; }
.auth-visual::before { width: 520px; height: 520px; right: -230px; top: -140px; }
.auth-visual::after { width: 350px; height: 350px; left: -180px; bottom: -130px; }
.auth-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; }
.auth-brand span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--cyan); font-size: 12px; }
.auth-brand .auth-logo { overflow: hidden; background: #fff; }
.auth-logo img { width: 100%; height: 100%; object-fit: contain; }
.auth-copy { position: relative; z-index: 1; margin: auto 0; max-width: 660px; }
.auth-copy .eyebrow { color: var(--primary-accent); }
.auth-copy h1 { margin: 13px 0 18px; font-size: clamp(38px,4vw,64px); line-height: 1.08; letter-spacing: -2.3px; }
.auth-copy p { max-width: 550px; color: rgba(255,255,255,.68); font-size: 15px; line-height: 1.7; }
.auth-flow { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: rgba(255,255,255,.7); font-size: 10px; }
.auth-flow span { padding: 8px 10px; border: 1px solid rgba(255,255,255,.16); border-radius: 8px; background: rgba(255,255,255,.06); }
.auth-flow i { color: var(--primary-accent); font-style: normal; }
.auth-form-wrap { display: grid; place-items: center; padding: 35px; background: white; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card-head { margin-bottom: 26px; text-align: center; }
.auth-card-head h2 { margin: 0 0 6px; font-size: 25px; letter-spacing: -.7px; }
.auth-card-head p { margin: 0; color: var(--muted); font-size: 12px; }
.password-field { position: relative; }
.password-field input { padding-right: 60px; }
.password-toggle { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); border: 0; background: transparent; color: var(--teal); font-size: 10px; font-weight: 750; }
.check-row { display: flex; align-items: center; gap: 8px; margin: 16px 0 20px; color: var(--muted); font-size: 11px; }
.auth-note { color: var(--muted); text-align: center; font-size: 9px; margin: 15px 0 0; }
.sidebar-backdrop { display: none; }

@media (max-width: 1180px) {
    .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .rule-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .filter-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .search-field { grid-column: 1 / -1; }
    .connection-config-grid { grid-template-columns: 1fr; }
}
@media (max-width: 880px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop { position: fixed; z-index: 35; inset: 0; background: rgba(5, 25, 33, .52); }
    .sidebar-backdrop.show { display: block; }
    .main-wrap { width: 100%; margin-left: 0; }
    .menu-toggle { display: inline-grid; place-items: center; }
    .content { padding: 24px 20px 42px; }
    .topbar { padding: 0 20px; }
    .grid-main-side, .detail-grid, .profile-grid { grid-template-columns: 1fr; }
    .auth-shell { grid-template-columns: 1fr; }
    .auth-visual { display: none; }
}

@media (max-width: 680px) {
    .topbar { height: 72px; }
    .topbar-status { display: none; }
    .topbar h1 { font-size: 16px; }
    .stats-grid, .rule-grid, .settings-grid, .form-grid, .two-cols, .settings-form-grid { grid-template-columns: 1fr; }
    .span-full { grid-column: auto; }
    .stat-card { min-height: 90px; }
    .filter-grid { grid-template-columns: 1fr; }
    .filter-grid .search-field, .filter-actions { grid-column: auto; }
    .form-actions .btn { flex: 1; }
    .detail-list > div { grid-template-columns: 1fr; gap: 4px; }
    .setting-card { padding: 16px; }
    .auth-form-wrap { padding: 18px; }
    .auth-card { padding: 25px 20px; }
    .activity-item { grid-template-columns: 9px 1fr; }
    .activity-item code { display: none; }
    .data-pagination { align-items: stretch; flex-direction: column; gap: 12px; }
    .data-pagination-info { justify-content: space-between; }
    .data-pagination-nav { justify-content: space-between; }
    .pagination-button { flex: 1; }
    .page-actions, .settings-source { align-items: stretch; flex-direction: column; }
    .inline-search { width: 100%; flex-wrap: wrap; }
    .inline-search input { flex: 1 0 100%; }
    .table-actions { justify-content: flex-start; }
    .profile-password-form { padding: 3px 18px 20px; }
    .profile-password-grid, .password-requirements > div { grid-template-columns: 1fr; }
    .profile-form-actions .btn { width: 100%; }
    .profile-sso-state { margin: 18px; }
}
