/* ---------- windows ---------- */
.win { position: absolute; display: flex; flex-direction: column; min-width: 220px; min-height: 120px; pointer-events: auto; background: var(--frame); border: var(--frame-w) solid var(--frame); border-radius: var(--radius) var(--radius) 0 0; box-shadow: var(--win-shadow); color: var(--body-fg); }
.win.inactive { background: var(--frame-off); border-color: var(--frame-off); }
.win.min { display: none; }
.win.max { border-radius: 0; }
.tb { flex: none; display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 4px 0 7px; background: var(--title-bg); color: var(--title-fg); font: 700 var(--title-size)/1 var(--title-font); text-shadow: var(--title-shadow); border-radius: calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0 0; touch-action: none; cursor: default; }
.win.max .tb { border-radius: 0; }
.inactive .tb { background: var(--title-bg-off); color: var(--title-fg-off); }
.tb .ico { width: 16px; height: 16px; }
.tb .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctl { display: flex; gap: 2px; }
.ctl button { width: 22px; height: 22px; display: grid; place-items: center; padding: 0; background: var(--ctl-bg); color: var(--ctl-fg); border: 1px solid var(--ctl-border); border-radius: var(--ctl-radius); }
.ctl button svg { width: 12px; height: 12px; }
.ctl button[data-act="close"] { background: var(--close-bg); color: var(--close-fg); }
.ctl button:hover { filter: brightness(1.15); }
.wbody { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--body-bg); color: var(--body-fg); overflow: hidden; }
.grip { position: absolute; right: 0; bottom: 0; width: 14px; height: 14px; cursor: nwse-resize; touch-action: none; background: linear-gradient(135deg, transparent 50%, var(--line) 50%, var(--line) 60%, transparent 60%, transparent 70%, var(--line) 70%, var(--line) 80%, transparent 80%); }
.win.max .grip { display: none; }

/* shared window parts */
.menubar { flex: none; display: flex; flex-wrap: wrap; gap: 0 2px; padding: 1px 4px; border-bottom: 1px solid var(--line); font-size: var(--small-size); }
.menubar span { padding: 2px 7px; border-radius: 2px; }
.menubar span:hover { background: var(--sel); color: var(--sel-fg); }
.toolbar { flex: none; display: flex; flex-wrap: wrap; gap: 2px; padding: 3px 4px; border-bottom: 1px solid var(--line); }
.tool { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; border: 1px solid transparent; border-radius: 3px; background: none; color: var(--body-fg); font-size: var(--small-size); }
.tool:hover { border-color: var(--line); background: var(--panel); }
.tool:disabled { opacity: 0.45; cursor: default; border-color: transparent; background: none; }
.tool svg { width: 20px; height: 20px; }
.addr { flex: none; display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-bottom: 1px solid var(--line); font-size: var(--small-size); color: var(--muted); }
.addr .field { flex: 1; }
.field { min-width: 0; padding: 3px 6px; background: var(--field-bg); color: var(--field-fg); border: 1px solid var(--field-border); border-radius: 0; user-select: text; -webkit-user-select: text; }
.btn { min-width: 76px; padding: 4px 12px; background: var(--face); color: var(--face-fg); border: 1px solid var(--face-border); border-radius: 3px; }
.btn:hover { box-shadow: inset 0 0 0 2px var(--accent); }
.btn:active { filter: brightness(0.94); }
.btn:disabled { opacity: 0.5; cursor: default; box-shadow: none; }
.btn.small { min-width: 0; padding: 2px 9px; }
.dlg-btns { flex: none; display: flex; justify-content: flex-end; gap: 6px; padding: 8px 10px 10px; }
.tabs { flex: none; display: flex; flex-wrap: wrap; padding: 8px 8px 0; }
.tabs button { padding: 4px 11px; margin-right: -1px; background: var(--face); color: var(--face-fg); border: 1px solid var(--line); border-bottom: none; border-radius: 3px 3px 0 0; font-size: var(--small-size); }
.tabs button[aria-selected="true"] { position: relative; top: 1px; background: var(--panel); color: var(--panel-fg); box-shadow: inset 0 2px 0 var(--accent); }
.tabpanel { flex: 1; min-height: 0; margin: 0 8px; padding: 10px; overflow: auto; background: var(--panel); color: var(--panel-fg); border: 1px solid var(--line); }
.statusbar { flex: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 3px 8px; border-top: 1px solid var(--line); font-size: var(--small-size); color: var(--muted); }
.statusbar > * + * { padding-left: 8px; border-left: 1px solid var(--line); }
.chip { display: inline-block; padding: 0 6px; border: 1px solid currentColor; border-radius: 8px; font-size: 0.82em; line-height: 1.5; color: var(--link); }
.chip[data-stage="live"] { color: var(--ok); }
.chip[data-stage="pilot"] { color: var(--accent); }
.chip[data-stage="spitballing"] { color: var(--muted); }
.table-wrap { flex: 1; min-height: 0; overflow: auto; border: 1px solid var(--line); background: var(--panel); }
.grid { width: 100%; border-collapse: collapse; font-size: var(--small-size); color: var(--panel-fg); }
.grid th { position: sticky; top: 0; padding: 3px 8px; text-align: left; font-weight: 400; white-space: nowrap; background: var(--body-bg); border: 1px solid var(--line); border-top: 0; }
.grid td { padding: 4px 8px; white-space: nowrap; font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--line); }
.grid td.wrap { white-space: normal; min-width: 200px; }
.grid tr.on td { background: var(--sel); color: var(--sel-fg); }
.grid tbody tr { cursor: default; }
.row-ico { display: inline-block; width: 16px; height: 16px; margin-right: 6px; vertical-align: -3px; }
.dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--ok); }
.dot.idle { background: var(--muted); }
.note { margin: 0; font-size: var(--small-size); color: var(--muted); }
.selectable { user-select: text; -webkit-user-select: text; }

/* window motion */
.win.opening { animation: win-in 0.16s ease-out; }
.win.closing { animation: win-out 0.12s ease-in forwards; pointer-events: none; }
.win.minimizing { transform-origin: 50% 100%; animation: win-min 0.18s ease-in forwards; pointer-events: none; }
@keyframes win-in { from { opacity: 0; transform: scale(0.94); } }
@keyframes win-out { to { opacity: 0; transform: scale(0.96); } }
@keyframes win-min { to { opacity: 0; transform: translateY(60px) scale(0.6); } }
.menubar a { padding: 2px 7px; border-radius: 2px; color: inherit; text-decoration: none; }
.menubar a:hover, .menubar a:focus-visible { background: var(--sel); color: var(--sel-fg); }
