:root {
  --gold: #d4a047;
  --navy: #071425;
  --cream: #f7f3eb;
  --border: #e6d9be;
  --divider-blue: #0c2f68;
  --panel-grey: #eef1f7;
  --panel-grey-strong: #f2f4f9;
  --panel-blue: #0b3a73;
  --text: #4e5968;
}

.links-page .tt-nav a.active {
  color: var(--gold);
}

body {
  margin: 0;
  font-family: "Montserrat", sans-serif;
  background: var(--cream);
  color: var(--text);
}

.links-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.links-page main {
  flex: 1;
}

.links-wrapper {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 48px 24px 64px;
  display: flex;
  flex-direction: column;
  gap: 54px;
  align-items: center;
}

.card {
  width: 100%;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(7, 20, 37, 0.05);
  overflow: hidden;
}

.filters-card {
  border: 1px solid rgba(11, 58, 115, 0.35);
  background: #fff;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
}

.filters-card-body {
  padding: 14px 20px 12px;
}

.filters-row {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(180px, 220px) minmax(180px, 220px) 130px;
  gap: 14px;
  align-items: center;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #081737;
  text-transform: none;
  letter-spacing: 0.03em;
}

.filter-group span {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: #0c2049;
}

.link-search-input {
  border-radius: 14px;
  border: 1px solid #dcd8cf;
  background: #fff;
  padding: 8px 12px;
}

.link-search-input input {
  width: 100%;
  border: none;
  font-size: 0.95rem;
  color: var(--navy);
}

.link-search-input input:focus {
  outline: none;
}

.filter-group select {
  border: 1px solid #dcd8cf;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.95rem;
  appearance: none;
  background: #fff
    url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23071425' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E")
    no-repeat right 12px center;
  padding-right: 32px;
}

.filter-button {
  justify-self: end;
}

.filter-button .tt-btn {
  height: 36px;
  min-width: 130px;
  border-radius: 999px;
  padding: 0 16px;
  font-size: 0.95rem;
  background: var(--panel-blue);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(7, 20, 37, 0.25);
}

.link-table {
  border: 1px solid var(--panel-blue);
  border-radius: 20px;
  background: #fff;
  box-shadow: none;
  padding: 0;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
}

.link-table-shell {
  background: #fff;
  border-radius: 18px;
  overflow: visible;
  width: 100%;
}

.link-table-shell table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  table-layout: auto;
}

.link-table-shell th,
.link-table-shell td {
  padding: 12px 18px;
  font-size: 0.98rem;
  text-align: left;
  color: #0c2049;
  border-bottom: 1px solid #e5e8f2;
  background: #fff;
}

.link-table-shell tbody td strong,
.link-table-shell tbody td b {
  font-weight: 400;
}

.link-table-shell thead th {
  background: #e7eefa;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.01em;
  border-bottom: 2px solid #c8d5ea;
}

.link-table-shell thead th.actions {
  text-align: left;
  width: 460px;
}

.link-table-shell tbody td.actions {
  min-width: 460px;
  width: 460px;
  padding-right: 20px;
  overflow: visible;
}

.link-table-shell tbody td:last-child {
  text-align: right;
}

.link-table-shell tbody td:nth-child(1),
.link-table-shell thead th:nth-child(1) {
  min-width: 170px;
  width: 170px;
}

.link-table-shell tbody td:nth-child(2),
.link-table-shell thead th:nth-child(2) {
  min-width: 150px;
  width: 150px;
}

.link-table-shell tbody td:nth-child(3),
.link-table-shell thead th:nth-child(3) {
  min-width: 190px;
  width: 190px;
}

.link-table-shell tbody td:nth-child(4),
.link-table-shell thead th:nth-child(4) {
  min-width: 120px;
  width: 120px;
}

.link-table-shell tbody td:nth-child(5),
.link-table-shell thead th:nth-child(5) {
  min-width: 210px;
  width: 210px;
}

.link-table-shell tbody td:nth-child(3) {
  white-space: nowrap;
}

.link-table-shell tbody tr:last-child td {
  border-bottom: none;
}

.actions-cell {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.actions-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  grid-auto-rows: minmax(34px, auto);
  column-gap: 10px;
  row-gap: 10px;
  justify-items: stretch;
  align-items: stretch;
  width: 100%;
  max-width: 420px;
  margin-left: auto;
  padding-right: 0;
}

