/* governance.css — Data-tab governance (undo banner, history drawer, record view), masked cells,
   column layout (hidden / pinned), Admin → Sensitive columns, and the cost-guard review sheet. */

/* ---------------------------------------------------------------- Data tab layout */
#panel-data {
    position: relative;
}

.data-body {
    display: flex;
    flex: 1;
    min-height: 0;
    min-width: 0;
}

.data-body > .grid-wrap {
    flex: 1;
    min-width: 0;
}

/* ---------------------------------------------------------------- save banner with Undo */
.gov-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    font-size: 12px;
    background: var(--ok-soft);
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.gov-banner[hidden] {
    display: none;
}

.gov-banner .gov-banner-text {
    font-weight: 500;
}

.gov-banner .gov-banner-id {
    font-size: 11px;
}

/* ---------------------------------------------------------------- history drawer */
.gov-history {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(520px, 60%);
    background: var(--surface);
    border-left: 1px solid var(--border-strong);
    box-shadow: var(--shadow-2, 0 8px 30px rgba(0, 0, 0, .12));
    z-index: 5;
    overflow: auto;
    padding: 10px 14px 16px;
    font-size: 12px;
}

.gov-history[hidden] {
    display: none;
}

.gov-drawer-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.gov-drawer-head strong {
    font-size: 13px;
}

.gov-drawer-hint {
    margin: 0 0 10px;
}

.gov-filter {
    width: 100%;
    margin-bottom: 8px;
}

.gov-empty, .gov-loading {
    padding: 16px 4px;
}

.gov-set {
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    margin-bottom: 8px;
    background: var(--surface);
}

.gov-set.undone {
    opacity: .72;
}

.gov-set-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
}

.gov-set-main {
    flex: 1;
    min-width: 0;
}

