:root {
  --blue-900: #224d72;
  --blue-700: #0d7ed6;
  --blue-800: #026bbc;
  --blue-100: #e0eef8;
  --blue-50: #f2f5f8;
  --text: #172b4d;
  --muted: #66727f;
  --line: #d9e2ec;
  --white: #ffffff;
  --green-bg: #eaf7ee;
  --green-line: #b9e2c5;
  --green: #087832;
  --pink-bg: #fff0f3;
  --pink-line: #f3c5cf;
  --pink: #a7193f;
  --gray-bg: #f3f5f7;
  --gray-line: #d9dee5;
  --gray: #4c5967;
  --shadow: 0 12px 32px rgba(11, 31, 51, 0.08);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--white); }

body {
  margin: 0;
  color: var(--text);
  background: var(--white);
  font-family: "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.modal-open { overflow: hidden; }

button, input { font: inherit; }
button { color: inherit; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-header {
  position: relative;
  color: var(--white);
  background: var(--blue-700);
  box-shadow: 0 2px 12px rgba(0, 34, 102, 0.18);
}

.app-header__inner {
  display: flex;
  width: min(1760px, calc(100% - 48px));
  min-height: 72px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: var(--white);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand__mark {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 7px;
  background: var(--white);
  box-shadow: 0 2px 8px rgba(0, 34, 84, 0.18);
}

.brand__mark::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 3px;
  width: 10px;
  height: 18px;
  border-right: 3px solid var(--blue-700);
  border-bottom: 3px solid var(--blue-700);
  border-radius: 1px;
  transform: rotate(43deg);
}
.brand__cabinet { margin-left: 5px; font-size: 14px; font-weight: 500; letter-spacing: 0; opacity: 0.9; }

.app-actions { display: flex; align-items: center; gap: 12px; }

.button {
  display: inline-flex;
  min-height: 44px;
  padding: 0 20px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.button:hover { transform: translateY(-1px); }
.button:focus-visible, .profile:focus-visible, .tour-launch:focus-visible, .document-link:focus-visible, .confirmation-download:focus-visible, .search input:focus-visible, .modal__close:focus-visible { outline: 3px solid rgba(24, 103, 255, 0.28); outline-offset: 2px; }
.button--light { color: var(--blue-700); background: var(--white); }
.button--light:hover { background: #eef4ff; }
.button--primary { color: var(--white); background: var(--blue-700); box-shadow: 0 7px 18px rgba(13, 76, 211, 0.2); }
.button--primary:hover { background: var(--blue-800); }
.button--full { width: 100%; }
.button__upload { font-size: 21px; line-height: 1; }

.profile {
  display: inline-flex;
  padding: 4px 0 4px 10px;
  align-items: center;
  gap: 9px;
  border: 0;
  color: var(--white);
  background: transparent;
  font-size: 13px;
  cursor: pointer;
}

.profile__initials {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  color: var(--blue-700);
  background: #dce8ff;
  font-size: 12px;
  font-weight: 700;
}

.tour-launch {
  display: inline-flex;
  min-height: 40px;
  padding: 0 14px;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 9px;
  color: var(--white);
  background: rgba(3, 72, 140, 0.2);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.tour-launch:hover { background: rgba(3, 72, 140, 0.38); }
.tour-launch > span:first-child { display: grid; width: 20px; height: 20px; place-items: center; border-radius: 50%; color: var(--blue-700); background: var(--white); font-weight: 800; }

.page-shell {
  width: min(1760px, calc(100% - 48px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.breadcrumbs { display: flex; margin-bottom: 24px; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.breadcrumbs a { color: var(--blue-700); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }

.eyebrow { margin: 0 0 8px; color: var(--blue-700); font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }

.house-picker { position: relative; flex: 1.2 1 320px; min-width: 240px; max-width: 440px; }
.house-picker__trigger { display: flex; width: 100%; min-height: 42px; padding: 0 14px; align-items: center; justify-content: space-between; gap: 16px; border: 1px solid #b9c8d8; border-radius: 8px; color: var(--blue-900); background: var(--white); font-size: 14px; font-weight: 650; text-align: left; cursor: pointer; box-shadow: 0 4px 13px rgba(11, 31, 51, 0.05); }
.house-picker__trigger span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.house-picker__trigger:hover { border-color: #7797c2; }
.house-picker__trigger:focus-visible { outline: 3px solid rgba(24, 103, 255, 0.22); outline-offset: 2px; border-color: var(--blue-700); }
.house-picker__trigger i { width: 8px; height: 8px; flex: 0 0 8px; border-right: 1.5px solid var(--blue-700); border-bottom: 1.5px solid var(--blue-700); transform: translateY(-2px) rotate(45deg); transition: transform 160ms ease; }
.house-picker__trigger[aria-expanded="true"] i { transform: translateY(2px) rotate(225deg); }
.house-picker__menu { position: absolute; z-index: 12; top: calc(100% + 8px); left: 0; width: 100%; padding: 10px; border: 1px solid #c6d2df; border-radius: 12px; background: var(--white); box-shadow: 0 18px 46px rgba(11, 31, 51, 0.19); }
.house-picker__menu[hidden] { display: none; }
.house-picker__search { position: relative; display: block; margin-bottom: 8px; }
.house-picker__search input { width: 100%; min-height: 42px; padding: 0 13px 0 40px; border: 1px solid #c7d1dc; border-radius: 8px; color: var(--text); background: #f8fafc; font-size: 13px; }
.house-picker__search input:focus-visible { outline: 3px solid rgba(24, 103, 255, 0.2); outline-offset: 1px; border-color: var(--blue-700); }
.house-picker__options { max-height: 270px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.house-picker__options button { display: block; width: 100%; padding: 12px; overflow: hidden; border: 0; border-radius: 8px; color: var(--blue-900); background: transparent; font-size: 14px; font-weight: 650; text-align: left; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; }
.house-picker__options button[hidden] { display: none; }
.house-picker__options button:hover, .house-picker__options button:focus-visible { outline: 0; background: #edf3fd; }
.house-picker__options button[aria-selected="true"] { color: var(--blue-700); background: #e8f0ff; }
.house-picker__empty { margin: 8px 0; padding: 18px 10px; color: var(--muted); font-size: 13px; text-align: center; }

.documents { overflow: visible; border: 1px solid var(--line); border-radius: 14px; background: var(--white); box-shadow: var(--shadow); }
.documents__filters { display: flex; min-height: 78px; padding: 18px 24px; align-items: center; flex-wrap: nowrap; gap: 10px; border-bottom: 1px solid var(--line); }

.search { position: relative; flex: 1 1 250px; min-width: 200px; }
.search__icon { position: absolute; top: 50%; left: 15px; width: 14px; height: 14px; border: 2px solid #708090; border-radius: 50%; transform: translateY(-58%); pointer-events: none; }
.search__icon::after { content: ""; position: absolute; right: -6px; bottom: -4px; width: 7px; height: 2px; border-radius: 2px; background: #708090; transform: rotate(45deg); }
.search input { width: 100%; min-height: 42px; padding: 0 14px 0 41px; border: 1px solid #c7d1dc; border-radius: 8px; color: var(--text); background: var(--white); font-size: 14px; }
.search input::placeholder { color: #8995a3; }
.filter-select { position: relative; flex: 0 0 auto; }
.filter-select::after { content: ""; position: absolute; top: 50%; right: 14px; width: 7px; height: 7px; border-right: 1.5px solid #53667a; border-bottom: 1.5px solid #53667a; transform: translateY(-65%) rotate(45deg); pointer-events: none; }
.filter-select select { min-height: 42px; padding: 0 34px 0 13px; border: 1px solid #c7d1dc; border-radius: 8px; color: #35495e; background: var(--white); font-size: 13px; font-weight: 600; appearance: none; cursor: pointer; }
.filter-select select:hover { border-color: #8fa6c0; }
.filter-select select:focus-visible { outline: 3px solid rgba(24, 103, 255, 0.2); outline-offset: 1px; border-color: var(--blue-700); }

.table-wrap { overflow-x: auto; border-radius: 0 0 14px 14px; }
table { width: 100%; min-width: 1460px; border-spacing: 0; table-layout: fixed; }
th, td { padding: 15px 14px; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
th { padding: 0; color: #51606f; background: #f6f8fa; font-size: 11px; font-weight: 700; line-height: 1.35; text-transform: uppercase; letter-spacing: 0.035em; }
th button { display: flex; width: 100%; min-height: 56px; padding: 13px 14px; align-items: center; justify-content: space-between; gap: 8px; border: 0; color: inherit; background: transparent; font: inherit; line-height: inherit; text-align: left; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
th button:hover { color: var(--blue-700); background: #edf3fd; }
th button:focus-visible { position: relative; z-index: 1; outline: 3px solid rgba(24, 103, 255, 0.24); outline-offset: -3px; }
th[aria-sort="ascending"] button, th[aria-sort="descending"] button { color: var(--blue-700); background: #edf3fd; }
th button span { flex: 0 0 auto; font-size: 15px; }
th:nth-child(1) { width: 145px; }
th:nth-child(2) { width: 180px; }
th:nth-child(3) { width: 240px; }
th:nth-child(4) { width: 215px; }
th:nth-child(5) { width: 210px; }
th:nth-child(6) { width: 220px; }
th:nth-child(7) { width: 250px; }
td { border-top: 1px solid rgba(116, 130, 145, 0.17); color: #263a50; font-size: 13px; line-height: 1.45; }
tbody tr:first-child td { border-top: 0; }
.document-row--signed td { background: var(--green-bg); }
.document-row--rejected td { background: var(--pink-bg); }
.document-row--waiting td { background: var(--gray-bg); }
.document-row:hover td { filter: brightness(0.985); }
td strong { display: block; margin-bottom: 4px; color: var(--blue-900); font-weight: 650; }
td > span:not(.status):not(.notification) { display: block; color: #627180; font-size: 12px; }

.document-link { padding: 0; border: 0; color: var(--blue-700); background: transparent; font-weight: 650; line-height: 1.45; text-align: left; text-decoration: underline; text-decoration-color: rgba(13, 76, 211, 0.25); text-underline-offset: 3px; cursor: pointer; }
.document-link:hover { text-decoration-color: currentColor; }
.notification { display: inline-flex; align-items: flex-start; gap: 7px; }
.notification i { display: grid; width: 17px; height: 17px; flex: 0 0 17px; margin-top: 1px; place-items: center; border-radius: 50%; color: var(--white); background: #159447; font-size: 11px; font-style: normal; font-weight: 700; }

.status { display: inline-flex; margin-bottom: 7px; padding: 5px 9px; align-items: center; gap: 7px; border: 1px solid; border-radius: 999px; font-size: 12px; font-weight: 700; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status--signed { border-color: #85cf9c; color: var(--green); background: rgba(255, 255, 255, 0.55); }
.confirmation-download { display: inline-flex; margin-top: 8px; padding: 7px 10px; align-items: center; gap: 6px; border: 1px solid #70bd8a; border-radius: 8px; color: #096c39; background: #fff; font-size: 12px; font-weight: 700; line-height: 1.2; text-decoration: none; white-space: nowrap; box-shadow: 0 2px 6px rgba(18, 94, 53, 0.08); }
.confirmation-download:hover { border-color: #238b57; background: #f5fff8; }
.confirmation-download span { font-size: 15px; line-height: 1; }
.status--rejected { border-color: #e9a5b5; color: var(--pink); background: rgba(255, 255, 255, 0.55); }
.status--waiting { border-color: #b9c1ca; color: var(--gray); background: rgba(255, 255, 255, 0.55); }
.status-detail { color: #4f6070 !important; font-size: 12px !important; }

.empty-state { padding: 48px 20px; text-align: center; }
.empty-state strong, .empty-state span { display: block; }
.empty-state strong { margin-bottom: 6px; color: var(--blue-900); }
.empty-state span { color: var(--muted); font-size: 13px; }

.modal[hidden], .toast[hidden], .coach[hidden], .coach__spotlight[hidden] { display: none; }
.modal { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 20px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(7, 27, 52, 0.62); backdrop-filter: blur(2px); }
.modal__dialog { position: relative; z-index: 1; width: min(620px, 100%); max-height: calc(100vh - 40px); padding: 30px; overflow-y: auto; border-radius: 16px; background: var(--white); box-shadow: 0 24px 80px rgba(1, 22, 53, 0.28); }
.modal__dialog h2 { margin: 0; color: var(--blue-900); font-size: 26px; letter-spacing: -0.025em; }
.modal__lead { margin: 10px 0 22px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.modal__close { position: absolute; top: 15px; right: 17px; width: 36px; height: 36px; border: 0; border-radius: 50%; color: #485a6c; background: #eff3f7; font-size: 24px; line-height: 1; cursor: pointer; }
.upload-fields { display: grid; margin-bottom: 16px; grid-template-columns: minmax(0, 2fr) minmax(180px, 1fr); gap: 14px; }
.field { display: grid; gap: 7px; color: #35495e; font-size: 13px; font-weight: 650; }
.field--wide { grid-column: 1 / -1; }
.field input, .field select { width: 100%; min-height: 44px; padding: 0 13px; border: 1px solid #c9d3de; border-radius: 8px; color: #35495e; background: var(--white); }
.field input::placeholder { color: #8995a3; }
.field input:focus-visible, .field select:focus-visible { outline: 3px solid rgba(13, 126, 214, 0.18); outline-offset: 1px; border-color: var(--blue-700); }
.field select { padding-right: 34px; cursor: pointer; }
.dropzone { display: grid; min-height: 180px; margin-bottom: 16px; padding: 24px; place-items: center; align-content: center; gap: 6px; border: 2px dashed #a9bfe7; border-radius: 12px; color: var(--blue-700); background: #f5f8ff; text-align: center; cursor: pointer; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone__icon { display: grid; width: 42px; height: 42px; margin-bottom: 3px; place-items: center; border-radius: 50%; color: var(--white); background: var(--blue-700); font-size: 25px; }
.dropzone span:last-child { color: var(--muted); font-size: 12px; }

.toast { position: fixed; z-index: 30; right: 22px; bottom: 22px; display: flex; max-width: min(390px, calc(100vw - 44px)); padding: 13px 16px; align-items: center; gap: 10px; border-radius: 10px; color: var(--white); background: #15314f; box-shadow: 0 14px 36px rgba(7, 27, 52, 0.25); }
.toast > span { display: grid; width: 20px; height: 20px; place-items: center; border-radius: 50%; color: #15314f; background: #8fe0a9; font-size: 12px; font-weight: 800; }
.toast p { margin: 0; font-size: 13px; }

.coach { position: fixed; z-index: 50; inset: 0; }
.coach__backdrop { position: fixed; inset: 0; background: rgba(7, 27, 52, 0.68); transition: opacity 180ms ease; }
.coach--targeted .coach__backdrop { opacity: 0; }
.coach__spotlight {
  position: fixed;
  z-index: 51;
  border: 3px solid #76b7ff;
  border-radius: 12px;
  background: transparent;
  box-shadow: 0 0 0 9999px rgba(7, 27, 52, 0.68), 0 0 0 7px rgba(255, 255, 255, 0.96), 0 12px 34px rgba(5, 28, 60, 0.28);
  pointer-events: none;
  transition: top 180ms ease, left 180ms ease, width 180ms ease, height 180ms ease;
}
.coach__card {
  position: fixed;
  z-index: 52;
  width: min(390px, calc(100vw - 32px));
  padding: 22px;
  border: 1px solid rgba(190, 211, 235, 0.8);
  border-radius: 16px;
  color: var(--text);
  background: var(--white);
  box-shadow: 0 24px 70px rgba(3, 22, 50, 0.34);
}
.coach--welcome .coach__card { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.coach__topline { display: flex; margin-bottom: 13px; align-items: center; justify-content: space-between; gap: 16px; }
.coach__eyebrow { color: var(--blue-700); font-size: 11px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; }
.coach__close { width: 32px; height: 32px; border: 0; border-radius: 50%; color: #506274; background: #eef3f8; font-size: 22px; line-height: 1; cursor: pointer; }
.coach__close:hover { background: #e1e9f1; }
.coach__card h2 { margin: 0; color: var(--blue-900); font-size: 24px; line-height: 1.18; letter-spacing: -0.025em; }
.coach__card > p { margin: 10px 0 0; color: #42566a; font-size: 14px; line-height: 1.55; }
.coach__card .coach__note { color: var(--muted); font-size: 12px; }
.coach__progress { display: flex; margin: 18px 0; gap: 6px; }
.coach__progress i { width: 24px; height: 4px; border-radius: 99px; background: #dbe4ee; }
.coach__progress i.is-active { background: var(--blue-700); }
.coach__actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.coach__actions > div { display: flex; gap: 8px; }
.coach__actions button { min-height: 40px; padding: 0 15px; border-radius: 8px; font-size: 13px; font-weight: 700; cursor: pointer; }
.coach__skip { padding-left: 0 !important; border: 0; color: #66798b; background: transparent; }
.coach__skip:hover { color: var(--blue-700); }
.coach__back { border: 1px solid #c3d0dd; color: #3a5269; background: var(--white); }
.coach__back:disabled { opacity: 0; pointer-events: none; }
.coach__next { border: 1px solid var(--blue-700); color: var(--white); background: var(--blue-700); }
.coach__next:hover { background: var(--blue-800); }
.coach__close:focus-visible, .coach__skip:focus-visible, .coach__back:focus-visible, .coach__next:focus-visible { outline: 3px solid rgba(24, 103, 255, 0.25); outline-offset: 2px; }

@media (max-width: 1180px) {
  .documents__filters { align-items: stretch; flex-wrap: wrap; }
  .house-picker { width: 100%; max-width: none; flex-basis: 100%; }
  .search { width: 100%; flex-basis: 100%; }
  .filter-select { flex: 1 1 210px; }
  .filter-select select { width: 100%; }
}

@media (max-width: 920px) {
  .app-header__inner, .page-shell { width: min(100% - 32px, 1760px); }
  .profile__name { display: none; }
}

@media (max-width: 700px) {
  .app-header__inner { min-height: 64px; }
  .brand { font-size: 18px; }
  .brand__cabinet { display: none; }
  .brand__mark { width: 31px; height: 31px; }
  .button--light { width: 42px; min-height: 42px; padding: 0; font-size: 0; }
  .button--light span { font-size: 23px; }
  .profile { display: none; }
  .tour-launch { width: 42px; min-height: 42px; padding: 0; justify-content: center; }
  .tour-launch__text { display: none; }
  .page-shell { padding-top: 18px; }
  .breadcrumbs { margin-bottom: 18px; }
  .house-picker__trigger { min-height: 42px; font-size: 14px; }
  .documents { overflow: visible; border: 0; background: transparent; box-shadow: none; }
  .documents__filters { margin-bottom: 12px; padding: 0; border: 0; }
  .table-wrap { overflow: visible; }
  table, thead, tbody, tr, td { display: block; width: 100%; min-width: 0; }
  thead { display: none; }
  tbody { display: grid; gap: 12px; }
  .document-row { overflow: hidden; border: 1px solid var(--gray-line); border-radius: 12px; box-shadow: 0 7px 20px rgba(11, 31, 51, 0.07); }
  .document-row--signed { border-color: var(--green-line); }
  .document-row--rejected { border-color: var(--pink-line); }
  td { display: grid; padding: 12px 14px; grid-template-columns: 120px minmax(0, 1fr); gap: 14px; border-top: 1px solid rgba(116, 130, 145, 0.15); }
  td::before { content: attr(data-label); color: #607080; font-size: 10px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; }
  .modal__dialog { padding: 25px 20px; }
  .upload-fields { grid-template-columns: 1fr; }
  .field--wide { grid-column: auto; }
  .coach__card, .coach--welcome .coach__card { right: 12px !important; bottom: 12px !important; left: 12px !important; top: auto !important; width: auto; max-height: calc(100vh - 24px); padding: 19px; overflow-y: auto; transform: none; }
  .coach__card h2 { font-size: 21px; }
  .coach__spotlight { border-radius: 10px; }
}

@media (max-width: 460px) {
  .app-header__inner, .page-shell { width: min(100% - 24px, 1760px); }
  .page-heading h1 { font-size: 26px; }
  .eyebrow { font-size: 10px; }
  td { grid-template-columns: 1fr; gap: 5px; }
  .toast { right: 12px; bottom: 12px; max-width: calc(100vw - 24px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
