:root {
  color: #102335;
  background: #07131f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 0%, rgba(42, 159, 255, 0.22), transparent 28rem),
    linear-gradient(135deg, #06101a 0%, #10283a 52%, #06101a 100%);
}

main {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.hero,
.panel {
  border: 1px solid rgba(142, 190, 224, 0.24);
  background: rgba(247, 251, 255, 0.94);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 28px;
  border-radius: 18px;
  margin-bottom: 18px;
}

.hero h1,
.panel h2 {
  margin: 0;
  letter-spacing: 0;
}

.hero h1 {
  font-size: clamp(32px, 4vw, 56px);
  line-height: 0.95;
}

.hero p {
  max-width: 720px;
  color: #526577;
  font-size: 17px;
  line-height: 1.5;
}

.hero img {
  width: 170px;
  max-width: 28vw;
  border-radius: 14px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #168fe0;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12px;
}

.panel {
  padding: 22px;
  border-radius: 14px;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

label {
  display: grid;
  gap: 7px;
  color: #20384d;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid #b6c7d3;
  border-radius: 9px;
  padding: 11px 12px;
  background: #ffffff;
  color: #102335;
  font: inherit;
  font-size: 15px;
  text-transform: none;
  letter-spacing: 0;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: 3px solid rgba(35, 159, 245, 0.24);
  border-color: #168fe0;
}

.toolbar,
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 14px;
}

.filters {
  margin: 16px 0;
}

.filters input {
  flex: 1 1 220px;
}

.filters select {
  flex: 0 0 170px;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  background: linear-gradient(135deg, #1199f1, #6fd0ff);
  color: #06101a;
  font-weight: 950;
  font-size: 14px;
  cursor: pointer;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(17, 153, 241, 0.28);
}

#status {
  min-height: 24px;
  color: #0d5e8c;
  font-weight: 800;
}

.clients {
  display: grid;
  gap: 12px;
  max-height: 1100px;
  overflow: auto;
  padding-right: 4px;
}

.client {
  border: 1px solid #d6e2eb;
  border-radius: 12px;
  padding: 14px;
  background: #ffffff;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.client:hover,
.client:focus,
.client.selected {
  border-color: #168fe0;
  box-shadow: 0 12px 28px rgba(17, 153, 241, 0.18);
  outline: none;
  transform: translateY(-1px);
}

.client div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.client strong {
  font-size: 17px;
}

.client span {
  border-radius: 999px;
  padding: 5px 9px;
  background: #eaf6ff;
  color: #075986;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.client p {
  margin: 8px 0 0;
  color: #526577;
}

.client small {
  display: block;
  margin-top: 9px;
  color: #6a7d8f;
  font-weight: 700;
}

.view-toggle {
  margin-top: 10px;
  padding-top: 14px;
  border-top: 1px solid #d6e2eb;
}

.view-btn {
  background: #eaf6ff;
  color: #075986;
}

.view-btn.active {
  background: linear-gradient(135deg, #1199f1, #6fd0ff);
  color: #06101a;
}

.hint {
  margin: 6px 0 0;
  color: #6a7d8f;
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 14px;
  border: 1px solid #d6e2eb;
  border-radius: 12px;
}

#clientsTable {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  font-size: 14px;
}

#clientsTable th,
#clientsTable td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid #e5edf3;
  white-space: nowrap;
}

#clientsTable thead th {
  background: #f2f8fc;
  color: #20384d;
  font-weight: 900;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
  user-select: none;
  position: sticky;
  top: 0;
}

#clientsTable thead th[data-sort]::after {
  content: '';
  margin-left: 6px;
  opacity: 0.35;
}

#clientsTable thead th.sorted-asc::after {
  content: '▲';
  opacity: 1;
}

#clientsTable thead th.sorted-desc::after {
  content: '▼';
  opacity: 1;
}

#clientsTable tbody tr {
  cursor: pointer;
  transition: background 0.15s ease;
}

#clientsTable tbody tr:hover {
  background: #f7fbff;
}

#clientsTable .empty {
  cursor: default;
  border: 0;
}

.status-badge {
  border-radius: 999px;
  padding: 5px 9px;
  background: #eaf6ff;
  color: #075986;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.sig-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.sig-badge.sig-signed {
  background: #dcf7e3;
  color: #147a3a;
  cursor: pointer;
}

.sig-badge.sig-signed:hover {
  background: #c3f0d0;
}

.sig-badge.sig-waiting {
  background: #fff3d6;
  color: #8a5a00;
}

.sig-badge.sig-checking,
.sig-badge.sig-error {
  background: #eef2f6;
  color: #526577;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 16px;
  overflow-x: auto;
}

.kanban-column {
  background: #f2f8fc;
  border: 1px solid #d6e2eb;
  border-radius: 12px;
  padding: 12px;
  min-width: 220px;
}

.kanban-column h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #20384d;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-count {
  background: #ffffff;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  color: #526577;
}

.kanban-cards {
  display: grid;
  gap: 10px;
  min-height: 60px;
}

.kanban-cards.drag-over {
  outline: 2px dashed #168fe0;
  outline-offset: 4px;
  border-radius: 8px;
}

.kanban-card {
  background: #ffffff;
  border: 1px solid #d6e2eb;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: grab;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.kanban-card:hover {
  box-shadow: 0 10px 20px rgba(17, 153, 241, 0.16);
  transform: translateY(-1px);
}

.kanban-card.dragging {
  opacity: 0.4;
}

.kanban-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.kanban-card strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}

.delete-btn {
  background: #fdeaea;
  color: #a12727;
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.delete-btn:hover {
  background: #fbd4d4;
}

.kanban-card-head .delete-btn {
  min-height: 22px;
  min-width: 22px;
  padding: 0;
  border-radius: 999px;
  font-size: 16px;
  line-height: 1;
  flex: 0 0 auto;
}

#clientsTable .delete-btn {
  min-height: 32px;
  padding: 0 12px;
}

.kanban-card p {
  margin: 2px 0;
  color: #526577;
  font-size: 12px;
}

.kanban-card .sig-badge {
  margin-top: 6px;
}

@media (max-width: 980px) {
  .kanban-board {
    grid-template-columns: 1fr;
  }
}

.empty,
.error {
  border: 1px dashed #b6c7d3;
  border-radius: 12px;
  padding: 18px;
  color: #526577;
  background: #f7fbff;
}

.error {
  color: #8a1f1f;
  border-color: #e0a0a0;
  background: #fff7f7;
}

@media (max-width: 980px) {
  .grid,
  .fields {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: auto;
  }
}

@media (max-width: 650px) {
  main {
    width: min(100% - 20px, 1440px);
    padding-top: 10px;
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
    padding: 20px;
  }

  .hero img {
    width: 132px;
    max-width: 100%;
  }

  .panel {
    padding: 16px;
  }

  button,
  .filters select,
  .toolbar button {
    width: 100%;
  }
}
