:root {
    color-scheme: light;
    --bg: #f3f7f6;
    --bg-strong: #e7efed;
    --surface: #ffffff;
    --surface-soft: #f7faf9;
    --surface-muted: #edf3f1;
    --border: #c8d4d0;
    --border-strong: #b5c5c0;
    --text: #1b262c;
    --muted: #65777b;
    --primary: #467b79;
    --primary-dark: #345d5c;
    --primary-soft: #e8f3f2;
    --accent: #b69256;
    --accent-soft: #fbf3e1;
    --danger: #b85a5a;
    --danger-soft: #fff1f1;
    --success: #3f8b74;
    --success-soft: #ebf7f2;
    --info: #5a8798;
    --info-soft: #edf5f8;
    --shadow: 0 14px 38px rgba(28, 43, 46, 0.08);
    --shadow-lg: 0 24px 60px rgba(28, 43, 46, 0.12);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 10px;
}

html.dark {
    color-scheme: dark;
    --bg: #0f1718;
    --bg-strong: #0b1112;
    --surface: #142022;
    --surface-soft: #182628;
    --surface-muted: #1d2d30;
    --border: #315052;
    --border-strong: #3f6265;
    --text: #edf4f2;
    --muted: #9ab0ac;
    --primary: #69a7a2;
    --primary-dark: #4f8884;
    --primary-soft: rgba(105, 167, 162, 0.12);
    --accent: #d5b57a;
    --accent-soft: rgba(213, 181, 122, 0.14);
    --danger: #df8a8a;
    --danger-soft: rgba(223, 138, 138, 0.14);
    --success: #73b79f;
    --success-soft: rgba(115, 183, 159, 0.14);
    --info: #89b7c2;
    --info-soft: rgba(137, 183, 194, 0.14);
    --shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
    --shadow-lg: 0 30px 70px rgba(0, 0, 0, 0.38);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

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

body {
    font-family: "Inter", "Inter var", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(70, 123, 121, 0.12), transparent 24%),
        radial-gradient(circle at top right, rgba(90, 135, 152, 0.08), transparent 18%),
        linear-gradient(180deg, #f9fbfa 0%, var(--bg) 100%);
}

html.dark body {
    background:
        radial-gradient(circle at top left, rgba(105, 167, 162, 0.14), transparent 24%),
        radial-gradient(circle at top right, rgba(137, 183, 194, 0.10), transparent 20%),
        linear-gradient(180deg, #0c1314 0%, #0f1718 48%, #0a1011 100%);
}

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

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none !important;
    outline-offset: 0;
}

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

*,
*:focus,
*:focus-visible,
*:focus-within {
    -webkit-tap-highlight-color: transparent;
}

img {
    display: block;
    max-width: 100%;
}

.ui-icon {
    width: 1rem;
    height: 1rem;
    flex: 0 0 auto;
    display: inline-block;
    vertical-align: middle;
}

.ui-icon-xs {
    width: 0.95rem;
    height: 0.95rem;
}

.ui-icon-sm {
    width: 1rem;
    height: 1rem;
}

.ui-icon-lg {
    width: 2.2rem;
    height: 2.2rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: transform 0.16s ease, opacity 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset;
}

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

.button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.is-disabled-button {
    cursor: not-allowed;
    opacity: 0.7;
    pointer-events: none;
}

.button-primary {
    background: linear-gradient(180deg, #4a8482 0%, #3b6f6d 100%);
    color: #ffffff;
    box-shadow: 0 10px 18px rgba(70, 123, 121, 0.22);
}

.button-save {
    border-color: #3b6f6d;
    background: linear-gradient(180deg, #4f8f8c 0%, #3b6f6d 100%);
    color: #ffffff;
    box-shadow: 0 10px 18px rgba(70, 123, 121, 0.22);
}

.button-light {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
    color: var(--text);
    border-color: var(--border);
}

.button-secondary {
    background: linear-gradient(180deg, #eef6f8 0%, #e3edf1 100%);
    color: var(--info);
    border-color: #cfdee3;
}

.form-control,
.form-select {
    width: 100%;
    min-height: 42px;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    color: var(--text);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: rgba(70, 123, 121, 0.48);
    box-shadow: 0 0 0 4px rgba(70, 123, 121, 0.12);
    background: #ffffff;
}

textarea.form-control {
    min-height: 110px;
    resize: vertical;
}

.form-error {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(178, 68, 68, 0.16);
    background: linear-gradient(180deg, rgba(255, 251, 251, 0.98), rgba(255, 241, 241, 0.94));
    color: var(--danger);
    font-size: 0.92rem;
}

.message-stack {
    display: grid;
    gap: 12px;
}

.message-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 254, 0.95));
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

.message-item::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--info);
    flex: 0 0 auto;
}

