:root {
  --bg: #e8eef2;
  --bg-deep: #0f2a33;
  --surface: #f7fafb;
  --ink: #14242b;
  --muted: #5a7079;
  --accent: #1a7a6d;
  --accent-dark: #125f55;
  --line: #c5d4db;
  --danger: #b42318;
  --ok: #1a7a6d;
  --shadow: 0 18px 50px rgba(15, 42, 51, 0.12);
  --radius: 14px;
  --font: "Segoe UI", "Source Sans 3", system-ui, sans-serif;
  --display: "Segoe UI Semibold", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(26, 122, 109, 0.18), transparent 55%),
    radial-gradient(900px 420px at 100% 0%, rgba(15, 42, 51, 0.14), transparent 50%),
    linear-gradient(180deg, #f4f8f9 0%, var(--bg) 100%);
  min-height: 100vh;
}

a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid rgba(197, 212, 219, 0.7);
  backdrop-filter: blur(8px);
  background: rgba(247, 250, 251, 0.72);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--bg-deep);
}

.nav-actions { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.65rem 1.15rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}
.btn-danger {
  background: #fff;
  border-color: #f0b4ae;
  color: var(--danger);
}

.hero {
  min-height: calc(100vh - 74px);
  display: grid;
  align-items: center;
  padding: 2.5rem 1.5rem 3.5rem;
  max-width: 1100px;
  margin: 0 auto;
}

.hero-inner {
  max-width: 640px;
  animation: rise 0.7s ease both;
}

.hero h1 {
  font-family: var(--display);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
  color: var(--bg-deep);
}

.hero p {
  font-size: 1.12rem;
  line-height: 1.55;
  color: var(--muted);
  margin: 0 0 1.6rem;
  max-width: 38ch;
}

.hero-cta { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.price-pill {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 1.4rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: rgba(26, 122, 109, 0.1);
  color: var(--accent-dark);
  font-weight: 600;
}
.price-pill strong { font-size: 1.25rem; }

.price-offer-badge {
  display: inline-block;
  margin-right: 0.25rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: #c62828;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.price-list {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.95em;
}

.price-now {
  font-weight: 800;
}

.section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem 3.5rem;
}

.section h2 {
  font-family: var(--display);
  font-size: 1.6rem;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}

.section > p {
  color: var(--muted);
  margin: 0 0 1.5rem;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.module-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease;
  animation: rise 0.6s ease both;
}
.module-tile.is-locked {
  opacity: 0.78;
  cursor: not-allowed;
  background: #f8fafc;
}
.module-tile.is-locked:hover { transform: none; }
.module-tile.is-locked h3 {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.module-tile p { margin: 0; color: var(--muted); font-size: 0.95rem; line-height: 1.45; }
.module-tile .count {
  margin-top: 0.9rem;
  font-size: 0.85rem;
  color: var(--accent-dark);
  font-weight: 600;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.5rem 0;
}
.auth-page .panel {
  margin: auto;
}
.auth-page .site-footer {
  margin-top: auto;
  padding: 1.25rem 0 1.5rem;
}

.app-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

body.app-hub {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.app-hub > .site-header,
body.app-hub > #impersonate-banner:not(.hidden) {
  flex: 0 0 auto;
}

body.app-hub > .app-shell,
body.app-hub > main.app-shell {
  flex: 1 1 auto;
  width: 100%;
  box-sizing: border-box;
}

body.app-hub > .site-footer,
body.app-hub .site-footer--app {
  flex: 0 0 auto;
  margin-top: auto;
  width: 100%;
  box-sizing: border-box;
}

.site-footer--app {
  background: rgba(247, 250, 251, 0.92);
}

.site-footer {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem 0.65rem;
  padding: 1.5rem;
  font-size: 0.88rem;
  color: var(--muted);
  border-top: 1px solid rgba(197, 212, 219, 0.65);
}
.site-footer-company {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.4;
  text-align: center;
  color: var(--muted);
}
.site-footer-company a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.12em;
}
.site-footer-company a:hover {
  color: var(--accent-dark);
}
.site-footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem 0.65rem;
}
.site-footer span { opacity: 0.5; }

.site-footer-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1rem;
  margin-top: 0.85rem;
}

.anpc-sal-badge {
  display: inline-flex;
  align-items: stretch;
  width: 250px;
  max-width: 100%;
  height: 50px;
  box-sizing: border-box;
  border: 2px solid #0b3d91;
  border-radius: 4px;
  overflow: hidden;
  text-decoration: none;
  background: #fff;
  color: #0b3d91;
  line-height: 1.15;
}

.anpc-sal-badge:hover {
  opacity: 0.92;
}

