:root {
  --ink: #17231f;
  --muted: #65746d;
  --surface: #ffffff;
  --canvas: #f3f7f5;
  --line: #dce7e1;
  --brand: #79b82a;
  --brand-dark: #4f7d18;
  --forest: #173f34;
  --accent: #ef7d52;
  --danger: #b42318;
  --shadow: 0 18px 48px rgba(23, 63, 52, 0.14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; min-height: 100vh; background: var(--canvas); }
.public-page { overflow-x: hidden; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
[hidden] { display: none !important; }

.site-header,
.app-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px clamp(16px, 4vw, 56px);
  background: rgba(255,255,255,0.98);
  border-bottom: 1px solid var(--line);
}

.site-header { justify-content: space-between; }
.brand { display: inline-flex; align-items: center; flex: 0 0 auto; text-decoration: none; }
.brand img { display: block; width: 154px; height: 48px; object-fit: contain; object-position: left center; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.language-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #fff; }
.language-switch a { min-width: 38px; padding: 8px 9px; color: var(--muted); text-align: center; text-decoration: none; font-size: 13px; font-weight: 700; }
.language-switch a.active { background: var(--forest); color: #fff; }

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 9px 18px;
  cursor: pointer;
  font-weight: 750;
  text-decoration: none;
  transition: background-color .16s ease, color .16s ease, border-color .16s ease, opacity .16s ease;
}
.button:disabled { cursor: not-allowed; opacity: .55; }
.button-primary { background: var(--brand); color: #15230b; border-color: var(--brand); }
.button-primary:hover:not(:disabled) { background: #8acb37; }
.button-secondary { background: #fff; color: var(--forest); border-color: #b9ccc2; }
.button-secondary:hover { border-color: var(--forest); }
.button-light { background: #fff; color: var(--forest); border-color: #fff; }
.button-large { min-height: 50px; padding: 12px 24px; }
.button-compact { min-height: 36px; padding: 7px 12px; font-size: 13px; }
.button.is-loading { color: transparent; position: relative; pointer-events: none; }
.button.is-loading::after { content: ""; position: absolute; width: 18px; height: 18px; border: 2px solid rgba(23,35,31,.25); border-top-color: currentColor; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.hero {
  min-height: min(740px, calc(100vh - 118px));
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr);
  align-items: center;
  gap: clamp(36px, 7vw, 110px);
  overflow: hidden;
  padding: clamp(56px, 8vw, 112px) clamp(20px, 7vw, 104px);
  background: var(--forest);
  color: #fff;
}
.hero-content { min-width: 0; max-width: 760px; position: relative; z-index: 1; }
.brand-name { margin: 0 0 18px; color: var(--brand); font-size: 18px; font-weight: 800; text-transform: uppercase; }
.hero h1 { max-width: 720px; margin: 0; font-size: 68px; line-height: 1.02; font-weight: 850; letter-spacing: 0; }
.hero-copy { max-width: 660px; margin: 26px 0 0; color: #dce9e3; font-size: 20px; line-height: 1.55; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.hero-logo { width: min(38vw, 520px); max-height: 520px; justify-self: center; object-fit: contain; filter: drop-shadow(0 24px 34px rgba(0,0,0,.18)); }

.site-footer { min-height: 46px; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 18px; padding: 12px 20px; background: #fff; color: var(--muted); border-top: 1px solid var(--line); font-size: 13px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--forest); }

.modal-backdrop { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px; overflow-y: auto; background: rgba(10, 24, 19, .72); }
.auth-modal { position: relative; width: min(100%, 480px); max-height: calc(100vh - 40px); overflow-y: auto; padding: 26px; border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.modal-close { position: absolute; top: 12px; right: 12px; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 28px; line-height: 1; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 10px 38px 24px 0; border-bottom: 1px solid var(--line); }
.auth-tabs button { border: 0; border-bottom: 3px solid transparent; padding: 12px 8px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 750; }
.auth-tabs button.active { color: var(--forest); border-bottom-color: var(--brand); }
.auth-form { display: grid; gap: 16px; }
.auth-form h2 { margin: 0 0 2px; font-size: 25px; }
.auth-form label { display: grid; gap: 7px; color: #2e453c; font-size: 13px; font-weight: 700; }
.auth-form input:not([type="checkbox"]) { width: 100%; min-height: 46px; border: 1px solid #b9c9c1; border-radius: 6px; padding: 10px 12px; color: var(--ink); background: #fff; outline: none; }
.auth-form input:focus { border-color: var(--brand-dark); box-shadow: 0 0 0 3px rgba(121,184,42,.17); }
.password-field { display: grid; grid-template-columns: 1fr auto; border: 1px solid #b9c9c1; border-radius: 6px; overflow: hidden; background: #fff; }
.password-field:focus-within { border-color: var(--brand-dark); box-shadow: 0 0 0 3px rgba(121,184,42,.17); }
.password-field input { border: 0 !important; box-shadow: none !important; }
.password-toggle { border: 0; border-left: 1px solid var(--line); padding: 0 12px; background: #f7faf8; color: var(--forest); cursor: pointer; font-size: 12px; font-weight: 700; }
.checkbox-row { grid-template-columns: 20px 1fr !important; align-items: start; font-weight: 500 !important; line-height: 1.45; }
.checkbox-row input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--brand-dark); }
.form-submit { width: 100%; }
.text-button { justify-self: center; border: 0; background: transparent; color: var(--brand-dark); cursor: pointer; font-weight: 750; }
.form-message { min-height: 0; margin-bottom: 0; }
.form-message:not(:empty) { margin-bottom: 16px; border-left: 4px solid var(--accent); padding: 11px 12px; background: #fff5ef; color: #70341c; font-size: 14px; line-height: 1.45; }
.form-message.success:not(:empty) { border-left-color: var(--brand); background: #f2f9e8; color: #325210; }
.notice { margin: 0; border-left: 4px solid var(--accent); padding: 10px 12px; background: #fff5ef; color: #70341c; font-size: 14px; }
.code-input { min-height: 62px !important; text-align: center; font-size: 30px !important; font-weight: 800; letter-spacing: 10px !important; }

.app-header { position: sticky; top: 0; z-index: 50; }
.header-search { flex: 1 1 520px; max-width: 700px; margin: 0 auto; }
.header-search input { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 6px; padding: 9px 14px; background: var(--canvas); outline: none; }
.header-search input:focus { border-color: var(--brand-dark); background: #fff; }
.app-account { display: flex; align-items: center; gap: 12px; }
.account-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 750; }
.realtime-status { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.realtime-status i { width: 9px; height: 9px; border-radius: 50%; background: #a5aea9; }
.realtime-status.online i { background: #41b84b; box-shadow: 0 0 0 3px rgba(65,184,75,.15); }
.app-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 73px); }
.app-sidebar { position: sticky; top: 73px; height: calc(100vh - 73px); display: flex; flex-direction: column; gap: 6px; padding: 22px 14px; background: #fff; border-right: 1px solid var(--line); }
.app-sidebar a { padding: 11px 14px; border-radius: 6px; color: var(--muted); text-decoration: none; font-weight: 700; }
.app-sidebar a:hover, .app-sidebar a.active { background: #edf6e2; color: #31530e; }
.feed { width: min(100%, 1260px); margin: 0 auto; padding: 30px clamp(18px, 4vw, 52px) 60px; }
.feed-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.feed-heading h1 { margin: 0; font-size: 30px; }
.publication-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 340px)); justify-content: center; gap: 20px; }
.publication-card { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.publication-card > img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.publication-content { padding: 18px; }
.publication-content h2 { margin: 5px 0 8px; font-size: 20px; line-height: 1.25; }
.publication-content > p:last-child { margin: 0; color: var(--muted); line-height: 1.5; }
.publication-meta { margin: 0; color: var(--brand-dark); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.empty-state { grid-column: 1 / -1; margin: 40px auto; color: var(--muted); text-align: center; }

.legal-page { padding: 24px; }
.legal-page main { width: min(100%, 800px); margin: 40px auto; padding: clamp(22px, 5vw, 52px); border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.legal-page h1 { margin: 28px 0 20px; }
.legal-page p { color: #46584f; line-height: 1.75; }
.legal-brand { color: var(--brand-dark); font-size: 22px; font-weight: 850; text-decoration: none; }

@media (max-width: 820px) {
  .site-header { align-items: flex-start; }
  .brand img { width: 122px; height: 42px; }
  .header-actions { flex-wrap: wrap; gap: 7px; }
  .header-actions .button { min-height: 38px; padding: 7px 11px; font-size: 13px; }
  .hero { min-height: calc(100vh - 118px); grid-template-columns: 1fr; padding-top: 58px; }
  .hero-logo { grid-row: 1; width: min(62vw, 330px); max-height: 250px; }
  .hero-content { grid-row: 2; text-align: center; }
  .hero h1 { font-size: 46px; }
  .hero-actions { justify-content: center; }
  .app-header { flex-wrap: wrap; gap: 10px; padding: 9px 14px; }
  .header-search { order: 3; flex-basis: 100%; max-width: none; }
  .account-name { display: none; }
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar { position: fixed; inset: auto 0 0 0; z-index: 60; height: 58px; flex-direction: row; justify-content: space-around; padding: 7px 10px; border: 1px solid var(--line); }
  .app-sidebar a { flex: 1; padding: 10px 6px; text-align: center; font-size: 13px; }
  .feed { padding-bottom: 90px; }
}

@media (max-width: 520px) {
  .site-header { min-height: 104px; flex-wrap: wrap; align-items: center; justify-content: center; padding: 8px 12px; }
  .site-header .brand { flex: 0 0 100%; justify-content: center; }
  .site-header .brand img { width: 120px; height: 34px; object-position: center; }
  .site-header .header-actions { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
  .site-header .header-actions .button { width: 100%; min-width: 0; white-space: normal; line-height: 1.15; }
  .language-switch { order: 0; }
  .hero h1 { font-size: 40px; overflow-wrap: anywhere; }
  .hero { gap: 28px; padding: 36px 18px 52px; }
  .hero-logo { width: min(70vw, 260px); }
  .hero-actions { display: grid; grid-template-columns: 1fr; }
  .hero-actions .button { width: 100%; }
  .auth-modal { padding: 22px 18px; }
  .modal-backdrop { padding: 10px; }
  .auth-tabs { margin-right: 34px; }
  .app-account .button { padding-inline: 9px; }
  .realtime-status span { display: none; }
  .publication-grid { grid-template-columns: minmax(0, 1fr); }
}