.message-success {
    border-color: #c8e7d7;
    background: linear-gradient(180deg, #f4fbf7 0%, #edf8f1 100%);
}

.message-success::before {
    background: var(--success);
}

.message-warning {
    border-color: #edd8b1;
    background: linear-gradient(180deg, #fffdf7 0%, #fff5e3 100%);
}

.message-warning::before {
    background: var(--accent);
}

.message-error,
.message-danger {
    border-color: #eccccc;
    background: linear-gradient(180deg, #fff8f8 0%, #fff1f1 100%);
}

.message-error::before,
.message-danger::before {
    background: var(--danger);
}

.app-shell {
    min-height: 100vh;
}

.app-skip-link {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 80;
    padding: 10px 14px;
    border-radius: 14px;
    background: #0f172a;
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
    transform: translateY(-140%);
    transition: transform 0.16s ease;
}

.app-skip-link:focus {
    transform: translateY(0);
}

.app-layout-solo {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-theme-toggle-wrap {
    width: calc(100% - 32px);
    max-width: 1120px;
    margin: 24px auto 0;
    display: flex;
    justify-content: flex-end;
}

.theme-toggle {
    width: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 0;
    border-radius: 14px;
    gap: 0;
}

.theme-toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle .ui-icon-sm {
    width: 1.05rem;
    height: 1.05rem;
}

.app-layout-content {
    flex: 1;
    width: calc(100% - 32px);
    max-width: 1120px;
    margin: 0 auto;
    padding: 32px 0 24px;
}

.app-footer {
    width: calc(100% - 32px);
    max-width: 1120px;
    margin: 0 auto 24px;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.92);
    background: rgba(255, 255, 255, 0.76);
    box-shadow: var(--shadow);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .app-footer {
        background: rgba(255, 255, 255, 0.96);
    }
}

.app-footer-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-footer-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient(180deg, #eef5fb 0%, #dfeaf4 100%);
    color: #17384d;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.app-footer-kicker,
.app-footer-copy {
    margin: 0;
}

.app-footer-kicker {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.app-footer-copy {
    color: var(--muted);
    line-height: 1.5;
}

html.dark .button-light {
    background: linear-gradient(180deg, #182628 0%, #142022 100%);
    color: #eef4f8;
    border-color: #294244;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

html.dark .button-secondary {
    background: linear-gradient(180deg, rgba(137, 183, 194, 0.16) 0%, rgba(137, 183, 194, 0.1) 100%);
    color: #a8cbd2;
    border-color: rgba(137, 183, 194, 0.24);
}

html.dark .button-primary {
    background: linear-gradient(180deg, #5a9893 0%, #457c78 100%);
    box-shadow: 0 12px 22px rgba(9, 16, 17, 0.36);
}

html.dark .button-save {
    border-color: #4d8782;
    background: linear-gradient(180deg, #5a9893 0%, #457c78 100%);
    box-shadow: 0 12px 22px rgba(9, 16, 17, 0.36);
}

html.dark .form-control,
html.dark .form-select {
    background: linear-gradient(180deg, #10191b 0%, #142022 100%);
    border-color: #294244;
    color: #eef4f8;
}

html.dark .form-control:focus,
html.dark .form-select:focus {
    background: #142022;
    box-shadow: 0 0 0 4px rgba(105, 167, 162, 0.16);
    border-color: rgba(105, 167, 162, 0.45);
}

html.dark .message-item {
    border-color: rgba(41, 66, 68, 0.9);
    background: linear-gradient(180deg, rgba(20, 32, 34, 0.98), rgba(16, 25, 27, 0.95));
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

html.dark .app-footer {
    border-color: rgba(41, 66, 68, 0.92);
    background: rgba(20, 32, 34, 0.84);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

html.dark .app-footer-mark {
    background: linear-gradient(180deg, #223637 0%, #1a2b2d 100%);
    color: #eef4f8;
}

@media (max-width: 720px) {
    .app-theme-toggle-wrap {
        width: calc(100% - 24px);
        max-width: 100%;
        margin-top: 16px;
    }

    .app-layout-content {
        width: calc(100% - 24px);
        max-width: 100%;
        padding-top: 18px;
    }

    .app-footer {
        width: calc(100% - 24px);
        max-width: 100%;
        flex-direction: column;
        align-items: flex-start;
    }

    .message-item {
        align-items: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
