:root {
  --bg: #f5f6f4; --panel: #fff; --ink: #22272b; --ink2: #5b636a; --ink3: #8a9298;
  --line: #e2e5e2; --line2: #eef0ee; --accent: #4f7f6a; --accent2: #e6efe9; --accentInk: #fff;
  --red: #b23a3a; --redBg: #fbeaea; --green: #2e7a4b; --greenBg: #e7f3ea; --amber: #a86a12; --amberBg: #fdf2dd;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }

.app { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.side { background: #fff; border-right: 1px solid var(--line); padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .logo { display: block; width: 150px; margin: 0 auto 10px; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; color: var(--ink2); text-decoration: none; font-weight: 500; }
.side nav a:hover { background: var(--line2); }
.side nav a.on { background: var(--accent2); color: var(--accent); }
.side nav .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink3); margin: 14px 12px 4px; }
.side .count { margin-left: auto; font-size: 11px; background: var(--line2); color: var(--ink2); border-radius: 10px; padding: 1px 7px; }

.main { min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top .sp { flex: 1; }
.top label { font-size: 12px; color: var(--ink3); display: flex; align-items: center; gap: 6px; }
.proto { font-size: 11px; background: var(--amberBg); color: var(--amber); padding: 3px 8px; border-radius: 6px; }
.page { padding: 22px 24px 60px; max-width: 1320px; }
h1 { font-size: 24px; margin: 0 0 4px; }
.sub { color: var(--ink2); margin: 0 0 18px; }
h2 { font-size: 17px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 16px 0 8px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.muted { color: var(--ink3); }
.small { font-size: 12px; }
.right { margin-left: auto; }

.btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 12px; cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--line2); }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--accentInk); }
.btn.pri:hover { filter: brightness(.95); }
.btn.sm { padding: 3px 8px; font-size: 12px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink2); }
.btn.ghost:hover { background: var(--line2); }
.btn.danger { color: var(--red); }
.btn[disabled] { opacity: .5; cursor: default; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs a { padding: 9px 14px; color: var(--ink2); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1px; cursor: pointer; font-weight: 500; }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }

input[type=text], input[type=date], input[type=number], input[type=email], select, textarea {
  border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; background: #fff; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent2); border-color: var(--accent); }
textarea { width: 100%; min-height: 70px; resize: vertical; line-height: 1.45; }
textarea.tall { min-height: 220px; }
input.bare, textarea.bare { border-color: transparent; background: transparent; }
input.bare:hover, textarea.bare:hover { border-color: var(--line); }
input.w100 { width: 100%; }

table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 12px; color: var(--ink3); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 6px 8px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
.done-row td { color: var(--ink3); }
.done-row input.bare { text-decoration: line-through; color: var(--ink3); }

.av { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: #50585e; color: #fff; font-size: 11px; font-weight: 600; flex: none; }
.av.lg { width: 34px; height: 34px; font-size: 13px; }
.pill { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px; background: var(--line2); color: var(--ink2); font-weight: 600; }
.pill.on, .pill.green { background: var(--greenBg); color: var(--green); }
.pill.off, .pill.red { background: var(--redBg); color: var(--red); }
.pill.done { background: #e8eef7; color: #2f5d9a; }
.pill.amber { background: var(--amberBg); color: var(--amber); }
.overdue { color: var(--red); font-weight: 600; }

/* scorecard */
.sc-wrap { overflow-x: auto; }
table.sc { border-collapse: collapse; min-width: 100%; }
table.sc th, table.sc td { border-bottom: 1px solid var(--line2); padding: 4px 6px; font-size: 13px; white-space: nowrap; }
table.sc th { font-size: 11px; color: var(--ink3); font-weight: 500; text-align: center; }
table.sc th.l, table.sc td.l { text-align: left; }
table.sc td.title { min-width: 260px; max-width: 360px; white-space: normal; }
table.sc td.cell { padding: 2px; }
table.sc td.cell input { width: 70px; text-align: right; border: 1px solid transparent; border-radius: 5px; padding: 4px 6px; background: transparent; }
table.sc td.cell input:hover { border-color: var(--line); }
table.sc td.cell.good input { background: var(--greenBg); color: var(--green); }
table.sc td.cell.bad input { background: var(--redBg); color: var(--red); }
table.sc td.num { text-align: right; color: var(--ink2); }
table.sc tr.cur-col td.cell { }
.sc-edit { background: var(--line2); }

/* meeting runner */
.mtg { display: grid; grid-template-columns: 270px 1fr; gap: 16px; align-items: start; }
.agenda { position: sticky; top: 70px; }
.agenda .it { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 8px; cursor: pointer; color: var(--ink2); }
.agenda .it:hover { background: var(--line2); }
.agenda .it.on { background: var(--accent2); color: var(--accent); font-weight: 600; }
.agenda .it .m { margin-left: auto; font-size: 12px; font-variant-numeric: tabular-nums; }
.agenda .it .m.over { color: var(--red); }
.clock { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rating-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }

/* reviews */
.rv-cols { display: grid; grid-template-columns: 220px 1fr 1fr; gap: 0; }
.rv-cols > div { padding: 10px 12px; border-bottom: 1px solid var(--line2); }
.rv-cols .hd { font-weight: 600; font-size: 12px; color: var(--ink3); text-transform: uppercase; letter-spacing: .04em; background: var(--line2); }
.rv-cols .lbl { font-weight: 600; }
.rv-cols .lbl .muted { font-weight: 400; display: block; font-size: 12px; margin-top: 2px; }
.hidden-side { color: var(--ink3); font-style: italic; font-size: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 4px 10px; cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: #fff; }
.seg button[disabled] { cursor: default; }
.pa-cell { text-align: center; font-weight: 700; }
.pa-plus { color: var(--green); } .pa-mid { color: var(--amber); } .pa-minus { color: var(--red); }
.status-steps { display: flex; gap: 6px; flex-wrap: wrap; }
.status-steps span { font-size: 12px; padding: 4px 10px; border-radius: 14px; background: var(--line2); color: var(--ink3); }
.status-steps span.ok { background: var(--greenBg); color: var(--green); }

/* VTO */
.vto-sec { margin-bottom: 18px; }
.vto-sec > .hd { background: #8d9491; color: #fff; text-align: center; font-weight: 600; padding: 8px; border-radius: 6px; margin-bottom: 10px; }
.kv { display: grid; grid-template-columns: 1fr 160px 30px; gap: 6px; align-items: center; margin-bottom: 6px; }

/* accountability chart */
.ac { overflow-x: auto; padding-bottom: 20px; }
.ac ul { display: flex; justify-content: center; padding: 18px 0 0; margin: 0; position: relative; list-style: none; }
.ac li { padding: 18px 8px 0; position: relative; text-align: center; }
.ac li::before, .ac li::after { content: ''; position: absolute; top: 0; right: 50%; width: 50%; height: 18px; border-top: 1px solid #c7ccc8; }
.ac li::after { right: auto; left: 50%; border-left: 1px solid #c7ccc8; }
.ac li:only-child::before, .ac li:only-child::after { display: none; }
.ac li:only-child { padding-top: 0; }
.ac li:first-child::before, .ac li:last-child::after { border: 0 none; }
.ac li:last-child::before { border-right: 1px solid #c7ccc8; border-radius: 0 6px 0 0; }
.ac li:first-child::after { border-radius: 6px 0 0 0; }
.ac ul ul::before { content: ''; position: absolute; top: 0; left: 50%; border-left: 1px solid #c7ccc8; height: 18px; }
.ac > ul { padding-top: 0; width: max-content; min-width: 100%; }
.agenda .it .m { white-space: nowrap; }
input[type=date] { width: 140px; }
.seat { display: inline-block; width: 210px; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 10px 12px; vertical-align: top; }
.seat .st { font-weight: 700; }
.seat .who { display: flex; align-items: center; gap: 6px; margin: 6px 0; }
.seat ul.roles { display: block; padding: 0 0 0 16px; margin: 6px 0 0; }
.seat ul.roles::before { display: none; }
.seat ul.roles li { display: list-item; padding: 0; text-align: left; font-size: 12px; color: var(--ink2); }
.seat ul.roles li::before, .seat ul.roles li::after { display: none; }

.empty { padding: 18px; text-align: center; color: var(--ink3); background: var(--line2); border-radius: 8px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #22272b; color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 13px; z-index: 50; }
.addbar { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.addbar input[type=text] { flex: 1; min-width: 200px; }
.kpi-tile { padding: 12px 14px; }
.kpi-tile .big { font-size: 26px; font-weight: 700; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; padding: 6px 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side .logo, .side nav .grp { display: none; }
  .side nav { display: flex; overflow-x: auto; gap: 2px; }
  .side nav a { white-space: nowrap; padding: 6px 10px; }
  .top { flex-wrap: wrap; padding: 8px 12px; }
  .page { padding: 14px 12px 40px; }
  .grid2, .grid3, .mtg { grid-template-columns: 1fr; }
  .rv-cols { grid-template-columns: 1fr; }
  .agenda { position: static; }
}
@media print {
  .side, .top, .noprint, .btn, .tabs { display: none !important; }
  .app { display: block; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
  textarea, input { border: 0 !important; resize: none; }
}
