/* Master table tab inside Script Desk: same tokens as tracker.css / script-desk.css. */
.mt-root {display: flex; flex-direction: column; gap: 12px; padding: 16px 16px 64px; max-width: 1400px; width: 100%; min-width: 0; color: var(--text); font-size: 14px;}
.mt-root *, .mt-root *::before, .mt-root *::after {box-sizing: border-box;}
.mt-root [hidden] {display: none !important;}
.mt-root .mt-btn {font: inherit; font-size: 14px; border-radius: 6px; padding: 7px 12px; border: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer; white-space: nowrap;}
.mt-root .mt-btn:hover:not(:disabled) {border-color: var(--border-strong);}
.mt-root .mt-btn.mt-primary {background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600;}
.mt-root .mt-btn.mt-primary:hover:not(:disabled) {background: var(--accent-hover); border-color: var(--accent-hover);}
.mt-root .mt-btn:disabled {opacity: .4; cursor: not-allowed;}
.mt-root .mt-btn:focus-visible, .mt-root .mt-inp:focus-visible {outline: 2px solid var(--accent); outline-offset: 1px;}
.mt-root .mt-empty {display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; max-width: 560px;}
.mt-root .mt-empty h3 {margin: 0; font-size: 16px; font-weight: 600;}
.mt-root .mt-empty p {margin: 0; color: var(--text2);}
.mt-root .mt-state {padding: 16px 0; color: var(--text2);}
.mt-root .mt-err {color: var(--red);}
.mt-root .mt-bar {display: flex; align-items: center; gap: 12px; flex-wrap: wrap;}
.mt-root .mt-count {color: var(--text2);}
.mt-root .mt-status {font-size: 13px; color: var(--green);}
.mt-root .mt-status.mt-err {color: var(--red);}
.mt-root .mt-grow {flex: 1;}
.mt-root .mt-banner {display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--red); border-radius: 8px; color: var(--red); background: var(--surface);}
.mt-root .mt-table {background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: auto; max-height: calc(100dvh - 320px); min-height: 120px;}
.mt-root .mt-tr {display: grid; grid-template-columns: 40px minmax(220px,1.4fr) repeat(3, minmax(180px,1fr)); min-width: 820px; gap: 0; align-items: start; border-bottom: 1px solid var(--surface2);}
.mt-root .mt-tr:last-child {border-bottom: 0;}
.mt-root .mt-tr > span {padding: 6px 6px; min-width: 0;}
.mt-root .mt-n {padding-top: 12px; color: var(--text3); font-variant-numeric: tabular-nums; text-align: right;}
.mt-root .mt-line {padding: 12px 10px 8px 6px; line-height: 1.4; overflow-wrap: anywhere; border-right: 1px solid var(--border);}
.mt-root .mt-th {position: sticky; top: 0; z-index: 2; background: var(--bg); color: var(--text3); font-size: 12px; align-items: center; border-bottom: 1px solid var(--border);}
.mt-root .mt-th > span {padding-top: 8px; padding-bottom: 8px;}
.mt-root .mt-inp {width: 100%; font: inherit; font-size: 14px; color: var(--text); background: transparent; border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; resize: none; field-sizing: content; min-height: 34px; line-height: 1.4;}
.mt-root .mt-inp:disabled {opacity: .6;}

