/* The phone app layout, used below 761px and inside the desktop phone preview. */
.m-app { --bar-h: 54px; }
@media (max-width: 760px) {
  .app-body { padding-bottom: 0; }
  body.is-embed .demo-bar { display: none; }
  body.is-embed { user-select: none; scrollbar-width: none; }
  body.is-embed::-webkit-scrollbar { display: none; }
  .m-bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 6px 12px; background: var(--accent); color: #fff; }
  .m-bar > img { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .35); border-radius: 8px; }
  .m-bar .icon-btn { margin-left: -6px; width: 44px; height: 44px; }
  .m-bar .icon-btn .icon { width: 24px; height: 24px; }
  .m-title { flex: 1; min-width: 0; font: 600 17.5px/1.2 var(--head); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .m-bar .avatar { width: 40px; height: 40px; background: #e1e6ea; }
  .m-filters { padding: 10px 12px 8px; background: var(--accent-tint); border-bottom: 1px solid #ccd4db; }
  .m-chips .tab { min-height: 40px; font-size: 14px; border-color: #bcc6cf; }
  .m-chips .tab.is-active { border-color: var(--accent); }
  .m-filterline { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; font-size: 13px; color: #2c3a45; }
  .m-filterline .btn { flex: none; min-height: 40px; }
  .content { padding: 14px 12px 104px; }
  .content > * + * { margin-top: 12px; }
  .page-head h1 { font-size: 20px; }
  .page-head p { font-size: 13.5px; }
  .page-actions .btn { min-height: 44px; }
  .page-actions .btn-primary[data-act="task-new"] { display: none; }
  .page-actions:not(:has(> :not([data-act="task-new"]))) { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis li > * { padding: 11px 12px; }
  .kpis li:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .k-value { font-size: 20px; }
  .k-name, .k-sub { font-size: 12.5px; }
  .grid { gap: 12px; }
  .grid + .grid { margin-top: 12px; }
  #main .checks-card { order: -1; }
  .card { padding: 12px 12px 10px; }
  .card-flush { padding: 0; }
  .card-flush > .card-head { padding: 12px 12px 8px; }
  .card h2 { font-size: 15.5px; }
  .seg button { min-height: 34px; padding: 0 11px; }
  .more-link { display: inline-flex; align-items: center; min-height: 40px; }
  .chart-table table { font-size: 13px; }
  .chart-table :is(th, td) { padding: 8px 5px; }
  thead th { white-space: normal; }
  .listbar { padding: 0 12px 10px; }
  .searchfield { flex: 1 1 100%; min-height: 44px; }
  .searchfield input { font-size: 16px; }
  .tab { min-height: 40px; }
  .inline-select { width: 100%; justify-content: space-between; }
  .inline-select select { min-height: 44px; flex: 1; max-width: 230px; font-size: 16px; }
  .card-tools .inline-select { width: auto; }
  .list-count { padding: 0 12px 8px; }
  .list-more { padding: 10px 12px; }
  .list-more .btn { min-height: 44px; }
  .rows li { border-top: 1px solid var(--line); }
  .rows li > :is(a, div) { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 62px; padding: 10px 12px; color: inherit; text-decoration: none; }
  .rows li > a:active { background: var(--soft); }
  .r-main { min-width: 0; }
  .r-main strong, .r-main small { display: block; line-height: 1.35; overflow-wrap: anywhere; }
  .r-main strong { font-size: 15px; font-weight: 600; }
  .r-main small { margin-top: 2px; color: var(--ink-2); font-size: 13px; }
  .r-end { display: grid; flex: none; justify-items: end; gap: 3px; font-size: 14px; font-variant-numeric: tabular-nums; }
  .r-end small { color: var(--ink-2); font-size: 12.5px; }
  .r-end .delta, .r-end .badge { font-size: 12.5px; }
  .r-actions .btn, .views .btn, .access .btn, .pays .btn { min-height: 44px; }
  .mini a { min-height: 54px; }
  .checks a { min-height: 56px; }
  .views li, .access li { padding: 12px; }
  .p-actions .btn { flex: 1 1 auto; min-height: 46px; }
  .p-title h1 { font: 700 20px/1.3 var(--head); }
  .list-more .btn, .empty .btn { min-height: 44px; }
  .p-sec .chart-card, .m-detail .chart-card { --xc-h: 170px; }
  .m-fab { position: fixed; right: 14px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 19; display: grid; place-items: center; width: 56px; height: 56px; border: 0; border-radius: 18px; background: var(--sand); color: #fff; box-shadow: 0 14px 26px -10px rgba(30, 35, 40, .6); cursor: pointer; }
  .m-fab .icon { width: 26px; height: 26px; }
  .m-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-2); background: var(--surface); }
  .m-tabs a { display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 54px; border-radius: 10px; color: var(--ink-2); font-size: 12px; font-weight: 600; text-decoration: none; }
  .m-tabs .icon { width: 22px; height: 22px; }
  .m-tabs a.is-active { background: var(--accent-tint); color: var(--accent-dark); }
  .m-who { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
  .m-who strong, .m-who small { display: block; } .m-who small { color: var(--ink-2); font-size: 13.5px; }
  .m-menu { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
  .m-menu li + li { border-top: 1px solid var(--line); }
  .m-menu :is(a, button) { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 0 14px; border: 0; background: none; color: var(--ink); font-weight: 600; text-align: left; text-decoration: none; cursor: pointer; }
  .m-menu span { flex: 1; }
  .m-menu .icon { color: var(--accent); }
  /* Popups slide up from the bottom */
  dialog { width: 100%; max-width: 100%; max-height: calc(100dvh - 40px); margin: auto 0 0; border-radius: 18px 18px 0 0; }
  dialog form { max-height: calc(100dvh - 40px); }
  .field :is(input, select, textarea) { min-height: 46px; font-size: 16px; }
  .modal-foot .btn { flex: 1; min-height: 46px; }
  .sheet-links .btn { min-height: 44px; }
  @media (prefers-reduced-motion: no-preference) { dialog[open] { animation: m-up .22s ease-out; } }
  .toasts { left: 12px; right: 12px; bottom: 144px; max-width: none; }
  .signin { padding: 28px 16px 40px; }
}
@media (max-width: 350px) {
  .kpis li > * { padding-inline: 9px; }
  .k-value { font-size: 18px; }
  .content { padding-inline: 8px; }
}
body.is-grabbing, body.is-grabbing * { cursor: grabbing !important; }
.tabs, .table-wrap { -webkit-overflow-scrolling: touch; }
@keyframes m-up { from { transform: translateY(40px); opacity: .4; } }

/* Desktop and phone switch in the demo bar */
.view-switch { display: none; }
.preview { display: none; }
@media (min-width: 900px) {
  .view-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 99px; background: rgba(52, 66, 78, .14); }
  .view-switch button { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 13px; border: 0; border-radius: 99px; background: none; color: #202b34; font-size: 13.5px; font-weight: 700; cursor: pointer; }
  .view-switch button .icon { width: 15px; height: 15px; }
  .view-switch button[aria-pressed="true"] { background: #fff; box-shadow: 0 1px 3px rgba(52, 66, 78, .25); }

  .app-body.is-preview { background: #e9e5dd; }
  .is-preview #app, .is-preview > dialog, .is-preview .toasts { display: none; }
  .is-preview .preview { display: flex; align-items: center; justify-content: center; gap: clamp(32px, 6vw, 96px); min-height: calc(100vh - var(--bar)); padding: 20px 32px; }
  .preview-notes { max-width: 360px; }
  .preview-notes h2 { font: 700 clamp(28px, 2.8vw, 38px)/1.12 var(--head); }
  .preview-notes > p { margin-top: 10px; color: var(--ink-2); font-size: 17px; }
  .preview-notes ul { margin-top: 20px; border-top: 1px solid var(--line-2); }
  .preview-notes li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
  .preview-notes li .icon { margin-top: 2px; color: var(--accent); }

  .device { --h: 844px; flex: none; width: 414px; padding: 11px; border-radius: 56px; background: #141517; box-shadow: 0 40px 70px -30px rgba(20, 21, 23, .65), inset 0 0 0 2px #45474c; }
  .device-screen { position: relative; display: flex; flex-direction: column; width: 392px; height: var(--h); border-radius: 45px; overflow: hidden; background: var(--surface); isolation: isolate; }
  .device-status { display: flex; align-items: center; justify-content: space-between; flex: none; height: 44px; padding: 0 30px; background: var(--surface); font-size: 15px; font-weight: 700; }
  .device-status::after { content: ""; width: 25px; height: 12px; border: 1.5px solid var(--ink); border-radius: 4px; background: linear-gradient(var(--ink), var(--ink)) 2px 50% / 16px 6px no-repeat; }
  .device-island { position: absolute; top: 10px; left: 50%; width: 108px; height: 26px; margin-left: -54px; border-radius: 99px; background: #141517; }
  .device iframe { flex: 1; width: 100%; min-height: 0; border: 0; background: var(--bg); }
  .device-home { flex: none; height: 12px; background: var(--surface); }
}

@media (max-width: 760px) {
  /* Role screen: both roles are visible at once, each as one large row */
  .signin .roles { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 22px; }
  .signin h1 { margin-top: 22px; font-size: 25px; text-wrap: balance; }
  .signin-sub { margin-inline: auto; font-size: 15px; text-wrap: balance; }
  .signin .role-points { display: none; }
  .signin .role { display: grid; grid-template-columns: 46px minmax(0, 1fr) 10px; grid-template-areas: "ico title go" "ico name go" "ico short go"; align-content: center; align-items: center; column-gap: 14px; row-gap: 1px; height: auto; min-height: 104px; padding: 16px; text-align: left; }
  .signin .role::after { content: ""; grid-area: go; width: 8px; height: 8px; border: solid currentColor; border-width: 2px 2px 0 0; transform: rotate(45deg); opacity: .55; }
  .signin .role-icon { grid-area: ico; align-self: center; }
  .signin .role-title { grid-area: title; margin: 0; font-size: 18px; line-height: 1.25; }
  .signin .role-name { grid-area: name; font-size: 14px; line-height: 1.35; }
  .signin .role-short { grid-area: short; display: block; font-size: 13.5px; line-height: 1.35; color: var(--ink-2); }
}

/* Desktop and Mobile switch sits in the exact middle of the bar */
@media (min-width: 900px) {
  .app-body .demo-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
  .app-body .demo-bar > p { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .app-body .demo-bar > .view-switch { justify-self: center; }
  .app-body .demo-bar > nav { justify-self: end; }
}
