:root {
  --bg: #0f172a;
  --panel: #111827;
  --panel-2: #1f2937;
  --line: #334155;
  --line-soft: rgba(148, 163, 184, 0.16);
  --text: #e5e7eb;
  --muted: #94a3b8;
  --amber: #f59e0b;
  --red: #ef4444;
  --green: #22c55e;
  --blue: #38bdf8;
  --white: #ffffff;
  --body-bg-start: #0b1220;
  --body-bg-end: #0f172a;
  --card-bg: rgba(17, 24, 39, 0.92);
  --table-head-bg: rgba(255, 255, 255, 0.03);
  --table-head-text: #cbd5e1;
  --backdrop: rgba(2, 6, 23, 0.7);
  --selection-bg: rgba(56, 189, 248, 0.1);
  --hover-bg: rgba(59, 130, 246, 0.06);
}

body[data-theme="light"] {
  --bg: #e8eef7;
  --panel: #ffffff;
  --panel-2: #f8fbff;
  --line: #c9d6e6;
  --line-soft: rgba(100, 116, 139, 0.18);
  --text: #122033;
  --muted: #64748b;
  --white: #0f172a;
  --body-bg-start: #eef4fb;
  --body-bg-end: #dfe8f4;
  --card-bg: rgba(255, 255, 255, 0.95);
  --table-head-bg: rgba(148, 163, 184, 0.12);
  --table-head-text: #334155;
  --backdrop: rgba(148, 163, 184, 0.35);
  --selection-bg: rgba(59, 130, 246, 0.14);
  --hover-bg: rgba(59, 130, 246, 0.08);
  --blue: #0f5fa8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, var(--body-bg-start) 0%, var(--body-bg-end) 100%);
  color: var(--text);
  transition: background 0.25s ease, color 0.25s ease;
}

body.login-locked .wrap {
  display: none;
}

.wrap {
  max-width: 1500px;
  margin: 0 auto;
  padding: 20px;
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}

.login-overlay.hidden {
  display: none;
}

.login-card {
  width: min(420px, 100%);
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  display: grid;
  gap: 12px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  font-family: "IBM Plex Sans", Arial, Helvetica, sans-serif;
}

.login-title-wrap h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.login-title-wrap p {
  margin: 8px 0 0;
  color: var(--muted);
}

.login-role-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.login-role-buttons button,
#loginSubmitBtn {
  font-size: 15px;
  font-weight: 600;
  padding: 12px 14px;
}

.login-role-buttons button.is-selected {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue);
}

.login-password-label {
  color: var(--muted);
  font-size: 13px;
}

.login-error-text {
  min-height: 18px;
  margin: 0;
  color: var(--red);
  font-size: 13px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.title h1 {
  margin: 0;
  font-size: 28px;
  color: var(--white);
}

.title p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

button,
.view-switch-link,
select,
input {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
}

.view-switch-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  text-decoration: none;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

.page-section {
  margin-top: 16px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
}

.kpi {
  grid-column: span 3;
}

.kpi-immediate {
  display: flex;
  flex-direction: column;
  height: 220px;
  max-height: 220px;
  overflow: hidden;
}

.kpi-immediate-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-bottom: 8px;
}

.kpi-immediate-header .label {
  flex: 1;
  margin-bottom: 0;
}

.kpi-immediate-count {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.span-4 {
  grid-column: span 4;
}

.span-12 {
  grid-column: span 12;
}

.label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.kpi-inline-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin: -2px 0 8px;
}

.value {
  font-size: 30px;
  font-weight: 700;
  margin-bottom: 6px;
}

.value-unit {
  font-size: 18px;
  font-weight: 600;
}

.value-unit-inline {
  font-size: 16px;
  margin-left: 6px;
}

.kpi-secondary-note {
  color: #cbd5e1;
  font-size: 12px;
  margin: -2px 0 10px;
}

.kpi-alert-list {
  margin-top: 10px;
  display: grid;
  gap: 6px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.kpi-alert-list::-webkit-scrollbar {
  width: 4px;
}

.kpi-alert-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

.kpi-corner-badge {
  position: absolute;
  top: 16px;
  right: 16px;
}

.kpi-alert-item {
  padding: 7px 9px;
  border-radius: 10px;
  border: 1px solid rgba(239,68,68,.2);
  background: rgba(239,68,68,.08);
  color: #fecaca;
  font-size: 12px;
  line-height: 1.35;
  word-break: break-word;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.section-title h2 {
  margin: 0;
  font-size: 18px;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1 1 auto;
}

.section-heading-space {
  justify-content: space-between;
}

.section-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.equipment-upload-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  max-width: 720px;
}

.asset-row {
  cursor: pointer;
}

.asset-row:hover td {
  background: var(--hover-bg);
}

.asset-row.is-selected td {
  background: var(--selection-bg);
}

.asset-row-primary {
  font-weight: 700;
}

.asset-cell {
  display: block;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asset-status-table .col-vessel {
  width: 140px;
}

.asset-status-table .col-equipment {
  width: 250px;
}

.asset-status-table .col-last-oh {
  width: 130px;
}

.asset-status-table .col-last-oh-rh {
  width: 140px;
}

.asset-status-table .col-current-rh {
  width: 140px;
}

.asset-status-table .col-hrs {
  width: 150px;
}

.asset-status-table .col-status {
  width: 140px;
}

.asset-status-table .col-comments {
  width: 240px;
}

.asset-cell-status {
  display: inline-flex;
}

.comment-cell-wrap {
  position: relative;
  cursor: pointer;
}

.comment-cell-wrap::after {
  content: '✎';
  position: absolute;
  top: 4px;
  right: 5px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.comment-cell-wrap:hover::after { opacity: 1; }

/* Read-only preview — double-click opens popup */
.comment-cell {
  display: block;
  width: 100%;
  min-height: 28px;
  padding: 4px 22px 4px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
  font-family: inherit;
  cursor: pointer;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: hidden;
  max-height: 48px;
  text-overflow: ellipsis;
  transition: border-color 0.15s, background 0.15s;
}

.comment-cell:hover {
  border-color: var(--line);
  border-style: dashed;
  background: rgba(255,255,255,0.04);
}

.comment-cell-empty {
  color: var(--muted);
  font-style: italic;
}

.asset-detail-panel {
  margin-top: 14px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  padding-top: 14px;
  display: grid;
  gap: 12px;
}

.detail-topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.detail-kicker {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.detail-title {
  margin: 4px 0 2px;
  font-size: 18px;
}

.detail-subtitle {
  color: var(--muted);
  font-size: 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.detail-stat {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
}

.detail-stat-label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.detail-stat-value {
  font-size: 14px;
  font-weight: 700;
}

.detail-stat-value.fw-normal,
.overview-value.fw-normal {
  font-weight: 400;
  line-height: 1.4;
}

.detail-columns {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 12px;
}

.history-card,
.overview-card {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.detail-card-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.detail-card-title h3 {
  margin: 0;
  font-size: 14px;
}

.overview-list {
  display: grid;
  gap: 8px;
}

.overview-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.overview-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.overview-key {
  color: var(--muted);
  font-size: 12px;
}

.overview-value {
  text-align: right;
  font-weight: 700;
  max-width: 65%;
  word-break: break-word;
}

.history-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.history-year {
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  padding: 10px;
  min-height: 82px;
  background: rgba(15, 23, 42, 0.38);
  position: relative;
  overflow: hidden;
}

.history-year-label {
  color: #93c5fd;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

.history-year-text {
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
}

.history-year-input {
  width: 100%;
  min-height: 54px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
  resize: none;
  outline: none;
  font-family: inherit;
  overflow: hidden;
}

.history-year-input::-webkit-scrollbar {
  display: none;
}

.history-year-input::placeholder {
  color: var(--muted);
}

.history-year::after {
  content: '⤢';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 28px;
  background: linear-gradient(transparent, rgba(15, 23, 42, 0.7));
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 0 6px 4px 0;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.28);
  pointer-events: none;
  border-radius: 0 0 14px 14px;
  transition: color 0.15s;
}

.history-year:hover::after {
  color: rgba(255, 255, 255, 0.65);
}

.history-text-modal-card {
  width: min(480px, calc(100% - 48px)) !important;
  max-height: calc(100vh - 120px);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(244,248,255,0.98) 100%);
  border: 1px solid rgba(96, 165, 250, 0.22);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.28);
}

/* Resizable modal cards */
.resizable-modal-card {
  position: relative;
  min-width: 320px;
  min-height: 220px;
  overflow: hidden !important; /* clip body content to card bounds */
  /* Switch from grid to flex so the body fills the remaining height */
  display: flex !important;
  flex-direction: column !important;
}

/* The resize handle pokes outside the card — needs its own overflow escape */
.resizable-modal-card .modal-resize-handle {
  overflow: visible;
}

.resizable-modal-header {
  cursor: move;
  user-select: none;
  flex-shrink: 0; /* header never shrinks */
}

/* Body fills all remaining height */
.resizable-modal-card .history-text-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Textarea fills the body */
.resizable-modal-textarea {
  flex: 1 1 auto;
  height: 100% !important;
  min-height: 0 !important;
  resize: none;
}

.modal-resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 22px;
  height: 22px;
  cursor: se-resize;
  background:
    linear-gradient(135deg, transparent 50%, rgba(100,116,139,0.35) 50%),
    linear-gradient(135deg, transparent 60%, rgba(100,116,139,0.25) 60%);
  border-bottom-right-radius: 18px;
}

.modal-resize-handle::after {
  content: "";
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(100,116,139,0.5);
  border-bottom: 2px solid rgba(100,116,139,0.5);
  border-bottom-right-radius: 2px;
}

.history-text-modal-body {
  padding: 0 14px 14px;
  display: flex;
  flex-direction: column;
}

.history-text-modal-textarea {
  width: 100%;
  min-height: 80px;
  max-height: none;
  padding: 14px 14px;
  border: 1px solid rgba(96, 165, 250, 0.26);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(239, 246, 255, 0.98) 0%, rgba(255, 251, 235, 0.94) 100%);
  color: #1e293b;
  font-size: 14px;
  line-height: 1.65;
  resize: none;
  outline: none;
  font-family: inherit;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}

.history-text-modal-card .modal-header {
  padding-bottom: 6px;
}

.history-text-modal-card .detail-kicker {
  color: #2563eb;
}

.history-text-modal-card .modal-header h2 {
  color: #0f172a;
  font-size: 18px;
  line-height: 1.25;
}

.history-text-modal-card .note {
  color: #64748b;
}

.empty-history {
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.danger {
  background: rgba(239, 68, 68, 0.14);
  color: #fca5a5;
}

.warn {
  background: rgba(245, 158, 11, 0.14);
  color: #fcd34d;
}

.ok {
  background: rgba(34, 197, 94, 0.14);
  color: #86efac;
}

.info {
  background: rgba(56, 189, 248, 0.14);
  color: #7dd3fc;
}

.status-select {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: none;
}
.status-select-ok {
  background: rgba(34, 197, 94, 0.14) !important;
  color: #86efac !important;
}
.status-select-danger {
  background: rgba(239, 68, 68, 0.14) !important;
  color: #fca5a5 !important;
}
.status-select-info {
  background: rgba(56, 189, 248, 0.14) !important;
  color: #7dd3fc !important;
}
.status-select option {
  background: #1e293b;
  color: #e2e8f0;
  font-weight: 600;
}

.filters {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  align-items: end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
}

.filter-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  padding: 8px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--table-head-text);
  font-weight: 700;
  background: var(--table-head-bg);
  border-bottom: 1px solid rgba(148, 163, 184, 0.24);
  white-space: nowrap;
}

.table-wrap {
  overflow: auto;
  max-height: 520px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(15, 23, 42, 0.35);
}

.price-list-title {
  margin-top: 18px;
}

.price-list-wrap {
  max-height: 340px; /* collapsed-visible size (unused — collapsed = display:none) */
}

/* Maximized: ~20 строк, внутренний скрол.
   Мышь внутри → скролит фрейм.
   Мышь снаружи → скролит страницу (стандартное поведение браузера).
   overscroll-behavior-y: auto → когда фрейм достиг края, страница продолжает скролиться. */
.price-list-wrap.is-maximized {
  max-height: 700px !important;  /* ~20 строк данных + заголовок */
  height: auto !important;
  overflow-x: auto !important;
  overflow-y: auto !important;
  overscroll-behavior-y: auto !important;
}

.price-list-wrap.is-collapsed {
  display: none;
}

.price-list-wrap th:nth-child(2),
.price-list-wrap td:nth-child(2) {
  width: 80px;
  min-width: 60px;
  max-width: 90px;
}

.price-list-wrap th:nth-child(4),
.price-list-wrap td:nth-child(4) {
  min-width: 200px;
  white-space: normal;
}

.note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.list {
  display: grid;
  gap: 10px;
}

.list-item {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.list-item h3 {
  margin: 0 0 6px;
  font-size: 14px;
}

.priority-badge-row {
  margin-top: 6px;
}

.stack-head {
  line-height: 1.2;
}

.input-cell {
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  outline: none;
}

.table-input {
  min-width: 110px;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 8px;
}

.cost-cell {
  max-width: 96px;
}

.date-cell {
  max-width: 130px;
}

.remarks-cell {
  max-width: 120px;
}

.status-select {
  width: auto;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.status-select:focus {
  outline: 2px solid rgba(255,255,255,0.3);
  outline-offset: 1px;
}

.detail-stat-input {
  width: 100%;
  min-height: 28px;
  padding: 4px 8px;
  margin-top: 2px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

.soft-box {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 7px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.02);
}

.link-cell {
  color: #3b82f6;
  font-weight: 700;
  text-decoration: none;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  line-height: 1.15;
}

.stock-wh-link {
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  line-height: 18px;
}

.spares-wh-cell {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.stock-wh-btn {
  font-size: 11px;
  letter-spacing: 0.02em;
}


/* Vessel picker inside procurement table header */
th.th-vessel-select {
  padding: 6px 10px;
  vertical-align: middle;
}

th.th-vessel-select #procVesselSelect {
  width: 100%;
  padding: 5px 28px 5px 10px;
  border-radius: 6px;
  border: 1.5px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
  color: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='white' opacity='.7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 10px 6px;
  outline: none;
  min-width: 130px;
}

th.th-vessel-select #procVesselSelect:hover {
  border-color: rgba(255,255,255,0.4);
  background-color: rgba(255,255,255,0.14);
}

th.th-vessel-select #procVesselSelect option {
  background: #1e293b;
  color: #e2e8f0;
}

body[data-theme="light"] th.th-vessel-select #procVesselSelect {
  background-color: rgba(0,0,0,0.06);
  border-color: rgba(0,0,0,0.2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23334155' opacity='.7'/%3E%3C/svg%3E");
  color: #0f172a;
}

body[data-theme="light"] th.th-vessel-select #procVesselSelect option {
  background: #f8fafc;
  color: #0f172a;
}

