/* ECO SORT AI - design system. Change colors here. */
:root {
    --bg: #f2f5ef;
    --paper: #ffffff;
    --ink: #19372c;
    --muted: #5d7067;
    --green: #236d51;
    --dark: #143e30;
    --lime: #c9edaa;
    --line: #dce6dc;
    --soft: #e9f2e8;
    --warn: #8c5524;
    --danger: #a93636;
    --radius: 18px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.6 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: var(--green); text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { opacity: .48; cursor: not-allowed; }
:focus-visible { outline: 3px solid #6d9d52; outline-offset: 3px; }
.skip { position: absolute; top: -100px; background: white; padding: 8px; z-index: 100; }
.skip:focus { top: 0; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 76px;
    padding: 12px 30px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--dark); font-weight: 850; letter-spacing: .055em; font-size: 19px; line-height: 1.3; }
.brand small { display: block; color: var(--muted); font-size: 9px; font-weight: 650; letter-spacing: .13em; margin-top: 3px; }
.logo { display: grid; place-items: center; position: relative; width: 43px; height: 43px; background: var(--green); color: white; border-radius: 13px; font-size: 26px; letter-spacing: -.1em; }
.logo span { color: var(--lime); position: absolute; font-size: 15px; right: 3px; bottom: 0; }
.top-actions { display: flex; align-items: center; gap: 18px; font-size: 13px; }
.status { color: var(--muted); font-size: 12px; background: var(--soft); padding: 5px 10px; border-radius: 30px; }
.menu-toggle { display: none; border: 0; background: var(--soft); border-radius: 8px; padding: 8px 14px; }
.layout { display: grid; grid-template-columns: 246px minmax(0, 1fr); max-width: 1660px; margin: auto; min-height: calc(100vh - 125px); }
.sidebar { position: sticky; top: 76px; align-self: start; padding: 27px 17px; border-right: 1px solid var(--line); min-height: calc(100vh - 76px); }
.eyebrow { font-size: 10px; letter-spacing: .16em; font-weight: 800; color: var(--green); margin: 0 0 9px; }
.sidebar .eyebrow { margin: 0 9px 14px; }
.sidebar nav { display: grid; gap: 3px; }
.sidebar nav a { color: #40564b; display: flex; align-items: center; gap: 12px; padding: 11px 9px; border-radius: 9px; font-size: 13px; font-weight: 600; }
.sidebar nav a span { font-size: 11px; font-weight: 800; color: #71917b; min-width: 22px; }
.sidebar nav a:hover, .sidebar nav a.active { background: #dcebdc; color: #19553c; }
.sidebar nav a.active { box-shadow: inset 3px 0 var(--green); }
.side-note { background: #e5eee2; padding: 14px; border-radius: 12px; margin-top: 25px; font-size: 12px; }
.side-note p { color: var(--muted); margin: 4px 0 0; }
main { min-width: 0; padding: 30px clamp(18px, 3vw, 42px) 42px; }
.view { max-width: 1260px; margin: auto; }
.hero { position: relative; overflow: hidden; display: grid; grid-template-columns: 1.5fr 1fr; align-items: center; gap: 8px; border-radius: 25px; padding: clamp(24px, 4vw, 48px); color: white; background: radial-gradient(ellipse at 95% 20%, #43815e, transparent 65%), var(--dark); }
.hero h1 { font-size: clamp(30px, 4.2vw, 59px); line-height: 1.12; letter-spacing: -.055em; margin: 12px 0 16px; }
.hero em { color: var(--lime); font-style: normal; }
.hero p:not(.eyebrow) { max-width: 520px; color: #d6e9dc; }
.light { color: #bce4ad; }
.hero-art { width: 100%; max-height: 310px; }
.actions { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin: 12px 0; }
.btn { border: 1px solid #cdded1; background: white; color: var(--ink); padding: 10px 15px; border-radius: 10px; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; text-align: center; line-height: 1.4; }
.btn:hover:not(:disabled) { background: #e6f1e3; }
.btn.primary { background: var(--green); color: white; border-color: var(--green); }
.btn.primary:hover:not(:disabled) { background: #19583e; }
.hero .primary { background: var(--lime); color: var(--dark); border-color: var(--lime); }
.hero .primary:hover { background: #e0f6ce; }
.btn.ghost { background: transparent; color: white; border-color: #88b89d; }
.btn.ghost:hover { background: #386b51; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 6px 10px; font-size: 12px; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 18px 0 28px; }
.metrics article { background: var(--paper); padding: 16px 20px; border: 1px solid var(--line); border-radius: 15px; }
.metrics small, .metrics span { display: block; color: var(--muted); font-size: 12px; }
.metrics strong { display: block; color: var(--green); font-size: 32px; letter-spacing: -.04em; }
.metrics.compact { gap: 7px; margin: 12px 0; }
.metrics.compact article { background: var(--soft); padding: 9px; }
.metrics.compact strong { font-size: clamp(17px, 2vw, 26px); }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
h1, h2, h3 { line-height: 1.24; letter-spacing: -.025em; }
h2 { font-size: 21px; margin: 0 0 14px; }
h3 { font-size: 16px; margin: 8px 0; }
.section-title h2 { margin: 0; }
.module-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.module-card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 17px; color: var(--ink); transition: transform .15s, border-color .15s; }
.module-card:hover { border-color: #91b8a0; transform: translateY(-3px); }
.module-card small { display: block; color: var(--green); font-size: 9px; letter-spacing: .1em; font-weight: 800; margin-top: 12px; }
.module-card p { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.module-icon { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 11px; background: var(--soft); color: var(--green); font-size: 24px; }
.page-heading { margin: 0 0 22px; }
.page-heading h1 { font-size: clamp(28px, 4vw, 42px); margin: 5px 0; }
.page-heading p:not(.eyebrow) { color: var(--muted); margin: 8px 0; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(15px, 2.2vw, 25px); margin-bottom: 15px; min-width: 0; }
.two-col, .three-col, .form-grid { display: grid; gap: 15px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
label { display: block; font-weight: 650; font-size: 13px; margin: 9px 0; }
input:not([type=checkbox]):not([type=range]):not([type=file]), select, textarea { display: block; width: 100%; background: #fbfdfb; border: 1px solid #cbdad0; border-radius: 9px; padding: 9px 11px; margin: 5px 0 8px; color: var(--ink); min-width: 0; }
textarea { resize: vertical; }
input[type=range] { display: block; width: 100%; accent-color: var(--green); }
input[type=checkbox] { accent-color: var(--green); width: 17px; height: 17px; flex-shrink: 0; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.file-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-btn:focus-within { outline: 3px solid #6d9d52; }
.preview, .visual { border-radius: 13px; background: #edf4eb; min-height: 190px; display: grid; place-items: center; overflow: hidden; margin: 10px 0 15px; padding: 12px; text-align: center; color: var(--muted); }
.preview img { max-height: 270px; max-width: 100%; object-fit: contain; }
.preview span { padding: 20px; }
.visual svg, .preview svg { width: 100%; max-height: 260px; height: auto; }
video { width: 100%; border-radius: 12px; }
.notice, .result { border-radius: 11px; padding: 13px 15px; background: #eef5eb; border-left: 3px solid var(--green); margin: 12px 0; font-size: 13px; overflow-wrap: anywhere; }
.notice.warn, .result.warn { background: #fff4e1; border-color: #be7e37; color: #74491d; }
.notice.error, .result.error { background: #fff0ee; border-color: var(--danger); color: var(--danger); }
.result h3 { margin-top: 0; }
.hint { color: var(--muted); font-size: 12px; }
.source-link { font-size: 12px; font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }
.library { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.library-item { border: 1px solid var(--line); border-radius: 12px; padding: 13px; }
.library-item h3 { margin: 0 0 5px; }
.library-item p { margin: 5px 0; font-size: 13px; color: var(--muted); }
.big-number { font-size: clamp(25px, 3vw, 40px); font-weight: 800; color: var(--green); letter-spacing: -.04em; }
.formula { font-family: ui-monospace, monospace; background: var(--soft); padding: 10px; border-radius: 9px; margin: 8px 0; font-size: 13px; }
.bar-row { display: grid; grid-template-columns: minmax(75px, 130px) minmax(0,1fr) auto; align-items: center; gap: 10px; margin: 9px 0; font-size: 12px; }
.bar-track { background: #e5ece5; height: 12px; border-radius: 20px; overflow: hidden; }
.bar-fill { height: 100%; background: #438a65; border-radius: 20px; }
.range-labels { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); }
.factory-options, .sequence { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 0; }
.sequence { min-height: 52px; background: var(--soft); border-radius: 9px; padding: 10px; }
.sequence span { font-size: 12px; background: white; padding: 6px 9px; border-radius: 7px; }
.table-scroll { overflow-x: auto; margin: 10px 0; }
table { border-collapse: collapse; width: 100%; font-size: 12px; }
th, td { border-bottom: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; }
th { background: var(--soft); font-weight: 700; }
.matrix td, .matrix th { text-align: center; min-width: 45px; }
.matrix td.diag { background: #d7edce; font-weight: 800; }
.matrix td.off { background: #faebd8; }
summary { cursor: pointer; font-weight: 700; margin: 12px 0; }
footer { text-align: center; color: var(--muted); padding: 15px; font-size: 12px; border-top: 1px solid var(--line); }
#toast { position: fixed; bottom: 18px; right: 18px; background: var(--dark); color: white; border-radius: 12px; padding: 12px 18px; max-width: min(400px, 90vw); opacity: 0; pointer-events: none; z-index: 30; transition: opacity .2s; }
#toast.show { opacity: 1; }
@media (max-width: 1100px) { .module-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 850px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar { display: none; position: fixed; top: 67px; left: 0; bottom: 0; width: 250px; min-height: 0; overflow: auto; z-index: 9; background: var(--bg); box-shadow: 10px 0 30px #0002; }
    .sidebar.open { display: block; }
    .menu-toggle { display: block; }
    .topbar { min-height: 67px; padding: 10px 15px; }
    .top-actions a { display: none; }
    .two-col { grid-template-columns: 1fr; }
    .hero { grid-template-columns: 1fr 0.6fr; }
}
@media (max-width: 520px) {
    main { padding: 16px 12px 28px; }
    .brand { font-size: 15px; }
    .brand small { display: none; }
    .logo { width: 36px; height: 36px; }
    .top-actions { gap: 0; }
    .status { font-size: 10px; }
    .hero { grid-template-columns: 1fr; padding: 22px; }
    .hero-art { max-height: 160px; }
    .metrics { gap: 6px; }
    .metrics article { padding: 9px; }
    .metrics strong { font-size: 24px; }
    .metrics small, .metrics span { font-size: 10px; }
    .module-card { padding: 12px; }
    .form-grid, .three-col, .library { grid-template-columns: 1fr; }
}
@media print {
    body { background: white; color: black; }
    .topbar, .sidebar, footer, .no-print, #toast, .skip { display: none !important; }
    .layout { display: block; }
    main { padding: 0; }
    .panel { border: none; padding: 0; }
    #print-area { display: block; }
    tr { break-inside: avoid; }
}

/* V3: five-category diagram, responsive; no absolute-positioned cards. */
.waste-overview { display:grid; grid-template-columns:minmax(0, .95fr) minmax(0,1.05fr); gap:16px; align-items:stretch; }
.waste-overview > .panel { margin:0; }
.waste-wheel-panel { display:flex; flex-direction:column; justify-content:center; align-items:center; text-align:center; min-width:0; }
.waste-wheel-svg { display:block; width:100%; max-width:480px; height:auto; overflow:visible; }
.waste-wheel-panel .hint { margin:12px 0 0; }
.waste-info h2 { margin:0 0 14px; }
.waste-list { display:grid; gap:9px; }
.waste-row { display:grid; grid-template-columns:36px minmax(0,1fr); align-items:start; gap:12px; padding:11px 10px; border:1px solid var(--line); border-radius:12px; background:#f8fbf8; }
.waste-number { background:var(--group-color); color:white; display:grid; place-items:center; border-radius:10px; height:36px; font-size:12px; font-weight:800; }
.waste-row h3 { margin:0 0 3px; font-size:14px; line-height:1.35; }
.waste-row p { color:var(--muted); margin:0; font-size:12px; line-height:1.5; }
.submodule { margin-top:22px; scroll-margin-top:95px; }
.submodule-title { padding-top:20px; border-top:1px solid var(--line); }
.extra-tools { margin-top:18px; }
.extra-tools > summary { color:var(--green); font-size:15px; }
.contextual-card { margin-top:18px; }
.game-top { display:flex; justify-content:space-between; align-items:center; gap:15px; }
.game-score { text-align:right; flex-shrink:0; }
.game-score strong { display:block; color:var(--green); font-size:25px; }
.game-score span { font-size:12px; color:var(--muted); }
.game-progress { background:var(--soft); height:8px; border-radius:20px; overflow:hidden; margin:14px 0; }
#game-progress { height:100%; width:0; background:var(--green); transition:width .25s; }
.game-items { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin:16px 0 24px; }
.game-item { min-width:0; background:#f8fbf8; border:1px solid var(--line); border-radius:12px; padding:12px 7px; color:var(--ink); display:grid; justify-items:center; gap:6px; cursor:grab; font-weight:650; font-size:13px; }
.game-item svg { width:65px; height:65px; pointer-events:none; }
.game-item.selected { outline:3px solid #438a65; background:#e1f0df; }
.game-item.done { opacity:.5; cursor:default; }
.game-bins { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
.game-bin { background:white; color:var(--ink); border:1px solid var(--line); border-radius:14px; padding:12px 5px; display:grid; justify-items:center; gap:5px; min-width:0; font-size:12px; font-weight:700; }
.game-bin svg { width:74px; height:86px; pointer-events:none; }
.game-bin.over,.game-bin:hover { background:#eaf4e9; border-color:var(--green); }
@media(max-width:1150px) { .waste-overview { grid-template-columns:1fr; } }
@media(max-width:600px) { .game-items,.game-bins { grid-template-columns:repeat(2,minmax(0,1fr)); } .game-top { align-items:flex-start; } .game-score strong { font-size:20px; } .waste-wheel-panel { padding:10px; } }

/* ==========================================
   MODULE 02 - ECOIMPACT
========================================== */

.impact-knowledge {
    margin: 28px 0;
}

.impact-knowledge h2 {
    margin: 28px 0 18px;
    color: #183f31;
    font-size: 25px;
    font-weight: 800;
}

.impact-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin: 24px 0;
}

.impact-card {
    background: #f3f7f2;
    border: 1px solid #e0e9df;
    border-radius: 18px;
    padding: 25px;
    min-width: 0;
    transition: transform .2s, box-shadow .2s;
}

.impact-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(32, 80, 51, .09);
}

.impact-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e1eee0;
    border-radius: 14px;
    width: 48px;
    height: 48px;
    font-size: 24px;
    margin-bottom: 14px;
}

.impact-card h3 {
    color: #236d51;
    font-size: 19px;
    margin: 0 0 12px;
}

.impact-card p {
    font-size: 15px;
    line-height: 1.85;
    color: #385448;
    margin: 0;
}

.impact-flow {
    display: flex;
    align-items: stretch;
    gap: 12px;
    margin: 22px 0;
}

.impact-step {
    flex: 1;
    min-width: 0;
    padding: 20px;
    background: #e7f0e5;
    border: 1px solid #d5e5d5;
    border-radius: 16px;
}

.impact-step span {
    display: block;
    color: #438b5a;
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 10px;
}

.impact-step strong {
    color: #183f31;
    line-height: 1.5;
}

.impact-arrow {
    align-self: center;
    color: #438b5a;
    font-size: 25px;
}

.impact-school {
    margin-top: 24px;
    padding: 25px;
    background: #e6f1e4;
    border-left: 5px solid #236d51;
    border-radius: 12px;
}

.impact-school h3 {
    color: #236d51;
    margin-top: 0;
}

.impact-school p {
    line-height: 1.8;
}

.impact-sources {
    padding: 24px;
    margin-top: 22px;
    border: 1px solid #dce7dc;
    border-radius: 16px;
    background: #f5f8f3;
}

.impact-sources a {
    color: #236d51;
    overflow-wrap: anywhere;
}

#decomp-art svg {
    display: block;
    width: 100%;
    height: auto;
}

@media (max-width: 850px) {

    .impact-grid {
        grid-template-columns: 1fr;
    }

    .impact-flow {
        flex-direction: column;
    }

    .impact-arrow {
        transform: rotate(90deg);
    }

}
/* ===== SIDEBAR MODULE COLORS ===== */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.nav-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 16px;
  border-radius: 22px;
  text-decoration: none;
  border: 2px solid transparent;
  transition: all 0.25s ease;
  box-shadow: 0 8px 18px rgba(0,0,0,0.08);
}

.nav-card strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.nav-card small {
  display: block;
  font-size: 0.95rem;
  opacity: 0.95;
}

.nav-badge {
  min-width: 54px;
  height: 54px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.nav-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.12);
}

/* Trang chủ */
.nav-home {
  background: linear-gradient(135deg, #f4fff4, #ddf7df);
  border-color: #9dd39f;
  color: #14532d;
}
.nav-home .nav-badge {
  background: #ffffff;
  color: #14532d;
}

/* EcoScan - xanh dương */
.nav-ecoscan {
  background: linear-gradient(135deg, #e7f4ff, #cfe8ff);
  border-color: #7bb8f2;
  color: #0f4c81;
}
.nav-ecoscan .nav-badge {
  background: #ffffff;
  color: #0f4c81;
}

/* EcoImpact - cam đỏ */
.nav-ecoimpact {
  background: linear-gradient(135deg, #fff0e3, #ffd7bd);
  border-color: #f29a5a;
  color: #a64700;
}
.nav-ecoimpact .nav-badge {
  background: #fffaf5;
  color: #a64700;
}

/* EcoSolution - xanh lá */
.nav-ecosolution {
  background: linear-gradient(135deg, #ecffe8, #d3f5ca);
  border-color: #7fcf6a;
  color: #216a1f;
}
.nav-ecosolution .nav-badge {
  background: #f9fff8;
  color: #216a1f;
}

/* EcoPlay - tím */
.nav-ecoplay {
  background: linear-gradient(135deg, #f4eaff, #e7d4ff);
  border-color: #b186ea;
  color: #6b34a8;
}
.nav-ecoplay .nav-badge {
  background: #fffaff;
  color: #6b34a8;
}

/* Thư viện nguồn - xanh ngọc */
.nav-library {
  background: linear-gradient(135deg, #e7fff8, #cff5ea);
  border-color: #73cfb4;
  color: #16645a;
}
.nav-library .nav-badge {
  background: #ffffff;
  color: #16645a;
}

/* trạng thái active */
.nav-card.active {
  transform: translateX(4px);
  box-shadow: 0 14px 28px rgba(0,0,0,0.14);
}

.nav-home.active {
  border-color: #4caf50;
}
.nav-ecoscan.active {
  border-color: #2f80ed;
}
.nav-ecoimpact.active {
  border-color: #f97316;
}
.nav-ecosolution.active {
  border-color: #3fb950;
}
.nav-ecoplay.active {
  border-color: #a855f7;
}
.nav-library.active {
  border-color: #14b8a6;
}
