/* App shell: sidebar on wide screens, bottom tab bar on phones. The shell
   stays put; only #main changes between pages. */
.shell { min-height: 100dvh; display: grid; grid-template-columns: var(--nav-w) 1fr; }
.sidenav {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 4px;
  padding: 14px 10px; background: var(--surface); border-right: 1px solid var(--line);
}
.brandmark { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; color: var(--text); text-decoration: none; }
.brandmark img { width: 34px; height: 34px; border-radius: 9px; }
.brandmark b { display: block; font-size: 15px; }
.brandmark span { display: block; font-size: 12px; color: var(--muted); }
.navlist { position: relative; display: grid; gap: 2px; }
.navlist a {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px;
  border-radius: 10px; color: var(--text-2); text-decoration: none; font-weight: 580;
}
.navlist a:hover { color: var(--text); background: var(--surface-sunk); }
.navlist a[aria-current="page"] { color: var(--brand-hi); }
:root[data-theme="dark"] .navlist a[aria-current="page"] { color: var(--brand); }
.navlist a svg { width: 20px; height: 20px; flex: none; }
.navlist .nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }
/* the pill behind the active item stretches toward its destination, then settles */
.navlist .nav-pill { position: absolute; left: 0; right: 0; top: 0; height: 42px; border-radius: 10px; background: var(--brand-soft); z-index: 0; pointer-events: none; }
.sidenav .spacer { flex: 1; }
.sidenav .me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-hi); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
:root[data-theme="dark"] .avatar { color: var(--brand); }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; min-height: var(--topbar-h); display: flex; align-items: center; gap: 10px;
  padding: 8px 20px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--step--1); }
.topbar .crumbs a { color: var(--muted); text-decoration: none; }
.topbar .crumbs a:hover { color: var(--text); }
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: var(--step--1); font-weight: 600; }
.conn.offline { color: var(--warn); }
main#main { flex: 1; padding: 20px; width: 100%; max-width: 1240px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.page-enter > * { animation: enter var(--t-slow) var(--ease-out) both; }
.page-enter > *:nth-child(2) { animation-delay: 40ms; }
.page-enter > *:nth-child(3) { animation-delay: 80ms; }
.page-enter > *:nth-child(n+4) { animation-delay: 110ms; }

.tabbar { display: none; }

@media (max-width: 1023px) {
  .shell { grid-template-columns: 1fr; }
  .sidenav { display: none; }
  main#main { padding: 14px 14px calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom)); }
  .tabbar {
    position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
  }
  .tabbar a { position: relative; display: grid; justify-items: center; align-content: center; gap: 3px; color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 600; }
  .tabbar a svg { width: 23px; height: 23px; }
  .tabbar a[aria-current="page"] { color: var(--brand-hi); }
  :root[data-theme="dark"] .tabbar a[aria-current="page"] { color: var(--brand); }
  .tabbar a[aria-current="page"]::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: currentColor; }
  .tabbar .nav-badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
  .topbar { padding: 8px 14px; }
}

/* two-column content that collapses on narrow screens */
.cols { display: grid; gap: 16px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.cols.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols > *, .stack > *, .grid-cards > * { min-width: 0; }
/* minmax(0, 1fr), not 1fr: a column must be allowed to be narrower than its longest line */
@media (max-width: 900px) { .cols, .cols.even { grid-template-columns: minmax(0, 1fr); } }
.grid-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* sign-in */
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 10% -10%, var(--brand-soft), transparent), var(--bg); }
.auth-card { width: min(400px, 100%); padding: 28px; }
.auth-card .brandmark { padding: 0 0 18px; }

/* account: name card + sign out in the sidebar; avatar button beside the bell on phones */
.sidenav .me { padding: 6px; gap: 4px; }
.me-open { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 4px; border: 0; background: none; color: inherit; font: inherit; border-radius: 9px; cursor: pointer; }
.me-open:hover { background: var(--surface-sunk); }
.topbar-me { display: none; padding: 0; }
@media (max-width: 1023px) { .topbar-me { display: inline-grid; place-items: center; } }

/* ---------------- sign-in ("Daylight") ----------------
   Computer: the photo on the left, the form on the right.
   Phone / small tablet: the photo is a header, the form slides up over it.
   The photo panel keeps its own light colours in both themes (it is a
   photograph of a light kitchen); the form follows the app theme. */
