/* Mixed Rice/IPO — kopitiam palette: cream walls, bottle-green tiles, enamel red, sambal amber */
:root {
  --bg: #efe6d2; --paper: #fbf6ea; --card: #fffdf6; --ink: #2a2018; --mute: #7a6c5c;
  --green: #1d5b4a; --green2: #2f7d66; --mint: #d7e8dd; --red: #cf3f29; --amber: #eda42e; --cream: #f7efd9;
  --line: rgba(42, 32, 24, 0.14); --sh: 0 1px 0 rgba(42, 32, 24, 0.06), 0 8px 24px -12px rgba(42, 32, 24, 0.28);
  --r: 14px; --disp: 'Bricolage Grotesque', system-ui, sans-serif; --body: 'Instrument Sans', system-ui, sans-serif; --mono: 'DM Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--body); overflow: hidden; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
.hide { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.grow { flex: 1; }
.muted { color: var(--mute); }
.tiny { font-size: 12px; }
.up { color: var(--green2); } .down { color: var(--red); }

#app { display: grid; grid-template-columns: minmax(0, 1fr) 452px; grid-template-rows: 58px minmax(0, 1fr); height: 100vh; }
#top { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; padding: 0 16px; background: var(--green); color: #f6efdc; border-bottom: 3px solid #143f33; }
.brand { font: 800 19px/1 var(--disp); letter-spacing: 0.02em; white-space: nowrap; }
.brand span, h1 span { color: var(--amber); }
.chip { background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.22); padding: 5px 11px; border-radius: 99px; font-weight: 600; font-size: 12.5px; white-space: nowrap; }
#date { font-size: 12.5px; opacity: 0.9; white-space: nowrap; }
#top .stat { display: flex; flex-direction: column; line-height: 1.15; text-align: right; }
#top .stat span { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.7; }
#top .stat b { font: 500 15px var(--mono); }
.seg { display: inline-flex; background: rgba(0, 0, 0, 0.18); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; color: inherit; padding: 5px 10px; border-radius: 8px; font: 600 12.5px var(--body); opacity: 0.75; }
.seg button.on { background: var(--amber); color: #2a2018; opacity: 1; }
#side .seg { background: #e9dfc8; width: 100%; } #side .seg button { flex: 1; } #side .seg button.on { background: var(--green); color: #fff; }
.icon { width: 32px; height: 32px; border-radius: 9px; border: 1px solid rgba(255, 255, 255, 0.25); background: transparent; color: #f6efdc; }
.icon.off { opacity: 0.4; }

#stage { position: relative; overflow: hidden; background: #e7dcc3; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#goals { position: absolute; left: 14px; top: 14px; width: 292px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); padding: 12px 14px; }
#goals h3 { margin: 0 0 2px; font: 700 15px var(--disp); }
#goals .learn { font-size: 12px; color: var(--mute); margin-bottom: 8px; }
.gl { display: flex; gap: 8px; align-items: baseline; font-size: 13px; padding: 3px 0; }
.gl i { flex: none; width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--line); position: relative; top: 2px; }
.gl.ok i { background: var(--green2); border-color: var(--green2); }
.gl.ok span { color: var(--mute); text-decoration: line-through; }
.gl em { margin-left: auto; font: normal 11.5px var(--mono); color: var(--mute); white-space: nowrap; }
#goals .next { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 12.5px; }
#kpis { position: absolute; right: 14px; top: 14px; display: flex; gap: 8px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sh); padding: 7px 11px; min-width: 84px; }
.kpi span { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--mute); }
.kpi b { font: 500 16px var(--mono); }
.kpi.warn b { color: var(--red); } .kpi.good b { color: var(--green2); }
#huddle { position: absolute; left: 14px; right: 14px; bottom: 40px; display: flex; gap: 10px; align-items: flex-end; }
.prop { flex: 1; max-width: 330px; background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--amber); border-radius: 12px; box-shadow: var(--sh); padding: 9px 11px; animation: rise 0.35s ease; }
.prop .who { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--mute); }
.prop b { display: block; font: 700 13.5px var(--disp); margin: 1px 0 2px; }
.prop p { margin: 0 0 7px; font-size: 12px; color: var(--mute); }
.prop .yn { display: flex; gap: 6px; }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }
#ticker { position: absolute; left: 0; right: 0; bottom: 0; height: 30px; display: flex; align-items: center; padding: 0 14px; background: rgba(42, 32, 24, 0.86); color: #f3ead6; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#ticker .bad { color: #ffab9a; } #ticker .good { color: #b9e6c9; } #ticker .warn { color: #ffd88a; }

