/* SlomoPlan — Light Premium UMA-inspired Theme */

:root {
  --uma-bg: #f5f0e6;
  --uma-bg-soft: #fbf7ef;
  --uma-card: rgba(255, 252, 244, .92);
  --uma-card-2: #fffaf0;
  --uma-text: #17251d;
  --uma-muted: #6f756d;
  --uma-green: #0f7a52;
  --uma-green-2: #159866;
  --uma-gold: #c8a85f;
  --uma-gold-2: #e8d19a;
  --uma-line: rgba(42, 62, 50, .16);
  --uma-line-strong: rgba(15, 122, 82, .28);
  --uma-blue: #286e9f;
  --uma-radius: 26px;
  --uma-shadow: 0 22px 70px rgba(75, 61, 35, .14);
}

html,
body {
  background:
    radial-gradient(circle at 15% 0%, rgba(232, 209, 154, .42), transparent 34%),
    radial-gradient(circle at 85% 8%, rgba(15, 122, 82, .16), transparent 32%),
    linear-gradient(180deg, #fbf7ef 0%, #f5f0e6 48%, #efe6d5 100%) !important;
  color: var(--uma-text) !important;
  font-family: Inter, Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif !important;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(23,37,29,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23,37,29,.035) 1px, transparent 1px);
  background-size: 46px 46px;
  opacity: .45;
  z-index: -1;
}

/* Header */

.topbar {
  width: min(1220px, calc(100% - 32px)) !important;
  margin: 16px auto 0 !important;
  padding: 16px 20px !important;
  border-radius: 28px !important;
  border: 1px solid rgba(200, 168, 95, .36) !important;
  background:
    linear-gradient(135deg, rgba(255,255,255,.86), rgba(255,250,240,.72)) !important;
  box-shadow: var(--uma-shadow) !important;
  backdrop-filter: blur(16px);
}

.brand {
  color: var(--uma-text) !important;
  font-weight: 650 !important;
  letter-spacing: -.02em !important;
}

.brand::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--uma-gold), var(--uma-green));
  box-shadow: 0 0 22px rgba(15,122,82,.34);
}

nav a {
  color: var(--uma-muted) !important;
  background: transparent !important;
  border-radius: 999px !important;
  font-weight: 500 !important;
}

nav a:hover {
  color: var(--uma-green) !important;
  background: rgba(15,122,82,.08) !important;
}

/* Main layout */

.page {
  max-width: 1220px !important;
  margin-top: 32px !important;
}

.login-card,
.card,
.editor-head,
.match-grid,
.evs-scroll,
.layout-drop,
.pdf-sheet,
.clean-final,
.admin-card,
.panel-card {
  background:
    linear-gradient(145deg, rgba(255,255,255,.92), rgba(255,250,240,.82)) !important;
  border: 1px solid rgba(200,168,95,.30) !important;
  border-radius: var(--uma-radius) !important;
  box-shadow: var(--uma-shadow) !important;
  color: var(--uma-text) !important;
}

.login-card {
  max-width: 500px !important;
  padding: 42px !important;
}

.login-card::before {
  content: "BROADCAST PLANNING SYSTEM";
  display: block;
  margin-bottom: 16px;
  color: var(--uma-green);
  font-size: 11px;
  letter-spacing: .18em;
  font-weight: 700;
}

h1,
h2,
h3 {
  color: var(--uma-text) !important;
  font-weight: 620 !important;
  letter-spacing: -.04em !important;
}

h1 {
  font-size: clamp(34px, 4.2vw, 56px) !important;
  line-height: .96 !important;
}

h2 {
  font-size: clamp(22px, 2.4vw, 32px) !important;
}

.muted,
.small-muted,
.link-subtitle {
  color: var(--uma-muted) !important;
}

label {
  color: var(--uma-text) !important;
  font-weight: 600 !important;
}

input,
select,
textarea {
  color: var(--uma-text) !important;
  background: rgba(255,255,255,.82) !important;
  border: 1px solid rgba(42,62,50,.20) !important;
  border-radius: 16px !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.70) !important;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(15,122,82,.58) !important;
  outline: 3px solid rgba(15,122,82,.12) !important;
}

