/* Unified responsive and navigation stylesheet */

.mobile-nav-toggle,
.mobile-drawer-backdrop,
.public-nav-toggle,
.public-drawer-backdrop {
  display: none;
}

@media (max-width: 1120px) {
  .site-header {
    position: sticky;
    top: 0;
    z-index: 59;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    row-gap: 8px;
  }

  .public-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid var(--line);
    background: #121922f2;
    color: var(--text);
    border-radius: 10px;
    padding: 8px 12px;
    font-weight: 700;
    cursor: pointer;
  }

  .public-drawer-backdrop {
    display: none;
  }

  .site-header .site-nav {
    grid-column: 1 / -1;
    position: static;
    transform: none;
    width: 100%;
    max-height: none;
    overflow: visible;
    border-right: 0;
    padding: 4px 0 0;
    background: transparent;
    box-shadow: none;
    display: none;
    grid-template-columns: 1fr;
    gap: 8px;
    white-space: normal;
  }

  .site-header.nav-open .site-nav {
    display: grid;
  }

  .site-header .site-nav a {
    text-align: left;
    min-height: 44px;
    display: flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
    background: #121922d9;
    font-size: 0.84rem;
  }

  .cta-group,
  .cta-link {
    white-space: nowrap;
  }

  .mobile-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    border: 1px solid var(--line);
    background: #121922f2;
    color: var(--text);
    border-radius: 10px;
    padding: 10px 12px;
    font-weight: 700;
    cursor: pointer;
    position: fixed;
    left: 12px;
    top: 12px;
    z-index: 62;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  }

  .mobile-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(4, 8, 14, 0.26);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
    z-index: 60;
  }

  body.drawer-open .mobile-drawer-backdrop {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  body.drawer-open .mobile-nav-toggle {
    opacity: 0;
    pointer-events: none;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell .side-nav {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(84vw, 330px);
    height: 100dvh;
    z-index: 61;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    margin: 0;
    border-radius: 0;
    overflow-y: auto;
    padding: 16px 12px 14px;
    transform: translateX(-104%);
    transition: transform 0.24s ease;
    box-shadow: 0 24px 42px rgba(2, 6, 18, 0.7);
    background:
      radial-gradient(circle at 90% 8%, rgba(0, 209, 255, 0.12), transparent 36%),
      linear-gradient(180deg, #111a27 0%, #0d1420 58%, #0a1019 100%);
    gap: 12px;
  }

  body.drawer-open .app-shell .side-nav {
    transform: translateX(0);
  }

  .app-shell .workspace {
    padding-top: 64px;
    transform: none;
  }

  body.drawer-open .app-shell .workspace {
    transform: none;
  }

  body.drawer-open {
    overflow-x: hidden;
  }

  .app-shell .mobile-quick-nav,
  .app-shell .side-nav .mobile-quick-nav {
    display: none;
  }

  .app-shell .side-nav .brand-block {
    border: 1px solid rgba(157, 176, 200, 0.2);
    border-radius: 12px;
    background: rgba(10, 16, 25, 0.66);
    padding: 10px;
  }

  .app-shell .side-nav .menu-title {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: #8fa8c5;
    margin: 6px 4px 2px;
  }

  .app-shell .side-nav .menu-group {
    display: grid;
    gap: 7px;
  }

  .app-shell .side-nav .menu-item {
    border: 1px solid rgba(157, 176, 200, 0.22);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(16, 27, 40, 0.92), rgba(11, 18, 28, 0.92));
    min-height: 54px;
    padding: 11px 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: border-color 0.22s ease, background 0.22s ease, box-shadow 0.22s ease, transform 0.2s ease;
  }

  .app-shell .side-nav .menu-item svg {
    width: 17px;
    height: 17px;
    color: #79e7ff;
    flex: 0 0 auto;
  }

  .app-shell .side-nav .menu-copy {
    gap: 1px;
  }

  .app-shell .side-nav .menu-label {
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.25;
    color: #eaf2ff;
  }

  .app-shell .side-nav .menu-hint {
    display: block;
    font-size: 0.73rem;
    line-height: 1.2;
    color: #8ea3be;
  }

  .app-shell .side-nav .menu-item:hover,
  .app-shell .side-nav .menu-item.active {
    border-color: rgba(0, 209, 255, 0.62);
    background: linear-gradient(180deg, rgba(15, 39, 56, 0.96), rgba(9, 24, 37, 0.96));
    box-shadow: 0 8px 20px rgba(0, 209, 255, 0.14), inset 0 1px 0 rgba(164, 240, 255, 0.18);
    transform: translateY(-1px);
  }

  .app-shell .side-nav .menu-item.btn-info {
    border-color: rgba(0, 209, 255, 0.5);
    background: linear-gradient(180deg, rgba(0, 209, 255, 0.2), rgba(0, 137, 176, 0.15));
    color: #d5f7ff;
  }

  .app-shell .side-nav .menu-item.btn-danger {
    border-color: rgba(255, 122, 122, 0.58);
    background: linear-gradient(180deg, rgba(255, 107, 107, 0.22), rgba(110, 35, 35, 0.22));
    color: #ffe1e1;
  }

  body.role-investor .app-shell .side-nav {
    background:
      radial-gradient(circle at 14% 6%, rgba(124, 92, 255, 0.2), transparent 35%),
      radial-gradient(circle at 88% 12%, rgba(31, 172, 255, 0.18), transparent 34%),
      linear-gradient(180deg, #10162a 0%, #0b1223 58%, #090f1b 100%);
    border-right: 1px solid rgba(143, 170, 255, 0.24);
    box-shadow: 0 24px 42px rgba(2, 6, 18, 0.7), inset -1px 0 0 rgba(157, 189, 255, 0.15);
  }

  body.role-investor .app-shell .side-nav .brand-block {
    background: linear-gradient(180deg, rgba(22, 33, 58, 0.88), rgba(14, 21, 40, 0.88));
    border: 1px solid rgba(154, 176, 255, 0.3);
  }

  body.role-investor .app-shell .side-nav .menu-title {
    color: #9fb6ff;
    letter-spacing: 0.1em;
  }

  body.role-investor .app-shell .side-nav .menu-item {
    border: 1px solid rgba(130, 156, 255, 0.28);
    background: linear-gradient(180deg, rgba(22, 34, 59, 0.94), rgba(14, 23, 41, 0.94));
  }

  body.role-investor .app-shell .side-nav .menu-item svg {
    color: #9cc1ff;
  }

  body.role-investor .app-shell .side-nav .menu-label {
    color: #edf3ff;
  }

  body.role-investor .app-shell .side-nav .menu-hint {
    color: #9fb0d9;
  }

  body.role-investor .app-shell .side-nav .menu-item:hover,
  body.role-investor .app-shell .side-nav .menu-item.active {
    border-color: rgba(113, 151, 255, 0.72);
    background: linear-gradient(180deg, rgba(39, 56, 95, 0.95), rgba(27, 43, 76, 0.95));
    box-shadow: 0 12px 24px rgba(61, 103, 255, 0.22), inset 0 1px 0 rgba(173, 196, 255, 0.24);
  }
}

@media (max-width: 900px) {
  .workspace {
    padding: 12px;
  }

  .top-bar h1 {
    font-size: 1.24rem;
    line-height: 1.3;
  }

  .top-bar p,
  .panel-hint,
  .panel-list,
  .content-section > p,
  .content-card p {
    font-size: 0.95rem;
    line-height: 1.55;
  }

  .menu-item,
  .finance-mode-btn,
  .chip,
  .login-btn,
  .site-nav a,
  .cta-link,
  .ghost-btn,
  .toast-close {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .chip {
    padding: 8px 11px;
    border-radius: 999px;
  }

  .role-badge,
  .article-tag,
  .mode-active-note,
  .panel-label,
  .menu-hint {
    font-size: 0.75rem;
  }

  .panel,
  .content-card,
  .auth-card,
  .toast {
    border-radius: 10px;
  }

  .panel-head {
    flex-wrap: wrap;
  }

  .panel-head span {
    font-size: 0.78rem;
  }

  .data-table {
    font-size: 0.84rem;
  }

  .data-table th,
  .data-table td {
    padding: 9px 7px;
    vertical-align: top;
  }

  .data-table.mobile-cards td {
    grid-template-columns: 96px 1fr;
    gap: 6px;
  }

  .table-wrap {
    -webkit-overflow-scrolling: touch;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .app-shell .side-nav {
    width: min(88vw, 334px);
    padding: 14px 10px 12px;
  }

  .app-shell .side-nav .menu-item {
    min-height: 50px;
    padding: 10px 11px;
  }

  .app-shell .side-nav .menu-label {
    font-size: 0.83rem;
  }

  .app-shell .side-nav .menu-hint {
    font-size: 0.7rem;
  }

  .site-header {
    padding: 12px 12px 10px;
    grid-template-columns: 1fr;
  }

  .site-brand img {
    width: 32px;
    height: 32px;
  }

  .site-brand p {
    font-size: 0.95rem;
    line-height: 1.1;
  }

  .site-brand span {
    font-size: 0.72rem;
  }

  .site-nav a {
    font-size: 0.78rem;
    padding: 8px 5px;
  }

  .cta-group {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .cta-group .cta-link,
  .cta-group .ghost-btn,
  .site-header > .cta-link {
    width: 100%;
    justify-content: center;
    text-align: center;
    padding: 9px 8px;
    font-size: 0.84rem;
  }

  .top-user {
    justify-items: start;
  }

  .panel-head {
    align-items: flex-start;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .workspace {
    padding: 10px;
  }

  .panel,
  .content-card {
    padding: 11px;
  }

  .kpi-grid,
  .metric-strip,
  .fact-grid,
  .home-mini-grid {
    grid-template-columns: 1fr;
  }

  .top-bar h1 {
    font-size: 1.14rem;
  }

  .panel h2,
  .content-section h2 {
    font-size: 1.2rem;
    line-height: 1.3;
  }

  .panel-head h3,
  .card-head h3 {
    font-size: 0.98rem;
    line-height: 1.3;
  }

  .data-table {
    font-size: 0.8rem;
  }

  .data-table.mobile-cards td {
    grid-template-columns: 88px 1fr;
  }

  .chip,
  .menu-item,
  .finance-mode-btn,
  .login-btn,
  .site-nav a,
  .cta-link,
  .ghost-btn {
    font-size: 0.8rem;
  }

  .sync-badge,
  .mode-active-note,
  .panel-label,
  .menu-label,
  .menu-hint {
    line-height: 1.35;
  }
}

@media (min-width: 1121px) {
  body.role-investor .app-shell {
    grid-template-columns: 320px 1fr;
  }

  body.role-investor .app-shell .side-nav {
    position: sticky;
    top: 0;
    height: 100dvh;
    padding: 18px 16px;
    background:
      radial-gradient(circle at 20% 8%, rgba(124, 92, 255, 0.18), transparent 34%),
      radial-gradient(circle at 88% 14%, rgba(31, 172, 255, 0.14), transparent 33%),
      linear-gradient(180deg, #11182d 0%, #0c1426 55%, #09101f 100%);
    border-right: 1px solid rgba(145, 170, 248, 0.2);
    box-shadow: inset -1px 0 0 rgba(162, 186, 255, 0.08);
    gap: 12px;
  }

  body.role-investor .app-shell .side-nav .brand-block {
    border: 1px solid rgba(145, 170, 248, 0.3);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(24, 35, 62, 0.86), rgba(15, 24, 44, 0.86));
    padding: 12px;
  }

  body.role-investor .app-shell .side-nav .menu-title {
    color: #9eb4ff;
    letter-spacing: 0.11em;
    margin: 8px 6px 4px;
  }

  body.role-investor .app-shell .side-nav .menu-group {
    gap: 8px;
  }

  body.role-investor .app-shell .side-nav .menu-item {
    min-height: 56px;
    border-radius: 13px;
    border: 1px solid rgba(125, 154, 237, 0.28);
    background: linear-gradient(180deg, rgba(21, 33, 59, 0.9), rgba(14, 22, 40, 0.9));
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  }

  body.role-investor .app-shell .side-nav .menu-item svg {
    color: #9abfff;
  }

  body.role-investor .app-shell .side-nav .menu-label {
    font-size: 0.9rem;
    color: #eef4ff;
  }

  body.role-investor .app-shell .side-nav .menu-hint {
    color: #9aaed4;
    font-size: 0.75rem;
  }

  body.role-investor .app-shell .side-nav .menu-item:hover,
  body.role-investor .app-shell .side-nav .menu-item.active {
    transform: translateY(-1px);
    border-color: rgba(112, 149, 255, 0.72);
    background: linear-gradient(180deg, rgba(41, 57, 97, 0.94), rgba(28, 41, 71, 0.94));
    box-shadow: 0 10px 24px rgba(55, 99, 255, 0.2), inset 0 1px 0 rgba(182, 206, 255, 0.24);
  }
}

/* Public visual polish */
.public-shell {
  background:
    radial-gradient(circle at 8% 0%, rgba(0, 209, 255, 0.08), transparent 34%),
    radial-gradient(circle at 92% 4%, rgba(212, 175, 55, 0.1), transparent 35%),
    linear-gradient(180deg, #0b0f14 0%, #0b1119 45%, #0a0f17 100%);
}

.hero-section,
.content-section,
.home-dense {
  width: min(1240px, 100%);
}

.site-header {
  border-bottom: 1px solid rgba(124, 138, 154, 0.28);
  background: linear-gradient(180deg, rgba(18, 25, 34, 0.96), rgba(13, 19, 28, 0.92));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.site-brand p {
  letter-spacing: 0.01em;
}

.site-brand span {
  color: #9eb6d3;
}

.site-nav a {
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.site-nav a.active,
.site-nav a:hover {
  border-color: rgba(0, 209, 255, 0.34);
  box-shadow: inset 0 1px 0 rgba(148, 240, 255, 0.2);
}

.hero-copy h1 {
  letter-spacing: -0.012em;
}

.hero-copy p {
  color: #abc0da;
  max-width: 66ch;
}

.hero-visual,
.feature-article,
.content-card,
.panel,
.fact-card,
.home-mini,
.metric-strip div {
  border-radius: 12px;
}

.hero-visual {
  border-color: rgba(145, 170, 248, 0.28);
  box-shadow: 0 18px 40px rgba(1, 8, 24, 0.42);
}

.content-card,
.panel {
  background: linear-gradient(180deg, rgba(18, 25, 34, 0.88), rgba(14, 20, 30, 0.88));
  border-color: rgba(124, 138, 154, 0.26);
}

.content-card:hover,
.panel:hover {
  border-color: rgba(0, 209, 255, 0.38);
  box-shadow: 0 12px 30px rgba(1, 9, 27, 0.4);
}

.content-section > p,
.content-card p,
.content-card ul,
.feature-article p,
.feature-article ul {
  color: #a8bdd6;
}

.inline-link {
  color: #74e0ff;
}

.inline-link:hover {
  color: #a7eeff;
}

.site-footer {
  border-top: 1px solid rgba(124, 138, 154, 0.28);
  color: #9db2cb;
  background: rgba(11, 16, 24, 0.6);
}

/* Subtle motion polish */
@keyframes fadeUpSoft {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-copy,
.hero-visual,
.content-section,
.home-dense,
.feature-article,
.content-card,
.panel {
  animation: fadeUpSoft 0.5s ease both;
}

.content-card,
.panel,
.fact-card,
.home-mini,
.hero-visual,
.feature-article {
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.content-card:hover,
.panel:hover,
.fact-card:hover,
.home-mini:hover,
.feature-article:hover {
  transform: translateY(-2px);
}

.solid-btn,
.ghost-btn,
.cta-link,
.site-nav a {
  transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
}

.solid-btn:hover,
.ghost-btn:hover,
.cta-link:hover {
  transform: translateY(-1px);
  filter: saturate(1.06);
}

.site-nav a:hover,
.site-nav a.active {
  transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
  .hero-copy,
  .hero-visual,
  .content-section,
  .home-dense,
  .feature-article,
  .content-card,
  .panel {
    animation: none;
  }

  .content-card,
  .panel,
  .fact-card,
  .home-mini,
  .hero-visual,
  .feature-article,
  .solid-btn,
  .ghost-btn,
  .cta-link,
  .site-nav a {
    transition: none;
    transform: none;
  }
}

@media (max-width: 1120px) {
  .hero-section,
  .content-section,
  .home-dense {
    padding-left: 16px;
    padding-right: 16px;
  }

  .hero-copy h1 {
    letter-spacing: -0.008em;
  }
}
