
    :root {
      --bg: #ffffff;
      --surface: #ffffff;
      --surface-2: #fff2f3;
      --surface-3: #fff7f8;
      --ink: #20252b;
      --muted: #68717a;
      --line: #e3e6ea;
      --primary: #ff4d5a;
      --primary-dark: #d93645;
      --primary-soft: #ffe7e9;
      --secondary: #ff4d5a;
      --secondary-dark: #d93645;
      --secondary-soft: #ffe7e9;
      --gold: #e7aa33;
      --danger: #b83d4b;
      --success: #36414b;
      --packed: #737c85;
      --navy: #20252b;
      --keyboard-inset: 0px;
      --shadow-sm: 0 5px 18px rgba(27, 57, 55, 0.07);
      --shadow-md: 0 18px 50px rgba(27, 57, 55, 0.13);
      --radius-sm: 12px;
      --radius-md: 18px;
      --radius-lg: 28px;
      --safe-bottom: env(safe-area-inset-bottom, 0px);
      --content: 1180px;
    }

    * { box-sizing: border-box; }
    html { scroll-behavior: smooth; }
    body {
      margin: 0;
      min-height: 100vh;
      background:
        radial-gradient(circle at 4% 0%, rgba(233, 101, 75, .10), transparent 26rem),
        radial-gradient(circle at 98% 8%, rgba(29, 143, 128, .10), transparent 28rem),
        var(--bg);
      color: var(--ink);
      font-family: "Nunito Sans", "Avenir Next", Avenir, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      -webkit-font-smoothing: antialiased;
    }

    button, input, select, textarea { font: inherit; }
    button { color: inherit; }
    a { color: inherit; }
    img, svg { display: block; }
    [hidden] { display: none !important; }

    :focus-visible {
      outline: 3px solid rgba(29, 143, 128, .35);
      outline-offset: 3px;
    }

    .icon {
      width: 22px;
      height: 22px;
      stroke: currentColor;
      stroke-width: 1.9;
      fill: none;
      stroke-linecap: round;
      stroke-linejoin: round;
      flex: 0 0 auto;
    }
    .icon-sm { width: 18px; height: 18px; }
    .icon-lg { width: 30px; height: 30px; }

    .app-layout { min-height: 100vh; }
    #app.is-refreshing::before {
      content: "";
      position: fixed;
      inset: 0 auto auto 0;
      width: 34%;
      height: 3px;
      z-index: 120;
      background: var(--secondary);
      box-shadow: 0 0 10px rgba(29, 143, 128, .28);
      animation: appRefresh 1s ease-in-out infinite;
    }
    @keyframes appRefresh {
      0% { transform: translateX(-110%); }
      100% { transform: translateX(395%); }
    }
    @media (prefers-reduced-motion: reduce) {
      #app.is-refreshing::before { width: 100%; animation: none; }
    }

    .app-boot {
      position: fixed;
      inset: 0;
      z-index: 220;
      display: none;
      place-items: center;
      overflow: hidden;
      padding: 24px;
      background:
        radial-gradient(circle at 18% 12%, rgba(255, 77, 90, .14), transparent 21rem),
        radial-gradient(circle at 88% 86%, rgba(255, 77, 90, .08), transparent 24rem),
        #fff;
    }
    .app-boot.open { display: grid; }
    .app-boot-card { width: min(100%, 380px); text-align: center; }
    .app-boot-animation {
      position: relative;
      width: 104px;
      height: 104px;
      margin: 0 auto 25px;
      display: grid;
      place-items: center;
    }
    .app-boot-animation::before,
    .app-boot-animation::after {
      content: "";
      position: absolute;
      border-radius: 50%;
    }
    .app-boot-animation::before { inset: 4px; background: var(--primary-soft); animation: bootBreathe 1.8s ease-in-out infinite; }
    .app-boot-animation::after { inset: 0; border: 2px solid rgba(255, 77, 90, .13); }
    .app-boot-orbit {
      position: absolute;
      inset: 0;
      z-index: 1;
      border-radius: 50%;
      animation: bootSpin 1.35s linear infinite;
    }
    .app-boot-orbit::after {
      content: "";
      position: absolute;
      top: -3px;
      left: calc(50% - 6px);
      width: 12px;
      height: 12px;
      border-radius: 50%;
      background: var(--primary);
      box-shadow: 0 4px 14px rgba(255, 77, 90, .35);
    }
    .app-boot-icon {
      position: relative;
      z-index: 2;
      width: 58px;
      height: 58px;
      display: grid;
      place-items: center;
      border-radius: 19px;
      background: #fff;
      color: var(--primary-dark);
      box-shadow: 0 10px 28px rgba(46, 37, 38, .10);
      animation: bootFloat 1.8s ease-in-out infinite;
    }
    .app-boot-brand { margin-bottom: 12px; color: var(--primary); font-size: 14px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
    .app-boot-card h1 { margin: 0; font-size: clamp(27px, 7vw, 34px); letter-spacing: -.035em; }
    .app-boot-card .lead { min-height: 24px; margin: 10px 0 20px; color: var(--muted); }
    .app-boot-dots { display: flex; justify-content: center; gap: 7px; }
    .app-boot-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); animation: bootDot 1.1s ease-in-out infinite; }
    .app-boot-dots span:nth-child(2) { animation-delay: .14s; }
    .app-boot-dots span:nth-child(3) { animation-delay: .28s; }
    @keyframes bootSpin { to { transform: rotate(360deg); } }
    @keyframes bootBreathe { 50% { transform: scale(1.06); opacity: .72; } }
    @keyframes bootFloat { 50% { transform: translateY(-4px) rotate(-2deg); } }
    @keyframes bootDot { 0%, 100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-4px); } }

    .desktop-sidebar {
      display: none;
      position: fixed;
      inset: 0 auto 0 0;
      width: 260px;
      padding: 26px 20px;
      background: rgba(255,255,255,.88);
      backdrop-filter: blur(18px);
      border-right: 1px solid rgba(231, 227, 220, .9);
      z-index: 30;
    }

    .brand {
      display: inline-flex;
      align-items: center;
      gap: 15px;
      text-decoration: none;
      font-size: 21px;
      font-weight: 900;
      letter-spacing: -.03em;
    }
    .brand-mark {
      width: 44px;
      height: 44px;
      border-radius: 15px;
      display: grid;
      place-items: center;
      color: white;
      background: linear-gradient(145deg, var(--primary), #f29468);
      box-shadow: 0 10px 22px rgba(233,101,75,.27);
    }
    .brand-mark .icon { width: 25px; height: 25px; stroke-width: 2.2; }
    .brand small { display: block; color: var(--muted); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; font-weight: 800; }

    .side-nav { display: grid; gap: 8px; margin-top: 34px; }
    .side-link {
      border: 0;
      background: transparent;
      width: 100%;
      min-height: 48px;
      display: flex;
      align-items: center;
      gap: 13px;
      padding: 0 14px;
      border-radius: 15px;
      cursor: pointer;
      font-weight: 800;
      color: #526565;
      text-align: left;
    }
    .side-link:hover { background: var(--surface-2); }
    .side-link.active { color: var(--secondary-dark); background: var(--secondary-soft); }
    .side-link.active::after {
      content: "";
      width: 7px; height: 7px; border-radius: 999px; background: var(--secondary); margin-left: auto;
    }
    .side-card {
      margin-top: auto;
      padding: 16px;
      border-radius: 20px;
      background: linear-gradient(145deg, #174b55, #1d746e);
      color: white;
    }
    .side-card p { color: rgba(255,255,255,.75); margin: 7px 0 12px; font-size: 13px; line-height: 1.4; }
    .side-card button { width: 100%; }

    .app-main { min-width: 0; }
    .topbar {
      position: sticky;
      top: 0;
      z-index: 20;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      min-height: 72px;
      padding: 12px 18px;
      background: rgba(255,255,255,.85);
      backdrop-filter: blur(18px);
      border-bottom: 1px solid rgba(231,227,220,.75);
    }
    .topbar .brand { font-size: 19px; }
    .topbar .brand-mark { width: 40px; height: 40px; border-radius: 14px; }
    .topbar-actions { display: flex; align-items: center; gap: 8px; }

    .icon-button {
      min-width: 44px;
      min-height: 44px;
      border: 1px solid var(--line);
      background: rgba(255,255,255,.8);
      display: inline-grid;
      place-items: center;
      border-radius: 14px;
      cursor: pointer;
      transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
    }
    .icon-button:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); border-color: #d8d1c8; }
    .avatar-button {
      width: 44px; height: 44px; border-radius: 50%; border: 3px solid white; background: #f7c9ad; color: #7c3d29; font-weight: 900; box-shadow: var(--shadow-sm); cursor: pointer;
    }

    .page-container {
      width: min(100%, var(--content));
      margin: 0 auto;
      padding: 22px 16px calc(100px + var(--safe-bottom));
    }
    .page { display: none; animation: pageIn .25s ease both; }
    .page.active { display: block; }
    @keyframes pageIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

    .eyebrow {
      display: inline-flex;
      align-items: center;
      gap: 7px;
      color: var(--secondary-dark);
      font-size: 12px;
      font-weight: 900;
      text-transform: uppercase;
      letter-spacing: .09em;
    }
    h1, h2, h3, p { margin-top: 0; }
    h1 { margin-bottom: 8px; font-size: clamp(28px, 8vw, 44px); line-height: 1.02; letter-spacing: -.045em; }
    h2 { margin-bottom: 8px; font-size: 24px; line-height: 1.1; letter-spacing: -.035em; }
    h3 { margin-bottom: 6px; font-size: 18px; letter-spacing: -.02em; }
    .lead { color: var(--muted); line-height: 1.55; margin-bottom: 0; }
    .section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 28px 0 14px; }
    .section-head h2 { margin: 0; }
    .section-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
    .text-button {
      border: 0; background: transparent; min-height: 44px; padding: 0 4px; color: var(--secondary-dark); font-weight: 900; cursor: pointer;
    }

    .card {
      background: rgba(255,255,255,.92);
      border: 1px solid rgba(231,227,220,.95);
      border-radius: var(--radius-md);
      box-shadow: var(--shadow-sm);
    }

    .hero-grid { display: grid; gap: 16px; }
    .trip-hero {
      position: relative;
      overflow: hidden;
      padding: 22px;
      color: white;
      border-radius: var(--radius-lg);
      background:
        radial-gradient(circle at 85% 0%, rgba(255,255,255,.25), transparent 18rem),
        linear-gradient(145deg, #1c7e73, #14525f 72%);
      box-shadow: 0 22px 55px rgba(21, 82, 95, .24);
    }
    .home-trip-empty {
      min-height: 300px;
      padding: 28px;
      display: grid;
      align-content: center;
      justify-items: start;
      gap: 17px;
    }
    .home-trip-empty[hidden] { display: none; }
    .home-trip-empty .empty-icon { margin: 0; }
    .home-trip-empty h2 { margin: 5px 0 8px; }
    .home-trip-empty p { max-width: 480px; margin: 0; color: var(--muted); line-height: 1.55; }
    .trip-hero::after {
      content: "";
      position: absolute;
      width: 160px; height: 160px; border-radius: 50%; right: -58px; bottom: -75px; border: 24px solid rgba(255,255,255,.08);
    }
    .trip-hero .eyebrow { color: #c8fff2; }
    .trip-hero h2 { font-size: clamp(28px, 8vw, 40px); margin: 8px 0 6px; }
    .trip-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; color: rgba(255,255,255,.8); font-weight: 700; font-size: 13px; }
    .trip-meta span { display: inline-flex; align-items: center; gap: 6px; }
    .hero-stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 20px 0 18px; }
    .hero-stat {
      padding: 13px 14px;
      border-radius: 17px;
      background: rgba(255,255,255,.12);
      border: 1px solid rgba(255,255,255,.12);
      backdrop-filter: blur(8px);
    }
    .hero-stat strong { display: block; font-size: 23px; line-height: 1; }
    .hero-stat span { display: block; margin-top: 5px; font-size: 12px; color: rgba(255,255,255,.72); }
    .progress-track { height: 9px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.18); }
    .progress-bar { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #ffd37d, #fff1bd); transition: width .25s ease; }
    .progress-label { display: flex; justify-content: space-between; gap: 12px; margin: 8px 0 14px; font-size: 12px; font-weight: 800; color: rgba(255,255,255,.8); }
    .hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

    .btn {
      border: 0;
      min-height: 46px;
      border-radius: 14px;
      padding: 0 17px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 9px;
      font-weight: 900;
      cursor: pointer;
      text-decoration: none;
      transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
    }
    .btn:hover { transform: translateY(-1px); }
    .btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
    .btn-primary { background: var(--primary); color: white; box-shadow: 0 9px 20px rgba(233,101,75,.24); }
    .btn-primary:hover { box-shadow: 0 12px 24px rgba(233,101,75,.3); }
    .btn-secondary { background: var(--secondary); color: white; box-shadow: 0 9px 20px rgba(29,143,128,.21); }
    .btn-white { background: white; color: var(--navy); }
    .btn-soft { background: var(--secondary-soft); color: var(--secondary-dark); }
    .btn-ghost { background: transparent; color: inherit; border: 1px solid var(--line); }
    .btn-danger-soft { background: #fff0f1; color: var(--danger); }
    .btn-block { width: 100%; }

    .quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .quick-action {
      min-height: 120px;
      padding: 16px;
      border: 1px solid var(--line);
      border-radius: 20px;
      background: var(--surface);
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      justify-content: space-between;
      text-align: left;
      cursor: pointer;
      box-shadow: var(--shadow-sm);
    }
    .quick-action .bubble {
      width: 43px; height: 43px; border-radius: 14px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-dark);
    }
    .quick-action.secondary .bubble { background: var(--secondary-soft); color: var(--secondary-dark); }
    .quick-action.tertiary .bubble { background: #f2ecff; color: #63469a; }
    .quick-action:first-child { grid-column: 1 / -1; }
    .quick-action > span:last-child { display: block; min-width: 0; }
    .quick-action strong { display: block; font-size: 15px; }
    .quick-action small { display: block; color: var(--muted); margin-top: 4px; }

    .trip-list, .recent-grid, .family-grid, .settings-grid { display: grid; gap: 13px; }
    .trip-card { padding: 16px; display: grid; gap: 14px; }
    .trip-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
    .trip-card-top > div:first-child { min-width: 0; }
    .list-card-progress-wrap { flex: none; display: grid; justify-items: center; gap: 7px; }
    .list-card-progress-ring {
      --p: 0; position: relative; width: 56px; height: 56px; border-radius: 50%; background: conic-gradient(var(--primary) calc(var(--p) * 1%), var(--line) 0); display: grid; place-items: center;
    }
    .list-card-progress-ring::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--surface); }
    .list-card-progress-ring strong { position: relative; z-index: 1; font-size: 11px; }
    .trip-card h3 { margin-bottom: 4px; }
    .trip-card p { margin: 0; color: var(--muted); font-size: 13px; }
    .status-pill, .tag {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      min-height: 27px;
      padding: 0 9px;
      border-radius: 999px;
      font-size: 11px;
      line-height: 1;
      font-weight: 900;
      white-space: nowrap;
    }
    .status-pill.active { background: var(--secondary-soft); color: var(--secondary-dark); }
    .status-pill.draft { background: #fff5dc; color: #8a5a08; }
    .status-pill.done { background: #eef1f1; color: #536767; }
    .status-pill.ai { background: #f2ecff; color: #63469a; }
    .trip-card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
    .mini-progress { flex: 1; }
    .mini-progress .progress-track { background: #e9efed; height: 7px; }
    .mini-progress .progress-bar { background: var(--secondary); }
    .mini-progress small { display: flex; justify-content: space-between; color: var(--muted); margin-bottom: 6px; font-weight: 800; }

    .avatar-stack { display: flex; padding-left: 6px; }
    .avatar {
      width: 34px; height: 34px; border-radius: 50%; border: 3px solid white; margin-left: -7px; display: grid; place-items: center; font-size: 11px; font-weight: 900; box-shadow: 0 2px 6px rgba(0,0,0,.08);
    }
    .avatar.avatar-image { background-size: cover; background-position: center; background-repeat: no-repeat; color: transparent; }
    .avatar-photo { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
    .avatar.a1 { background: #f9c5a8; color: #7d3f28; }
    .avatar.a2 { background: #bfded8; color: #175f57; }
    .avatar.a3 { background: #f6d884; color: #75500a; }
    .avatar.a4 { background: #d6c9ec; color: #594185; }
    .avatar.a5 { background: #f6c3d0; color: #8f3252; }
    .avatar.a6 { background: #bfe2f3; color: #1f5a7a; }
    .avatar.a7 { background: #d8efb8; color: #446b16; }
    .avatar.a8 { background: #ffd5a8; color: #8a4c0f; }
    .avatar.a9 { background: #c8d0f8; color: #384895; }
    .avatar.a10 { background: #f4d4f8; color: #7a347f; }
    .avatar.a11 { background: #c7ece4; color: #1b6656; }
    .avatar.a12 { background: #f5e0b7; color: #7d5a16; }

    .family-summary { padding: 17px; }
    .family-summary-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
    .member-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
    .member-row:first-of-type { border-top: 0; }
    .member-row .avatar { margin-left: 0; width: 42px; height: 42px; }
    .member-row-info { min-width: 0; flex: 1; }
    .member-row-info strong { display: block; }
    .member-row-info small { color: var(--muted); }
    .rule-count { font-size: 11px; font-weight: 900; color: var(--secondary-dark); background: var(--secondary-soft); padding: 6px 8px; border-radius: 999px; }

    .page-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
    .page-title-row > :first-child { min-width: 0; }
    .page-title-row h1 { font-size: clamp(30px, 8vw, 42px); }
    .page-create-button { flex: none; min-width: 140px; }
    .page-title-actions { display: flex; flex: none; align-items: center; justify-content: flex-end; gap: 10px; }

    .segmented {
      display: flex;
      gap: 4px;
      padding: 4px;
      border: 1px solid var(--line);
      border-radius: 16px;
      background: rgba(255,255,255,.75);
      overflow-x: auto;
      scrollbar-width: none;
    }
    .segmented::-webkit-scrollbar { display: none; }
    .segmented button {
      border: 0; background: transparent; min-height: 39px; padding: 0 13px; border-radius: 12px; color: var(--muted); font-weight: 900; white-space: nowrap; cursor: pointer;
    }
    .segmented button.active { background: white; color: var(--ink); box-shadow: 0 3px 12px rgba(18,52,54,.08); }

    .notice-card {
      padding: 16px;
      display: flex;
      gap: 12px;
      align-items: flex-start;
      border-radius: 18px;
      background: var(--primary-soft);
      border: 1px solid #ffc8cd;
      color: var(--primary-dark);
    }
    .notice-card p { margin: 4px 0 0; font-size: 13px; line-height: 1.45; color: #74464b; }

    /* Packing page */
    .packing-header {
      padding: 0;
      background: transparent;
      border: 0;
      box-shadow: none;
    }
    .packing-headline { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
    .packing-title-line { min-width: 0; flex: 1; display: flex; align-items: baseline; gap: 10px 14px; flex-wrap: wrap; }
    .packing-headline-actions { flex: none; display: flex; align-items: center; gap: 8px; }
    .packing-share-button { min-height: 42px; padding-inline: 14px; }
    .packing-menu-button { flex: 0 0 auto; }
    .packing-headline h1 { font-size: 29px; margin-bottom: 0; }
    .packing-headline p { margin: 0; color: var(--muted); font-size: 13px; }
    .packing-progress-summary { margin-top: 15px; }
    .packing-progress-copy { margin-bottom: 7px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; }
    .packing-progress-copy span { color: var(--muted); font-weight: 700; }
    .packing-progress-copy strong { color: var(--ink); font-size: 12px; }
    .packing-progress-track { height: 9px; overflow: hidden; border-radius: 999px; background: var(--line); }
    .packing-progress-bar { width: 0; height: 100%; border-radius: inherit; background: var(--primary); transition: width .25s ease; }
    .progress-ring {
      --p: 0;
      width: 68px; height: 68px; border-radius: 50%; flex: 0 0 auto;
      display: grid; place-items: center;
      background: conic-gradient(var(--secondary) calc(var(--p) * 1%), #e7efed 0);
      position: relative;
    }
    .progress-ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: white; }
    .progress-ring strong { position: relative; z-index: 1; font-size: 14px; }
    .packing-toolbar { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; margin-top: 16px; }
    .legacy-packing-control { display: none !important; }
    .search-wrap { position: relative; }
    .search-wrap .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
    .search-input {
      width: 100%; min-height: 48px; border: 1px solid var(--line); background: white; border-radius: 14px; padding: 0 14px; color: var(--ink);
    }
    .packing-filter-wrap { position: relative; }
    .packing-filter-button {
      position: relative; width: 48px; height: 48px; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); display: grid; place-items: center; cursor: pointer;
    }
    .packing-filter-button:hover,
    .packing-filter-button.active { border-color: var(--secondary); background: var(--secondary-soft); color: var(--secondary-dark); }
    .packing-filter-count {
      position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border: 2px solid var(--bg); border-radius: 999px; background: var(--primary); color: white; display: grid; place-items: center; font-size: 10px; font-weight: 800;
    }
    .packing-filter-count[hidden] { display: none; }
    .packing-filter-panel {
      position: absolute; z-index: 35; top: 56px; right: 0; width: min(360px, calc(100vw - 32px)); max-height: min(620px, calc(100vh - 190px)); overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-md);
    }
    #baseItemsFilterWrap .packing-filter-panel {
      width: min(520px, calc(100vw - 32px));
    }
    .packing-filter-panel[hidden] { display: none; }
    .packing-filter-head { min-height: 58px; padding: 7px 8px 7px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
    .packing-filter-head strong { font-size: 17px; }
    .packing-filter-options { max-height: min(470px, calc(100vh - 330px)); padding: 8px 12px 12px; overflow-y: auto; }
    .packing-filter-group { border-bottom: 1px solid var(--line); }
    .packing-filter-group:last-child { border-bottom: 0; }
    .packing-filter-group-toggle {
      width: 100%; min-height: 52px; padding: 7px 4px; border: 0; background: transparent; color: var(--ink); display: flex; align-items: center; gap: 8px; text-align: left; font-weight: 750; cursor: pointer;
    }
    .packing-filter-group-toggle > span:first-child { flex: 1; }
    .packing-filter-group-count { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--secondary-soft); color: var(--secondary-dark); display: grid; place-items: center; font-size: 11px; }
    .packing-filter-group-chevron { flex: none; color: var(--muted); transform: rotate(90deg); transition: transform .18s ease; }
    .packing-filter-group-toggle[aria-expanded="true"] .packing-filter-group-chevron { transform: rotate(-90deg); }
    .packing-filter-choices { display: grid; gap: 7px; }
    .packing-filter-choices[hidden] { display: none; }
    .packing-filter-group-toggle + .packing-filter-choices:not([hidden]) { padding-bottom: 12px; }
    .packing-filter-choice {
      width: 100%; min-height: 50px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer;
    }
    .packing-filter-choice:hover { border-color: #9db4aa; }
    .packing-filter-choice.selected { border-color: var(--secondary); background: var(--secondary-soft); }
    .packing-filter-choice > span:nth-last-child(2) { flex: 1; min-width: 0; font-weight: 700; }
    .packing-filter-choice .category-icon,
    .packing-filter-choice .avatar { flex: none; width: 36px; height: 36px; margin: 0; border: 0; font-size: 10px; }
    .packing-filter-choice .avatar { border-radius: 50%; }
    .packing-filter-check { flex: none; opacity: 0; color: var(--secondary-dark); }
    .packing-filter-choice.selected .packing-filter-check { opacity: 1; }
    .packing-filter-footer { padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface-2); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
    .chip-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 2px 1px 5px; scrollbar-width: none; }
    .chip-scroll::-webkit-scrollbar { display: none; }
    .chip {
      min-height: 37px; border: 1px solid var(--line); background: white; color: var(--muted); border-radius: 999px; padding: 0 12px; display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 900; white-space: nowrap; cursor: pointer;
    }
    .chip.active { color: var(--secondary-dark); background: var(--secondary-soft); border-color: #bde0d8; }

    .category-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 14px; }
    .packing-flat-list { overflow: visible; }
    .category-card { overflow: hidden; }
    .category-header {
      width: 100%; min-height: 64px; background: white; padding: 7px 9px 7px 14px; display: flex; align-items: center; gap: 6px;
    }
    .category-toggle { min-width: 0; min-height: 50px; flex: 1; padding: 0; border: 0; background: transparent; color: inherit; display: flex; align-items: center; gap: 12px; text-align: left; cursor: pointer; }
    .category-header-add { width: 42px; height: 42px; flex: 0 0 auto; border: 0; border-radius: 10px; background: var(--secondary-soft); color: var(--secondary-dark); display: grid; place-items: center; cursor: pointer; }
    .category-header-add:hover { background: #ffd8dc; }
    .category-icon { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-dark); }
    .picker-empty-icon { width: 38px; height: 38px; border: 2px solid #c8d4d1; background: transparent; display: grid; place-items: center; flex: 0 0 auto; }
    .picker-empty-square { border-radius: 14px; }
    .picker-empty-circle { border-radius: 50%; }
    .category-icon.green { background: var(--secondary-soft); color: var(--secondary-dark); }
    .category-icon.gold { background: #fff5dc; color: #9d680a; }
    .category-icon.purple { background: #f0eaff; color: #684c9b; }
    .category-picker { display: grid; gap: 10px; }
    .category-picker-trigger {
      width: 100%; min-height: 58px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: #ffffff; color: var(--ink); display: flex; align-items: center; gap: 11px; text-align: left; cursor: pointer;
    }
    .category-picker-trigger .category-icon { width: 38px; height: 38px; flex: 0 0 auto; }
    .category-picker-current-label { flex: 1; }
    .category-picker-chevron { color: var(--muted); transition: transform .18s ease; }
    .category-picker-trigger[aria-expanded="true"] .category-picker-chevron { transform: rotate(90deg); }
    .category-picker-options {
      grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2);
    }
    .category-picker-options:not([hidden]) { display: grid; }
    .category-picker-option {
      min-width: 0; min-height: 64px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); display: flex; align-items: center; gap: 9px; text-align: left; cursor: pointer;
    }
    .category-picker-option:hover { border-color: #9db4aa; }
    .category-picker-option.selected { border-color: var(--secondary); background: var(--secondary-soft); }
    .category-picker-option .category-icon { width: 36px; height: 36px; flex: 0 0 auto; }
    .category-picker-option strong { min-width: 0; font-size: 12px; line-height: 1.25; }
    .member-scope-current-icon { flex: none; display: grid; place-items: center; }
    .member-scope-current-icon .category-icon,
    .member-scope-current-icon .avatar,
    .member-scope-option .avatar { width: 38px; height: 38px; margin: 0; border: 0; flex: none; }
    .member-scope-current-icon .avatar,
    .member-scope-option .avatar { border-radius: 50%; }
    .member-scope-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .item-optional-fields { display: block; }
    .item-optional-picker-row { position: relative; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
    .item-optional-picker-control { min-width: 0; display: flex; align-items: center; gap: 7px; flex: 0 1 auto; }
    .item-optional-picker-label { color: #455a59; font-size: 12px; font-weight: 900; white-space: nowrap; }
    .compact-picker-field { display: block; }
    .compact-icon-picker { position: static; display: block; width: 54px; }
    .compact-icon-picker .category-picker-trigger { width: 54px; min-height: 54px; height: 54px; padding: 0; justify-content: center; border-radius: 14px; }
    .compact-icon-picker .member-scope-trigger { border-radius: 50%; }
    .compact-icon-picker .category-picker-trigger .category-icon,
    .compact-icon-picker .category-picker-trigger .picker-empty-icon,
    .compact-icon-picker .member-scope-current-icon .category-icon,
    .compact-icon-picker .member-scope-current-icon .picker-empty-icon,
    .compact-icon-picker .member-scope-current-icon .avatar { width: 38px; height: 38px; margin: 0; border: 0; }
    .compact-icon-picker .category-picker-trigger .picker-empty-icon,
    .compact-icon-picker .member-scope-current-icon .picker-empty-icon { border: 2px solid #c8d4d1; }
    .compact-icon-picker .member-scope-current-icon .avatar { border-radius: 50%; }
    .compact-icon-picker .category-picker-current-label,
    .compact-icon-picker .category-picker-chevron { display: none; }
    .compact-icon-picker .category-picker-options {
      position: absolute; top: calc(100% + 8px); left: 0; z-index: 8; width: min(330px, calc(100vw - 64px)); max-height: 280px; overflow-y: auto; background: var(--surface); box-shadow: var(--shadow-md);
    }
    #modalBackdrop .modal.item-entry-modal { max-height: none; overflow: visible; }
    @media (max-width: 759px) {
      .compact-icon-picker .category-picker-options {
        top: auto;
        bottom: calc(100% + 8px);
        max-height: min(400px, calc(100vh - 150px));
        max-height: min(400px, calc(100dvh - 150px));
      }
      .compact-icon-picker .category-picker-option { min-height: 48px; padding: 5px 7px; gap: 7px; }
      .compact-icon-picker .category-picker-option .category-icon,
      .compact-icon-picker .category-picker-option .picker-empty-icon,
      .compact-icon-picker .member-scope-option .avatar { width: 32px; height: 32px; }
    }
    .sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
    .category-title { flex: 1; min-width: 0; }
    .category-title strong { display: block; }
    .category-title small { color: var(--muted); }
    .category-chevron { transition: transform .2s ease; color: var(--muted); }
    .category-card.collapsed .category-chevron { transform: rotate(-90deg); }
    .category-card.collapsed .category-body { display: none; }
    .category-body { border-top: 1px solid var(--line); }
    .inline-category-editor { padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--secondary-soft); display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 8px; }
    .inline-category-editor[hidden] { display: none; }
    .inline-category-editor input { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 9px; padding: 0 11px; background: white; color: var(--ink); }
    .inline-item-quantity { width: 92px; min-height: 42px; display: flex; align-items: center; border: 1px solid var(--line); border-radius: 9px; background: white; }
    .inline-category-editor .inline-item-quantity input { min-width: 0; border: 0; padding-right: 4px; }
    .inline-item-quantity span { padding-right: 10px; color: var(--muted); font-size: 12px; }
    .inline-item-actions { display: flex; gap: 6px; }
    .inline-item-actions .btn { min-height: 42px; padding-inline: 11px; }
    .inline-item-error { grid-column: 1 / -1; margin: 0; }
    .pack-item {
      min-height: 76px;
      padding: 12px 10px 12px 14px;
      display: flex;
      align-items: center;
      gap: 11px;
      border-top: 1px solid #f0eeea;
      background: white;
    }
    .pack-item:first-child { border-top: 0; }
    .pack-check {
      appearance: none;
      width: 29px; height: 29px; flex: 0 0 auto; border-radius: 50%; border: 2px solid #c8d4d1; background: white; margin: 0; cursor: pointer; display: grid; place-items: center;
    }
    .pack-check::after { content: ""; width: 10px; height: 6px; border-left: 2px solid white; border-bottom: 2px solid white; transform: rotate(-45deg) translate(1px,-1px); opacity: 0; }
    .pack-check:checked { border-color: var(--packed); background: var(--packed); }
    .pack-check:checked::after { opacity: 1; }
    .pack-item-info { min-width: 0; align-self: stretch; flex: 1; display: flex; align-items: center; padding: 0; border: 0; border-radius: 8px; background: transparent; color: inherit; text-align: left; cursor: pointer; }
    .pack-item-info:focus-visible { outline: 3px solid rgba(255,77,90,.25); outline-offset: 2px; }
    .pack-item-name { width: 100%; display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; font-weight: 850; line-height: 1.25; }
    .pack-item-quantity-prefix { flex: 0 0 auto; color: var(--muted); font-size: 12px; font-weight: 750; white-space: nowrap; }
    .pack-item-name-text { min-width: 0; font-size: 15px; overflow-wrap: anywhere; }
    .pack-item.packed .pack-item-name-text { text-decoration: line-through; color: #899695; }
    .pack-item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--muted); font-size: 11px; margin-top: 5px; }
    .ai-badge { background: #f1ebff; color: #674aa3; }
    .pack-item-side { flex: 0 0 auto; display: flex; align-items: center; gap: 5px; }
    .pack-item-identity { display: flex; align-items: center; gap: 5px; }
    .item-icon-tooltip-trigger { position: relative; width: 34px; height: 34px; flex: 0 0 auto; padding: 0; border: 0; border-radius: 10px; background: transparent; color: inherit; cursor: pointer; }
    .item-icon-tooltip-trigger:focus-visible { outline: 3px solid rgba(255,77,90,.25); outline-offset: 2px; }
    .item-icon-tooltip-trigger > .item-category-icon,
    .item-icon-tooltip-trigger > .item-owner-avatar { width: 100%; height: 100%; }
    .item-icon-tooltip { position: absolute; z-index: 12; top: calc(100% + 7px); right: 0; width: max-content; max-width: min(220px, calc(100vw - 32px)); padding: 7px 9px; border-radius: 7px; background: #28312f; color: white; box-shadow: 0 7px 18px rgba(31,43,40,.2); font-size: 12px; font-weight: 750; line-height: 1.3; text-align: left; white-space: normal; }
    .item-icon-tooltip[hidden] { display: none; }
    .item-category-icon, .item-owner-avatar { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 10px; display: grid; place-items: center; }
    .item-category-icon { background: var(--primary-soft); color: var(--primary-dark); }
    .item-category-icon.green { background: var(--secondary-soft); color: var(--secondary-dark); }
    .item-category-icon.gold { background: #fff5dc; color: #9d680a; }
    .item-category-icon.purple { background: #f0eaff; color: #684c9b; }
    .item-owner-avatar.avatar { margin: 0; border: 0; font-size: 10px; }
    .item-owner-avatar { border-radius: 50%; }
    .shared-owner-avatar { background: #bfded8; color: #175f57; box-shadow: none; }
    @media (max-width: 460px) {
      .pack-item { gap: 11px; }
      .pack-item-side { gap: 2px; }
      .pack-item-identity { gap: 3px; }
      .item-icon-tooltip-trigger { width: 30px; height: 30px; border-radius: 8px; }
      .item-category-icon, .item-owner-avatar { width: 30px; height: 30px; border-radius: 8px; }
      .item-owner-avatar { border-radius: 50%; }
    }
    .item-more { border: 0; background: transparent; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; color: var(--muted); cursor: pointer; }
    .category-footer { padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fcfbf9; border-top: 1px solid var(--line); }
    .category-footer button { border: 0; background: transparent; color: var(--secondary-dark); font-size: 12px; font-weight: 900; min-height: 38px; padding: 0 8px; cursor: pointer; }
    .empty-category-hint { color: var(--muted); font-size: 12px; }
    .packing-fab {
      position: fixed;
      right: 18px;
      bottom: calc(86px + var(--safe-bottom));
      width: 58px; height: 58px; border-radius: 19px; border: 0; background: var(--primary); color: white; display: grid; place-items: center; box-shadow: 0 15px 30px rgba(233,101,75,.35); z-index: 18; cursor: pointer;
    }
    .packing-fab[hidden] { display: none !important; }
    @media (min-width: 1024px) {
      #page-packing .packing-header,
      #page-packing .packing-toolbar,
      #page-packing #packingCategories,
      #page-packing #packingEmpty {
        width: min(100%, 860px);
        margin-inline: auto;
      }
      #page-packing .packing-flat-list,
      #page-packing .empty-state.card {
        width: 100%;
      }
    }
    @media (max-width: 520px) {
      .inline-category-editor { grid-template-columns: minmax(0,1fr) 86px; }
      .inline-item-actions { grid-column: 1 / -1; justify-content: flex-end; }
    }
    /* Travellers */
    .member-card { padding: 16px; }
    .member-card-top { display: flex; align-items: flex-start; gap: 13px; }
    .member-card .avatar { margin: 0; width: 54px; height: 54px; font-size: 15px; border: 0; }
    .member-card-info { flex: 1; min-width: 0; }
    .member-card-info p { margin: 3px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; white-space: pre-line; }
    .member-card > .rule-chips { margin-top: 14px; }
    .member-size-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
    .member-size { padding: 10px 12px; border-radius: 13px; background: var(--surface-2); }
    .member-size small { display: block; color: var(--muted); font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
    .member-size strong { display: block; margin-top: 3px; }
    .rule-chips { display: flex; gap: 7px; flex-wrap: wrap; }
    .rule-chip { background: var(--secondary-soft); color: var(--secondary-dark); padding: 7px 9px; border-radius: 999px; font-size: 11px; font-weight: 900; }
    .family-rules { padding: 17px; }
    .family-rule-row { width: 100%; display: flex; align-items: center; gap: 10px; padding: 11px 0; border: 0; border-top: 1px solid var(--line); background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
    .family-rule-row:first-of-type { border-top: 0; }
    .family-rule-row:focus-visible { outline: 3px solid rgba(29,143,128,.25); outline-offset: 2px; border-radius: 8px; }
    .family-rule-row .category-icon { width: 36px; height: 36px; border-radius: 12px; }
    .family-rule-row-info { min-width: 0; flex: 1; }
    .family-rule-row strong { display: block; font-size: 14px; }
    .family-rule-row small { color: var(--muted); }
    .member-detail-header { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
    .member-detail-heading { flex: 1; min-width: 0; }
    .member-detail-back { flex: none; width: 36px; min-height: 44px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; color: var(--ink); cursor: pointer; }
    .member-back-icon { width: 27px; height: 27px; fill: currentColor; }
    .member-detail-back:focus-visible { outline: 3px solid rgba(29,143,128,.3); outline-offset: 2px; border-radius: 8px; }
    .member-detail-header .avatar { width: 62px; height: 62px; font-size: 17px; cursor: pointer; transition: transform .16s ease, box-shadow .16s ease; }
    .member-detail-header .avatar:hover { transform: scale(1.03); }
    .member-detail-header .avatar:focus-visible { outline: 3px solid rgba(29,143,128,.3); outline-offset: 3px; }
    .member-detail-header h1 { margin: 2px 0 0; font-size: clamp(30px, 8vw, 42px); }
    .member-avatar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
    .member-avatar-actions small { color: var(--muted); font-size: 12px; }
    .avatar-cropper { display: grid; gap: 14px; }
    .avatar-cropper-preview { position: relative; width: min(100%, 280px); margin: 0 auto; cursor: grab; touch-action: none; user-select: none; }
    .avatar-cropper-preview.dragging { cursor: grabbing; }
    .avatar-cropper-toolbar { display: grid; justify-items: center; gap: 8px; }
    .avatar-cropper-toolbar small { color: var(--muted); font-size: 12px; text-align: center; }
    .avatar-cropper canvas { width: 100%; aspect-ratio: 1; margin: 0 auto; border-radius: 24px; border: 1px solid var(--line); background: #eef1f1; display: block; }
    .avatar-cropper-circle {
      position: absolute; inset: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.92); box-shadow: 0 0 0 999px rgba(19, 34, 35, .22); pointer-events: none;
    }
    .avatar-cropper-controls { gap: 12px; }
    .member-detail-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
    .member-detail-card { padding: 18px; }
    .member-detail-card h2 { margin: 0 0 15px; }
    .member-detail-actions { display: flex; justify-content: space-between; gap: 10px; }
    .member-items-head { margin-top: 0; }
    .member-items-head .btn { white-space: nowrap; }
    .member-base-list-summary { padding: 16px; }
    .base-lists-grid { display: grid; gap: 16px; }
    .base-list-section { padding: 17px; }
    .base-list-section-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-bottom: 13px; }
    .base-list-section-heading { display: flex; align-items: center; gap: 11px; min-width: 0; }
    .base-list-section-heading .avatar { flex: none; margin: 0; width: 42px; height: 42px; border: 0; font-size: 12px; }
    .base-list-section-heading h2 { margin: 0; font-size: 19px; }
    .base-list-section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
    .base-list-items { border-top: 1px solid var(--line); }
    .base-list-empty { padding: 14px 0 2px; }
    @media (max-width: 560px) {
      .base-list-section-header { align-items: stretch; flex-direction: column; }
      .base-list-section-header > .btn { width: 100%; }
      .member-items-head { align-items: stretch; flex-direction: column; }
      .member-items-head > .btn { width: 100%; }
    }

    /* Settings */
    .settings-card { overflow: hidden; }
    .settings-row {
      width: 100%; min-height: 66px; padding: 11px 14px; border: 0; border-top: 1px solid var(--line); background: white; display: flex; align-items: center; gap: 12px; text-align: left; cursor: pointer;
    }
    .settings-row:first-child { border-top: 0; }
    .settings-row-icon { flex: none; width: 41px; height: 41px; border-radius: 13px; display: grid; place-items: center; color: var(--secondary-dark); background: var(--secondary-soft); }
    .settings-row > .icon:last-child { flex: none; }
    .settings-row-info { flex: 1; min-width: 0; }
    .settings-row-info strong { display: block; }
    .settings-row-info small { display: block; color: var(--muted); margin-top: 2px; line-height: 1.3; overflow-wrap: anywhere; }
    .settings-profile { padding: 18px; display: flex; align-items: center; gap: 14px; }
    .settings-profile .avatar { margin: 0; width: 58px; height: 58px; font-size: 16px; border: 0; }
    .settings-profile-info { flex: 1; min-width: 0; }
    .settings-profile-info h3 { margin: 0; overflow-wrap: anywhere; }
    .settings-profile-info p { margin: 3px 0 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
    #page-settings,
    #page-settings .settings-grid,
    #page-settings .settings-grid > div,
    #page-settings .notice-card > div { min-width: 0; }

    /* Bottom navigation */
    .bottom-nav {
      position: fixed;
      z-index: 25;
      left: 0; right: 0; bottom: 0;
      min-height: calc(72px + var(--safe-bottom));
      padding: 7px 7px var(--safe-bottom);
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      background: rgba(255,255,255,.94);
      backdrop-filter: blur(18px);
      border-top: 1px solid var(--line);
      box-shadow: 0 -8px 25px rgba(25,58,56,.08);
    }
    .bottom-link {
      min-height: 58px; border: 0; background: transparent; color: #7c8988; border-radius: 15px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10px; font-weight: 900; cursor: pointer; position: relative;
    }
    .bottom-link .icon { width: 22px; height: 22px; }
    .bottom-link.active { color: var(--secondary-dark); background: var(--secondary-soft); }
    .bottom-link.active::before { content: ""; position: absolute; top: 3px; width: 19px; height: 3px; border-radius: 99px; background: var(--secondary); }
    .lists-overview .empty-state { grid-column: 1 / -1; }
    /* Modal / sheet */
    .modal-backdrop {
      position: fixed; inset: 0; z-index: 100; display: none; align-items: flex-end; justify-content: center; padding: 0 0 var(--keyboard-inset); background: rgba(11,31,34,.52); backdrop-filter: blur(5px);
    }
    .modal-backdrop.open { display: flex; }
    .modal {
      width: 100%; max-height: min(92vh, calc(100dvh - var(--keyboard-inset))); overflow: auto; background: var(--bg); border-radius: 28px 28px 0 0; box-shadow: var(--shadow-md); animation: sheetUp .25s ease both;
    }
    @keyframes sheetUp { from { transform: translateY(26px); opacity: .6; } to { transform: none; opacity: 1; } }
    .modal-header { position: sticky; top: 0; z-index: 2; min-height: 68px; padding: 12px 16px; background: rgba(255,255,255,.93); backdrop-filter: blur(14px); display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
    .modal-header h2 { margin: 0; font-size: 21px; }
    .item-entry-modal .modal-header { display: none; }
    .item-entry-modal .modal-footer:empty { display: none; }
    .modal-body { padding: 18px 16px calc(22px + var(--safe-bottom) + var(--keyboard-inset)); }
    .modal-footer { position: sticky; bottom: 0; padding: 12px 16px calc(12px + var(--safe-bottom) + var(--keyboard-inset)); background: rgba(255,255,255,.96); backdrop-filter: blur(14px); border-top: 1px solid var(--line); display: flex; gap: 10px; }
    .modal-footer .btn { flex: 1; }

    .form-grid { display: grid; gap: 14px; }
    .item-task-title-row { min-width: 0; display: flex; align-items: center; gap: 14px; padding: 4px 2px 2px; }
    .item-task-title-row .item-task-complete { width: 31px; height: 31px; }
    .item-task-name-field { min-width: 0; flex: 1; }
    .item-entry-delete-button { position: absolute; right: 16px; bottom: calc(16px + var(--safe-bottom) + var(--keyboard-inset)); z-index: 3; padding: 0; border: 0; background: transparent; color: var(--danger); box-shadow: none; }
    .item-entry-delete-button:hover { background: transparent; color: var(--danger); }
    .field .item-task-name-input { min-height: 48px; max-height: 132px; padding: 9px 2px; overflow-y: hidden; resize: none; border: 0; border-radius: 0; background: transparent; font-size: 20px; font-weight: 800; line-height: 1.3; }
    .field .item-task-name-input:focus { outline: none; box-shadow: inset 0 -2px var(--secondary); }
    .form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    .field { display: grid; gap: 7px; }
    .field label { font-size: 12px; font-weight: 900; color: #455a59; }
    .field input, .field select, .field textarea {
      width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 14px; background: white; color: var(--ink); padding: 11px 13px;
    }
    .field textarea { min-height: 105px; resize: vertical; }
    .muted-copy { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
    .quantity-expression { display: grid; grid-template-columns: minmax(80px, 1fr) auto auto minmax(170px, 1fr); align-items: center; gap: 9px; }
    .quantity-expression > span { color: var(--muted); font-weight: 800; }
    .period-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
    .period-choice label { cursor: pointer; }
    .field .period-choice input, .permanent-inline-form .period-choice input { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; opacity: 0; pointer-events: none; }
    .period-choice label > span { min-height: 44px; display: grid; place-items: center; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--muted); font-size: 12px; font-weight: 900; transition: .15s ease; }
    .period-choice input:checked + span { border-color: var(--secondary); background: var(--secondary-soft); color: var(--secondary-dark); box-shadow: 0 0 0 1px var(--secondary); }
    .period-choice input:focus-visible + span { outline: 3px solid rgba(29,143,128,.25); outline-offset: 2px; }
    .quantity-static-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; }
    .quantity-static-row > span { min-width: 38px; color: var(--muted); font-weight: 900; }
    .quantity-stepper { min-height: 50px; display: grid; grid-template-columns: 50px minmax(0, 1fr) 50px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: white; }
    .quantity-stepper button { border: 0; background: var(--primary-soft); color: var(--primary-dark); font-size: 24px; font-weight: 800; cursor: pointer; }
    .quantity-stepper button:hover:not(:disabled) { background: #ffd8dc; color: var(--primary-dark); }
    .quantity-stepper button:active:not(:disabled) { background: #ffc8cd; color: var(--primary-dark); }
    .quantity-stepper button:focus-visible { outline-color: rgba(255,77,90,.34); outline-offset: -3px; }
    .quantity-stepper button:disabled { color: #aeb3b8; background: #f5f6f7; cursor: default; }
    .field .quantity-stepper input { min-width: 0; min-height: 48px; padding: 8px; border: 0; border-right: 1px solid var(--line); border-left: 1px solid var(--line); border-radius: 0; text-align: center; font-weight: 850; appearance: textfield; }
    .field .quantity-stepper input::-webkit-inner-spin-button,
    .field .quantity-stepper input::-webkit-outer-spin-button { margin: 0; appearance: none; }
    .period-choice-cards label > span { min-height: 74px; justify-items: start; align-content: center; text-align: left; }
    .period-choice-cards strong, .period-choice-cards small { display: block; }
    .period-choice-cards small { margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 700; line-height: 1.35; }
    .period-choice-cards input:checked + span small { color: var(--secondary-dark); }
    .member-permanent-section { display: grid; gap: 11px; margin-top: 4px; padding-top: 16px; border-top: 1px solid var(--line); }
    .member-permanent-section > div:first-child > strong { display: block; }
    .member-permanent-section > div:first-child > p { margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
    .member-permanent-section .family-rule-row { padding: 9px 0; }
    .permanent-inline-form { display: grid; grid-template-columns: minmax(130px, 2fr) 72px auto auto minmax(170px, 1fr) auto; align-items: center; gap: 8px; }
    .permanent-inline-form input, .permanent-inline-form select { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--ink); padding: 9px 11px; }
    .permanent-inline-form > span { color: var(--muted); font-weight: 800; }
    .permanent-inline-form .btn { min-height: 44px; padding-inline: 14px; }
    .permanent-inline-cancel { grid-column: 1 / -1; justify-self: end; }
    .permanent-inline-form .auth-error { grid-column: 1 / -1; }
    @media (max-width: 560px) {
      .quantity-expression { grid-template-columns: 72px auto auto minmax(150px, 1fr); }
      .permanent-inline-form { grid-template-columns: 72px auto auto minmax(150px, 1fr); }
      .permanent-inline-form > input:first-child { grid-column: 1 / -1; }
      .permanent-inline-form .btn { grid-column: 1 / -1; }
    }
    .helper { color: var(--muted); font-size: 11px; line-height: 1.4; }
    .toggle-row { min-height: 54px; display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
    .toggle-row:first-child { border-top: 0; }
    .toggle-row > div:first-child { flex: 1; }
    .toggle-row strong { display: block; font-size: 14px; }
    .toggle-row small { color: var(--muted); }
    .switch { appearance: none; width: 49px; height: 29px; border-radius: 999px; background: #d8dfdd; position: relative; cursor: pointer; transition: .2s ease; }
    .switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 21px; height: 21px; border-radius: 50%; background: white; box-shadow: 0 2px 7px rgba(0,0,0,.18); transition: .2s ease; }
    .switch:checked { background: var(--secondary); }
    .switch:checked::after { transform: translateX(20px); }

    /* Wizard */
    .wizard-modal { max-height: 100vh; min-height: 100vh; border-radius: 0; }
    .wizard-top { padding: 13px 16px 10px; background: white; border-bottom: 1px solid var(--line); }
    .wizard-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
    .wizard-head strong { font-size: 16px; }
    .wizard-progress { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-top: 12px; }
    .wizard-progress span { height: 5px; border-radius: 99px; background: var(--line); }
    .wizard-progress span.active { background: var(--primary); }
    .wizard-step-label { color: var(--muted); font-size: 11px; font-weight: 900; margin-top: 8px; }
    .wizard-content { padding: 22px 16px 110px; width: min(100%, 720px); margin: 0 auto; }
    .wizard-content h1 { font-size: 30px; }
    .wizard-step { display: none; }
    .wizard-step.active { display: block; animation: pageIn .22s ease; }
    .wizard-footer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 2; padding: 12px 16px calc(12px + var(--safe-bottom)); background: rgba(255,255,255,.95); backdrop-filter: blur(15px); border-top: 1px solid var(--line); display: flex; gap: 10px; }
    .wizard-footer .btn { flex: 1; }
    .wizard-footer #wizardRegenerate { flex: 1.35; padding-inline: 10px; font-size: 12px; }
    .choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    .choice-card {
      min-height: 98px; border: 1px solid var(--line); border-radius: 18px; padding: 13px; background: white; text-align: left; cursor: pointer; position: relative;
    }
    .choice-card.selected { border-color: var(--secondary); background: var(--secondary-soft); box-shadow: inset 0 0 0 1px var(--secondary); }
    .choice-card .choice-icon { width: 39px; height: 39px; border-radius: 13px; display: grid; place-items: center; background: var(--surface-2); color: var(--navy); margin-bottom: 11px; }
    .choice-card strong { display: block; font-size: 14px; }
    .choice-card small { color: var(--muted); font-size: 11px; }
    .choice-check { position: absolute; right: 10px; top: 10px; width: 21px; height: 21px; border: 2px solid #d4dcda; border-radius: 50%; display: grid; place-items: center; color: white; }
    .choice-card.selected .choice-check { background: var(--secondary); border-color: var(--secondary); }
    .choice-card.selected .choice-check::after { content: "✓"; font-size: 12px; font-weight: 900; }
    .participant-grid { display: grid; gap: 10px; }
    .participant-card { min-height: 72px; padding: 10px 12px; border: 1px solid var(--line); background: white; border-radius: 18px; display: flex; align-items: center; gap: 12px; cursor: pointer; text-align: left; position: relative; }
    .participant-card.selected { background: var(--secondary-soft); border-color: var(--secondary); }
    .participant-card .avatar { margin: 0; width: 46px; height: 46px; border: 0; }
    .participant-card > div:nth-child(2) { flex: 1; }
    .participant-card strong { display: block; }
    .participant-card small { color: var(--muted); }
    .participant-card .choice-check { position: static; }
    .summary-card { padding: 15px; margin-bottom: 12px; }
    .summary-row { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
    .summary-row:first-child { border-top: 0; }
    .summary-row .icon { color: var(--secondary); }
    .summary-row > div { min-width: 0; }
    .summary-label { display: block; margin-bottom: 3px; color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
    .summary-row strong { display: block; font-size: 13px; }
    .summary-row p { margin: 2px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
    .ai-card { padding: 17px; background: linear-gradient(145deg, #f2ecff, #eaf8f5); border: 1px solid #d8d2ed; border-radius: 20px; }
    .ai-card-head { display: flex; gap: 12px; align-items: flex-start; }
    .ai-spark { width: 45px; height: 45px; border-radius: 15px; display: grid; place-items: center; color: white; background: linear-gradient(145deg, #7559b2, #4f8a8c); }
    .ai-card p { color: #59626a; font-size: 12px; line-height: 1.5; margin: 5px 0 0; }

    .loading-overlay {
      position: fixed; inset: 0; z-index: 140; display: none; place-items: center; padding: 24px; background: rgba(255,255,255,.96); backdrop-filter: blur(15px);
    }
    .loading-overlay.open { display: grid; }
    .loading-card { width: min(100%, 380px); text-align: center; }
    .loader-orbit { width: 88px; height: 88px; border-radius: 50%; margin: 0 auto 22px; position: relative; display: grid; place-items: center; background: var(--secondary-soft); color: var(--secondary-dark); }
    .loader-orbit::before { content: ""; position: absolute; inset: -7px; border-radius: 50%; border: 3px solid transparent; border-top-color: var(--primary); border-right-color: var(--secondary); animation: spin 1.2s linear infinite; }
    @keyframes spin { to { transform: rotate(360deg); } }
    .loading-card h2 { font-size: 25px; }
    .loading-card p { color: var(--muted); min-height: 44px; line-height: 1.45; }
    .loading-dots { display: flex; justify-content: center; gap: 6px; }
    .loading-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--secondary); animation: pulse 1s ease-in-out infinite; }
    .loading-dots span:nth-child(2) { animation-delay: .15s; }
    .loading-dots span:nth-child(3) { animation-delay: .3s; }
    @keyframes pulse { 0%,100% { opacity: .25; transform: scale(.85); } 50% { opacity: 1; transform: scale(1); } }

    .toast {
      position: fixed; left: 50%; bottom: calc(88px + var(--safe-bottom)); z-index: 160; transform: translate(-50%, 18px); opacity: 0; pointer-events: none; width: min(calc(100% - 28px), 420px); padding: 13px 15px; background: #173234; color: white; border-radius: 15px; box-shadow: var(--shadow-md); display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 800; transition: .22s ease;
    }
    .toast.show { opacity: 1; transform: translate(-50%, 0); }

    .context-menu {
      position: fixed; z-index: 130; width: 210px; padding: 7px; border-radius: 16px; background: white; border: 1px solid var(--line); box-shadow: var(--shadow-md); display: none;
    }
    .context-menu.open { display: block; }
    .context-menu button { width: 100%; min-height: 43px; padding: 0 10px; border: 0; background: transparent; border-radius: 11px; display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer; font-size: 13px; font-weight: 800; }
    .context-menu button:hover { background: var(--surface-2); }
    .context-menu .danger { color: var(--danger); }

    .empty-state { padding: 32px 18px; text-align: center; }
    .empty-icon { width: 66px; height: 66px; border-radius: 22px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); margin: 0 auto 14px; }
    .empty-state p { color: var(--muted); max-width: 340px; margin: 0 auto 15px; line-height: 1.5; }

    .login-screen {
      position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; padding: 22px; background:
        radial-gradient(circle at 15% 0%, rgba(233,101,75,.2), transparent 22rem),
        radial-gradient(circle at 90% 90%, rgba(29,143,128,.18), transparent 25rem),
        var(--bg);
    }
    .login-screen.open { display: flex; }
    .login-card { width: min(100%, 420px); padding: 24px; border-radius: 28px; background: rgba(255,255,255,.92); border: 1px solid var(--line); box-shadow: var(--shadow-md); }
    .login-card .brand { margin-bottom: 30px; }
    .login-card h1 { font-size: 34px; }
    .login-card .lead { margin-bottom: 23px; }
    .login-note { padding: 12px; margin-top: 15px; border-radius: 14px; background: var(--secondary-soft); color: var(--secondary-dark); font-size: 12px; line-height: 1.45; }

    @media (max-width: 759px) {
      .modal.item-entry-modal { border-radius: 0; }
    }
    @media (min-width: 720px) {
      .page-container { padding-left: 24px; padding-right: 24px; }
      .hero-grid { grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); align-items: stretch; }
      .trip-hero, .home-trip-empty { grid-column: 1; grid-row: 1; }
      .quick-actions { grid-column: 2; grid-row: 1; grid-template-columns: 1fr; }
      .quick-action:first-child { grid-column: auto; }
      .quick-action { min-height: 0; flex-direction: row; align-items: center; justify-content: flex-start; gap: 14px; }
      .trip-list, .recent-grid, .family-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .settings-grid { grid-template-columns: 1.1fr .9fr; align-items: start; }
      .choice-grid { grid-template-columns: repeat(3, 1fr); }
      .participant-grid { grid-template-columns: repeat(2, 1fr); }
      .modal-backdrop { align-items: center; padding: 24px; }
      .modal { max-width: 600px; border-radius: 28px; max-height: 88vh; }
      .item-entry-modal .modal-footer { border-radius: 0 0 28px 28px; }
      .wizard-modal { max-width: 860px; min-height: auto; border-radius: 28px; }
      .wizard-footer { position: sticky; left: auto; right: auto; bottom: 0; }
    }

    @media (max-width: 599px) {
      .packing-share-button { width: 42px; min-width: 42px; padding: 0; }
      .packing-share-button span { display: none; }
      .page-title-row { flex-direction: column; gap: 14px; }
      .page-title-actions { width: 100%; flex-wrap: wrap; }
      .page-title-actions .btn { flex: 1 1 140px; }
      #page-settings .settings-grid { grid-template-columns: minmax(0, 1fr); }
      #page-settings .settings-profile {
        grid-template-columns: auto minmax(0, 1fr);
        display: grid;
        padding: 15px;
        gap: 12px;
      }
      #page-settings #editProfileButton { grid-column: 1 / -1; width: 100%; }
      #page-settings .settings-row { padding: 11px 12px; gap: 10px; }
      #page-settings .notice-card { min-width: 0; }
      #page-settings .notice-card p { overflow-wrap: anywhere; }
      .packing-filter-panel {
        position: fixed;
        top: calc(76px + env(safe-area-inset-top, 0px));
        left: 0;
        right: 0;
        bottom: calc(72px + var(--safe-bottom));
        width: 100vw;
        max-height: calc(100dvh - 148px - var(--safe-bottom) - env(safe-area-inset-top, 0px));
        border-radius: 0;
      }
      .packing-filter-head { min-height: 72px; padding: 14px 16px; }
      .packing-filter-options { max-height: calc(100dvh - 312px - (2 * var(--safe-bottom)) - env(safe-area-inset-top, 0px)); padding: 12px 16px 16px; }
      .packing-filter-footer { position: fixed; left: 0; right: 0; bottom: calc(72px + var(--safe-bottom)); padding: 12px 16px; }
    }

    @media (max-width: 1023px) {
      .page.active {
        animation: none;
        transform: none;
      }
      #page-lists,
      #page-trips,
      #page-family,
      #page-baselists { padding-bottom: 72px; }
      .page-title-row .page-create-button {
        position: fixed;
        z-index: 24;
        left: 16px;
        right: 16px;
        bottom: calc(72px + var(--safe-bottom) + 10px);
        width: auto;
        min-height: 52px;
        font-size: 16px;
        box-shadow: 0 8px 24px rgba(26, 60, 57, .2);
      }
      #page-baselists #baseItemsAddButton.page-create-button {
        position: fixed;
        z-index: 24;
        left: 16px;
        right: 16px;
        bottom: calc(72px + var(--safe-bottom) + 10px);
        width: auto;
        min-height: 52px;
        font-size: 16px;
        box-shadow: 0 8px 24px rgba(26, 60, 57, .2);
      }
    }

    #page-baselists .packing-headline { align-items: flex-start; }
    #page-baselists .packing-headline .btn { flex: none; white-space: nowrap; }
    .base-item-row { align-items: center; }
    .base-item-row .pack-item-info { align-self: center; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 4px; }
    .base-item-row .pack-item-name { width: auto; }
    .base-item-frequency { margin-top: 0; color: var(--muted); font-size: 12px; font-weight: 800; }

    @media (min-width: 1024px) {
      .desktop-sidebar { display: flex; flex-direction: column; }
      .app-main { margin-left: 260px; }
      .topbar .brand { display: none; }
      .topbar { justify-content: flex-end; padding-left: 26px; padding-right: 26px; }
      .bottom-nav { display: none; }
      .page-container { padding-top: 32px; padding-bottom: 50px; }
      .packing-fab { right: 30px; bottom: 30px; }
      .toast { bottom: 30px; }
      .trip-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
      .recent-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
      .family-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
      .category-list { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
      #page-packing .category-list,
      #page-baselists .category-list { grid-template-columns: minmax(0, 1fr); }
      .category-card.wide { grid-column: 1 / -1; }
      .wizard-footer { position: sticky; }
    }

    body.shared-list-mode .desktop-sidebar,
    body.shared-list-mode .topbar,
    body.shared-list-mode .bottom-nav,
    body.shared-list-mode #packingShareButton,
    body.shared-list-mode #packingMenuButton,
    body.shared-list-mode #aiSuggestionNotice,
    body.shared-list-mode #aiDebugButton { display: none !important; }
    .shared-list-brand { display: none; }
    body.shared-list-mode .shared-list-brand {
      width: fit-content;
      margin-bottom: 24px;
      display: inline-flex;
      align-items: center;
      gap: 9px;
      color: var(--ink);
      text-decoration: none;
      font-size: 16px;
      font-weight: 700;
      letter-spacing: -.02em;
      opacity: .78;
    }
    body.shared-list-mode .shared-list-brand:hover { opacity: 1; }
    body.shared-list-mode .shared-list-brand .brand-mark { width: 25px; height: 29px; }
    body.shared-list-mode .shared-list-brand .brand-letter { margin-top: 2px; font-size: 14px; }
    body.shared-list-mode .shared-list-brand .brand-mark::after { top: 5px; right: 5px; width: 3px; height: 3px; }
    body.shared-list-mode .shared-list-brand small { display: block; margin-top: 1px; font-size: 7px; letter-spacing: .11em; }
    body.shared-list-mode .app-main { margin-left: 0 !important; }
    body.shared-list-mode .page-container { padding-top: 28px; padding-bottom: 96px; }
    body.shared-list-mode #page-packing { padding-bottom: 0; }
    body.shared-list-mode #packingAddFab { bottom: calc(24px + var(--safe-bottom)); }
    body.shared-list-mode .toast { bottom: calc(24px + var(--safe-bottom)); }

    .share-link-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
    .share-link-field input { min-width: 0; font-size: 13px; }
    .share-link-copy { width: 48px; min-width: 48px; }
    .share-modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 16px; }
    .share-modal-note { margin-top: 14px; }

    @media (max-width: 599px) {
      body.shared-list-mode .packing-filter-panel { top: 0; bottom: 0; max-height: 100dvh; }
      body.shared-list-mode .packing-filter-options { max-height: calc(100dvh - 154px - var(--safe-bottom)); }
      body.shared-list-mode .packing-filter-footer { bottom: 0; padding-bottom: calc(12px + var(--safe-bottom)); }
      .share-modal-actions { grid-template-columns: minmax(0, 1fr); }
    }

    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
    }


    /* -----------------------------------------------------------------
       Brand refinement – quieter, editorial and less template-like
       ----------------------------------------------------------------- */
    :root {
      --bg: #ffffff;
      --surface: #ffffff;
      --surface-2: #fff2f3;
      --surface-3: #fff7f8;
      --ink: #20252b;
      --muted: #68717a;
      --line: #e3e6ea;
      --primary: #ff4d5a;
      --primary-dark: #d93645;
      --primary-soft: #ffe7e9;
      --secondary: #ff4d5a;
      --secondary-dark: #d93645;
      --secondary-soft: #ffe7e9;
      --gold: #b88a3a;
      --danger: #a43d43;
      --success: #36414b;
      --packed: #737c85;
      --navy: #20252b;
      --shadow-sm: 0 1px 2px rgba(32, 38, 33, .05), 0 8px 22px rgba(32, 38, 33, .05);
      --shadow-md: 0 3px 8px rgba(32, 38, 33, .08), 0 20px 48px rgba(32, 38, 33, .10);
      --radius-sm: 8px;
      --radius-md: 13px;
      --radius-lg: 18px;
    }

    body {
      background: var(--bg);
      font-family: Aptos, "Helvetica Neue", Helvetica, Arial, sans-serif;
      font-size: 15px;
      letter-spacing: -.005em;
    }

    h1, h2, .brand > span:last-child, .trip-hero h2, .login-card h1 {
      font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
      font-weight: 700;
    }
    h1 { letter-spacing: -.035em; }
    h2 { letter-spacing: -.025em; }
    h3 { letter-spacing: -.012em; }

    .desktop-sidebar {
      width: 248px;
      background: #fff7f8;
      backdrop-filter: none;
      border-right-color: var(--line);
    }
    .app-main { background: transparent; }

    .brand {
      gap: 12px;
      font-size: 23px;
      font-weight: 700;
      letter-spacing: -.025em;
    }
    .brand-mark {
      position: relative;
      width: 38px;
      height: 43px;
      border-radius: 3px;
      clip-path: polygon(0 0, 72% 0, 100% 24%, 100% 100%, 0 100%);
      display: grid;
      place-items: center;
      color: #ffffff;
      background: var(--ink);
      box-shadow: none;
      transform: rotate(-2deg);
    }
    .brand-mark::after {
      content: "";
      position: absolute;
      top: 7px;
      right: 7px;
      width: 5px;
      height: 5px;
      border-radius: 50%;
      background: var(--bg);
      box-shadow: 0 0 0 1px rgba(255,255,255,.35);
    }
    .brand-letter {
      font-family: "Iowan Old Style", Georgia, serif;
      font-size: 23px;
      font-weight: 700;
      line-height: 1;
      margin-top: 4px;
    }
    .brand small {
      margin-top: 2px;
      color: var(--muted);
      font-family: Aptos, "Helvetica Neue", Helvetica, Arial, sans-serif;
      font-size: 9px;
      letter-spacing: .13em;
      font-weight: 700;
    }
    .topbar .brand { font-size: 21px; }
    .topbar .brand-mark { width: 34px; height: 38px; border-radius: 3px; }
    .topbar .brand-letter { font-size: 20px; }

    .topbar {
      min-height: 68px;
      background: rgba(255,255,255,.94);
      backdrop-filter: blur(10px);
      border-bottom-color: var(--line);
    }

    .side-link {
      min-height: 46px;
      border-radius: 8px;
      font-weight: 650;
      color: #59615a;
    }
    .side-link.active {
      color: var(--ink);
      background: var(--primary-soft);
      box-shadow: inset 3px 0 0 var(--primary);
    }
    .side-link.active::after { display: none; }
    .side-card {
      border-radius: 12px;
      background: var(--ink);
    }

    .eyebrow {
      color: var(--secondary-dark);
      font-size: 11px;
      font-weight: 750;
      letter-spacing: .12em;
    }
    .lead { color: #697169; }

    .card,
    .category-card,
    .login-card,
    .modal,
    .wizard-modal {
      background: var(--surface);
      border-color: var(--line);
      box-shadow: var(--shadow-sm);
    }

    .trip-hero {
      border: 1px solid #42171d;
      border-radius: 16px;
      background: #5a2027;
      box-shadow: 0 14px 34px rgba(38, 56, 48, .16);
    }
    .trip-hero::before {
      content: "";
      position: absolute;
      inset: 0;
      pointer-events: none;
      opacity: .10;
      background-image: repeating-linear-gradient(125deg, transparent 0 28px, rgba(255,255,255,.5) 29px 30px);
    }
    .trip-hero::after {
      width: 140px;
      height: 140px;
      right: -78px;
      bottom: -82px;
      border-width: 1px;
      opacity: .65;
    }
    .trip-hero > * { position: relative; z-index: 1; }
    .trip-hero .eyebrow { color: #e4eee8; }
    .hero-stat {
      border-radius: 9px;
      background: rgba(255,255,255,.08);
      border-color: rgba(255,255,255,.18);
      backdrop-filter: none;
    }
    .progress-track { height: 7px; }
    .progress-bar { background: var(--primary); }

    .btn {
      min-height: 44px;
      border-radius: 8px;
      font-weight: 700;
      transition: background-color .16s ease, border-color .16s ease, transform .16s ease;
    }
    .btn-primary,
    .btn-secondary { box-shadow: none; }
    .btn-primary { background: var(--primary); }
    .btn-secondary { background: var(--secondary); }
    .btn-primary:hover { background: var(--primary-dark); box-shadow: none; }
    .btn-white { background: #ffffff; }
    .btn-soft { background: var(--secondary-soft); }

    .icon-button {
      border-radius: 8px;
      background: var(--surface);
      box-shadow: none;
    }
    .avatar-button { border-width: 1px; background: #e4c1aa; box-shadow: none; }

    .quick-action {
      min-height: 112px;
      border-radius: 12px;
      box-shadow: none;
    }
    .quick-action .bubble,
    .category-icon,
    .ai-spark,
    .empty-icon {
      border-radius: 8px;
    }
    .quick-action strong,
    .side-card strong,
    .member-row-info strong,
    .category-title strong { font-weight: 700; }

    .status-pill, .tag, .rule-count {
      border-radius: 6px;
      font-weight: 700;
    }
    .status-pill.ai { background: #ece7dd; color: #655d4d; }
    .status-pill.draft { background: #efe6cf; color: #755a23; }

    .segmented {
      border-radius: 10px;
      background: var(--surface-2);
    }
    .segmented button { border-radius: 7px; font-weight: 700; }
    .segmented button.active { box-shadow: none; }

    .packing-header {
      padding: 0;
      border: 0;
      border-radius: 0;
      background: transparent;
      box-shadow: none;
    }
    .search-input,
    .field input,
    .field select,
    .field textarea {
      border-radius: 8px;
      background: #ffffff;
    }
    .chip {
      min-height: 36px;
      border-radius: 8px;
      font-weight: 700;
    }
    .chip.active { border-color: #9db4aa; }
    .category-header { background: var(--surface); }
    .pack-item { background: var(--surface); }
    .pack-check { border-radius: 50%; }

    .ai-card {
      border-radius: 12px;
      background: var(--surface-3);
      border: 1px solid var(--line);
      border-left: 4px solid var(--secondary);
    }
    .ai-spark {
      color: var(--secondary-dark);
      background: #d9e3de;
    }

    .notice-card {
      border-radius: 10px;
      background: var(--primary-soft);
      border-color: #ffc8cd;
      color: var(--primary-dark);
    }

    .login-screen {
      background: var(--surface-3);
    }
    .login-card { border-radius: 16px; }
    .login-note { border-radius: 8px; }

    .modal-backdrop { background: rgba(28, 32, 29, .46); }
    .modal,
    .wizard-modal { border-radius: 16px; }
    .context-menu { border-radius: 10px; }
    .context-menu button { border-radius: 6px; }

    @media (min-width: 1024px) {
      .app-main { margin-left: 248px; }
    }


    /* -----------------------------------------------------------------
       Public landing page + OTP entry
       ----------------------------------------------------------------- */
    .landing-page {
      min-height: 100vh;
      background: var(--bg);
      overflow: hidden;
    }
    .landing-shell {
      width: min(calc(100% - 32px), 1160px);
      margin: 0 auto;
    }
    .landing-header {
      min-height: 76px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 18px;
      border-bottom: 1px solid var(--line);
    }
    .landing-header .brand { flex: 0 0 auto; }
    .landing-nav { display: none; align-items: center; gap: 28px; margin-left: auto; }
    .landing-nav a {
      color: #515a52;
      text-decoration: none;
      font-size: 14px;
      font-weight: 650;
    }
    .landing-nav a:hover { color: var(--ink); }
    .landing-login {
      min-height: 42px;
      padding: 0 14px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--surface);
      cursor: pointer;
      font-weight: 700;
    }
    .landing-login:hover { border-color: #aaa398; }

    .landing-hero {
      position: relative;
      display: grid;
      gap: 42px;
      padding: 68px 0 76px;
    }
    .landing-hero::before {
      content: "";
      position: absolute;
      z-index: 0;
      width: 340px;
      height: 340px;
      left: -220px;
      top: 45px;
      border: 1px solid #d5d0c5;
      border-radius: 50%;
    }
    .landing-hero-copy,
    .landing-preview { position: relative; z-index: 1; }
    .landing-kicker {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 18px;
      color: var(--secondary-dark);
      font-size: 11px;
      font-weight: 750;
      letter-spacing: .13em;
      text-transform: uppercase;
    }
    .landing-kicker::before { content: ""; width: 30px; height: 1px; background: var(--secondary); }
    .landing-hero h1 {
      max-width: 720px;
      margin-bottom: 20px;
      font-size: clamp(43px, 12.5vw, 78px);
      line-height: .96;
      letter-spacing: -.052em;
    }
    .landing-hero h1 em { color: var(--primary); font-style: normal; }
    .landing-hero .lead {
      max-width: 610px;
      font-size: clamp(17px, 4.4vw, 20px);
      line-height: 1.55;
    }
    .landing-hero-actions {
      display: flex;
      flex-direction: column;
      align-items: stretch;
      gap: 10px;
      margin-top: 28px;
    }
    .landing-hero-actions .btn { min-height: 50px; }
    .landing-subnote {
      display: flex;
      flex-wrap: wrap;
      gap: 10px 18px;
      margin-top: 17px;
      color: #68717a;
      font-size: 12px;
      font-weight: 650;
    }
    .landing-subnote span { display: inline-flex; align-items: center; gap: 6px; }

    .landing-preview {
      width: min(100%, 470px);
      justify-self: center;
    }
    .preview-window {
      position: relative;
      padding: 13px;
      border: 1px solid #cfc9be;
      background: #dad5ca;
      box-shadow: 0 24px 54px rgba(42, 45, 40, .14);
      transform: rotate(1.2deg);
    }
    .preview-window::before {
      content: "MITVIGYEK / 01";
      position: absolute;
      right: -10px;
      top: 66px;
      padding: 7px 9px;
      background: var(--primary);
      color: #fff;
      font-size: 9px;
      font-weight: 800;
      letter-spacing: .13em;
      transform: rotate(90deg) translateX(100%);
      transform-origin: right top;
    }
    .preview-app {
      overflow: hidden;
      border: 1px solid #c8c2b7;
      background: var(--surface);
    }
    .preview-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      min-height: 56px;
      padding: 9px 13px;
      border-bottom: 1px solid var(--line);
      background: #f4f1e9;
    }
    .preview-brand { display: flex; align-items: center; gap: 9px; font-family: "Iowan Old Style", Georgia, serif; font-weight: 700; }
    .preview-brand .brand-mark { width: 27px; height: 31px; }
    .preview-brand .brand-letter { font-size: 16px; }
    .preview-avatar { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; background: #e4c1aa; font-size: 10px; font-weight: 800; }
    .preview-body { padding: 18px 15px 17px; }
    .preview-body > small { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; font-weight: 750; }
    .preview-body h3 { margin: 5px 0 12px; font-family: "Iowan Old Style", Georgia, serif; font-size: 25px; }
    .preview-trip {
      padding: 15px;
      border: 1px solid #42171d;
      background: #5a2027;
      color: #fff;
    }
    .preview-trip-head { display: flex; justify-content: space-between; gap: 10px; }
    .preview-trip strong { font-family: "Iowan Old Style", Georgia, serif; font-size: 19px; }
    .preview-trip small { color: rgba(255,255,255,.7); }
    .preview-progress { height: 5px; margin-top: 14px; background: rgba(255,255,255,.18); }
    .preview-progress span { display: block; width: 63%; height: 100%; background: var(--primary); }
    .preview-list { margin-top: 12px; border: 1px solid var(--line); }
    .preview-item {
      display: grid;
      grid-template-columns: 22px 1fr auto;
      align-items: center;
      gap: 9px;
      min-height: 48px;
      padding: 7px 10px;
      border-bottom: 1px solid var(--line);
      font-size: 12px;
    }
    .preview-item:last-child { border-bottom: 0; }
    .preview-check { width: 19px; height: 19px; display: grid; place-items: center; border: 1px solid #a9a399; border-radius: 4px; }
    .preview-check.checked { background: var(--secondary); border-color: var(--secondary); color: #fff; }
    .preview-item small { color: var(--muted); }
    .preview-person { padding: 3px 6px; background: #ece8df; color: #5f625c; font-size: 9px; font-weight: 700; }
    .landing-handnote {
      width: fit-content;
      margin: -4px 10px 0 auto;
      padding: 8px 11px;
      background: #ffe7e9;
      box-shadow: 0 7px 16px rgba(55, 50, 38, .09);
      color: #8d2934;
      font-family: "Bradley Hand", "Segoe Print", cursive;
      font-size: 13px;
      transform: rotate(-2.5deg);
    }

    .landing-section { padding: 74px 0; border-top: 1px solid var(--line); }
    .landing-section-head { max-width: 690px; margin-bottom: 32px; }
    .landing-section-head h2 { font-size: clamp(34px, 9vw, 53px); line-height: 1.02; }
    .landing-section-head p { color: var(--muted); font-size: 16px; line-height: 1.6; }
    .landing-number { display: inline-block; margin-bottom: 13px; color: var(--primary); font-family: "Iowan Old Style", Georgia, serif; font-size: 16px; }

    .problem-band {
      padding: 26px 0;
      border-top: 1px solid var(--line);
      border-bottom: 1px solid var(--line);
      background: var(--ink);
      color: #ffffff;
    }
    .problem-band .landing-shell { display: grid; gap: 18px; }
    .problem-line { font-family: "Iowan Old Style", Georgia, serif; font-size: clamp(25px, 7vw, 38px); line-height: 1.14; }
    .problem-line em { color: var(--primary); font-style: normal; }
    .problem-note { max-width: 480px; color: #bec5bf; line-height: 1.55; }

    .step-grid { display: grid; gap: 14px; }
    .landing-step {
      min-height: 215px;
      padding: 22px;
      border: 1px solid var(--line);
      background: var(--surface);
    }
    .landing-step-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
    .landing-step-index { color: var(--primary); font-family: "Iowan Old Style", Georgia, serif; font-size: 30px; }
    .landing-step-icon { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface-2); }
    .landing-step h3 { margin-top: 34px; font-size: 21px; }
    .landing-step p { margin-bottom: 0; color: var(--muted); line-height: 1.55; }

    .feature-layout { display: grid; gap: 22px; }
    .feature-visual {
      min-height: 430px;
      padding: 18px;
      border: 1px solid #42171d;
      background: #5a2027;
      color: #fff;
    }
    .feature-visual-head { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 18px; border-bottom: 1px solid rgba(255,255,255,.18); }
    .feature-visual-head h3 { font-family: "Iowan Old Style", Georgia, serif; font-size: 27px; }
    .feature-visual-head p { color: rgba(255,255,255,.67); font-size: 12px; }
    .feature-rule { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 11px; min-height: 68px; border-bottom: 1px solid rgba(255,255,255,.14); }
    .feature-rule-icon { width: 32px; height: 32px; display: grid; place-items: center; background: rgba(255,255,255,.09); }
    .feature-rule small { display: block; color: rgba(255,255,255,.62); }
    .feature-rule-tag { padding: 4px 7px; border: 1px solid rgba(255,255,255,.2); font-size: 10px; font-weight: 700; }
    .feature-copy { display: grid; align-content: center; gap: 21px; }
    .feature-point { display: grid; grid-template-columns: 34px 1fr; gap: 12px; }
    .feature-point-index { color: var(--primary); font-family: "Iowan Old Style", Georgia, serif; font-size: 23px; }
    .feature-point h3 { margin-bottom: 4px; }
    .feature-point p { margin: 0; color: var(--muted); line-height: 1.55; }

    .privacy-panel {
      display: grid;
      gap: 24px;
      padding: 27px;
      border: 1px solid var(--line);
      background: #fff7f8;
    }
    .privacy-panel h2 { font-size: clamp(32px, 8vw, 48px); }
    .privacy-panel p { color: #59655e; line-height: 1.6; }
    .privacy-list { display: grid; gap: 10px; }
    .privacy-item { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; }
    .privacy-item .icon { color: var(--secondary); }

    .landing-final { padding: 76px 0 84px; text-align: center; }
    .landing-final h2 { max-width: 800px; margin: 0 auto 18px; font-size: clamp(39px, 10vw, 66px); line-height: .98; }
    .landing-final p { max-width: 560px; margin: 0 auto 27px; color: var(--muted); font-size: 17px; line-height: 1.6; }
    .landing-final .btn { min-height: 51px; }
    .landing-footer { padding: 24px 0 30px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
    .landing-footer-inner { display: flex; flex-direction: column; gap: 14px; }
    .landing-footer-links { display: flex; flex-wrap: wrap; gap: 14px 22px; }
    .landing-footer a { color: inherit; text-decoration: none; }

    .auth-card { position: relative; }
    .auth-close { position: absolute; right: 17px; top: 17px; }
    .auth-step[hidden] { display: none !important; }
    .auth-back {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      min-height: 34px;
      margin-bottom: 14px;
      padding: 0;
      border: 0;
      background: transparent;
      color: var(--muted);
      cursor: pointer;
      font-weight: 700;
    }
    .otp-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; margin: 15px 0; }
    .otp-input {
      width: 100%;
      min-width: 0;
      height: 52px;
      padding: 0;
      border: 1px solid #bdb7ac;
      border-radius: 7px;
      background: #ffffff;
      color: var(--ink);
      text-align: center;
      font-size: 22px;
      font-weight: 750;
      caret-color: var(--primary);
    }
    .otp-input:focus { border-color: var(--secondary); outline: 3px solid rgba(61,98,87,.14); }
    .auth-email-label { color: var(--ink); font-weight: 750; }
    .auth-resend { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; color: var(--muted); font-size: 12px; }
    .auth-resend button { border: 0; background: transparent; color: var(--secondary-dark); cursor: pointer; font-weight: 750; }
    .auth-error { min-height: 18px; margin: 8px 0 0; color: var(--danger); font-size: 12px; font-weight: 650; }
    .auth-success { display: grid; place-items: center; min-height: 300px; text-align: center; }
    .auth-success-mark { width: 64px; height: 64px; display: grid; place-items: center; margin-bottom: 18px; background: var(--secondary); color: #fff; }

    @media (min-width: 560px) {
      .landing-hero-actions { flex-direction: row; align-items: center; }
      .landing-hero-actions .btn { min-width: 178px; }
    }
    @media (min-width: 780px) {
      .landing-nav { display: flex; }
      .landing-hero { grid-template-columns: minmax(0, 1.1fr) minmax(360px, .72fr); align-items: center; padding: 94px 0 104px; }
      .landing-preview { justify-self: end; }
      .problem-band .landing-shell { grid-template-columns: 1.15fr .65fr; align-items: center; }
      .step-grid { grid-template-columns: repeat(3, 1fr); }
      .feature-layout { grid-template-columns: minmax(360px, .86fr) minmax(340px, 1fr); gap: 62px; }
      .privacy-panel { grid-template-columns: 1fr .92fr; align-items: center; padding: 44px; }
      .landing-footer-inner { flex-direction: row; align-items: center; justify-content: space-between; }
    }
    @media (min-width: 1040px) {
      .landing-shell { width: min(calc(100% - 64px), 1160px); }
      .landing-header { min-height: 84px; }
      .landing-section { padding: 100px 0; }
    }

  
/* Development-only OpenAI request/response viewer. */
.ai-debug-button {
  margin: 14px 0 16px;
  width: 100%;
  justify-content: center;
  border-style: dashed;
}
.ai-debug-notice {
  margin-bottom: 14px;
  background: var(--secondary-soft);
  border-color: #c7e5de;
  color: var(--secondary-dark);
}
.ai-debug-error {
  margin: 14px 0;
  background: #fff0f1;
  border-color: #efc7cb;
  color: var(--danger);
}
.ai-debug-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.ai-debug-meta-row {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .48);
}
.ai-debug-meta-row span,
.ai-debug-meta-row strong {
  display: block;
  overflow-wrap: anywhere;
}
.ai-debug-meta-row span {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.ai-debug-meta-row strong { font-size: 13px; }
.ai-debug-section {
  margin-top: 10px;
  border: 1px solid var(--line);
  background: #fffdf9;
}
.ai-debug-section summary {
  min-height: 44px;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 750;
}
.ai-debug-code {
  max-height: 340px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border-top: 1px solid var(--line);
  background: #222723;
  color: #f4f0e8;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 2;
}
@media (max-width: 520px) {
  .ai-debug-meta { grid-template-columns: 1fr; }
  .ai-debug-code { max-height: 280px; }
}


/* Mitvigyek mobile foundation */
html.is-native body {
  overscroll-behavior-y: none;
  -webkit-user-select: none;
  user-select: none;
}
html.is-native input, html.is-native textarea, html.is-native [contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
}
html.is-native .topbar {
  padding-top: max(12px, env(safe-area-inset-top));
}
html.is-native.keyboard-open {
  height: 100%;
}
html.is-native .auth-close { display: none; }
html.is-offline::after {
  content: "Offline";
  position: fixed;
  z-index: 1200;
  top: max(8px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 10px;
  border-radius: 999px;
  background: #2f2a26;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 5px 18px rgba(0,0,0,.16);
}
/* Keep the transparent product logo unobstructed in every brand placement. */
.brand-mark {
  overflow: visible;
  clip-path: none;
  color: inherit;
  background: transparent;
  box-shadow: none;
  transform: none;
}
.brand-mark::after { display: none; }
.brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scale(1.32);
}

/* 02 · Korallpiros · #FF4D5A — final application palette bindings. */
:focus-visible { outline-color: rgba(255, 77, 90, .34); }
.btn-primary,
.packing-fab { background: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.side-link.active { box-shadow: inset 3px 0 0 var(--primary); }
.progress-bar,
.switch:checked,
.choice-card.selected .choice-check { background: var(--primary); }
.choice-card.selected,
.chip.active { border-color: var(--primary); }
.choice-card.selected,
.chip.active,
.required-badge { color: var(--primary-dark); background: var(--primary-soft); }
.loader-orbit::before { border-top-color: var(--primary); }