#side { display: flex; flex-direction: column; background: var(--paper); border-left: 1px solid var(--line); min-height: 0; }
#tabs { display: flex; gap: 2px; padding: 8px 8px 0; background: var(--cream); border-bottom: 1px solid var(--line); }
#tabs button { flex: 1; border: 1px solid transparent; border-bottom: 0; background: transparent; padding: 8px 2px 9px; border-radius: 10px 10px 0 0; font: 600 12.5px var(--body); color: var(--mute); position: relative; }
#tabs button.on { background: var(--paper); border-color: var(--line); color: var(--ink); margin-bottom: -1px; }
#tabs button .dot { position: absolute; top: 5px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); }
#panel { flex: 1; overflow-y: auto; padding: 14px 14px 30px; }
.ph { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.ph h2 { margin: 0; font: 800 20px var(--disp); }
.pill { font: 500 11.5px var(--mono); background: var(--mint); color: var(--green); padding: 3px 9px; border-radius: 99px; }
.pill.red { background: #f7d9d2; color: var(--red); } .pill.amb { background: #fbe8c2; color: #8a5a00; }
.sec { font: 700 11px var(--body); text-transform: uppercase; letter-spacing: 0.09em; color: var(--mute); margin: 16px 0 7px; }
.box { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 11px 12px; margin-bottom: 8px; }
.box p { margin: 3px 0 0; font-size: 12.5px; color: var(--mute); }
.row { display: flex; align-items: center; gap: 8px; } .sb { justify-content: space-between; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; } .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.st .l { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--mute); } .st .v { font: 500 16px var(--mono); }
.btn { border: 1px solid var(--line); background: var(--card); padding: 7px 12px; border-radius: 10px; font-weight: 600; font-size: 13px; }
.btn:hover:not(:disabled) { border-color: var(--ink); }
.btn.pri { background: var(--green); border-color: var(--green); color: #fff; } .btn.red { background: var(--red); border-color: var(--red); color: #fff; }
.btn.sm { padding: 4px 9px; font-size: 12px; border-radius: 8px; } .btn.big { padding: 12px 20px; font-size: 15px; } .btn.ghost { background: transparent; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.yes { background: var(--green); color: #fff; border-color: var(--green); flex: 1; } .btn.no { flex: none; }
input[type='range'] { width: 100%; accent-color: var(--green); margin: 6px 0 2px; }
.tog { width: 40px; height: 22px; border-radius: 99px; border: 0; background: #d5cab3; position: relative; flex: none; }
.tog::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left 0.15s; }
.tog.on { background: var(--green2); } .tog.on::after { left: 21px; }

/* tray line */
.trays { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; background: linear-gradient(#cfd4d6, #aab1b4); padding: 8px; border-radius: 12px; border: 2px solid #8d9598; }
.tray { position: relative; height: 62px; border-radius: 8px; background: #eef1f2; border: 1px solid #7f888b; padding: 5px 6px; text-align: left; overflow: hidden; font-size: 11px; line-height: 1.15; }
.tray .food { position: absolute; inset: 0; opacity: 0.9; }
.tray b, .tray span { position: relative; display: block; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55); }
.tray b { font-weight: 700; } .tray span { font-family: var(--mono); font-size: 10.5px; margin-top: 2px; }
.tray.empty { background: repeating-linear-gradient(135deg, #e3e7e8, #e3e7e8 6px, #d5dadc 6px, #d5dadc 12px); border-style: dashed; color: #6c7578; display: grid; place-items: center; text-align: center; }
.tray.lock { opacity: 0.45; }
.tray .x { position: absolute; right: 3px; top: 2px; color: #fff; font-size: 13px; opacity: 0; } .tray:hover .x { opacity: 1; }
.dish { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); margin-bottom: 5px; }
.dish i { width: 22px; height: 22px; border-radius: 6px; flex: none; }
.dish .n { flex: 1; min-width: 0; } .dish .n b { display: block; font-size: 13px; } .dish .n span { font: 11px var(--mono); color: var(--mute); }
.stars { color: var(--amber); letter-spacing: 1px; font-size: 11px; }
.bar { height: 6px; border-radius: 9px; background: #e6dcc6; overflow: hidden; margin-top: 4px; } .bar i { display: block; height: 100%; background: var(--green2); border-radius: 9px; }
.bar.red i { background: var(--red); } .bar.amb i { background: var(--amber); }
table.pl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.pl td, table.pl th { padding: 4px 4px; text-align: right; font-family: var(--mono); border-bottom: 1px solid var(--line); }
table.pl td:first-child, table.pl th:first-child { text-align: left; font-family: var(--body); }
table.pl th { font: 600 10.5px var(--body); text-transform: uppercase; letter-spacing: 0.06em; color: var(--mute); }
table.pl tr.tot td { font-weight: 700; border-top: 2px solid var(--ink); }
.store { cursor: default; } .store .nm { font-weight: 700; } .store .meta { font: 11.5px var(--mono); color: var(--mute); }
.step { display: flex; gap: 10px; } .step .n { width: 26px; height: 26px; border-radius: 50%; background: #e6dcc6; display: grid; place-items: center; font: 600 12px var(--mono); flex: none; }
.step.done .n { background: var(--green2); color: #fff; } .step.run .n { background: var(--amber); }
.term { border-bottom: 1.5px dotted var(--green2); cursor: help; }
#tip { position: fixed; z-index: 90; max-width: 280px; background: var(--ink); color: #f6efdc; padding: 9px 11px; border-radius: 10px; font-size: 12.5px; pointer-events: none; box-shadow: var(--sh); }
#tip b { display: block; color: var(--amber); margin-bottom: 2px; }
canvas.spark { width: 100%; height: 90px; display: block; }

#modal { position: fixed; inset: 0; background: rgba(30, 22, 14, 0.55); display: grid; place-items: center; z-index: 50; padding: 20px; }
#modalBox { width: min(600px, 100%); max-height: 90vh; overflow: auto; background: var(--paper); border-radius: 18px; border: 1px solid var(--line); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.5); padding: 22px 24px; animation: rise 0.25s ease; }
#modalBox.wide { width: min(820px, 100%); }
#modalBox h2 { margin: 6px 0 8px; font: 800 24px/1.15 var(--disp); }
#modalBox .tag { display: inline-block; font: 600 11px var(--body); text-transform: uppercase; letter-spacing: 0.1em; padding: 3px 9px; border-radius: 99px; background: var(--mint); color: var(--green); }
#modalBox .tag.Integrity, #modalBox .tag.Exposed, #modalBox .tag.Crisis { background: #f7d9d2; color: var(--red); }
#modalBox .body { font-size: 14.5px; margin-bottom: 14px; }
.choice { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 11px 13px; margin-bottom: 8px; }
.choice:hover:not(:disabled) { border-color: var(--green); background: #fff; }
.choice b { display: block; font-size: 14px; } .choice span { font-size: 12.5px; color: var(--mute); }
.choice:disabled { opacity: 0.45; }
.out { background: var(--mint); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-size: 14px; }
.lesson { border-left: 4px solid var(--amber); background: #fdf3da; border-radius: 0 10px 10px 0; padding: 9px 12px; margin: 10px 0; font-size: 13px; }
.lesson b { display: block; }
#toasts { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: #f6efdc; padding: 8px 14px; border-radius: 99px; font-size: 13px; animation: rise 0.25s ease; }
.toast.bad { background: var(--red); }

#title { position: fixed; inset: 0; z-index: 60; background: #e9dfc7; display: grid; place-items: center; }
#titleScene { position: absolute; inset: 0; width: 100%; height: 100%; }
.tcard { position: relative; width: min(560px, 92vw); background: rgba(255, 253, 246, 0.94); backdrop-filter: blur(6px); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 30px 80px -30px rgba(42, 32, 24, 0.5); padding: 30px 32px 24px; }
.tkick { font: 600 11.5px var(--body); text-transform: uppercase; letter-spacing: 0.14em; color: var(--green2); }
.tcard h1 { margin: 6px 0 8px; font: 800 52px/0.95 var(--disp); letter-spacing: -0.01em; color: var(--green); }
.tsub { margin: 0 0 16px; font-size: 15px; }
.tform { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.tform label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--mute); }
.tform input { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: 500 14px var(--body); }
.trow { display: flex; gap: 8px; flex-wrap: wrap; }
.tlearn { margin: 16px 0 0; padding-top: 14px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--mute); }
#lbPanel { margin-top: 12px; max-height: 220px; overflow: auto; }

@media print {
  body { overflow: visible; background: #fff; }
  #app, #title, #toasts { display: none !important; }
  #modal { position: static; background: none; padding: 0; display: block; }
  #modalBox { max-height: none; box-shadow: none; border: 0; width: 100%; }
  .noprint { display: none !important; }
}
