:root {
  --bg: #08111f;
  --bg-2: #0d1728;
  --card: rgba(10, 18, 32, 0.78);
  --card-strong: rgba(14, 25, 42, 0.9);
  --line: rgba(255, 255, 255, 0.08);
  --text: #f8fafc;
  --muted: #94a3b8;
  --primary: #7c3aed;
  --primary-2: #4f46e5;
  --success: #10b981;
  --danger: #ef4444;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --toast-bg: rgba(15, 23, 42, 0.95);
}

:root[data-theme="light"] {
  --bg: #eef3fb;
  --bg-2: #dde7f5;
  --card: rgba(255, 255, 255, 0.88);
  --card-strong: rgba(255, 255, 255, 0.92);
  --line: rgba(15, 23, 42, 0.08);
  --text: #0f172a;
  --muted: #475569;
  --primary: #7c3aed;
  --primary-2: #4f46e5;
  --success: #059669;
  --danger: #dc2626;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
  --toast-bg: rgba(255, 255, 255, 0.96);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(124, 58, 237, 0.24), transparent 32%),
    radial-gradient(circle at top right, rgba(16, 185, 129, 0.16), transparent 28%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
}

body {
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom) 0;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

button:active {
  transform: scale(0.98);
}

input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 16px;
  padding: 15px 16px;
  outline: none;
}

:root[data-theme="light"] input {
  background: rgba(15, 23, 42, 0.03);
}

input::placeholder {
  color: rgba(148, 163, 184, 0.72);
}

input:focus {
  border-color: rgba(124, 58, 237, 0.55);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.14);
}

.app-shell {
  width: 100%;
  min-height: 100vh;
}

.app-frame {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: 18px 14px 32px;
}

.screen {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hidden {
  display: none !important;
}

.hero-card,
.card,
.top-card {
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero-card {
  border-radius: 32px;
  padding: 22px 18px 18px;
  margin-top: 8px;
}

.card {
  border-radius: var(--radius-xl);
  padding: 16px;
}

.top-card {
  border-radius: 30px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--card);
}

.auth-hero {
  position: relative;
  overflow: hidden;
}

.theme-toggle-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  min-width: 42px;
  min-height: 42px;
  border-radius: 14px;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 18px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}

.brand-mark {
  width: 62px;
  height: 62px;
  border-radius: 20px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,.22), transparent 35%),
    linear-gradient(135deg, rgba(124,58,237,.30), rgba(79,70,229,.22));
  border: 1px solid var(--line);
  box-shadow:
    0 18px 40px rgba(0,0,0,.18),
    0 0 24px rgba(124,58,237,.12);
}

.brand-roof {
  position: absolute;
  top: 14px;
  width: 26px;
  height: 14px;
  border-top: 4px solid #fff;
  border-left: 4px solid #fff;
  transform: rotate(45deg);
  opacity: .95;
}

.brand-letter {
  position: absolute;
  bottom: 10px;
  left: 23px;
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  line-height: 1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.18);
  color: #ddd6fe;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.hero-card h1 {
  margin: 18px 0 10px;
  font-size: 34px;
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.hero-text {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.5;
}

.auth-form {
  margin-top: 4px;
}

.auth-bottom-action {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.link-btn {
  background: transparent;
  color: var(--muted);
  padding: 0;
  min-height: 32px;
  font-weight: 700;
}

.register-card {
  margin-top: 0;
}

.register-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ghost-btn-small {
  min-height: 40px;
  border-radius: 14px;
  padding: 0 12px;
}

.section-title {
  margin: 0 0 14px;
  font-size: 26px;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.tab-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.tab-btn {
  height: 50px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid transparent;
  font-weight: 600;
}

.tab-btn.active {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.24), rgba(79, 70, 229, 0.22));
  border-color: rgba(124, 58, 237, 0.34);
}

.form-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field span {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.logovo-menu-link {
  min-height: 48px;
  border-radius: 16px;
  font-weight: 700;
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
  box-shadow: 0 14px 30px rgba(79, 70, 229, 0.3);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--line);
}

.ghost-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 0 14px;
}

.large-btn {
  min-height: 54px;
}

.logovo-home-header {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 14px;
}

.logovo-crest {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,.22), transparent 35%),
    linear-gradient(135deg, rgba(124,58,237,.28), rgba(79,70,229,.18));
  border: 1px solid var(--line);
  box-shadow:
    0 18px 40px rgba(0,0,0,.18),
    0 0 24px rgba(124,58,237,.10);
  font-size: 24px;
  flex: 0 0 58px;
}

.logovo-title-wrap {
  min-width: 0;
  flex: 1;
}

.logovo-title-wrap h2 {
  margin: 4px 0 2px;
  font-size: 26px;
  line-height: 1.02;
  letter-spacing: -.04em;
}