button,
.button-link {
  color: #fff !important;
  background: linear-gradient(135deg, #0f7a52, #159866) !important;
  border: 0 !important;
  border-radius: 999px !important;
  font-weight: 650 !important;
  box-shadow: 0 14px 34px rgba(15,122,82,.20) !important;
}

button:hover,
.button-link:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.ghost,
button.ghost,
.button-link.ghost {
  color: var(--uma-green) !important;
  background: rgba(255,255,255,.72) !important;
  border: 1px solid rgba(15,122,82,.22) !important;
  box-shadow: none !important;
}

.secondary-link,
.actions a,
.link-button {
  color: var(--uma-green) !important;
}

/* Tables */

table {
  color: var(--uma-text) !important;
}

th {
  color: var(--uma-text) !important;
  background: linear-gradient(135deg, #e8d19a, #f7e8bd) !important;
  font-weight: 700 !important;
}

td,
th {
  border-color: rgba(42,62,50,.14) !important;
}

/* Editor */

.editor-head {
  padding: 24px !important;
}

.match-grid {
  padding: 20px !important;
}

.evs-scroll {
  overflow-x: auto !important;
  overflow-y: visible !important;
  -webkit-overflow-scrolling: touch;
}

.evs-table,
.links-table,
.connections-table,
.links-section table {
  table-layout: fixed !important;
  width: max-content !important;
  min-width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  background: rgba(255,255,255,.72) !important;
}

.evs-table th:first-child,
.evs-table td:first-child,
.links-table th:first-child,
.links-table td:first-child,
.links-section table th:first-child,
.links-section table td:first-child,
.connections-table th:first-child,
.connections-table td:first-child {
  width: 120px !important;
  min-width: 120px !important;
  max-width: 120px !important;
}

.evs-table th:not(:first-child),
.evs-table td:not(:first-child),
.links-table th:not(:first-child),
.links-table td:not(:first-child),
.links-section table th:not(:first-child),
.links-section table td:not(:first-child),
.connections-table th:not(:first-child),
.connections-table td:not(:first-child) {
  width: 235px !important;
  min-width: 235px !important;
  max-width: 235px !important;
}

.side-title {
  color: var(--uma-green) !important;
  background: #f2ead8 !important;
  font-weight: 800 !important;
}

.evs-table thead th,
.links-section-title,
.clean-green-head,
.green-head {
  color: #132018 !important;
  background: linear-gradient(135deg, #d7bd78, #159866) !important;
  font-weight: 750 !important;
}

.evs-name-select {
  background: rgba(255,255,255,.86) !important;
  color: var(--uma-text) !important;
  border: 1px solid rgba(15,122,82,.26) !important;
}

.multiview {
  gap: 10px !important;
}

.mv-cell {
  background:
    linear-gradient(180deg, rgba(255,255,255,.92), rgba(247,240,224,.78)) !important;
  border: 1px solid rgba(15,122,82,.22) !important;
  border-radius: 18px !important;
  padding: 8px !important;
  gap: 7px !important;
  box-shadow: 0 10px 26px rgba(75,61,35,.08) !important;
}

.mv-cell select,
.evs-table select {
  height: 34px !important;
  font-size: 11px !important;
  padding: 4px 20px 4px 8px !important;
  color: var(--uma-text) !important;
  background: #fffaf0 !important;
}

.mv-label {
  min-height: 40px !important;
  padding: 7px 5px !important;
  border-radius: 14px !important;
  background: linear-gradient(135deg, rgba(15,122,82,.12), rgba(40,110,159,.10)) !important;
  border: 1px solid rgba(15,122,82,.24) !important;
  color: var(--uma-green) !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
}

.layout-drop {
  background:
    radial-gradient(circle at center, rgba(200,168,95,.18), transparent 38%),
    rgba(255,255,255,.78) !important;
}

.layout-empty b {
  color: var(--uma-green) !important;
}

.chip,
.camera-chip,
.extra-camera-chip,
.people-chip,
.evs-chip {
  border-radius: 999px !important;
  font-weight: 650 !important;
  box-shadow: none !important;
}

.camera-chip,
.extra-camera-chip {
  color: #0e4568 !important;
  background: rgba(40,110,159,.10) !important;
  border: 1px solid rgba(40,110,159,.24) !important;
}

.people-chip {
  color: #765515 !important;
  background: rgba(200,168,95,.16) !important;
  border: 1px solid rgba(200,168,95,.34) !important;
}

.evs-chip {
  color: var(--uma-green) !important;
  background: rgba(15,122,82,.10) !important;
  border: 1px solid rgba(15,122,82,.28) !important;
}

.chip-remove {
  color: inherit !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* Final preview */

.clean-final,
.pdf-sheet {
  background:
    linear-gradient(145deg, rgba(255,255,255,.94), rgba(255,250,240,.86)) !important;
  border: 1px solid rgba(200,168,95,.34) !important;
  color: var(--uma-text) !important;
}

.clean-head,
.clean-header {
  color: var(--uma-text) !important;
}

.clean-tournament {
  color: var(--uma-green) !important;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 800 !important;
}

.clean-date {
  color: var(--uma-muted) !important;
}

.clean-layout {
  background: #fffaf0 !important;
  border: 1px solid rgba(42,62,50,.16) !important;
}

.clean-camera-table,
.clean-links-table {
  background: rgba(255,255,255,.78) !important;
  border: 1px solid rgba(42,62,50,.16) !important;
}

.clean-grid {
  background: transparent !important;
}

.clean-evs-column,
.clean-link-column {
  background: rgba(255,255,255,.55) !important;
  border-right: 1px solid rgba(42,62,50,.14) !important;
}

.clean-evs-column:last-child,
.clean-link-column:last-child {
  border-right: 0 !important;
}

.clean-camera-matrix {
  background: rgba(255,255,255,.64) !important;
}

.clean-camera-cell {
  color: var(--uma-text) !important;
  background: rgba(255,255,255,.62) !important;
  border-color: rgba(42,62,50,.13) !important;
}

.clean-camera-cell.muted-cell {
  color: rgba(23,37,29,.35) !important;
  background: rgba(245,240,230,.70) !important;
}

.clean-link-list {
  background: rgba(255,255,255,.62) !important;
}

.clean-link-row {
  color: var(--uma-text) !important;
  border-color: rgba(42,62,50,.13) !important;
}

.clean-camera-summary,
.clean-link-row:last-child {
  color: var(--uma-green) !important;
  font-weight: 800 !important;
}

/* Admin / notices */

.success-box {
  color: var(--uma-green) !important;
  background: rgba(15,122,82,.10) !important;
  border: 1px solid rgba(15,122,82,.24) !important;
}

.alert {
  color: #9b2424 !important;
  background: rgba(212, 70, 70, .10) !important;
  border: 1px solid rgba(212,70,70,.24) !important;
}

.empty {
  color: var(--uma-muted) !important;
  background: rgba(255,255,255,.62) !important;
  border: 1px solid rgba(42,62,50,.12) !important;
}

/* Mobile */

@media (max-width: 760px) {
  .topbar {
    width: calc(100% - 20px) !important;
    margin-top: 10px !important;
    border-radius: 22px !important;
  }

  nav a {
    background: rgba(255,255,255,.58) !important;
    border: 1px solid rgba(42,62,50,.10) !important;
  }

  .page {
    padding: 0 10px !important;
    margin-top: 18px !important;
  }

  .login-card {
    padding: 30px 20px !important;
  }

  h1 {
    font-size: 34px !important;
  }

  .evs-table th:first-child,
  .evs-table td:first-child,
  .links-table th:first-child,
  .links-table td:first-child,
  .links-section table th:first-child,
  .links-section table td:first-child,
  .connections-table th:first-child,
  .connections-table td:first-child {
    width: 105px !important;
    min-width: 105px !important;
    max-width: 105px !important;
  }

  .evs-table th:not(:first-child),
  .evs-table td:not(:first-child),
  .links-table th:not(:first-child),
  .links-table td:not(:first-child),
  .links-section table th:not(:first-child),
  .links-section table td:not(:first-child),
  .connections-table th:not(:first-child),
  .connections-table td:not(:first-child) {
    width: 225px !important;
    min-width: 225px !important;
    max-width: 225px !important;
  }
}

/* ===== Light cleanup: remove remaining dark blocks, reduce boldness ===== */

/* Global font weight normalization */
body,
input,
select,
textarea,
button,
table,
td,
th,
label,
p,
div,
span,
a {
  font-weight: 400 !important;
}

h1,
h2,
h3,
.brand {
  font-weight: 500 !important;
}

/* Keep only important labels slightly stronger */
.side-title,
.evs-table thead th,
.links-section-title,
.clean-green-head,
.green-head,
.mv-label,
.camera-chip,
.extra-camera-chip,
.people-chip,
.evs-chip {
  font-weight: 500 !important;
}

/* Remove dark side cells in editor */
.side-title,
.evs-table th:first-child,
.evs-table td:first-child,
.links-table th:first-child,
.links-table td:first-child,
.links-section table th:first-child,
.links-section table td:first-child,
.connections-table th:first-child,
.connections-table td:first-child {
  background: #f6efe0 !important;
  color: #0f7a52 !important;
  border-color: rgba(42,62,50,.14) !important;
}

/* Whole EVS editor should be light */
.evs-scroll,
.evs-table,
.evs-table tbody,
.evs-table tr,
.evs-table td,
.links-table,
.links-table tbody,
.links-table tr,
.links-table td,
.connections-table,
.connections-table tbody,
.connections-table tr,
.connections-table td,
.links-section table,
.links-section table tbody,
.links-section table tr,
.links-section table td {
  background: rgba(255, 252, 244, .88) !important;
  color: #17251d !important;
}

/* EVS cells */
.evs-table td:not(:first-child),
.links-table td:not(:first-child),
.links-section table td:not(:first-child),
.connections-table td:not(:first-child) {
  background: rgba(255, 255, 255, .68) !important;
}

/* Multiview cards cleaner */
.mv-cell {
  background: #fffaf0 !important;
  border: 1px solid rgba(15,122,82,.18) !important;
  box-shadow: none !important;
}

.mv-label {
  background: rgba(15,122,82,.08) !important;
  color: #0f7a52 !important;
  border: 1px solid rgba(15,122,82,.20) !important;
}

/* Form controls softer */
input,
select,
textarea {
  background: #fffdf7 !important;
  color: #17251d !important;
  border-color: rgba(42,62,50,.18) !important;
}

/* Make selected camera chips less heavy */
.camera-chip,
.extra-camera-chip {
  background: rgba(15,122,82,.08) !important;
  color: #0f7a52 !important;
  border-color: rgba(15,122,82,.22) !important;
}

.people-chip {
  background: rgba(200,168,95,.12) !important;
  color: #6a4d13 !important;
  border-color: rgba(200,168,95,.26) !important;
}

.evs-chip {
  background: rgba(15,122,82,.08) !important;
  color: #0f7a52 !important;
  border-color: rgba(15,122,82,.22) !important;
}

/* ===== Layout image block: fit border to actual image ===== */

.layout-drop,
.clean-layout,
.pdf-layout {
  background: transparent !important;
  box-shadow: none !important;
}

/* Editor upload area */
.layout-drop {
  display: inline-flex !important;
  width: auto !important;
  max-width: 100% !important;
  min-height: 0 !important;
  height: auto !important;
  padding: 0 !important;
  border: 1px solid rgba(42,62,50,.16) !important;
  border-radius: 18px !important;
  overflow: hidden !important;
  align-items: center !important;
  justify-content: center !important;
}

/* If no layout is uploaded, keep a normal empty upload card */
.layout-drop:has(.layout-empty) {
  display: flex !important;
  width: 100% !important;
  min-height: 260px !important;
  padding: 24px !important;
  background: rgba(255,255,255,.58) !important;
  border: 1px dashed rgba(15,122,82,.28) !important;
}

/* Uploaded layout image in editor */
.layout-drop img,
.layout-preview img,
#layoutPreview img {
  display: block !important;
  max-width: 100% !important;
  height: auto !important;
  object-fit: contain !important;
  border-radius: 16px !important;
}

/* Final preview layout: border follows image, no side dark bars */
.clean-layout {
  display: inline-flex !important;
  width: auto !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin-left: auto !important;
  margin-right: auto !important;
  border: 1px solid rgba(42,62,50,.16) !important;
  border-radius: 18px !important;
  overflow: hidden !important;
  align-items: center !important;
  justify-content: center !important;
}

.clean-layout img {
  display: block !important;
  width: auto !important;
  max-width: 100% !important;
  height: auto !important;
  max-height: none !important;
  object-fit: contain !important;
  border-radius: 16px !important;
}

/* Empty final preview only */
.clean-layout.empty-preview {
  display: flex !important;
  width: 100% !important;
  min-height: 260px !important;
  background: rgba(255,255,255,.58) !important;
  border: 1px dashed rgba(15,122,82,.28) !important;
}

/* The final sheet should not force a dark inner background */
.clean-final,
.pdf-sheet,
.preview-page {
  background: transparent !important;
}

/* Keep final document card light */
.clean-final.pdf-sheet,
.pdf-sheet.clean-final,
article.clean-final {
  background:
    linear-gradient(145deg, rgba(255,255,255,.94), rgba(255,250,240,.88)) !important;
  border: 1px solid rgba(200,168,95,.34) !important;
}

/* Camera matrix in final view stays light */
.clean-camera-matrix,
.clean-camera-cell,
.clean-link-list,
.clean-link-row {
  background: rgba(255,255,255,.70) !important;
  color: #17251d !important;
}

/* Reduce bold inside final/PDF preview */
.clean-camera-cell,
.clean-link-row,
.clean-camera-summary {
  font-weight: 500 !important;
}

/* Mobile */
@media (max-width: 760px) {
  .layout-drop,
  .clean-layout {
    width: 100% !important;
  }

  .clean-layout img,
  .layout-drop img,
  .layout-preview img,
  #layoutPreview img {
    width: 100% !important;
    height: auto !important;
  }
}

/* ===== Plan setup page ===== */

.setup-page {
  max-width: 980px;
  margin: 0 auto;
}

.setup-hero {
  margin-bottom: 18px;
  padding: 34px;
  border-radius: 30px;
  background:
    radial-gradient(circle at 12% 0%, rgba(232,209,154,.45), transparent 34%),
    radial-gradient(circle at 88% 10%, rgba(15,122,82,.13), transparent 30%),
    linear-gradient(145deg, rgba(255,255,255,.94), rgba(255,250,240,.86));
  border: 1px solid rgba(200,168,95,.34);
  box-shadow: 0 22px 70px rgba(75,61,35,.14);
}

.setup-kicker {
  color: #0f7a52;
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.setup-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding: 28px;
  border-radius: 30px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.94), rgba(255,250,240,.86));
  border: 1px solid rgba(200,168,95,.34);
  box-shadow: 0 22px 70px rgba(75,61,35,.14);
}

