/* ---- app shell ------------------------------------------------------- */
.shell { --sidebar-w: 256px; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100dvh; transition: grid-template-columns 0.2s ease; }
.shell.collapsed { --sidebar-w: 78px; }

.sidebar {
  position: sticky; top: 0; height: 100dvh; overflow-y: auto; overflow-x: hidden;
  background: var(--side); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 0 0.85rem 1rem;
}
.sidebar .strip { height: 54px; margin: 0.85rem 0 0.4rem; border-radius: 16px; flex: none; }
.brand { display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem 0.55rem 1rem; text-decoration: none; color: var(--heading); }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 1.4rem; line-height: 1; white-space: nowrap; }
.brand-name small { display: block; font-family: var(--font-ui); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-top: 0.3rem; }

.nav-group { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; margin-bottom: 1rem; }
.nav-label { padding: 0 0.7rem 0.35rem; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 0.8rem; min-height: 42px; padding: 0 0.7rem; border-radius: 12px;
  color: var(--ink); text-decoration: none; font-weight: 500; font-size: 0.95rem; white-space: nowrap; min-width: 0; transition: background 0.15s ease;
}
.nav-text { overflow: hidden; text-overflow: ellipsis; }
.nav-link:hover { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.nav-link[aria-current="page"] { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent-ink); font-weight: 600; }
.nav-link[aria-current="page"]::before { content: ""; position: absolute; left: -0.85rem; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--accent); }
.sidebar-foot { margin-top: auto; display: flex; padding-top: 0.5rem; }
.sidebar-foot .icon-btn svg { transition: transform 0.2s ease; }
.shell.collapsed .sidebar-foot .icon-btn svg { transform: rotate(180deg); }

.shell.collapsed .brand-name, .shell.collapsed .nav-label, .shell.collapsed .nav-text { display: none; }
.shell.collapsed .nav-link { justify-content: center; padding: 0; }
.shell.collapsed .brand { justify-content: center; padding-inline: 0; }
.shell.collapsed .sidebar-foot { justify-content: center; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 0.5rem; height: 68px; padding: 0 2rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid transparent;
}
.topbar h1 { font-size: 1.7rem; margin-right: auto; }
.topbar-tools { position: relative; display: flex; gap: 0.25rem; }
.content { padding: 0.75rem 2rem 3rem; width: 100%; max-width: 1280px; margin: 0 auto; }

/* ---- popover (theme switcher) --------------------------------------- */
.popover {
  position: absolute; top: calc(100% + 10px); right: 0; width: 320px; z-index: 40; padding: 1.1rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
}
.popover[hidden] { display: none; }
.swatches { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin: 0.6rem 0 1rem; }
.swatch {
  display: grid; gap: 0.5rem; padding: 0.6rem; text-align: left; border-radius: 14px; background: var(--card);
  border: 1.5px solid var(--line); transition: border-color 0.15s ease, transform 0.15s ease;
}
.swatch:hover { transform: translateY(-1px); }
.swatch[aria-pressed="true"] { border-color: var(--accent-ink); box-shadow: 0 0 0 1px var(--accent-ink); }
.swatch-art { height: 46px; border-radius: 9px; background: var(--sw-bg); position: relative; overflow: hidden; border: 1px solid rgba(0, 0, 0, 0.06); }
.swatch-art::before { content: ""; position: absolute; left: 8px; right: 38%; top: 8px; height: 8px; border-radius: 4px; background: var(--sw-accent); }
.swatch-art::after { content: ""; position: absolute; left: 8px; width: 46%; bottom: 8px; height: 6px; border-radius: 3px; background: var(--sw-accent); opacity: 0.35; }
.swatch-art.is-leo { background-color: #E8D5B7; background-image: url("/img/leopard.svg"); background-size: 110px 110px; }
.swatch-art.is-leo::before, .swatch-art.is-leo::after { display: none; }
.swatch-name { font-size: 0.88rem; font-weight: 600; }
.seg { display: inline-grid; grid-auto-flow: column; gap: 2px; padding: 3px; border-radius: 12px; background: color-mix(in srgb, var(--ink) 7%, transparent); }
.seg button { border: 0; background: transparent; border-radius: 9px; padding: 0.35rem 0.9rem; font-size: 0.86rem; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); color: var(--accent-ink); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

/* ---- bottom bar (phones) -------------------------------------------- */
.bottombar { display: none; }
.sheet-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 45; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--card); border-top: 1px solid var(--line);
  border-radius: 22px 22px 0 0; padding: 1.2rem 1rem calc(5.5rem + env(safe-area-inset-bottom)); display: grid; gap: 2px;
  max-height: 80dvh; overflow-y: auto;
}

