* {
    box-sizing: border-box;
}

:root {
    --primary: #1677ff;
    --primary-dark: #0958d9;
    --primary-soft: #eaf3ff;
    --bg: #f3f6fb;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #667085;
    --line: #e5eaf2;
    --success: #16a34a;
    --success-soft: #dcfce7;
    --gray-soft: #f2f4f7;
    --shadow: 0 18px 45px rgba(16, 24, 40, .08);
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background: var(--bg);
}

a {
    color: inherit;
    text-decoration: none;
}

.page-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    padding: 24px 18px;
    color: #fff;
    background: linear-gradient(180deg, #0057e7, #05a8ff);
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 30px;
}

.brand.compact {
    margin-bottom: 24px;
}

.brand-logo {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    flex: 0 0 44px;
    border-radius: 14px;
    color: var(--primary);
    background: #fff;
    font-size: 20px;
    font-weight: 900;
}

.brand h1 {
    margin: 0 0 4px;
    font-size: 18px;
}

.brand p {
    margin: 0;
    color: rgba(255, 255, 255, .78);
    font-size: 12px;
}

.sidebar nav {
    display: grid;
    gap: 10px;
}

.sidebar nav a {
    padding: 12px 14px;
    border-radius: 12px;
    color: rgba(255, 255, 255, .88);
    font-weight: 700;
}

.sidebar nav a.active,
.sidebar nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, .2);
}

.main {
    flex: 1;
    width: 0;
    padding: 28px;
}

.page-title {
    margin-bottom: 18px;
}

.page-title h2 {
    margin: 0 0 6px;
    font-size: 28px;
}

.page-title p,
.list-title p,
.modal-head p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.create-panel,
.list-panel,
.login-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--card);
    box-shadow: var(--shadow);
}

.create-panel {
    padding: 20px;
    margin-bottom: 18px;
}

.create-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) 150px;
    gap: 16px;
    align-items: end;
}

label {
    display: grid;
    gap: 8px;
    margin: 0;
    color: #344054;
    font-weight: 700;
}

label span {
    font-size: 14px;
}

input[type="text"],
input[type="password"],
input[type="file"],
textarea {
    width: 100%;
    min-height: 44px;
    padding: 11px 12px;
    border: 1px solid #d0d7e2;
    border-radius: 12px;
    outline: none;
    background: #fbfcfe;
    color: var(--text);
    font: inherit;
}

textarea {
    min-height: 88px;
    resize: vertical;
}

input:focus,
textarea:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(22, 119, 255, .12);
}

button,
.config-btn,
.cancel-btn,
.modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

button,
.config-btn {
    min-height: 44px;
    padding: 0 18px;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #29b6ff);
    box-shadow: 0 10px 24px rgba(22, 119, 255, .24);
}

.config-btn {
    min-height: 34px;
    padding: 0 14px;
    font-size: 13px;
}

.cancel-btn {
    min-height: 44px;
    padding: 0 18px;
    border-radius: 12px;
    color: var(--primary);
    background: var(--primary-soft);
}

.list-panel {
    padding: 20px;
}

.list-title {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    margin-bottom: 16px;
}

.list-title h3 {
    margin: 0 0 5px;
    font-size: 20px;
}

.table-wrap {
    overflow-x: auto;
}

.user-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 920px;
}

.user-table th {
    padding: 13px 14px;
    color: #667085;
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    text-align: left;
    white-space: nowrap;
}

.user-table th:first-child {
    border-radius: 12px 0 0 12px;
}

.user-table th:last-child {
    border-radius: 0 12px 12px 0;
}

.user-table td {
    padding: 14px;
    border-bottom: 1px solid #eef2f7;
    vertical-align: middle;
    white-space: nowrap;
}

.user-table tbody tr:hover {
    background: #fbfdff;
}

.right {
    text-align: right !important;
}

.account-cell {
    display: flex;
    gap: 10px;
    align-items: center;
}

.account-cell strong {
    display: block;
    font-size: 14px;
}

.account-cell small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.mini-avatar,
.big-avatar {
    display: grid;
    place-items: center;
    overflow: hidden;
    color: #fff;
    background: linear-gradient(135deg, #1677ff, #36c2ff);
    font-weight: 900;
}

.mini-avatar {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 12px;
}

.mini-avatar img,
.big-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

code {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 8px;
    color: var(--primary-dark);
    background: var(--primary-soft);
    font-family: Consolas, Monaco, monospace;
    font-weight: 800;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.success-pill {
    color: #166534;
    background: var(--success-soft);
}

.blue-pill {
    color: var(--primary-dark);
    background: var(--primary-soft);
}

.gray-pill {
    color: #475467;
    background: var(--gray-soft);
}

.muted {
    color: #98a2b3;
}

.empty {
    padding: 42px !important;
    color: var(--muted);
    text-align: center;
}

.alert,
.new-user-tip {
    margin-bottom: 16px;
    padding: 13px 15px;
    border-radius: 14px;
    font-weight: 700;
}

.alert.success,
.new-user-tip {
    color: #166534;
    background: var(--success-soft);
}

.alert.error {
    color: #991b1b;
    background: #fee2e2;
}

.new-user-tip {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.modal-mask {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 23, 42, .48);
    backdrop-filter: blur(4px);
}

.config-modal {
    width: min(720px, 100%);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    padding: 22px;
    border: 1px solid rgba(255, 255, 255, .78);
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 28px 80px rgba(15, 23, 42, .24);
}

.modal-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.modal-head h3 {
    margin: 0 0 6px;
    font-size: 22px;
}

.modal-close {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 999px;
    color: #667085;
    background: #f2f4f7;
    font-size: 24px;
    line-height: 1;
}

.avatar-config {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 16px;
    align-items: center;
    padding: 16px;
    margin-bottom: 18px;
    border: 1px dashed #d0d7e2;
    border-radius: 18px;
    background: #f8fafc;
}

.big-avatar {
    width: 96px;
    height: 96px;
    border-radius: 26px;
    font-size: 34px;
}

.upload-box em {
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.modal-grid label:nth-last-child(-n + 2) {
    grid-column: 1 / -1;
}

.switch-row {
    display: flex;
    gap: 10px;
    align-items: center;
    min-height: 44px;
    padding: 11px 12px;
    border: 1px solid #d0d7e2;
    border-radius: 12px;
    background: #fbfcfe;
}

.switch-row input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.modal-switch {
    align-self: end;
}

.image-link {
    display: inline-flex;
    width: fit-content;
    color: var(--primary);
    font-size: 13px;
    font-weight: 800;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.login-body {
    display: grid;
    place-items: center;
    padding: 24px;
    background: radial-gradient(circle at top left, #e3f2fd, transparent 34%), #f4f7fb;
}

.login-card {
    width: min(420px, 100%);
    padding: 28px;
}

.login-card .brand h1,
.login-card .brand p {
    color: #172033;
}

.login-card .brand p {
    color: #64748b;
}

.login-card .brand-logo {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #29b6ff);
}

.login-card button {
    width: 100%;
}

@media (max-width: 900px) {
    .page-shell {
        display: block;
    }

    .sidebar {
        width: 100%;
        border-radius: 0 0 22px 22px;
    }

    .main {
        width: auto;
        padding: 20px;
    }

    .create-form,
    .modal-grid,
    .avatar-config {
        grid-template-columns: 1fr;
    }
}
