/* rig-mgmt-v2.css — Rig Management, professional layout (release 20261108o). Loaded after the page styles. */
:root { --rm-sidebar-w: 300px; --rv-green: var(--sa-green, #007A3D); --rv-ink: #15201A; --rv-muted: #56655D; --rv-line: #DCE3DF; --rv-demob: #A3A29A; --rv-warn: #A15C00; }

/* ── Rail ─────────────────────────────────────────────────────────────── */
.rm-sidebar-header { background: #fff; padding: 12px 12px 10px; }
.rm-sidebar-header .input-group-text, .rm-sidebar-header .form-control { height: 34px; font-size: 13px; }
.rv-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.rv-chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px; border: 1px solid var(--rv-line); border-radius: 13px; background: #fff; font-size: 11.5px; font-weight: 600; color: var(--rv-ink); cursor: pointer; }
.rv-chip span { font-weight: 500; color: var(--rv-muted); font-variant-numeric: tabular-nums; }
.rv-chip:hover { border-color: var(--rv-green); }
.rv-chip.on { background: var(--rv-green); border-color: var(--rv-green); color: #fff; }
.rv-chip.on span { color: rgba(255,255,255,.8); }
.rv-chip-dept.on { background: #E3EEFC; border-color: #9DBDEB; color: #184f95; }
#rm-rig-count { margin-top: 8px !important; font-size: 11.5px; }
.rm-rig-list { padding: 4px 8px 12px; }
.rv-group { padding: 0; margin-top: 6px; }
.rv-group-h { display: flex; align-items: baseline; gap: 6px; width: 100%; padding: 6px 4px; background: none; border: 0; border-bottom: 1px solid #EEF2EF; text-align: left; color: var(--rv-ink); cursor: pointer; }
.rv-group-h i { font-size: 10px; color: var(--rv-muted); transition: transform .15s; align-self: center; }
.rv-group.folded .rv-group-h i { transform: rotate(-90deg); }
.rv-group-h b { font-size: 12px; letter-spacing: .02em; }
.rv-group-h small { flex: 1; min-width: 0; font-size: 11px; color: var(--rv-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-group-h span { font-size: 11px; font-weight: 600; color: var(--rv-muted); font-variant-numeric: tabular-nums; }
.rv-item { padding: 5px 8px 5px 10px; font-size: 12.5px; }
.rv-item .rm-rig-name { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.rv-item .rm-rig-div { font-size: 11px; min-width: 36px; text-align: right; }
.rv-silent { font-style: normal; font-size: 10.5px; font-weight: 600; color: var(--rv-warn); background: #FFF4E0; border-radius: 8px; padding: 0 6px; white-space: nowrap; }
.rm-rig-item.active .rv-silent { background: rgba(255,255,255,.2); color: #fff; }
.rv-dot { flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; }
.rv-dot.rv-st-active { background: var(--rv-green); }
.rv-dot.rv-st-demob { background: var(--rv-demob); }
.rv-dot.rv-st-none { background: #fff; border: 1.5px solid var(--rv-demob); }
.rm-rig-item.active .rv-dot { box-shadow: 0 0 0 2px rgba(255,255,255,.7); }
.rv-none { padding: 18px 8px; text-align: center; font-size: 12.5px; color: var(--rv-muted); }

/* ── Shared ───────────────────────────────────────────────────────────── */
.rv-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--rv-ink); white-space: nowrap; }
.rv-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--rv-demob); }
.rv-state.rv-st-active i { background: var(--rv-green); }
.rv-state.rv-st-none i { background: #fff; border: 1.5px solid var(--rv-demob); }
.rv-acting { font-size: 10.5px; font-weight: 700; color: #7A5200; background: #FFF1C9; border-radius: 8px; padding: 0 6px; }
.rv-mute { color: #A3A29A; }
.rv-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rv-rig { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.rv-link { background: none; border: 0; padding: 0; margin-left: auto; font-size: 12px; font-weight: 600; color: var(--rv-green); cursor: pointer; text-transform: none; letter-spacing: 0; }
.rv-link:hover { text-decoration: underline; }
.rv-legend { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 11.5px; color: var(--rv-muted); }
.rv-legend i, .rv-legend span i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.rv-legend > i { margin-right: 0; }
.rv-legend i.a { background: var(--rv-green); }
.rv-legend i.m { background: var(--rv-demob); }
.rv-card { background: #fff; border: 1px solid var(--rv-line); border-radius: 12px; padding: 14px 16px; min-width: 0; }
.rv-card > header { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.rv-card h2 { margin: 0; font-size: 14px; font-weight: 700; color: var(--rv-ink); }
.rv-card > footer { margin-top: 10px; font-size: 11.5px; color: var(--rv-muted); }
.rv-loading { margin: auto; color: var(--rv-muted); font-size: 13px; }

/* ── Fleet view ───────────────────────────────────────────────────────── */
.rv-fleet { flex: 1; overflow-y: auto; padding: 20px 24px 28px; display: flex; flex-direction: column; gap: 16px; }
.rv-fleet.d-none { display: none !important; }
.rv-fleet-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.rv-fleet-h h1 { margin: 0; font-size: 22px; font-weight: 700; color: var(--rv-ink); }
.rv-fleet-h p { margin: 2px 0 0; font-size: 13px; color: var(--rv-muted); }
.rv-hint { font-size: 12px; color: var(--rv-muted); display: inline-flex; gap: 6px; align-items: center; }
.rv-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.rv-kpi { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: #fff; border: 1px solid var(--rv-line); border-radius: 12px; text-align: left; cursor: pointer; color: inherit; font: inherit; transition: border-color .12s, box-shadow .12s; }
.rv-kpi:hover { border-color: var(--rv-green); }
.rv-kpi.on { border-color: var(--rv-green); box-shadow: 0 0 0 2px rgba(0,122,61,.15); }
.rv-kpi-l { font-size: 12px; color: var(--rv-muted); }
.rv-kpi-v { font-size: 26px; font-weight: 700; line-height: 1.15; color: var(--rv-ink); font-variant-numeric: tabular-nums; }
.rv-kpi.g .rv-kpi-v { color: var(--rv-green); }
.rv-kpi.m .rv-kpi-v { color: #6E6D66; }
.rv-kpi.w { background: #FFFBF2; border-color: #F1D9A8; }
.rv-kpi.w .rv-kpi-v { color: var(--rv-warn); }
.rv-kpi-s { font-size: 11.5px; color: var(--rv-muted); }
.rv-fleet-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.rv-deps > header { margin-bottom: 6px; }
.rv-bars { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 2px 28px; }
.rv-bar { display: grid; grid-template-columns: 92px minmax(0, 1fr) 32px; align-items: center; gap: 8px; padding: 4px 6px; border: 0; border-radius: 6px; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.rv-bar:hover { background: #F3F5F4; }
.rv-bar.on { background: #E3EEFC; }
.rv-bar-l { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-bar-t { display: flex; gap: 2px; height: 10px; }
.rv-bar-t i { display: block; height: 100%; min-width: 0; }
.rv-bar-t i.a { background: var(--rv-green); border-radius: 4px 0 0 4px; }
.rv-bar-t i.m { background: var(--rv-demob); border-radius: 0 4px 4px 0; }
.rv-bar-t i.a[style^="width:0%"] + i.m { border-radius: 4px; }
.rv-bar-n { font-size: 12px; text-align: right; color: var(--rv-muted); font-variant-numeric: tabular-nums; }
.rv-filters { font-size: 12px; color: var(--rv-muted); }
.rv-filters .rv-link { margin-left: 6px; }
.rv-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.rv-table th { position: sticky; top: -20px; background: #fff; z-index: 1; padding: 0; border-bottom: 1px solid var(--rv-line); }
.rv-table th button { display: flex; align-items: center; gap: 4px; width: 100%; padding: 8px 8px; border: 0; background: none; font-size: 11.5px; font-weight: 600; color: var(--rv-muted); text-align: left; white-space: nowrap; cursor: pointer; }
.rv-table th button i { opacity: 0; font-size: 10px; }
.rv-table th button:hover i, .rv-table th button.asc i, .rv-table th button.desc i { opacity: 1; }
.rv-table th button.asc, .rv-table th button.desc { color: var(--rv-ink); }
.rv-table td { padding: 7px 8px; border-bottom: 1px solid #EEF2EF; vertical-align: middle; }
.rv-table tbody tr { cursor: pointer; }
.rv-table td.rv-rig, .rv-table td .rv-state, .rv-table td:nth-child(5) { white-space: nowrap; }
.rv-dep { white-space: nowrap; max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.rv-table tbody tr:hover, .rv-table tbody tr:focus { background: #F3F8F5; outline: 0; }

/* ── Rig header ───────────────────────────────────────────────────────── */
.rm-rig-header { padding: 10px 24px 0; }
.rv-hbar { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.rv-sp { flex: 1; }
.rv-btn { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border: 1px solid var(--rv-line); border-radius: 8px; background: #fff; font-size: 12.5px; font-weight: 600; color: var(--rv-ink); cursor: pointer; }
.rv-btn:hover:not(:disabled) { border-color: var(--rv-green); color: var(--rv-green); }
.rv-btn:disabled { opacity: .4; cursor: default; }
.rv-pos { font-size: 12px; color: var(--rv-muted); min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; }
.rm-badge-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.rm-rig-title { font-size: 24px; color: var(--rv-ink); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: -.01em; }
.rm-rig-title i { display: none; }
.rm-status-badge.rv-state { padding: 3px 10px; border-radius: 12px; background: #F1F3F2; text-transform: none; letter-spacing: 0; }
.rm-status-badge.rv-st-active { background: #E6F2EC; color: #075E33; }
#rm-dept-badge { background: #E6F2EC !important; color: #075E33 !important; font-size: 12px !important; font-weight: 600; padding: 5px 10px; }
#rm-div-badge { font-size: 12px !important; font-weight: 600; padding: 5px 10px; }
.rm-rig-subtitle { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 8px 0 4px; font-size: 12.5px; color: var(--rv-ink); }
.rm-rig-subtitle > span { display: inline-flex; align-items: center; gap: 6px; }
.rm-rig-subtitle i { color: var(--rv-muted); }
.rm-rig-subtitle .rv-rp-live i { color: var(--rv-green); }
.rm-rig-subtitle .rv-rp-silent { color: var(--rv-warn); font-weight: 600; }
.rm-rig-subtitle .rv-rp-silent i { color: var(--rv-warn); }
.rm-rig-subtitle .rv-rp-never { color: var(--rv-muted); }
.rm-tabs { margin-top: 4px; }
.rm-tabs .nav-link { font-size: 13px; padding: 9px 14px; }
.rv-tabn { margin-left: 6px; font-size: 11px; font-weight: 600; color: var(--rv-muted); background: #EEF2EF; border-radius: 9px; padding: 0 6px; }
.rv-tabn:empty { display: none; }
.rm-tab-content { padding: 20px 24px; }

/* ── Overview ─────────────────────────────────────────────────────────── */
.rm-kpi-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.rm-kpi-card { border-radius: 12px; padding: 12px 14px; border-color: var(--rv-line); }
.rm-kpi-label { font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--rv-muted); }
.rm-kpi-value { font-size: 22px; color: var(--rv-ink); font-variant-numeric: tabular-nums; }
.rm-kpi-value small { font-size: 13px; font-weight: 600; color: var(--rv-muted); }
.rm-kpi-sub { font-size: 11.5px; }
.rm-assign-card { border-radius: 12px; border-color: var(--rv-line); border-left: 1px solid var(--rv-line) !important; box-shadow: none; }
.rm-assign-card h6 { display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--rv-ink); }
.rm-team-scroll { max-height: none !important; overflow: visible !important; }
.rv-dl { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 7px 12px; margin: 0; font-size: 13px; }
.rv-dl dt { font-weight: 500; color: var(--rv-muted); font-size: 12px; padding-top: 1px; }
.rv-dl dd { margin: 0; color: var(--rv-ink); min-width: 0; overflow-wrap: anywhere; }
.rv-tl { margin: 2px 0 14px; }
.rv-tl-bar { display: flex; gap: 2px; height: 26px; }
.rv-seg { position: relative; display: flex; align-items: center; min-width: 0; overflow: hidden; color: #fff; }
.rv-seg:first-child { border-radius: 6px 0 0 6px; }
.rv-seg:last-child { border-radius: 0 6px 6px 0; }
.rv-seg:only-child { border-radius: 6px; }
.rv-seg em { font-style: normal; font-size: 11px; font-weight: 600; padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-tl-ax { display: flex; justify-content: space-between; font-size: 11px; color: var(--rv-muted); margin: 4px 0 6px; }
.rv-ov-extra { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.rv-mini { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.rv-mini th { font-size: 11.5px; font-weight: 600; color: var(--rv-muted); padding: 4px 6px; border-bottom: 1px solid var(--rv-line); }
.rv-mini td { padding: 6px; border-bottom: 1px solid #EEF2EF; }
.rv-fbar { display: inline-block; width: 70px; height: 6px; margin-right: 8px; background: #EEF2EF; border-radius: 3px; vertical-align: middle; overflow: hidden; }
.rv-fbar i { display: block; height: 100%; background: var(--rv-green); border-radius: 3px; }
.rv-note { padding: 8px 0; border-bottom: 1px solid #EEF2EF; }
.rv-note:last-child { border-bottom: 0; }
.rv-note p { margin: 4px 0 2px; font-size: 13px; color: var(--rv-ink); white-space: pre-wrap; }
.rv-note small { font-size: 11.5px; color: var(--rv-muted); }

/* ── Tables in the rig tabs: everything shown, headers sort ───────────── */
#rm-rig-detail .table-responsive { max-height: none !important; overflow: visible !important; }
#rm-rig-detail table thead th { cursor: pointer; user-select: none; white-space: nowrap; }
#rm-rig-detail table thead th.rm-hist-dot-col { cursor: default; }
#rm-rig-detail table thead th[data-rv-dir]::after { content: ' \25B2'; font-size: 9px; color: var(--rv-green); }
#rm-rig-detail table thead th[data-rv-dir="desc"]::after { content: ' \25BC'; }

/* ── Small screens: the rail is the list; opening a rig shows the rig ─── */
@media (max-width: 1250px) { .rv-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .rm-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .rv-ov-extra { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) {
  .rm-sidebar { width: 100%; min-width: 0; border-right: 0; }
  .rm-main { display: none; }
  .rm-layout.rv-rig-open .rm-sidebar { display: none; }
  .rm-layout.rv-rig-open .rm-main { display: flex; }
  .rv-table th:nth-child(n+6), .rv-table td:nth-child(n+6) { display: none; }
  .rm-rig-header, .rm-tab-content, .rv-fleet { padding-left: 16px; padding-right: 16px; }
  .rm-tabs { flex-wrap: nowrap; overflow-x: auto; }
  .rm-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #rv-copy { display: none; }
}

label[for="rm-jh-group-select"] { white-space: nowrap; }
.rm-tabs .nav-link { white-space: nowrap; }
