:root {
  --bg: #f3f6f4;
  --panel: #ffffff;
  --ink: #18212f;
  --muted: #667085;
  --line: #dfe7e3;
  --soft: #eef4f1;
  --primary: #3157d5;
  --primary-dark: #243faf;
  --teal: #088477;
  --teal-soft: #e2f5f1;
  --amber: #a96608;
  --amber-soft: #fff2d7;
  --red: #c13d4a;
  --red-soft: #fde8eb;
  --green: #1f8f5f;
  --green-soft: #e3f4ea;
  --violet: #7157b8;
  --violet-soft: #eeeafd;
  --surface: rgba(255, 255, 255, .88);
  --shadow: 0 16px 44px rgba(33, 44, 38, .12);
  --shadow-sm: 0 8px 20px rgba(33, 44, 38, .08);
  --focus: 0 0 0 3px rgba(49, 87, 213, .18);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.public-page {
  min-height: 100vh;
  background: #fbfcfb;
}

.public-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px clamp(18px, 4vw, 56px);
  background: rgba(251, 252, 251, .82);
  border-bottom: 1px solid rgba(223, 231, 227, .9);
  backdrop-filter: blur(18px);
}

.public-brand {
  min-width: 240px;
}

.public-links {
  display: flex;
  align-items: center;
  gap: 24px;
  color: #526071;
  font-weight: 750;
}

.public-links a {
  border-radius: 8px;
  padding: 8px 2px;
}

.public-links a:hover {
  color: var(--primary-dark);
}

.public-hero {
  min-height: 660px;
  display: grid;
  background-image:
    linear-gradient(90deg, rgba(15, 22, 35, .96) 0%, rgba(15, 22, 35, .88) 46%, rgba(18, 38, 45, .78) 100%),
    url("portal-hero.jpg");
  background-size: cover;
  background-position: center;
}

.hero-shade {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 520px);
  gap: 42px;
  align-items: center;
  padding: 62px clamp(20px, 5vw, 72px) 74px;
}

.hero-copy {
  max-width: 760px;
  color: #fff;
}

.eyebrow {
  display: block;
  margin-bottom: 12px;
  color: #61d7c8;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-copy h1 {
  margin: 0;
  max-width: 740px;
  font-size: 56px;
  line-height: 1.04;
}

.hero-copy p {
  max-width: 660px;
  margin: 20px 0 0;
  color: rgba(255, 255, 255, .86);
  font-size: 18px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 30px;
}

.hero-link {
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border-color: rgba(255, 255, 255, .16);
}

.hero-proof {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 30px;
}

.hero-proof span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 8px;
  padding: 7px 11px;
  background: rgba(255, 255, 255, .08);
  color: rgba(255, 255, 255, .76);
  white-space: nowrap;
}

.hero-proof b {
  color: #fff;
}

.hero-visual {
  width: min(520px, 100%);
  min-height: 430px;
  justify-self: end;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 8px;
  background: rgba(246, 249, 248, .94);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .34);
  overflow: hidden;
}

.visual-toolbar {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  border-bottom: 1px solid #dce5e0;
  background: #ffffff;
}

.visual-toolbar span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #d6ded9;
}

.visual-toolbar span:first-child {
  background: #ff7468;
}

.visual-toolbar span:nth-child(2) {
  background: #ffbf3e;
}

.visual-toolbar span:nth-child(3) {
  background: #2ac78f;
}

.visual-toolbar b {
  margin-left: auto;
  color: #263243;
  font-size: 13px;
}

.visual-grid {
  display: grid;
  grid-template-columns: minmax(150px, .85fr) minmax(0, 1fr);
  gap: 14px;
  padding: 18px;
}

.document-preview,
.recognition-preview {
  border: 1px solid #dfe7e3;
  border-radius: 8px;
  background: #fff;
}

.document-preview {
  overflow: hidden;
}

.doc-scan {
  height: 250px;
  background-image: url("portal-hero.jpg");
  background-size: cover;
  background-position: 42% 0;
  filter: saturate(.4) contrast(1.08);
}

.doc-caption {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.recognition-preview {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
}

.preview-line {
  display: grid;
  gap: 4px;
  border-bottom: 1px solid #edf1ef;
  padding-bottom: 10px;
}

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

.preview-line b {
  font-size: 14px;
}

.status-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.visual-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin: 0 18px 18px;
  border: 1px solid #dfe7e3;
  border-radius: 8px;
  padding: 13px 14px;
  background: #eef6f3;
}

.visual-footer b {
  display: block;
  margin-top: 2px;
  font-size: 18px;
}

.public-band,
.auth-band {
  padding: 64px clamp(18px, 5vw, 72px);
}