.setup-wide {
  grid-column: 1 / -1;
}

.setup-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Summary in editor */

.setup-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
  padding: 16px;
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.92), rgba(255,250,240,.82));
  border: 1px solid rgba(200,168,95,.30);
  box-shadow: 0 16px 44px rgba(75,61,35,.10);
}

.setup-summary div {
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,.62);
  border: 1px solid rgba(42,62,50,.12);
}

.setup-summary-label {
  display: block;
  margin-bottom: 4px;
  color: #6f756d;
  font-size: 11px;
}

.setup-summary b {
  color: #17251d;
  font-weight: 500 !important;
}

/* For new setup flow, hide duplicated match fields inside editor */
.setup-flow-editor .editor-match-grid {
  display: none !important;
}

@media (max-width: 760px) {
  .setup-card {
    grid-template-columns: 1fr;
    padding: 20px;
  }

  .setup-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .setup-actions button,
  .setup-actions .button-link {
    width: 100%;
  }

  .setup-summary {
    grid-template-columns: 1fr;
  }
}

.pts-hint {
  display: block;
  margin-top: 6px;
  color: #6f756d;
  font-size: 12px;
  line-height: 1.3;
}

.setup-summary b {
  line-height: 1.25;
}

/* ===== Editor selected setup info ===== */

