@media (min-width: 681px) {
  .mobile-only, .mobile-account-actions { display: none !important; }
  .trip-group { display: contents; }
}

.trip-library-link { margin-bottom: 16px; }
.pwa-install { display: none; }
.pwa-install-help p { margin-bottom: 14px; line-height: 1.55; }

@media (max-width: 680px) {
  :root {
    --mobile-gutter: clamp(16px, 6vw, 24px);
    --dock-gap: max(12px, env(safe-area-inset-bottom));
  }

  body { background: var(--paper); }
  .desktop-only { display: none !important; }
  .sidebar {
    height: calc(84px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) max(var(--mobile-gutter), env(safe-area-inset-right)) 0 max(var(--mobile-gutter), env(safe-area-inset-left));
    border: 0;
    background: var(--paper);
  }
  .sidebar .brand, .auth-story .brand { color: var(--ink); gap: 9px; font-weight: 800; }
  .sidebar .brand-dot, .auth-story .brand-dot, .sidebar-bottom { display: none; }
  .sidebar .brand-mark, .auth-story .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    color: transparent;
    background: url("/favicon.svg") center / contain no-repeat;
  }
  .mobile-account-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
  .mobile-account-actions .icon-btn, .mobile-trip-top .icon-btn {
    position: relative;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    color: var(--green);
  }
  .mobile-account-actions .friend-badge {
    position: absolute;
    top: 1px;
    right: 1px;
    padding: 1px 5px;
  }
  .mobile-account-actions .mobile-account-profile { border: 0; background: transparent; }
  .mobile-account-profile .avatar { width: 42px; height: 42px; background: #f2e6d9; color: var(--green); }

  .workspace { padding-bottom: calc(69px + var(--dock-gap)); }
  #main-content:not(.messenger-main) {
    padding: 16px max(var(--mobile-gutter), env(safe-area-inset-right)) 24px max(var(--mobile-gutter), env(safe-area-inset-left));
  }
  #main-content h1 { font-size: clamp(29px, 9vw, 38px); font-weight: 800; line-height: 1.12; overflow-wrap: anywhere; letter-spacing: -.045em; }
  #main-content h2 { font-weight: 800; letter-spacing: -.025em; }
  .mobile-description, .page-heading p { font-size: 13px; line-height: 1.55; color: var(--muted); }
  .mobile-eyebrow { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .055em; color: var(--green); }
  .mobile-dashboard .mobile-eyebrow { margin: 7px 0 10px; }
  .mobile-dashboard h1 { margin: 0 0 4px; }
  .mobile-dashboard .mobile-description { margin: 0 0 18px; }
  .mobile-dashboard h2, .mobile-overview h2 { font-size: 20px; margin: 24px 0 12px; }
  .mobile-dashboard .pwa-install { margin-top: 12px; }

  .mobile-cover, .trip-card:not(.is-past) {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    text-align: left;
    color: #fff;
    background: linear-gradient(125deg, #173d32, #0c2b24);
    border: 0;
    border-radius: 24px;
  }
  .mobile-cover::before, .trip-card:not(.is-past)::before {
    position: absolute;
    z-index: -1;
    inset: 0;
    content: "";
    background: url("/mobile-trip-cover.svg") right 6px center / min(56%, 210px) auto no-repeat;
  }
  .mobile-cover {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    min-height: 224px;
    padding: 16px;
  }
  .mobile-cover .pill, .trip-card:not(.is-past) .pill {
    background: var(--yellow);
    color: var(--ink);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
  }
  .mobile-cover > strong {
    margin: auto 0 14px;
    padding-top: 16px;
    font-size: clamp(23px, 7vw, 32px);
    font-weight: 800;
    line-height: 1.12;
    max-width: min(100% - 34px, 13ch);
    overflow-wrap: anywhere;
  }
  .mobile-cover > small, .trip-card:not(.is-past) .trip-card-footer { color: #e1efe8; }
  .mobile-cover > small { padding-right: 48px; }
  .mobile-cover-arrow, .trip-card:not(.is-past) .photo-arrow {
    position: absolute;
    inset: auto 14px 14px auto;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: var(--yellow);
    color: var(--green);
  }

  .mobile-list-link {
    display: grid;
    grid-template-columns: 42px minmax(0,1fr) 18px;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 66px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: #fff;
    color: var(--ink);
    text-align: left;
    text-decoration: none;
  }
  .mobile-list-link strong, .mobile-list-link small { display: block; overflow-wrap: anywhere; }
  .mobile-list-link strong { font-size: 14px; }
  .mobile-list-link small { margin-top: 3px; color: var(--muted); font-size: 12px; }
  .mobile-list-link > .icon { width: 18px; color: var(--green); }
  .mobile-list-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--soft); color: var(--green); }
  .mobile-decision { background: var(--selected); border-color: transparent; }
  .mobile-decision .mobile-list-icon { background: #fff; }

  #main-content[data-screen="trips"] .discovery-banner { display: none; }
  #main-content[data-screen="trips"] .page-heading { margin: 0 0 16px; }
  #main-content[data-screen="trips"] .page-heading h1 { margin: 0 0 4px; }
  #main-content[data-screen="trips"] .page-heading p { max-width: none; margin: 0; }
  .trip-utilities:not(:empty) { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
  .pwa-install, .trip-utilities .btn { display: inline-flex; margin: 0; }
  .trip-filters { margin: 0 0 18px; }
  .trip-filters .segmented, .inbox-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0;
    border: 0;
    background: transparent;
  }
  .trip-filters button, .inbox-filters button {
    min-height: 36px;
    padding: 6px 11px;
    border: 0;
    border-radius: 999px;
    background: var(--soft);
    color: var(--green);
    font-size: 11px;
    font-weight: 800;
  }
  .trip-filters [data-filter="all"] { order: -1; }
  .trip-filters button.selected, .inbox-filters button.selected { background: var(--green); color: #fff; box-shadow: none; }
  .trip-grid { display: grid; gap: 20px; }
  .trip-group { display: grid; min-width: 0; gap: 10px; }
  .trip-group h2 { display: flex; align-items: center; justify-content: space-between; margin: 0; font-size: 20px; }
  .trip-group h2 span { color: var(--muted); font-size: 12px; }
  .trip-grid .trip-card { min-width: 0; min-height: 162px; box-shadow: none; }
  .trip-card:not(.is-past) .trip-card-photo { position: static; height: auto; background: none; }
  .trip-card:not(.is-past) .trip-card-photo img { display: none; }
  .trip-card:not(.is-past) .trip-card-photo .pill { inset: 14px auto auto 15px; }
  .trip-card:not(.is-past) .trip-card-body { padding: 55px 60px 16px 16px; }
  .trip-card:not(.is-past) .trip-card-body .destination { display: none; }
  .trip-card:not(.is-past) .trip-card-body h3 {
    color: #fff;
    font-size: clamp(21px, 6vw, 27px);
    line-height: 1.16;
    max-width: 12ch;
    margin: 0 0 7px;
    overflow-wrap: anywhere;
  }
  .trip-card:not(.is-past) .trip-card-footer { padding-top: 0; border: 0; gap: 5px 12px; flex-wrap: wrap; }
  .trip-card.is-past {
    display: grid;
    grid-template-columns: 48px minmax(0,1fr);
    align-items: center;
    gap: 10px;
    min-height: 70px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: #fff;
  }
  .trip-card.is-past .trip-card-photo { height: 48px; border-radius: 12px; }
  .trip-card.is-past .trip-card-photo .pill, .trip-card.is-past .photo-arrow { display: none; }
  .trip-card.is-past .trip-card-body { padding: 0; }
  .trip-card.is-past .destination { display: none; }
  .trip-card.is-past .trip-card-body h3 { margin: 0 0 4px; font-size: 15px; overflow-wrap: anywhere; }
  .trip-card.is-past .trip-card-footer { padding: 0; border: 0; margin: 0; flex-wrap: wrap; color: var(--muted); }
  .mobile-new-trip { display: flex; width: 100%; margin-top: 22px; }
  #main-content[data-screen="trips"] { display: flex; flex-direction: column; }
  #main-content[data-screen="trips"] .trip-utilities { order: 1; margin: 14px 0 0; }

  .app-shell:has(.trip-heading) > .sidebar, .app-shell:has(.thread-open) > .sidebar { display: none; }
  #main-content:has(.trip-heading) { padding-top: calc(16px + env(safe-area-inset-top)); }
  #main-content:has(.guest-banner) { display: flex; flex-direction: column; }
  #main-content:has(.guest-banner) .trip-heading { order: -2; }
  #main-content:has(.guest-banner) .guest-banner { order: -1; }
  .trip-heading { margin: 0 0 14px; }
  .mobile-trip-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 17px;
    font-size: 15px;
  }
  .mobile-trip-people { margin-left: auto; }
  .trip-heading-row > div:first-child { min-width: 0; }
  .trip-heading-row .heading-actions { display: none; }
  .trip-heading-row p { font-size: 13px; line-height: 1.5; color: var(--muted); }
  .trip-heading .mobile-eyebrow { margin: 4px 0 8px; }
  #main-content[data-screen="overview"] .trip-heading-row p { display: none; }
  .mobile-trip-members { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; margin-top: 10px; }
  .mobile-trip-members .avatar { width: 27px; height: 27px; border-color: var(--paper); }
  .mobile-tabs {
    display: flex;
    gap: 2px;
    margin: 0 0 18px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: #fff;
  }
  .mobile-tabs button { flex: 1 1 auto; min-height: 38px; padding: 4px; border-radius: 11px; color: var(--muted); font-size: 11px; font-weight: 750; }
  .mobile-tabs button.selected { background: var(--soft); color: var(--green); }
  #main-content[data-screen="overview"] { display: flex; flex-direction: column; }
  .trip-overview-content, .trip-overview-summary { display: contents; }
  .trip-overview-primary { display: none; }
  .mobile-overview h2 { margin-top: 0; }
  .mobile-overview section { margin: 18px 0; }
  .mobile-overview .section-header { margin-bottom: 9px; gap: 8px; }
  .mobile-overview .section-header h2 { margin: 0; }
  .mobile-plan-list { background: #fff; border: 1px solid var(--line); border-radius: 17px; padding: 8px 12px; }
  .mobile-plan-list div { display: flex; align-items: center; gap: 10px; padding: 9px 0; font-size: 14px; }
  .mobile-plan-list div + div { border-top: 1px solid var(--line); }
  .mobile-plan-list div > span { flex-shrink: 0; background: var(--soft); color: var(--green); border-radius: 9px; padding: 5px 8px; font-size: 11px; font-weight: 800; }
  .mobile-plan-list strong { overflow-wrap: anywhere; }
  .trip-offline-actions { order: 1; gap: 8px; margin: 0 0 18px; }
  .trip-offline-actions .btn { flex: 1 1 auto; }
  .trip-overview-summary > :is(.participation-panel, .decisions-panel) { order: 2; }

  .panel, .modal, .member-card, .friend-card, .finance-summary {
    background: #fff;
    border-color: var(--line);
    border-radius: 20px;
    box-shadow: none;
  }
  #main-content .panel { min-width: 0; padding: 16px; }
  .panel h3, .member-card h3 { overflow-wrap: anywhere; }
  .btn, .icon-btn { min-height: 44px; }
  .btn { border-radius: 14px; border-color: var(--line); font-size: 13px; }
  .btn.primary { min-height: 48px; background: var(--green); color: #fff; border-color: var(--green); font-weight: 800; }
  .btn.primary:hover:not(:disabled) { background: #0b2d25; border-color: #0b2d25; }
  .btn.primary:disabled { background: var(--soft); color: var(--muted); border-color: var(--line); opacity: 1; }
  .btn.destructive { background: #fae9e8; color: #8e302d; border-color: transparent; }
  .pill.soft, .day-tab.selected, .budget-note, .stat-icon.green { background: var(--soft); color: var(--green); }
  .guest-banner, .notice { background: var(--info); border: 1px solid var(--line); border-radius: 17px; color: var(--green); font-size: 13px; }
  .guest-banner { margin-bottom: 14px; padding: 13px; }
  .guest-banner strong, .guest-banner p { overflow-wrap: anywhere; }
  .guest-banner p, .guest-banner small { color: var(--muted); }
  .modal { max-height: calc(100dvh - 24px - env(safe-area-inset-bottom)); }
  .modal input:not([type=checkbox]):not([type=radio]), .modal select, .modal textarea,
  .auth-form-wrap input, .friend-search input {
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    font-size: 16px;
  }

  .poll-panel { scroll-margin-top: 12px; }
  .focused-poll .trip-heading { margin-bottom: 0; }
  .focused-poll :is(.trip-heading-row, .mobile-tabs, .poll-intro, .poll-panel:not(.current-poll)) { display: none; }
  .focused-poll .guest-banner { padding: 10px 13px; }
  .focused-poll .proposal-card > .section-header:has(.stat-icon:only-child) { display: none; }
  .focused-poll .proposal-card h3 { margin: 0 0 6px; }
  #main-content .poll-panel { padding: 0; border: 0; background: transparent; }
  .poll-panel > .section-header { margin: 0 0 12px; }
  .poll-panel > .section-header h2 { font-size: clamp(26px, 8vw, 38px); line-height: 1.1; }
  .poll-panel > .section-header .tiny { font-size: 12px; }
  .poll-status { width: fit-content; margin: 0 0 10px; padding: 7px 11px; background: var(--soft); color: var(--green); border-radius: 999px; font-size: 10px; text-transform: uppercase; font-weight: 800; }
  .poll-panel > .section-header > .pill { display: none; }
  .mobile-vote-progress { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 17px; background: #fff; color: var(--ink); font-size: 12px; }
  .mobile-vote-progress progress { grid-column: 1 / -1; width: 100%; height: 7px; border: 0; border-radius: 99px; accent-color: var(--green); background: var(--soft); }
  .mobile-vote-progress progress::-webkit-progress-bar { background: var(--soft); border-radius: 99px; }
  .mobile-vote-progress progress::-webkit-progress-value { background: var(--green); border-radius: 99px; }
  .mobile-vote-progress progress::-moz-progress-bar { background: var(--green); border-radius: 99px; }
  .proposal-grid { gap: 9px; }
  .proposal-card { position: relative; padding: 13px; background: #fff; border: 1px solid var(--line); border-radius: 20px; }
  .proposal-card.is-selected, .proposal-card.chosen { background: var(--selected); border-color: var(--green); }
  .proposal-card:has(.mobile-vote-pick) > :is(h3, .section-header, p, .proposal-votes) { padding-right: 44px; }
  .mobile-vote-pick {
    position: absolute;
    top: 8px;
    right: 8px;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: transparent;
  }
  .mobile-vote-pick .icon { width: 24px; height: 24px; padding: 3px; border: 1px solid var(--muted); border-radius: 50%; color: transparent; background: #fff; }
  .mobile-vote-pick[aria-pressed="true"] .icon { background: var(--green); border-color: var(--green); color: #fff; }
  .proposal-actions:has(> .desktop-only:only-child) { display: none; }
  .mobile-vote-submit { display: grid; justify-items: center; gap: 8px; margin: 15px 0; }
  .mobile-vote-submit > .btn { width: 100%; justify-content: space-between; }
  .mobile-vote-submit p { margin: 0; }

  .bottom-dock, .guest-dock {
    inset: auto auto var(--dock-gap) 50%;
    transform: translateX(-50%);
    width: min(calc(100% - 32px), 440px);
    padding: 5px 7px;
    border: 1px solid var(--line);
    border-radius: 25px;
    background: #fff;
    box-shadow: 0 6px 22px #123c3214;
  }
  .bottom-dock .dock-tab {
    min-width: 0;
    min-height: 46px;
    padding: 3px;
    gap: 3px;
    color: #52645a;
    border-radius: 15px;
    font-weight: 800;
  }
  .bottom-dock .dock-tab > .icon { width: 20px; height: 20px; }
  .bottom-dock .dock-tab.is-current { background: var(--soft); color: var(--green); }
  .bottom-dock .dock-tab.is-current::after { display: none; }
  .bottom-dock .dock-create { width: 46px; height: 44px; margin: 0 clamp(2px, 1.3vw, 6px); background: var(--yellow); color: var(--green); box-shadow: none; }
  .bottom-dock .dock-create:hover { background: #cce775; }
  #toast { bottom: calc(69px + var(--dock-gap)); }

  .messenger-main { padding: 0 max(var(--mobile-gutter), env(safe-area-inset-right)) 0 max(var(--mobile-gutter), env(safe-area-inset-left)) !important; }
  .messenger { min-height: 0; height: auto; background: transparent; overflow: visible; }
  .conversation-list { height: auto; background: transparent; overflow: visible; }
  .inbox-header { padding: 12px 0 12px; }
  .inbox-header h1 { margin-bottom: 3px; }
  .inbox-header p { margin: 0; }
  .inbox-header > .icon-btn { width: 44px; height: 44px; background: var(--yellow); color: var(--green); border-radius: 14px; }
  .inbox-search { min-height: 44px; margin: 0 0 10px; border: 1px solid var(--line); border-radius: 14px; color: var(--green); background: #fff; }
  .inbox-search input { font-size: 16px; }
  .inbox-filters { margin-bottom: 14px; }
  .inbox-filters .selected::after, .conversation-list > .chat-refresh-note { display: none; }
  .inbox-list-label { margin: 0 0 9px; font-size: 20px; }
  #conversation-rows { flex: initial; padding: 4px; background: #fff; border: 1px solid var(--line); border-radius: 20px; }
  .conversation-row { border-radius: 15px; margin: 0; }
  .conversation-row.unread { background: var(--selected); }
  .conversation-avatar { background: #f2e6d9; color: var(--green); }
  .group-avatar { background: var(--info); }
  .conversation-preview > span, .conversation-title time { color: var(--muted); }
  .unread-badge { background: var(--green); }
  .app-shell:has(.thread-open) .workspace { padding: 0; }
  .app-shell:has(.thread-open) > .bottom-dock { display: none; }
  .messenger-main:has(.thread-open) { padding: 0 !important; }
  .messenger.thread-open { height: 100dvh; padding-top: env(safe-area-inset-top); }
  .conversation-thread { background: var(--paper); }
  .thread-header { background: var(--paper); border-color: var(--line); }
  .telegram-bubble { border: 1px solid var(--line); border-radius: 17px 17px 17px 5px; box-shadow: none; }
  .outgoing .telegram-bubble { background: var(--soft); border-radius: 17px 17px 5px 17px; }
  .telegram-meta, .telegram-author { color: var(--muted); }
  .telegram-compose { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .send-message { width: 44px; height: 44px; border-radius: 14px; background: var(--yellow); color: var(--green); }
  .send-message:hover { background: #cce775; }

  .auth-layout, .auth-panel, .auth-story { background: var(--paper); color: var(--ink); }
  .auth-story { min-height: 0; padding: calc(24px + env(safe-area-inset-top)) var(--mobile-gutter) 12px; }
  .auth-story::before, .auth-story::after, .auth-story .auth-copy { display: none; }
  .auth-panel { padding: 18px var(--mobile-gutter) 32px; }
  .auth-form-wrap h2 { font-size: clamp(29px, 9vw, 38px); font-weight: 800; line-height: 1.12; }
  .auth-form-wrap .pwa-install { display: flex; width: 100%; justify-content: center; margin-top: 12px; }
  :is(button, a, input, select, textarea):focus-visible { outline: 3px solid #367db5; outline-offset: 2px; }
}
