:root {
    --purple: #7413dc;
    --purple-dark: #4f0c9e;
    --purple-light: #f4edff;
    --white: #ffffff;
    --text: #222222;
    --muted: #666666;
    --border: #e5d8f7;
    --background: #f7f3fc;
    --shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--background);
    color: var(--text);
}

.top-header {
    background: var(--purple);
    color: var(--white);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    background: var(--white);
    color: var(--purple);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: bold;
}

.brand-title {
    font-size: 21px;
    font-weight: bold;
}

.brand-subtitle {
    font-size: 14px;
    opacity: 0.9;
}

.user-bar {
    font-size: 14px;
}

.user-bar a {
    color: var(--white);
    margin-left: 14px;
    font-weight: bold;
    text-decoration: none;
}

.main-nav {
    width: 220px;
    min-height: calc(100vh - 74px);
    background: var(--white);
    border-right: 1px solid var(--border);
    padding: 18px 14px;
    position: fixed;
    left: 0;
    top: 74px;
}

.main-nav a {
    display: block;
    padding: 11px 12px;
    margin-bottom: 8px;
    border-radius: 9px;
    color: var(--purple-dark);
    text-decoration: none;
    font-weight: bold;
}

.main-nav a:hover {
    background: var(--purple-light);
}

.container {
    margin-left: 220px;
    padding: 24px;
}

.card {
    background: var(--white);
    border-radius: 14px;
    padding: 22px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.card h1,
.card h2,
.card h3 {
    margin-top: 0;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.stat-card {
    background: var(--white);
    border-radius: 14px;
    padding: 18px;
    box-shadow: var(--shadow);
}

.stat-card h3 {
    margin-top: 0;
    color: var(--purple-dark);
}

.big-number {
    font-size: 36px;
    font-weight: bold;
    color: var(--purple);
    margin: 8px 0;
}

input,
select,
textarea {
    width: 100%;
    max-width: 420px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
}

textarea {
    min-height: 90px;
}

input[type="checkbox"] {
    width: auto;
    max-width: none;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--purple-light);
    border-color: var(--purple);
}

button,
.button,
.quick-button {
    display: inline-block;
    background: var(--purple);
    color: var(--white);
    border: none;
    border-radius: 9px;
    padding: 10px 15px;
    font-size: 15px;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
    margin: 2px 0;
}

button:hover,
.button:hover,
.quick-button:hover {
    background: var(--purple-dark);
}

.footer {
    margin-left: 220px;
    padding: 20px 24px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
}

th,
td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--purple-dark);
    font-weight: bold;
}

td a {
    color: var(--purple-dark);
    font-weight: bold;
}

.notice {
    background: var(--purple-light);
    border-left: 4px solid var(--purple);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.error {
    background: #ffecec;
    border-left: 4px solid #c62828;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.success {
    background: #eefbea;
    border-left: 4px solid #2e7d32;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: bold;
}

.status-active {
    background: #eefbea;
    color: #2e7d32;
}

.status-disabled {
    background: #ffecec;
    color: #c62828;
}

.status-warning {
    background: #fff8e1;
    color: #8a5a00;
}

.app-badge {
    display: inline-block;
    background: var(--purple-light);
    color: var(--purple-dark);
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: bold;
    margin: 2px;
}

.mobile-user-list {
    display: none;
}

.user-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: var(--shadow);
}

.user-card h3 {
    margin: 0 0 8px 0;
}

.user-meta {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 10px;
}

.user-card-section {
    margin-top: 12px;
}

.user-card-section strong {
    display: block;
    margin-bottom: 4px;
    color: var(--purple-dark);
}

@media (max-width: 900px) {
    .top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 14px 16px;
    }

    .brand-title {
        font-size: 18px;
    }

    .brand-subtitle {
        font-size: 13px;
    }

    .user-bar {
        width: 100%;
    }

    .main-nav {
        position: static;
        width: 100%;
        min-height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        padding: 10px;
    }

    .main-nav a {
        margin-bottom: 0;
        padding: 9px 10px;
        font-size: 14px;
    }

    .container {
        margin-left: 0;
        padding: 14px;
    }

    .footer {
        margin-left: 0;
    }

    .card {
        padding: 16px;
        border-radius: 12px;
    }

    input,
    select,
    textarea {
        max-width: 100%;
    }

    .desktop-table {
        display: none;
    }

    .mobile-user-list {
        display: block;
    }
}

@media (max-width: 520px) {
    .brand-mark {
        width: 36px;
        height: 36px;
        font-size: 22px;
    }

    .card h1 {
        font-size: 24px;
    }

    .card h2 {
        font-size: 20px;
    }

    button,
    .button,
    .quick-button {
        width: 100%;
        text-align: center;
        margin-bottom: 6px;
    }

    .main-nav a {
        flex: 1 1 45%;
        text-align: center;
    }
}