/* Imetame-inspired application shell */
:root {
    --primary: #009b50;
    --primary-strong: #007a3f;
    --primary-dark: #006b37;
    --bg: #f3f3f3;
    --surface-muted: #f0f3f1;
    --sidebar-width: 252px;
}

.app-shell {
    background: var(--bg);
}

.sidebar {
    padding: 0;
    background: #ffffff;
    color: var(--text);
    border-right: 1px solid #d5d8dc;
    box-shadow: 3px 0 10px rgba(15, 23, 42, 0.08);
}

.brand {
    display: grid;
    justify-items: center;
    gap: 5px;
    min-height: 104px;
    margin: 0;
    padding: 16px 18px 10px;
    background: var(--primary);
    color: #ffffff;
    text-align: center;
}

.brand > div {
    display: grid;
    gap: 2px;
}

.brand-logo {
    display: block;
    width: min(136px, 100%);
    height: auto;
}

.imetame-mark {
    width: 42px;
    height: 34px;
    border-radius: 0;
    background: transparent;
    color: #ffffff;
    font-size: 32px;
    line-height: 1;
    font-weight: 900;
}

.brand strong {
    color: #ffffff;
    font-size: 21px;
    letter-spacing: 0.03em;
}

.brand small {
    color: rgba(255, 255, 255, 0.86);
    font-size: 10px;
    text-transform: uppercase;
}

.sidebar-profile {
    display: grid;
    justify-items: center;
    gap: 7px;
    padding: 18px 16px 22px;
    background: var(--primary);
    color: #ffffff;
    text-align: center;
}

.sidebar-profile .avatar {
    display: grid;
    width: 70px;
    height: 70px;
    place-items: center;
    border: 4px solid #ffffff;
    border-radius: 50%;
    background: #dbe6df;
    color: var(--primary-strong);
    font-size: 28px;
    font-weight: 800;
}

.sidebar-profile strong {
    max-width: 100%;
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-profile small {
    max-width: 100%;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.72);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-list {
    gap: 10px;
    padding: 22px 0;
}

.nav-heading {
    padding: 0 20px 10px;
    color: #8a929c;
    font-size: 12px;
    letter-spacing: 0;
    text-transform: uppercase;
}

.nav-link {
    min-height: 44px;
    margin: 0 14px;
    padding: 11px 16px;
    border-radius: 999px;
    color: #2c333a;
    font-size: 14px;
}

.nav-link:hover,
.nav-link.active {
    background: var(--primary);
    color: #ffffff;
}

.nav-dot {
    width: 14px;
    height: 14px;
    border: 1px solid currentColor;
    border-radius: 3px;
    background: transparent;
}

.nav-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

.nav-group-toggle:hover {
    color: var(--primary-strong);
}

.nav-group-caret {
    width: 8px;
    height: 8px;
    margin-left: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform 160ms ease;
}

.nav-section.is-collapsed .nav-group-caret {
    transform: rotate(-45deg);
}

.nav-group-content {
    display: grid;
    gap: 6px;
}

.main-area {
    background: var(--bg);
}

.topbar {
    min-height: 56px;
    padding: 0 18px 0 24px;
    background: var(--primary);
    border-bottom: 1px solid rgba(0, 0, 0, 0.14);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.16);
}

.topbar-kicker {
    color: rgba(255, 255, 255, 0.7);
}

.topbar h1 {
    color: #ffffff;
    font-size: 21px;
    font-weight: 500;
}