.actions-row button {
  border: 1px solid #c9d5e6;
  background: #fff;
  color: #0a274f;
  border-radius: 999px;
  padding: 0 8px;
  height: 34px;
  width: 100%;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(7, 20, 37, 0.1);
  white-space: nowrap;
}

.actions-row button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.new-link-btn {
  height: 34px;
  min-width: 130px;
  border-radius: 999px;
  background: #f6cc6d;
  color: #0b3a73;
  border: 1px solid #c89c1f;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0 18px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  justify-self: end;
}

.link-actions-row {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  justify-content: flex-end;
  padding: 0 16px 0;
}

.links-note {
  margin: 0 auto 0;
  font-size: 0.85rem;
  color: #3a3a3a;
  text-align: center;
  width: min(960px, 100%);
  padding: 18px 16px;
}

.client-links-modal .tt-modal-card {
  width: min(520px, 90vw);
  max-height: 86vh;
  overflow: hidden;
  border-radius: 20px;
  padding: 0;
}

.client-links-modal .tt-modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid #d2dbe8;
}

.client-links-modal .tt-modal-header h3 {
  margin: 0;
  color: var(--navy);
  font-size: 1.2rem;
}

.client-links-modal .tt-modal-body {
  padding: 0;
}

.client-links-modal-panels {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 16px 20px 12px;
}

.client-links-panel {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  border: 1px solid #dfe4ef;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 220px;
}

.client-links-panel.existing {
  background: #fbfcff;
}

.client-links-panel.create {
  border-style: dashed;
  background: #f8fafc;
}

.client-links-panel-heading {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.client-links-panel-heading strong {
  font-size: 1.05rem;
  color: var(--navy);
}

.client-links-panel-search {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.client-links-search-row {
  display: flex;
  gap: 8px;
}

.client-links-search-row input {
  flex: 1;
  border: 1px solid #dcd8cf;
  border-radius: 10px;
  padding: 8px 12px;
}

.client-links-search-row button {
  border: none;
  background: var(--panel-blue);
  color: #fff;
  border-radius: 999px;
  font-weight: 700;
  padding: 0 18px;
  min-width: 100px;
  height: 34px;
  cursor: pointer;
}

.client-links-case-list {
  border: 1px solid #d7dce5;
  border-radius: 12px;
  padding: 10px;
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fff;
}

.client-links-case-row {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  transition: border 0.2s ease, background 0.2s ease;
}

.client-links-case-row:hover {
  border-color: var(--divider-blue);
  background: #f4f6fb;
}

.client-links-case-row.active {
  border-color: var(--navy);
  background: #e7efff;
}

.client-links-case-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.client-links-case-meta {
  font-size: 0.9rem;
  color: #0c2049;
}

.client-links-case-id {
  font-size: 0.8rem;
  color: #5c6576;
}

.client-links-panel-label {
  font-size: 0.85rem;
  color: var(--text);
}

.client-links-create-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.client-links-create-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}

.client-links-create-form input,
.client-links-create-form select {
  border-radius: 10px;
  border: 1px solid #d3d6e1;
  padding: 10px 12px;
  font-size: 0.95rem;
}

.client-links-create-form .tt-btn {
  align-self: flex-end;
  min-width: 140px;
  height: 36px;
  border-radius: 999px;
  background: var(--panel-blue);
  color: #fff;
  border: none;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0 20px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(7, 20, 37, 0.15);
}

.tt-modal-footer.client-links-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid #d2dbe8;
}

.tt-modal-footer.client-links-modal-footer .tt-selected-case {
  font-weight: 600;
  color: #0b2f5b;
}

.client-links-modal-actions {
  display: flex;
  gap: 10px;
}

.tt-selected-case {
  font-size: 0.95rem;
}

.client-links-modal-status {
  font-weight: 600;
  color: #0c2049;
  font-size: 0.9rem;
}

@media (max-width: 900px) {
  .filters-row {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  .filter-button {
    justify-self: stretch;
    width: 100%;
  }

  .link-actions-row {
    flex-direction: column;
    align-items: center;
  }

  .links-wrapper {
    padding: 24px 18px 40px;
  }

  .client-links-modal-panels {
    grid-template-columns: 1fr;
    padding: 18px 18px;
  }
}
