/* Layout: the signed-in app shell (sidebar, top bar, page) and the signed-out auth
 * layout (brand panel + form). */

/* --- brand ------------------------------------------------------------------------ */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
}

/* --- app shell -------------------------------------------------------------------- */

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  border-right: 1px solid var(--border);
  background: var(--sidebar);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-height);
  padding: 0 12px 0 16px;
  flex: none;
}

.sidebar-close {
  display: none;
}

.sidebar-scroll {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  padding: 8px 12px 12px;
  overflow-y: auto;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-label {
  padding: 4px 8px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.nav-item .icon {
  color: var(--text-3);
}

.nav-item:hover {
  background: var(--surface-3);
  color: var(--text);
  text-decoration: none;
}

.nav-item[aria-current="page"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  outline: 1px solid var(--border);
  outline-offset: -1px;
}

.nav-item[aria-current="page"] .icon {
  color: var(--primary);
}

:root[data-theme="dark"] .nav-item[aria-current="page"] .icon {
  color: var(--link);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nav-item[aria-current="page"] .icon {
    color: var(--link);
  }
}

.nav-item-end {
  margin-left: auto;
}

.nav-item .icon.nav-item-end {
  width: 13px;
  height: 13px;
  opacity: 0.7;
}

.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

.upsell {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.upsell-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

.upsell-text {
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.45;
}

.theme-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 4px 4px 10px;
  color: var(--text-2);
  font-size: 13px;
}

.theme-switch .segment {
  width: 30px;
  padding: 0;
  justify-content: center;
}

.user {
  display: block;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.user > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius);
  cursor: pointer;
}

.user > summary:hover,
.user[open] > summary {
  background: var(--surface-3);
}

.user-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.user-name {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-email {
  overflow: hidden;
  color: var(--text-3);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user .menu-panel {
  right: 0;
  left: 0;
  min-width: 0;
}

.app-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-height);
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
}

.topbar-menu {
  display: none;
  margin-left: -8px;
}

.topbar-brand {
  display: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 0;
  list-style: none;
  color: var(--text-2);
  font-size: 14px;
}

.crumbs li {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.crumbs li + li::before {
  content: "/";
  color: var(--border-strong);
}

.crumbs a {
  color: var(--text-2);
}

.crumbs a:hover {
  color: var(--text);
}

.crumbs [aria-current="page"] {
  overflow: hidden;
  color: var(--text);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 28px 32px 72px;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: 24px;
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.page-desc {
  margin-top: 4px;
  color: var(--text-2);
  font-size: 14px;
}

.page-aside {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title {
  margin-bottom: 12px;
  font-size: 15px;
  font-weight: 600;
}

.flashes {
  margin-bottom: 16px;
}

.flashes:empty {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 900px) {
  .sidebar {
    width: min(288px, 86vw);
    box-shadow: var(--shadow-lg);
    transform: translateX(-102%);
    transition: transform 0.2s ease;
    visibility: hidden;
  }

  .sidebar:target,
  .sidebar.is-open {
    transform: none;
    visibility: visible;
  }

  .sidebar:target ~ .sidebar-backdrop,
  .sidebar.is-open ~ .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 55;
    display: block;
    background: var(--overlay);
  }

  .sidebar-close {
    display: inline-flex;
  }

  .app-main {
    margin-left: 0;
  }

  .topbar {
    padding: 0 16px;
  }

  .topbar-menu,
  .topbar-brand {
    display: inline-flex;
  }

  .topbar .crumbs {
    display: none;
  }

  .page {
    padding: 20px 16px 56px;
  }

  .page-title {
    font-size: 21px;
  }
}

/* --- auth layout ------------------------------------------------------------------ */

.auth {
  display: grid;
  grid-template-columns: minmax(360px, 5fr) 7fr;
  min-height: 100vh;
}

.auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: 40px 48px;
  overflow: hidden;
  background: radial-gradient(120% 80% at 0% 0%, #2f6a9c 0%, transparent 60%),
    linear-gradient(160deg, #183650 0%, #10263a 55%, #0b1b2a 100%);
  color: #e6eef6;
}

.auth-brand .brand {
  color: #ffffff;
}

.auth-pitch {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 420px;
}

.auth-pitch .auth-headline {
  color: #ffffff;
  text-wrap: balance;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.auth-pitch p {
  color: #b9cbdc;
  font-size: 15px;
}

.auth-points {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
  padding: 0;
  list-style: none;
  color: #d5e2ee;
}

.auth-points li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-points .icon {
  color: var(--highlight);
}

.auth-mock {
  max-width: 420px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  font-size: 12.5px;
}

.auth-mock-bar {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-mock-bar span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
}

.auth-mock table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.auth-mock th,
.auth-mock td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
}

.auth-mock th {
  color: #9fb6cb;
  font-weight: 500;
}

.auth-mock td {
  color: #e6eef6;
}

.auth-mock td:last-child,
.auth-mock th:last-child {
  text-align: right;
}

.auth-mock tr:last-child td {
  border-bottom: 0;
}

.auth-foot {
  color: #8fa7bd;
  font-size: 12.5px;
}

.auth-foot a {
  color: #c6d7e7;
}

.auth-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background: var(--surface);
}

.auth-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  max-width: 380px;
}

.auth-logo {
  display: none;
}

.auth-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.auth-sub {
  color: var(--text-2);
}

.auth-alt {
  color: var(--text-2);
  font-size: 13.5px;
  text-align: center;
}

.auth-alt a {
  font-weight: 500;
}

.auth-note {
  color: var(--text-3);
  font-size: 12.5px;
  text-align: center;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-3);
  font-size: 12.5px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-google {
  height: 40px;
  font-weight: 500;
}

.btn-google .icon {
  width: 18px;
  height: 18px;
}

@media (max-width: 900px) {
  .auth {
    grid-template-columns: minmax(0, 1fr);
  }

  .auth-brand {
    display: none;
  }

  .auth-main {
    justify-content: flex-start;
    padding: 32px 16px;
    background: var(--bg);
  }

  .auth-card {
    padding: 24px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
  }

  .auth-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
  }
}

.page-note {
  margin-bottom: 16px;
}

.page-section + .page-section {
  margin-top: 24px;
}

body.has-drawer {
  overflow: hidden;
}
