:root {
  --bg: #0f1720;
  --panel: #17212c;
  --panel-alt: #1e2a37;
  --border: #2a3a48;
  --text: #e6edf3;
  --text-dim: #93a3b3;
  --accent: #2f81f7;
  --accent-dim: #1c4a86;
  --danger: #e5534b;
  --success: #3fb950;
  --warning: #d29922;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

a {
  color: var(--accent);
  text-decoration: none;
}

/* --- Login --- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.login-card h1 {
  margin: 0;
  font-size: 22px;
}
.login-subtitle {
  margin: 0 0 10px;
  color: var(--text-dim);
  font-size: 13px;
}
.login-card label {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 8px;
}
.login-card input {
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text);
  font-size: 14px;
}
.login-card button {
  margin-top: 18px;
  padding: 10px;
  border-radius: 6px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}
.login-card button:hover {
  background: #4a90ff;
}

/* --- App shell --- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  /* dvh = the *visible* height on phones (excludes the browser's address
     bar / toolbar), so the bottom of the sidebar isn't hidden behind it. */
  height: 100dvh;
}
.sidebar-brand {
  height: 73px;
  padding: 0 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-brand span {
  display: block;
  font-weight: 400;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 10px;
  gap: 2px;
  flex: 1;
  /* If the links don't fit (small phone, landscape), scroll them instead of
     pushing the user name / Log out off the bottom of the screen. */
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sidebar-nav a {
  padding: 9px 12px;
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 13.5px;
}
.sidebar-nav a:hover {
  background: var(--panel-alt);
  color: var(--text);
}
.sidebar-nav a.active {
  background: var(--accent-dim);
  color: #fff;
}
.sidebar-footer {
  padding: 14px 18px;
  /* Keep clear of the iPhone home indicator. */
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  font-size: 12px;
  flex-shrink: 0;
}
.sidebar-user {
  color: var(--text-dim);
  margin-bottom: 6px;
}
.logout-link {
  color: var(--danger);
}

.content {
  flex: 1;
  min-width: 0;
}
.content-header {
  height: 73px;
  padding: 0 30px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
}
.content-header h1 {
  margin: 0;
  font-size: 20px;
}
.content-body {
  padding: 26px 30px;
}

.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-right: 10px;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.hamburger-btn:hover {
  background: var(--panel-alt);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
}
.sidebar-backdrop.open {
  display: block;
}

@media (max-width: 768px) {
  .hamburger-btn {
    display: flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-nav a {
    padding: 11px 12px; /* bigger tap targets */
  }
  .logout-link {
    display: inline-block;
    padding: 6px 0;
  }

  .content-header {
    padding: 0 16px;
  }
  .content-body {
    padding: 16px;
  }
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.btn:hover {
  border-color: var(--accent);
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: #4a90ff;
}
.btn-danger {
  color: var(--danger);
}
.btn-danger:hover {
  border-color: var(--danger);
}
.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}
.btn-big {
  padding: 14px 22px;
  font-size: 15px;
  font-weight: 600;
}

/* --- Simple/advanced split (e.g. Paris MoU Sync page) --- */
.pm-simple-card h2 {
  font-size: 17px;
}
.pm-advanced {
  margin-bottom: 20px;
}
.pm-advanced summary {
  cursor: pointer;
  color: var(--text-dim);
  font-size: 13px;
  padding: 10px 4px;
  user-select: none;
}
.pm-advanced summary:hover {
  color: var(--text);
}
.pm-advanced[open] summary {
  margin-bottom: 4px;
}

/* --- Tables --- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
th,
td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th {
  background: var(--panel-alt);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}
td.wrap {
  white-space: normal;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.toolbar-actions {
  display: flex;
  gap: 8px;
}

/* --- Badges --- */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.badge-low {
  background: rgba(63, 185, 80, 0.15);
  color: var(--success);
}
.badge-standard {
  background: rgba(210, 153, 34, 0.15);
  color: var(--warning);
}
.badge-high {
  background: rgba(229, 83, 75, 0.15);
  color: var(--danger);
}
.badge-perf-high {
  background: rgba(63, 185, 80, 0.15);
  color: var(--success);
}
.badge-perf-medium {
  background: rgba(210, 153, 34, 0.15);
  color: var(--warning);
}
.badge-perf-low {
  background: rgba(229, 83, 75, 0.15);
  color: var(--danger);
}
.badge-perf-very_low {
  background: rgba(229, 83, 75, 0.3);
  color: var(--danger);
}
.badge-source-manual {
  background: rgba(139, 148, 158, 0.15);
  color: var(--text-dim);
}
.badge-source-parismou {
  background: rgba(88, 166, 255, 0.15);
  color: #58a6ff;
}

.pm-output {
  background: var(--bg);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  max-height: 480px;
  overflow: auto;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 12px;
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 20px;
  overflow-y: auto;
  z-index: 100;
}
.modal-overlay-lg {
  padding: 4vh 12px;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  padding: 24px;
}
.modal.modal-lg {
  max-width: 98vw;
  width: 98vw;
}
.modal h2 {
  margin: 0 0 16px;
  font-size: 17px;
}
.modal .field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}
.modal label {
  font-size: 12px;
  color: var(--text-dim);
}
.modal input,
.modal select,
.modal textarea {
  padding: 9px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* --- Alerts / toasts --- */
.alert {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 14px;
}
.alert-error {
  background: rgba(229, 83, 75, 0.12);
  color: #ff8a80;
  border: 1px solid rgba(229, 83, 75, 0.3);
}
.alert-success {
  background: rgba(63, 185, 80, 0.12);
  color: #7ee787;
  border: 1px solid rgba(63, 185, 80, 0.3);
}
.alert-warning {
  background: rgba(210, 153, 34, 0.12);
  color: #e3b341;
  border: 1px solid rgba(210, 153, 34, 0.3);
}
.alert-info {
  background: rgba(47, 129, 247, 0.1);
  color: #9ecbff;
  border: 1px solid rgba(47, 129, 247, 0.35);
  line-height: 1.6;
}
.alert-info strong {
  color: var(--text);
}
.match-banner .btn {
  margin-left: 6px;
}

#toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}
.toast {
  padding: 10px 16px;
  border-radius: 6px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  font-size: 13px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}
.toast.error {
  border-color: var(--danger);
  color: #ff8a80;
}
.toast.success {
  border-color: var(--success);
  color: #7ee787;
}

/* --- Forms (non-modal, e.g. entry/filter panels) --- */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.panel h2 {
  margin: 0 0 14px;
  font-size: 15px;
}
.panel h3 {
  margin: 18px 0 10px;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-dim);
}
.panel h3:first-child {
  margin-top: 0;
}
.form-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 180px;
}
.form-field label {
  font-size: 12px;
  color: var(--text-dim);
}
.form-field input,
.form-field select,
.form-field textarea {
  padding: 9px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
}
.form-field textarea {
  resize: vertical;
  min-height: 50px;
}
.helptext {
  font-size: 11.5px;
  color: var(--text-dim);
}
.imo-search {
  min-width: 0;
  position: relative;
}
.imo-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  z-index: 30;
  max-height: 240px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.imo-search-result {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.imo-search-result:hover,
.imo-search-result:focus-visible {
  background: var(--accent-dim);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* --- Deficiency review table --- */
.def-table td,
.def-table th {
  white-space: normal;
}
.def-table input,
.def-table select,
.def-table textarea {
  width: 100%;
  padding: 6px 8px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text);
  font-size: 12.5px;
  font-family: inherit;
}
.def-table textarea {
  min-height: 84px;
}
.checkbox-cell {
  text-align: center;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 34px;
  text-align: center;
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.15s;
}
.dropzone.dragover {
  border-color: var(--accent);
  color: var(--text);
}

/* --- Report mode toggle + stat --- */
.report-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}
.report-mode-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
}
.report-mode-label {
  font-size: 13px;
  color: var(--text-dim);
  transition: color 0.15s;
}
.report-mode-label.active {
  color: var(--text);
  font-weight: 600;
}
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: background 0.15s ease;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 2px;
  top: 2px;
  background: var(--text-dim);
  border-radius: 50%;
  transition:
    transform 0.15s ease,
    background 0.15s ease;
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--accent-dim);
  border-color: var(--accent);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: var(--accent);
}
.report-stat {
  text-align: right;
}
.report-stat-number {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.1;
}
.report-stat-label {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* --- Analytics bars --- */
.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
}
.bar-label {
  width: 260px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-track {
  flex: 1;
  background: var(--panel-alt);
  border-radius: 4px;
  height: 18px;
  overflow: hidden;
}
.bar-fill {
  background: var(--accent);
  height: 100%;
}
.bar-count {
  width: 36px;
  text-align: right;
  color: var(--text-dim);
  flex-shrink: 0;
}
.bar-avg {
  width: 88px;
  text-align: right;
  color: var(--text-dim);
  font-size: 11.5px;
  flex-shrink: 0;
}

.empty-state {
  color: var(--text-dim);
  padding: 30px;
  text-align: center;
  font-size: 13.5px;
}

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.tabs button {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 10px 4px;
  margin-right: 18px;
  cursor: pointer;
  font-size: 13.5px;
  border-bottom: 2px solid transparent;
}
.tabs button.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* --- Role picker (Admins page) --- */
.badge-role-admin {
  background: rgba(47, 129, 247, 0.18);
  color: #58a6ff;
}
.badge-role-user {
  background: rgba(139, 148, 158, 0.15);
  color: var(--text-dim);
}
.role-select-wrap {
  position: relative;
  display: inline-block;
}
.role-select-wrap::after {
  content: "";
  position: absolute;
  right: 11px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -5px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  pointer-events: none;
  color: var(--text-dim);
}
.role-select {
  appearance: none;
  -webkit-appearance: none;
  min-width: 104px;
  padding: 5px 30px 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.role-select:hover {
  border-color: var(--accent);
}
.role-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.role-select.role-admin {
  background: rgba(47, 129, 247, 0.15);
  border-color: rgba(47, 129, 247, 0.45);
  color: #58a6ff;
}
.role-select.role-user {
  color: var(--text-dim);
}
.role-select option {
  background: var(--panel);
  color: var(--text);
}

/* --- Help page --- */
.help-page {
  max-width: 820px;
  line-height: 1.6;
}
.help-page .help-lang {
  display: none;
}
.help-page[data-lang="en"] [data-lang-block="en"],
.help-page[data-lang="bg"] [data-lang-block="bg"] {
  display: block;
}
.help-lang-switch {
  display: inline-flex;
  padding: 3px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
}
.help-lang-btn {
  padding: 6px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.help-lang-btn:hover {
  color: var(--text);
}
.help-lang-btn[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
}
.help-toc {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
}
.help-toc-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.help-toc ol {
  margin: 0;
  padding-left: 20px;
  columns: 2;
  column-gap: 32px;
}
.help-toc li {
  break-inside: avoid;
  padding: 2px 0;
}
.help-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 16px;
  scroll-margin-top: 16px;
}
.help-section h2 {
  margin: 0 0 10px;
  font-size: 17px;
}
.help-section p {
  margin: 0 0 10px;
}
.help-section ul,
.help-section ol {
  margin: 0 0 10px;
  padding-left: 22px;
}
.help-section li {
  margin-bottom: 6px;
}
.help-section > :last-child {
  margin-bottom: 0;
}
.help-tip {
  background: rgba(47, 129, 247, 0.08);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 8px 12px;
}
.kbd {
  display: inline-block;
  min-width: 20px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel-alt);
  font-size: 12px;
  text-align: center;
}
.help-glossary {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 18px;
  margin: 0;
}
.help-glossary dt {
  font-weight: 600;
}
.help-glossary dd {
  margin: 0;
  color: var(--text-dim);
}
@media (max-width: 768px) {
  .help-toc ol {
    columns: 1;
  }
  .help-section {
    padding: 14px 16px;
  }
  .help-glossary {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .help-glossary dd {
    margin-bottom: 8px;
  }
}

/* --- Stop iOS auto-zoom on input focus ---
   iPhone Safari zooms the page in whenever you tap a field whose text is
   smaller than 16px. Making form fields 16px on small screens stops that,
   while still letting people pinch-zoom if they want to. !important because
   several components (.modal, .form-field, .def-table, login…) set their
   own smaller sizes with more specific selectors. */
@media (max-width: 768px), (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* --- Inspection priority (Risk Profile page) --- */
:root {
  --priority-1: #f0605a;
  --priority-2: #f0883e;
}
.badge-priority-1 {
  background: rgba(240, 96, 90, 0.2);
  color: var(--priority-1);
}
.badge-priority-2 {
  background: rgba(240, 136, 62, 0.2);
  color: var(--priority-2);
}
.badge-priority-none {
  background: rgba(139, 148, 158, 0.12);
  color: var(--text-dim);
}
tr.row-priority-1 {
  background: rgba(240, 96, 90, 0.09);
  box-shadow: inset 3px 0 0 var(--priority-1);
}
tr.row-priority-1:hover {
  background: rgba(240, 96, 90, 0.14);
}
tr.row-priority-2 {
  background: rgba(240, 136, 62, 0.08);
  box-shadow: inset 3px 0 0 var(--priority-2);
}
tr.row-priority-2:hover {
  background: rgba(240, 136, 62, 0.13);
}
.cell-sub {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 2px;
}
.dim {
  color: var(--text-dim);
}
.next-change {
  font-weight: 600;
}
.next-change-soon {
  color: var(--priority-2);
}
.next-change-overdue {
  color: var(--priority-1);
}

.priority-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 10px;
}
.priority-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 14px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.priority-chip:hover {
  border-color: var(--text-dim);
}
.priority-chip.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.priority-chip-count {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.priority-chip-label {
  color: var(--text-dim);
}
.chip-priority-1 .priority-chip-count {
  color: var(--priority-1);
}
.chip-priority-2 .priority-chip-count {
  color: var(--priority-2);
}
.chip-soon .priority-chip-count {
  color: var(--warning);
}
.priority-legend {
  margin-bottom: 12px;
}

.window-cell {
  min-width: 190px;
}
.window-bar {
  position: relative;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.window-bar-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  background: rgba(240, 136, 62, 0.28);
}
.window-bar-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  background: rgba(63, 185, 80, 0.55);
}
.window-window_open .window-bar-fill {
  background: rgba(240, 136, 62, 0.75);
}
.window-overdue .window-bar-fill,
.window-bar-none {
  background: rgba(240, 96, 90, 0.7);
}
.window-bar-now {
  position: absolute;
  top: -1px;
  bottom: -1px;
  width: 2px;
  margin-left: -1px;
  background: var(--text);
}
.window-overdue .window-bar-now {
  display: none;
}

th.sortable {
  cursor: pointer;
  user-select: none;
}
th.sortable:hover {
  color: var(--text);
}
th.sortable::after {
  content: '';
  display: inline-block;
  width: 1em;
  margin-left: 2px;
}
th.sorted-asc::after {
  content: '▲';
  font-size: 9px;
}
th.sorted-desc::after {
  content: '▼';
  font-size: 9px;
}

/* --- Companies page: ship names in the list, search highlighting --- */
.company-ships {
  min-width: 220px;
  max-width: 480px;
  font-size: 13px;
}
mark {
  background: rgba(47, 129, 247, 0.35);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* --- Company fleet data (Companies page, Risk Profile page) --- */
.badge-fleet {
  background: rgba(88, 166, 255, 0.15);
  color: #58a6ff;
}
.badge-fleet-pending {
  background: rgba(240, 136, 62, 0.18);
  color: #f0883e;
}
.badge-fleet-none {
  background: rgba(139, 148, 158, 0.12);
  color: var(--text-dim);
}
.fleet-status {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-dim);
}
.fleet-status-text {
  flex: 1;
  min-width: 260px;
}
.fleet-warn {
  color: #f0883e;
}
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -2px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Filter bar (Ships, Companies, Ports, Risk Profile) --- */
.filter-bar {
  margin-bottom: 14px;
}
.filter-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: flex-end;
}
.filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 1 170px;
  min-width: 130px;
  font-size: 11.5px;
  color: var(--text-dim);
}
.filter-field-search {
  flex: 2 1 260px;
}
.filter-field input,
.filter-field select {
  padding: 7px 9px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  min-width: 0;
  width: 100%;
}
.filter-field .filter-on {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.filter-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--text-dim);
  min-height: 28px;
}
/* .btn sets display, which would otherwise override the hidden attribute */
.filter-summary [hidden] {
  display: none;
}
