* {
    box-sizing: border-box;
    font-family: "Segoe UI", system-ui, Arial, sans-serif;
}

/* Renders native form controls - including the date field's calendar icon and
   its drop-down calendar - in dark mode, so they stay visible on this theme. */
html {
    color-scheme: dark;
}

body {
    margin: 0;
    background: radial-gradient(circle at top, #1a1f2e 0%, #0b0d14 55%);
    color: #e5e7eb;
    min-height: 100vh;
}

.app-header {
    background: rgba(8, 10, 17, 0.88);
    padding: 16px 28px;
    border-bottom: 1px solid #222a3a;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-header h1 {
    margin: 0;
    font-size: 20px;
}

.app-header a {
    color: #f9fafb;
    text-decoration: none;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    display: block;
    height: 18px;
    width: auto;
}

.brand-divider {
    width: 1px;
    height: 18px;
    background: #2a3245;
}

.container {
    padding: 24px 28px;
    max-width: 1000px;
    margin: 0 auto;
}

.card {
    background: rgba(10, 14, 23, 0.8);
    border: 1px solid #222a3a;
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 20px;
}

.card-narrow {
    max-width: 460px;
    margin: 40px auto;
}

.card h2, .card h3 {
    margin-top: 0;
    color: #f3f4f6;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

label {
    display: flex;
    flex-direction: column;
    font-size: 14px;
    gap: 6px;
    color: #cbd5e1;
    margin-bottom: 14px;
}

input, select, textarea {
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #2e3a4d;
    background: #0f1422;
    color: #e5e7eb;
    width: 100%;
}

input:disabled {
    opacity: 0.6;
}

input[type="date"] {
    cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.75;
    padding: 2px;
    border-radius: 4px;
    transition: opacity 0.15s ease, background 0.15s ease;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
    background: rgba(37, 99, 235, 0.35);
}

button {
    border: none;
    border-radius: 10px;
    background: linear-gradient(120deg, #2563eb, #4f46e5);
    color: #f9fafb;
    padding: 9px 16px;
    cursor: pointer;
    font-weight: 600;
}

.btn-secondary {
    background: #1f2937;
    border: 1px solid #374151;
    color: #d1d5db;
}

.btn-danger {
    background: linear-gradient(120deg, #dc2626, #b91c1c);
}

.btn-success {
    background: linear-gradient(120deg, #16a34a, #15803d);
}

.header-actions {
    display: flex;
    gap: 10px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #0f1422;
    border-radius: 10px;
    overflow: hidden;
}

.data-table th, .data-table td {
    border: 1px solid #20293a;
    padding: 10px;
    text-align: left;
}

.data-table th {
    background: #111827;
    color: #cbd5e1;
    font-size: 12px;
    text-transform: uppercase;
}

.data-table tr.clickable {
    cursor: pointer;
}

.data-table tr.clickable:hover {
    background: #182234;
}

.empty-row td {
    text-align: center;
    padding: 24px;
    color: #8b96ab;
    font-style: italic;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.status-active {
    background: #052e16;
    color: #4ade80;
}

.status-revoked {
    background: #450a0a;
    color: #f87171;
}

.truncate-cell {
    font-family: Consolas, monospace;
    font-size: 13px;
}

.muted {
    color: #9ca3af;
    font-size: 14px;
}

.section-note {
    margin: 4px 0 0;
}

.flash-list {
    margin-bottom: 16px;
}

.flash {
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 8px;
    font-size: 14px;
}

.flash-error {
    background: #450a0a;
    color: #fca5a5;
    border: 1px solid #991b1b;
}

.flash-success {
    background: #052e16;
    color: #86efac;
    border: 1px solid #166534;
}

code {
    font-family: Consolas, monospace;
    background: #0f1422;
    padding: 2px 6px;
    border-radius: 6px;
}

.hidden {
    display: none;
}

.build-log {
    max-height: 260px;
    overflow: auto;
    margin: 12px 0 0;
    padding: 12px;
    border: 1px solid #263043;
    border-radius: 8px;
    background: #0b0e16;
    color: #9fb0c9;
    font-family: Consolas, "Courier New", monospace;
    font-size: 11.5px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Tablets and phones. Tables here run wide (up to 8 columns) - scrolling
   the table horizontally beats squeezing every column, which would make
   every cell unreadable. */
@media (max-width: 900px) {
    .container {
        padding: 16px;
    }

    .card {
        padding: 16px;
    }

    .data-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 600px) {
    .brand-logo {
        height: 15px;
    }

    .app-header {
        padding: 12px 16px;
    }

    .header-top {
        flex-wrap: wrap;
        gap: 10px;
    }

    .app-header h1 {
        font-size: 17px;
    }

    /* Stacked full-width rather than squeezed into one row - the Account
       Actions card alone can hold three buttons (Revoke/Reset/Delete). */
    .header-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .header-actions button {
        width: 100%;
    }

    .section-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .section-header > a,
    .section-header > a button {
        width: 100%;
    }

    .card-narrow {
        margin: 16px auto;
    }

    /* Buttons are the main tap targets on this panel - keep them comfortably
       thumb-sized rather than the desktop-optimized 9px/16px. */
    button {
        padding: 11px 16px;
        font-size: 14.5px;
    }

    .btn-danger {
        margin-left: 0;
    }

    /* Browsers apply their own default font-size to form controls rather
       than inheriting body's - below 16px, iOS Safari zooms the whole page
       in on focus. Explicit here since nothing else in this file sets it. */
    input,
    select,
    textarea {
        font-size: 16px;
    }
}

/* Show/hide button inside password fields - added by password_toggle.js. */
.password-field {
    position: relative;
    display: block;
}

.password-field input {
    width: 100%;
    padding-right: 40px;
}

.password-toggle,
.password-toggle:hover {
    position: absolute;
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 28px;
    min-width: 0;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    box-shadow: none;
    color: #8b96ab;
}

.password-toggle:hover,
.password-toggle:focus-visible {
    color: #e5e7eb;
    background: rgba(148, 163, 184, 0.12);
}

.password-toggle:focus-visible {
    outline: 2px solid #4f46e5;
    outline-offset: 1px;
}
