* { box-sizing: border-box; }

body {
  margin: 0;
  color: #202124;
  background: #f6f7f9;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: #2454d6; }
a:hover { color: #173b79; }

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.header-inner,
.page,
.footer-inner {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
}

header.site-header {
  background: #ffffff;
  border-bottom: 1px solid #dfe3e8;
  padding: 14px 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand strong {
  font-size: 20px;
  line-height: 1.2;
  font-weight: 650;
}

.brand span,
.product-note {
  color: #687281;
  font-size: 12px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-link,
.declaration-link {
  border: 1px solid #c8d1de;
  background: #ffffff;
  color: #244278;
  border-radius: 999px;
  padding: 8px 13px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  font-size: 13px;
}

.nav-link:hover,
.declaration-link:hover {
  background: #f4f7fb;
  border-color: #8ea4c5;
  color: #244278;
}

.nav-link.active {
  background: #2454d6;
  border-color: #2454d6;
  color: #ffffff;
}

.account-menu {
  position: relative;
}

.account-menu summary {
  list-style: none;
  border: 1px solid #c8d1de;
  background: #ffffff;
  color: #244278;
  border-radius: 999px;
  padding: 8px 13px;
  font-weight: 650;
  cursor: pointer;
  font-size: 13px;
}

.account-menu summary::-webkit-details-marker { display: none; }

.account-menu .menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 168px;
  background: #ffffff;
  border: 1px solid #dfe3e8;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(29, 42, 65, 0.12);
  padding: 6px;
  z-index: 20;
}

.account-menu .menu a,
.account-menu .menu button {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: 7px;
  color: #202124;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}

.account-menu .menu a:hover,
.account-menu .menu button:hover {
  background: #f4f7fb;
}

.page {
  padding: 22px 0 40px;
}

.page-title {
  margin: 0;
  font-size: 26px;
  line-height: 1.25;
}

.page-lead {
  margin: 8px 0 18px;
  color: #5b6573;
  font-size: 14px;
  line-height: 1.7;
  max-width: 820px;
}

.banner {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-left: 3px solid #2454d6;
  background: #ffffff;
  border: 1px solid #dce3ed;
  border-left: 3px solid #2454d6;
  border-radius: 8px;
  line-height: 1.7;
  font-size: 14px;
}

.banner.warn {
  border-left-color: #b54708;
  background: #fff8f1;
}

.banner.ok {
  border-left-color: #0f7b5a;
  background: #f2faf6;
}

.grid-3,
.grid-2,
.grid-cards {
  display: grid;
  gap: 12px;
}

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

.card {
  border: 1px solid #dce3ed;
  border-radius: 10px;
  padding: 14px 16px;
  background: #ffffff;
}

.card h2,
.card h3 {
  margin: 0 0 8px;
  color: #173b79;
  font-size: 16px;
}

.card p,
.card ul,
.article p,
.article li {
  margin: 0;
  color: #3d4652;
  font-size: 13px;
  line-height: 1.6;
}

.grid-3 .card {
  padding: 12px 14px;
}

.grid-3 .card h2 {
  font-size: 15px;
}

.action-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.card ul,
.article ul {
  padding-left: 18px;
}

.card ul + p,
.card p + ul {
  margin-top: 8px;
}

.card-link {
  color: inherit;
  text-decoration: none;
  display: block;
}

.card-link:hover {
  border-color: #8ea4c5;
  box-shadow: 0 6px 16px rgba(36, 84, 214, 0.08);
}

.card .meta {
  margin-top: 8px;
  color: #687281;
  font-size: 12px;
}

.data-table-wrap {
  overflow: auto;
  border: 1px solid #dce3ed;
  border-radius: 10px;
  background: #ffffff;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  background: #173b79;
  color: #ffffff;
  text-align: left;
  padding: 11px 14px;
  font-weight: 650;
}

.data-table td {
  padding: 11px 14px;
  border-top: 1px solid #e6ebf2;
  vertical-align: top;
  line-height: 1.6;
}

.data-table tbody tr:nth-child(even) td {
  background: #f7f9fc;
}

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

.article section {
  background: #ffffff;
  border: 1px solid #dce3ed;
  border-radius: 10px;
  padding: 14px 16px;
}

.article h2 {
  margin: 0 0 8px;
  font-size: 16px;
  color: #173b79;
}

.kv {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 12px;
  font-size: 14px;
}

.kv dt { color: #687281; }
.kv dd { margin: 0; color: #202124; }

.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #ffffff;
  border: 1px solid #dce3ed;
  border-radius: 10px;
  padding: 10px 12px;
}

.action-row h3 {
  margin: 0 0 4px;
  font-size: 15px;
  color: #173b79;
}

.action-row p {
  margin: 0;
  color: #5b6573;
  font-size: 13px;
  line-height: 1.6;
}

.btn,
.btn-secondary {
  border: 1px solid #cfd6df;
  border-radius: 7px;
  background: #ffffff;
  cursor: pointer;
  height: 38px;
  padding: 0 14px;
  font-weight: 650;
  font-size: 13px;
  color: #202124;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.btn {
  background: #2454d6;
  border-color: #2454d6;
  color: #ffffff;
}

.btn:disabled,
.btn-secondary:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.btn-danger {
  background: #b42318;
  border-color: #b42318;
  color: #ffffff;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field span {
  font-size: 13px;
  font-weight: 650;
  color: #3d4652;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid #cfd6df;
  border-radius: 7px;
  padding: 10px 12px;
  font: inherit;
  color: #202124;
  background: #ffffff;
}

.field textarea { min-height: 110px; resize: vertical; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: #2454d6;
  box-shadow: 0 0 0 3px rgba(36, 84, 214, 0.12);
}

.inline-fields {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
}

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

.muted {
  color: #687281;
  font-size: 13px;
  line-height: 1.6;
}

.todo-note {
  margin-top: 10px;
  padding: 10px 12px;
  background: #fff8f1;
  border: 1px solid #f3d3b0;
  border-radius: 8px;
  color: #7a3e04;
  font-size: 13px;
  line-height: 1.6;
}

.site-footer {
  border-top: 1px solid #dfe3e8;
  background: #ffffff;
  padding: 14px 0 18px;
  color: #687281;
  font-size: 12px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  line-height: 1.6;
}

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

.footer-links a {
  color: #244278;
  text-decoration: none;
}

.footer-links a:hover { text-decoration: underline; }

.login-gate {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.login-gate[hidden],
.app[hidden] {
  display: none !important;
}

.login-main {
  display: grid;
  place-items: start center;
  padding: 28px 16px 40px;
}

.login-card {
  width: min(560px, 100%);
  background: #ffffff;
  border: 1px solid #dce3ed;
  border-radius: 14px;
  padding: 22px 24px 20px;
  box-shadow: 0 16px 40px rgba(29, 42, 65, 0.08);
}

.login-card h1 {
  margin: 0;
  font-size: 24px;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 16px 0 14px;
}

.tab {
  border: 1px solid #d6dbe2;
  background: #fbfcfd;
  border-radius: 8px;
  height: 38px;
  cursor: pointer;
  font-weight: 650;
}

.tab.active {
  background: #2454d6;
  border-color: #2454d6;
  color: #ffffff;
}

.consent-box {
  margin: 14px 0 12px;
  padding: 12px;
  border: 1px solid #dce3ed;
  border-radius: 10px;
  background: #f7f9fc;
}

.consent-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: #3d4652;
  font-size: 13px;
  line-height: 1.6;
  cursor: pointer;
}

.consent-check input {
  margin-top: 3px;
  accent-color: #2454d6;
}

.login-extra {
  margin: 12px 0 0;
  text-align: center;
  font-size: 13px;
}

.dialog {
  width: min(560px, calc(100vw - 28px));
  border: 0;
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 22px 70px rgba(29, 42, 65, 0.28);
}

.dialog::backdrop { background: rgba(25, 32, 45, 0.5); }

.dialog-body {
  padding: 20px 22px 18px;
}

.dialog-body h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.dialog-close {
  float: right;
  width: 32px;
  height: 32px;
  border: 1px solid #d6dbe2;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
}

.status {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.6;
}

.status.error { color: #b42318; }
.status.ok { color: #0f7b5a; }

@media (max-width: 900px) {
  .grid-3,
  .grid-2,
  .grid-cards,
  .action-list { grid-template-columns: 1fr; }
  .action-row { align-items: flex-start; flex-direction: column; }
  .kv { grid-template-columns: 1fr; }
  .header-inner { align-items: flex-start; }
}