.procurement-history-row td {
  background: rgba(255, 255, 255, 0.02);
}

.procurement-history-cell {
  padding: 10px 12px;
}

.history-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.history-inline-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.history-title {
  font-weight: 700;
  color: var(--white);
}

.history-vessel-button {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  cursor: pointer;
}

.history-file-name {
  color: var(--muted);
  font-size: 12px;
}

.history-spent-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.24);
  color: #7dd3fc;
  font-size: 12px;
  font-weight: 700;
}

.history-inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mini-button {
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
}

.contracts-title {
  margin-top: 18px;
}

.contracts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.contract-card,
.contract-card-link {
  display: grid;
  gap: 8px;
  text-align: left;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.contract-card-link {
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.contract-card-link:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 14px 32px rgba(2, 6, 23, 0.25);
}

.contract-card-kicker {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.contract-card strong,
.contract-card-link strong {
  font-size: 15px;
  color: var(--white);
}

.contract-card-link strong {
  color: #7dd3fc;
  font-size: 16px;
}

.contract-card-muted {
  opacity: 0.75;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  width: min(1200px, 100%);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  display: grid;
  gap: 14px;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  color: #0f172a;
}

.contract-modal-card {
  width: min(1360px, 100%);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  display: grid;
  gap: 14px;
  background: #0a0c10;
  border: 1px solid #1e2430;
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  color: #cdd5e0;
}

.dgs-tracker-modal-card {
  width: min(1320px, 100%);
  height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
}

.dgs-tracker-modal-card .table-wrap.modal-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: auto;
}

.dgs-tracker-modal-card #dgsTrackerContent {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.stock-status-modal-card {
  width: min(1480px, 100%);
  height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  /* Override modal-card white background — iframe has its own dark bg */
  background: #0b1220;
  padding: 6px;
  gap: 0;
}

.stock-status-modal-card.stock-page-active > .modal-header {
  display: none;
}

.stock-status-frame-wrap {
  flex: 1 1 auto;
  min-height: 0;
  border: none;
  border-radius: 14px;
  overflow: hidden;
}

.stock-vessel-picker {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 0;
}

.stock-vessel-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 520px;
}

.stock-vessel-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(51,65,85,.7);
  border-radius: 10px;
  padding: 12px 16px;
  cursor: pointer;
  color: var(--text, #e5e7eb);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  transition: background .15s, border-color .15s;
}

.stock-vessel-btn:hover {
  background: rgba(56,189,248,.08);
  border-color: rgba(56,189,248,.4);
}

#stockStatusModalFrame {
  width: 100%;
  height: 100%;
  border: 0;
}

.equipment-pdf-preview-card {
  width: min(1280px, 100%);
  height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
}

.equipment-pdf-preview-frame-wrap {
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(180deg, #eef6ff 0%, #ffffff 100%);
}

#equipmentPdfPreviewFrame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

.dgs-inventory-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  min-width: 0;
  margin-top: 0;
}

.dgs-inventory-table th,
.dgs-inventory-table td {
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: 7px 9px;
  vertical-align: middle;
}

.dgs-inventory-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #dfeaf6;
  color: #18324d;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border-bottom: 2px solid #b9cce2;
  box-shadow: 0 2px 0 rgba(15,23,42,0.08);
}

.dgs-inventory-table td {
  background: rgba(255, 255, 255, 0.95);
  font-size: 12px;
  line-height: 1.25;
  color: #1e293b;
}

.dgs-inventory-table th:first-child,
.dgs-inventory-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
}

.dgs-inventory-table th:first-child {
  z-index: 4;
}

.dgs-section-refurbished .dgs-inventory-table th:first-child,
.dgs-section-refurbished .dgs-inventory-table td:first-child,
.dgs-section-refurbished .dgs-inventory-table th:nth-child(2),
.dgs-section-refurbished .dgs-inventory-table td:nth-child(2) {
  position: static;
  z-index: auto;
}

.dgs-section-refurbished .dgs-inventory-table th:first-child {
  background: #cfe4fb;
}

.dgs-section-warehouse .dgs-inventory-table th:first-child,
.dgs-section-warehouse .dgs-inventory-table td:first-child,
.dgs-section-warehouse .dgs-inventory-table th:nth-child(2),
.dgs-section-warehouse .dgs-inventory-table td:nth-child(2) {
  position: static;
  z-index: auto;
}

.dgs-section-warehouse .dgs-inventory-table th:first-child {
  background: #fde7b0;
}

.dgs-section-refurbished .dgs-inventory-table td:first-child {
  background: #eef7ff;
}

.dgs-section-warehouse .dgs-inventory-table td:first-child {
  background: #fff8eb;
}

.dgs-inventory-table th:nth-child(2),
.dgs-inventory-table td:nth-child(2) {
  position: sticky;
  left: 100px;
  z-index: 1;
}

.dgs-section-refurbished .dgs-inventory-table th:nth-child(2) {
  background: #cfe4fb;
}

.dgs-section-warehouse .dgs-inventory-table th:nth-child(2) {
  background: #fde7b0;
}

.dgs-section-refurbished .dgs-inventory-table td:nth-child(2) {
  background: #eef7ff;
}

.dgs-section-warehouse .dgs-inventory-table td:nth-child(2) {
  background: #fff8eb;
}

.dgs-inventory-table .table-input {
  min-width: 0;
  width: 100%;
  min-height: 26px;
  padding: 4px 8px;
  font-size: 12px;
  color: #1e293b;
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(100, 116, 139, 0.35);
}

/* On Board green rows — dark green inputs with white text */
.dgs-section-onboard .dgs-inventory-table tr.vg-a .input-cell,
.dgs-section-onboard .dgs-inventory-table tr.vg-a .table-input,
.dgs-section-onboard .dgs-inventory-table tr.vg-b .input-cell,
.dgs-section-onboard .dgs-inventory-table tr.vg-b .table-input {
  background-color: rgba(255, 255, 255, 0.84) !important;
  color: #0f172a !important;
  border: 1.5px solid #a7c8b5 !important;
}
.dgs-section-onboard .dgs-inventory-table .input-cell::placeholder,
.dgs-section-onboard .dgs-inventory-table .table-input::placeholder {
  color: #64748b;
}
.dgs-section-onboard .dgs-inventory-table .input-cell:focus,
.dgs-section-onboard .dgs-inventory-table .table-input:focus {
  border-color: #66bb6a !important;
  outline: none;
}

/* Borrowed (Issued from stock) purple rows — dark purple inputs */
.dgs-section-borrowed .dgs-inventory-table tr.vg-a .input-cell,
.dgs-section-borrowed .dgs-inventory-table tr.vg-a .table-input,
.dgs-section-borrowed .dgs-inventory-table tr.vg-b .input-cell,
.dgs-section-borrowed .dgs-inventory-table tr.vg-b .table-input {
  background-color: rgba(255, 255, 255, 0.84) !important;
  color: #0f172a !important;
  border: 1.5px solid #c4b5d8 !important;
}
.dgs-section-borrowed .dgs-inventory-table .input-cell::placeholder,
.dgs-section-borrowed .dgs-inventory-table .table-input::placeholder {
  color: #64748b;
}
.dgs-section-borrowed .dgs-inventory-table .input-cell:focus,
.dgs-section-borrowed .dgs-inventory-table .table-input:focus {
  border-color: #ab47bc !important;
  outline: none;
}

.dgs-inventory-table .table-input.qty-zero {
  background: #f5c6c6 !important;
  color: #7a3a3a !important;
  font-weight: 600;
  border-color: #000000 !important;
}
.dgs-inventory-table .table-input.qty-zero::placeholder {
  color: rgba(90, 40, 40, 0.55);
}

.dgs-inventory-table td:nth-child(5) .table-input {
  width: 72px;
}

.dgs-inventory-table td:last-child .table-input {
  width: 190px;
}