.menu-toggle,
.notification-menu summary,
.user-menu summary {
    border-color: rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.menu-toggle span {
    background: #ffffff;
}

.bell-icon {
    border-color: #ffffff;
}

.content {
    width: 100%;
    max-width: none;
    padding: 28px 24px;
}

.user-menu {
    position: relative;
}

.user-menu summary {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 42px;
    padding: 0 8px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #ffffff;
    cursor: pointer;
    list-style: none;
}

.user-menu summary::-webkit-details-marker {
    display: none;
}

.avatar.small {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: var(--primary);
    font-weight: 800;
}

.user-menu summary span:last-child {
    max-width: none;
}

.user-menu summary span:not(.avatar):not(.user-menu-caret) {
    max-width: 210px;
    overflow: hidden;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-caret {
    width: 7px;
    height: 7px;
    border-right: 2px solid rgba(255, 255, 255, 0.9);
    border-bottom: 2px solid rgba(255, 255, 255, 0.9);
    transform: rotate(45deg) translateY(-2px);
}

.user-menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 70;
    display: grid;
    gap: 0;
    width: 270px;
    padding: 8px 0;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: #ffffff;
    color: var(--text);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}

.user-menu-panel strong {
    padding: 10px 16px 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-panel small {
    padding: 0 16px 10px;
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-section {
    display: grid;
    padding: 8px 0;
    border-top: 1px solid var(--line);
}

.user-menu-section > span {
    padding: 2px 16px 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.user-menu-panel a,
.user-menu-panel button {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 42px;
    width: 100%;
    padding: 10px 16px;
    border: 0;
    border-radius: 0;
    background: #ffffff;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}

.user-menu-panel a {
    color: var(--primary-strong);
}

.user-menu-panel > a,
.user-menu-panel > form {
    border-top: 1px solid var(--line);
}

.user-menu-panel a:hover,
.user-menu-panel button:hover {
    background: #f3f6f4;
}

.auth-page {
    background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.08), transparent 36%), var(--primary-dark);
}

.auth-shell {
    width: min(348px, calc(100vw - 32px));
}

.login-panel {
    display: grid;
    gap: 24px;
    padding: 48px 30px 42px;
    border: 0;
    border-radius: 0;
    box-shadow: 0 22px 52px rgba(0, 0, 0, 0.3);
}

.login-brand {
    display: grid;
    justify-items: center;
    gap: 2px;
    margin: 0 0 8px;
    color: var(--primary);
    text-align: center;
}

.login-logo {
    display: block;
    width: 190px;
    max-width: 100%;
    height: auto;
}

.login-brand .imetame-mark {
    color: var(--primary);
    font-size: 54px;
}

.login-brand strong {
    color: var(--primary);
    font-size: 32px;
    letter-spacing: 0.03em;
}

.login-brand small {
    color: #9aa4a0;
    font-size: 9px;
    text-transform: uppercase;
}

.login-panel h1 {
    margin: 0;
    font-size: 17px;
    font-weight: 400;
    text-align: center;
}

.login-panel .form-grid {
    gap: 18px;
}

.login-panel .form-grid label {
    gap: 5px;
    font-size: 11px;
}

.login-panel input {
    min-height: 38px;
    border-radius: 4px;
}

.login-help-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}

.remember-line {
    display: inline-flex !important;
    align-items: center;
    gap: 7px;
    color: var(--text) !important;
    font-size: 13px !important;
    font-weight: 400 !important;
}

.remember-line input {
    width: auto;
    min-height: auto;
}

.login-help-row a {
    color: var(--primary);
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
}

.auth-secondary-link {
    display: flex;
    justify-content: center;
    margin-top: 16px;
}

.auth-secondary-link a {
    color: var(--primary);
    text-decoration: none;
    font-size: 12px;
    font-weight: 800;
}

.login-panel .primary-button {
    width: min(200px, 100%);
    margin: 2px auto 0;
    min-height: 34px;
    border-radius: 4px;
    background: var(--primary);
    box-shadow: 0 3px 7px rgba(0, 0, 0, 0.25);
}

.register-box {
    display: grid;
    gap: 14px;
    padding-top: 4px;
    border-top: 1px solid var(--line);
}

.register-box summary {
    display: flex;
    justify-content: center;
    color: var(--primary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    list-style: none;
}

.register-box summary::-webkit-details-marker {
    display: none;
}

.register-box .form-grid {
    margin-top: 14px;
}

.register-box .secondary-button {
    width: min(200px, 100%);
    margin: 0 auto;
    min-height: 34px;
    border-radius: 4px;
}

@media (max-width: 900px) {
    .sidebar,
    body.sidebar-collapsed .sidebar {
        width: min(252px, 82vw);
        padding: 0;
        border-right: 0;
        background: #ffffff;
    }

    body.sidebar-collapsed.sidebar-expanded .sidebar {
        padding: 0;
    }

    .topbar {
        min-height: 64px;
        padding: 8px 10px;
        gap: 10px;
    }

    .topbar > div {
        min-width: 0;
        flex: 1;
    }

    .topbar h1 {
        overflow: hidden;
        font-size: 20px;
        line-height: 1.18;
        text-overflow: ellipsis;
    }

    .menu-toggle,
    .notification-menu summary,
    .user-menu summary {
        width: 42px;
        height: 42px;
        flex: 0 0 42px;
        border-radius: 0;
    }

    .notification-menu {
        margin-left: 0;
    }

    .user-menu summary {
        padding: 0;
    }

    .user-menu summary span:not(.avatar):not(.user-menu-caret),
    .user-menu-caret {
        display: none;
    }

    .user-menu-panel {
        position: fixed;
        top: 62px;
        right: 10px;
        left: 10px;
        width: auto;
    }

    .content {
        padding: 14px;
    }

    .panel {
        padding: 14px;
        border-radius: 8px;
    }

    .panel-header h2 {
        font-size: 20px;
    }

}

@media (max-width: 520px) {
    .dashboard-summary {
        grid-template-columns: 1fr;
    }

    .topbar {
        gap: 6px;
        padding: 8px;
    }

    .topbar h1 {
        font-size: 17px;
    }

    .menu-toggle,
    .notification-menu summary,
    .user-menu summary {
        width: 40px;
        height: 40px;
        flex-basis: 40px;
    }

}

@media (max-width: 900px) {
    .company-page,
    .process-page,
    .unit-page,
    .document-type-page {
        grid-template-columns: 1fr;
    }

    .company-page .table-wrap,
    .process-page .table-wrap,
    .unit-page .table-wrap,
    .document-type-page .table-wrap {
        overflow: visible;
    }

    .company-page .data-table,
    .process-page .data-table,
    .unit-page .data-table,
    .document-type-page .data-table {
        min-width: 0;
    }

    .company-page .data-table,
    .company-page .data-table tbody,
    .company-page .data-table tr,
    .company-page .data-table td,
    .process-page .data-table,
    .process-page .data-table tbody,
    .process-page .data-table tr,
    .process-page .data-table td,
    .unit-page .data-table,
    .unit-page .data-table tbody,
    .unit-page .data-table tr,
    .unit-page .data-table td,
    .document-type-page .data-table,
    .document-type-page .data-table tbody,
    .document-type-page .data-table tr,
    .document-type-page .data-table td {
        display: block;
        width: 100%;
    }

    .company-page .data-table thead,
    .process-page .data-table thead,
    .unit-page .data-table thead,
    .document-type-page .data-table thead {
        display: none;
    }

    .company-page .data-table tbody,
    .process-page .data-table tbody,
    .unit-page .data-table tbody,
    .document-type-page .data-table tbody {
        display: grid;
        gap: 12px;
    }

    .company-page .data-table tr,
    .process-page .data-table tr,
    .unit-page .data-table tr,
    .document-type-page .data-table tr {
        padding: 12px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: #ffffff;
    }

    .company-page .data-table td,
    .process-page .data-table td,
    .unit-page .data-table td,
    .document-type-page .data-table td {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
        padding: 9px 0;
        border-bottom: 1px solid var(--line);
        word-break: break-word;
    }

    .company-page .data-table td:last-child,
    .process-page .data-table td:last-child,
    .unit-page .data-table td:last-child,
    .document-type-page .data-table td:last-child {
        border-bottom: 0;
    }

    .company-page .data-table td::before,
    .process-page .data-table td::before,
    .unit-page .data-table td::before,
    .document-type-page .data-table td::before {
        content: attr(data-label);
        flex: 0 0 42%;
        color: var(--muted);
        font-size: 12px;
        font-weight: 800;
    }

    .company-page .data-table td.actions,
    .process-page .data-table td.actions,
    .unit-page .data-table td.actions,
    .document-type-page .data-table td.actions {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        white-space: normal;
    }

    .company-page .data-table td.actions::before,
    .process-page .data-table td.actions::before,
    .unit-page .data-table td.actions::before,
    .document-type-page .data-table td.actions::before {
        content: none;
    }

    .company-page .actions form,
    .process-page .actions form,
    .unit-page .actions form,
    .document-type-page .actions form {
        display: inline-flex;
    }
}

