:root {
    --bg: #faf6f0;
    --surface: #ffffff;
    --surface2: #f5eed9;
    --border: #e8dfc8;
    --text: #3d3327;
    --text2: #8a7d6b;
    --accent: #c8a951;
    --accent2: #a68b2e;
    --green: #5a8a4a;
    --red: #b94a3e;
    --yellow: #c8a951;
    --cyan: #6a8e9a;
    --sidebar-w: 240px;
    --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 16px 10px;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.logo {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent2);
    padding: 8px 10px 16px;
    letter-spacing: -0.3px;
}

.nav-section {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text2);
    padding: 14px 10px 4px;
}

.nav-btn {
    width: 100%;
    background: none;
    border: none;
    color: var(--text2);
    padding: 9px 10px;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font-size: 0.84rem;
    font-family: inherit;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn:hover { background: var(--surface2); color: var(--text); }
.nav-btn.active { background: var(--surface2); color: var(--accent2); font-weight: 600; }

.nav-footer {
    margin-top: auto;
    padding: 12px 10px;
    border-top: 1px solid var(--border);
}

.nav-footer a { color: var(--text2); text-decoration: none; font-size: 0.78rem; }
.nav-footer a:hover { color: var(--accent2); }

/* ── Mobile hamburger ── */
.hamburger {
    display: none;
    position: fixed;
    top: 12px; left: 12px;
    z-index: 200;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.2);
    z-index: 90;
}

/* ── Content ── */
.content {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 28px 32px;
    max-width: 880px;
}

.module { display: none; }
.module.active { display: block; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.module-header { margin-bottom: 20px; }
.module-header h1 { font-size: 1.35rem; font-weight: 700; color: var(--text); }
.module-header p { color: var(--text2); font-size: 0.84rem; margin-top: 2px; }

/* ── Cards ── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 14px;
}

.card h3 { font-size: 0.88rem; font-weight: 600; margin-bottom: 12px; color: var(--text); }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-head h3 { margin-bottom: 0; }

/* ── Forms ── */
.form-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.form-group { flex: 1; min-width: 120px; }
.form-group label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text2);
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

input, select, textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 8px 10px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.84rem;
    transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(200,169,81,0.15);
}

textarea { resize: vertical; font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.82rem; }

/* ── Buttons ── */
.btn {
    padding: 9px 18px;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 500;
    transition: all 0.15s;
}

.btn-primary {
    background: var(--accent2);
    color: #fff;
    margin-top: 10px;
}

.btn-primary:hover { background: #8d7624; }

.btn-sm {
    padding: 5px 12px;
    font-size: 0.78rem;
    background: var(--surface2);
    color: var(--text2);
    border: 1px solid var(--border);
}

.btn-sm:hover { background: var(--border); }

.btn-x {
    background: none;
    border: none;
    color: var(--text2);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 2px 5px;
    border-radius: 4px;
}

.btn-x:hover { background: rgba(185,74,62,0.1); color: var(--red); }

/* ── Tables ── */
.ing-table { width: 100%; border-collapse: collapse; margin-bottom: 6px; }
.ing-table th {
    text-align: left;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text2);
    padding: 5px 3px;
    border-bottom: 1px solid var(--border);
}

.ing-table td { padding: 3px; }
.ing-table input, .ing-table select { padding: 6px 7px; font-size: 0.8rem; }
.ing-table th:nth-child(2), .ing-table td:nth-child(2) { width: 70px; }
.ing-table th:last-child, .ing-table td:last-child { width: 36px; text-align: center; }

/* ── Results ── */
.result-area { margin-top: 14px; }

.result-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 10px;
    animation: fadeIn 0.3s ease;
}

.score-display { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }

.score-circle {
    width: 76px; height: 76px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; font-weight: 700; flex-shrink: 0;
}

.score-circle.good { background: rgba(90,138,74,0.1); color: var(--green); border: 2px solid var(--green); }
.score-circle.warn { background: rgba(200,169,81,0.12); color: var(--accent2); border: 2px solid var(--yellow); }
.score-circle.bad { background: rgba(185,74,62,0.08); color: var(--red); border: 2px solid var(--red); }

.score-info h2 { font-size: 1rem; font-weight: 600; }
.score-info p { color: var(--text2); font-size: 0.82rem; }

.violation {
    padding: 9px 12px;
    border-radius: 7px;
    margin-bottom: 6px;
    font-size: 0.82rem;
    line-height: 1.45;
}

.violation.critical { background: rgba(185,74,62,0.07); border-left: 3px solid var(--red); }
.violation.warning { background: rgba(200,169,81,0.1); border-left: 3px solid var(--yellow); }
.violation.info { background: rgba(106,142,154,0.08); border-left: 3px solid var(--cyan); }
.violation.success { background: rgba(90,138,74,0.08); border-left: 3px solid var(--green); }

.inci-output {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 12px;
    font-family: 'SF Mono', monospace;
    font-size: 0.82rem;
    line-height: 1.7;
    color: var(--accent2);
    margin-top: 10px;
}

.cost-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.cost-table th {
    text-align: left; padding: 7px; border-bottom: 2px solid var(--border);
    color: var(--text2); font-size: 0.7rem; text-transform: uppercase;
}
.cost-table td { padding: 7px; border-bottom: 1px solid var(--border); }
.cost-table tr:hover { background: var(--surface2); }

.sub-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 8px;
}

.sub-card h4 { font-size: 0.86rem; margin-bottom: 6px; color: var(--accent2); }

.match-bar { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; margin: 3px 0 6px; }
.match-fill { height: 100%; border-radius: 3px; transition: width 0.4s ease; }

.tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.tag { padding: 2px 8px; border-radius: 16px; font-size: 0.68rem; font-weight: 500; }
.tag.green { background: rgba(90,138,74,0.12); color: var(--green); }
.tag.red { background: rgba(185,74,62,0.1); color: var(--red); }
.tag.blue { background: rgba(200,169,81,0.12); color: var(--accent2); }

.loading { text-align: center; padding: 24px; color: var(--text2); font-size: 0.85rem; }
.loading::after {
    content: '';
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.5s linear infinite;
    margin-left: 6px;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Mobile ── */
@media (max-width: 768px) {
    .hamburger { display: block; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,0.08); }
    .overlay.open { display: block; }
    .content { margin-left: 0; padding: 56px 16px 24px; max-width: 100%; }
    .form-grid { flex-direction: column; }
    .form-group { min-width: 100%; }
    .score-display { flex-direction: column; text-align: center; }
    .cost-table { font-size: 0.75rem; }
    .cost-table th, .cost-table td { padding: 5px 3px; }
}