.signin { --signin-navy: #24266b; --signin-cyan: #29a9e1; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 46fr) minmax(0, 54fr); background: var(--bg); }
.signin-photo { position: relative; overflow: hidden; color: var(--signin-navy);
  background: #eef1f4 url("data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAA0JCgsKCA0LCgsODg0PEyAVExISEyccHhcgLikxMC4pLSwzOko+MzZGNywtQFdBRkxOUlNSMj5aYVpQYEpRUk//2wBDAQ4ODhMREyYVFSZPNS01T09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0//wAARCAAgABgDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDuI1D3jYIPyH+lI6YPTFSIDJdsy91P9KV1xnPBHUGqTFYqslFSNiiqEKtzZpIWSQenOc1KWWQAkDA6fOKyCR5uccYqKSM5yjgexFc3tDb2ZsPHnuV+nNFY0b3Kg7pmz2weP1oqvaoXs2f/2Q==") center / cover no-repeat; }
.signin-photo::before { content: ""; position: absolute; inset: 0; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.signin-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .6s ease-out; }
.signin-img.loaded { opacity: 1; }
.signin-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,255,255,.72) 0%, rgba(255,255,255,.25) 42%, rgba(255,255,255,0) 68%); }
.signin-copy { position: relative; z-index: 1; padding: clamp(28px, 5vw, 56px); display: grid; gap: 14px; max-width: 520px; }
.signin-brand { display: flex; align-items: center; gap: 12px; margin-bottom: clamp(16px, 4vh, 40px); }
.signin-brand img { width: 44px; height: 44px; border-radius: 11px; box-shadow: 0 6px 18px -8px rgba(36, 38, 107, .45); }
.signin-brand b { display: block; font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.signin-brand span { display: block; font-size: 12.5px; opacity: .75; }
.signin-head { margin: 0; font-size: clamp(30px, 3.4vw, 44px); line-height: 1.08; font-weight: 800; letter-spacing: -.025em; text-wrap: balance; }
.signin-sub { margin: 0; max-width: 34ch; font-size: 15px; line-height: 1.5; opacity: .85; }
.signin-panel { display: grid; place-items: center; padding: 32px max(20px, env(safe-area-inset-right, 0px)) 32px 32px; }
.signin-form { width: min(380px, 100%); }
.signin-lang { display: flex; justify-content: flex-end; gap: 4px; margin-bottom: 8px; }
.signin-lang button[aria-pressed="true"] { color: var(--text); font-weight: 700; background: var(--surface-2, transparent); }
.signin-form h1 { margin: 0; font-size: 28px; letter-spacing: -.015em; }
.signin-hint { margin: 4px 0 22px; }
.signin-form .btn.primary { --brand: var(--signin-navy); --btn-fg: #fff; color: #fff; background: linear-gradient(#2f3288, var(--signin-navy)); box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 10px 22px -12px rgba(36, 38, 107, .7); }
.signin-form .btn.primary:hover { background: linear-gradient(#383ca0, #2a2d7c); }
.signin-foot { margin-top: 22px; gap: 6px; }
:root[data-theme="dark"] .signin-form .btn.primary { background: linear-gradient(#4a4fc4, #3438a0); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .signin-form .btn.primary { background: linear-gradient(#4a4fc4, #3438a0); } }
@media (max-width: 860px) {
  .signin { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .signin-photo { min-height: 42dvh; display: flex; }
  .signin-photo::after { background: linear-gradient(180deg, rgba(255,255,255,.78) 0%, rgba(255,255,255,.35) 55%, rgba(255,255,255,.1) 100%); }
  .signin-copy { padding: max(22px, env(safe-area-inset-top, 0px)) 20px 44px; gap: 10px; align-content: start; }
  .signin-brand { margin-bottom: 14px; }
  .signin-brand img { width: 38px; height: 38px; border-radius: 10px; }
  .signin-head { font-size: clamp(26px, 7vw, 34px); max-width: 15ch; }
  .signin-sub { display: none; }
  .signin-panel { place-items: start center; margin-top: -24px; position: relative; z-index: 2; background: var(--bg); border-radius: 22px 22px 0 0; padding: 26px 20px max(24px, env(safe-area-inset-bottom, 0px)); box-shadow: 0 -10px 30px -18px rgba(16, 24, 40, .35); }
}
@media (prefers-reduced-motion: reduce) { .signin-img { transition: none; } }
