:root {
    --bg: #f7f7f5;
    --panel: #ffffff;
    --panel-soft: #f1f3f6;
    --sidebar: #fbfbfa;
    --text: #111827;
    --muted: #6b7280;
    --soft: #94a3b8;
    --line: #e5e7eb;
    --line-strong: #d7dbe2;
    --accent: #0f172a;
    --accent-soft: #eef2f7;
    --success: #16a34a;
    --danger: #b94a48;
    --shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    --radius-xl: 22px;
    --radius-lg: 18px;
    --radius-md: 14px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    font-family: "Inter", sans-serif;
    background: var(--bg);
}

body,
input,
button {
    font-family: "Inter", sans-serif;
}

a {
    color: inherit;
}

.auth-shell,
.page-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 40px 24px;
}

.auth-card,
.page-card {
    width: min(100%, 520px);
    padding: 44px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.brand-block {
    margin-bottom: 30px;
}

.brand-kicker,
.section-eyebrow,
.content-label {
    display: inline-block;
    margin-bottom: 12px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

h1,
h2,
h3 {
    margin: 0;
    font-family: "Playfair Display", serif;
    font-weight: 600;
    line-height: 1.08;
    letter-spacing: -0.03em;
    color: #0f172a;
}

h1 {
    margin-bottom: 10px;
    font-size: clamp(2rem, 3vw, 3.25rem);
}

h2 {
    font-size: 1.8rem;
}

h3 {
    margin-bottom: 10px;
    font-size: 1.35rem;
}

p {
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

.auth-form {
    display: grid;
    gap: 18px;
}

.auth-message {
    margin-bottom: 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    padding: 12px 14px;
    font-size: 14px;
}

.auth-message-error {
    border-color: #efc2c1;
    background: #fbefef;
    color: var(--danger);
}

.auth-message-success {
    border-color: #c7e4d4;
    background: #edf7f1;
    color: var(--success);
}

.field-group {
    display: grid;
    gap: 8px;
}

label {
    font-size: 13px;
    font-weight: 500;
    color: #334155;
}

input {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    font-size: 15px;
    color: var(--text);
    background: var(--panel);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select {
    font-family: "Inter", sans-serif;
}

input:focus {
    border-color: #94a3b8;
    box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.12);
}

.primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    border: 0;
    border-radius: 999px;
    padding: 15px 22px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    background: #111827;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.primary-button:hover {
    background: #1f2937;
    transform: translateY(-1px);
}

.inline-button {
    width: auto;
    margin-top: 24px;
    padding-inline: 24px;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
}

.app-sidebar {
    border-right: 1px solid var(--line);
    background: var(--sidebar);
}

.app-sidebar-inner {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 28px 18px 22px;
}

.app-brand {
    padding: 0 10px 20px;
}

.app-brand-mark {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.app-logo {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: #fff;
    font-family: "Playfair Display", serif;
    font-size: 16px;
    font-weight: 600;
}

.app-brand-copy h2 {
    font-size: 1.05rem;
    font-family: "Inter", sans-serif;
    font-weight: 700;
    line-height: 1.35;
}

.app-brand-copy p {
    margin-top: 8px;
    font-size: 0.9rem;
    color: var(--muted);
}

.app-nav {
    display: grid;
    gap: 6px;
    padding-top: 8px;
}

.app-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 42px;
    padding: 10px 12px;
    border-radius: 12px;
    color: #475569;
    text-decoration: none;
    font-size: 0.98rem;
    font-weight: 400;
}

.app-nav-link:hover,
.app-nav-link-active {
    background: var(--accent-soft);
    color: var(--accent);
}

.app-nav-icon {
    width: 18px;
    height: 18px;
    border: 1.5px solid currentColor;
    border-radius: 5px;
    opacity: 0.8;
}

.app-support-box {
    margin-top: auto;
    padding: 16px 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #f8fafc;
}

.app-support-box p {
    font-size: 0.9rem;
    line-height: 1.5;
}

.support-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 14px;
    border-radius: 999px;
    padding: 10px 14px;
    background: #16a34a;
    color: #fff;
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
}

.app-user-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
    padding: 16px 10px 0;
    border-top: 1px solid var(--line);
}

.app-user-name {
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 500;
}

.app-user-meta {
    margin-top: 4px;
    font-size: 0.88rem;
    color: var(--muted);
}

.sidebar-logout {
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    color: #334155;
}

.app-content {
    padding: 30px 36px;
}

.app-content-inner {
    max-width: 100%;
}

.content-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.content-topbar h1 {
    margin-bottom: 0;
    font-family: "Inter", sans-serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.content-topbar-note {
    padding: 8px 12px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.metric-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 26px;
}

.metric-card,
.content-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.metric-card {
    padding: 24px 26px;
}

.metric-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    color: #374151;
    font-size: 0.98rem;
}

.metric-card-dot {
    width: 16px;
    height: 16px;
    border: 1px solid #9ca3af;
    border-radius: 50%;
}

