: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:hover { transform: translateY(-3px); }
.module-tile h3 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.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, .app-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.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);
}

.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; }
}
