:root {
  color-scheme: light;
  --bg: #eef2f5;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --line: #d8e0e8;
  --line-strong: #c2ced9;
  --text: #1f2a37;
  --muted: #66758a;
  --accent: #1976d2;
  --accent-2: #0f9f7a;
  --warning: #b7791f;
  --danger: #ba3b46;
  --shadow: 0 1px 2px rgba(31, 42, 55, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1120px;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  height: 34px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  padding: 0 14px;
  cursor: pointer;
}

button.secondary {
  background: #fff;
  color: var(--accent);
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.app-shell {
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 14px;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(240px, 1.7fr) 150px 150px 180px 210px 260px 160px;
  gap: 10px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.filters label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.filters span {
  color: var(--muted);
  font-size: 12px;
}

.filters input,
.filters select {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  padding: 0 9px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin: 12px 0;
}

.summary div {
  padding: 11px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.summary strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.tabs {
  display: inline-flex;
  margin-bottom: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  overflow: hidden;
  background: #fff;
}

.tabs button {
  border: 0;
  border-radius: 0;
  background: #fff;
  color: var(--text);
}

.tabs button.active {
  background: var(--accent);
  color: #fff;
}

.message {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
}

.message.error {
  border-color: #e3a5ab;
  color: var(--danger);
}

.table-frame {
  overflow: auto;
  max-height: calc(100vh - 285px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

tbody tr:hover td {
  background: #f8fbff;
}

.num {
  text-align: right;
  white-space: nowrap;
}

.muted {
  color: var(--muted);
}

.status {
  display: inline-block;
  min-width: 142px;
  padding: 4px 8px;
  border-radius: 4px;
  background: #edf7f4;
  color: #176f58;
  text-align: center;
}

.status.review,
.status.attention {
  background: #fff6e5;
  color: var(--warning);
}

.contract-details {
  background: #fbfcfd;
}

.contract-details td {
  padding: 0;
}

.details-panel {
  padding: 12px;
}

.details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.details-header strong {
  font-size: 15px;
}

.documents-grid {
  width: 100%;
}

.link-fields {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr) minmax(260px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.link-fields label {
  display: grid;
  gap: 5px;
}

.link-fields span {
  color: var(--muted);
  font-size: 12px;
}

.link-fields input {
  width: 100%;
  height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 0 8px;
}

.open-task {
  padding-bottom: 7px;
  white-space: nowrap;
}

.documents-grid select,
.documents-grid input {
  width: 160px;
  height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 0 7px;
}

.documents-grid input {
  text-align: right;
}

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

.link:hover {
  text-decoration: underline;
}

.review-note {
  color: var(--warning);
  font-weight: 700;
}

@media (max-width: 1280px) {
  .filters {
    grid-template-columns: minmax(220px, 1fr) repeat(3, 150px);
  }

  .summary {
    grid-template-columns: repeat(3, 1fr);
  }
}
