:root{color-scheme:only light}
*{box-sizing:border-box}
html,body{margin:0;height:100%;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;color:#1f2937;background:#f3f4f6}
body{display:flex;flex-direction:column}
header{display:flex;flex-wrap:wrap;align-items:center;gap:10px;padding:8px 12px;background:#14532d;color:#fff}
.brand{font-weight:700;font-size:17px}
#totals{flex:1;font-size:14px;opacity:.95}
.actions{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
button,.btn,select{font:inherit;font-size:14px;padding:7px 11px;border-radius:7px;border:1px solid #cbd5e1;background:#fff;color:#111827;cursor:pointer;min-height:36px}
header button,header .btn,header select{border-color:#166534}
button:hover,.btn:hover{background:#ecfdf5}
.ghost{background:transparent;color:#fff;border-color:#86efac}
.danger{color:#b91c1c;border-color:#fecaca}
nav#tabs{display:flex;gap:4px;padding:6px 10px 0;background:#e5e7eb;overflow-x:auto}
.tab{display:flex;align-items:center;gap:6px;padding:8px 12px;border-radius:8px 8px 0 0;background:#d1d5db;cursor:pointer;white-space:nowrap;font-size:14px;user-select:none}
.tab.active{background:#fff;font-weight:600}
.tab .seat{font-size:12px;color:#065f46;background:#d1fae5;border-radius:10px;padding:1px 7px}
.tab .dup{color:#b45309}
.tab.add{background:transparent;border:1px dashed #9ca3af}
#main{flex:1;display:flex;min-height:0;background:#fff}
#palette,#props{width:190px;padding:10px;overflow:auto;border-right:1px solid #e5e7eb;display:flex;flex-direction:column;gap:6px}
#props{width:250px;border-right:0;border-left:1px solid #e5e7eb}
#palette h3,#props h3{margin:8px 0 2px;font-size:13px;text-transform:uppercase;letter-spacing:.04em;color:#6b7280}
.hint{font-size:12px;color:#6b7280}
.chk{font-size:14px;display:flex;gap:6px;align-items:center}
#stageWrap{flex:1;position:relative;min-width:0;background:#f8fafc}
#stage{width:100%;height:100%;display:block;touch-action:none;user-select:none;-webkit-user-select:none}
#props label{display:flex;flex-direction:column;font-size:12px;color:#4b5563;gap:2px}
#props input,#props select{width:100%;min-width:0;font:inherit;font-size:15px;padding:6px 8px;border:1px solid #cbd5e1;border-radius:6px}
#props .row{display:flex;gap:6px}#props .row>*{flex:1}
.warn{background:#fef3c7;color:#92400e;border-radius:6px;padding:6px 8px;font-size:12px}
.note{background:#eff6ff;color:#1e3a8a;border-radius:6px;padding:6px 8px;font-size:12px}
.tbl{cursor:grab}.tbl.sel .shape{stroke:#f59e0b;stroke-width:3px;vector-effect:non-scaling-stroke}
#printArea{display:none}
@media (max-width:900px){#palette{width:130px}#props{width:200px}}

@media (max-width:700px){
  header{padding:6px 8px!important;gap:6px!important}
  header .brand{font-size:16px}
  header #totals{font-size:11px;width:100%}
  header .actions{gap:4px!important;flex-wrap:wrap}
  header .actions button,header .actions select,header .actions .btn{padding:5px 8px!important;font-size:13px!important}
  #main{flex-direction:column;overflow:auto}
  #stageWrap{order:1;flex:none;height:62vh;min-height:320px;border-bottom:1px solid #e5e7eb}
  #palette{order:2;width:auto;flex-direction:row;flex-wrap:nowrap;overflow-x:auto;border-right:0;border-bottom:1px solid #e5e7eb;padding:6px 8px;align-items:center}
  #palette h3,#palette p,#palette .hint{display:none}
  #palette button,#palette label{flex:none;white-space:nowrap;width:auto!important}
  #props{order:3;width:auto;border-left:0;padding:8px 10px}
  body.has-sel #props{position:fixed;left:0;right:0;bottom:0;max-height:45vh;overflow-y:auto;background:#fff;z-index:60;border-top:1px solid #cbd5e1;border-radius:14px 14px 0 0;box-shadow:0 -6px 20px rgba(0,0,0,.18);padding:10px 12px calc(14px + env(safe-area-inset-bottom))}
  body.has-sel #props .sheetClose{display:block}
  body.has-sel #main{padding-bottom:45vh}
}
@media print{
  @page{size:landscape;margin:8mm}
  header,nav,#main{display:none!important}
  html,body{background:#fff!important}
  #printArea{display:block}
  .page{page-break-after:always;break-after:page;height:190mm;display:flex;flex-direction:column}
  .page:last-child{page-break-after:auto;break-after:auto}
  .page h1{font-size:22pt;margin:0 0 2mm}
  .page .sub{font-size:12pt;margin-bottom:3mm}
  .page svg{flex:1;width:100%;height:100%}
}

.sheetClose{display:none;position:sticky;top:0;float:right;margin:-2px -4px 0 8px;width:34px;height:34px;border-radius:17px;border:1px solid #cbd5e1;background:#f1f5f9;font-size:16px;line-height:1;z-index:2}