.mt-root .mt-hookcell {display: flex; gap: 4px; align-items: flex-start;}
.mt-root .mt-hookcell .mt-inp {flex: 1; min-width: 0;}
.mt-root .mt-pick {flex-shrink: 0; font: inherit; font-size: 12px; width: 26px; height: 34px; border: 1px solid var(--border); border-radius: 6px; background: transparent; color: var(--text2); cursor: pointer;}
.mt-root .mt-pick:hover:not(:disabled) {border-color: var(--border-strong); color: var(--text);}
.mt-root .mt-pick:disabled {opacity: .4; cursor: not-allowed;}
.mt-root .mt-tr.mt-marked {background: var(--accent-light);}
.mt-root .mt-edited {display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px; font-size: 11px; line-height: 18px; color: var(--accent); border: 1px solid var(--accent); vertical-align: 1px; cursor: help;}
.mt-root .mt-syncerr {font-size: 12px; color: var(--text3);}
.mt-root .mt-notice {border: 1px solid var(--orange, #c2410c); border-radius: 8px; background: var(--surface); padding: 12px 14px; display: flex; flex-direction: column; gap: 12px;}
.mt-root .mt-nhead {display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;}
.mt-root .mt-nhead p {margin: 0; font-weight: 600;}
.mt-root .mt-ngroup {display: flex; flex-direction: column; gap: 6px;}
.mt-root .mt-ngroup h4 {margin: 0; font-size: 12px; font-weight: 600; color: var(--text2);}
.mt-root .mt-diff {display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 4px 12px; font-size: 13px;}
.mt-root .mt-dh {font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: .04em;}
.mt-root .mt-old {color: var(--text2); text-decoration: line-through; text-decoration-color: var(--text3);}
.mt-root .mt-removed {border: 1px dashed var(--border); border-radius: 6px; padding: 6px 8px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; user-select: text;}
.mt-root .mt-rline {display: flex; gap: 8px; justify-content: space-between; align-items: center;}
.mt-root .mt-hookline {display: flex; gap: 8px;}
.mt-root .mt-hk {color: var(--text3); min-width: 80px;}
.mt-root .mt-hv {white-space: pre-wrap; overflow-wrap: anywhere;}
.mt-root .mt-nohooks {color: var(--text3); font-size: 12px;}
.mt-root .mt-added {font-size: 13px;}
.mt-root .mt-btn.mt-small {padding: 3px 8px; font-size: 12px;}
/* Template picker: appended to <body> so the table's scrolling never clips it. */
.mt-popover {position: fixed; z-index: 1000; width: 300px; max-height: 330px; display: flex; flex-direction: column; gap: 6px; padding: 8px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-medium); font-size: 13px; font-family: var(--font-sans);}
.mt-popover *, .mt-popover *::before {box-sizing: border-box;}
.mt-popover .mt-inp {width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px;}
.mt-popover .mt-btn {font: inherit; border-radius: 6px; padding: 6px 10px; border: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer; text-align: left;}
.mt-popover .mt-btn:hover {border-color: var(--border-strong);}
.mt-popover .mt-plist {overflow: auto; display: flex; flex-direction: column; gap: 2px; min-height: 32px;}
.mt-popover .mt-pitem {display: flex; align-items: stretch; gap: 2px;}
.mt-popover .mt-puse {flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; text-align: left; font: inherit; color: var(--text); background: transparent; border: 0; border-radius: 6px; padding: 6px 8px; cursor: pointer;}
.mt-popover .mt-puse:hover, .mt-popover .mt-puse:focus-visible {background: var(--surface2); outline: none;}
.mt-popover .mt-pname {font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
.mt-popover .mt-ptext {color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
.mt-popover .mt-pdel {font: inherit; border: 0; background: transparent; color: var(--text3); cursor: pointer; border-radius: 6px; padding: 0 8px;}
.mt-popover .mt-pdel:hover {color: var(--red); background: var(--surface2);}
.mt-popover .mt-pstate {padding: 6px 8px; color: var(--text2);}
.mt-popover .mt-pnote:empty {display: none;}
.mt-popover .mt-pnote {font-size: 12px; color: var(--text2);}
.mt-popover .mt-err {color: var(--red);}

/* Script Desk gives the table the whole workspace (set by script-desk-view.js while the tab is open). */
#view-script-desk .sd-workspace.sd-wide {grid-template-columns: minmax(0,1fr);}
#view-script-desk .sd-workspace.sd-wide > .sd-guide {display: none;}

.mt-root .mt-table{max-width:100%;min-width:0;overscroll-behavior-x:contain}
.mt-root .mt-line{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mt-root .mt-inp:not(:focus){field-sizing:fixed;height:34px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mt-root .mt-inp:focus{field-sizing:content;min-height:80px;white-space:pre-wrap}
.mt-root .mt-tr>*{min-width:0}
