:root {
    color-scheme: dark light;
    --bg: #10131a;
    --fg: #f2f4f8;
    --accent: #58c4ff;
    --card: #1a1f2b;
    --border: #2b3244;
    --danger: #ff6b6b;
    font-family: "Segoe UI", Arial, sans-serif;
}

html, body {
    min-height: 100vh;
}

body {
    margin: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg) url('crus_logo.png') no-repeat center center fixed;
    background-size: cover;
    color: var(--fg);
}

.topbar {
    background: #0c0f16;
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar h1 {
    margin: 0;
    font-size: 1.4rem;
}

.topbar nav a {
    color: var(--accent);
    text-decoration: none;
    margin-left: 16px;
    font-weight: 600;
}

.container {
    padding: 24px;
    max-width: 1100px;
    margin: 0 auto;
}

main.container {
    flex: 1 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.card h2 {
    margin-top: 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.section-header h2 {
    margin: 0;
}

form {
    display: grid;
    gap: 12px;
}

label {
    font-weight: 600;
}

input, select, textarea {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #141926;
    color: var(--fg);
}

button {
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    background: var(--accent);
    color: #05101d;
    font-weight: 600;
}

button.danger {
    background: var(--danger);
    color: #fff;
}

.button-link {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 8px;
    background: rgba(88, 196, 255, 0.15);
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.button-link:hover {
    background: rgba(88, 196, 255, 0.25);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

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

.footer {
    padding: 16px;
    text-align: center;
    border-top: 1px solid var(--border);
    background: #0c0f16;
    color: #6b748a;
    flex-shrink: 0;
}

.flash {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.flash.success {
    border-color: #2ecc71;
    background: rgba(46, 204, 113, 0.12);
}

.flash.error {
    border-color: var(--danger);
    background: rgba(255, 107, 107, 0.12);
}

.token-block {
    font-family: "Fira Code", monospace;
    font-size: 0.85rem;
    background: #0c0f16;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    overflow-x: auto;
    white-space: pre-wrap;
}

.inline-form {
    display: inline-block;
    margin-left: 8px;
}

button.small {
    padding: 6px 12px;
    font-size: 0.85rem;
}
.form-note {    font-size: 0.85rem;    color: #9aa4b8;   margin: -6px 0 0;}

.auth-tabs {
    display: flex;
    margin-bottom: 20px;
}

.tab-button {
    flex: 1;
    padding: 10px;
    border: none;
    background: var(--border);
    color: var(--fg);
    cursor: pointer;
    font-weight: 600;
    border-radius: 8px 8px 0 0;
    transition: background 0.3s;
}

.tab-button.active {
    background: var(--accent);
    color: #05101d;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.form-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.form-grid > div {
    flex: 1 1 220px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-grid .full-width {
    flex-basis: 100%;
    display: flex;
    justify-content: flex-end;
}

.form-grid button {
    align-self: flex-start;
}

.optional {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.85em;
}

.row-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.table-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 6px;
    background: var(--accent);
    color: #05101d;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.table-action:hover {
    opacity: 0.85;
}

.table-action-danger {
    background: #c0392b;
    color: #fff;
}

.table-action-danger:hover {
    opacity: 0.9;
}

.table-action-secondary {
    background: #2b3244;
    color: var(--fg);
}

.table-action-secondary:hover {
    opacity: 0.85;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

.pagination-pages {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.clients-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 12px;
    gap: 8px;
}

.search-field {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.search-field input {
    padding: 8px 40px 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #141926;
    color: var(--fg);
    min-width: 220px;
}

.search-field input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.search-field .search-icon {
    position: absolute;
    right: 12px;
    width: 20px;
    height: 20px;
    pointer-events: none;
    opacity: 0.75;
}

.search-button,
.search-clear {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #141926;
    color: var(--fg);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.search-button {
    background: var(--accent);
    color: #05101d;
    border: none;
}

.search-button:hover {
    opacity: 0.85;
}

.search-clear:hover {
    opacity: 0.8;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.page-button {
    min-width: 32px;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #141926;
    color: var(--fg);
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.page-button.active {
    background: var(--accent);
    color: #05101d;
}

.page-button[disabled] {
    opacity: 0.4;
    cursor: default;
}

.page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    color: var(--fg);
    opacity: 0.75;
    font-weight: 600;
}

.status-tag {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(88, 196, 255, 0.18);
    color: var(--accent);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-pill.active {
    background: rgba(46, 204, 113, 0.18);
    color: #2ecc71;
}

.status-pill.revoked {
    background: rgba(192, 57, 43, 0.18);
    color: #e74c3c;
}

.status-pill.inactive {
    background: rgba(241, 196, 15, 0.18);
    color: #f1c40f;
}

