:root {
    --sidebar: #ffffff;
    --sidebar-border: #eff3f4;
    --sidebar-text: #0f1419;
    --sidebar-muted: #536471;
    --sidebar-hover: #f7f9f9;
    --sidebar-active: #e8f5fd;
    --primary: #1d9bf0;
    --surface: #ffffff;
    --background: #f7f9fb;
}

html,
body {
    min-height: 100%;
}

body {
    background: var(--background);
    color: #273244;
}

.app-shell {
    min-height: 100vh;
}

.sidebar {
    width: 255px !important;
    min-width: 255px;
    flex: 0 0 255px;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    background: var(--sidebar);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--sidebar-border);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.35rem 1.25rem;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand strong {
    color: var(--sidebar-text);
    font-weight: 800;
}

.sidebar-brand small {
    display: block;
    color: var(--sidebar-muted);
    font-size: .74rem;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    background: var(--sidebar-text);
    color: #fff;
    border-radius: 999px;
    font-weight: 800;
}

.sidebar-nav {
    padding: .9rem .75rem;
}

.sidebar-nav .nav-link {
    color: var(--sidebar-text);
    border-radius: 999px;
    padding: .72rem .95rem;
    margin: .08rem 0;
    font-weight: 650;
    white-space: nowrap;
    transition: background-color .15s ease, color .15s ease;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link:focus {
    color: var(--sidebar-text);
    background: var(--sidebar-hover);
}

.sidebar-nav .nav-link.active,
.sidebar-nav .nav-link[aria-current="page"] {
    color: var(--sidebar-text);
    background: var(--sidebar-active);
}

.sidebar-menu-group {
    display: flex;
    align-items: stretch;
    min-width: 0;
}

.sidebar-menu-group > .nav-link:first-child {
    min-width: 0;
}

.sidebar-submenu-toggle {
    display: flex;
    align-items: center;
    flex: 0 0 2.5rem;
    justify-content: center;
    padding-inline: .5rem !important;
}

.sidebar-submenu .nav-link {
    margin-left: 2.25rem;
    padding-left: .75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tenant-shell .sidebar-nav .nav-link[data-icon]::before {
    display: inline-grid;
    width: 1.35rem;
    margin-right: .45rem;
    place-items: center;
    color: #65758b;
    content: attr(data-icon);
    font-size: .95rem;
}

.tenant-shell .sidebar-nav .nav-link.active {
    color: #1264d8;
    background: #eaf3ff;
}

.tenant-shell .sidebar-nav .nav-link.active::before {
    color: #1264d8;
}

.nav-caption {
    font-size: .68rem;
    color: var(--sidebar-muted);
    letter-spacing: .08em;
    padding: 1.15rem .95rem .35rem;
    font-weight: 800;
}

.sidebar-logout {
    margin: auto 1rem 1rem;
}

.sidebar-logout .btn {
    color: var(--sidebar-text);
    border-color: #cfd9de;
    background: #fff;
    border-radius: 999px;
    font-weight: 700;
}

.sidebar-logout .btn:hover {
    background: #f7f9f9;
    color: var(--sidebar-text);
}

.content-wrap {
    min-width: 0;
}

.topbar {
    height: 64px;
    background: #fff;
    border-bottom: 1px solid #e3e8f1;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
}

.topbar-identity {
    display: flex;
    min-width: 0;
    flex-direction: column;
    line-height: 1.2;
}

.topbar-identity strong {
    overflow: hidden;
    max-width: 190px;
    color: #1d293b;
    font-size: .85rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-identity small {
    color: #7b8798;
    font-size: .72rem;
}

.topbar-date {
    margin-right: 1rem;
    font-size: .78rem;
}

.card {
    border: 1px solid #e3e8f1;
    border-radius: .8rem;
    box-shadow: 0 2px 8px rgba(28, 45, 76, .04);
}

.card-header {
    padding: .9rem 1rem;
}

.stat-card {
    transition: .15s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 18px rgba(28, 45, 76, .1);
}

.dashboard-welcome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.dashboard-actions {
    display: flex;
    gap: .65rem;
}

.setup-status-card {
    overflow: hidden;
    background: #fff;
    border: 1px solid #f2d39a;
    border-radius: 12px;
    box-shadow: 0 5px 18px rgba(126, 82, 15, .07);
}

.setup-status-main {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.15rem 1.25rem;
    background: #fffaf0;
}

.setup-status-main > div {
    min-width: 0;
    flex: 1;
}

.setup-status-main h2 {
    margin: 0;
    color: #5e410d;
    font-size: 1rem;
    font-weight: 750;
}

.setup-status-main p {
    margin: .2rem 0 0;
    color: #886523;
    font-size: .82rem;
}

.setup-status-icon {
    display: grid;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    color: #9a5b00;
    background: #ffe9bd;
    border-radius: 10px;
    place-items: center;
    font-weight: 800;
}

.setup-status-steps {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    padding: .8rem 1.25rem;
    border-top: 1px solid #f5e6ca;
}

.setup-status-step {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .35rem .6rem;
    color: #566477;
    text-decoration: none;
    background: #f5f7fa;
    border-radius: 999px;
    font-size: .74rem;
}

.setup-status-step:hover { color: inherit; }
.setup-status-step.is-completed { color: #18794e; background: #e7f7ef; }
.setup-status-step.is-warning { color: #946000; background: #fff2d9; }
.setup-status-step.is-missing { color: #b42318; background: #feeceb; }

.dashboard-kpi {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: 1.15rem;
    color: inherit;
    text-decoration: none;
    background: #fff;
    border: 1px solid #e8edf4;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(30, 50, 80, .045);
    transition: transform .15s ease, box-shadow .15s ease;
}

.dashboard-kpi:hover {
    color: inherit;
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(30, 50, 80, .08);
}

.dashboard-kpi small,
.dashboard-kpi strong {
    display: block;
}

.dashboard-kpi small {
    color: #6c788b;
    font-size: .78rem;
    white-space: nowrap;
}

.dashboard-kpi strong {
    margin-top: .15rem;
    color: #162033;
    font-size: 1.7rem;
    line-height: 1;
}

.kpi-icon {
    display: grid;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 11px;
    font-size: 1.25rem;
}

.kpi-blue { background: #eaf3ff; }
.kpi-violet { background: #f1ebff; }
.kpi-green { background: #e8f8ef; }
.kpi-orange { background: #fff3df; }
.kpi-teal { background: #e5f8f7; }

.dashboard-card {
    overflow: hidden;
    background: #fff;
    border: 1px solid #e8edf4;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(30, 50, 80, .04);
}

.dashboard-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.2rem;
    border-bottom: 1px solid #edf1f6;
}

.dashboard-card-head h2 {
    margin: 0;
    color: #172033;
    font-size: 1rem;
    font-weight: 750;
}

.dashboard-card-head p {
    margin: .2rem 0 0;
    color: #7a8699;
    font-size: .78rem;
}

.dashboard-card-head a {
    flex: none;
    font-size: .82rem;
    font-weight: 650;
    text-decoration: none;
}

.dashboard-table > :not(caption) > * > * {
    padding: .85rem 1.2rem;
    border-color: #edf1f6;
    vertical-align: middle;
}

.dashboard-table thead th {
    color: #7a8699;
    background: #fbfcfe;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.status-pill {
    display: inline-block;
    padding: .28rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    white-space: nowrap;
}

.status-success { color: #18794e; background: #e7f7ef; }
.status-warning { color: #9a5b00; background: #fff2d9; }
.status-neutral { color: #526174; background: #eef2f6; }

.empty-cell {
    padding: 2rem !important;
    color: #8490a2 !important;
    text-align: center;
}

.notification-list form + form {
    border-top: 1px solid #edf1f6;
}

.notification-row {
    display: flex;
    width: 100%;
    gap: .7rem;
    padding: .9rem 1.2rem;
    color: #283449;
    text-align: left;
    background: #fff;
    border: 0;
}

.notification-row:hover { background: #f8fafc; }
.notification-row.is-unread { background: #f4f8ff; }
.notification-row > span:last-child { min-width: 0; }
.notification-row strong,
.notification-row small,
.notification-row time { display: block; }
.notification-row strong { font-size: .85rem; }
.notification-row small { overflow: hidden; margin: .15rem 0; color: #68758a; font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.notification-row time { color: #909aab; font-size: .7rem; }
.notification-dot { flex: 0 0 7px; width: 7px; height: 7px; margin-top: .45rem; background: transparent; border-radius: 50%; }
.notification-row.is-unread .notification-dot { background: #1d72f3; }

.message-summary { padding: .55rem 1.2rem; }
.message-summary > div { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: .65rem; padding: .8rem 0; border-bottom: 1px solid #edf1f6; }
.summary-dot { width: 8px; height: 8px; border-radius: 50%; }
.message-summary strong { color: #172033; font-size: 1.05rem; }
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; padding: .8rem 1.2rem 1.2rem; }

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.table > :not(caption) > * > * {
    padding: .8rem .9rem;
    vertical-align: middle;
}

.form-label {
    font-weight: 500;
}

.text-truncate-message {
    max-width: 330px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-templates-table thead th {
    color: #526174;
    background: #fafbfd;
    font-size: .78rem;
    font-weight: 650;
}

.message-templates-table .template-name {
    color: #1d293b;
    font-weight: 650;
}

.message-templates-table .template-type {
    color: #536174;
    font-size: .88rem;
}

.message-templates-table .template-content {
    color: #7a8698;
    font-size: .85rem;
}

@media (max-width: 576px) {
    .message-templates-head {
        align-items: stretch;
    }

    .message-templates-card .text-truncate-message {
        max-width: 220px;
    }
}

@media (min-width: 992px) {
    .sidebar {
        position: sticky;
        top: 0;
        visibility: visible !important;
        transform: none !important;
    }
}

@media (max-width: 576px) {
    .setup-status-main {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .setup-status-main .btn {
        width: 100%;
    }
    .topbar-date {
        display: none;
    }

    .topbar-identity strong {
        max-width: 105px;
    }
    .dashboard-welcome {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .page-head {
        align-items: stretch;
        flex-direction: column;
    }

    .page-head .btn {
        width: 100%;
    }

    .table {
        font-size: .88rem;
    }
}