.logovo-family-line {
  margin-top: 6px;
  color: rgba(226,232,240,.82);
  font-size: 14px;
  line-height: 1.4;
}

:root[data-theme="light"] .logovo-family-line {
  color: var(--muted);
}

.logovo-me-line {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.label-mini {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.members-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.member-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
}

.member-role {
  color: var(--muted);
  font-weight: 600;
}

.logovo-menu-wrap {
  position: relative;
}

.logovo-menu {
  position: relative;
}

.logovo-menu summary {
  list-style: none;
  min-width: 44px;
  min-height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  color: var(--text);
  cursor: pointer;
  user-select: none;
  font-size: 20px;
}

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

.logovo-menu-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(320px, calc(100vw - 48px));
  padding: 12px;
  border-radius: 18px;
  background: var(--card-strong);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 300;
  display: grid;
  gap: 10px;
}

.menu-invite-code {
  font-size: 20px;
  margin-top: 6px;
}

.logovo-menu-actions {
  display: grid;
  gap: 8px;
}

.logovo-menu-link {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
  text-align: left;
  padding: 0 14px;
  display: flex;
  align-items: center;
}

.logovo-home-card {
  border-radius: 28px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-head h3 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.03em;
}

.logovo-home-links {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.logovo-link-card {
  display: block;
  width: 100%;
  text-align: left;
  text-decoration: none;
  color: inherit;
  padding: 18px;
  border-radius: 24px;
  background: var(--card-strong);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.logovo-link-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.logovo-link-card-title h3 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -.03em;
}

.logovo-link-card small {
  color: var(--muted);
  line-height: 1.5;
  display: block;
}

.logovo-link-badge {
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: rgba(255,255,255,.06);
  color: var(--text);
  white-space: nowrap;
}

.logovo-link-badge-soon {
  background: rgba(124, 58, 237, 0.16);
  color: #c4b5fd;
  border: 1px solid rgba(124, 58, 237, 0.22);
}

:root[data-theme="light"] .logovo-link-badge-soon {
  background: rgba(124, 58, 237, 0.10);
  color: #6d28d9;
  border-color: rgba(124, 58, 237, 0.16);
}

.logovo-link-card-active {
  border-color: rgba(124,58,237,.24);
}

.logovo-link-card-soon {
  opacity: .92;
  cursor: default;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(3, 8, 18, 0.62);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.sheet-backdrop.active {
  display: flex;
}

.sheet-center {
  width: 100%;
  max-width: 620px;
  border-radius: 28px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 16px;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.sheet-title {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -.03em;
}

.sheet-close {
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  border-radius: 14px;
  background: rgba(255,255,255,.05);
  color: var(--text);
  border: 1px solid var(--line);
  font-size: 22px;
  line-height: 1;
  padding: 0;
}

.sheet-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.sheet-actions button {
  flex: 1 1 0;
}

.members-sheet-code {
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  margin-bottom: 12px;
}

.members-invite-code {
  font-size: 22px;
  margin-top: 6px;
}

.members-sheet-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.member-sheet-card {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
}

.member-sheet-name {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
}

.member-sheet-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  min-width: 220px;
  max-width: calc(100vw - 32px);
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--toast-bg);
  color: var(--text);
  box-shadow: var(--shadow);
  text-align: center;
  z-index: 200;
  border: 1px solid var(--line);
}

@media (max-width: 760px) {
  .logovo-home-header {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .logovo-menu-wrap {
    grid-column: 1 / -1;
    justify-self: end;
    margin-top: -52px;
  }
}

@media (max-width: 520px) {
  .app-frame {
    padding: 12px 10px 24px;
  }

  .hero-card h1 {
    font-size: 30px;
  }

  .section-title {
    font-size: 24px;
  }

  .logovo-title-wrap h2 {
    font-size: 24px;
  }

  .sheet-actions {
    flex-direction: column;
  }

  .theme-toggle-btn {
    top: 12px;
    right: 12px;
  }
}

/* ===== menu overlay fix ===== */
#appView,
#appView .top-card,
#appView .logovo-home-header,
#appView .logovo-menu-wrap,
#appView .logovo-menu {
  overflow: visible !important;
}

#appView .top-card {
  position: relative;
  z-index: 80;
}

#appView .logovo-menu-wrap {
  position: relative;
  z-index: 200;
}

#appView .logovo-menu {
  position: relative;
  z-index: 210;
}

#appView .logovo-menu-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 9999;
}

#appView .logovo-home-card {
  position: relative;
  z-index: 1;
}

@media (max-width: 760px) {
  #appView .top-card {
    overflow: visible !important;
  }

  #appView .logovo-menu-wrap {
    margin-top: -52px;
    justify-self: end;
  }

  #appView .logovo-menu-panel {
    right: 0;
    width: min(320px, calc(100vw - 40px));
  }
}
