/* Additive, demo-only cross-screen component refinements. */
@media screen {
  body.app-shell .main :is(.btn, .chip) {
    max-width: 100%;
    min-width: 0;
    height: auto;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.4;
  }
  body.app-shell .main .btn > .ico { flex-shrink: 0; }
  body.app-shell .main .card-head .act .btn.small { white-space: normal; }
  body.app-shell .main :is(.page-actions, .card-head .act) {
    min-width: 0;
    max-width: 100%;
    flex-wrap: wrap;
  }
  body.app-shell .page-head h1 { min-width: 0; overflow-wrap: anywhere; }
  body.app-shell :is(.td-who, .sl-h, .sl-why, .tm-name, .tm-f) {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  body.app-shell .tm-name { flex-wrap: wrap; gap: 2px 8px; }
  body.app-shell .tm-name > * { min-width: 0; max-width: 100%; }
  body.app-shell .tm-pin { flex-wrap: wrap; max-width: 100%; }
  body.app-shell .tm-pin > input { flex: 1 1 12rem; min-width: 0; max-width: 100%; }
  body.app-shell .tm-pin > .btn { flex: 0 1 auto; white-space: normal; }
}

@media screen and (max-width: 840px) {
  body.app-shell .main :is(.btn, .btn.small, .chip) { min-height: 44px; }
  body.app-shell .main :is(.btn.icon, .btn.small.icon) { min-width: 44px; }
  body.app-shell .card-head { gap: 10px; flex-wrap: wrap; }
  body.app-shell .card-head > h2 { min-width: 0; overflow-wrap: anywhere; }
  body.app-shell .td-row { grid-template-columns: minmax(0, 1fr); gap: 7px; }
  body.app-shell .td-row .td-act { grid-column: 1; grid-row: auto; justify-content: flex-start; }
  body.app-shell .sl-row { grid-template-columns: minmax(0, 1fr); gap: 7px; }
  body.app-shell .sl-row .sl-ok { grid-column: 1; grid-row: auto; justify-self: start; }
  /* Task rows are compact records rather than a desktop-width table on phones. */
  body.app-shell #task-card .tbl,
  body.app-shell #task-card .tbl tbody { display: block; width: 100%; min-width: 0; }
  body.app-shell #task-card .tbl tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
  }
  body.app-shell #task-card .tbl td { display: block; width: auto !important; min-width: 0; border: 0; padding: 0; }
  body.app-shell #task-card .tbl td:nth-child(1) { grid-column: 1; }
  body.app-shell #task-card .tbl td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; overflow-wrap: anywhere; }
  body.app-shell #task-card .tbl td:nth-child(3) { grid-column: 2; grid-row: 1; display: flex; gap: 6px; }
  body.app-shell #task-card .tbl td:nth-child(3) .btn { min-width: 44px; }
}

/* Guest controls grow with their labels; existing handlers and links remain. */
body:has(> .topbar):not(.app-shell) .topbar { flex-wrap: wrap; }
body:has(> .topbar):not(.app-shell) .tb-right {
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
  justify-content: flex-end;
}
body:has(> .topbar):not(.app-shell) .tb-nav { min-width: 0; flex-wrap: wrap; }
body .drive-viewbar { min-width: 0; max-width: 100%; }
body .drive-view-switch { min-width: 0; max-width: 100%; }
body .drive-view-switch :is(a, span) {
  min-width: 0;
  height: auto;
  white-space: normal;
  overflow-wrap: anywhere;
  padding-block: 10px;
  text-align: center;
}
body:has(> .topbar):not(.app-shell) :is(.cta-btn, .dp-go, .bk-time span) {
  height: auto;
  min-height: 44px;
  white-space: normal;
  line-height: 1.4;
}
body:has(> .topbar):not(.app-shell) .bk-time span {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 4px;
}
body:has(> .topbar):not(.app-shell) .estimate .row > b:only-child {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
@media screen and (max-width: 700px) {
  /* em tracks respond to larger text as well as narrower viewports. */
  body:is(:has(> .wrap > .body > .title), :has(> .wrap2 > .nd-t)) .gd-summary {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 10em), 1fr));
  }
  body:is(:has(> .wrap > .body > .title), :has(> .wrap2 > .nd-t)) :is(.gd-summary-label, .gd-summary-price) {
    grid-column: auto;
    grid-row: auto;
  }
  body:is(:has(> .wrap > .body > .title), :has(> .wrap2 > .nd-t)) .gd-summary-note { grid-column: 1 / -1; }
}
@media screen and (max-width: 360px) {
  body:is(:has(> .wrap > .body > .title), :has(> .wrap2 > .nd-t)) .gd-summary {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
  }
  body:is(:has(> .wrap > .body > .title), :has(> .wrap2 > .nd-t)) .gd-summary-price {
    grid-column: 1;
    grid-row: auto;
    text-align: left;
    min-width: 0;
    white-space: normal;
  }
  body:is(:has(> .wrap > .body > .title), :has(> .wrap2 > .nd-t)) .gd-summary-note { grid-row: 3; }
  body:is(:has(> .wrap > .body > .title), :has(> .wrap2 > .nd-t)) { --gd-dock-space: calc(168px + env(safe-area-inset-bottom)); }
}