.setup-summary-v2 {
  display: grid !important;
  grid-template-columns: 1fr 1fr 2fr 1fr 1fr 1.4fr;
  gap: 10px;
  margin-bottom: 18px;
  padding: 14px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 10% 0%, rgba(232,209,154,.34), transparent 34%),
    linear-gradient(145deg, rgba(255,255,255,.92), rgba(255,250,240,.84));
  border: 1px solid rgba(200,168,95,.32);
  box-shadow: 0 16px 44px rgba(75,61,35,.10);
}

.setup-summary-item {
  min-width: 0;
  padding: 11px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,.66);
  border: 1px solid rgba(42,62,50,.12);
}

.setup-summary-label {
  display: block;
  margin-bottom: 5px;
  color: #6f756d;
  font-size: 10px;
  line-height: 1;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.setup-summary-item b {
  display: block;
  color: #17251d;
  font-size: 14px;
  line-height: 1.16;
  font-weight: 400 !important;
  white-space: normal;
  overflow-wrap: anywhere;
}

.setup-summary-game b {
  color: #0f7a52;
}

.setup-summary-limits {
  background: rgba(15,122,82,.08);
  border-color: rgba(15,122,82,.20);
}

.setup-summary-limits b {
  color: #0f7a52;
}

@media (max-width: 980px) {
  .setup-summary-v2 {
    grid-template-columns: 1fr 1fr;
  }

  .setup-summary-game,
  .setup-summary-limits {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .setup-summary-v2 {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .setup-summary-game,
  .setup-summary-limits {
    grid-column: auto;
  }
}

/* Hide duplicated match fields when editor was opened from setup page */
.setup-flow-editor .editor-match-grid {
  display: none !important;
}

/* Users page cleanup */
.email-column,
.user-email,
td.email,
th.email {
  display: none !important;
}

/* Team autocomplete */
input[list="teamSuggestions"] {
  position: relative;
}

/* Two-team match input */

.game-teams-block {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: end;
}

.game-vs {
  padding-bottom: 14px;
  color: #0f7a52;
  font-size: 24px;
  line-height: 1;
}

@media (max-width: 760px) {
  .game-teams-block {
    grid-template-columns: 1fr;
  }

  .game-vs {
    padding: 0;
    text-align: center;
  }
}

/* ===== Hide editor side label columns ===== */

/* Hide first technical column in EVS and links tables */
.evs-table th:first-child,
.evs-table td:first-child,
.links-table th:first-child,
.links-table td:first-child,
.connections-table th:first-child,
.connections-table td:first-child,
.links-section table th:first-child,
.links-section table td:first-child {
  display: none !important;
}

/* Let EVS columns use the freed space */
.evs-table th:not(:first-child),
.evs-table td:not(:first-child),
.links-table th:not(:first-child),
.links-table td:not(:first-child),
.links-section table th:not(:first-child),
.links-section table td:not(:first-child),
.connections-table th:not(:first-child),
.connections-table td:not(:first-child) {
  width: 245px !important;
  min-width: 245px !important;
  max-width: 245px !important;
}

/* Cleaner table edges after removing side column */
.evs-table,
.links-table,
.connections-table,
.links-section table {
  border-radius: 22px !important;
  overflow: hidden !important;
}

/* Align first visible EVS column nicely */
.evs-table th:nth-child(2),
.evs-table td:nth-child(2),
.links-table th:nth-child(2),
.links-table td:nth-child(2),
.connections-table th:nth-child(2),
.connections-table td:nth-child(2),
.links-section table th:nth-child(2),
.links-section table td:nth-child(2) {
  border-left: 0 !important;
}

/* Mobile: keep horizontal scroll but use space better */
@media (max-width: 760px) {
  .evs-table th:not(:first-child),
  .evs-table td:not(:first-child),
  .links-table th:not(:first-child),
  .links-table td:not(:first-child),
  .links-section table th:not(:first-child),
  .links-section table td:not(:first-child),
  .connections-table th:not(:first-child),
  .connections-table td:not(:first-child) {
    width: 230px !important;
    min-width: 230px !important;
    max-width: 230px !important;
  }
}

/* ===== Polish links table after removing side columns ===== */

/* Main links wrapper */
.links-section,
.links-table-wrap,
.connections-wrap {
  border-radius: 24px !important;
  overflow: hidden !important;
}

/* Links table itself */
.links-table,
.connections-table,
.links-section table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  overflow: hidden !important;
  border-radius: 24px !important;
  background: rgba(255, 255, 255, .76) !important;
  border: 1px solid rgba(42, 62, 50, .13) !important;
  box-shadow: 0 14px 42px rgba(75, 61, 35, .08) !important;
}

/* Header row "СВЯЗИ" should be one clean bar */
.links-section-title,
.links-table .links-section-title,
.connections-table .links-section-title {
  border-radius: 24px 24px 0 0 !important;
  overflow: hidden !important;
}

/* If title is separate above table */
.links-title,
.links-header,
.link-title-row {
  border-radius: 24px 24px 0 0 !important;
}

/* Remove leftover empty first-column geometry */
.links-table th:first-child,
.links-table td:first-child,
.connections-table th:first-child,
.connections-table td:first-child,
.links-section table th:first-child,
.links-section table td:first-child {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

/* First visible EVS column: no broken left edge */
.links-table th:nth-child(2),
.links-table td:nth-child(2),
.connections-table th:nth-child(2),
.connections-table td:nth-child(2),
.links-section table th:nth-child(2),
.links-section table td:nth-child(2) {
  border-left: 0 !important;
}

/* Last visible EVS column: no broken right edge */
.links-table th:last-child,
.links-table td:last-child,
.connections-table th:last-child,
.connections-table td:last-child,
.links-section table th:last-child,
.links-section table td:last-child {
  border-right: 0 !important;
}

/* EVS columns inside links */
.links-table td:not(:first-child),
.connections-table td:not(:first-child),
.links-section table td:not(:first-child) {
  background:
    linear-gradient(180deg, rgba(255,255,255,.72), rgba(255,250,240,.62)) !important;
  border-right: 1px solid rgba(42, 62, 50, .11) !important;
  vertical-align: top !important;
  padding: 14px 10px !important;
}

/* Subtitles inside links */
.link-subtitle {
  color: rgba(23, 37, 29, .55) !important;
  font-size: 10px !important;
  line-height: 1.1 !important;
  letter-spacing: .06em !important;
  text-transform: uppercase !important;
  margin: 0 0 8px !important;
}

/* Chips layout */
.links-box,
.camera-links-box,
.people-links-box,
.evs-links-box {
  display: grid !important;
  gap: 10px !important;
}

.chips {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  gap: 7px !important;
  min-height: 24px !important;
}

/* Select + plus row */
.add-row,
.extra-camera-row,
.add-person-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 8px !important;
  align-items: center !important;
  margin-top: 4px !important;
}

.add-row select,
.extra-camera-row select,
.add-person-row select,
.camera-links-box select,
.people-links-box select {
  min-width: 0 !important;
  height: 34px !important;
  border-radius: 999px !important;
  font-size: 11px !important;
}

/* Plus buttons: equal round circles */
.add-row button,
.extra-camera-row button,
.add-person-row button,
.camera-links-box button:not(.chip-remove),
.people-links-box button:not(.chip-remove) {
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  padding: 0 !important;
  border-radius: 999px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Make people chips less noisy */
.people-chip,
.camera-chip,
.extra-camera-chip,
.evs-chip {
  min-height: 26px !important;
  padding: 5px 9px !important;
  font-size: 11px !important;
  line-height: 1.1 !important;
}

/* Rounded bottom corners only on the visible bottom cells */
.links-table tr:last-child td:nth-child(2),
.connections-table tr:last-child td:nth-child(2),
.links-section table tr:last-child td:nth-child(2) {
  border-bottom-left-radius: 24px !important;
}

.links-table tr:last-child td:last-child,
.connections-table tr:last-child td:last-child,
.links-section table tr:last-child td:last-child {
  border-bottom-right-radius: 24px !important;
}

/* Remove phantom corner artifacts from wrappers */
.evs-scroll,
.links-scroll {
  background: transparent !important;
}

/* Mobile */
@media (max-width: 760px) {
  .links-table td:not(:first-child),
  .connections-table td:not(:first-child),
  .links-section table td:not(:first-child) {
    padding: 12px 8px !important;
  }

  .people-chip,
  .camera-chip,
  .extra-camera-chip,
  .evs-chip {
    font-size: 10.5px !important;
    padding: 5px 8px !important;
  }
}

/* ===== Unified links section card ===== */

/* The title bar and table below should look like one object */
.links-section-title {
  margin: 18px 0 0 !important;
  padding: 12px 16px !important;
  border-radius: 24px 24px 0 0 !important;
  background: linear-gradient(135deg, #d7bd78, #159866) !important;
  color: #132018 !important;
  text-align: center !important;
  font-size: 18px !important;
  line-height: 1.1 !important;
  font-weight: 500 !important;
  border: 1px solid rgba(42, 62, 50, .13) !important;
  border-bottom: 0 !important;
  overflow: hidden !important;
}

/* Table wrapper directly under "СВЯЗИ" */
.links-editor-table {
  margin-top: 0 !important;
  border-radius: 0 0 24px 24px !important;
  border: 1px solid rgba(42, 62, 50, .13) !important;
  border-top: 0 !important;
  overflow: hidden !important;
  background: rgba(255, 255, 255, .76) !important;
  box-shadow: 0 14px 42px rgba(75, 61, 35, .08) !important;
}

/* Remove own border/radius from inner table to avoid double corners */
.links-editor-table table,
.links-editor-table .links-table,
.links-editor-table .connections-table {
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  margin: 0 !important;
}

/* Hide the removed technical side column completely */
.links-editor-table th:first-child,
.links-editor-table td:first-child {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

/* First visible column starts cleanly from the left edge */
.links-editor-table th:nth-child(2),
.links-editor-table td:nth-child(2) {
  border-left: 0 !important;
}

/* Last visible column ends cleanly */
.links-editor-table th:last-child,
.links-editor-table td:last-child {
  border-right: 0 !important;
}

/* Top of the first visible row should not create white corner artifacts */
.links-editor-table tr:first-child td,
.links-editor-table tr:first-child th {
  border-top: 0 !important;
}

/* Bottom corners belong to wrapper, not inner cells */
.links-editor-table tr:last-child td {
  border-bottom: 0 !important;
}

/* Keep content light and even */
.links-editor-table td:not(:first-child) {
  background:
    linear-gradient(180deg, rgba(255,255,255,.76), rgba(255,250,240,.66)) !important;
  padding: 14px 10px !important;
  vertical-align: top !important;
}

/* Fix possible old rounded corners from previous patches */
.links-editor-table tr:last-child td:nth-child(2),
.links-editor-table tr:last-child td:last-child {
  border-radius: 0 !important;
}

/* Make plus buttons visually aligned */
.links-editor-table button:not(.chip-remove) {
  align-self: center !important;
}

/* Mobile */
@media (max-width: 760px) {
  .links-section-title {
    font-size: 16px !important;
    border-radius: 20px 20px 0 0 !important;
  }

  .links-editor-table {
    border-radius: 0 0 20px 20px !important;
  }

  .links-editor-table td:not(:first-child) {
    padding: 12px 8px !important;
  }
}

/* Safe editable camera labels */

.mv-label-edit {
  width: 100% !important;
  min-height: 40px !important;
  padding: 7px 5px !important;
  border-radius: 14px !important;
  background: rgba(15,122,82,.08) !important;
  color: #0f7a52 !important;
  border: 1px solid rgba(15,122,82,.20) !important;
  box-shadow: none !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
}

.mv-label-edit:hover {
  background: rgba(15,122,82,.14) !important;
  filter: none !important;
  transform: none !important;
}

.mv-label-edit::after {
  content: " ✎";
  opacity: .45;
  font-size: 11px;
}

/* ===== Restore horizontal scroll for LINKS table ===== */

/* Main links scroll container */
.links-editor-table {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: visible !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-x pan-y !important;
}

/* The inner table must be wider than the viewport when there are many EVS */
.links-editor-table table {
  width: max-content !important;
  min-width: 100% !important;
  table-layout: fixed !important;
}

/* EVS columns inside LINKS */
.links-editor-table table th:not(:first-child),
.links-editor-table table td:not(:first-child) {
  width: 245px !important;
  min-width: 245px !important;
  max-width: 245px !important;
}

/* Hidden technical first column should not occupy space */
.links-editor-table table th:first-child,
.links-editor-table table td:first-child {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

/* Do not let parent containers clip the scroll */
.links-section,
.links-section-wrap,
.editor-section,
.editor-card {
  overflow: visible !important;
}

/* Mobile: keep links scrollable with finger */
@media (max-width: 760px) {
  .links-editor-table {
    overflow-x: auto !important;
    overflow-y: visible !important;
  }

  .links-editor-table table {
    width: max-content !important;
    min-width: max-content !important;
  }

  .links-editor-table table th:not(:first-child),
  .links-editor-table table td:not(:first-child) {
    width: 230px !important;
    min-width: 230px !important;
    max-width: 230px !important;
  }
}

/* ===== Equal column widths for synced EVS/LINKS scroll ===== */

.evs-scroll,
.links-editor-table {
  overflow-x: auto !important;
  overflow-y: visible !important;
  -webkit-overflow-scrolling: touch !important;
}

.evs-scroll table,
.links-editor-table table {
  width: max-content !important;
  min-width: 100% !important;
  table-layout: fixed !important;
}

/* Same EVS column width in multiview and links */
.evs-scroll table th:not(:first-child),
.evs-scroll table td:not(:first-child),
.links-editor-table table th:not(:first-child),
.links-editor-table table td:not(:first-child) {
  width: 245px !important;
  min-width: 245px !important;
  max-width: 245px !important;
}

/* Hidden technical left column must be equal/zero in both */
.evs-scroll table th:first-child,
.evs-scroll table td:first-child,
.links-editor-table table th:first-child,
.links-editor-table table td:first-child {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

@media (max-width: 760px) {
  .evs-scroll,
  .links-editor-table {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    touch-action: pan-x pan-y !important;
  }

  .evs-scroll table,
  .links-editor-table table {
    width: max-content !important;
    min-width: max-content !important;
  }

  .evs-scroll table th:not(:first-child),
  .evs-scroll table td:not(:first-child),
  .links-editor-table table th:not(:first-child),
  .links-editor-table table td:not(:first-child) {
    width: 230px !important;
    min-width: 230px !important;
    max-width: 230px !important;
  }
}