.public-band.alt {
  background: #f4f7f6;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.section-head {
  max-width: 820px;
  margin-bottom: 28px;
}

.section-head h2,
.auth-copy h2 {
  margin: 0;
  font-size: 34px;
  line-height: 1.14;
}

.section-head p,
.auth-copy p,
.tariff-card p,
.role-block p,
.feature span {
  color: var(--muted);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.feature,
.role-block,
.tariff-card,
.auth-panel,
.panel,
.stat,
.meter,
.client-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.feature {
  display: grid;
  gap: 10px;
  min-height: 148px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.feature::before,
.role-block::before {
  content: "";
  width: 42px;
  height: 3px;
  border-radius: 999px;
  background: var(--teal);
}

.feature:nth-child(2)::before,
.role-block:nth-child(2)::before {
  background: var(--primary);
}

.feature:nth-child(3)::before,
.role-block:nth-child(3)::before {
  background: var(--amber);
}

.feature b {
  font-size: 17px;
}

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

.tariff-card {
  padding: 24px;
}

.tariff-card.strong {
  border-color: rgba(49, 87, 213, .28);
  box-shadow: inset 4px 0 0 var(--primary), var(--shadow-sm);
}

.tariff-label {
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.tariff-card h3,
.role-block h3 {
  margin: 9px 0 8px;
  font-size: 21px;
}

.tariff-card ul {
  margin: 16px 0 0;
  padding-left: 18px;
  color: var(--ink);
}

.tariff-card li + li {
  margin-top: 8px;
}

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

.role-block {
  display: grid;
  gap: 4px;
  padding: 22px;
}

.auth-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
  gap: 32px;
  align-items: start;
  background:
    linear-gradient(90deg, rgba(20, 31, 47, .96), rgba(23, 54, 57, .94)),
    url("portal-hero.jpg");
  background-size: cover;
  background-position: center;
  color: #fff;
}

.auth-copy {
  max-width: 700px;
}

.auth-copy p {
  color: rgba(255, 255, 255, .76);
  font-size: 16px;
}

.auth-panel {
  padding: 20px;
  color: var(--ink);
  background: rgba(255, 255, 255, .96);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 14px;
  padding: 4px;
  background: var(--soft);
}

.tabs button {
  min-height: 40px;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.tabs button.active {
  background: #fff;
  color: var(--primary-dark);
  box-shadow: 0 5px 14px rgba(33, 44, 38, .08);
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-field {
  display: grid;
  gap: 5px;
}

.auth-field > label {
  color: var(--muted);
  font-weight: 700;
}

.field-help {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}

.password-control {
  position: relative;
}

.password-control .field {
  padding-right: 94px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 5px 9px;
  transform: translateY(-50%);
  background: transparent;
  color: var(--primary-dark);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.password-toggle:hover {
  background: var(--soft);
}

.password-toggle:focus-visible,
.auth-help summary:focus-visible {
  outline: 3px solid rgba(49, 87, 213, .18);
  outline-offset: 2px;
}

.auth-help {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.auth-help summary {
  width: fit-content;
  color: var(--primary-dark);
  font-weight: 750;
  cursor: pointer;
}

.auth-help p {
  margin: 8px 0 0;
  line-height: 1.5;
}

.auth-form .field[aria-invalid="true"] {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(184, 54, 74, .12);
}

.auth-form button[type="submit"]:disabled {
  cursor: wait;
  opacity: .68;
}

.form-message {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.form-message.error {
  color: var(--red);
}

.form-message.ok {
  color: var(--green);
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  background: #eef2f0;
}

.side {
  background: rgba(255, 255, 255, .88);
  border-right: 1px solid var(--line);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  flex: 0 0 auto;
}

.brand-name {
  display: block;
  font-size: 17px;
  font-weight: 800;
}

.brand-sub,
.muted,
.side-label,
.tiny {
  color: var(--muted);
}

.brand-sub {
  display: block;
  font-size: 12px;
}

.side-section {
  display: grid;
  gap: 8px;
}

.side-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 800;
}

.nav-btn {
  width: 100%;
  text-align: left;
  border-radius: 8px;
  padding: 11px 12px;
  background: transparent;
  color: #384456;
  font-weight: 700;
}

.nav-btn:hover,
.nav-btn.active {
  background: var(--soft);
  color: var(--primary-dark);
}

.field,
.search {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
  min-width: 0;
}

.field:focus,
.search:focus {
  border-color: rgba(49, 87, 213, .45);
}

.side-footer {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.meter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 11px;
  background: #fbfcfb;
}

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

.main {
  min-width: 0;
}

.topbar {
  min-height: 76px;
  background: rgba(255, 255, 255, .9);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 15px 24px;
  backdrop-filter: blur(18px);
}

h1 {
  margin: 0 0 2px;
  font-size: 22px;
}

h2 {
  margin: 0 0 12px;
  font-size: 15px;
}

h3 {
  margin: 0;
  font-size: 14px;
}

.top-actions,
.toolbar,
.row-actions,
.switcher,
.inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.view {
  padding: 22px 24px 36px;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, .9fr);
  gap: 18px;
}

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

.panel {
  background: var(--panel);
  padding: 18px;
}

.band {
  background: rgba(255, 255, 255, .92);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 18px;
  margin-bottom: 18px;
}

.toolbar {
  justify-content: space-between;
  margin-bottom: 14px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 220px;
}

.search {
  max-width: 260px;
}

.primary,
.ghost,
.danger,
.teal {
  border-radius: 8px;
  min-height: 38px;
  padding: 9px 14px;
  font-weight: 800;
  white-space: nowrap;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}

.primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 22px rgba(49, 87, 213, .22);
}

.primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.ghost {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .82);
  color: var(--ink);
}

.ghost:hover {
  background: #f5f8f6;
}

.teal {
  background: var(--teal-soft);
  color: var(--teal);
}

.danger {
  background: var(--red-soft);
  color: var(--red);
}

.small {
  min-height: 32px;
  padding: 6px 11px;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.segmented button {
  min-height: 34px;
  padding: 7px 11px;
  background: #fff;
  color: var(--muted);
  border-right: 1px solid var(--line);
  font-weight: 750;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: var(--primary);
  color: #fff;
}

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

th {
  text-align: left;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

td {
  padding: 10px 8px;
  border-bottom: 1px solid #edf1ef;
  vertical-align: middle;
  word-break: break-word;
}

tr:last-child td {
  border-bottom: 0;
}

.right {
  text-align: right;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 800;
}

.pill.ok {
  color: var(--green);
  background: var(--green-soft);
}

.pill.warn {
  color: var(--amber);
  background: var(--amber-soft);
}

.pill.err {
  color: var(--red);
  background: var(--red-soft);
}

.pill.info {
  color: var(--primary-dark);
  background: #e8edff;
}

.pill.violet {
  color: var(--violet);
  background: var(--violet-soft);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat {
  background: #fff;
  padding: 15px;
}

.stat b {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

.dropzone {
  border: 2px dashed #b9c9c2;
  border-radius: 8px;
  padding: 24px;
  background: #fbfdfc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.dropzone strong {
  display: block;
  font-size: 16px;
}

.review-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.file-name {
  font-weight: 800;
  overflow-wrap: anywhere;
}

.review-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px 14px;
}

.kv-row {
  display: grid;
  gap: 3px;
}

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

.kv-row b {
  font-size: 14px;
}

.nomenclature {
  margin-top: 16px;
  overflow-x: auto;
}

.nomenclature table {
  min-width: 760px;
}

.nomenclature td:first-child {
  word-break: normal;
  overflow-wrap: anywhere;
}

.type-cell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.type-cell button {
  min-height: 28px;
  border-radius: 7px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.type-cell button.active {
  background: var(--teal-soft);
  color: var(--teal);
}

.client-list {
  display: grid;
  gap: 9px;
}

.client-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: #fff;
}

.client-row.active {
  border-color: rgba(49, 87, 213, .42);
  box-shadow: inset 3px 0 0 var(--primary), var(--shadow-sm);
}

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

.event {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.event:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.tiny {
  font-size: 12px;
}

@media (max-width: 1180px) {
  .hero-shade {
    grid-template-columns: 1fr;
  }

  .hero-visual {
    justify-self: start;
  }

  .feature-grid,
  .role-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .side {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .grid,
  .grid-equal,
  .stats,
  .auth-band {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .public-nav {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 760px) {
  .hero-copy h1 {
    font-size: 40px;
  }

  .hero-shade {
    padding-top: 46px;
  }

  .hero-visual {
    min-height: auto;
  }

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

  .doc-scan {
    height: 190px;
  }

  .feature-grid,
  .role-grid,
  .tariff-grid {
    grid-template-columns: 1fr;
  }

  .public-links {
    gap: 12px;
    flex-wrap: wrap;
  }

  .public-hero {
    min-height: 620px;
  }
}

@media (max-width: 640px) {
  .view,
  .topbar {
    padding-left: 14px;
    padding-right: 14px;
  }

  .hero-copy h1 {
    font-size: 34px;
  }

  .hero-copy p {
    font-size: 16px;
  }

  .hero-proof span,
  .visual-footer {
    width: 100%;
  }

  .visual-footer,
  .dropzone,
  .review-head,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

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

  table {
    min-width: 720px;
  }

  .panel.table-wrap {
    overflow-x: auto;
  }
}
