/* ===== Admin-specific layout ===== */

#admin-badge {
    font-size: 11px;
    background: var(--accent);
    color: var(--bg);
    padding: 2px 7px;
    border-radius: 2px;
    vertical-align: middle;
    margin-left: 8px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

#user-link {
    color: var(--accent);
    font-size: 12px;
    text-decoration: none;
    margin-right: 12px;
    border: 1px solid var(--accent);
    padding: 2px 10px;
    border-radius: 2px;
}

#user-link:hover {
    background: var(--accent);
    color: var(--bg);
}

#admin-layout {
    display: flex;
    min-height: calc(100vh - 57px);
}

/* ===== Sidebar nav ===== */

#admin-nav {
    width: 160px;
    flex-shrink: 0;
    background: #0c1015;
    border-right: 1px solid var(--border);
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: block;
    width: 100%;
    background: transparent;
    border: none;
    border-radius: 0;
    border-left: 2px solid transparent;
    color: var(--muted);
    text-align: left;
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
    margin-top: 0;
}

.nav-item:hover {
    background: var(--panel);
    color: var(--text);
}

.nav-item.active {
    color: var(--accent);
    border-left-color: var(--accent);
    background: var(--panel);
}

/* ===== Content area ===== */

#admin-content {
    flex: 1;
    padding: 24px 28px;
    overflow-y: auto;
}

.admin-section {
    max-width: 960px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.section-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    text-transform: none;
    letter-spacing: 0;
}

/* ===== Action buttons ===== */

.action-btn {
    background: #1f2c3f;
    color: var(--text);
    border: 1px solid var(--border);
    padding: 5px 14px;
    font-size: 12px;
    border-radius: 2px;
    cursor: pointer;
    margin-top: 0;
}

.action-btn:hover {
    background: var(--border);
    color: var(--text);
}

.action-btn.accent {
    color: var(--accent);
    border-color: var(--accent);
}

.action-btn.accent:hover {
    background: var(--accent);
    color: var(--bg);
}

.action-btn.danger {
    color: var(--red);
    border-color: var(--red);
}

.action-btn.danger:hover {
    background: var(--red);
    color: #fff;
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

/* ===== Admin tables ===== */

.table-scroll table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table-scroll th,
.table-scroll td {
    padding: 7px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table-scroll th {
    color: var(--muted);
    font-weight: normal;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.table-scroll tr:last-child td {
    border-bottom: none;
}

.table-scroll td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}

.table-scroll td.code {
    font-family: monospace;
    font-size: 12px;
    color: var(--text);
    letter-spacing: 0.04em;
}

.table-scroll td.muted {
    color: var(--muted);
}

/* ===== Admin badges ===== */

.badge-admin {
    background: var(--accent);
    color: var(--bg);
    padding: 1px 6px;
    border-radius: 2px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-used {
    color: var(--muted);
    font-size: 12px;
}

.badge-unused {
    color: var(--green);
    font-size: 12px;
}

/* ===== New invite code box ===== */

.new-code-box {
    background: #1a2a1a;
    border: 1px solid var(--green);
    color: var(--green);
    padding: 10px 14px;
    border-radius: 2px;
    font-family: monospace;
    font-size: 14px;
    letter-spacing: 0.08em;
    margin-bottom: 16px;
    word-break: break-all;
}

.new-code-box a {
    color: var(--green);
}

.new-code-box .action-btn {
    margin-left: 10px;
    vertical-align: middle;
}

.reset-expiry {
    color: var(--muted);
    font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 12px;
    letter-spacing: 0;
}

.action-cell {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ===== Migration groups ===== */

.migration-group {
    margin-bottom: 20px;
}

.migration-group-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.pending-title { color: var(--accent); }
.done-title    { color: var(--green); }

.migration-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.migration-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 2px;
    font-size: 12px;
    font-family: monospace;
}

.migration-item .mig-name {
    color: var(--text);
}

.migration-item .mig-date {
    color: var(--muted);
    font-size: 11px;
}

.migration-item.pending {
    border-left: 2px solid var(--accent);
}

.migration-item.done {
    border-left: 2px solid var(--green);
}

/* ===== Confirm dialog overlay ===== */

/* display:flex below would override the HTML hidden attribute without this guard */
.overlay[hidden] { display: none; }

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.dialog {
    min-width: 300px;
    max-width: 480px;
    padding: 24px;
}

.dialog p {
    margin: 0 0 16px;
    font-size: 14px;
}

.dialog-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ===== Toggle switch (reuse from style.css pattern) ===== */

.toggle-cell {
    display: flex;
    align-items: center;
    gap: 6px;
}

.toggle-cell input[type="checkbox"] {
    display: none;
}

.toggle-cell .toggle-slider {
    display: inline-block;
    width: 30px;
    height: 16px;
    background: var(--border);
    border-radius: 8px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.toggle-cell .toggle-slider::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--muted);
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.2s, background 0.2s;
}

.toggle-cell input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle-cell input:checked + .toggle-slider::after {
    transform: translateX(14px);
    background: #fff;
}

/* ===== Add universe form ===== */

.app-create-header {
    margin-top: 24px;
}

.add-form {
    max-width: 360px;
}

.add-form label {
    margin-bottom: 12px;
}

.add-form .hint {
    margin: 0 0 10px;
}

.add-form em {
    font-style: normal;
    font-family: monospace;
    color: var(--text);
}
