:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 76px;
    --topbar-height: 72px;

    --color-background: #f4f6f8;
    --color-surface: #ffffff;
    --color-sidebar: #18212f;
    --color-sidebar-hover: #253247;
    --color-sidebar-active: #2f6fed;
    --color-sidebar-active-text: #ffffff;
    --color-border: #dfe4ea;
    --color-text: #1f2937;
    --color-text-muted: #6b7280;
    --color-white: #ffffff;

    --border-radius: 8px;
    --transition-speed: 180ms;
}

* {
    box-sizing: border-box;
}

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

body {
    background: var(--color-background);
    color: var(--color-text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

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

.sidebar-overlay {
    display: none;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    display: flex;
    width: var(--sidebar-width);
    flex-direction: column;
    overflow: hidden;
    background: var(--color-sidebar);
    color: var(--color-white);
    transition: width var(--transition-speed) ease;
}

.sidebar.sidebar-identity-graphite {
    --color-sidebar: #18212f;
    --color-sidebar-hover: #253247;
    --color-sidebar-active: #2f6fed;
    --color-sidebar-active-text: #ffffff;
}

.sidebar.sidebar-identity-ember {
    --color-sidebar: #4a2617;
    --color-sidebar-hover: #61321e;
    --color-sidebar-active: #f46a16;
    --color-sidebar-active-text: #18212f;
}

.sidebar.sidebar-identity-moss {
    --color-sidebar: #374019;
    --color-sidebar-hover: #4d5821;
    --color-sidebar-active: #b8cf16;
    --color-sidebar-active-text: #18212f;
}

.sidebar.sidebar-identity-plum {
    --color-sidebar: #3a1e2a;
    --color-sidebar-hover: #512b3a;
    --color-sidebar-active: #b83a5a;
    --color-sidebar-active-text: #ffffff;
}

.sidebar.sidebar-identity-lagoon {
    --color-sidebar: #153a3c;
    --color-sidebar-hover: #1e5052;
    --color-sidebar-active: #1f9d9a;
    --color-sidebar-active-text: #18212f;
}

.sidebar-brand {
    position: relative;
    display: flex;
    min-height: var(--topbar-height);
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px solid rgb(255 255 255 / 10%);
    padding: 0 12px 0 18px;
}

.brand-link {
    display: flex;
    min-width: 0;
    flex: 1;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    display: inline-flex;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--color-sidebar-active);
    color: var(--color-sidebar-active-text);
    font-size: 20px;
    font-weight: 700;
}

.brand-mark svg {
    display: block;
    width: 24px;
    height: 24px;
}

.brand-mark-no-background {
    background: transparent;
    color: inherit;
}

.brand-mark:not(.brand-mark-no-background) svg > rect:first-child {
    fill: transparent;
}

.brand-mark:not(.brand-mark-no-background) svg > path {
    fill: currentColor;
}

.brand-text {
    overflow: hidden;
    font-size: 20px;
    font-weight: 700;
    white-space: nowrap;
}

.sidebar-collapse-toggle {
    display: inline-flex;
    width: 28px;
    height: 34px;
    flex: 0 0 28px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgb(255 255 255 / 18%);
    border-radius: 7px;
    background: rgb(255 255 255 / 8%);
    color: var(--color-white);
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    transition:
        background var(--transition-speed) ease,
        transform var(--transition-speed) ease;
}

.sidebar-collapse-toggle:hover {
    background: rgb(255 255 255 / 16%);
}

.sidebar-collapse-toggle span {
    display: block;
    transition: transform var(--transition-speed) ease;
}

.mobile-navigation-toggle {
    display: none;
}

.module-navigation {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 5px;
    padding: 18px 12px;
}

.module-link {
    position: relative;
    display: flex;
    min-height: 48px;
    align-items: center;
    gap: 13px;
    border-radius: var(--border-radius);
    color: rgb(255 255 255 / 75%);
    padding: 8px 12px;
    transition:
        background var(--transition-speed) ease,
        color var(--transition-speed) ease;
}

.module-link:hover {
    background: var(--color-sidebar-hover);
    color: var(--color-white);
}

.module-link.is-active {
    background: var(--color-sidebar-active);
    color: var(--color-sidebar-active-text);
}

.module-link.is-active::before {
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: -12px;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: var(--color-white);
    content: "";
}

.module-icon {
    display: inline-flex;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgb(255 255 255 / 10%);
    font-weight: 700;
}

.module-label {
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-footer {
    min-height: 48px;
    border-top: 1px solid rgb(255 255 255 / 10%);
    color: rgb(255 255 255 / 45%);
    padding: 15px 24px;
    font-size: 12px;
}

.app-main {
    width: calc(100% - var(--sidebar-width));
    min-width: 0;
    margin-left: var(--sidebar-width);
    transition:
        width var(--transition-speed) ease,
        margin-left var(--transition-speed) ease;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    min-height: var(--topbar-height);
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
    padding: 0 28px;
}

.topbar-left {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 22px;
}

.module-menu-mobile-toggle {
    display: none;
}

.module-menu-shell {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    align-items: center;
    gap: 4px;
}

.module-menu {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
}

.module-menu::-webkit-scrollbar {
    display: none;
}

.module-menu-scroll {
    display: none;
    width: 28px;
    height: 40px;
    flex: 0 0 28px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: var(--border-radius);
    background: transparent;
    color: var(--color-text-muted);
    padding: 0;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.module-menu-shell.has-overflow .module-menu-scroll {
    display: inline-flex;
}

.module-menu-scroll:hover:not(:disabled) {
    background: var(--color-background);
    color: var(--color-text);
}

.module-menu-scroll:disabled {
    opacity: 0.3;
    cursor: default;
}

.module-menu-link {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    border-radius: var(--border-radius);
    color: var(--color-text-muted);
    padding: 0 14px;
    white-space: nowrap;
}

.module-menu-link:hover {
    background: var(--color-background);
    color: var(--color-text);
}

.module-menu-link.is-active {
    background: #e8efff;
    color: var(--color-sidebar-active);
    font-weight: 700;
}

.topbar-user {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 18px;
}

.user-details {
    display: flex;
    flex-direction: column;
    text-align: right;
}

.user-profile-link {
    color: inherit;
    text-decoration: none;
}

.user-profile-link:hover .user-name {
    color: var(--color-sidebar-active);
    text-decoration: underline;
}

.user-name {
    font-weight: 700;
}

.user-email {
    color: var(--color-text-muted);
    font-size: 12px;
}

.profile-icon-link {
    display: inline-flex;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    background: var(--color-surface);
    color: var(--color-text-muted);
    text-decoration: none;
}

.profile-icon-link svg {
    width: 20px;
    height: 20px;
    fill: currentcolor;
}

.profile-icon-link:hover,
.profile-icon-link.is-active {
    border-color: var(--color-sidebar-active);
    background: #e8efff;
    color: var(--color-sidebar-active);
}

.logout-link {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: 0 14px;
}

.logout-link:hover {
    background: var(--color-background);
}

.logout-form {
    margin: 0;
}

button.logout-link {
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
}

.logout-dialog {
    width: min(560px, calc(100% - 32px));
    border: 0;
    border-radius: 12px;
    background: var(--color-surface);
    color: var(--color-text);
    padding: 0;
    box-shadow: 0 24px 70px rgb(0 0 0 / 28%);
}

.logout-dialog::backdrop {
    background: rgb(0 0 0 / 45%);
}

.logout-dialog-content {
    padding: 24px;
}

.logout-dialog h2 {
    margin: 0 0 10px;
    font-size: 20px;
}

.logout-dialog-content > p {
    margin: 0;
    color: var(--color-text-muted);
    line-height: 1.5;
}

.logout-dialog-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 22px;
}

.logout-dialog-options form {
    margin: 0;
}

.logout-option-button {
    display: flex;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    padding: 16px;
    text-align: left;
}

.logout-option-button:hover {
    border-color: var(--color-sidebar-active);
    background: #f7f9ff;
}

.logout-option-button.is-primary {
    border-color: var(--color-sidebar-active);
    background: #e8efff;
}

.logout-option-button strong {
    font-size: 15px;
}

.logout-option-button span {
    color: var(--color-text-muted);
    font-size: 13px;
    line-height: 1.45;
}

.logout-dialog-cancel {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    margin-top: 20px;
    padding: 0 16px;
}

.logout-dialog-cancel:hover {
    background: var(--color-background);
}

.content-area {
    padding: 28px;
}

.page-header {
    margin-bottom: 22px;
}

.page-header h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
}

.page-content {
    min-height: 300px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: var(--color-surface);
    padding: 28px;
}

.data-page {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.data-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.data-toolbar-main {
    display: flex;
    min-width: 0;
    flex: 1;
    align-items: center;
    gap: 12px;
}

.data-toolbar-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 10px;
}

.data-search,
.data-filter {
    min-height: 36px;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    background: var(--color-surface);
    color: var(--color-text);
    padding: 0 12px;
    outline: none;
}

.data-search {
    width: 100%;
    max-width: 360px;
}

.data-filter {
    min-width: 150px;
}

.data-search:focus,
.data-filter:focus {
    border-color: var(--color-sidebar-active);
    box-shadow: 0 0 0 3px rgb(47 111 237 / 12%);
}

.primary-action-button {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: var(--border-radius);
    background: var(--color-sidebar-active);
    color: var(--color-white);
    cursor: pointer;
    padding: 0 16px;
    font-weight: 700;
    white-space: nowrap;
}

.primary-action-button:hover {
    background: #245dcc;
}

.data-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-surface);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th,
.data-table td {
    border-bottom: 1px solid var(--color-border);
    padding: 8px 10px;
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    background: #f7f8fa;
    color: var(--color-text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr:hover td {
    background: #e8efff;
}

.data-table tbody tr:hover td:first-child {
    box-shadow: inset 3px 0 0 var(--color-sidebar-active);
}

.data-table-actions-column {
    width: 1%;
    text-align: right !important;
    white-space: nowrap;
}

.data-table-empty {
    height: 150px;
    color: var(--color-text-muted);
    text-align: center !important;
}

.status-badge {
    display: inline-flex;
    min-height: 26px;
    align-items: center;
    border-radius: 999px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.status-badge.is-active {
    background: #e8f7ee;
    color: #18794e;
}

.status-badge.is-inactive {
    background: #f2f3f5;
    color: #6b7280;
}

.status-badge.is-warning {
    background: #fff4d6;
    color: #946200;
}

.status-badge.is-error {
    background: #fdebec;
    color: #b42318;
}

.action-button {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    padding: 0 9px;
    font-size: 12px;
    white-space: nowrap;
}

.action-button:hover {
    background: var(--color-background);
}

.action-button.is-danger {
    border-color: #f0b6b8;
    color: #b42318;
}

.data-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.data-pagination-summary {
    color: var(--color-text-muted);
    font-size: 13px;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pagination button,
.pagination-current {
    display: inline-flex;
    min-width: 38px;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    border-radius: 7px;
    background: var(--color-surface);
    color: var(--color-text);
    padding: 0 11px;
}

.pagination button {
    cursor: pointer;
}

.pagination button:hover:not(:disabled) {
    background: var(--color-background);
}

.pagination button:disabled {
    cursor: default;
    opacity: 0.5;
}

.pagination-current {
    border-color: var(--color-sidebar-active);
    background: #e8efff;
    color: var(--color-sidebar-active);
    font-weight: 700;
}

body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .app-main {
    width: calc(100% - var(--sidebar-collapsed-width));
    margin-left: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .module-label,
body.sidebar-collapsed .sidebar-footer {
    display: none;
}

body.sidebar-collapsed .sidebar-brand {
    justify-content: space-between;
    gap: 4px;
    padding: 0 6px;
}

body.sidebar-collapsed .brand-link {
    flex: 0 0 40px;
}

body.sidebar-collapsed .sidebar-collapse-toggle {
    width: 24px;
    flex-basis: 24px;
}

body.sidebar-collapsed .sidebar-collapse-toggle span {
    transform: rotate(180deg);
}

body.sidebar-collapsed .module-link {
    justify-content: center;
    padding-inline: 10px;
}

@media (min-width: 768px) and (max-width: 1199px) {
    :root {
        --sidebar-width: 230px;
        --sidebar-collapsed-width: 72px;
    }

    .topbar {
        padding-inline: 20px;
    }

    .content-area {
        padding: 22px;
    }
}

@media (max-width: 767px) {
    .sidebar {
        width: var(--sidebar-width);
        transform: translateX(-100%);
        transition:
            transform var(--transition-speed) ease,
            width var(--transition-speed) ease;
    }

    .sidebar-collapse-toggle {
        display: none;
    }

    .mobile-navigation-toggle {
        display: inline-flex;
        width: 40px;
        height: 40px;
        align-items: center;
        justify-content: center;
        border: 1px solid var(--color-border);
        border-radius: var(--border-radius);
        background: var(--color-surface);
        color: var(--color-text);
        cursor: pointer;
        font-size: 20px;
    }

    .mobile-navigation-toggle:hover {
        background: var(--color-background);
    }

    .app-main,
    body.sidebar-collapsed .app-main {
        width: 100%;
        margin-left: 0;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 15;
        background: rgb(0 0 0 / 45%);
    }

    body.sidebar-open .sidebar-overlay {
        display: block;
    }

    .topbar {
        padding-inline: 16px;
    }

    .topbar-left {
        position: relative;
        gap: 8px;
    }

    .module-menu-mobile-toggle {
        display: inline-flex;
        min-width: 0;
        max-width: 180px;
        min-height: 40px;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        border: 1px solid var(--color-border);
        border-radius: var(--border-radius);
        background: var(--color-surface);
        color: var(--color-text);
        padding: 0 11px;
        cursor: pointer;
        font-weight: 700;
    }

    .module-menu-mobile-toggle > span:first-child {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .module-menu-mobile-caret {
        flex: 0 0 auto;
        transition: transform var(--transition-speed) ease;
    }

    .module-menu-mobile-toggle[aria-expanded="true"]
    .module-menu-mobile-caret {
        transform: rotate(180deg);
    }

    .module-menu-shell {
        display: contents;
    }

    .module-menu-scroll,
    .module-menu-shell.has-overflow .module-menu-scroll {
        display: none;
    }

    .module-menu {
        position: absolute;
        top: calc(100% + 8px);
        left: 48px;
        z-index: 30;
        display: none;
        width: min(280px, calc(100vw - 32px));
        max-height: calc(100vh - var(--topbar-height) - 24px);
        align-items: stretch;
        flex-direction: column;
        gap: 3px;
        overflow-x: hidden;
        overflow-y: auto;
        border: 1px solid var(--color-border);
        border-radius: var(--border-radius);
        background: var(--color-surface);
        box-shadow: 0 14px 36px rgb(15 23 42 / 18%);
        padding: 6px;
    }

    .module-menu.is-mobile-open {
        display: flex;
    }

    .module-menu-link {
        width: 100%;
        min-height: 42px;
        flex: 0 0 auto;
    }

    .content-area {
        padding: 18px;
    }

    .user-email {
        display: none;
    }
	
	    .data-toolbar,
    .data-toolbar-main,
    .data-pagination {
        align-items: stretch;
        flex-direction: column;
    }

    .data-toolbar-actions {
        width: 100%;
    }

    .data-search,
    .data-filter,
    .primary-action-button {
        width: 100%;
        max-width: none;
    }

    .data-pagination {
        gap: 12px;
    }

    .pagination {
        justify-content: space-between;
    }
}

.development-state {
    display: flex;
    min-height: 240px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    text-align: center;
}

.development-state h2 {
    margin: 0 0 10px;
    color: var(--color-text);
    font-size: 24px;
}

.development-state p {
    margin: 0;
}

/*
|--------------------------------------------------------------------------
| Application errors
|--------------------------------------------------------------------------
*/

.application-error {
    display: flex;
    min-height: 260px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
}

.application-error-code {
    color: var(--color-text-muted);
    font-size: 48px;
    font-weight: 800;
    line-height: 1;
}

.application-error-message {
    max-width: 620px;
    margin: 0;
    color: var(--color-text-muted);
    line-height: 1.6;
}

.application-error-actions {
    display: flex;
    justify-content: center;
    margin-top: 8px;
}

.application-error-debug {
    width: min(100%, 760px);
    margin-top: 18px;
    border-top: 1px solid var(--color-border);
    padding-top: 20px;
    text-align: left;
}

.application-error-debug h2 {
    margin: 0 0 14px;
    font-size: 18px;
}

.application-error-debug-warning {
    margin-bottom: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    background: var(--color-background);
    padding: 10px 12px;
    font-weight: 700;
    line-height: 1.5;
}

.application-error-debug-list {
    margin: 0;
}

.application-error-debug-list > div {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 12px;
    border-bottom: 1px solid var(--color-border);
    padding: 9px 0;
}

.application-error-debug-list dt {
    color: var(--color-text-muted);
    font-weight: 700;
}

.application-error-debug-list dd {
    min-width: 0;
    margin: 0;
}

.application-error-debug-list code,
.application-error-debug-trace code {
    overflow-wrap: anywhere;
}

.application-error-debug-presentation,
.application-error-debug-trace {
    margin-top: 16px;
}

.application-error-debug-presentation {
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    background: var(--color-background);
    padding: 12px;
}

.application-error-debug-trace-title {
    margin-bottom: 8px;
    color: var(--color-text-muted);
    font-weight: 700;
}

.application-error-debug-trace pre {
    max-height: 360px;
    margin: 0;
    overflow: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    background: var(--color-background);
    padding: 14px;
    white-space: pre-wrap;
    word-break: break-word;
}

.public-error-page {
    min-height: 100vh;
    margin: 0;
    background: var(--color-background);
}

.public-error-shell {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 24px;
}

.public-error-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 800;
}

.public-error-card {
    width: min(100%, 560px);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: var(--color-surface);
    padding: 34px;
    text-align: center;
}

.public-error-card--debug {
    width: min(100%, 860px);
}

.public-error-card h1 {
    margin: 14px 0 10px;
}

@media (max-width: 640px) {
    .application-error-debug-list > div {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .public-error-card {
        padding: 24px;
    }
}