/* ---- pages ---------------------------------------------------------- */
.banner { position: relative; overflow: hidden; display: grid; grid-template-columns: 1fr auto; gap: 1.5rem; align-items: stretch; padding: 0; }
.banner-text { padding: 2rem 2.2rem; display: grid; align-content: center; gap: 0.6rem; }
.banner h2 { font-size: clamp(1.9rem, 3.2vw, 2.7rem); }
.banner .leo { width: clamp(120px, 22vw, 300px); border-radius: 0 20px 20px 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; align-items: start; }
.areas { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.8rem; }
.steps { list-style: none; margin: 0.9rem 0 0; padding: 0; display: grid; gap: 0.55rem; }
.steps li { display: grid; grid-template-columns: 26px 1fr; gap: 0.7rem; align-items: start; font-size: 0.92rem; }
.step-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 0.78rem; font-weight: 700; border: 1px solid var(--line); background: var(--card); }
.steps li.done .step-n { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.steps li.now .step-n { border-color: var(--accent-ink); color: var(--accent-ink); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1rem; margin: 0.8rem 0 0; font-size: 0.92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }
.form { display: grid; gap: 0.9rem; max-width: 460px; margin-top: 0.8rem; }

/* ---- login ---------------------------------------------------------- */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem; }
.login-card { width: min(100%, 420px); padding: 0; overflow: hidden; }
.login-card .strip { height: 88px; border-radius: 0; }
.login-body { padding: 1.8rem 2rem 2rem; display: grid; gap: 1.1rem; }
.login-body .brand-mark { width: 46px; height: 46px; border-radius: 14px; }
.login-body h1 { font-size: 2.2rem; }

/* ---- tablet and phone ----------------------------------------------- */
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content, .topbar { padding-inline: 1.4rem; }
}
@media (max-width: 800px) {
  .shell, .shell.collapsed { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar { height: 60px; padding-inline: 1rem; }
  .topbar h1 { font-size: 1.45rem; }
  .content { padding: 0.5rem 1rem calc(6rem + env(safe-area-inset-bottom)); }
  .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .banner { grid-template-columns: 1fr; }
  .banner .leo { width: 100%; height: 44px; border-radius: 0 0 20px 20px; order: 2; }
  .banner-text { padding: 1.4rem 1.3rem; }
  .card { padding: 1.15rem 1.2rem; border-radius: 18px; }
  .popover { position: fixed; left: 0.75rem; right: 0.75rem; top: 64px; width: auto; }
  .bottombar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
    background: color-mix(in srgb, var(--card) 94%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
    padding: 0.35rem 0.4rem calc(0.35rem + env(safe-area-inset-bottom));
  }
  .bottombar a, .bottombar button {
    display: grid; justify-items: center; gap: 2px; padding: 0.4rem 0; border: 0; background: transparent; border-radius: 12px;
    font-size: 0.68rem; font-weight: 600; color: var(--muted); text-decoration: none;
  }
  .bottombar [aria-current="page"], .bottombar [aria-expanded="true"] { color: var(--accent-ink); background: color-mix(in srgb, var(--accent) 12%, transparent); }
  .login-body { padding: 1.4rem 1.4rem 1.6rem; }
}