/* Guest showroom grid: keep trim/mileage and price visually connected.
   Only the empty spacing changes (16px -> 8px); gallery/list views retain
   their own alignment, and all amounts/disclosures remain in place. */
@media screen {
  body:has(> .topbar):not(.app-shell) #cars.v-grid > .vc .vc-p {
    margin-top: 8px;
  }
}

/* Long salesperson names and enlarged shift text fit their own components. */
@media screen {
  body.app-shell :is(.sell-s, .sold-row, .nis-st) .sold-by {
    display: inline-block;
    max-inline-size: 100%;
    height: auto;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.4;
    vertical-align: middle;
  }
  body.app-shell .z-shift .shift-week li { flex-wrap: wrap; }
  body.app-shell .z-shift .shift-week li :is(b, span) {
    max-inline-size: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}
@media screen and (max-width: 840px) {
  body.app-shell .z-shift .shift-week {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 10em), 1fr));
  }
  body.app-shell .z-shift .shift-week li span {
    display: flex;
    flex-wrap: wrap;
  }
}

/* Schedule leads the dashboard; its original controls and disclosure remain. */
@media screen {
  body.app-shell[data-nav="dashboard"] .dash-cols > .z-shift { order: -1; }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-card { padding: 18px 20px; }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-main { gap: 10px; }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-v {
    margin-top: 5px;
    font-size: clamp(23px, 2.15vw, 28px);
    line-height: 1.2;
    letter-spacing: -.035em;
  }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-s { font-size: 13.5px; line-height: 1.5; }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-season { margin-top: 4px; font-size: 12.5px; }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-edit { min-height: 36px; line-height: 1.5; }
}
@media screen and (min-width: 1100px) {
  body.app-shell[data-nav="dashboard"] .dash-cols > .z-shift { grid-column: 1 / -1; grid-row: 1; }
  body.app-shell[data-nav="dashboard"] .dash-main { grid-column: 1; grid-row: 2; }
  body.app-shell[data-nav="dashboard"] .dash-rail { grid-column: 2; grid-row: 2; }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-card {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(0, 2fr);
    align-items: start;
    gap: 20px;
  }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-wk {
    margin: 0;
    padding-left: 20px;
    border-left: 1px solid #ffffff26;
  }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-wknote { margin: 0 0 8px; }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-week {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
    margin: 0;
  }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-week li,
  body.app-shell[data-nav="dashboard"] .z-shift .shift-week li.today {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 4px;
    padding: 10px 7px;
    text-align: left;
  }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-week li b { font-size: 12px; }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-week li span {
    display: flex;
    flex-wrap: wrap;
    margin: 0;
    font-size: 12.5px;
    line-height: 1.4;
  }
}
@media screen and (max-width: 1099px) {
  body.app-shell[data-nav="dashboard"] .z-shift .shift-card { padding: 16px; }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-wk {
    margin-top: 10px;
    padding-top: 3px;
    border-top: 1px solid #ffffff26;
  }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-wk > summary { min-height: 36px; }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-wknote { margin-top: 6px; }
}
@media screen and (min-width: 360px) and (max-width: 560px) {
  body.app-shell[data-nav="dashboard"] .z-shift .shift-week {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-week li:not(.today) {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 8px;
  }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-week li b { font-size: 12.5px; }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-week li span {
    margin-top: 0;
    font-size: 13px;
    line-height: 1.4;
  }
}

/* Mobile Marketing: Tools belongs to the title, outside the everyday actions. */
@media screen and (max-width: 840px) {
  body.app-shell[data-nav="ads"] .page-head:has(.df-marketing-tools) {
    position: relative;
    align-items: flex-start;
  }
  body.app-shell[data-nav="ads"] .page-head:has(.df-marketing-tools) > h1 {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    width: 100%;
    min-height: 44px;
    height: auto;
    margin: 0;
    padding-inline-end: calc(7ch + 16px);
    box-sizing: border-box;
  }
  body.app-shell[data-nav="ads"] .page-head:has(.df-marketing-tools) > .page-actions {
    position: static;
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    align-items: flex-start;
    align-content: flex-start;
    gap: 8px;
    width: 100%;
    min-height: 0;
    height: auto;
  }
  body.app-shell[data-nav="ads"] .page-head:has(.df-marketing-tools) > .page-actions > .btn {
    flex: 0 1 calc(50% - 4px);
    width: calc(50% - 4px);
    min-width: 0;
    min-height: 44px;
    height: auto;
    align-self: flex-start;
    box-sizing: border-box;
  }
  body.app-shell[data-nav="ads"] .page-head:has(.df-marketing-tools) > .page-actions > .btn:last-of-type:nth-child(odd) {
    flex-basis: 100%;
    width: 100%;
  }
  body.app-shell[data-nav="ads"] .page-head .df-marketing-tools {
    position: absolute;
    top: 0;
    right: 0;
    left: auto;
    z-index: 41;
    width: max-content;
    max-width: 100%;
    height: auto;
    margin: 0;
  }
  body.app-shell[data-nav="ads"] .page-head .df-marketing-tools-panel {
    right: 0;
    left: auto;
    max-width: min(320px, calc(100vw - 32px));
    box-sizing: border-box;
  }
}

/* Schedule tiles: dates and wrapped shift hours share a centered reading line. */
@media screen {
  body.app-shell[data-nav="dashboard"] .z-shift .shift-week > li {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    row-gap: 0;
    column-gap: 0;
    min-width: 0;
    padding: 10px 8px;
    text-align: center;
  }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-week > li:not(.today) {
    display: flex;
  }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-week > li > b {
    display: block;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: center;
  }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-week > li > span.tnum {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    column-gap: 0;
    row-gap: 2px;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    margin: 5px 0 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: center;
  }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-week > li > span.tnum > i {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: center;
  }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-week > li.off > span.tnum {
    font-weight: 600;
  }
}

/* List cards keep their headings and original actions visible when folded. */
@media screen {
  body.app-shell .main .df-card-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 8px;
    min-width: 0;
    max-width: 100%;
  }
  body.app-shell .main .df-card-head > h2 {
    flex: 1 1 0;
    min-width: 0;
    margin: 0;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }
  body.app-shell .main .df-card-head > .act {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    width: auto;
    margin-left: auto;
    gap: 6px;
  }
  body.app-shell .main .df-card-head > .df-card-toggle {
    display: inline-flex;
    flex: 0 0 44px;
    align-self: center;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    height: 44px;
    padding: 0;
    margin: 0;
    border-radius: 8px;
    color: var(--ink-2);
  }
  body.app-shell .main .df-card-toggle::before {
    content: "";
    display: block;
    width: 8px;
    height: 8px;
    border-right: 1.8px solid currentColor;
    border-bottom: 1.8px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
  }
  body.app-shell .main .df-card-toggle[aria-expanded="true"]::before {
    transform: translateY(2px) rotate(225deg);
  }
  body.app-shell .main .df-card-content[hidden] { display: none !important; }
  body.app-shell .main .mgr-notes .df-card-head > .mn-all {
    flex: 0 0 auto;
    min-height: 44px;
    height: auto;
    padding: 6px 8px;
    margin: 0;
    font-size: 13px;
    line-height: 1.35;
    white-space: normal;
  }
  body.app-shell .main .mgr-notes .df-card-head > .mn-tally {
    order: 3;
    flex-basis: 100%;
  }
  body.app-shell .main .mgr-notes .df-card-head > .act {
    order: 4;
    flex: 1 1 100%;
    justify-content: flex-start;
    margin-left: 0;
  }
  body.app-shell .main .mgr-notes .df-card-head > .df-empty-actions { display: none; }
  body.app-shell .main .sold-hi .df-card-toggle { color: inherit; }
}

