/* The “Objekti na mreži” table (planner-grade/civil-objects-view.js).
   Shared stylesheet: transit.html and leaderboard.html both render this table,
   and a second copy of these rules would drift the moment either page changed. */
.civil-objects-modal {
    max-height: min(80vh, 720px);
    width: min(640px, calc(100vw - 32px));
}
.civil-objects-content {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    padding: 4px 0;
}
.civil-objects-content h4 {
    margin: 14px 0 6px;
    font-size: 0.9rem;
    color: #334;
}
.civil-objects-summary h4 { margin-top: 0; }
.civil-objects-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
/* `background` is stated because the leaderboard styles its own table headers
   dark, and this table lives inside that page. */
.civil-objects-table th {
    text-align: left;
    font-weight: 600;
    color: #6b7280;
    background: transparent;
    font-size: 0.78rem;
    padding: 2px 6px;
    border-bottom: 1px solid #e5e7eb;
}
.civil-objects-table td {
    padding: 4px 6px;
    border-bottom: 1px solid #f1f3f5;
    color: #333;
}
/* Numbers must never wrap ("5.0 mil.\nEUR"); the object name may, which is what
   keeps the table inside a 320 px phone without a horizontal scrollbar. */
.civil-objects-num { text-align: right; white-space: nowrap; }
.civil-objects-name { word-break: break-word; }
.civil-objects-note { color: #6b7280; font-weight: 400; font-size: 0.78rem; }
.civil-objects-total td {
    border-top: 1px solid #d1d5db;
    border-bottom: none;
    font-weight: 600;
    background: #f8fafc;
}
.civil-objects-empty { color: #6b7280; font-size: 0.85rem; margin: 6px 0; }
/* Hand-typed per-object prices: the cost cell is a button that becomes an
   inline number input. An overridden price is marked so it is obvious which
   numbers came from the model and which from the author. */
.civil-objects-cost {
    background: none;
    border: 1px dashed transparent;
    border-radius: 4px;
    padding: 1px 4px;
    font: inherit;
    color: inherit;
    cursor: pointer;
}
.civil-objects-cost:hover { border-color: #9ca3af; background: #f8fafc; }
.civil-objects-cost.is-manual { color: #b45309; font-weight: 600; border-color: #fcd34d; background: #fffbeb; }
.civil-objects-cost-reset {
    background: none;
    border: none;
    color: #b45309;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0 2px;
    line-height: 1;
}
.civil-objects-cost-reset:hover { color: #7c2d12; }
.civil-objects-cost-input {
    width: 5.5em;
    text-align: right;
    font: inherit;
    padding: 1px 4px;
    border: 1px solid #2563eb;
    border-radius: 4px;
}
.civil-objects-disclaimer { display: block; margin: 8px 0 0; line-height: 1.45; }
.civil-objects-summary {
    padding-bottom: 8px;
    border-bottom: 2px solid #e5e7eb;
}
@media (max-width: 480px) {
    .civil-objects-table { font-size: 0.8rem; }
    .civil-objects-table td, .civil-objects-table th { padding: 4px 3px; }
    .civil-objects-note { font-size: 0.72rem; }
}


/* ── The planner's side panel ──────────────────────────────────────────────
   A dialog hid the very thing the list describes. As a right-edge panel the
   map stays visible, so clicking a row can point at the structure on it.
   The leaderboard keeps its own modal — it has no map to point at. */
.civil-objects-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--objects-panel-width, clamp(320px, 32vw, 460px));
    /* Above the sidebar (1200): both live on the right edge, and the panel is
       the work surface while it is open. */
    z-index: 1250;
    display: flex;
    flex-direction: column;
    background: #fff;
    box-shadow: -4px 0 18px rgba(15, 23, 42, 0.18);
    padding: 12px 14px 0;
    box-sizing: border-box;
}
.civil-objects-panel.hidden { display: none; }
.civil-objects-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex: 0 0 auto;
}
.civil-objects-panel-header h3 { margin: 0; font-size: 1rem; }
.civil-objects-hint {
    margin: 4px 0 8px;
    color: #6b7280;
    font-size: 0.76rem;
    line-height: 1.35;
    flex: 0 0 auto;
}
.civil-objects-panel .civil-objects-content { padding-bottom: 14px; }
/* A phone has no room for a third of the screen: take it all. */
@media (max-width: 700px) {
    .civil-objects-panel { width: 100%; }
}

/* ── Sortable column headers ─────────────────────────────────────────────── */
.civil-objects-table th { padding: 0; }
.civil-objects-sort {
    width: 100%;
    background: none;
    border: 0;
    padding: 4px 6px;
    font: inherit;
    color: inherit;
    text-align: inherit;
    cursor: pointer;
    border-radius: 4px;
}
.civil-objects-num .civil-objects-sort { text-align: right; }
.civil-objects-sort:hover { background: #f1f5f9; color: #1f2937; }
.civil-objects-sort.is-active { color: #1d4ed8; font-weight: 700; }
.civil-objects-sort-arrow { font-size: 0.62rem; }

/* ── Rows that can point at the map ──────────────────────────────────────── */
.civil-objects-row.is-locatable { cursor: pointer; }
.civil-objects-row.is-locatable:hover td { background: #eff6ff; }
.civil-objects-row.is-locatable:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: -2px;
}
.civil-objects-chainage { font-variant-numeric: tabular-nums; color: #475569; }

/* Icon-only object column: exactly as wide as one icon. */
.civil-objects-table-objects .civil-objects-name {
    width: 1.6em;
    white-space: nowrap;
    text-align: center;
    padding-left: 2px;
    padding-right: 2px;
}
.civil-objects-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
