/* The panel's width before any drag (--coord-panel-width, written by js/utils.js). One token: the
   fullscreen drawer and its rail fall back to it (components/fullscreen.css, animations/responsive.css). */
:root { --coord-panel-default: 405px; }
.coordinates-panel {
    /* flex:0 0 auto, so the canvas-section (flex:1) takes the rest. */
    flex: 0 0 auto;
    width: var(--coord-panel-width, var(--coord-panel-default));
    min-width: 240px;
    max-width: 640px;
    background: var(--bg-coord-panel);
    padding: 10px 12px;
    border-radius: 5px;
    margin-top: 10px;   /* level with .canvas-viewport's top (layout/canvas/frame.css) */
    transition: padding 0.2s;
    position: sticky;
    top: 10px;
    /* max-height is set by ZoomPan.syncCoordPanelHeight: a `calc(100vh - …)` cap over-reports by however
       far down the panel sits. This is the boot fallback. */
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}
#coord-body {
    overflow-y: auto;
    min-height: 0;   /* a flex child defaults to min-content — without this it never shrinks */
}
.coordinates-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}
/* The canvas↔panel drag handle, the desktop splitter's counterpart (mainContent.js). */
.panel-resizer {
    position: relative;
    flex: 0 0 auto;
    align-self: stretch;
    width: 8px;
    margin-top: 10px;
    border-radius: 3px;
    cursor: col-resize;
    background: transparent;
    transition: background 0.15s;
}
.panel-resizer::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 3px;
    height: 34px;
    border-radius: 2px;
    background: var(--border-main);
    transition: background 0.15s, height 0.15s;
}
.panel-resizer:hover::before, .panel-resizer.dragging::before { background: var(--accent); height: 52px; }
.main-content:has(.coordinates-panel.coord-collapsed) .panel-resizer { display: none; }
.coordinates-panel.coord-collapsed {
    /* --panel-slide-out-ms (panel/coordFold.js), declared on the after-change style so only the way out takes it. */
    transition: width var(--panel-slide-out-ms) var(--fold-ease),
                min-width var(--panel-slide-out-ms) var(--fold-ease),
                padding var(--panel-slide-out-ms) var(--fold-ease),
                margin-right var(--panel-slide-out-ms) var(--fold-ease);
    /* 0, not `unset`: `min-width: auto` cannot interpolate, and the 240px floor snapped back at once. */
    min-width: 0;
    max-width: unset;
    /* No card on the rail, only the button (user report). 10px from the canvas and from the window edge, 5px under the
       canvas top, as the desktop's (PANEL_TOGGLE_INSET/TOP): 4px main gap + 6px, and 10px into the page's 20px padding. */
    width: 34px;
    padding: 5px 0 5px 6px;
    margin-right: -10px;
    background: transparent;
    overflow: hidden;
}
.coord-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 6px;
    white-space: nowrap;
}
/* One 28px rounded square in both states, so the control never changes shape. */
#toggle-coord-panel {
    background: transparent;
    border: 1px solid var(--border-main) !important;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    line-height: 1;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    margin-left: auto;
}
#toggle-coord-panel:hover { background: var(--bg-info); }
/* Inside its own edge: the folded rail clips what overflows it. */
#toggle-coord-panel:focus-visible { outline-offset: -2px; }
.coordinates-panel.coord-collapsed #coord-body { display: none; }
.coordinates-panel.coord-collapsed .coord-tabs { display: none; }
.coordinates-panel.coord-collapsed .coord-panel-header { margin-bottom: 0; }

.coord-tabs { display: inline-flex; gap: 2px; }
.coord-tab {
    font-weight: bold;
    font-size: 12px;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 3px 8px 4px;
    cursor: pointer;
    line-height: 1.3;
}
.coord-tab:hover { color: var(--text-coord-h3); }
.coord-tab-active {
    color: var(--text-coord-h3);
    border-bottom-color: var(--accent);
}

/* Fixed layout over the colgroup, so a row fits the panel at its 240px narrowest. */
.lines-table { table-layout: fixed; }
.lines-index-col { width: 24px; }
.lines-swatch-col { width: 26px; }
.lines-num-col { width: 30px; }
.lines-count-col { width: 34px; }
.lines-remove-col { width: 26px; }
.lines-row { cursor: pointer; }
.lines-row:hover { background-color: color-mix(in srgb, var(--accent) 18%, transparent); }
/* The row whose line is under the canvas cursor. */
.lines-row-hover:not(.lines-row-selected) {
    background-color: color-mix(in srgb, var(--accent) 18%, transparent);
}
.lines-row-selected td { box-shadow: inset 0 1px var(--accent), inset 0 -1px var(--accent); }
.lines-row-selected td:first-child { box-shadow: inset 1px 0 var(--accent), inset 0 1px var(--accent), inset 0 -1px var(--accent); }
.lines-row-selected td:last-child { box-shadow: inset -1px 0 var(--accent), inset 0 1px var(--accent), inset 0 -1px var(--accent); }
.lines-table td.lines-swatch-cell { text-align: center; padding-left: 2px; padding-right: 2px; }
.lines-swatch, .lines-point-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid var(--border-main);
    display: inline-block;
    vertical-align: middle;
}
.lines-point-swatch { border-radius: 50%; }
/* A double-click edits it (panel/lines/numEdit.js). */
.lines-num { cursor: text; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; }
.lines-num:has(.lines-num-input) { padding: 2px; }
/* Never display:none (panel/lines/swatchPicker.js), or the native picker opens at the page corner. */
.lines-color-picker { position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.lines-remove-cell, .lines-eye-cell { padding: 4px 2px; }
/* The name takes what the fixed columns leave; unnamed, it shows its muted "Line N". */
.lines-name { cursor: text; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lines-name-unset { color: var(--text-muted); font-style: italic; }
.lines-name:has(.lines-name-input) { padding: 2px; }
/* A hidden line keeps its row, dimmed; its eye stays at full strength so it reads as the way back. */
.lines-row-hidden td:not(.lines-eye-cell) { opacity: 0.45; }
