
:root {
    --bg: #101116;
    --surface: #191b24;
    --surface2: #222531;
    --border: #303443;
    --text: #f3f4f8;
    --muted: #a2a8b8;
    --accent: #7456d8;
    --accent-hover: #896df0;
    --success: #39b878;
    --warning: #e5a940;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 50% -20%, #292044 0, transparent 55%),
        var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
}

.topbar {
    min-height: 68px;
    padding: 15px 4%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    background: rgba(18, 19, 27, .94);
    border-bottom: 1px solid var(--border);
}

.topbar strong {
    font-size: 17px;
}

.topbar .muted {
    margin-left: 12px;
}

.muted, small {
    color: var(--muted);
}

.container {
    max-width: 1400px;
    margin: 38px auto;
    padding: 0 30px;
}

h1 {
    font-size: 30px;
    font-weight: 600;
    margin: 0 0 8px;
}

h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 15px;
}

.nav {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    margin: 28px 0;
}

.nav a {
    color: var(--muted);
    text-decoration: none;
    padding: 13px 20px;
    border-bottom: 3px solid transparent;
    transition: .2s;
}

.nav a:hover {
    color: white;
}

.nav a.active {
    color: white;
    border-bottom-color: var(--accent);
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 26px;
}

.stat, .panel {
    background: linear-gradient(145deg, var(--surface), #171923);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 22px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, .18);
}

.stat span {
    display: block;
    color: var(--muted);
    margin-bottom: 12px;
}

.stat strong {
    font-size: 34px;
    font-weight: 600;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}

th, td {
    padding: 15px 13px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .6px;
    background: rgba(255,255,255,.025);
}

tbody tr {
    transition: background .15s;
}

tbody tr:hover {
    background: rgba(116, 86, 216, .09);
}

.status {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.good {
    background: rgba(57, 184, 120, .15);
    color: #67dda0;
}

.warning {
    background: rgba(229, 169, 64, .15);
    color: #f2c36e;
}

.neutral {
    background: #303443;
    color: #c0c5d1;
}

label {
    display: block;
    margin: 17px 0 8px;
    color: #e5e7ee;
    font-weight: 600;
}

input, select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #3a3e4e;
    border-radius: 7px;
    background: #11131b;
    color: var(--text);
    font-size: 15px;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(116, 86, 216, .18);
}

button {
    margin-top: 22px;
    padding: 12px 22px;
    border: none;
    border-radius: 7px;
    background: var(--accent);
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: .2s;
}

button:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

button.secondary {
    background: #343849;
}

button.secondary:hover {
    background: #454b60;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 22px;
}

.form-grid .full {
    grid-column: 1 / -1;
}

small {
    display: block;
    margin-top: 7px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: normal;
    margin-top: 20px;
}

.checkbox-label input {
    width: auto;
    accent-color: var(--accent);
}

.message {
    padding: 15px 18px;
    border-radius: 8px;
    margin: 18px 0;
}

.message.success {
    background: rgba(57, 184, 120, .14);
    color: #7ce3ac;
    border: 1px solid rgba(57, 184, 120, .3);
}

.message.error {
    background: rgba(220, 70, 70, .14);
    color: #ff9999;
    border: 1px solid rgba(220, 70, 70, .3);
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 35px;
    background: rgba(25, 27, 36, .96);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 20px 70px rgba(0,0,0,.45);
}

.login-card h1 {
    font-size: 32px;
    color: white;
}

.login-card button {
    width: 100%;
}

a {
    color: #a995ff;
}

.logout {
    margin-left: 20px;
}

@media (max-width: 700px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .container {
        margin-top: 24px;
        padding: 0 15px;
    }

    .stats, .form-grid {
        grid-template-columns: 1fr;
    }

    .form-grid .full {
        grid-column: auto;
    }

    .panel {
        padding: 17px;
    }
}

/* Kompakt användarlista med ikoner */
.account-table {
    min-width: 900px;
}

.account-table th,
.account-table td {
    vertical-align: middle;
}

.account-table th {
    white-space: nowrap;
}

.username-cell {
    min-width: 125px;
}

.email-cell {
    min-width: 300px;
}

.email-editor {
    display: flex;
    align-items: center;
    gap: 7px;
}

.email-editor input {
    min-width: 100px;
    flex: 1;
}

.icon-button {
    width: 38px;
    height: 38px;
    min-width: 38px;
    padding: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
}

.ui-icon {
    width: 19px;
    height: 19px;
    display: block;
}

.save-button {
    background: #7456d8;
}

.save-button:hover {
    background: #896df0;
}

.remove-email-form {
    display: inline-block;
    margin-top: 7px;
}

.remove-button {
    background: transparent;
    color: #e58b8b;
    border: 1px solid #55353d;
}

.remove-button:hover {
    background: rgba(220, 70, 70, .15);
    color: #ffaaaa;
}

.icon-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
}

.icon-status .ui-icon {
    width: 18px;
    height: 18px;
}

.icon-status.good {
    color: #67dda0;
    background: transparent;
}

.icon-status.warning {
    color: #f2c36e;
    background: transparent;
}

.icon-status.neutral {
    color: #aeb5c5;
    background: transparent;
}

.icon-status.role-admin {
    color: #b5a0ff;
}

@media (max-width: 700px) {
    .account-table {
        min-width: 850px;
    }
}
