:root {
    --color-bg: #f6f7fb;
    --color-surface: #ffffff;
    --color-border: #e0e3ea;
    --color-text: #1f2430;
    --color-muted: #6b7280;
    --color-primary: #2f5fd1;
    --color-primary-dark: #22429a;
    --color-primary-tint: #eef2fd;
    --color-error: #b3261e;
    --color-error-bg: #fdecea;
    --color-error-border: #f3c6c2;
    --color-warning: #8a5a00;
    --color-warning-bg: #fff6e5;
    --color-warning-border: #f0dca6;
    --color-mandatory: #8a5a00;
    --radius: 8px;
}

[data-theme="dark"] {
    --color-bg: #14171f;
    --color-surface: #1c202b;
    --color-border: #2e3441;
    --color-text: #e7e9ee;
    --color-muted: #9aa1b1;
    --color-primary: #7297ea;
    --color-primary-dark: #93b1ef;
    --color-primary-tint: #1e2a44;
    --color-error: #ff8a80;
    --color-error-bg: #3a1f1f;
    --color-error-border: #6b3232;
    --color-warning: #f0c674;
    --color-warning-bg: #3a2f14;
    --color-warning-border: #6b5726;
    --color-mandatory: #f0c674;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.theme-switcher {
    position: fixed;
    top: 1rem;
    left: 1rem;
    display: flex;
    gap: 0.4rem;
    z-index: 10;
}

.theme-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 50%;
    background: var(--color-surface);
    box-shadow: 0 0 0 1px var(--color-border);
    color: var(--color-muted);
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.theme-btn:hover {
    color: var(--color-primary);
}

.theme-btn--active {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.theme-icon {
    width: 18px;
    height: 18px;
}

.lang-switcher {
    position: fixed;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.4rem;
    z-index: 10;
}

.lang-btn {
    padding: 0;
    border: 2px solid transparent;
    border-radius: 4px;
    background: none;
    line-height: 0;
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.15s ease, border-color 0.15s ease;
}

.lang-btn:hover {
    opacity: 0.85;
}

.lang-btn--active {
    opacity: 1;
    border-color: var(--color-primary);
}

.flag-icon {
    display: block;
    width: 28px;
    height: 20px;
    border-radius: 3px;
    box-shadow: 0 0 0 1px var(--color-border);
}

.content {
    max-width: 720px;
    margin: 0 auto;
    padding: 3.25rem 1.5rem 4rem;
}

h1 {
    margin-top: 0;
}

.hint {
    color: var(--color-muted);
    font-size: 0.92rem;
}

.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    color: var(--color-primary);
    text-decoration: none;
    font-size: 0.9rem;
}

.shape-section {
    margin-top: 2rem;
}

.shape-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.shape-list li a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text);
    text-decoration: none;
    font-weight: 500;
}

.shape-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.shape-list li a:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.shape-list li.disabled {
    padding: 0.55rem 1rem;
    color: var(--color-muted);
    font-size: 0.88rem;
}

.calc-form {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-top: 1.5rem;
}

.field {
    margin-bottom: 1rem;
}

.field label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.35rem;
    font-size: 0.92rem;
}

.field input,
.field select {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--color-bg);
    color: var(--color-text);
}

.field input:focus,
.field select:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1.25rem;
}

.calc-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--color-primary);
    background: var(--color-surface);
    color: var(--color-primary);
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
}

.btn-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.calc-btn:hover {
    background: var(--color-primary-tint);
}

.calc-btn--all {
    background: var(--color-primary);
    color: #fff;
}

.calc-btn--all:hover {
    background: var(--color-primary-dark);
}

.result {
    margin-top: 1.5rem;
}

.result-table {
    border-collapse: collapse;
    width: 100%;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}

.result-table td {
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid var(--color-border);
}

.result-table tr:last-child td {
    border-bottom: none;
}

.result-table td.value {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.messages {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.messages .msg {
    padding: 0.55rem 0.8rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: var(--color-error-bg);
    color: var(--color-error);
    border: 1px solid var(--color-error-border);
}

.messages .msg-warning,
.messages .msg-mandatory {
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border-color: var(--color-warning-border);
}

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

.error {
    color: var(--color-error);
    font-weight: 500;
}

