:root {
    --primary: #0d6efd;
    --primary-soft: #eaf4ff;
    --danger: #dc2626;
    --text: #334155;
    --heading: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --surface: #ffffff;
    --background: #f4f7fb;
    --sidebar-width: 258px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--background);
    font-family: "Inter", sans-serif;
    font-size: 14px;
}

a {
    color: var(--primary);
}

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

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1030;
    display: flex;
    width: var(--sidebar-width);
    flex-direction: column;
    border-right: 1px solid var(--line);
    background: var(--surface);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #0057d9;
}

.brand-mark {
    color: #e30613;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -8px;
    transform: skew(-8deg);
}

.brand strong {
    color: var(--heading);
    font-size: 16px;
}

.brand small {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 400;
}

.sidebar-brand {
    height: 72px;
    padding: 0 24px;
    border-bottom: 1px solid var(--line);
}

.sidebar nav {
    flex: 1;
    overflow-y: auto;
    padding: 18px 12px;
}

.menu-title {
    display: block;
    margin: 10px 9px 7px;
    color: #94a3b8;
    font-size: 0.70rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.sidebar nav a {
    display: flex;
    min-height: 48px;
    align-items: center;
    gap: 12px;
    margin-bottom: 3px;
    padding: 0 13px;
    border-radius: 12px;
    color: #52637c;
    font-weight: 600;
    text-decoration: none;
}

.sidebar nav a i {
    width: 18px;
    color: #64748b;
    font-size: 17px;
}

.sidebar nav a.active {
    color: #0780ef;
    background: var(--primary-soft);
}

.sidebar nav a.active i {
    color: #0780ef;
}

.sidebar nav a.disabled {
    opacity: 0.55;
    pointer-events: none;
}

.sidebar nav a small {
    margin-left: auto;
    font-size: 10px;
}

.sidebar footer {
    padding: 14px 18px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}

.app-main {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    height: 73px;
    align-items: center;
    gap: 12px;
    padding: 0 28px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
}

.btn-menu,
.btn-logout {
    display: inline-flex;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 13px;
    color: var(--text);
    background: white;
}

.page-heading small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.page-heading h1 {
    margin: -1px 0 0;
    color: var(--heading);
    font-size: 21px;
    font-weight: 700;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.avatar {
    display: inline-flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #0780ef;
    background: var(--primary-soft);
    font-weight: 700;
}

.user-name {
    line-height: 1.15;
}

.user-name strong,
.user-name small {
    display: block;
}

.user-name small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
}

.content {
    width: min(100% - 42px, 1260px);
    margin: 26px auto;
}

.panel-card,
.welcome-card,
.summary-card {
    border: 1px solid var(--line);
    border-radius: 17px;
    background: var(--surface);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.welcome-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px;
}

.welcome-card h2 {
    margin: 5px 0 8px;
    color: var(--heading);
    font-size: 24px;
    font-weight: 700;
}

.welcome-card p,
.summary-card p,
.panel-heading p {
    margin: 0;
    color: var(--muted);
}

.welcome-card > i {
    color: #cfe8ff;
    font-size: 72px;
}

.eyebrow {
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 18px;
}

.summary-card {
    padding: 22px;
}

.summary-card > span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.summary-card > strong {
    display: block;
    margin: 10px 0 7px;
    color: var(--heading);
    font-size: 20px;
}

.panel-card {
    margin-bottom: 18px;
    padding: 18px;
}

.panel-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
}

.panel-heading {
    min-width: 260px;
}

.panel-heading h2 {
    margin: 0 0 2px;
    color: var(--heading);
    font-size: 17px;
    font-weight: 700;
}

.toolbar-actions {
    display: flex;
    flex: 1;
    justify-content: flex-end;
    gap: 10px;
}

.form-page-toolbar {
    justify-content: space-between;
}

.form-page-heading {
    flex: 1;
    min-width: 0;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 12px;
    text-decoration: none;
}

.form-actions {
    display: flex;
    flex-shrink: 0;
    gap: 10px;
    margin-left: auto;
}

.record-card {
    padding: 22px 18px;
}

.record-card-heading {
    margin-bottom: 18px;
}

.record-card-heading h2 {
    margin: 0 0 3px;
    color: var(--heading);
    font-size: 17px;
    font-weight: 700;
}

.record-card-heading p,
.form-help {
    margin: 0;
    color: var(--muted);
}

.form-help {
    margin-top: 5px;
    font-size: 12px;
}

.search-box {
    position: relative;
    width: min(100%, 410px);
}

.search-box i {
    position: absolute;
    top: 50%;
    left: 13px;
    color: var(--muted);
    transform: translateY(-50%);
}

.search-box input {
    padding-left: 38px;
}

.table {
    margin: 0;
    color: var(--text);
}

.table thead th {
    padding: 11px 8px;
    border-bottom-color: var(--line);
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.table tbody td {
    padding: 12px 8px;
    border-bottom-color: #edf1f6;
    vertical-align: middle;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.status-badge.active {
    color: #008246;
    background: #e8f8ef;
}

.status-badge.inactive {
    color: #9f1239;
    background: #fff1f2;
}

.empty-state {
    padding: 35px !important;
    color: var(--muted);
    text-align: center;
}

.modal-content {
    border: 0;
    border-radius: 17px;
}

.modal-header,
.modal-footer {
    border-color: var(--line);
}

.form-label {
    color: var(--heading);
    font-size: 13px;
    font-weight: 600;
}

.form-control,
.form-select {
    min-height: 40px;
    border-color: #d7dee8;
    font-size: 14px;
}

.permission-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.permission-item {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.login-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 18px;
    background: #f4f8fc;
}

.login-card {
    width: min(100%, 430px);
    padding: 35px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: white;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.09);
}

.brand-login {
    margin-bottom: 28px;
}

.login-card h1 {
    margin: 0 0 8px;
    color: var(--heading);
    font-size: 28px;
    font-weight: 700;
}

.login-card > p {
    margin-bottom: 26px;
    color: var(--muted);
    line-height: 1.6;
}

.google-button {
    min-height: 42px;
}

.form-message {
    margin-top: 16px;
    padding: 10px;
    border-radius: 10px;
    font-size: 13px;
}

.form-message.error {
    color: #991b1b;
    background: #fee2e2;
}

.form-message.success {
    color: #166534;
    background: #dcfce7;
}

.login-card footer {
    margin-top: 28px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.sidebar-overlay {
    display: none;
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

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

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 1025;
        background: rgba(15, 23, 42, 0.42);
    }

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

    .app-main {
        margin-left: 0;
    }

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

@media (max-width: 650px) {
    .topbar {
        padding: 0 14px;
    }

    .user-name {
        display: none;
    }

    .content {
        width: calc(100% - 24px);
        margin-top: 14px;
    }

    .welcome-card {
        padding: 20px;
    }

    .welcome-card > i {
        display: none;
    }

    .panel-toolbar,
    .toolbar-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .form-page-toolbar {
        align-items: stretch;
    }

    .form-actions {
        width: 100%;
    }

    .form-actions .btn {
        flex: 1;
    }

    .toolbar-actions .btn,
    .search-box {
        width: 100%;
    }

    .permission-list {
        grid-template-columns: 1fr;
    }
}