/* Marketing actions share a row height, including wrapped assignment labels. */
@media screen {
  body.app-shell[data-nav="ads"] .page-head:has(.df-marketing-tools) > .page-actions {
    align-items: stretch;
  }
  body.app-shell[data-nav="ads"] .page-head:has(.df-marketing-tools) > .page-actions > .btn {
    align-self: stretch;
    min-height: 44px;
  }
  body.app-shell[data-nav="ads"] .page-head > .page-actions > .btn > .tnum {
    flex-shrink: 0;
  }
  body.app-shell[data-nav="ads"] .page-head .df-marketing-tools { align-self: center; }
}
@media screen and (max-width: 840px) {
  body.app-shell[data-nav="ads"] .page-head:has(.df-marketing-tools) > .page-actions > .btn {
    min-height: 56px;
    padding-block: 7px;
  }
}

/* 2026-11-17 (유진 "랩탑 가독성"): 노트북에서도 7일을 한 줄로 (4+3 으로 접혀 빈 칸이 생겼다), 날짜 · 시간은 칸마다 한 줄,
   큰 근무 시간도 한 줄. 위 규칙들보다 뒤에 둬야 이긴다 */
@media screen and (min-width: 1100px) {
  body.app-shell[data-nav="dashboard"] .z-shift .shift-week { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-week > li > b { white-space: nowrap; overflow-wrap: normal; font-size: 12px; }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-week > li > span.tnum { display: block; white-space: nowrap; overflow-wrap: normal; font-size: 13px; letter-spacing: -.01em; }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-week > li > span.tnum > i { display: inline; white-space: nowrap; }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-week > li { padding: 9px 4px; }
  body.app-shell[data-nav="dashboard"] .z-shift :is(.shift-v, .shift-s) { white-space: nowrap; }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-wknote { margin: 8px 0 0; }
}
@media screen and (min-width: 1100px) and (max-width: 1399px) {
  body.app-shell[data-nav="dashboard"] .z-shift .shift-card { grid-template-columns: minmax(250px, .85fr) minmax(0, 2.15fr); gap: 16px; }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-wk { padding-left: 16px; }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-week { gap: 4px; }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-week > li > b { font-size: 11.5px; }
  body.app-shell[data-nav="dashboard"] .z-shift .shift-week > li > span.tnum { font-size: 12px; }
}
