/* Phone layout. Desktop styles remain untouched above this breakpoint. */
@media (max-width: 760px), (max-width: 1100px) and (max-height: 600px) {
  html, body { overflow: hidden; width: 100%; }
  #shell { height: 100dvh; width: 100%; overflow: hidden; }
  .topbar { display: flex; flex-wrap: nowrap; padding: 8px; gap: 6px; min-height: 60px; height: auto; }
  .topbar .brand, .topbar > .grow { display: none; }
  #coll-btn { flex: 1; min-width: 0; }
  #coll-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #bell-btn, #user-btn { flex: 0 0 44px; min-width: 44px; width: 44px; height: 44px; padding: 8px; }
  #user-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  #user-btn > span:last-child { display: none; }
  .body { flex-direction: column; min-width: 0; overflow: hidden; }
  .nav { width: 100%; flex-direction: row; overflow-x: auto; padding: 6px 8px; gap: 4px; border-right: 0; border-bottom: 1px solid var(--border); }
  .nav button { font-size: 13px; padding: 10px 12px; flex: 0 0 auto; white-space: nowrap; min-height: 44px; }
  .nav button .ico { flex: 0 0 18px; }
  .main, .main:has(.title-detail) { width: 100%; min-width: 0; padding: 12px; overflow: auto; overscroll-behavior: contain; }
  .work-page, .team-page, .profile-page, .fin-page, .plan-page, .title-detail { height: auto; min-height: 0; overflow: visible; }
  .main > *, .heading > *, .team-head > *, .plan-head > * { min-width: 0; }
  .heading, .team-head, .plan-head, .hist-top { flex-wrap: wrap; }
  .heading > .grow, .team-head > .grow, .plan-head > .grow { flex: 1 0 100%; }
  .page-title, .title-name { font-size: 24px; }
  .filters, .filter-bar, .ch-filters { flex-wrap: wrap; height: auto; overflow: visible; }
  .filters input, .filters select, .filter-bar input, .filter-bar select, .ch-filters input, .ch-filters select { min-width: 0; max-width: 100%; flex: 1 1 140px; }
  button, .work-small, .plan-icon { min-height: 40px; }
  input, select, textarea { font-size: 16px; max-width: 100%; }
  .work-panel, #work-list, .title-stack, #series-feed, #title-tab-series, #title-tab-chapters, #title-tab-history { flex: none; overflow: visible; height: auto; }
  .work-panel-head { flex-direction: column; align-items: stretch; }
  .lanes { justify-content: flex-start; }
  .grid2 { grid-template-columns: minmax(0,1fr); }
  .work-ident, .work-prog { min-width: 0; max-width: none; }
  .work-footer, .title-footer, .fin-charts { flex-direction: column; flex: none; }
  .work-sum { flex: none; max-height: 320px; }
  .work-sum-h, .work-sum-row { min-width: 500px; }
  #work-attention .work-sum-row { min-width: 0; grid-template-columns: 28px minmax(0,1fr) 70px; gap: 8px; }
  #work-attention .work-sum-row > :last-child { display: none; }
  .title-header { display: grid; grid-template-columns: 112px minmax(0,1fr); height: auto; flex: none; gap: 12px; }
  .cover-card, .cover-card img, .cover-card .cover-letter { width: 112px; height: 160px; }
  .cover-card { flex-basis: auto; }
  .cover-card .cover-btn { width: 100%; font-size: 11px; padding: 4px; white-space: normal; bottom: 0; }
  .title-info, .title-info:has(.title-blurb:empty):not(:has(.genre-chip)) { min-width: 0; height: auto; padding: 0; }
  .title-info .title-name { font-size: 20px; overflow-wrap: anywhere; }
  .title-info .metrics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); width: 100%; gap: 6px; }
  .metric { min-width: 0; height: auto; min-height: 62px; padding: 6px; }
  .metric .c { white-space: normal; overflow-wrap: anywhere; }
  .title-header .team-card, .title-header .title-actions { grid-column: 1 / -1; width: 100%; height: auto; min-width: 0; }
  .title-tabs { flex: none; }
  .series-row { flex-wrap: wrap; gap: 10px; }
  .series-gap, .series-grip { display: none; }
  .series-info { flex: 1; min-width: 120px; }
  .series-prog { min-width: 0; max-width: none; flex: 1 0 100%; }
  .people-grid { min-width: 0; max-width: 100%; }
  .duebox { min-width: 90px; flex: 1; }
  .series-tools { margin-left: auto; }
  .work-small { width: 40px; }
  .stat-row, .fin-kpi { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .stat-card { min-width: 0; padding: 10px; flex-wrap: wrap; }
  .ident-card { flex-wrap: wrap; height: auto; }
  .ident-main { flex: 1; }
  .ident-contacts { flex: 1 0 100%; }
  .ident-names { flex-wrap: wrap; gap: 8px; }
  .ov-grid { display: block; }
  .ov-right { margin-top: 12px; }
  .ov-left > .full-card { overflow-x: auto; }
  .task-head, .task-line { min-width: 650px; }
  .chapter-table, .team-table { display: block; overflow-x: auto; width: 100%; }
  .chapter-table th, .chapter-table td, .team-table th, .team-table td { min-width: 80px; }
  .hist-tabs { overflow-x: auto; flex: none; }
  .hist-tabs button { white-space: nowrap; flex: 0 0 auto; }
  .hist-embed, .hist-left { height: auto; flex: none; min-width: 0; }
  .hist-dock, .fin-dock { width: 100%; flex: none; }
  .plan-body { display: block; }
  .plan-timeline { flex: none; height: auto; max-height: 440px; min-height: 200px; }
  .plan-side { width: 100%; margin-top: 12px; }
  .plan-period { min-width: 100px; }
  .publish-card .row { flex-wrap: wrap; }
  .publish-card .grow { min-width: 0; }
  .ch-pager { flex-wrap: wrap; }
  .menu, #notify-menu, #notify-settings { position: fixed; left: 8px; right: 8px; top: 60px; width: auto; max-width: calc(100vw - 16px); max-height: calc(100dvh - 80px); overflow: auto; z-index: 1000; }
  #notify-settings { top: 68px; }
  #notify-menu #n-policy { grid-template-columns: minmax(0,1fr) 90px; }
  #notify-menu #n-save-policy { white-space: normal; }
  .modal-card { width: calc(100vw - 24px); max-width: calc(100vw - 24px); max-height: calc(100dvh - 32px); overflow: auto; padding: 16px; }
  .login-card { width: calc(100vw - 24px); }
}
@media (max-width: 760px), (max-width: 1100px) and (max-height: 600px) {
  .title-header .team-head { flex-wrap: nowrap; align-items: center; }
  .title-header .team-head > .grow { flex: 1; }
  .plan-toolbar { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); }
  .plan-toolbar > .grow { display: none; }
  .plan-toolbar .plan-period { grid-column: auto; min-width: 0; }
  .plan-toolbar #pl-today { grid-column: 1 / -1; }
}
@media (max-width: 760px), (max-width: 1100px) and (max-height: 600px) {
  .publish-card .row > .grow { flex: 1 1 calc(100% - 90px); }
  .publish-card .row > div:last-child { flex: 1 0 100%; }
  .publish-card .hist-user { flex-wrap: wrap; }
}
@media (max-width: 760px), (max-width: 1100px) and (max-height: 600px) {
  #notify-menu #n-ping-text { flex: 1 0 100%; width: 100%; order: 2; }
  #notify-menu #n-ping { order: 3; margin-left: auto; }
  #notify-menu #n-ping-user { flex: 1; }
}