.metric-card strong {
    display: block;
    margin-bottom: 6px;
    color: #0f172a;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.04em;
}

.metric-card p {
    font-size: 0.95rem;
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(280px, 0.7fr);
    gap: 16px;
}

.content-card {
    padding: 0;
}

.content-chart-card {
    overflow: hidden;
}

.content-chart-head {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 18px;
    padding: 26px 28px 0;
}

.content-chart-head p {
    max-width: 520px;
}

.chart-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    border-left: 1px solid var(--line);
}

.chart-summary div {
    padding: 22px 24px;
    min-width: 120px;
}

.chart-summary div + div {
    border-left: 1px solid var(--line);
}

.chart-summary span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.9rem;
}

.chart-summary strong {
    color: #0f172a;
    font-size: 1.05rem;
    font-weight: 700;
}

.chart-placeholder {
    position: relative;
    height: 320px;
    margin-top: 24px;
    border-top: 1px solid var(--line);
    padding: 32px 28px 28px;
}

.chart-grid {
    position: absolute;
    inset: 32px 28px 28px;
    background:
        repeating-linear-gradient(
            to top,
            transparent 0,
            transparent 52px,
            #e5e7eb 52px,
            #e5e7eb 54px
        );
    border-bottom: 1px solid var(--line);
}

.chart-bars {
    position: relative;
    z-index: 1;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    align-items: end;
    gap: 18px;
    padding: 0 26px;
}

.chart-bars span {
    display: block;
    border-radius: 12px 12px 0 0;
    background: #1f2937;
}

.content-side-card {
    padding: 26px 24px;
}

.content-profile-card {
    padding: 26px 24px;
}

.content-profile-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.profile-badge {
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel-soft);
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.profile-form {
    display: grid;
    gap: 18px;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.profile-grid-full {
    grid-column: 1 / -1;
}

.profile-actions {
    display: flex;
    justify-content: flex-start;
}

.profile-save-button {
    width: auto;
    min-width: 200px;
}

.users-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.users-grid-lower {
    align-items: start;
}

.users-card {
    padding: 24px;
}

.users-form {
    display: grid;
    gap: 18px;
}

.users-form-compact {
    gap: 14px;
}

.app-select,
.app-select-inline,
.app-input-inline {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    background: var(--panel);
    color: var(--text);
    font-size: 14px;
}

.users-checkbox-list {
    max-height: 200px;
    overflow: auto;
    display: grid;
    gap: 10px;
    padding: 6px 2px;
}

.users-checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--text);
    font-size: 0.95rem;
}

.users-checkbox-item small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
}

.permissions-matrix {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fafafa;
}

.permissions-row {
    display: grid;
    grid-template-columns: minmax(110px, 1fr) 80px 90px;
    gap: 12px;
    align-items: center;
    font-size: 0.94rem;
    color: var(--text);
}

.permissions-module {
    font-weight: 600;
}

.template-list {
    display: grid;
    gap: 10px;
}

.template-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fbfbfc;
}

.template-item strong {
    font-size: 0.96rem;
}

.template-item span {
    color: var(--muted);
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.users-table-card {
    margin-top: 8px;
    padding: 24px;
}

.users-table-head {
    margin-bottom: 16px;
}

.users-table {
    display: grid;
    gap: 12px;
}

.users-row {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fcfcfd;
}

.users-row-main {
    display: grid;
    grid-template-columns: 1.2fr 1.4fr 0.8fr 0.8fr 1fr;
    gap: 12px;
}

.users-row-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.user-chip {
    margin-right: auto;
    padding: 7px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 600;
}

.table-action {
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    padding: 9px 14px;
    background: #fff;
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
}

.table-action-danger {
    border-color: #efc2c1;
    color: var(--danger);
}

.content-list {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    line-height: 1.8;
}

.content-list li + li {
    margin-top: 6px;
}

@media (max-width: 1100px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .app-sidebar-inner {
        min-height: auto;
    }

    .app-content {
        padding: 24px 20px;
    }

    .metric-row,
    .content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .auth-shell,
    .page-shell,
    .app-content {
        padding: 20px 16px;
    }

    .auth-card,
    .page-card {
        padding: 28px 24px;
    }

    .app-sidebar-inner {
        padding: 20px 14px;
    }

    .content-topbar,
    .content-chart-head,
    .content-profile-head {
        flex-direction: column;
    }

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

    .users-row-main {
        grid-template-columns: 1fr;
    }

    .users-row-meta {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .permissions-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

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

    .chart-summary {
        grid-template-columns: 1fr 1fr;
        border-left: 0;
        border-top: 1px solid var(--line);
        width: 100%;
    }

    .chart-summary div {
        padding: 16px 18px;
    }

    .chart-placeholder {
        height: 240px;
        padding-inline: 16px;
    }

    .chart-grid {
        inset: 32px 16px 28px;
    }

    .chart-bars {
        gap: 10px;
        padding: 0 10px;
    }
}
