:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #d1d5db;
    --surface: #ffffff;
    --background: #f3f4f6;
    --error: #b91c1c;
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--background);
}

h1 {
    font-size: 1.5rem;
    margin: 0 0 0.5rem;
}

h1:focus {
    outline: none;
}

a {
    color: var(--primary);
}

.topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.topbar .brand {
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    margin-right: auto;
}

.topbar .who {
    color: var(--muted);
    font-size: 0.875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.content {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 16px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
}

.card.narrow {
    max-width: 400px;
    margin: 2rem auto;
}

.muted {
    color: var(--muted);
}

form label {
    display: block;
    font-weight: 500;
    margin: 1rem 0 0.25rem;
}

input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    font: inherit;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

input:focus {
    outline: 2px solid var(--primary);
    outline-offset: -1px;
}

button {
    font: inherit;
    cursor: pointer;
}

form button[type="submit"] {
    width: 100%;
    margin-top: 1.5rem;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    color: #fff;
    background: var(--primary);
    font-weight: 600;
}

form button[type="submit"]:hover:not(:disabled) {
    background: var(--primary-dark);
}

button:disabled {
    opacity: 0.6;
    cursor: default;
}

button.link {
    border: none;
    background: none;
    color: var(--primary);
    padding: 0;
}

.error {
    color: var(--error);
    margin: 1rem 0 0;
}

.loading {
    text-align: center;
    margin-top: 20vh;
    color: var(--muted);
}

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 0.6rem 16px;
    background: #fef3c7;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 16px;
    top: 0.5rem;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

a.button, button.secondary {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
}

a.button {
    color: #fff;
    background: var(--primary);
}

button.secondary {
    color: var(--primary);
    background: var(--surface);
    border: 1px solid var(--primary);
}

.table-wrap {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tr:last-child td {
    border-bottom: none;
}

select {
    width: 100%;
    padding: 0.625rem 0.75rem;
    font: inherit;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.hint {
    color: var(--muted);
    font-size: 0.875rem;
    margin: 0.25rem 0 0;
}

.password-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.password {
    font-size: 1.25rem;
    letter-spacing: 0.05em;
    padding: 0.5rem 0.75rem;
    background: var(--background);
    border-radius: 8px;
    user-select: all;
}

.section {
    margin-top: 1.5rem;
}

.section h2 {
    font-size: 1.125rem;
    margin: 0 0 0.5rem;
}

.status {
    font-weight: 600;
    font-size: 0.875rem;
}

.status.on { color: #15803d; }
.status.off { color: var(--error); }

.ok {
    color: #15803d;
    margin: 1rem 0 0;
}

form label.check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

input[type="checkbox"] {
    width: auto;
}

input[readonly] {
    background: var(--background);
    color: var(--muted);
}

.logo-preview {
    display: block;
    max-width: 200px;
    max-height: 200px;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
}

button.danger {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    color: #fff;
    background: var(--error);
    border: 1px solid var(--error);
}

.dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.4);
}

.dialog {
    width: 100%;
    max-width: 420px;
}

.dialog h2 {
    margin: 0 0 0.5rem;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
