:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --text: #1f2a25;
  --muted: #68746d;
  --line: #d8d0c3;
  --panel: #fffdf8;
  --accent: #2f6f62;
  --accent-strong: #1f5148;
  --warn: #a75d28;
  --sand: #fff7e8;
  --sage: #dce8dd;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(135deg, #f4f1ea 0%, #e9efe8 100%);
  color: var(--text);
  font-family: "PT Sans", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

a {
  color: inherit;
}

.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.88);
}

.brand {
  font-weight: 700;
  text-decoration: none;
}

nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

nav a,
.nav-link {
  color: var(--muted);
  text-decoration: none;
}

.nav-form {
  margin: 0;
}

.nav-link {
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 32px auto;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 18px 45px rgba(31, 42, 37, 0.08);
}

.narrow {
  max-width: 560px;
}

.auth-shell {
  min-height: calc(100vh - 128px);
  display: grid;
  place-items: center;
  padding: 24px 0 48px;
}

.auth-card {
  width: min(520px, 100%);
  display: grid;
  gap: 20px;
  padding: clamp(28px, 5vw, 44px);
  border: 1px solid rgba(216, 208, 195, 0.9);
  border-radius: 28px;
  background:
    radial-gradient(circle at top left, rgba(47, 111, 98, 0.12), transparent 34%),
    linear-gradient(145deg, #fffdf8 0%, #fff8eb 100%);
  box-shadow: 0 28px 70px rgba(31, 42, 37, 0.13);
}

.auth-intro {
  text-align: center;
}

.auth-intro h1 {
  margin-bottom: 10px;
}

.eyebrow {
  display: inline-flex;
  margin-bottom: 10px;
  border-radius: 999px;
  background: var(--sage);
  color: var(--accent-strong);
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.auth-form button {
  width: 100%;
  min-height: 44px;
}

.auth-restore {
  display: grid;
  gap: 10px;
  margin-top: 4px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.auth-restore h2 {
  margin-bottom: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.1;
  margin-bottom: 14px;
}

h2 {
  font-size: 18px;
  margin-bottom: 6px;
}

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

.actions,
.row-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.button,
button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  padding: 10px 16px;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.button.secondary,
button.secondary {
  background: #e4e0d7;
  color: var(--text);
}

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

.form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
}

input[type="hidden"] {
  min-height: 0;
  padding: 0;
}

input[type="file"] {
  padding: 8px;
  background: white;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  background: white;
}

.section-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.inline-form {
  display: flex;
  gap: 8px;
}

.inline-form input {
  width: 130px;
}

.table {
  display: grid;
  gap: 10px;
}

.row {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
}

.priority {
  display: grid;
  gap: 4px;
  color: var(--muted);
}

.priority strong {
  color: var(--accent-strong);
  font-size: 28px;
}

.statement p {
  margin-bottom: 4px;
}

.empty {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.summary {
  display: grid;
  gap: 4px;
  margin-bottom: 22px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
}

.summary p {
  margin-bottom: 4px;
}

.notice {
  padding: 16px;
  border-left: 4px solid var(--accent);
  background: #eef5ef;
  border-radius: 6px;
}

.notice.warn {
  border-left-color: var(--warn);
  background: #fff4e8;
}

.upload-context {
  margin-bottom: 18px;
}

.soft-separator {
  margin: 24px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.compact-list {
  margin: 8px 0 0;
  padding-left: 20px;
}

.zayav-form {
  max-width: 620px;
}

.check {
  display: flex;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  font-weight: 400;
}

.check input {
  min-height: auto;
}

.dadata-field {
  position: relative;
}

.suggestions {
  display: grid;
  position: absolute;
  z-index: 20;
  right: 0;
  left: 0;
  top: calc(100% + 4px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  box-shadow: 0 16px 35px rgba(31, 42, 37, 0.16);
}

.suggestions[hidden] {
  display: none;
}

.suggestion-item {
  width: 100%;
  border-radius: 0;
  background: white;
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
  font-size: 14px;
}

.suggestion-item:hover {
  background: #edf4ed;
}

.upload-form {
  margin-top: 20px;
  max-width: 720px;
}

.documents-panel {
  margin-top: 18px;
}

.documents-list {
  display: grid;
  gap: 10px;
}

.document-item,
.customer-item {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
}

.document-item p {
  margin-bottom: 4px;
}

.document-actions {
  display: grid;
  justify-items: end;
  align-content: start;
  gap: 10px;
  min-width: 150px;
}

.customers-list {
  display: grid;
  gap: 10px;
}

.customer-item p {
  margin-bottom: 4px;
}

.dev-id-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 12px;
}

.dev-id-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: stretch;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--sand);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.dev-id-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(31, 42, 37, 0.08);
}

.dev-id-pill {
  display: grid;
  grid-template-columns: auto auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 12px 14px;
  text-decoration: none;
}

.dev-id-pill span {
  color: var(--muted);
  font-size: 13px;
}

.dev-id-pill em {
  grid-column: 1 / -1;
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dev-password-form {
  display: flex;
  border-left: 1px solid var(--line);
}

.dev-password-button {
  height: 100%;
  min-width: 74px;
  border-radius: 0;
  padding: 10px 11px;
  background: #ece5d8;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

.dev-password-button:hover {
  background: #dfeade;
}

.dev-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  padding: clamp(26px, 5vw, 44px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    radial-gradient(circle at 20% 0%, rgba(47, 111, 98, 0.18), transparent 30%),
    linear-gradient(135deg, #fffdf8 0%, #edf4ed 100%);
  box-shadow: 0 22px 55px rgba(31, 42, 37, 0.1);
}

.dev-hero h1 {
  margin-bottom: 8px;
}

.dev-hero p {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
}

.dev-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dev-panel {
  border-radius: 22px;
}

.dev-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  margin-bottom: 22px;
}

.dev-toolbar h2 {
  font-size: 24px;
  margin-bottom: 4px;
}

.dev-quick-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.dev-quick-form span {
  display: flex;
  gap: 8px;
}

.dev-quick-form input {
  width: 130px;
}

.customer-form {
  max-width: 900px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

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

textarea {
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  resize: vertical;
}

.data-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 20px;
}

.data-grid div,
.change-item {
  display: grid;
  gap: 3px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
}

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

.data-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.data-grid strong {
  display: block;
  font-size: 15px;
  line-height: 1.25;
  word-break: break-word;
}

.me-actions {
  margin-top: 20px;
}

.changes-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.change-item p {
  margin-bottom: 0;
}

.contract-card {
  display: grid;
  gap: 18px;
  margin-bottom: 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7fbf3;
}

.contract-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

.contract-head h2,
.scan-upload h2,
.scan-list h2 {
  margin-bottom: 4px;
}

.contract-number {
  color: var(--accent-strong);
  font-size: 24px;
}

.contract-grid {
  margin-top: 0;
}

.contract-actions {
  padding-top: 4px;
}

.scan-upload {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.scan-list {
  display: grid;
  gap: 10px;
}

code {
  padding: 2px 5px;
  border-radius: 4px;
  background: #eee7db;
}

@media (max-width: 760px) {
  .topbar,
  .section-head,
  .row,
  .document-item,
  .customer-item,
  .data-grid,
  .contract-head,
  .dev-hero,
  .dev-toolbar {
    display: grid;
  }

  .data-grid,
  .dev-toolbar {
    grid-template-columns: 1fr;
  }

  .auth-shell {
    min-height: auto;
    place-items: stretch;
    padding-top: 8px;
  }

  .auth-card,
  .dev-hero,
  .dev-panel {
    border-radius: 18px;
  }

  .dev-hero-actions {
    justify-content: start;
  }

  .document-actions {
    justify-items: start;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 14px 16px;
  }

  nav {
    flex-wrap: wrap;
  }

  .row {
    grid-template-columns: 1fr;
  }
}
