:root {
    --sidebar-width: 248px;
    --color-navy: #0d1117;
    --color-navy-mid: #141828;
    --color-accent: #6366f1;
    --color-accent-end: #7c6cf0;
    --color-sidebar-accent: #6366f1;
    --color-sidebar-accent-end: #7c6cf0;
    --color-success: #16a05d;
    --color-warning: #f59e0b;
    --color-danger: #dc3545;
    --color-info: #1670d2;
    --color-muted: #6b7280;
    --color-border: #e5e7eb;
    --color-bg: #f9fafb;
    --color-text: #1f2937;
    --color-heading: #111827;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-card: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .04);
    --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.5;
    letter-spacing: -.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6,
.page-heading h1,
.card-header h2,
.brand-text,
.metric-card strong,
.donut-center strong,
.user-name,
.landing-headline {
    font-family: var(--font-sans);
    letter-spacing: -.02em;
}

button, input, select, textarea {
    font-family: inherit;
}

code, kbd, pre, samp,
.mono,
.table.audit-table code,
.api-note code,
.database-note code,
.secure-confirmation code,
.erp-url-field input,
.erp-url-field textarea,
.notification-templates-card .erp-url-field textarea,
.settings-panel .erp-url-field textarea,
.data-browser-card td code,
.vendor-code,
.table td code {
    font-family: var(--font-mono);
    font-feature-settings: "liga" 0;
    letter-spacing: 0;
    font-size: 0.92em;
}
code {
    background: #f1f5f9;
    color: #4338ca;
    padding: 1px 5px;
    border-radius: 4px;
}

[data-lucide],
.lucide {
    width: 1em;
    height: 1em;
    stroke-width: 1.75;
    flex-shrink: 0;
}

/* Shared page/process loading overlay */
.page-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    background: rgba(247, 248, 251, .72);
    -webkit-backdrop-filter: blur(1px);
    backdrop-filter: blur(1px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .18s ease, visibility 0s linear .18s;
}
.page-loading-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
    transition: opacity .18s ease;
}
.page-loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 88px;
    min-height: 48px;
    padding: 12px 17px;
    border: 1px solid rgba(255, 255, 255, .8);
    border-radius: 999px;
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 12px 35px rgba(15, 23, 42, .16);
}
.loading-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    animation: loading-dot-wave 1.05s ease-in-out infinite;
    will-change: transform, opacity;
}
.loading-dot-red { background: #ef4444; animation-delay: 0s; }
.loading-dot-yellow { background: #f59e0b; animation-delay: .13s; }
.loading-dot-green { background: #20a464; animation-delay: .26s; }
.loading-dot-blue { background: #3b66e5; animation-delay: .39s; }
@keyframes loading-dot-wave {
    0%, 55%, 100% { transform: translateY(0) scale(.82); opacity: .48; }
    25% { transform: translateY(-7px) scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .loading-dot { animation: loading-dot-fade 1.2s linear infinite; }
    @keyframes loading-dot-fade { 0%, 100% { opacity: .4; } 50% { opacity: 1; } }
}

.audit-log-card { min-width: 0; max-width: 100%; overflow: hidden; }
.audit-table-wrap { width: 100%; max-width: 100%; overflow-x: auto; }
.table.audit-table { table-layout: fixed; width: 100%; max-width: 100%; }
.table.audit-table th:nth-child(1) { width: 15%; }
.table.audit-table th:nth-child(2) { width: 19%; }
.table.audit-table th:nth-child(3) { width: 38%; }
.table.audit-table th:nth-child(4) { width: 16%; }
.table.audit-table th:nth-child(5) { width: 12%; }
.table.audit-table th,
.table.audit-table td,
.table.audit-table td.audit-description {
    min-width: 0;
    max-width: 100%;
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.45;
    vertical-align: top;
}
.table.audit-table code {
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.app-shell { display: flex; min-height: 100vh; width: 100%; min-width: 0; }

.sidebar {
    width: var(--sidebar-width);
    background:
        radial-gradient(120% 60% at 0% 0%, rgba(109, 99, 239, .22), transparent 55%),
        radial-gradient(90% 50% at 100% 100%, rgba(47, 87, 242, .16), transparent 50%),
        linear-gradient(180deg, var(--color-navy-mid) 0%, var(--color-navy) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid rgba(255, 255, 255, .06);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, .04);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .18) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .18); border-radius: 999px; }
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 18px;
    font-weight: 700;
    min-height: 72px;
}
.brand-mark {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 15px;
    line-height: 1;
    letter-spacing: -.4px;
    color: #fff;
    background: linear-gradient(145deg, var(--color-sidebar-accent), var(--color-sidebar-accent-end));
    box-shadow:
        0 8px 20px rgba(99, 102, 241, .35),
        inset 0 1px 0 rgba(255, 255, 255, .28);
}
.brand-divider {
    height: 28px;
    width: 1px;
    background: linear-gradient(180deg, transparent, rgba(255, 255, 255, .35), transparent);
}
.brand-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 2px;
}
.brand-text {
    font-size: 14px;
    line-height: 1.2;
    letter-spacing: -.01em;
    font-weight: 700;
    color: #f4f6fb;
}
.brand-subtitle {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #9eabc6;
}
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 6px;
    padding: 0 12px;
    flex: 1;
}
.nav-item {
    position: relative;
    color: #c5cde0;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: .1px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition:
        background .18s ease,
        color .18s ease,
        box-shadow .18s ease,
        transform .18s ease;
}
.nav-item:hover {
    background: rgba(255, 255, 255, .07);
    color: #fff;
    transform: translateX(2px);
}
.nav-item:hover .nav-icon {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}
.nav-item.active {
    background: linear-gradient(135deg, var(--color-sidebar-accent), var(--color-sidebar-accent-end));
    color: #fff;
    box-shadow:
        0 8px 22px rgba(91, 92, 224, .38),
        inset 0 1px 0 rgba(255, 255, 255, .2),
        inset 3px 0 0 #c4c6ff;
}
.nav-item.active .nav-icon {
    background: rgba(255, 255, 255, .16);
    color: #fff;
}
.nav-item.disabled { opacity: 0.4; pointer-events: none; }
.nav-icon {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
    color: #9eabc6;
    background: rgba(255, 255, 255, .04);
    transition: background .18s ease, color .18s ease;
}
.nav-icon svg,
.nav-icon i {
    width: 16px;
    height: 16px;
    stroke-width: 1.75;
}
.nav-label {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-help {
    margin: 16px 14px 18px;
    padding: 14px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}
.help-copy {
    display: flex;
    flex-direction: column;
    font-size: 12.5px;
    min-width: 0;
}
.help-copy strong { color: #f1f4fb; font-weight: 600; }
.sidebar-help small { color: #9eabc6; font-size: 10.5px; margin-top: 2px; }
.help-icon {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #c5cde0;
    background: rgba(255, 255, 255, .06);
}
.help-icon svg {
    width: 16px;
    height: 16px;
    stroke-width: 1.75;
}
.app-shell.sidebar-collapsed .sidebar { width: 76px; }
.app-shell.sidebar-collapsed .brand-divider,
.app-shell.sidebar-collapsed .brand-copy,
.app-shell.sidebar-collapsed .brand-text,
.app-shell.sidebar-collapsed .nav-label,
.app-shell.sidebar-collapsed .sidebar-help { display: none; }
.app-shell.sidebar-collapsed .sidebar-brand { justify-content: center; padding-inline: 12px; }
.app-shell.sidebar-collapsed .sidebar-nav { padding-inline: 10px; align-items: stretch; }
.app-shell.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 10px;
    gap: 0;
}
.app-shell.sidebar-collapsed .nav-item:hover { transform: none; }
.app-shell.sidebar-collapsed .nav-item.active {
    box-shadow:
        0 8px 22px rgba(91, 92, 224, .38),
        inset 0 1px 0 rgba(255, 255, 255, .2);
}

@media (prefers-reduced-motion: reduce) {
    .nav-item,
    .nav-icon { transition: none; }
    .nav-item:hover { transform: none; }
}

.main-area { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; width: calc(100% - var(--sidebar-width)); }
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: 64px;
    flex-shrink: 0;
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 20px;
    box-shadow: 0 1px 0 rgba(15, 23, 42, .03);
}
.menu-button {
    border: 0;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    display: grid;
    place-items: center;
}
.menu-button:hover { background: #f1f3f7; color: #172033; }
.menu-button svg { width: 20px; height: 20px; }
.topbar-search {
    flex: 1;
    max-width: 520px;
    position: relative;
    display: flex;
    align-items: center;
}
.topbar-search-icon {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    color: #94a3b8;
    pointer-events: none;
}
.topbar-search input {
    width: 100%;
    height: 40px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: #f8fafc;
    padding: 0 14px 0 38px;
    font: inherit;
    font-size: 13px;
    color: var(--color-heading);
    outline: none;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.topbar-search input:focus {
    background: #fff;
    border-color: #c7d2fe;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .15);
}
.logout-button {
    border: 0;
    background: #dc3545;
    color: #fff;
    cursor: pointer;
    height: 34px;
    border-radius: var(--radius-sm);
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    box-shadow: 0 2px 5px rgba(220, 53, 69, .2);
    transition: background .15s, transform .15s;
}
.logout-button:hover { background: #b92332; transform: translateY(-1px); }
.logout-button svg { width: 15px; height: 15px; }
.logout-label { font-size: 11px; }
.profile-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 0;
    background: transparent;
    padding: 4px 8px 4px 4px;
    margin: 0;
    border-radius: 999px;
    cursor: pointer;
    color: inherit;
    font: inherit;
    text-align: left;
    transition: background .15s ease;
}
.profile-trigger:hover,
.profile-trigger:focus-visible {
    background: #f1f3f7;
    outline: none;
}
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--color-muted); margin-left: auto; }
.notification-link {
    position: relative;
    color: #475569;
    text-decoration: none;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
}
.notification-link:hover { background: #f1f3f7; color: #172033; }
.notification-link svg { width: 18px; height: 18px; }
.notification-dot {
    position: absolute;
    right: 5px;
    top: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e3293b;
    border: 2px solid #fff;
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--color-sidebar-accent), var(--color-sidebar-accent-end));
    color: white;
    font-weight: 700;
    font-size: 13px;
}
.user-meta { display: flex; flex-direction: column; min-width: 105px; }
.user-name { color: #172033; font-size: 12px; }
.user-role { font-size: 10px; }
.btn-link { background: none; border: none; color: var(--color-accent); cursor: pointer; font-size: 14px; padding: 0; }
.inline-form { display: inline; }

.page-content { width: 100%; min-width: 0; max-width: 100%; padding: clamp(14px, 1.45vw, 22px) clamp(14px, 1.6vw, 24px) 28px; overflow-x: clip; }

.messages { margin-bottom: 16px; }
.alert { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 8px; font-size: 13px; }
.alert-success { background: #e6f7f0; color: var(--color-success); }
.alert-error, .alert-danger { background: #fdecec; color: var(--color-danger); }
.alert-warning { background: #fdf3e3; color: var(--color-warning); }
.alert-info { background: #eef2ff; color: var(--color-accent); }

.card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 16px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-card);
    min-width: 0;
    max-width: 100%;
}
.card + .card { margin-top: 16px; }

.table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table th {
    text-align: left;
    padding: 10px 12px;
    color: #475569;
    font-weight: 600;
    border-bottom: 1px solid var(--color-border);
    background: #fafbfc;
    white-space: nowrap;
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--color-border); white-space: nowrap; }
.table tr:hover td { background: #f8faff; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-active, .badge-success { background: #e6f7f0; color: var(--color-success); }
.badge-expiring_soon { background: #fdf3e3; color: var(--color-warning); }
.badge-expired, .badge-failed, .badge-danger { background: #fdecec; color: var(--color-danger); }
.badge-suspended { background: #ecebfd; color: #5b4fd6; }
.badge-awaiting_approval, .badge-pending { background: #eaf0fe; color: var(--color-accent); }
.badge-approved { background: #e6f7f0; color: var(--color-success); }
.badge-rejected { background: #fdecec; color: var(--color-danger); }
.badge-revoked { background: #374151; color: #fff; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; }
.search-box { position: relative; flex: 1; max-width: 360px; }
.search-box .search-field-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    display: grid;
    place-items: center;
    z-index: 1;
    pointer-events: none;
}
.search-box .search-field-icon svg { width: 14px; height: 14px; }
.search-box input {
    width: 100%; padding: 8px 12px 8px 32px; border: 1px solid var(--color-border); border-radius: 8px; font-size: 14px; font-family: inherit;
}
.search-results {
    position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid var(--color-border);
    border-radius: 8px; margin-top: 4px; max-height: 300px; overflow-y: auto; z-index: 20; display: none;
}
.search-results.show { display: block; }
.search-result-item { padding: 10px 12px; cursor: pointer; font-size: 14px; border-bottom: 1px solid var(--color-border); }
.search-result-item:hover { background: var(--color-bg); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    transition: background .15s, border-color .15s, box-shadow .15s, transform .15s;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary {
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-end));
    color: #fff;
    box-shadow: 0 6px 16px rgba(99, 102, 241, .28);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(99, 102, 241, .34); }
.btn-secondary { background: #fff; border: 1px solid var(--color-border); color: #1f2937; }
.btn-secondary:hover { background: #f8fafc; border-color: #c7d2fe; }
.btn-danger { background: var(--color-danger); color: #fff; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #374151; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 9px 12px; border: 1px solid var(--color-border); border-radius: 8px; font-size: 14px;
}
.form-errors { color: var(--color-danger); font-size: 13px; margin-top: 4px; }

.auth-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--color-navy);
}
.auth-card { background: #fff; border-radius: 12px; padding: 40px; width: 380px; }
.auth-card h1 { font-size: 22px; margin-bottom: 4px; }
.auth-card p.subtitle { color: var(--color-muted); font-size: 14px; margin-bottom: 24px; }

.summary-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }

/* Compact dashboard */
.dashboard-toolbar { display:flex; justify-content:flex-end; margin-bottom:14px; }
.page-heading { display:flex;justify-content:space-between;align-items:center;margin-bottom:14px; }
.page-heading h1 { margin:0;color:#111827;font-size:22px;line-height:1.2;letter-spacing:-.3px;font-weight:700; }
.page-heading p { margin:3px 0 0;color:#64748b;font-size:13px; }
.date-chip { border:1px solid #dbe0e8;background:#fff;border-radius:10px;padding:9px 12px;color:#475569;font-size:12px;min-width:190px;display:flex;justify-content:space-between;align-items:center;gap:8px;font-family:inherit; }
.date-filter{position:relative}.date-filter summary{cursor:pointer;list-style:none}.date-filter summary::-webkit-details-marker{display:none}.calendar-icon{color:var(--color-accent);margin-right:4px;display:inline-grid;place-items:center}
.calendar-icon svg{width:14px;height:14px}.date-filter-panel{position:absolute;right:0;top:calc(100% + 7px);z-index:40;width:285px;background:#fff;border:1px solid var(--color-border);border-radius:12px;padding:13px;box-shadow:0 12px 35px rgba(15,23,42,.13);display:grid;grid-template-columns:1fr 1fr;gap:10px}.date-filter-panel label{display:flex;flex-direction:column;gap:5px;color:#64748b;font-size:11px}.date-filter-panel input{min-width:0;width:100%;border:1px solid #dbe0e8;border-radius:8px;padding:7px;font:inherit;color:#172033}.date-filter-panel>div{grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;margin-top:3px}.clear-filter{color:#64748b;font-size:11px;text-decoration:none}.data-source-note{font-size:11px;color:#64748b;background:#eef2f6;border-radius:999px;padding:6px 10px}
.dashboard-summary { grid-template-columns:repeat(5,minmax(0,1fr)); gap:14px; margin-bottom:16px; }
.metric-card { --metric:#2563eb; position:relative;overflow:hidden;min-height:108px;background:#fff;border:1px solid var(--color-border);border-radius:var(--radius-lg);padding:16px;display:flex;align-items:center;gap:14px;box-shadow:var(--shadow-card); }
.metric-card:after { content:"";position:absolute;bottom:0;left:14px;right:14px;height:3px;border-radius:4px 4px 0 0;background:var(--metric); }
.metric-icon { flex:0 0 44px;width:44px;height:44px;border-radius:50%;display:grid;place-items:center;background:color-mix(in srgb,var(--metric) 12%,white);color:var(--metric); }
.metric-icon svg { width:20px;height:20px; }
.metric-card>div:last-child { min-width:0;display:flex;flex-direction:column; }
.metric-card span { color:#64748b;font-size:12px;font-weight:500;white-space:nowrap; }
.metric-card strong { color:#111827;font-size:24px;line-height:1.2;margin:4px 0;white-space:nowrap;font-weight:700;letter-spacing:-.02em; }
.metric-card small { color:var(--metric);font-size:11px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
.metric-success{--metric:#16a05d}.metric-warning{--metric:#f59e0b}.metric-danger{--metric:#dc3545}.metric-purple{--metric:#6366f1}.metric-blue{--metric:#1670d2}.metric-info{--metric:#3b82f6}
.metric-featured {
    --metric: #fff;
    background: linear-gradient(145deg, var(--color-accent) 0%, var(--color-accent-end) 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 12px 28px rgba(99, 102, 241, .28);
}
.metric-featured:after { display: none; }
.metric-featured .metric-icon { background: rgba(255, 255, 255, .18); color: #fff; }
.metric-featured span,
.metric-featured strong,
.metric-featured small { color: #fff; }
.metric-featured small { opacity: .88; }
.metric-card .revenue-value { font-size:20px; }

/* Mockup layout: Activity | Status | (Expiring + Quick search), Payments full width */
.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(280px, 1.4fr) minmax(260px, 1.05fr) minmax(240px, .95fr);
    grid-template-areas:
        "activity status side"
        "payments payments payments";
    gap: 14px;
    align-items: stretch;
}
.dashboard-grid > .card,
.dashboard-side-stack > .card { padding: 0; margin: 0; overflow: hidden; }
.activity-panel { grid-area: activity; }
.status-panel { grid-area: status; }
.dashboard-side-stack {
    grid-area: side;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}
.payments-panel { grid-area: payments; }
.quick-search-panel { position: relative; z-index: 30; overflow: visible !important; }

.card-header { height: 48px; padding: 0 16px; border-bottom: 1px solid var(--color-border); display: flex; align-items: center; justify-content: space-between; }
.card-header h2 { margin: 0; font-size: 14px; font-weight: 600; color: #111827; letter-spacing: -.01em; }
.card-header a { color: #6366f1; text-decoration: none; font-size: 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 2px; }
.card-header a svg { width: 14px; height: 14px; }
.card-body { padding: 14px 16px; }
.card-body.flush { padding: 0; }
.panel-help { font-size: 12px; color: #64748b; margin: 0 0 10px; }

.activity-row { min-height: 58px; padding: 12px 16px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid #edf0f4; }
.activity-status { flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #e8f7ef; color: #16a05d; }
.activity-status svg { width: 15px; height: 15px; }
.activity-status.warning { background: #fff3df; color: #e08b00; }
.activity-status.danger { background: #fde9e9; color: #dc3545; }
.activity-copy { min-width: 0; display: flex; flex-direction: column; }
.activity-copy strong { font-size: 13px; font-weight: 500; color: #1f2937; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-copy small { color: #7b8495; font-size: 11px; margin-top: 3px; }

/* Thick donut matching mockup */
.status-chart-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    min-height: 240px;
    padding: 20px 18px 24px;
}
.css-donut {
    position: relative;
    flex: 0 0 auto;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: conic-gradient(
        #16a05d 0 var(--active-stop),
        #f59e0b var(--active-stop) var(--expiring-stop),
        #dc3545 var(--expiring-stop) var(--expired-stop),
        #3b82f6 var(--expired-stop) 100%
    );
    display: grid;
    place-items: center;
    filter: drop-shadow(0 8px 18px rgba(15, 23, 42, .08));
}
.css-donut:before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .04);
    pointer-events: none;
}
.css-donut:after {
    content: "";
    position: absolute;
    inset: 20%;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, .04);
}
.css-donut.empty { background: #e8ebf0; filter: none; }
.donut-center {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.1;
    text-align: center;
}
.donut-center strong {
    font-size: 30px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -.04em;
}
.donut-center small {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    margin-top: 3px;
    letter-spacing: .01em;
}
.chart-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 140px;
}
.chart-legend li {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
}
.chart-legend i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: block;
}
.chart-legend i.active { background: #16a05d; }
.chart-legend i.expiring { background: #f59e0b; }
.chart-legend i.expired { background: #dc3545; }
.chart-legend i.suspended { background: #3b82f6; }
.chart-legend span {
    font-size: 12.5px;
    color: #475569;
    font-weight: 500;
}
.chart-legend b {
    font-size: 13px;
    color: #0f172a;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
}

.expiry-row { padding: 12px 16px; border-bottom: 1px solid #edf0f4; }
.expiry-title { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.expiry-title strong { font-size: 13px; font-weight: 600; color: #111827; }
.expiry-badge {
    font-size: 11px;
    color: #dd8200;
    background: #fff7e8;
    border: 1px solid #f3d9a4;
    border-radius: 999px;
    padding: 3px 9px;
    font-weight: 600;
    white-space: nowrap;
}
.expiry-row small { display: block; color: #64748b; font-size: 11px; margin-top: 4px; }

.search-box.full { position: relative; max-width: none; }
.search-field-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    display: grid;
    place-items: center;
    z-index: 1;
    pointer-events: none;
}
.search-field-icon svg { width: 14px; height: 14px; }
.search-box.full input { padding-left: 34px; font-size: 13px; }
.quick-search-panel .card-body { position: relative; }
.quick-search-panel .search-results {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    z-index: 100;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .16);
}
.table-scroll { overflow-x: auto; }
.payments-panel tbody tr { cursor: pointer; }
.empty-state { padding: 20px; text-align: center; color: #7b8495; font-size: 13px; }

@media (max-width:1100px) {
    .dashboard-summary { grid-template-columns: repeat(2, 1fr); }
    .metric-featured { grid-column: 1 / -1; }
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "activity status"
            "side side"
            "payments payments";
    }
}
@media (max-width:800px) {
    :root { --sidebar-width: 220px; }
    .dashboard-summary { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "activity"
            "status"
            "side"
            "payments";
    }
    .page-content { padding: 14px; }
    .date-chip { display: none; }
}
@media (max-width:600px) {
    .sidebar { display: none; position: fixed; inset: 0 auto 0 0; z-index: 50; width: min(280px, 86vw); height: 100vh; box-shadow: 12px 0 40px rgba(15, 23, 42, .35); }
    .app-shell.sidebar-open .sidebar { display: flex; }
    .dashboard-summary { grid-template-columns: 1fr; }
    .user-meta { display: none; }
    .page-heading h1 { font-size: 20px; }
}
/* Integrated administration */
.settings-heading{margin-bottom:16px}.admin-option{font-size:10px}.admin-summary{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:12px}.admin-stat{background:#fff;border:1px solid var(--color-border);border-radius:9px;padding:13px;display:flex;flex-direction:column}.admin-stat span{font-size:10px;color:#64748b}.admin-stat strong{font-size:19px;color:#172033;margin:3px 0}.admin-stat small{font-size:9px;color:#8791a2}.admin-stat .status-text{font-size:14px;color:#e08b00}.admin-stat .status-text.online{color:#16a05d}.settings-layout{display:grid;grid-template-columns:1fr 1fr;gap:12px}.settings-layout>.card{padding:0;margin:0;overflow:hidden}.settings-panel{padding:0;margin:0 0 12px;overflow:hidden}.settings-tabs{display:flex;gap:4px;padding:10px 12px 0;border-bottom:1px solid #edf0f4;background:#fafbfe;overflow-x:auto}.settings-tab{appearance:none;border:0;background:transparent;color:#64748b;font:inherit;font-size:11px;font-weight:600;padding:10px 14px;border-radius:8px 8px 0 0;cursor:pointer;white-space:nowrap;border-bottom:2px solid transparent;margin-bottom:-1px}.settings-tab:hover{color:#263247;background:#f1f4f9}.settings-tab.is-active{color:var(--color-accent);background:#fff;border-bottom-color:var(--color-accent)}.settings-tab-panels{min-height:280px}.settings-tab-panel{display:none;padding:4px 0 8px}.settings-tab-panel.is-active{display:block}.settings-panel-intro{padding:16px 14px 6px}.settings-panel-intro h2{margin:0;font-size:14px;color:#172033}.settings-panel-intro p{margin:4px 0 0;font-size:10px;color:#7b8495}.settings-subsection{margin-top:16px;padding-top:12px;border-top:1px solid #edf0f4}.settings-subsection h3{margin:0 0 10px;font-size:12px;color:#263247}.settings-secondary{margin-top:0}.section-icon{color:var(--color-accent);display:inline-grid;place-items:center}
.section-icon svg{width:16px;height:16px}.settings-form{padding:4px 14px}.setting-row{min-height:68px;display:flex;align-items:center;justify-content:space-between;gap:20px;border-bottom:1px solid #edf0f4}.setting-row>div:first-child{display:flex;flex-direction:column}.setting-row label{font-size:11px;font-weight:600;color:#263247}.setting-row small{font-size:9px;color:#7b8495;margin-top:3px}.setting-row>input,.input-suffix{width:150px}.setting-row input[type=text],.setting-row input[type=number]{width:100%;border:1px solid #dbe0e8;border-radius:7px;padding:8px;font-size:11px}.input-suffix{display:flex;align-items:center}.input-suffix input{border-radius:7px 0 0 7px!important}.input-suffix span{padding:8px;background:#f2f4f7;border:1px solid #dbe0e8;border-left:0;border-radius:0 7px 7px 0;font-size:10px;color:#64748b}.switch{position:relative;width:36px;height:20px;flex:0 0 36px}.switch input{position:absolute;opacity:0}.switch i{position:absolute;inset:0;background:#cbd2dc;border-radius:20px;cursor:pointer;transition:.2s}.switch i:after{content:"";position:absolute;width:14px;height:14px;left:3px;top:3px;background:#fff;border-radius:50%;transition:.2s}.switch input:checked+i{background:var(--color-accent)}.switch input:checked+i:after{transform:translateX(16px)}.settings-actions{padding:12px 14px;display:flex;justify-content:flex-end;align-items:center;gap:12px}.settings-actions-bar{justify-content:space-between;border-top:1px solid #edf0f4;background:#fafbfe}.settings-actions-buttons{display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end}.settings-status{margin:0;flex:1;min-width:140px;font-size:10.5px;color:#64748b}.settings-status.is-success{color:#147a49}.settings-status.is-error{color:#b92332}.settings-errors{color:#b92332;font-size:10px;padding:8px 0}.settings-errors ul{margin:3px 0;padding-left:16px}.integration-card,.users-card{min-height:230px}.integration-status{display:flex;gap:10px;padding:15px 0}.integration-status>div{display:flex;flex-direction:column}.integration-status strong{font-size:11px}.integration-status small{font-size:9px;color:#7b8495;margin-top:3px}.status-dot{width:9px;height:9px;flex:0 0 9px;border-radius:50%;background:#e08b00;margin-top:3px}.status-dot.online{background:#16a05d}.api-note{background:#f7f8fb;border:1px solid #edf0f4;border-radius:7px;padding:11px;font-size:9.5px;color:#64748b;line-height:1.5}.api-note code{color:#6366f1}.user-list{padding:0 14px}.user-row{min-height:52px;display:grid;grid-template-columns:30px 1fr auto;align-items:center;gap:9px;border-bottom:1px solid #edf0f4}.user-row .user-avatar{width:28px;height:28px}.user-row>div{display:flex;flex-direction:column;min-width:0}.user-row strong{font-size:10.5px}.user-row small{font-size:9px;color:#7b8495;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.badge-inactive,.badge-locked{background:#fdecec;color:#d64550}
@media(max-width:1000px){.admin-summary{grid-template-columns:repeat(2,1fr)}.settings-layout{grid-template-columns:1fr}}@media(max-width:600px){.admin-summary{grid-template-columns:1fr}.settings-heading .admin-option{display:none}.settings-actions-bar{flex-direction:column;align-items:stretch}.settings-actions-buttons{justify-content:stretch}.settings-actions-buttons .btn{flex:1;justify-content:center}.date-filter-panel{right:-5px;width:270px}.logout-label{display:none}.logout-button{width:32px;justify-content:center;padding:0}}
.notification-filters{display:flex;gap:8px;padding-bottom:12px;flex-wrap:wrap}.notification-filters select{border:1px solid #dbe0e8;border-radius:7px;padding:7px 10px;font-size:10.5px}.notification-message{max-width:430px;white-space:normal!important}
.compact-select{border:1px solid #dbe0e8;border-radius:7px;padding:8px 10px;font-size:10.5px;background:#fff}.clickable-row{cursor:pointer}.clickable-row small{color:#9ca3af}
.license-type-list{padding:0 14px}.license-type-row{min-height:58px;display:flex;align-items:center;justify-content:space-between;gap:12px;border-bottom:1px solid #edf0f4}.license-type-row>div:first-child{display:flex;flex-direction:column;min-width:0}.license-type-row strong{font-size:10.5px}.license-type-row small{font-size:9px;color:#64748b;margin-top:3px}.license-type-actions{display:flex;align-items:center;gap:7px;flex:0 0 auto}.license-edit-layout{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(250px,.7fr);gap:14px;align-items:start}.license-edit-form{padding:0;overflow:hidden}.license-edit-grid{padding:16px}.license-edit-grid .full-width{grid-column:1/-1}.license-edit-grid .admin-field small{line-height:1.45}.license-edit-grid input[type=checkbox]{width:auto}.security-choice{background:#fff8e8;border:1px solid #f3d18b;border-radius:8px;padding:11px}.confirmation-check{display:flex!important;flex-direction:row!important;align-items:center;gap:8px}.security-field{background:#fff4f4;border:1px solid #f1c4c4;border-radius:8px;padding:11px}.secure-confirmation{margin:0 16px 4px;padding:12px;border-left:4px solid #dc3545;background:#fff4f4;color:#53252a;font-size:10px}.secure-confirmation p{margin:4px 0 0;line-height:1.5}.secure-confirmation code{font-weight:700;color:#b92332}.license-edit-form .settings-actions{gap:8px}.impact-card{padding:0;overflow:hidden}.impact-content{padding:14px}.impact-content>div{display:flex;align-items:center;justify-content:space-between;background:#eef2ff;border-radius:8px;padding:11px}.impact-content span{font-size:10px;color:#64748b}.impact-content strong{font-size:20px;color:#6366f1}.impact-content ul{padding-left:18px;margin:13px 0 0;color:#475569;font-size:10px;line-height:1.55}.field-error{color:#b92332;font-size:9px;margin-top:3px}@media(max-width:800px){.license-edit-layout{grid-template-columns:1fr}.license-type-row{align-items:flex-start;padding:10px 0;flex-direction:column}.license-type-actions{width:100%;justify-content:space-between}}

/* Dashboard spacing stays readable to match design mockup — no ultra-dense overrides */
.dashboard-page .table { font-size: 12px; }
.dashboard-page .table th,
.dashboard-page .table td { padding: 10px 12px; }
.dashboard-page .badge { padding: 3px 9px; font-size: 11px; }
.table-action{padding:6px 10px;font-size:10px;white-space:nowrap}.reason-cell{max-width:240px;white-space:normal!important;color:#64748b}.admin-form-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;padding:14px}.admin-field{display:flex;flex-direction:column;gap:4px}.admin-field label{font-size:10px;font-weight:600;color:#263247}.admin-field input,.admin-field select{width:100%;border:1px solid #dbe0e8;border-radius:7px;padding:8px;font-size:10.5px}.database-links{display:grid;grid-template-columns:1fr 1fr;gap:7px;padding:14px}.database-links a{display:flex;flex-direction:column;text-decoration:none;border:1px solid #e3e7ed;border-radius:7px;padding:9px;color:#263247}.database-links a:hover{border-color:#6366f1;background:#fafaff}.database-links span{font-size:10.5px;font-weight:600}.database-links small{font-size:8.5px;color:#7b8495;margin-top:2px}.database-note{margin:0 14px 14px}.data-browser-nav{display:flex;gap:6px;overflow-x:auto;margin-bottom:10px}.data-browser-nav a{background:#fff;border:1px solid #e3e7ed;border-radius:999px;padding:6px 10px;text-decoration:none;color:#475569;font-size:9.5px;white-space:nowrap}.data-browser-card{padding:0;overflow:hidden}.data-search{display:flex;gap:8px;padding:12px;border-bottom:1px solid #e5e7eb}.data-search input{flex:1;min-width:160px;border:1px solid #dbe0e8;border-radius:7px;padding:8px;font-size:10.5px}.data-browser-card td{max-width:260px;overflow:hidden;text-overflow:ellipsis}
.pagination{
    display:flex;
    align-items:center;
    justify-content:center;
    flex-wrap:wrap;
    gap:6px;
    padding:14px 8px 4px;
}
.pagination-single{justify-content:flex-end}
.page-btn{
    min-width:34px;
    height:34px;
    padding:0 10px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border:1px solid var(--color-border);
    border-radius:var(--radius-sm);
    background:#fff;
    color:#475569;
    font-size:12px;
    font-weight:600;
    text-decoration:none;
    font-family:inherit;
    transition:background .15s,border-color .15s,color .15s,box-shadow .15s;
}
.page-btn:hover{border-color:#c7d2fe;color:var(--color-accent);background:#f8faff}
.page-btn.is-active{
    background:linear-gradient(135deg,var(--color-accent),var(--color-accent-end));
    border-color:transparent;
    color:#fff;
    box-shadow:0 6px 14px rgba(99,102,241,.28);
}
.page-btn.is-disabled{opacity:.4;pointer-events:none}
.page-btn.page-nav svg{width:16px;height:16px}
.page-ellipsis{color:#94a3b8;padding:0 2px;font-size:14px}
.page-meta{font-size:11px;color:#64748b;margin-left:8px}
@media(max-width:600px){.admin-form-grid,.database-links{grid-template-columns:1fr}.topbar-search{display:none}.page-meta{width:100%;text-align:center;margin:6px 0 0}}
.erp-url-field{display:flex;flex-direction:column;gap:5px;margin-bottom:8px}.erp-url-field label{font-size:10px;font-weight:600;color:#263247}.erp-url-field input,.erp-url-field textarea{width:100%;border:1px solid #dbe0e8;border-radius:7px;padding:9px;font-size:10.5px;box-sizing:border-box}.field-error{color:#b92332;font-size:9px}.setting-row.compact{min-height:52px}.sync-result{display:flex;flex-direction:column;background:#ecf8f1;color:#147a49;border-radius:7px;padding:9px;margin:8px 0}.sync-result strong{font-size:9.5px}.sync-result small{font-size:8.5px;margin-top:2px}.settings-actions.split{justify-content:space-between}.btn:disabled{opacity:.5;cursor:not-allowed}.notification-template-block{border-top:1px solid #edf0f4;padding-top:12px;margin-top:12px}.notification-template-block .settings-actions{padding:8px 0 4px}.settings-panel .erp-url-field textarea,.notification-templates-card .erp-url-field textarea{min-height:72px;font-family:var(--font-mono);font-size:11px;line-height:1.45}
.channel-test-section{margin-top:8px}.channel-test-hint{margin:0 0 12px;font-size:10px;color:#7b8495;line-height:1.45}.channel-test-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.channel-test-card{border:1px solid #e3e7ed;border-radius:8px;padding:12px;background:#fafbfe}.channel-test-card h4{margin:0 0 10px;font-size:11px;font-weight:700;color:#263247}.channel-test-actions{padding:4px 0 0;gap:8px;flex-wrap:wrap}.channel-test-actions .settings-status{flex:1;min-width:120px;margin:0}.channel-test-card textarea{min-height:64px;font-family:inherit;font-size:10.5px;line-height:1.4}
@media(max-width:800px){.channel-test-grid{grid-template-columns:1fr}}
.users-card{grid-column:1/-1}.users-card .user-list{max-height:430px;overflow-y:auto}.role-policy{margin:8px 14px 4px;border:1px solid #e5e9f0;border-radius:7px;background:#f8f9fc;color:#64748b;font-size:9.5px}.role-policy summary{padding:7px 10px;cursor:pointer;font-weight:700;color:#4b5870}.role-policy p{margin:0;padding:0 10px 8px;line-height:1.45}.users-card .user-row{grid-template-columns:30px minmax(150px,1fr) minmax(390px,auto);min-height:58px;gap:10px}.user-identity{overflow:hidden}.user-row>div.user-access-actions{display:flex;flex-direction:row!important;align-items:center;justify-content:flex-end;gap:8px;min-width:0;flex-wrap:nowrap}.user-role-form{display:grid!important;grid-template-columns:minmax(145px,180px) 76px;align-items:center;gap:5px;margin:0}.user-role-form select,.user-role-form input{width:100%;min-width:0;min-height:30px;border:1px solid #dbe0e8;border-radius:7px;padding:4px 6px;font-size:10px;background:#fff}.user-role-form .table-action{min-width:0;width:76px;padding:6px 8px}.role-handoff{grid-column:1/-1;position:relative;font-size:9px;color:#64748b}.role-handoff summary{cursor:pointer;text-align:right;list-style:none}.role-handoff summary::-webkit-details-marker{display:none}.role-handoff[open] input{margin-top:4px}.user-state-controls{display:flex!important;flex-direction:row!important;align-items:center;gap:6px;flex:0 0 auto}.user-access-actions .badge{min-width:58px;text-align:center;padding:5px 8px}.user-access-actions form{margin:0}.user-access-actions .table-action{min-width:82px}.user-access-actions .btn-danger{background:#dc3545;color:#fff;border-color:#dc3545}.user-access-actions button:disabled{opacity:.45;cursor:not-allowed}.admin-field-wide{grid-column:1/-1}.admin-field textarea{width:100%;border:1px solid #dbe0e8;border-radius:7px;padding:8px;font-size:10.5px}.admin-field select[multiple]{min-height:220px}@media(max-width:780px){.users-card .user-row{grid-template-columns:30px minmax(0,1fr);padding:8px 0}.user-access-actions{grid-column:2;justify-content:flex-start!important;flex-wrap:wrap!important}.user-role-form{grid-template-columns:minmax(135px,1fr) 76px;flex:1}.user-state-controls{margin-left:auto}}
.bulk-recipient-summary{margin:0 14px 10px;padding:9px 11px;border:1px solid #cfe0ff;border-radius:7px;background:#f3f7ff;color:#315b9b;font-size:10px;font-weight:600}
.performance-card{min-height:0}.performance-summary{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;padding:12px 14px}.performance-summary>div{display:flex;flex-direction:column;padding:10px;border:1px solid #e6e9f0;border-radius:8px;background:#fafbfe}.performance-summary span{font-size:8.5px;color:#64748b}.performance-summary strong{margin:2px 0;font-size:16px;color:#172033}.performance-summary small{font-size:8px;color:#94a3b8}.process-list{padding:0 14px;max-height:245px;overflow:auto}.process-row{display:grid;grid-template-columns:minmax(0,1fr) 78px 145px;align-items:center;gap:8px;padding:8px 0;border-top:1px solid #edf0f4}.process-row>div{display:flex;flex-direction:column;min-width:0}.process-row strong{font-size:9.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.process-row small{font-size:8px;color:#7b8495}.process-timing{text-align:right}.process-cause{padding:5px 7px;border-radius:999px;font-size:8px;font-weight:700;text-align:center}.process-fast{background:#e5f7ee;color:#138653}.process-normal{background:#eef2ff;color:#4f5fc7}.process-slow{background:#fdecec;color:#c63240}.process-running{background:#fff4d6;color:#a66700}.performance-note{margin:10px 14px 13px;padding:8px 10px;border-radius:7px;background:#f7f8fb;color:#7b8495;font-size:8.5px;line-height:1.4}.notification-centre-card{display:flex;flex-direction:column;min-height:250px}.notification-centre-body{display:grid;grid-template-columns:44px 1fr;gap:12px;padding:18px 16px}.notification-centre-icon{width:42px;height:42px;display:grid;place-items:center;border-radius:11px;background:linear-gradient(135deg,#eef2ff,#e0e7ff);color:#5b5ce2}.notification-centre-icon svg{width:20px;height:20px}.notification-centre-body h3{margin:0 0 5px;font-size:12px;color:#172033}.notification-centre-body p{margin:0;color:#64748b;font-size:10px;line-height:1.5}.notification-centre-body ul{margin:10px 0 0;padding-left:16px;color:#526078;font-size:9px;line-height:1.7}.notification-centre-actions{margin-top:auto;padding:12px 16px;border-top:1px solid #edf0f4;background:#fafbfe}.notification-centre-actions .btn{width:max-content}@media(max-width:700px){.performance-summary{grid-template-columns:1fr}.process-row{grid-template-columns:minmax(0,1fr) 72px}.process-cause{grid-column:1/-1;text-align:left}.notification-centre-body{grid-template-columns:1fr}.notification-centre-icon{display:none}}


/* Vendor modal + STK payment */
.vendor-row:hover{background:#f3f6ff}
.modal-overlay{
    position:fixed;inset:0;z-index:1200;
    display:grid;place-items:center;padding:18px;
    background:rgba(15,23,42,.46);
    -webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);
}
.modal-overlay[hidden]{display:none!important}
.modal-dialog{
    width:min(640px,100%);max-height:min(90vh,820px);overflow:auto;
    background:#fff;border:1px solid var(--color-border);border-radius:12px;
    box-shadow:0 24px 60px rgba(15,23,42,.28);
    animation:modal-in .18s ease-out;
}
@keyframes modal-in{from{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:none}}
.modal-header{
    display:flex;align-items:flex-start;justify-content:space-between;gap:12px;
    padding:16px 18px;border-bottom:1px solid var(--color-border);
}
.modal-header h2{margin:0;font-size:17px;color:#172033}
.modal-subtitle{display:flex;align-items:center;gap:8px;margin-top:6px;color:#64748b;font-size:12px}
.modal-close{
    border:none;background:#f3f4f6;color:#374151;width:32px;height:32px;
    border-radius:8px;font-size:20px;line-height:1;cursor:pointer;
    display:grid;place-items:center;
}
.modal-close svg{width:16px;height:16px}
.modal-close:hover{background:#e5e7eb}
.modal-body{padding:16px 18px 18px}
.modal-section + .modal-section{margin-top:18px;padding-top:16px;border-top:1px solid #edf0f4}
.modal-section h3{margin:0 0 10px;font-size:13px;color:#172033}
.modal-dl{display:grid;grid-template-columns:1fr 1fr;gap:10px 14px;margin:0 0 12px}
.modal-dl div{min-width:0}
.modal-dl dt{font-size:10px;color:#64748b;margin:0 0 2px}
.modal-dl dd{margin:0;font-size:12.5px;color:#172033;word-break:break-word}
.btn-sm{padding:6px 12px;font-size:12px}
.stk-help{margin:0 0 12px;color:#64748b;font-size:12px;line-height:1.45}
.stk-form-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.stk-amount-readonly{background:#f8fafc!important;color:#172033;font-weight:600;cursor:default}
.stk-account-row{
    display:flex;align-items:center;justify-content:space-between;gap:10px;
    margin:4px 0 14px;padding:10px 12px;border:1px solid #edf0f4;border-radius:8px;background:#f8fafc;
}
.stk-account-row span{font-size:11px;color:#64748b}
.stk-account-row strong{font-size:12px;color:#172033}
.stk-form-actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.stk-form-status{font-size:12px;color:#64748b}
.stk-form-status.is-success{color:var(--color-success)}
.stk-form-status.is-error{color:var(--color-danger)}
body.modal-open{overflow:hidden}
@media (max-width:700px){
    .stk-form-grid,.modal-dl{grid-template-columns:1fr}
    .modal-dialog{max-height:95vh}
    .profile-form-grid,.profile-password-grid{grid-template-columns:1fr}
}

.profile-modal-dialog{width:min(520px,100%)}
.profile-modal-heading{display:flex;align-items:center;gap:12px;min-width:0}
.profile-modal-avatar{
    width:42px;height:42px;border-radius:50%;display:grid;place-items:center;
    background:#6366f1;color:#fff;font-weight:700;font-size:15px;flex:0 0 42px;
}
.profile-readonly-dl{margin-bottom:14px}
.profile-help{margin:0 0 12px;color:#64748b;font-size:12px;line-height:1.45}
.profile-form-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.profile-password-grid{grid-template-columns:1fr}
.profile-form .form-group{margin-bottom:0}
.profile-form .form-group label{font-size:11px}
.profile-form .form-group input{
    width:100%;padding:8px 10px;border:1px solid var(--color-border);border-radius:8px;font-size:13px;
}
.profile-form-actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-top:12px}
.profile-form-status{font-size:12px;color:#64748b}
.profile-form-status.is-success{color:var(--color-success)}
.profile-form-status.is-error{color:var(--color-danger)}
.profile-modal-footer{display:flex;justify-content:flex-end}


/* Report cards + table filters */
.reports-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:16px}
.report-card{text-decoration:none;color:inherit;display:flex;flex-direction:column;gap:8px;transition:border-color .15s,box-shadow .15s,transform .15s}
.report-card:hover{border-color:#c7d2fe;box-shadow:0 10px 28px rgba(99,102,241,.12);transform:translateY(-2px)}
.report-card h3{margin:0;font-size:15px;color:#172033}
.report-card p{margin:0;color:#6b7280;font-size:12px;line-height:1.45}
.report-card-icon{width:40px;height:40px;border-radius:12px;display:grid;place-items:center;background:rgba(99,102,241,.1);color:var(--color-accent)}
.report-card-icon svg{width:18px;height:18px}
.table-filters{display:flex;gap:10px;margin-bottom:16px;flex-wrap:wrap;align-items:center}
.report-total{font-weight:600;font-size:14px;color:#172033;margin:0 0 12px}
.date-chip svg{width:14px;height:14px;color:#94a3b8}
.database-links small svg{width:12px;height:12px;display:inline;vertical-align:-2px}
.admin-option svg,.card-header a svg{width:13px;height:13px}

/* Responsive dashboard: size against usable content, not the physical display. */
.dashboard-page{container-type:inline-size;container-name:dashboard;min-width:0}
.dashboard-summary{gap:clamp(8px,1cqi,14px)}
.dashboard-summary .metric-card{min-width:0;padding:clamp(10px,1.15cqi,16px);gap:clamp(8px,.9cqi,14px)}
.dashboard-summary .metric-icon{flex-basis:clamp(34px,3.4cqi,44px);width:clamp(34px,3.4cqi,44px);height:clamp(34px,3.4cqi,44px)}
.dashboard-summary .metric-card span{max-width:100%;overflow:hidden;text-overflow:ellipsis;font-size:clamp(10px,.9cqi,12px)}
.dashboard-summary .metric-card strong{max-width:100%;font-size:clamp(18px,1.65cqi,24px);font-variant-numeric:tabular-nums}
.dashboard-summary .metric-card small{max-width:100%;font-size:clamp(9px,.82cqi,11px)}
.dashboard-summary .metric-card .revenue-value{font-size:clamp(13px,1.3cqi,18px);letter-spacing:-.045em}

@container dashboard (max-width:1120px){
    .dashboard-toolbar{margin-bottom:9px}.dashboard-summary{margin-bottom:10px}
    .dashboard-summary .metric-card{min-height:88px}
    .dashboard-grid{grid-template-columns:minmax(240px,1.35fr) minmax(225px,1fr) minmax(210px,.95fr);gap:10px}
    .dashboard-side-stack{gap:10px}.card-header{height:42px;padding-inline:13px}
    .activity-row{min-height:49px;padding:8px 13px;gap:9px}.activity-status{flex-basis:28px;width:28px;height:28px}
    .activity-copy strong{font-size:11.5px}.activity-copy small{font-size:9.5px}
    .status-chart-layout{min-height:204px;gap:14px;padding:14px 12px}.css-donut{width:145px;height:145px}
    .chart-legend{min-width:112px;gap:9px}.chart-legend span{font-size:10.5px}.chart-legend b{font-size:11px}
    .expiry-row{padding:9px 13px}.expiry-title strong{font-size:11.5px}.expiry-row small{font-size:9.5px}
    .quick-search-panel .card-body{padding:10px 13px}
}

@container dashboard (max-width:820px){
    .dashboard-summary{grid-template-columns:repeat(2,minmax(0,1fr))}.dashboard-summary .metric-featured{grid-column:1/-1}
    .dashboard-grid{grid-template-columns:1fr 1fr;grid-template-areas:"activity status" "side side" "payments payments"}
}

/* Compact vertically on scaled or short laptop displays while retaining every panel. */
@media (max-height:760px) and (min-width:801px){
    .page-content:has(> .dashboard-page){padding:10px 16px 16px}.dashboard-toolbar{margin-bottom:6px}
    .date-chip{min-width:174px;padding:6px 10px;font-size:10.5px}.dashboard-summary{margin-bottom:8px}
    .dashboard-summary .metric-card{min-height:76px;padding-block:8px}.dashboard-summary .metric-icon{flex-basis:32px;width:32px;height:32px}
    .dashboard-summary .metric-icon svg{width:16px;height:16px}.dashboard-summary .metric-card strong{margin:2px 0;font-size:18px}
    .dashboard-summary .metric-card .revenue-value{font-size:clamp(12px,1.2cqi,16px)}
    .dashboard-grid,.dashboard-side-stack{gap:8px}.card-header{height:34px;padding-inline:11px}
    .card-header h2{font-size:11.5px}.card-header a{font-size:9.5px}
    .activity-row{min-height:36px;padding:4px 11px;gap:8px}.activity-row:nth-child(n+5){display:none}
    .activity-status{flex-basis:24px;width:24px;height:24px}.activity-status svg{width:12px;height:12px}
    .activity-copy strong{font-size:10.5px}.activity-copy small{font-size:8.5px;margin-top:1px}
    .status-chart-layout{min-height:144px;padding:8px 10px;gap:12px}.css-donut{width:116px;height:116px}
    .donut-center strong{font-size:21px}.donut-center small{font-size:8px}.chart-legend{min-width:100px;gap:5px}
    .chart-legend li{gap:6px}.chart-legend span,.chart-legend b{font-size:9px}
    .expiry-row{padding:6px 11px}.expiry-title strong{font-size:10px}.expiry-badge{font-size:8.5px;padding:2px 7px}
    .expiry-row small{font-size:8.5px;margin-top:2px}.quick-search-panel .card-body{padding:7px 11px}
    .panel-help{font-size:9px;margin-bottom:5px}.search-box.full input{font-size:10px;padding-block:6px}
    .dashboard-page .table{font-size:9.5px}.dashboard-page .table th,.dashboard-page .table td{padding:5px 8px}
    .payments-panel tbody tr:nth-child(n+4){display:none}
}

@media (max-width:1360px) and (min-width:801px){
    .page-content:has(> .dashboard-page){padding-inline:16px}
}

/* Responsive application and vendor directory. Size from usable viewport width,
   so browser zoom, Windows display scaling and laptop resolution do not distort it. */
.vendor-page {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    container: vendor-page / inline-size;
}
.vendor-page .toolbar { min-width: 0; }
.vendor-page .search-box { min-width: 220px; }
.vendor-list-card { overflow: hidden; padding: clamp(10px, 1.2cqi, 16px); }
.vendor-filter-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(125px, 170px) auto;
    gap: 8px;
    margin-bottom: 12px;
    min-width: 0;
}
.vendor-filter-form input,
.vendor-filter-form select {
    width: 100%;
    min-width: 0;
    padding: 7px 10px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: #fff;
    color: var(--color-text);
    font-size: 12px;
}
.vendor-table-wrap { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; }
.vendor-table { table-layout: fixed; width: 100%; min-width: 0; }
.vendor-table th,
.vendor-table td {
    min-width: 0;
    padding: clamp(7px, .75cqi, 10px) clamp(6px, .85cqi, 12px);
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}
.vendor-table th { font-size: clamp(9px, .82cqi, 12px); }
.vendor-table td { font-size: clamp(9.5px, .88cqi, 12px); }
.vendor-table th:nth-child(1) { width: 11%; }
.vendor-table th:nth-child(2) { width: 18%; }
.vendor-table th:nth-child(3) { width: 17%; }
.vendor-table th:nth-child(4) { width: 13%; }
.vendor-table th:nth-child(5) { width: 22%; }
.vendor-table th:nth-child(6) { width: 9%; }
.vendor-table th:nth-child(7) { width: 10%; }
.vendor-table td:nth-child(2),
.vendor-table td:nth-child(3),
.vendor-table td:nth-child(5) { white-space: nowrap; }
.vendor-table .badge {
    max-width: 100%;
    padding: 3px clamp(5px, .6cqi, 9px);
    font-size: clamp(8.5px, .76cqi, 11px);
    overflow: hidden;
    text-overflow: ellipsis;
}
.vendor-page + .modal-overlay { max-width: none; }
.admin-field ul[id$="_channels"],
.admin-field ul[id$="_confirm_send"] {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin: 0;
    padding: 8px 0;
    list-style: none;
}
.admin-field ul[id$="_channels"] label,
.admin-field ul[id$="_confirm_send"] label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
}
.admin-field input[type="checkbox"] { width: auto; margin: 0; }
.erp-event-sync {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    margin: 10px 0;
    padding: 12px;
    border: 1px solid #dbe4ff;
    border-radius: 9px;
    background: #f7f9ff;
}
.erp-event-sync > div { display: flex; flex-direction: column; min-width: 0; gap: 4px; }
.erp-event-sync strong { font-size: 11px; color: #263247; }
.erp-event-sync code { max-width: 100%; overflow-wrap: anywhere; font-size: 9px; }
.erp-event-sync small { color: #64748b; font-size: 9px; }
@media (max-width: 700px) {
    .erp-event-sync { grid-template-columns: 1fr; }
    .erp-event-sync .btn { width: 100%; }
}
.role-directory{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:12px}.role-directory .card{margin:0}.role-card{display:flex;flex-direction:column;gap:11px}.role-card-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}.role-card h2{margin:0;font-size:15px}.role-card-heading small,.role-card p{color:#64748b;font-size:10px}.role-card p{margin:0;min-height:30px}.role-metrics{display:flex;gap:8px}.role-metrics span{flex:1;padding:8px;border-radius:8px;background:#f7f8fb;color:#64748b;font-size:9px}.role-metrics strong{font-size:14px;color:#172033}.role-card details summary{cursor:pointer;font-size:10px;font-weight:600}.role-permission-tags{display:flex;flex-wrap:wrap;gap:5px;margin-top:8px}.role-permission-tags span{padding:4px 7px;border-radius:999px;background:#eef2ff;color:#4f5fc7;font-size:8px}.role-card-actions{display:flex;align-items:center;gap:7px;margin-top:auto}.role-card-actions form{margin:0}.role-editor{max-width:920px}.capability-picker>ul{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 14px;list-style:none;margin:0;padding:10px;border:1px solid #e5e7eb;border-radius:8px}.capability-picker li label{display:flex;align-items:center;gap:7px;font-size:10px;font-weight:500}.capability-picker input{width:auto}.badge-inactive{background:#fdecec;color:#dc3545}@media(max-width:650px){.capability-picker>ul{grid-template-columns:1fr}}

@container vendor-page (max-width: 920px) {
    .vendor-table th:nth-child(3), .vendor-table td:nth-child(3) { display: none; }
    .vendor-table th:nth-child(1) { width: 13%; }
    .vendor-table th:nth-child(2) { width: 21%; }
    .vendor-table th:nth-child(4) { width: 16%; }
    .vendor-table th:nth-child(5) { width: 25%; }
    .vendor-table th:nth-child(6) { width: 11%; }
    .vendor-table th:nth-child(7) { width: 14%; }
}
@container vendor-page (max-width: 690px) {
    .vendor-page .toolbar { align-items: stretch; flex-direction: column; }
    .vendor-page .search-box { width: 100%; max-width: none; min-width: 0; }
    .vendor-page .data-source-note { align-self: flex-start; }
    .vendor-filter-form { grid-template-columns: minmax(0, 1fr) minmax(110px, 145px); }
    .vendor-filter-form .btn { grid-column: 1 / -1; width: 100%; }
    .vendor-table th:nth-child(4), .vendor-table td:nth-child(4) { display: none; }
    .vendor-table th:nth-child(1) { width: 17%; }
    .vendor-table th:nth-child(2) { width: 25%; }
    .vendor-table th:nth-child(5) { width: 30%; }
    .vendor-table th:nth-child(6) { width: 12%; }
    .vendor-table th:nth-child(7) { width: 16%; }
}

@media (max-width: 1360px) and (min-width: 801px) {
    :root { --sidebar-width: clamp(210px, 17.5vw, 238px); }
    .sidebar-brand { padding-inline: 15px; }
    .sidebar-nav { padding-inline: 9px; }
    .nav-item { padding-inline: 9px; gap: 9px; }
    .topbar { padding-inline: 14px; gap: 11px; }
    .topbar-search { max-width: min(42vw, 440px); }
    .user-meta { min-width: 0; max-width: 145px; }
    .user-name, .user-role { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
}
@media (max-width: 1000px) and (min-width: 601px) {
    .topbar-search { max-width: 300px; }
    .profile-trigger .user-meta { display: none; }
    .logout-label { display: none; }
    .logout-button { width: 34px; padding: 0; justify-content: center; }
}
