* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f4f6f8;
    color: #1a1a2e;
    line-height: 1.5;
}

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

.topbar {
    background: #1a1a2e;
    color: #fff;
}

.topbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    padding-bottom: 16px;
}

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

.card {
    background: #fff;
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.card h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.25rem;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.auth-card {
    background: #fff;
    border-radius: 10px;
    padding: 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.auth-card h1 {
    margin: 0 0 8px;
    font-size: 1.5rem;
}

.subtitle {
    color: #666;
    margin: 0 0 24px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.9rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 1rem;
    margin-bottom: 16px;
}

input:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.btn {
    display: inline-block;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: #4f46e5;
    color: #fff;
}

.btn-primary:hover {
    background: #4338ca;
}

.btn-secondary {
    background: #e5e7eb;
    color: #374151;
}

.btn-secondary:hover {
    background: #d1d5db;
}

.btn-success {
    background: #059669;
    color: #fff;
}

.btn-success:hover {
    background: #047857;
}

.btn-danger {
    background: #dc2626;
    color: #fff;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

.auth-divider {
    text-align: center;
    color: #6b7280;
    margin: 20px 0 16px;
    position: relative;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 42%;
    height: 1px;
    background: #e5e7eb;
}

.auth-divider::before {
    left: 0;
}

.auth-divider::after {
    right: 0;
}

.passkey-register-row {
    align-items: end;
}

.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 16px;
    align-items: end;
}

.form-group {
    margin-bottom: 0;
}

.form-group-sm {
    min-width: 120px;
}

.form-group input {
    margin-bottom: 0;
}

.upload-form {
    margin-top: 8px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
}

th {
    font-weight: 600;
    color: #4b5563;
    background: #f9fafb;
}

.row-expired {
    background: #fef2f2;
}

.row-expired td {
    color: #991b1b;
}

.row-expired .muted {
    color: #b91c1c;
}

.row-inactive {
    background: #f9fafb;
    opacity: 0.85;
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-active {
    background: #d1fae5;
    color: #065f46;
}

.badge-expired {
    background: #fee2e2;
    color: #991b1b;
}

.badge-inactive {
    background: #e5e7eb;
    color: #4b5563;
}

.muted {
    color: #6b7280;
    font-size: 0.85rem;
}

.url-copy {
    display: flex;
    gap: 6px;
    min-width: 200px;
}

.url-input {
    flex: 1;
    min-width: 0;
    padding: 6px 8px;
    font-size: 0.8rem;
    border: 1px solid #d0d5dd;
    border-radius: 4px;
    margin-bottom: 0;
}

.actions {
    min-width: 180px;
}

.inline-form {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.input-sm {
    width: 60px;
    padding: 6px 8px;
    border: 1px solid #d0d5dd;
    border-radius: 4px;
    font-size: 0.85rem;
}

.empty-state {
    color: #6b7280;
    text-align: center;
    padding: 32px;
}

.log-link {
    font-size: 0.85rem;
    color: #4f46e5;
    text-decoration: none;
}

.log-link:hover {
    text-decoration: underline;
}

.ua-cell {
    max-width: 220px;
    word-break: break-word;
}

.row-incomplete {
    background: #fffbeb;
}

code {
    font-size: 0.85rem;
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
}

@media (max-width: 900px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .url-copy {
        flex-direction: column;
    }
}