.dgs-section {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 14px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.dgs-section + .dgs-section {
  margin-top: 14px;
}

.dgs-section-refurbished {
  background: #ffffff;
}

.dgs-inventory-table .dgs-group-header {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 6px 10px;
  position: static;
}

.dgs-group-nakilat {
  background: #c2d9f0 !important;
  color: #0f2d4a !important;
  letter-spacing: 0.05em;
}

.dgs-group-eb {
  background: #c2dfd0 !important;
  color: #0c2d1e !important;
  letter-spacing: 0.05em;
}

.dgs-inventory-table td.dgs-next-action {
  font-weight: 600;
  font-size: 11px;
  min-width: 180px;
}

.dgs-inventory-table td.dgs-years-alert {
  background: #fee2e2 !important;
  color: #991b1b !important;
  font-weight: 700;
}

.dgs-section-refurbished .dgs-inventory-table tr.dgs-refurbished-row.vg-a td {
  background: #f1f8ff !important;
  color: #0f172a !important;
}

.dgs-section-refurbished .dgs-inventory-table tr.dgs-refurbished-row.vg-b td {
  background: #e8f4ff !important;
  color: #0f172a !important;
}

.dgs-section-refurbished .dgs-inventory-table tr.dgs-refurbished-row td:nth-child(n+10) {
  background: #edfff5 !important;
  color: #0f2a1e !important;
}

.dgs-section-warehouse .dgs-inventory-table tr.dgs-warehouse-row.vg-a td {
  background: #fefce8 !important;
  color: #0f172a !important;
}

.dgs-section-warehouse .dgs-inventory-table tr.dgs-warehouse-row.vg-b td {
  background: #fffbf0 !important;
  color: #0f172a !important;
}

.dgs-section-warehouse .dgs-inventory-table tr.dgs-warehouse-row td:nth-child(n+9) {
  background: #edfff5 !important;
  color: #0f2a1e !important;
}

.dgs-section-refurbished .dgs-inventory-table tr.dgs-refurbished-row td.dgs-years-alert {
  background: #ffd6d6 !important;
  color: #9f1239 !important;
}

.dgs-section-refurbished .dgs-inventory-table tr.dgs-refurbished-row .table-input,
.dgs-section-warehouse .dgs-inventory-table tr.dgs-warehouse-row .table-input {
  background: rgba(255, 255, 255, 0.82) !important;
  color: #0f172a !important;
  border-color: rgba(71, 85, 105, 0.35) !important;
}

/* qty-zero override — specificity (0,4,1) matches the row rule above so source order wins */
.dgs-section-refurbished .dgs-inventory-table tr .table-input.qty-zero,
.dgs-section-warehouse .dgs-inventory-table tr .table-input.qty-zero,
.dgs-section-onboard .dgs-inventory-table tr .table-input.qty-zero,
.dgs-section-borrowed .dgs-inventory-table tr .table-input.qty-zero {
  background: #f5c6c6 !important;
  color: #7a3a3a !important;
  font-weight: 600;
  border-color: #000000 !important;
}

/* Refurbished: col 10 = BOX No (narrow), col 3 = REFURBISH DATE, col 6 = DATE OF LANDING, col 13 = EB Repaired Date */
.dgs-section-refurbished .dgs-inventory-table th:nth-child(10),
.dgs-section-refurbished .dgs-inventory-table td:nth-child(10) {
  min-width: 52px;
  max-width: 72px;
  width: 60px;
}

/* Warehouse: col 9 = BOX No (narrow), col 12 = EB Remarks (wide) */
.dgs-section-warehouse .dgs-inventory-table th:nth-child(9),
.dgs-section-warehouse .dgs-inventory-table td:nth-child(9) {
  min-width: 52px;
  max-width: 72px;
  width: 60px;
}

.dgs-section-warehouse .dgs-inventory-table th:nth-child(12),
.dgs-section-warehouse .dgs-inventory-table td:nth-child(12) {
  min-width: 220px;
}

.dgs-section-warehouse {
  background: linear-gradient(180deg, #fff8eb 0%, #fffdf7 100%);
}

/* ── On Board — matches Warehouse amber palette ─────── */
.dgs-section-onboard {
  background: linear-gradient(180deg, #fff8eb 0%, #fffdf7 100%);
}

.dgs-section-onboard .dgs-inventory-table th {
  background: #fde7b0;
  white-space: normal;
  word-break: break-word;
  vertical-align: bottom;
  line-height: 1.25;
}

.dgs-section-onboard .dgs-inventory-table,
.dgs-section-borrowed .dgs-inventory-table {
  width: 100%;
  table-layout: auto;
  min-width: 600px;
}

.dgs-section-onboard .dgs-inventory-table th,
.dgs-section-onboard .dgs-inventory-table td,
.dgs-section-borrowed .dgs-inventory-table th,
.dgs-section-borrowed .dgs-inventory-table td {
  position: static;
  overflow: visible;
  white-space: normal;
  text-overflow: unset;
}

/* On Board: min-width hints — auto layout, content-driven */
.dgs-section-onboard .dgs-inventory-table th:nth-child(1),
.dgs-section-onboard .dgs-inventory-table td:nth-child(1) { min-width: 120px; }
.dgs-section-onboard .dgs-inventory-table th:nth-child(2),
.dgs-section-onboard .dgs-inventory-table td:nth-child(2) { min-width: 80px; }
.dgs-section-onboard .dgs-inventory-table th:nth-child(3),
.dgs-section-onboard .dgs-inventory-table td:nth-child(3) { min-width: 130px; }
.dgs-section-onboard .dgs-inventory-table th:nth-child(4),
.dgs-section-onboard .dgs-inventory-table td:nth-child(4) { min-width: 130px; }
.dgs-section-onboard .dgs-inventory-table th:nth-child(5),
.dgs-section-onboard .dgs-inventory-table td:nth-child(5) { min-width: 42px; width: 50px; }
.dgs-section-onboard .dgs-inventory-table th:nth-child(6),
.dgs-section-onboard .dgs-inventory-table td:nth-child(6) { min-width: 80px; }
.dgs-section-onboard .dgs-inventory-table th:nth-child(7),
.dgs-section-onboard .dgs-inventory-table td:nth-child(7) { min-width: 140px; }

/* Borrowed: min-width hints */
.dgs-section-borrowed .dgs-inventory-table {
  min-width: 700px;
}
.dgs-section-borrowed .dgs-inventory-table th:nth-child(1),
.dgs-section-borrowed .dgs-inventory-table td:nth-child(1) { min-width: 75px; }
.dgs-section-borrowed .dgs-inventory-table th:nth-child(2),
.dgs-section-borrowed .dgs-inventory-table td:nth-child(2) { min-width: 85px; }
.dgs-section-borrowed .dgs-inventory-table th:nth-child(3),
.dgs-section-borrowed .dgs-inventory-table td:nth-child(3) { min-width: 140px; }
.dgs-section-borrowed .dgs-inventory-table th:nth-child(4),
.dgs-section-borrowed .dgs-inventory-table td:nth-child(4) { min-width: 40px; width: 46px; }
.dgs-section-borrowed .dgs-inventory-table th:nth-child(5),
.dgs-section-borrowed .dgs-inventory-table td:nth-child(5) { min-width: 40px; width: 46px; }
.dgs-section-borrowed .dgs-inventory-table th:nth-child(6),
.dgs-section-borrowed .dgs-inventory-table td:nth-child(6) { min-width: 82px; }
.dgs-section-borrowed .dgs-inventory-table th:nth-child(7),
.dgs-section-borrowed .dgs-inventory-table td:nth-child(7) { min-width: 65px; }
.dgs-section-borrowed .dgs-inventory-table th:nth-child(8),
.dgs-section-borrowed .dgs-inventory-table td:nth-child(8) { min-width: 170px; }
.dgs-section-borrowed .dgs-inventory-table th:nth-child(9),
.dgs-section-borrowed .dgs-inventory-table td:nth-child(9) { min-width: 50px; }
.dgs-section-borrowed .dgs-inventory-table th:nth-child(10),
.dgs-section-borrowed .dgs-inventory-table td:nth-child(10) { min-width: 65px; }

/* All inputs in these sections fill their cell */
.dgs-section-onboard .dgs-inventory-table .table-input,
.dgs-section-borrowed .dgs-inventory-table .table-input {
  width: 100%;
  min-width: unset;
}

/* ── Borrowed — matches Warehouse amber palette ──────── */
.dgs-section-borrowed {
  background: linear-gradient(180deg, #fff8eb 0%, #fffdf7 100%);
}

.dgs-section-borrowed .dgs-inventory-table th {
  background: #fde7b0;
  white-space: normal;
  word-break: break-word;
  vertical-align: bottom;
  line-height: 1.25;
}

.dgs-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.dgs-stock-cards {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.dgs-stock-card {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  min-width: auto;
  box-shadow: none;
}

.dgs-stock-count {
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.3px;
}

.dgs-stock-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0.90;
}

.dgs-stock-warm {
  background: rgba(192, 115, 85, 0.15);
  color: #9a4a28;
  border: 1px solid rgba(192, 115, 85, 0.35);
}

.dgs-stock-cold {
  background: rgba(63, 111, 146, 0.13);
  color: #1e5272;
  border: 1px solid rgba(63, 111, 146, 0.32);
}

/* ── Inventory date bar ───────────────────────────── */
.dgs-date-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: rgba(219,231,245,0.45);
  border-bottom: 1px solid rgba(148,163,184,0.18);
  font-size: 12.5px;
  font-weight: 500;
  color: #334155;
}

.dgs-date-bar-label {
  white-space: nowrap;
  color: #475569;
}

.dgs-date-bar-input {
  height: 28px;
  padding: 0 10px;
  border: 1.5px solid #93c5fd;
  border-radius: 6px;
  background: #ffffff;
  color: #0f172a;
  font-size: 12.5px;
  width: 180px;
  outline: none;
}

.dgs-date-bar-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.13);
}

/* ── Column widths — size by content ───────────────── */
.dgs-section-refurbished .dgs-inventory-table th,
.dgs-section-warehouse .dgs-inventory-table th {
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  vertical-align: bottom;
  line-height: 1.25;
}

/* Refurbished: text cells — nowrap so content drives column width */
.dgs-section-refurbished .dgs-inventory-table td {
  white-space: nowrap;
}
/* Refurbished: floor widths for columns whose data is shorter than the header */
.dgs-section-refurbished .dgs-inventory-table th:nth-child(5),
.dgs-section-refurbished .dgs-inventory-table td:nth-child(5) { min-width: 42px; }  /* QTY */
.dgs-section-refurbished .dgs-inventory-table th:nth-child(9),
.dgs-section-refurbished .dgs-inventory-table td:nth-child(9) { min-width: 150px; } /* WH REMARKS */
.dgs-section-refurbished .dgs-inventory-table th:nth-child(14),
.dgs-section-refurbished .dgs-inventory-table td:nth-child(14) { min-width: 52px; } /* No of Years in Stock (data: 2-digit number) */

/* Warehouse: all inputs — browser can't size from value text, use content-based min-widths */
.dgs-section-warehouse .dgs-inventory-table th:nth-child(1),
.dgs-section-warehouse .dgs-inventory-table td:nth-child(1) { min-width: 78px; }   /* TYPE (Warm/Cold Side) */
.dgs-section-warehouse .dgs-inventory-table th:nth-child(2),
.dgs-section-warehouse .dgs-inventory-table td:nth-child(2) { min-width: 88px; }   /* S/N NO. */
.dgs-section-warehouse .dgs-inventory-table th:nth-child(3),
.dgs-section-warehouse .dgs-inventory-table td:nth-child(3) { min-width: 105px; }  /* PART NUMBER */
.dgs-section-warehouse .dgs-inventory-table th:nth-child(4),
.dgs-section-warehouse .dgs-inventory-table td:nth-child(4) { min-width: 42px; }   /* QTY */
.dgs-section-warehouse .dgs-inventory-table th:nth-child(5),
.dgs-section-warehouse .dgs-inventory-table td:nth-child(5) { min-width: 95px; }   /* MLA */
.dgs-section-warehouse .dgs-inventory-table th:nth-child(6),
.dgs-section-warehouse .dgs-inventory-table td:nth-child(6) { min-width: 108px; }  /* LANDED VESSEL */
.dgs-section-warehouse .dgs-inventory-table th:nth-child(7),
.dgs-section-warehouse .dgs-inventory-table td:nth-child(7) { min-width: 95px; }   /* DATE OF LANDING */
.dgs-section-warehouse .dgs-inventory-table th:nth-child(8),
.dgs-section-warehouse .dgs-inventory-table td:nth-child(8) { min-width: 55px; }   /* OWNER */
.dgs-section-warehouse .dgs-inventory-table th:nth-child(9),
.dgs-section-warehouse .dgs-inventory-table td:nth-child(9) { min-width: 55px; }   /* BOX No */
.dgs-section-warehouse .dgs-inventory-table th:nth-child(10),
.dgs-section-warehouse .dgs-inventory-table td:nth-child(10) { min-width: 88px; }  /* Seal Sr No */
.dgs-section-warehouse .dgs-inventory-table th:nth-child(11),
.dgs-section-warehouse .dgs-inventory-table td:nth-child(11) { min-width: 92px; }  /* EB DWG NO */
.dgs-section-warehouse .dgs-inventory-table th:nth-child(12),
.dgs-section-warehouse .dgs-inventory-table td:nth-child(12) { min-width: 185px; } /* EB Remarks */
.dgs-section-warehouse .dgs-inventory-table th:nth-child(13),
.dgs-section-warehouse .dgs-inventory-table td:nth-child(13) { min-width: 135px; } /* Next Action */

.dgs-section-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dgs-section-header h3 {
  margin: 2px 0 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  color: #0f172a;
}

.dgs-section-kicker {
  color: #64748b;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
  margin-bottom: 1px;
}

.dgs-section-note {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.28);
  color: #475569;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.dgs-table-wrap {
  overflow: auto;
  max-height: 360px;
}

.dgs-content-minor {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: calc(100vh - 245px);
}

.dgs-content-major {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1 1 auto;
  min-height: 0;
}

.dgs-content-major .dgs-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dgs-content-major .dgs-section.is-collapsed {
  flex: 0 0 auto;
}

.dgs-content-major .dgs-section.is-expanded {
  flex: 1 1 auto;
  min-height: 0;
}

.dgs-content-major .dgs-section.is-collapsed .dgs-table-wrap {
  display: none;
}

.dgs-content-major .dgs-section.is-expanded .dgs-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.dgs-content-minor .dgs-section {
  display: flex;
  flex-direction: column;
  min-height: 72px;
}

.dgs-content-minor .dgs-section.is-expanded {
  flex: 1 1 auto;
}

.dgs-content-minor .dgs-section.is-collapsed {
  flex: 0 0 auto;
}

.dgs-content-minor .dgs-section.is-collapsed .dgs-table-wrap {
  display: none;
}

.dgs-content-minor .dgs-section.is-expanded .dgs-table-wrap {
  flex: 1 1 auto;
  max-height: none;
}

.dgs-section-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.dgs-section-toggle-btn,
.dgs-add-row-btn {
  height: 30px;
  padding: 0 11px;
  border-radius: 9px;
  border: 1px solid rgba(148, 163, 184, 0.38);
  background: rgba(30, 41, 59, 0.07);
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 150ms, background 150ms, color 150ms;
}

.dgs-section-toggle-btn:hover,
.dgs-add-row-btn:hover {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(56, 189, 248, 0.07);
  color: #0f172a;
}

.dgs-section-toggle-btn:disabled {
  opacity: 0.40;
  cursor: default;
}

.dgs-section-refurbished .dgs-inventory-table th {
  background: #dfeaf6 !important;
  color: #18324d !important;
}

