:root {
    --bg: #f4f6fa;
    --surface: #ffffff;
    --surface-soft: #f8faff;

    --primary: #4f65e8;
    --primary-dark: #394bc3;
    --primary-soft: #edf0ff;

    --text: #20263a;
    --text-secondary: #596278;
    --text-muted: #858da1;

    --border: #e1e6f0;
    --border-strong: #d2d9e7;

    --success: #1d9a72;
    --warning: #d99527;
    --danger: #d94c5c;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;

    --shadow-sm:
        0 2px 8px rgba(30, 44, 80, 0.035);

    --shadow-md:
        0 10px 30px rgba(30, 44, 80, 0.06);

    --header-height: 68px;
    --rail-width: 76px;
    --segment-width: 260px;

    font-family:
        Inter,
        "PingFang SC",
        "Microsoft YaHei",
        sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-width: 320px;
    min-height: 100%;
    margin: 0;
}

body {
    color: var(--text);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.5;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    color: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid rgba(79, 101, 232, 0.2);
    outline-offset: 2px;
}

button {
    cursor: pointer;
}

input,
textarea,
select {
    color: var(--text);
}

input::placeholder,
textarea::placeholder {
    color: #a2a9b8;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

a {
    color: inherit;
    text-decoration: none;
}

.hidden {
    display: none !important;
}

.eyebrow {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    min-height: 36px;
    padding: 0 14px;

    border: 1px solid transparent;
    border-radius: var(--radius-sm);

    font-size: 12px;
    font-weight: 700;

    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        transform 0.18s ease;
}

.button:active {
    transform: translateY(1px);
}

.button-primary {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 4px 12px rgba(79, 101, 232, 0.18);
}

.button-primary:hover {
    background: var(--primary-dark);
}

.button-ghost {
    color: var(--text-secondary);
    background: #fff;
    border-color: var(--border);
}

.button-ghost:hover {
    background: var(--surface-soft);
    border-color: var(--border-strong);
}

.button-danger {
    color: var(--danger);
    background: #fff3f4;
    border-color: #ffe0e4;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 32px;
    height: 32px;

    padding: 0;

    color: var(--text-secondary);
    background: #fff;

    border: 1px solid var(--border);
    border-radius: 8px;

    font-size: 18px;
}

.icon-button:hover {
    color: var(--primary);
    background: var(--primary-soft);
    border-color: #dce2ff;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.field > label,
.field-label {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
}

.field input,
.field textarea,
.field select {
    width: 100%;
    min-height: 40px;
    padding: 10px 12px;

    color: var(--text);
    background: #fff;

    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.field textarea {
    min-height: 110px;
    resize: vertical;
    line-height: 1.8;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
    border-color: var(--primary);
    outline: 3px solid rgba(79, 101, 232, 0.1);
}

.card {
    min-width: 0;
    padding: 20px;

    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    box-shadow: var(--shadow-sm);
}

.card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    margin-bottom: 18px;
}

.card-heading h3 {
    margin: 0;
    font-size: 15px;
}

.card-heading p {
    margin: 5px 0 0;
    color: var(--text-muted);
    font-size: 12px;
}

.muted {
    color: var(--text-muted);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;

    padding: 4px 8px;

    color: var(--text-secondary);
    background: #f0f2f7;

    border-radius: 999px;

    font-size: 11px;
    font-weight: 700;
}

.status-pill.success {
    color: #177a5a;
    background: #e7f8f0;
}

.status-pill.warning {
    color: #98600e;
    background: #fff5df;
}

.status-pill.primary {
    color: var(--primary-dark);
    background: var(--primary-soft);
}

.empty-state {
    padding: 36px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state strong {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.toast-root {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1000;

    display: flex;
    flex-direction: column;
    gap: 8px;

    pointer-events: none;
}

.toast {
    max-width: min(380px, calc(100vw - 32px));
    padding: 12px 16px;

    color: #fff;
    background: #273149;

    border-radius: 10px;
    box-shadow: var(--shadow-md);

    animation: toast-in 0.2s ease;
}

.toast.error {
    background: #b52e42;
}

.toast.success {
    background: #187a5b;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}