:root {
    --bg: #f6f8fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #111827;
    --muted: #64748b;
    --border: #e2e8f0;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #15803d;
    --danger: #b91c1c;
    --warning: #b45309;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 14px 34px rgba(15, 23, 42, 0.08);
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

[hidden] {
    display: none !important;
}

button,
input,
select {
    font: inherit;
}

button {
    border: 0;
}

input,
select {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    color: var(--text);
    background: #fff;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

select {
    cursor: pointer;
}

input:focus,
select:focus,
button:focus-visible {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
    outline: none;
}

.btn {
    position: relative;
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, color 160ms ease;
    white-space: nowrap;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.btn-primary {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 10px 18px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-secondary,
.btn-ghost {
    color: #1e293b;
    background: #eef2f7;
    border: 1px solid #dbe3ef;
}

.btn-secondary:hover:not(:disabled),
.btn-ghost:hover:not(:disabled) {
    background: #e2e8f0;
}

.btn-full {
    width: 100%;
}

.btn-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 700ms linear infinite;
}

.is-loading .btn-spinner {
    display: inline-block;
}

.text-button {
    color: var(--primary);
    background: transparent;
    font-weight: 700;
    cursor: pointer;
}

.eyebrow {
    margin: 0 0 5px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.panel {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.panel-heading,
.table-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.panel h2,
.table-toolbar h2 {
    margin: 0;
    font-size: 18px;
    line-height: 1.25;
}

.status-message {
    min-height: 20px;
    margin: 12px 20px 18px;
    color: var(--muted);
    font-size: 13px;
}

.status-message.ok {
    color: var(--success);
}

.status-message.error {
    color: var(--danger);
}

.toast-region {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 40;
    display: grid;
    gap: 10px;
    width: min(360px, calc(100vw - 32px));
}

.toast {
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 12px;
    padding: 12px 14px;
    background: #fff;
    box-shadow: var(--shadow-md);
    animation: slideIn 180ms ease;
}

.toast.ok {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast strong {
    display: block;
    margin-bottom: 2px;
    font-size: 14px;
}

.toast span {
    color: var(--muted);
    font-size: 13px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 720px) {
    .panel-heading,
    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
    }
}