.dgs-section-warehouse .dgs-inventory-table th {
  background: #dfeaf6 !important;
  color: #18324d !important;
}

.dgs-section-refurbished .dgs-inventory-table tbody tr:nth-child(even) td {
  background: rgba(230, 242, 255, 0.96);
}

.dgs-section-warehouse .dgs-inventory-table tbody tr:nth-child(even) td {
  background: rgba(255, 248, 226, 0.96);
}

/* Final DGS color map. Keep these after generic zebra rules so the tracker never falls back to plain monochrome rows. */
.dgs-section-refurbished .dgs-inventory-table tbody tr.dgs-refurbished-row.vg-a td {
  background: #f1f8ff !important;
  color: #0f172a !important;
}

.dgs-section-refurbished .dgs-inventory-table tbody tr.dgs-refurbished-row.vg-b td {
  background: #e8f4ff !important;
  color: #0f172a !important;
}

.dgs-section-refurbished .dgs-inventory-table tbody tr.dgs-refurbished-row td:nth-child(n+10) {
  background: #edfff5 !important;
  color: #0f2a1e !important;
}

/* Vacuum lost — yellow cell highlight */
.dgs-section-refurbished .dgs-inventory-table tbody tr.dgs-refurbished-row td.dgs-vacuum-alert {
  background: #fef9c3 !important;
  color: #854d0e !important;
  font-weight: 600;
}

/* Years in stock > 5 — red cell */
.dgs-section-refurbished .dgs-inventory-table tbody tr.dgs-color-row.dgs-refurbished-row td.dgs-years-alert {
  background: #ffd6d6 !important;
  color: #9f1239 !important;
  font-weight: 700;
}

.dgs-section-warehouse .dgs-inventory-table tbody tr.dgs-warehouse-row.vg-a td {
  background: #fefce8 !important;
  color: #0f172a !important;
}

.dgs-section-warehouse .dgs-inventory-table tbody tr.dgs-warehouse-row.vg-b td {
  background: #fffbf0 !important;
  color: #0f172a !important;
}

.dgs-section-warehouse .dgs-inventory-table tbody tr.dgs-warehouse-row td:nth-child(n+9) {
  background: #edfff5 !important;
  color: #0f2a1e !important;
}

.dgs-section-onboard .dgs-inventory-table tbody tr.vg-a td {
  background: #fff0c2 !important;
  color: #3f2d00 !important;
}

.dgs-section-onboard .dgs-inventory-table tbody tr.vg-b td {
  background: #fff8df !important;
  color: #3f2d00 !important;
}

.dgs-section-borrowed .dgs-inventory-table tbody tr.vg-a td {
  background: #fff0c2 !important;
  color: #3f2d00 !important;
}

.dgs-section-borrowed .dgs-inventory-table tbody tr.vg-b td {
  background: #fff8df !important;
  color: #3f2d00 !important;
}

.dgs-section-refurbished .dgs-inventory-table .table-input,
.dgs-section-warehouse .dgs-inventory-table .table-input,
.dgs-section-onboard .dgs-inventory-table .table-input,
.dgs-section-borrowed .dgs-inventory-table .table-input {
  background: rgba(255, 255, 255, 0.84) !important;
  color: #0f172a !important;
  border-color: rgba(71, 85, 105, 0.36) !important;
}

/* QTY = 0 — always red, strongest override after generic input background rule */
.dgs-section-refurbished .dgs-inventory-table tbody tr .table-input.qty-zero,
.dgs-section-warehouse   .dgs-inventory-table tbody tr .table-input.qty-zero,
.dgs-section-onboard     .dgs-inventory-table tbody tr .table-input.qty-zero,
.dgs-section-borrowed    .dgs-inventory-table tbody tr .table-input.qty-zero {
  background: #f5c6c6 !important;
  color: #7a3a3a !important;
  border-color: #c0392b !important;
  font-weight: 600;
}

.dgs-inventory-table .table-input.qty-zero {
  background: #f5c6c6 !important;
  color: #7a3a3a !important;
  border-color: #000000 !important;
  font-weight: 600;
}

.contract-modal-header {
  color: #eef2f8;
}

.contract-modal-header .note,
.contract-modal-header .detail-kicker {
  color: #7b8798;
}

.contract-viewer {
  overflow: auto;
  max-height: calc(100vh - 150px);
  padding-right: 4px;
  display: grid;
  gap: 16px;
}

.contract-viewer-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding-bottom: 24px;
  border-bottom: 1px solid #1e2430;
}

.contract-badge-viewer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(0, 196, 255, 0.08);
  border: 1px solid rgba(0, 196, 255, 0.2);
  color: #00c4ff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.contract-viewer-header h3 {
  margin: 0 0 8px;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #eef2f8;
}

.contract-viewer-header h3 span {
  color: #00c4ff;
}

.contract-viewer-sub {
  color: #7b8798;
  font-size: 13px;
}

.contract-status-box {
  min-width: 220px;
  padding: 16px 18px;
  border-radius: 12px;
  background: #111318;
  border: 1px solid #1e2430;
}

.contract-status-label {
  color: #5a6478;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 4px;
}

.contract-status-value {
  color: #eef2f8;
  font-size: 13px;
  font-weight: 600;
}

.contract-status-gold {
  color: #f0c040;
}

.contract-status-stack {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.contract-tag {
  display: inline-flex;
  margin-top: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.contract-tag-obsolete {
  background: rgba(255, 107, 53, 0.12);
  border: 1px solid rgba(255, 107, 53, 0.25);
  color: #ff6b35;
}

.contract-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.contract-metric {
  padding: 18px;
  border-radius: 12px;
  background: #111318;
  border: 1px solid #1e2430;
}

.contract-metric-label {
  color: #5a6478;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.contract-metric-value {
  color: #eef2f8;
  font-size: 22px;
  font-weight: 700;
}

.contract-metric-gold {
  color: #f0c040;
}

.contract-metric-cyan {
  color: #00c4ff;
}

.contract-metric-green {
  color: #00e676;
}

.contract-metric-sub {
  margin-top: 4px;
  color: #7b8798;
  font-size: 11px;
}

.contract-grid-2,
.contract-scope-grid,
.contract-warranty-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.contract-warranty-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.contract-panel {
  border: 1px solid #1e2430;
  border-radius: 14px;
  overflow: hidden;
  background: #111318;
}

.contract-panel-head {
  padding: 14px 18px;
  border-bottom: 1px solid #1e2430;
  background: rgba(255, 255, 255, 0.02);
  color: #eef2f8;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}

.contract-panel-body {
  padding: 18px;
}

.contract-section-label {
  margin: 4px 0 12px;
  color: #5a6478;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.contract-kv-list {
  display: grid;
  gap: 10px;
}

.contract-kv {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.contract-kv span,
.contract-tc-item span,
.contract-warranty-card span {
  color: #7b8798;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.contract-kv strong,
.contract-tc-item strong {
  color: #eef2f8;
  font-size: 13px;
  text-align: right;
}

.contract-tc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.contract-tc-item,
.contract-warranty-card {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid #1e2430;
}

.contract-escalation {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #1e2430;
}

.contract-escalation-step {
  display: grid;
  gap: 4px;
  text-align: center;
  padding: 12px 10px;
  background: rgba(255, 255, 255, 0.02);
  border-right: 1px solid #1e2430;
}

.contract-escalation-step:last-child {
  border-right: 0;
}

.contract-escalation-step span,
.contract-escalation-step em {
  color: #7b8798;
  font-size: 10px;
  font-style: normal;
}

.contract-escalation-step strong {
  color: #f0c040;
  font-size: 20px;
}

.contract-scope-title {
  margin-bottom: 12px;
  color: #00c4ff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.contract-scope-title-warm {
  color: #ff6b35;
}

.contract-scope-list {
  display: grid;
  gap: 8px;
  padding-left: 18px;
}

.contract-scope-list li {
  color: #cdd5e0;
  font-size: 13px;
}

.contract-note-box,
.contract-disclaimer {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 10px;
  background: rgba(240, 192, 64, 0.05);
  border: 1px solid rgba(240, 192, 64, 0.2);
  color: #cdd5e0;
  font-size: 12px;
  line-height: 1.5;
}

.contract-note-box strong,
.contract-disclaimer strong {
  color: #f0c040;
}

.contract-warranty-card {
  background: rgba(0, 230, 118, 0.04);
  border-color: rgba(0, 230, 118, 0.15);
}

.contract-warranty-card strong {
  color: #eef2f8;
  font-size: 24px;
}

.contract-warranty-card em {
  color: #7b8798;
  font-size: 11px;
  font-style: normal;
}

.contract-table-body {
  padding: 0;
}

.contract-vessels-table {
  width: 100%;
  border-collapse: collapse;
}

.contract-vessels-table th,
.contract-vessels-table td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  text-align: left;
  color: #cdd5e0;
  font-size: 12px;
}

.contract-vessels-table th {
  color: #7b8798;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: rgba(255, 255, 255, 0.02);
}

.contract-vessel-muted {
  opacity: 0.45;
}

.contract-shell {
  color: #cdd5e0;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

.contract-shell .header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid #1e2430;
}

.contract-shell .header-left {
  flex: 1;
}

.contract-shell .contract-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(90, 100, 120, 0.15);
  border: 1px solid rgba(90, 100, 120, 0.3);
  border-radius: 4px;
  padding: 4px 12px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: #5a6478;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.contract-shell .contract-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5a6478;
}

.contract-shell h1 {
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(20px, 2.8vw, 32px);
  letter-spacing: 0.05em;
  color: #eef2f8;
  line-height: 1.15;
  margin-bottom: 6px;
}

.contract-shell h1 span {
  color: #00c4ff;
}

.contract-shell .header-dept {
  font-size: 12px;
  color: #5a6478;
  font-family: "IBM Plex Mono", monospace;
  margin-top: 10px;
  line-height: 1.8;
}

.contract-shell .header-dept strong {
  color: #cdd5e0;
}

.contract-shell .status-box {
  flex-shrink: 0;
  background: #111318;
  border: 1px solid rgba(255, 82, 82, 0.25);
  border-radius: 10px;
  padding: 18px 22px;
  min-width: 220px;
  text-align: right;
}

.contract-shell .status-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 14px;
}

.contract-shell .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff5252;
  flex-shrink: 0;
}

.contract-shell .status-text {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  font-weight: 600;
  color: #ff5252;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.contract-shell .date-row {
  margin-bottom: 10px;
}

.contract-shell .date-lbl {
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #5a6478;
  font-family: "IBM Plex Mono", monospace;
  margin-bottom: 2px;
}

.contract-shell .date-val {
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  color: #eef2f8;
  font-weight: 500;
}

.contract-shell .date-val.exp {
  color: #ff5252;
}

.contract-shell .date-sep {
  border-top: 1px solid #1e2430;
  margin: 12px 0;
}

.contract-shell .price-big {
  font-family: "Bebas Neue", sans-serif;
  font-size: 28px;
  color: #f0c040;
  letter-spacing: 0.04em;
  line-height: 1;
  margin-bottom: 2px;
}

.contract-shell .price-sub {
  font-size: 10px;
  color: #5a6478;
  font-family: "IBM Plex Mono", monospace;
}

.contract-shell .tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}

.contract-shell .tag-obs {
  background: rgba(255, 82, 82, 0.12);
  color: #ff5252;
  border: 1px solid rgba(255, 82, 82, 0.25);
}

.contract-shell .tag-stasco {
  background: rgba(255, 107, 53, 0.12);
  color: #ff6b35;
  border: 1px solid rgba(255, 107, 53, 0.25);
}

.contract-shell .tag-nsql {
  background: rgba(0, 196, 255, 0.12);
  color: #00c4ff;
  border: 1px solid rgba(0, 196, 255, 0.25);
}

.contract-shell .metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 10px;
  margin-bottom: 28px;
}

.contract-shell .metric {
  background: #111318;
  border: 1px solid #1e2430;
  border-radius: 8px;
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}

.contract-shell .metric::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: #00c4ff;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s;
}

.contract-shell .metric:hover::after {
  transform: scaleX(1);
}

.contract-shell .metric-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #5a6478;
  margin-bottom: 6px;
  font-family: "IBM Plex Mono", monospace;
}

.contract-shell .metric-value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 18px;
  font-weight: 600;
  color: #eef2f8;
  line-height: 1.2;
}

