:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --text: #111827;
  --muted: #607086;
  --line: #d9e0ea;
  --brand: #155e75;
  --brand-strong: #0f3f52;
  --accent: #b45309;
  --danger: #b91c1c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 28px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 18px;
  margin-right: auto;
}

.topnav a {
  padding: 8px 10px;
  border-radius: 6px;
  color: #334155;
  font-weight: 700;
  font-size: 13px;
}

.topnav a:hover {
  background: #eef6f8;
  text-decoration: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: var(--brand);
  color: #fff;
  border-radius: 6px;
  font-weight: 700;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 1px;
}

.shell {
  width: min(1380px, calc(100% - 32px));
  margin: 24px auto 48px;
}

.login-panel {
  max-width: 430px;
  margin: 8vh auto 0;
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

.public-head {
  max-width: 920px;
  margin: 0 auto 18px;
}

.public-head h1 {
  font-size: 30px;
}

.public-form {
  display: grid;
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
}

p {
  margin: 8px 0 0;
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

label,
.field {
  display: grid;
  gap: 7px;
  color: #344256;
  font-size: 13px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 400;
}

textarea {
  resize: vertical;
}

button,
.button,
.small-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--brand);
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

button:hover,
.button:hover,
.small-btn:hover {
  background: var(--brand-strong);
  text-decoration: none;
}

.strong {
  border-color: var(--accent);
  background: var(--accent);
}

.secondary,
.ghost {
  background: #fff;
  color: var(--brand);
}

.ghost {
  min-height: 34px;
  padding: 7px 11px;
}

.danger {
  border-color: var(--danger);
  color: var(--danger);
}

.danger:hover {
  background: #fee2e2;
}

.small-btn {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 13px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.split {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
  align-items: start;
}

.section-gap {
  margin-top: 18px;
}

.panel,
.nav-panel,
.wizard-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel {
  padding: 20px;
}

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 18px;
  align-items: start;
}

.nav-panel {
  position: sticky;
  top: 84px;
  display: grid;
  gap: 4px;
  padding: 16px;
}

.nav-panel strong {
  margin-bottom: 8px;
}

.nav-panel a {
  padding: 8px 9px;
  border-radius: 6px;
  color: #334155;
}

.nav-panel a:hover {
  background: #eef6f8;
  text-decoration: none;
}

.main-panel {
  display: grid;
  gap: 18px;
}

.wizard {
  display: grid;
  gap: 18px;
}

.wizard-section {
  padding: 20px;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.section-title p {
  max-width: 520px;
  text-align: right;
  font-size: 13px;
}

.fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.wide {
  grid-column: span 3;
}

.savebar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 -10px 28px rgba(15, 23, 42, 0.08);
}

.savebar span {
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 14px;
}

.table-wrap.compact table {
  min-width: 0;
}

.table-wrap.compact th {
  width: 210px;
  text-transform: none;
  font-size: 13px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: #475569;
  font-size: 12px;
  text-transform: uppercase;
}

.doc-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 14px 0 0;
  list-style: none;
}

.file-list {
  display: grid;
  gap: 8px;
  padding-left: 18px;
}

.file-list small {
  color: var(--muted);
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-weight: 400;
  color: var(--text);
}

.checkbox input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
}

.doc-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdff;
}

.doc-list small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.error,
.flash {
  padding: 11px 12px;
  border-radius: 6px;
  margin: 12px 0;
}

.error {
  background: #fee2e2;
  color: #991b1b;
}

.flash {
  background: #e0f2fe;
  color: #075985;
}

@media (max-width: 980px) {
  .topbar {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
  }

  .topnav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    margin: 0;
  }

  .split,
  .layout {
    grid-template-columns: 1fr;
  }

  .nav-panel {
    position: static;
  }

  .fields {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: span 1;
  }

  .page-head,
  .section-title,
  .savebar {
    align-items: stretch;
    flex-direction: column;
  }

  .section-title p {
    text-align: left;
  }
}
