:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #0f766e;
    --primary-contrast: #ffffff;
    --border: #e5e7eb;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
}
.container {
    width: min(100%, 1000px);
    margin: 0 auto;
    padding: 1rem;
}
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand {
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
}
nav a {
    margin-left: 1rem;
    color: var(--text);
    text-decoration: none;
}
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    margin: 1rem 0;
}
.grid {
    display: grid;
    gap: 1rem;
}
.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
label { display: block; font-weight: 600; margin-bottom: .25rem; }
input, textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .65rem .7rem;
    margin-bottom: .75rem;
}
textarea { min-height: 90px; resize: vertical; }
.btn {
    display: inline-block;
    padding: .65rem .9rem;
    border-radius: 8px;
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    background: var(--primary);
    color: var(--primary-contrast);
}
.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}
.btn-danger {
    background: #b91c1c;
    color: #fff;
}
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.error {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: .75rem;
    border-radius: 8px;
}
.success {
    background: #dcfce7;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: .75rem;
    border-radius: 8px;
}
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
    border-bottom: 1px solid var(--border);
    text-align: left;
    padding: .6rem;
}
.kpi { font-size: 1.6rem; font-weight: 700; }

.mobile-card {
    max-width: 450px;
    margin: 0 auto;
    padding: 1rem;
}
.mobile-header {
    text-align: center;
    padding: 1rem;
}
.mobile-name { font-size: 1.6rem; margin: 0; }
.mobile-sub { color: var(--muted); margin-top: .25rem; }
.mobile-buttons .btn { width: 100%; margin-bottom: .55rem; text-align: center; }
.small { color: var(--muted); font-size: .9rem; }

.site-footer {
    color: var(--muted);
    font-size: .9rem;
    padding-top: 0;
    padding-bottom: 1.2rem;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    justify-content: space-between;
    align-items: center;
}

.site-footer-links {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}

.site-footer-links a {
    color: var(--primary);
    text-decoration: none;
}

.site-footer-links a:hover {
    text-decoration: underline;
}

.legal-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 999;
}

.legal-modal.is-open {
    display: block;
}

.legal-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .45);
}

.legal-modal-dialog {
    position: relative;
    width: min(92vw, 760px);
    max-height: 86vh;
    overflow: auto;
    margin: 5vh auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
}

.legal-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .75rem;
}

.legal-modal-head h2 {
    margin: 0;
    font-size: 1.2rem;
}

.legal-modal-close {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
}

.legal-modal-body h3 {
    margin-top: 1rem;
    margin-bottom: .4rem;
}

.legal-modal-body p {
    margin-top: 0;
    margin-bottom: .7rem;
}

.card-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    margin-bottom: .75rem;
}

.card-form-import {
    background: #f9fafb;
    border: 1px dashed var(--border);
    border-radius: 10px;
    padding: .85rem;
    margin-bottom: 1rem;
}

.card-form-import h3 {
    margin: 0 0 .6rem 0;
    font-size: 1rem;
}

.card-form-import-row {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    align-items: flex-end;
}

.card-form-import-field {
    flex: 1;
    min-width: 260px;
}

.card-form-import input[type="file"] {
    margin-bottom: 0;
}

.card-form-import .small {
    margin: .6rem 0 0;
}

.card-form-grid {
    gap: 1.2rem;
}

.card-form-column {
    min-width: 0;
}

.card-form-field-hint {
    margin-top: -.35rem;
    margin-bottom: .75rem;
}

.card-form-checkbox {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin-top: .2rem;
}

.card-form-checkbox input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.card-form-submit {
    grid-column: 1 / -1;
    margin-top: .15rem;
}

.card-form-submit .btn {
    margin: 0;
}

@media (max-width: 680px) {
    .card-form-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