.gov-set-line {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.gov-set-meta {
    font-size: 11px;
}

.gov-set-reason {
    padding: 0 8px 6px 36px;
    font-size: 11px;
}

.gov-set-id {
    font-family: var(--mono);
}

.gov-undone {
    background: var(--warn-soft);
    color: var(--warn);
}

.gov-toggle {
    width: 26px;
    padding: 0;
}

.gov-set-body {
    border-top: 1px solid var(--border);
    padding: 8px;
    background: var(--surface-2);
}

.gov-change {
    margin-bottom: 10px;
}

.gov-change-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.gov-change-head code {
    font-size: 11px;
    color: var(--text-2);
}

.gov-op {
    font-weight: 600;
    letter-spacing: .02em;
}

.gov-op-insert {
    background: var(--ok-soft);
    color: var(--ok);
}

.gov-op-update {
    background: var(--warn-soft);
    color: var(--warn);
}

.gov-op-delete {
    background: var(--danger-soft);
    color: var(--danger);
}

.gov-diff-table {
    width: 100%;
    font-size: 11.5px;
}

.gov-diff-table th {
    position: static;
    height: 24px;
}

.gov-diff-table td {
    height: 24px;
    max-width: 220px;
}

.gov-diff-table .gov-col {
    font-family: var(--mono);
    color: var(--text-2);
}

.gov-diff-table tr.gov-changed td.gov-val:nth-child(2) {
    background: var(--danger-soft);
}

.gov-diff-table tr.gov-changed td.gov-val:nth-child(3) {
    background: var(--ok-soft);
}

.gov-diff-note {
    font-size: 11px;
    margin-top: 2px;
}

.gov-masked {
    color: var(--muted);
    letter-spacing: .08em;
}

/* ---------------------------------------------------------------- masked cells & column layout (grid.js) */
td.cell-masked {
    color: var(--muted);
    letter-spacing: .06em;
    background: repeating-linear-gradient(135deg, transparent 0 6px, var(--surface-2) 6px 7px);
}

th .col-masked {
    margin-left: 4px;
    color: var(--warn);
    font-size: 11px;
}

table.grid .col-hidden {
    display: none;
}

table.grid td.col-pinned, table.grid th.col-pinned {
    position: sticky;
    z-index: 2;
    background: var(--surface);
    box-shadow: inset -1px 0 0 var(--border-strong);
}

table.grid thead th.col-pinned {
    z-index: 4;
    background: var(--surface-2);
}

table.grid tbody tr:hover td.col-pinned {
    background: var(--surface-2);
}

table.grid tbody tr.row-selected td.col-pinned {
    background: var(--accent-soft);
}

/* ---------------------------------------------------------------- record view */
.gov-record {
    position: relative;
    width: 360px;
    min-width: 240px;
    max-width: 70vw;
    border-left: 1px solid var(--border-strong);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.gov-record[hidden] {
    display: none;
}

.gov-record-handle {
    position: absolute;
    left: -3px;
    top: 0;
    bottom: 0;
    width: 6px;
    cursor: col-resize;
    z-index: 3;
}

.gov-record-handle:hover {
    background: var(--accent-soft);
}

.gov-record-inner {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

.gov-record-head {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}

.gov-record-body {
    flex: 1;
    overflow: auto;
    padding: 6px 10px 12px;
    font-size: 12px;
}

.gov-record-meta {
    font-size: 11px;
    margin: 2px 0 8px;
    font-family: var(--mono);
}

.gov-record-table {
    width: 100%;
}

.gov-record-table th.gov-record-col {
    position: static;
    width: 34%;
    vertical-align: top;
    white-space: normal;
    padding: 4px 8px;
    height: auto;
    box-shadow: none;
    background: var(--surface-2);
    font-weight: 500;
}

.gov-record-name {
    display: block;
    color: var(--text);
    font-family: var(--mono);
    font-size: 11.5px;
}

.gov-record-type {
    display: block;
    color: var(--muted);
    font-size: 10px;
    font-weight: 400;
}

.gov-record-table td.gov-record-val {
    height: auto;
    padding: 3px 6px;
    white-space: normal;
    max-width: none;
    font-family: var(--mono);
}

.gov-record-table tr.gov-col-hidden th, .gov-record-table tr.gov-col-hidden td {
    opacity: .55;
}

.gov-record-table tr.gov-dirty td {
    background: var(--warn-soft);
}

.gov-record-field {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.gov-record-input {
    flex: 1;
    min-width: 0;
    resize: none;
    font: inherit;
    font-size: 12px;
    line-height: 18px;
    padding: 2px 6px;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--text);
}

.gov-record-input:hover {
    border-color: var(--border);
}

.gov-record-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface);
}

.gov-record-input.is-null::placeholder, .gov-record-input.is-default::placeholder {
    font-style: italic;
    color: var(--muted);
}

.gov-record-tools {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.gov-record-tools .gov-record-btn {
    padding: 0 5px;
    min-width: 0;
    height: 20px;
    line-height: 18px;
}

.gov-record-table td.gov-record-val {
    overflow: visible;
    text-overflow: clip;
}

.gov-marker {
    font-size: 10px;
    color: var(--muted);
    font-style: italic;
}

.gov-marker-dirty {
    color: var(--warn);
    font-style: normal;
}

/* ---------------------------------------------------------------- Admin → Sensitive columns */
.gov-sensitive {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}

.gov-tag-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface-2);
}

.gov-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 120px;
}

.gov-field input, .gov-field select {
    min-width: 140px;
}

.gov-sensitive-bar {
    border: none;
    padding: 0 2px;
}

.gov-sensitive-grid {
    flex: none;
    max-height: 42vh;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
}

.gov-kind {
    margin-left: 4px;
}

.gov-suggest {
    margin-top: 4px;
}

.gov-suggest-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.gov-suggest table.grid th {
    position: static;
}

/* ---------------------------------------------------------------- cost guard sheet */
.gov-guard .gov-guard-stmt {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.gov-guard .gov-guard-warning {
    margin: 2px 0;
}

.gov-guard-list code {
    display: block;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 11px;
    margin-top: 4px;
}

.gov-timeout-note {
    font-size: 11px;
    padding: 4px 2px 0;
}