.contract-shell .mv-gold { color: #f0c040; }
.contract-shell .mv-cyan { color: #00c4ff; }
.contract-shell .mv-green { color: #00e676; }
.contract-shell .mv-red { color: #ff5252; }

.contract-shell .metric-sub {
  font-size: 11px;
  color: #5a6478;
  margin-top: 4px;
}

.contract-shell .panel {
  background: #111318;
  border: 1px solid #1e2430;
  border-radius: 10px;
  overflow: hidden;
}

.contract-shell .panel-full {
  margin-bottom: 14px;
}

.contract-shell .panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 20px;
  border-bottom: 1px solid #1e2430;
  background: rgba(255, 255, 255, 0.018);
}

.contract-shell .panel-icon {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.contract-shell .pi-b { background: rgba(0, 196, 255, 0.12); }
.contract-shell .pi-o { background: rgba(255, 107, 53, 0.12); }
.contract-shell .pi-g { background: rgba(240, 192, 64, 0.12); }
.contract-shell .pi-gr { background: rgba(0, 230, 118, 0.12); }

.contract-shell .panel-title {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #eef2f8;
  font-weight: 600;
  font-family: "IBM Plex Mono", monospace;
}

.contract-shell .panel-body {
  padding: 20px;
}

.contract-shell .g2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.contract-shell .kvl {
  display: flex;
  flex-direction: column;
}

.contract-shell .kv {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.contract-shell .kv:last-child {
  border-bottom: none;
}

.contract-shell .kk {
  font-size: 11px;
  color: #5a6478;
  font-family: "IBM Plex Mono", monospace;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-top: 1px;
}

.contract-shell .kv-v {
  font-size: 13px;
  color: #eef2f8;
  text-align: right;
  word-break: break-word;
}

.contract-shell .kv-v.mono {
  font-family: "IBM Plex Mono", monospace;
}

.contract-shell .sl {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #5a6478;
  margin: 18px 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.contract-shell .sl:first-child {
  margin-top: 0;
}

.contract-shell .sl::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #1e2430;
}

.contract-shell .tcg,
.contract-shell .cg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.contract-shell .tc {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid #1e2430;
  border-radius: 6px;
  padding: 10px 13px;
}

.contract-shell .tcl,
.contract-shell .cn {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #5a6478;
  font-family: "IBM Plex Mono", monospace;
  margin-bottom: 3px;
}

.contract-shell .tcv,
.contract-shell .ct {
  font-size: 13px;
  color: #eef2f8;
  font-family: "IBM Plex Mono", monospace;
}

.contract-shell .cc {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid #1e2430;
  border-radius: 7px;
  padding: 14px 16px;
}

.contract-shell .cb {
  font-size: 12px;
  color: #5a6478;
  line-height: 1.55;
}

.contract-shell .escr {
  display: flex;
  margin-top: 8px;
}

.contract-shell .esc {
  flex: 1;
  text-align: center;
  padding: 10px 6px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid #1e2430;
}

.contract-shell .esc:first-child { border-radius: 6px 0 0 6px; }
.contract-shell .esc:last-child { border-radius: 0 6px 6px 0; }
.contract-shell .esc:not(:first-child) { border-left: none; }

.contract-shell .ep,
.contract-shell .en {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  color: #5a6478;
}

.contract-shell .er {
  font-family: "IBM Plex Mono", monospace;
  font-size: 18px;
  font-weight: 600;
  color: #f0c040;
  line-height: 1.3;
}

.contract-shell .sg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.contract-shell .st {
  font-size: 11px;
  font-family: "IBM Plex Mono", monospace;
  color: #00c4ff;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.contract-shell .st::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(0, 196, 255, 0.15);
}

.contract-shell .st.or {
  color: #ff6b35;
}

.contract-shell .st.or::after {
  background: rgba(255, 107, 53, 0.15);
}

.contract-shell .si-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.contract-shell .si {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 12px;
  color: #cdd5e0;
}

.contract-shell .si::before {
  content: "▸";
  color: #00c4ff;
  font-size: 10px;
}

.contract-shell .si.or::before {
  color: #ff6b35;
}

.contract-shell .wr {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.contract-shell .wc {
  background: rgba(0, 230, 118, 0.04);
  border: 1px solid rgba(0, 230, 118, 0.15);
  border-radius: 7px;
  padding: 14px;
}

.contract-shell .wct {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #00e676;
  font-family: "IBM Plex Mono", monospace;
  margin-bottom: 5px;
}

.contract-shell .wcv {
  font-size: 24px;
  font-family: "Bebas Neue", sans-serif;
  color: #eef2f8;
}

.contract-shell .wcd {
  font-size: 11px;
  color: #5a6478;
  margin-top: 3px;
  line-height: 1.4;
}

.contract-shell .nbox,
.contract-shell .wbox,
.contract-shell .ibox {
  border-radius: 6px;
  padding: 12px 16px;
  font-size: 12px;
  color: #cdd5e0;
  margin-top: 12px;
  line-height: 1.6;
}

.contract-shell .nbox {
  background: rgba(240, 192, 64, 0.05);
  border: 1px solid rgba(240, 192, 64, 0.2);
}

.contract-shell .wbox {
  background: rgba(255, 82, 82, 0.05);
  border: 1px solid rgba(255, 82, 82, 0.2);
}

.contract-shell .ibox {
  background: rgba(0, 196, 255, 0.04);
  border: 1px solid rgba(0, 196, 255, 0.15);
}

.contract-shell .nbox strong { color: #f0c040; }
.contract-shell .wbox strong { color: #ff5252; }
.contract-shell .ibox strong { color: #00c4ff; }

.contract-shell .dl {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.contract-shell .di {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid #1e2430;
  border-radius: 5px;
  font-size: 12px;
}

.contract-shell .dn {
  font-family: "IBM Plex Mono", monospace;
  color: #00c4ff;
  font-size: 11px;
  min-width: 28px;
  font-weight: 600;
}

.contract-shell .dname {
  color: #eef2f8;
  font-weight: 500;
}

.contract-shell .dnote {
  color: #5a6478;
  font-size: 11px;
  margin-top: 2px;
}

.contract-shell .vt {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.contract-shell .vt thead tr {
  background: rgba(255, 255, 255, 0.03);
}

.contract-shell .vt th {
  padding: 9px 14px;
  text-align: left;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #5a6478;
  font-weight: 500;
  border-bottom: 1px solid #1e2430;
}

.contract-shell .vt td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #cdd5e0;
  font-family: "IBM Plex Mono", monospace;
}

.contract-shell .vt.vt-sap {
  table-layout: auto;
  min-width: 1120px;
  width: max-content;
}
.contract-shell .vt.vt-sap td,
.contract-shell .vt.vt-sap th {
  white-space: nowrap;
  overflow: visible;
  text-overflow: unset;
}
.contract-shell .vt.vt-sap col:nth-child(1) { width: 42px !important; }
.contract-shell .vt.vt-sap col:nth-child(2) { width: 158px !important; }
.contract-shell .vt.vt-sap col:nth-child(3) { width: 420px !important; }
.contract-shell .vt.vt-sap col:nth-child(4) { width: 86px !important; }
.contract-shell .vt.vt-sap col:nth-child(5) { width: 122px !important; }
.contract-shell .vt.vt-sap col:nth-child(6) { width: 58px !important; }
.contract-shell .vt.vt-sap col:nth-child(7) { width: 92px !important; }
.contract-shell .vt.vt-sap col:nth-child(8) { width: 58px !important; }
.contract-shell .vt.vt-sap col:nth-child(9) { width: 120px !important; }

.contract-shell .vt.vt-sap th:nth-child(4),
.contract-shell .vt.vt-sap td:nth-child(4),
.contract-shell .vt.vt-sap th:nth-child(5),
.contract-shell .vt.vt-sap td:nth-child(5),
.contract-shell .vt.vt-sap th:nth-child(6),
.contract-shell .vt.vt-sap td:nth-child(6),
.contract-shell .vt.vt-sap th:nth-child(7),
.contract-shell .vt.vt-sap td:nth-child(7),
.contract-shell .vt.vt-sap th:nth-child(8),
.contract-shell .vt.vt-sap td:nth-child(8),
.contract-shell .vt.vt-sap th:nth-child(9),
.contract-shell .vt.vt-sap td:nth-child(9) {
  text-align: right;
}
.contract-shell .vt.vt-sap td:nth-child(3),
.contract-shell .vt.vt-sap th:nth-child(3) {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

.contract-shell .vt tr.ct-section-head td {
  background: rgba(56, 189, 248, 0.1);
  color: #7dd3fc;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 14px;
  border-top: 1px solid rgba(56, 189, 248, 0.2);
  border-bottom: 1px solid rgba(56, 189, 248, 0.2);
}

.contract-shell .vn { color: #eef2f8; font-weight: 500; }
.contract-shell .dd { color: #f0c040; }
.contract-shell .qg2 { color: #7eb3ff; }
.contract-shell .qg3 { color: #a78bfa; }
.contract-shell .hhi { color: #67e8f9; }
.contract-shell .shi { color: #86efac; }
.contract-shell .dsme { color: #fca5a5; }

.contract-shell .disc {
  margin-top: 22px;
  padding: 14px 18px;
  background: rgba(255, 82, 82, 0.05);
  border-left: 3px solid #ff5252;
  border-radius: 0 6px 6px 0;
  font-size: 12px;
  color: #5a6478;
}

.contract-shell .disc strong {
  color: #ff5252;
}

.contract-shell .footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid #1e2430;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: #5a6478;
}

.contract-document-hidden {
  display: none;
}

body[data-theme="light"] .kpi-secondary-note,
body[data-theme="light"] .note,
body[data-theme="light"] .detail-subtitle,
body[data-theme="light"] .footer,
body[data-theme="light"] td {
  color: var(--text);
}

body[data-theme="light"] .modal-card {
  background: #ffffff;
  border-color: rgba(148, 163, 184, 0.28);
  color: #0f172a;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.18);
}

body[data-theme="light"] .contract-modal-card {
  background: #f8fbff;
  border-color: rgba(148, 163, 184, 0.28);
  color: #122033;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.18);
}

body[data-theme="light"] .contract-modal-header {
  color: #0f172a;
}

body[data-theme="light"] .contract-shell {
  color: #334155;
}

body[data-theme="light"] .contract-shell h1,
body[data-theme="light"] .contract-shell .date-val,
body[data-theme="light"] .contract-shell .metric-value,
body[data-theme="light"] .contract-shell .panel-title,
body[data-theme="light"] .contract-shell .kv-v,
body[data-theme="light"] .contract-shell .tcv,
body[data-theme="light"] .contract-shell .ct,
body[data-theme="light"] .contract-shell .dname,
body[data-theme="light"] .contract-shell .vn,
body[data-theme="light"] .contract-shell .price-big {
  color: #0f172a;
}

body[data-theme="light"] .contract-shell .header-dept,
body[data-theme="light"] .contract-shell .metric-label,
body[data-theme="light"] .contract-shell .metric-sub,
body[data-theme="light"] .contract-shell .kk,
body[data-theme="light"] .contract-shell .tcl,
body[data-theme="light"] .contract-shell .cn,
body[data-theme="light"] .contract-shell .cb,
body[data-theme="light"] .contract-shell .dnote,
body[data-theme="light"] .contract-shell .date-lbl,
body[data-theme="light"] .contract-shell .footer,
body[data-theme="light"] .contract-shell .disc {
  color: #64748b;
}

body[data-theme="light"] .contract-shell .header-dept strong {
  color: #0f172a;
}

body[data-theme="light"] .contract-shell .contract-badge,
body[data-theme="light"] .contract-shell .metric,
body[data-theme="light"] .contract-shell .panel,
body[data-theme="light"] .contract-shell .status-box,
body[data-theme="light"] .contract-shell .tc,
body[data-theme="light"] .contract-shell .cc,
body[data-theme="light"] .contract-shell .si,
body[data-theme="light"] .contract-shell .di {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(148, 163, 184, 0.28);
}

body[data-theme="light"] .contract-shell .panel-header,
body[data-theme="light"] .contract-shell .vt thead tr {
  background: rgba(148, 163, 184, 0.08);
}

body[data-theme="light"] .contract-shell .vt td {
  color: #1e293b;
  border-bottom-color: rgba(100, 116, 139, 0.15);
}

body[data-theme="light"] .contract-shell .vt th {
  color: #475569;
  border-bottom-color: rgba(100, 116, 139, 0.25);
}

body[data-theme="light"] .contract-shell .vt tr.ct-section-head td {
  background: rgba(14, 116, 144, 0.1);
  color: #0369a1;
  border-color: rgba(14, 116, 144, 0.2);
}

body[data-theme="light"] .contract-shell .date-sep,
body[data-theme="light"] .contract-shell .sl::after,
body[data-theme="light"] .contract-shell .footer {
  border-color: rgba(148, 163, 184, 0.28);
}

body[data-theme="light"] .spares-summary-card {
  background: #f0f5fb;
  color: #334155;
}

body[data-theme="light"] .spares-summary-card strong {
  color: #0f172a;
}

body[data-theme="light"] .link-cell,
body[data-theme="light"] .history-year-label,
body[data-theme="light"] .info,
body[data-theme="light"] #selectedVesselLabel {
  color: #0f5fa8;
}

body[data-theme="light"] .info {
  background: rgba(15, 95, 168, 0.12);
}

body[data-theme="light"] .status-select-ok {
  background: rgba(21, 128, 61, 0.12) !important;
  color: #15803d !important;
}
body[data-theme="light"] .status-select-danger {
  background: rgba(185, 28, 28, 0.10) !important;
  color: #b91c1c !important;
}
body[data-theme="light"] .status-select-info {
  background: rgba(71, 85, 105, 0.10) !important;
  color: #475569 !important;
}

body[data-theme="light"] .comment-cell-wrap::after {
  color: rgba(30, 60, 110, 0.35);
}

body[data-theme="light"] .comment-cell:hover {
  border-color: rgba(100, 116, 139, 0.45);
}

/* ── Microsoft Login ─────────────────────────────────────────────────── */
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 4px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.btn-ms-login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  background: #2a2d3a;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
  box-sizing: border-box;
}
.btn-ms-login:hover {
  background: #353849;
  border-color: rgba(255,255,255,0.22);
  color: #fff;
}

body[data-theme="light"] .btn-ms-login {
  background: #f1f5fb;
  border-color: #c9d6e6;
  color: #122033;
}
body[data-theme="light"] .btn-ms-login:hover {
  background: #e4edf8;
}

/* ── Allowed Users Modal ─────────────────────────────────────────────── */
.allowed-users-card {
  width: min(460px, 92vw);
  max-height: 80vh;
  overflow-y: auto;
  padding: 0;
}

.allowed-users-body {
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.allowed-users-add-row {
  display: flex;
  gap: 8px;
}
.allowed-users-add-row .gh-input {
  flex: 1;
}
.allowed-users-add-row button {
  background: rgba(56,189,248,0.12);
  border: 1px solid rgba(56,189,248,0.3);
  color: var(--blue);
  border-radius: 6px;
  padding: 7px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.allowed-users-add-row button:hover { background: rgba(56,189,248,0.2); }

.allowed-users-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 40px;
}

.allowed-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  font-size: 13px;
  font-family: "IBM Plex Mono", monospace;
}

body[data-theme="light"] .allowed-user-row {
  background: rgba(0,0,0,0.03);
}

.allowed-user-email { color: var(--text); flex: 1; word-break: break-all; }

.allowed-user-delete {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.allowed-user-delete:hover { color: #ef4444; background: rgba(239,68,68,0.1); }

.allowed-users-empty {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding: 20px 0;
  font-style: italic;
}

/* ── GitHub Publish Buttons ──────────────────────────────────────────── */
.btn-publish {
  background: #16a34a;
  color: #fff;
  border: 1px solid #15803d;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: background 0.15s;
}
.btn-publish:hover { background: #15803d; }
.btn-publish:disabled {
  background: #4d7a5a;
  cursor: default;
  opacity: 0.7;
}

.btn-gh-settings {
  background: rgba(255,255,255,0.06);
  color: #94a3b8;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-gh-settings:hover { background: rgba(255,255,255,0.1); color: #e2e8f0; }

body[data-theme="light"] .btn-gh-settings {
  background: rgba(0,0,0,0.05);
  color: #475569;
  border-color: rgba(0,0,0,0.12);
}
body[data-theme="light"] .btn-gh-settings:hover { background: rgba(0,0,0,0.09); }

/* ── GitHub Settings Modal Card ──────────────────────────────────────── */
.gh-settings-card {
  width: min(540px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  padding: 0;
}

.gh-settings-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gh-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.gh-input {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  padding: 8px 12px;
  font-family: "IBM Plex Mono", monospace;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
  box-sizing: border-box;
}
.gh-input:focus { border-color: var(--blue); }

body[data-theme="light"] .gh-input {
  background: #fff;
  border-color: #c9d6e6;
  color: #122033;
}

.gh-hint {
  font-size: 11px;
  color: var(--muted);
  opacity: 0.7;
  line-height: 1.5;
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
}

.gh-test-btn {
  align-self: flex-start;
  background: rgba(56,189,248,0.1);
  border: 1px solid rgba(56,189,248,0.3);
  color: var(--blue);
  border-radius: 6px;
  padding: 7px 16px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.gh-test-btn:hover { background: rgba(56,189,248,0.18); }

.gh-test-result {
  min-height: 0;
  font-size: 12px;
  font-family: "IBM Plex Mono", monospace;
  border-radius: 6px;
  padding: 0;
  transition: all 0.2s;
  word-break: break-all;
  line-height: 1.6;
}
.gh-test-result.gh-ok  { color: #22c55e; padding: 8px 12px; background: rgba(34,197,94,0.08); border: 1px solid rgba(34,197,94,0.25); }
.gh-test-result.gh-err { color: #ef4444; padding: 8px 12px; background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.25); }

/* ── Publish Toast ───────────────────────────────────────────────────── */
.publish-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  border: 1px solid rgba(255,255,255,0.12);
  color: #e2e8f0;
  border-radius: 10px;
  padding: 12px 22px;
  font-size: 13px;
  font-family: "IBM Plex Mono", monospace;
  z-index: 99999;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  pointer-events: none;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 0.4s;
}
.publish-toast.hidden { display: none; }
.publish-toast.toast-ok  { border-color: rgba(34,197,94,0.4);  color: #86efac; }
.publish-toast.toast-err { border-color: rgba(239,68,68,0.4);  color: #fca5a5; }

body[data-theme="light"] .comment-cell:focus {
  border-color: rgba(37, 99, 235, 0.5);
}

body[data-theme="light"] th,
body[data-theme="light"] td {
  border-bottom-color: rgba(100, 116, 139, 0.26);
}

body[data-theme="light"] th {
  border-bottom-color: rgba(100, 116, 139, 0.34);
}

body[data-theme="light"] .table-wrap {
  background: rgba(255, 255, 255, 0.92);
}

body[data-theme="light"] .procurement-history-row td {
  background: rgba(255, 255, 255, 0.6);
}

body[data-theme="light"] .history-year {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border-color: rgba(100, 116, 139, 0.24);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.85), 0 6px 18px rgba(148, 163, 184, 0.10);
}

body[data-theme="light"] .history-year::after {
    background: linear-gradient(transparent, rgba(248, 251, 255, 0.95));
    color: rgba(20, 60, 110, 0.28);
}

body[data-theme="light"] .history-year:hover::after {
    color: rgba(20, 60, 110, 0.65);
}

body[data-theme="light"] .history-year-text,
body[data-theme="light"] .history-year-input {
    color: #122033;
}

body[data-theme="light"] .history-year-input::placeholder {
    color: #7b8798;
}

body[data-theme="light"] .history-spent-pill {
  background: rgba(11, 92, 173, 0.12);
  border-color: rgba(11, 92, 173, 0.28);
  color: #0b5cad;
}

body[data-theme="light"] .danger {
  background: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
  border: 1px solid rgba(220, 38, 38, 0.22);
}

body[data-theme="light"] .kpi-alert-item {
  background: rgba(254, 226, 226, 0.9);
  border-color: rgba(220, 38, 38, 0.28);
  color: #991b1b;
}

body[data-theme="light"] .kpi-alert-list {
  scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

body[data-theme="light"] .kpi-alert-list::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
}

body[data-theme="light"] .price-list-wrap table,
body[data-theme="light"] .price-list-wrap th,
body[data-theme="light"] .price-list-wrap td {
  border-color: rgba(100, 116, 139, 0.3);
}

body[data-theme="light"] .contract-shell .mv-cyan,
body[data-theme="light"] .contract-shell .tag-nsql,
body[data-theme="light"] .contract-shell .dn,
body[data-theme="light"] .contract-shell .st,
body[data-theme="light"] .contract-shell .ibox strong {
  color: #0b5cad;
}

body[data-theme="light"] .contract-shell .contract-badge,
body[data-theme="light"] .contract-shell .tag-nsql {
  border-color: rgba(11, 92, 173, 0.28);
}

body[data-theme="light"] .contract-shell .st::after,
body[data-theme="light"] .contract-shell .ibox {
  border-color: rgba(11, 92, 173, 0.22);
}

body[data-theme="light"] .contract-shell .si,
body[data-theme="light"] .contract-shell .tc,
body[data-theme="light"] .contract-shell .cc,
body[data-theme="light"] .contract-shell .di,
body[data-theme="light"] .contract-shell .nbox,
body[data-theme="light"] .contract-shell .wbox,
body[data-theme="light"] .contract-shell .ibox {
  color: #1e293b;
}

body[data-theme="light"] .contract-shell .si *,
body[data-theme="light"] .contract-shell .tc *,
body[data-theme="light"] .contract-shell .cc *,
body[data-theme="light"] .contract-shell .di * {
  color: inherit;
}

body[data-theme="light"] .contract-shell .si::before {
  color: #0b5cad;
}

body[data-theme="light"] .contract-shell .si,
body[data-theme="light"] .contract-shell .tc,
body[data-theme="light"] .contract-shell .cc {
  border-color: rgba(71, 85, 105, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.modal-header h2 {
  margin: 4px 0;
  font-size: 22px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.modal-table-wrap {
  max-height: calc(100vh - 180px);
  background: #ffffff;
  box-sizing: border-box;
  padding-bottom: 28px;
}

.admin-log-table th:nth-child(1),
.admin-log-table td:nth-child(1) {
  min-width: 170px;
}

.admin-log-table th:nth-child(2),
.admin-log-table td:nth-child(2) {
  min-width: 70px;
}

.admin-log-table th:nth-child(3),
.admin-log-table td:nth-child(3) {
  min-width: 120px;
}

.admin-log-table th:nth-child(4),
.admin-log-table td:nth-child(4) {
  min-width: 140px;
}

.admin-log-table th:nth-child(5),
.admin-log-table td:nth-child(5) {
  min-width: 280px;
  white-space: normal;
}

/* ── DGS Search input ─────────────────────────────── */
.dgs-search-input {
  height: 34px;
  padding: 0 12px;
  border: 1.5px solid #93c5fd;
  border-radius: 8px;
  background: #f0f7ff;
  color: #0f172a;
  font-size: 13px;
  width: 220px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.dgs-search-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
  background: #ffffff;
}
.dgs-search-input::placeholder {
  color: #94a3b8;
}

/* ── DGS Print / PDF export ────────────────────────── */
@media print {
  body.dgs-print-mode > * { display: none !important; }

  body.dgs-print-mode #dgsTrackerModal {
    display: block !important;
    position: static !important;
    inset: auto !important;
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    width: 100% !important;
  }

  body.dgs-print-mode .dgs-tracker-modal-card {
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    border: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
    display: block !important;
  }

  body.dgs-print-mode .modal-actions,
  body.dgs-print-mode .dgs-section-actions,
  body.dgs-print-mode .dgs-section-note,
  body.dgs-print-mode .dgs-search-input,
  body.dgs-print-mode .dgs-del-col,
  body.dgs-print-mode .dgs-add-row-btn,
  body.dgs-print-mode .dgs-del-row-btn { display: none !important; }

  /* hide the empty group-header th that corresponds to the delete column
     (it lacks dgs-del-col class so the rule above doesn't catch it) */
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table thead tr:first-child th:last-child,
  body.dgs-print-mode .dgs-section-refurbished .dgs-inventory-table thead tr:first-child th:last-child {
    display: none !important;
  }

  body.dgs-print-mode .dgs-date-bar {
    background: none !important;
    border: none !important;
    padding: 4px 0 8px !important;
    font-weight: 600 !important;
  }

  body.dgs-print-mode .dgs-date-bar-input {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    font-weight: 700 !important;
    font-size: 12px !important;
    color: #0f172a !important;
  }

  body.dgs-print-mode .modal-header {
    padding-bottom: 6px !important;
  }

  body.dgs-print-mode .dgs-tracker-modal-card .table-wrap.modal-table-wrap,
  body.dgs-print-mode .dgs-table-wrap {
    overflow: visible !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    flex: none !important;
  }

  body.dgs-print-mode #dgsTrackerContent {
    overflow: visible !important;
    display: block !important;
  }

  body.dgs-print-mode .dgs-content-major {
    display: block !important;
    gap: 0 !important;
  }

  body.dgs-print-mode .dgs-section {
    margin-top: 14px !important;
    break-inside: avoid;
    page-break-inside: avoid;
    border-radius: 0 !important;
  }

  body.dgs-print-mode .dgs-section-header { margin-bottom: 6px !important; }

  body.dgs-print-mode .dgs-inventory-table {
    font-size: 7.5px !important;
    table-layout: auto !important;
    min-width: 0 !important;
  }

  body.dgs-print-mode .dgs-inventory-table th,
  body.dgs-print-mode .dgs-inventory-table td {
    padding: 3px 4px !important;
    position: static !important;
    white-space: normal !important;
  }

  body.dgs-print-mode .dgs-inventory-table .table-input {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    font-size: inherit !important;
    width: auto !important;
    min-width: 0 !important;
    color: inherit !important;
  }

  body.dgs-print-mode .dgs-group-nakilat {
    background: #f5c518 !important;
    color: #1a1a00 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body.dgs-print-mode .dgs-group-eb {
    background: #1565c0 !important;
    color: #ffffff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body.dgs-print-mode .dgs-section-refurbished .dgs-inventory-table th {
    background: #cfe4fb !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table th {
    background: #fde7b0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Stock cards — keep visible, compact */
  body.dgs-print-mode .dgs-stock-cards { display: flex !important; gap: 6px !important; }
  body.dgs-print-mode .dgs-stock-card {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 2px 7px !important;
    border-radius: 4px !important;
    font-size: 8px !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  body.dgs-print-mode .dgs-stock-warm {
    background: #c07355 !important;
    color: #fff8f5 !important;
  }
  body.dgs-print-mode .dgs-stock-cold {
    background: #3f6f92 !important;
    color: #f0f6fb !important;
  }
  body.dgs-print-mode .dgs-stock-card .dgs-stock-count { font-size: 10px !important; font-weight: 700 !important; }
  body.dgs-print-mode .dgs-stock-card .dgs-stock-label { font-size: 7px !important; }

  /* Years alert and vacuum alert — preserve highlights in PDF/print export */
  body.dgs-print-mode .dgs-section-refurbished .dgs-inventory-table tbody tr.dgs-refurbished-row td.dgs-vacuum-alert {
    background: #fef9c3 !important;
    color: #854d0e !important;
    font-weight: 600;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  body.dgs-print-mode .dgs-section-refurbished .dgs-inventory-table tbody tr.dgs-color-row.dgs-refurbished-row td.dgs-years-alert {
    background: #ffd6d6 !important;
    color: #9f1239 !important;
    font-weight: 700;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* QTY column narrow in print */
  body.dgs-print-mode .dgs-section-refurbished .dgs-inventory-table th:nth-child(5),
  body.dgs-print-mode .dgs-section-refurbished .dgs-inventory-table td:nth-child(5) {
    width: 24px !important;
    min-width: 0 !important;
    max-width: 28px !important;
  }
  body.dgs-print-mode .dgs-section-refurbished .dgs-inventory-table td:nth-child(5) .table-input {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* ── Warehouse table — fixed column layout in print ─── */
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table {
    table-layout: fixed !important;
    width: 100% !important;
  }
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table th,
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table td {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table th:nth-child(1),
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table td:nth-child(1)  { width: 6% !important; }   /* TYPE */
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table th:nth-child(2),
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table td:nth-child(2)  { width: 7% !important; }   /* S/N NO. */
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table th:nth-child(3),
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table td:nth-child(3)  { width: 8% !important; }   /* PART NUMBER */
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table th:nth-child(4),
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table td:nth-child(4)  { width: 3% !important; }   /* QTY */
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table th:nth-child(5),
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table td:nth-child(5)  { width: 10% !important; }  /* MLA */
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table th:nth-child(6),
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table td:nth-child(6)  { width: 8% !important; }   /* LANDED VESSEL */
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table th:nth-child(7),
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table td:nth-child(7)  { width: 7% !important; }   /* DATE OF LANDING */
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table th:nth-child(8),
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table td:nth-child(8)  { width: 5% !important; }   /* OWNER */
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table th:nth-child(9),
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table td:nth-child(9)  { width: 4% !important; }   /* BOX No */
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table th:nth-child(10),
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table td:nth-child(10) { width: 6% !important; }   /* Seal Sr No */
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table th:nth-child(11),
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table td:nth-child(11) { width: 6% !important; }   /* EB DWG NO */
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table th:nth-child(12),
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table td:nth-child(12) { width: 18% !important; }  /* EB Remarks */
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table th:nth-child(13),
  body.dgs-print-mode .dgs-section-warehouse .dgs-inventory-table td:nth-child(13) { width: 12% !important; }  /* Next Action */

  /* QTY=0 red highlight — preserve in print/PDF */
  body.dgs-print-mode .dgs-inventory-table tbody tr .table-input.qty-zero {
    background: #f5c6c6 !important;
    color: #7a3a3a !important;
    border-color: #c0392b !important;
    font-weight: 600;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

@media print {
  @page {
    size: A4;
    margin: 12mm;
  }

  html,
  body {
    background: #ffffff !important;
    color: #111827 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.contract-print-mode > * {
    display: none !important;
  }

  body.contract-print-mode #contractModal {
    display: block !important;
  }

  body.contract-print-mode #contractModal {
    position: static !important;
    inset: auto !important;
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  body.contract-print-mode .contract-modal-card {
    width: 100% !important;
    max-width: none !important;
    max-height: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #ffffff !important;
    color: #111827 !important;
    overflow: visible !important;
    padding: 0 !important;
    gap: 0 !important;
  }

  body.contract-print-mode .contract-modal-header,
  body.contract-print-mode .modal-actions,
  body.contract-print-mode .detail-kicker,
  body.contract-print-mode #contractModalTitle,
  body.contract-print-mode #contractModalNote {
    display: none !important;
  }

  body.contract-print-mode .contract-viewer {
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #ffffff !important;
  }

  body.contract-print-mode .contract-shell {
    display: none !important;
    background: #ffffff !important;
    color: #111827 !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 11px !important;
    line-height: 1.35 !important;
  }

  body.contract-print-mode .contract-shell:not(.contract-document-hidden) {
    display: block !important;
  }

  body.contract-print-mode .contract-shell .header {
    gap: 18px !important;
    margin-bottom: 18px !important;
    padding-bottom: 14px !important;
    align-items: stretch !important;
  }

  body.contract-print-mode .contract-shell h1 {
    font-size: 24px !important;
    line-height: 1.05 !important;
    margin-bottom: 4px !important;
  }

  body.contract-print-mode .contract-shell .header-dept {
    font-size: 10px !important;
    line-height: 1.45 !important;
    margin-top: 6px !important;
  }

  body.contract-print-mode .contract-shell .status-box {
    min-width: 190px !important;
    padding: 12px 14px !important;
  }

  body.contract-print-mode .contract-shell .date-row {
    margin-bottom: 6px !important;
  }

  body.contract-print-mode .contract-shell .price-big {
    font-size: 22px !important;
  }

  body.contract-print-mode .contract-shell .metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin-bottom: 14px !important;
  }

  body.contract-print-mode .contract-shell .metric {
    padding: 10px 12px !important;
  }

  body.contract-print-mode .contract-shell .metric-label,
  body.contract-print-mode .contract-shell .tcl,
  body.contract-print-mode .contract-shell .cn,
  body.contract-print-mode .contract-shell .kk,
  body.contract-print-mode .contract-shell .date-lbl {
    font-size: 8.5px !important;
  }

  body.contract-print-mode .contract-shell .metric-value {
    font-size: 13px !important;
    line-height: 1.15 !important;
  }

  body.contract-print-mode .contract-shell .metric-sub,
  body.contract-print-mode .contract-shell .dnote,
  body.contract-print-mode .contract-shell .cb,
  body.contract-print-mode .contract-shell .wcd {
    font-size: 9px !important;
    line-height: 1.35 !important;
  }

  body.contract-print-mode .contract-shell .panel-full {
    margin-bottom: 10px !important;
  }

  body.contract-print-mode .contract-shell .panel-header {
    padding: 8px 10px !important;
  }

  body.contract-print-mode .contract-shell .panel-title {
    font-size: 9px !important;
  }

  body.contract-print-mode .contract-shell .panel-body {
    padding: 10px !important;
  }

  body.contract-print-mode .contract-shell .g2,
  body.contract-print-mode .contract-shell .sg,
  body.contract-print-mode .contract-shell .tcg,
  body.contract-print-mode .contract-shell .cg {
    gap: 8px !important;
  }

  body.contract-print-mode .contract-shell .wr {
    gap: 8px !important;
  }

  body.contract-print-mode .contract-shell .kv {
    gap: 10px !important;
    padding: 5px 0 !important;
  }

  body.contract-print-mode .contract-shell .kv-v,
  body.contract-print-mode .contract-shell .tcv,
  body.contract-print-mode .contract-shell .ct,
  body.contract-print-mode .contract-shell .dname {
    font-size: 10px !important;
    line-height: 1.35 !important;
  }

  body.contract-print-mode .contract-shell .sl {
    margin: 12px 0 6px !important;
    font-size: 8.5px !important;
  }

  body.contract-print-mode .contract-shell .tc,
  body.contract-print-mode .contract-shell .cc,
  body.contract-print-mode .contract-shell .si,
  body.contract-print-mode .contract-shell .di,
  body.contract-print-mode .contract-shell .wc,
  body.contract-print-mode .contract-shell .nbox,
  body.contract-print-mode .contract-shell .wbox,
  body.contract-print-mode .contract-shell .ibox {
    padding: 8px 10px !important;
  }

  body.contract-print-mode .contract-shell .escr {
    margin-top: 6px !important;
  }

  body.contract-print-mode .contract-shell .esc {
    padding: 8px 6px !important;
  }

  body.contract-print-mode .contract-shell .er {
    font-size: 14px !important;
  }

  body.contract-print-mode .contract-shell .st {
    margin-bottom: 6px !important;
    font-size: 9px !important;
  }

  body.contract-print-mode .contract-shell .si {
    font-size: 10px !important;
  }

  body.contract-print-mode .contract-shell .wcv {
    font-size: 18px !important;
  }

  body.contract-print-mode .contract-shell .vt {
    font-size: 9px !important;
  }

  body.contract-print-mode .contract-shell .vt th,
  body.contract-print-mode .contract-shell .vt td {
    padding: 5px 6px !important;
  }

  body.contract-print-mode .contract-shell .footer {
    margin-top: 12px !important;
    padding-top: 10px !important;
    font-size: 8.5px !important;
  }

  body.contract-print-mode .contract-shell .panel,
  body.contract-print-mode .contract-shell .metric,
  body.contract-print-mode .contract-shell .status-box,
  body.contract-print-mode .contract-shell .tc,
  body.contract-print-mode .contract-shell .cc,
  body.contract-print-mode .contract-shell .si,
  body.contract-print-mode .contract-shell .di,
  body.contract-print-mode .contract-shell .wc,
  body.contract-print-mode .contract-shell .nbox,
  body.contract-print-mode .contract-shell .wbox,
  body.contract-print-mode .contract-shell .ibox {
    background: #ffffff !important;
    color: #111827 !important;
    border-color: #d1d5db !important;
    break-inside: avoid-page;
  }

  body.contract-print-mode .contract-shell h1,
  body.contract-print-mode .contract-shell .date-val,
  body.contract-print-mode .contract-shell .metric-value,
  body.contract-print-mode .contract-shell .panel-title,
  body.contract-print-mode .contract-shell .kv-v,
  body.contract-print-mode .contract-shell .tcv,
  body.contract-print-mode .contract-shell .ct,
  body.contract-print-mode .contract-shell .dname,
  body.contract-print-mode .contract-shell .vn,
  body.contract-print-mode .contract-shell .price-big,
  body.contract-print-mode .contract-shell .header-dept strong {
    color: #111827 !important;
  }

  body.contract-print-mode .contract-shell .header-dept,
  body.contract-print-mode .contract-shell .metric-label,
  body.contract-print-mode .contract-shell .metric-sub,
  body.contract-print-mode .contract-shell .kk,
  body.contract-print-mode .contract-shell .tcl,
  body.contract-print-mode .contract-shell .cn,
  body.contract-print-mode .contract-shell .cb,
  body.contract-print-mode .contract-shell .dnote,
  body.contract-print-mode .contract-shell .date-lbl,
  body.contract-print-mode .contract-shell .footer,
  body.contract-print-mode .contract-shell .disc {
    color: #4b5563 !important;
  }

  body.contract-print-mode .contract-shell .vt thead tr,
  body.contract-print-mode .contract-shell .panel-header {
    background: #f3f4f6 !important;
  }

  body.contract-print-mode .contract-shell .vt td,
  body.contract-print-mode .contract-shell .vt th,
  body.contract-print-mode .contract-shell .kv,
  body.contract-print-mode .contract-shell .footer,
  body.contract-print-mode .contract-shell .date-sep,
  body.contract-print-mode .contract-shell .sl::after {
    border-color: #d1d5db !important;
  }
}

#dgsTrackerContent {
  display: grid;
  gap: 16px;
  min-width: 0;
  width: 100%;
}

.spares-summary {
  display: grid;
  gap: 10px;
}

.spares-summary-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.spares-summary-card {
  min-width: 112px;
  padding: 7px 11px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 12px;
  background: #e8eef8;
  color: #334155;
  font-size: 13px;
  line-height: 1.2;
}

.spares-summary-card strong {
  color: #0f172a;
  font-size: 22px;
  margin-right: 4px;
}

.spares-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  color: #1e293b;
  font-size: 13px;
  font-weight: 600;
}

.spares-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.spares-legend-chip {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(15, 23, 42, 0.12);
}

.spares-legend-blue {
  background: #1565c0;
}

.spares-legend-yellow {
  background: #b8860b;
}

.spares-legend-green {
  background: #2e7d32;
}

.spares-legend-white {
  background: #9e9e9e;
  border: 1px solid #757575;
}

.spares-table {
  table-layout: fixed;
  margin-bottom: 20px;
}

.spares-bottom-spacer td {
  height: 28px;
  padding: 0;
  border: 0;
  background: #ffffff;
}

.spares-total-row td {
  background: #e2e8f0 !important;
  color: #0f172a;
  font-weight: 700;
}

.spares-total-eur {
  margin-top: 4px;
  font-size: 12px;
  color: #334155;
}

.spares-table th:nth-child(1) {
  width: 36%;
}

.spares-table th:nth-child(2),
.spares-table th:nth-child(3),
.spares-table th:nth-child(4),
.spares-table th:nth-child(5) {
  width: 16%;
}

.spares-table input {
  width: 100%;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.9);
  color: #0f172a;
  border: 1px solid rgba(15, 23, 42, 0.18);
  font-size: 12px;
}

.spares-table th {
  background: #212121;
  color: #ffffff;
  border-color: rgba(0, 0, 0, 0.30);
  font-size: 12px;
  line-height: 1.2;
  padding: 6px 8px;
  white-space: normal;
}

.spares-table td {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.16);
  padding: 4px 8px;
}

.spares-row-blue td {
  background: #1565c0;
  color: #ffffff;
  border-left: 3px solid #0d47a1;
}

.spares-row-yellow td {
  background: #fde047;
  color: #1a1200;
  border-left: 3px solid #eab308;
}

.spares-row-green td {
  background: #2e7d32;
  color: #ffffff;
  border-left: 3px solid #1b5e20;
}

.spares-row-white td {
  background: #f5f5f5;
  color: #1a1a1a;
  border-left: 3px solid #9e9e9e;
}

/* ── Blue row inputs ─────────────────────────────────── */
.spares-row-blue .input-cell,
.spares-row-blue input {
  background-color: #1a237e !important;
  color: #ffffff !important;
  border: 1.5px solid #90caf9 !important;
  border-radius: 4px;
}
.spares-row-blue .input-cell:focus,
.spares-row-blue input:focus {
  border-color: #42a5f5 !important;
  outline: none;
}
.spares-row-blue .input-cell::placeholder,
.spares-row-blue input::placeholder {
  color: rgba(255, 255, 255, 0.60);
}

/* ── Yellow row inputs ───────────────────────────────── */
.spares-row-yellow .input-cell,
.spares-row-yellow input {
  background-color: #fef08a !important;
  color: #1a1200 !important;
  border: 1.5px solid #ca8a04 !important;
  border-radius: 4px;
}
.spares-row-yellow .input-cell:focus,
.spares-row-yellow input:focus {
  border-color: #a16207 !important;
  outline: none;
}
.spares-row-yellow .input-cell::placeholder,
.spares-row-yellow input::placeholder {
  color: rgba(26, 18, 0, 0.45);
}

/* ── Green row inputs ────────────────────────────────── */
.spares-row-green .input-cell,
.spares-row-green input {
  background-color: #1b5e20 !important;
  color: #ffffff !important;
  border: 1.5px solid #a5d6a7 !important;
  border-radius: 4px;
}
.spares-row-green .input-cell:focus,
.spares-row-green input:focus {
  border-color: #66bb6a !important;
  outline: none;
}
.spares-row-green .input-cell::placeholder,
.spares-row-green input::placeholder {
  color: rgba(255, 255, 255, 0.60);
}

/* ── White row inputs ────────────────────────────────── */
.spares-row-white .input-cell,
.spares-row-white input {
  background-color: #ffffff !important;
  color: #212121 !important;
  border: 1.5px solid #757575 !important;
  border-radius: 4px;
}
.spares-row-white .input-cell:focus,
.spares-row-white input:focus {
  border-color: #424242 !important;
  outline: none;
}
.spares-row-white .input-cell::placeholder,
.spares-row-white input::placeholder {
  color: rgba(0, 0, 0, 0.45);
}

.spares-input-match {
  background: #fff7b3 !important;
  border-color: #d97706 !important;
  box-shadow: 0 0 0 1px rgba(217, 119, 6, 0.15);
}

.spares-row-match td {
  box-shadow: inset 0 0 0 9999px rgba(250, 204, 21, 0.08);
}

.spares-low-inventory td {
  box-shadow: inset 0 0 0 9999px rgba(239, 68, 68, 0.08);
}

.spares-low-inventory .spares-inventory-input {
  background: #f5c6c6 !important;
  color: #7a3a3a !important;
  border-color: #000000 !important;
  font-weight: 600;
}
.spares-low-inventory .spares-inventory-input::placeholder {
  color: rgba(255, 255, 255, 0.75);
}

#sparesSearchInput {
  min-width: 240px;
  min-height: 34px;
  background: #ffffff;
  color: #0f172a;
  border: 1px solid rgba(15, 23, 42, 0.18);
}

.selected-vessel {
  color: #3b82f6;
  font-weight: 700;
}

.footer {
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 1100px) {
  .kpi,
  .span-4 {
    grid-column: span 12;
  }

  .detail-grid,
  .detail-columns,
  .history-strip,
  .contract-grid-2,
  .contract-scope-grid,
  .contract-warranty-grid,
  .contract-tc-grid {
    grid-template-columns: 1fr;
  }

  .contract-viewer-header {
    flex-direction: column;
  }

  .contract-escalation {
    grid-template-columns: 1fr;
  }

  .contract-escalation-step {
    border-right: 0;
    border-bottom: 1px solid #1e2430;
  }

  .contract-escalation-step:last-child {
    border-bottom: 0;
  }

  .contract-shell .header,
  .contract-shell .g2,
  .contract-shell .sg,
  .contract-shell .wr,
  .contract-shell .tcg,
  .contract-shell .cg {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .contract-shell .escr {
    flex-direction: column;
  }

  .contract-shell .esc {
    border-left: 1px solid #1e2430 !important;
    border-top: 0;
    border-radius: 0;
  }

  .contract-shell .esc:first-child {
    border-radius: 6px 6px 0 0;
  }

  .contract-shell .esc:last-child {
    border-radius: 0 0 6px 6px;
  }

  .asset-row td {
    display: block;
    width: 100%;
  }

  .section-heading-space,
  .section-actions {
    justify-content: flex-start;
  }

  .modal-table-wrap {
    max-height: calc(100vh - 360px);
  }

  .spares-summary-card {
    min-width: 0;
    flex: 1 1 180px;
  }
}

/* Final Equipment Status colors for both themes/pages. */
.asset-status-table .status-select {
  font-weight: 800;
  border-radius: 9px;
  border-width: 1px;
}

.asset-status-table .status-select-ok {
  background: #dcfce7 !important;
  color: #166534 !important;
  border-color: #86efac !important;
}

.asset-status-table .status-select-danger {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  border-color: #fca5a5 !important;
}

.asset-status-table .status-select-info {
  background: #e0f2fe !important;
  color: #075985 !important;
  border-color: #7dd3fc !important;
}

body:not([data-theme="light"]) .asset-status-table .status-select-ok {
  background: rgba(34, 197, 94, 0.22) !important;
  color: #86efac !important;
  border-color: rgba(34, 197, 94, 0.42) !important;
}

body:not([data-theme="light"]) .asset-status-table .status-select-danger {
  background: rgba(239, 68, 68, 0.24) !important;
  color: #fecaca !important;
  border-color: rgba(239, 68, 68, 0.50) !important;
}

body:not([data-theme="light"]) .asset-status-table .status-select-info {
  background: rgba(14, 165, 233, 0.20) !important;
  color: #bae6fd !important;
  border-color: rgba(14, 165, 233, 0.42) !important;
}

/* ══════════════════════════════════════════════
   MOBILE RESPONSIVE — tablet 768 px, phone 480 px
   ══════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* ── Wrapper ── */
  .wrap {
    padding: 12px;
  }

  /* ── Topbar ── */
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 12px;
  }

  .title h1 {
    font-size: 18px;
    line-height: 1.25;
  }

  .title p {
    font-size: 12px;
    margin-top: 3px;
  }

  /* Actions — horizontal scroll, no wrap */
  .actions {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .actions::-webkit-scrollbar { display: none; }

  .actions > button,
  .actions > a,
  .actions > select,
  .actions > input[type="text"] {
    flex-shrink: 0;
    font-size: 12px;
    padding: 8px 10px;
    min-height: 38px;
    white-space: nowrap;
  }

  /* ── Grid: single column ── */
  .grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .kpi,
  .span-4,
  .span-8,
  .span-12,
  .card {
    grid-column: span 1 !important;
  }

  .card {
    padding: 12px;
    border-radius: 12px;
  }

  /* ── KPI cards ── */
  .kpi-immediate {
    height: auto;
    max-height: none;
  }

  /* ── Filters ── */
  .filters {
    gap: 10px;
  }

  .filter-group {
    min-width: 0;
    width: 100%;
  }

  .filter-group select {
    width: 100%;
  }

  /* ── Section heading ── */
  .section-heading-space {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .section-actions {
    justify-content: flex-start;
    gap: 6px;
  }

  .section-actions button {
    font-size: 12px;
    padding: 7px 10px;
  }

  /* ── Tables: horizontal scroll ── */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    table-layout: auto;
    min-width: 560px;
  }

  /* ── Modals: bottom sheet style ── */
  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }

  .modal-card {
    width: 100%;
    max-height: 92vh;
    border-radius: 18px 18px 0 0;
    padding: 14px;
    overflow-y: auto;
  }

  .contract-modal-card {
    width: 100%;
    max-height: 92vh;
    border-radius: 18px 18px 0 0;
    padding: 14px;
    overflow-y: auto;
  }

  .dgs-tracker-modal-card {
    width: 100%;
    height: 94vh;
    border-radius: 18px 18px 0 0;
  }

  .stock-status-modal-card {
    width: 100%;
    height: 96vh;
    border-radius: 18px 18px 0 0;
  }

  .allowed-users-card,
  .gh-settings-card,
  .equipment-pdf-preview-card,
  .history-text-modal-card {
    width: 100%;
    max-height: 92vh;
    border-radius: 18px 18px 0 0;
    padding: 14px;
    overflow-y: auto;
  }

  /* Modal header: wrap actions below title on tight screens */
  .modal-header {
    gap: 10px;
  }

  .modal-header h2 {
    font-size: 18px;
  }

  .modal-actions {
    gap: 6px;
  }

  .modal-actions button {
    font-size: 12px;
    padding: 7px 10px;
    min-height: 36px;
  }

  .modal-table-wrap {
    max-height: calc(92vh - 140px);
  }

  /* ── Spares modal summary cards ── */
  .spares-summary-strip {
    flex-wrap: wrap;
  }

  .spares-summary-card {
    min-width: 0;
    flex: 1 1 140px;
  }

  /* ── Procurement chip buttons ── */
  .proc-chip {
    font-size: 11px !important;
    padding: 5px 8px 5px 6px !important;
    min-height: 36px;
  }

  /* ── DGS tracker section actions ── */
  .dgs-section-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  /* ── GitHub settings inputs ── */
  .gh-settings-body {
    gap: 10px;
  }

  .gh-input {
    font-size: 14px;
    padding: 10px 12px;
  }

  /* ── Login card ── */
  .login-title-wrap h1 {
    font-size: 20px;
  }

  /* ── Contract viewer ── */
  .contract-shell .header {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .price-list-title .actions {
    flex-wrap: wrap;
  }

  .price-list-title .actions button,
  .price-list-title .actions input {
    flex-shrink: 0;
    font-size: 12px;
    padding: 7px 10px;
  }
}

/* ── Extra small phones ── */
@media (max-width: 480px) {

  .wrap {
    padding: 8px;
  }

  .title h1 {
    font-size: 15px;
  }

  .title p {
    display: none;
  }

  /* One filter per row */
  .filters {
    flex-direction: column;
  }

  /* Buttons: touch-friendly min height */
  button,
  .view-switch-link {
    min-height: 40px;
  }

  .modal-card,
  .contract-modal-card,
  .allowed-users-card,
  .gh-settings-card,
  .history-text-modal-card {
    max-height: 96vh;
    padding: 12px;
  }

  .dgs-tracker-modal-card,
  .stock-status-modal-card {
    height: 98vh;
  }

  /* Asset table: show only key columns */
  .col-last-oh-rh,
  .asset-status-table th:nth-child(4),
  .asset-status-table td:nth-child(4) {
    display: none;
  }

  /* Contracts grid: 1 column */
  .contracts-grid {
    grid-template-columns: 1fr !important;
  }
}
