/* App shell: sidebar on desktop, bottom tab bar on mobile. */

#app-root {
  min-height: 100%;
}

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

.shell[hidden] {
  display: none;
}

/* ---------------------------------------------------------------- sidebar */
.sidebar {
  display: none;
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 18px 12px calc(18px + var(--safe-bottom));
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 18px;
}

.brand__mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-contrast);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 17px;
  flex: none;
}

.brand__name {
  font-weight: 680;
  letter-spacing: -0.02em;
}

.brand__sub {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.2;
}

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

.side-nav__link {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: var(--tap);
  padding: 0 12px;
  border-radius: var(--r-md);
  color: var(--text-2);
  font-weight: 520;
  transition: background 0.15s ease, color 0.15s ease;
}

.side-nav__link:hover {
  background: var(--surface-2);
}

.side-nav__link[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 620;
}

.side-nav__icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
  flex: none;
}

.side-foot {
  margin-top: auto;
  padding-top: 16px;
}

/* ------------------------------------------------------------------- main */
.main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + var(--safe-top)) max(14px, var(--safe-left)) 10px
    max(14px, var(--safe-right));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
  min-height: calc(52px + var(--safe-top));
}

.topbar__title {
  font-size: 1.06rem;
  font-weight: 660;
  letter-spacing: -0.02em;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar__actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex: none;
}

.view {
  flex: 1 1 auto;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--s-4) max(var(--s-3), var(--safe-left))
    calc(96px + var(--safe-bottom)) max(var(--s-3), var(--safe-right));
}

/* ----------------------------------------------------------------- tabbar */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: space-around;
  gap: 2px;
  padding: 6px max(6px, var(--safe-left)) calc(6px + var(--safe-bottom))
    max(6px, var(--safe-right));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  border-top: 1px solid var(--border);
}

.tabbar__link {
  flex: 1 1 0;
  min-width: 0;
  min-height: var(--tap);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: var(--r-md);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 550;
  padding: 4px 2px;
}

.tabbar__link span:last-child {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tabbar__icon {
  font-size: 18px;
  line-height: 1;
}

.tabbar__link[aria-current="page"] {
  color: var(--accent);
}

/* --------------------------------------------------------------- desktop */
@media (min-width: 900px) {
  .sidebar {
    display: flex;
    flex-direction: column;
  }

  .tabbar {
    display: none;
  }

  .view {
    padding-top: var(--s-5);
    padding-bottom: 64px;
    padding-left: var(--s-5);
    padding-right: var(--s-5);
  }

  .topbar {
    padding-left: var(--s-5);
    padding-right: var(--s-5);
  }

  .fab {
    bottom: 28px;
    right: 28px;
  }
}

/* ------------------------------------------------------------ auth screen */
.auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(var(--s-4) + var(--safe-top)) var(--s-4)
    calc(var(--s-4) + var(--safe-bottom));
  /* A single soft light source behind the card, so the screen has depth
     instead of reading as a flat sheet with a box on it. */
  background:
    radial-gradient(120% 80% at 50% -10%, var(--surface-2) 0%, transparent 60%),
    var(--bg);
}

.auth[hidden] {
  display: none;
}

.auth__card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-2);
  padding: var(--s-5) var(--s-4) var(--s-4);
}

/* Stacked rather than side by side: the mark reads as a logotype above the
   name, which is what gives the screen its title-page feel. */
.auth__brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-3);
  margin-bottom: var(--s-5);
}

.auth__brand .brand__mark {
  width: 52px;
  height: 52px;
  border-radius: var(--r-md);
  font-size: 24px;
}

.auth__brand .brand__name {
  font-size: 1.6rem;
  font-weight: 660;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.auth__brand .brand__sub {
  font-size: 11px;
  font-weight: 620;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
}

.auth__hint {
  margin-top: var(--s-4);
  padding-top: var(--s-3);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.auth__error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
}

.splash {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  color: var(--muted);
  gap: 12px;
}

.splash[hidden] {
  display: none;
}

.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid var(--border-strong);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