.anpc-sal-badge__mark {
  flex: 0 0 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0b3d91;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.anpc-sal-badge__text {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.1rem;
  padding: 0 0.55rem;
  min-width: 0;
}

.anpc-sal-badge__text strong {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.anpc-sal-badge__text span {
  font-size: 0.62rem;
  font-weight: 500;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.legal-company {
  margin: 0.75rem 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(247, 250, 251, 0.85);
}
.legal-company p {
  margin: 0 0 0.45rem;
}
.legal-company ul {
  margin: 0;
  padding-left: 1.15rem;
}
.legal-company li + li {
  margin-top: 0.25rem;
}

.legal-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  line-height: 1.55;
}
.legal-page h1 {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
}
.legal-meta {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.92rem;
}
.legal-page section {
  margin-bottom: 1.35rem;
}
.legal-page h2 {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
}
.legal-page p,
.legal-page ul {
  margin: 0.35rem 0 0;
  color: var(--ink);
}
.legal-page ul {
  padding-left: 1.25rem;
}
.legal-page li + li { margin-top: 0.25rem; }

.consent-check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0.65rem 0 0.85rem;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--muted);
  cursor: pointer;
}
.consent-check input[type="checkbox"] {
  width: auto;
  min-width: 1.05rem;
  height: 1.05rem;
  margin: 0.2rem 0 0;
  padding: 0;
  flex: 0 0 auto;
  accent-color: var(--accent);
}
.consent-check span {
  flex: 1 1 auto;
  min-width: 0;
}

.panel {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.6rem;
  box-shadow: var(--shadow);
  animation: rise 0.55s ease both;
}

.panel h1 {
  margin: 0 0 0.35rem;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
}

.panel .subtitle {
  margin: 0 0 1.2rem;
  color: var(--muted);
  font-size: 0.98rem;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-bottom: 1rem;
  background: #eef3f5;
  padding: 0.3rem;
  border-radius: 999px;
}
.tab {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 0.55rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
}
.tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(15, 42, 51, 0.08);
}

label {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  font-size: 0.92rem;
  font-weight: 600;
}
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }

.form-actions { margin-top: 0.4rem; }
.form-actions .btn { width: 100%; }

.error {
  color: var(--danger);
  min-height: 1.2rem;
  margin: 0.7rem 0 0;
  font-size: 0.92rem;
}
.note { color: var(--muted); font-size: 0.9rem; margin: 0.9rem 0 0; }
.hidden { display: none !important; }

.app-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 3rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: rgba(26, 122, 109, 0.12);
  color: var(--accent-dark);
  font-size: 0.88rem;
  font-weight: 600;
}
.status-chip.warn {
  background: rgba(180, 35, 24, 0.1);
  color: var(--danger);
}

.cabinet-switcher {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  margin-top: 0.55rem;
}
.cabinet-switcher.is-compact {
  margin-top: 0.35rem;
}
.cabinet-switcher-label {
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--muted, #64748b);
  letter-spacing: 0.02em;
}
.cabinet-switcher-select {
  min-width: 11rem;
  max-width: min(100%, 18rem);
  border: 1px solid var(--line, #d0d7de);
  border-radius: 999px;
  padding: 0.38rem 0.85rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent-dark, #145a50);
  background: rgba(26, 122, 109, 0.08);
  cursor: pointer;
}
.cabinet-switcher-select:disabled {
  opacity: 0.65;
  cursor: wait;
}
.cabinet-switcher-note {
  flex: 1 1 100%;
  font-size: 0.82rem;
  color: var(--muted, #64748b);
}
.cabinet-switcher.is-switching .cabinet-switcher-select {
  opacity: 0.7;
}

.list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}
.list-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.95rem 1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}
.list-item h3 { margin: 0 0 0.25rem; font-size: 1rem; }
.list-item p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.meta { font-size: 0.8rem; color: var(--muted); margin-top: 0.35rem; }

.compose {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}

.viewer-banner {
  background: #7a4b12;
  color: #fff8ef;
  padding: 0.65rem 1.2rem;
  font-size: 0.92rem;
}

body.viewer-mode input:not([data-viewer-allow]),
body.viewer-mode textarea:not([data-viewer-allow]),
body.viewer-mode select:not([data-viewer-allow]),
body.viewer-mode button:not([data-viewer-allow]):not(#logout-btn):not(#exit-impersonate),
body.viewer-mode .btn-danger:not([data-viewer-allow]),
body.viewer-mode form:not([data-viewer-allow]) button[type="submit"] {
  pointer-events: none !important;
  opacity: 0.55;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
  .hero { padding-top: 2rem; }
  .list-item { flex-direction: column; }
}
