/* Kaalinta — owner dashboard, phone version (<= 760px).
   The full dashboard is hidden on phones; this simpler one is shown instead.
   "Open the full dashboard here" (body.force-full) brings the full one back. */

#m-app { display: none; }
@media (max-width: 760px) {
  body:not(.force-full) .app, body:not(.force-full) .tabbar, body:not(.force-full) .drawer, body:not(.force-full) .scrim { display: none !important; }
  body:not(.force-full) #m-app { display: block; }
}

.m-main { padding: calc(14px + env(safe-area-inset-top, 0px)) 14px calc(96px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 14px; max-width: 520px; margin: 0 auto; }
.m-head { display: flex; flex-direction: column; gap: 2px; padding: 4px 2px 0; }
.m-crumb { font-size: 11.5px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
.m-sample { font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 99px; border: 1px dashed #bdb7ab; background: var(--card); }
.m-head h1 { margin: 0; font-size: 28px; font-weight: 400; letter-spacing: -0.03em; line-height: 1.15; }
.owe { color: var(--deyn-ink); }

.m-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: #e6e5e0; border-radius: 99px; padding: 4px; }
.m-seg button { border: 0; background: transparent; height: 42px; border-radius: 99px; font-weight: 500; font-size: 14px; color: var(--ink-2); }
.m-seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }

.m-card { background: var(--card); border-radius: var(--r); }
.m-hero { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.m-lbl { font-size: 11.5px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.m-big { font-size: 46px; font-weight: 300; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.m-big .c { font-size: 0.5em; color: var(--ink-3); letter-spacing: -0.01em; }
.m-big.owe .c { color: inherit; opacity: 0.7; }
.m-s2 { font-size: 12.5px; color: var(--ink-3); }
.m-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.m-pair div { background: var(--card-2); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; }
.m-pair span { font-size: 12.5px; color: var(--ink-3); }
.m-pair b { font-size: 18px; font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.m-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; border-top: 1px solid var(--line-2); padding-top: 14px; }
.m-grid div { display: flex; flex-direction: column; }
.m-grid span { font-size: 12.5px; color: var(--ink-3); }
.m-grid b { font-size: 19px; font-weight: 400; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.m-grid small { font-size: 11.5px; color: var(--ink-3); }
.m-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; border-top: 1px solid var(--line-2); padding-top: 12px; }
.m-wcol { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--ink-3); }
.m-wbar { height: 44px; width: 100%; max-width: 22px; display: flex; align-items: flex-end; }
.m-wbar i { display: block; width: 100%; background: #cfcdc7; border-radius: 4px 4px 0 0; }
.m-wcol:last-child .m-wbar i { background: var(--ink); }
.m-wcol:last-child { color: var(--ink); font-weight: 600; }

.m-sec { display: flex; flex-direction: column; gap: 8px; }
.m-sec-h { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 4px 0; }
.m-sec-h h2 { margin: 0; font-size: 16px; font-weight: 500; }
.m-sec-h span { font-size: 12.5px; color: var(--ink-3); }

.m-list { list-style: none; margin: 0; padding: 4px 0; }
.m-list li + li { border-top: 1px solid var(--line-2); }
.m-row { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 12px 16px; min-height: 62px; }
.m-row.static { cursor: default; }
.m-row:disabled { opacity: 0.45; cursor: default; }
.m-row:focus-visible { outline: 2.5px solid #23272880; outline-offset: -3px; }
.m-ic { grid-row: 1 / 3; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--line-2); font-weight: 600; font-size: 13px; color: var(--ink-2); }
.m-ic.warn { background: var(--partly-bg); color: var(--partly-ink); }
.m-t { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-s { font-size: 12.5px; color: var(--ink-3); grid-column: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-amt { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.m-amt small { font-size: 11px; color: var(--ink-3); font-weight: 400; }
.m-go { grid-row: 1 / 3; grid-column: 3; color: var(--ink-3); font-size: 13px; font-weight: 500; display: flex; align-items: center; }
.m-st { grid-column: 3; text-align: right; }
.m-owe-row .m-meter { grid-column: 2 / 4; }
.m-meter { display: block; height: 6px; border-radius: 99px; background: #f6dccd; overflow: hidden; margin-top: 6px; }
.m-meter i { display: block; height: 100%; background: var(--deyn); border-radius: 99px; }
.m-age.warn { color: var(--partly-ink); font-weight: 500; }
.m-age.old { color: var(--bad); font-weight: 600; }
.m-pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border-radius: 99px; font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.m-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; box-sizing: border-box; }
.m-pill.paid { color: var(--paid-ink); background: var(--paid-bg); }
.m-pill.paid::before { background: var(--paid); }
.m-pill.partly { color: var(--partly-ink); background: var(--partly-bg); }
.m-pill.partly::before { background: linear-gradient(90deg, var(--paid) 50%, var(--deyn) 50%); }
.m-pill.deyn { color: var(--deyn-ink); background: var(--deyn-bg); }
.m-pill.deyn::before { border: 2px solid var(--deyn); }
.m-pill.repayment { color: var(--repay-ink); background: var(--repay-bg); }
.m-pill.repayment::before { background: var(--repay); }
.m-empty { padding: 22px 16px; text-align: center; color: var(--ink-3); font-size: 14px; }

/* people on shift */
.m-people { display: flex; flex-direction: column; gap: 12px; }
.m-person { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.m-p-top { display: flex; align-items: center; gap: 12px; }
.m-av { width: 44px; height: 44px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 14px; flex: none; }
.m-person.later .m-av, .m-person.done .m-av { background: #dcdad4; color: var(--ink); }
.m-p-who { flex: 1; min-width: 0; }
.m-p-who b { display: block; font-weight: 500; font-size: 16px; }
.m-p-who span { font-size: 12.5px; color: var(--ink-3); }
.m-state { font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.m-state.now { background: var(--good-bg); color: var(--good); }
.m-state.done { background: var(--line-2); color: var(--ink-2); }
.m-state.later { background: var(--paid-bg); color: var(--paid-ink); }
.m-prog { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.m-prog i { display: block; height: 100%; background: var(--ink); border-radius: 99px; }
.m-person.done .m-prog i { background: #b9b8b2; }
.m-p-big { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.m-p-big div { background: var(--card-2); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; }
.m-p-big span { font-size: 12px; color: var(--ink-3); }
.m-p-big b { font-size: 19px; font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.m-p-stats { display: grid; grid-template-columns: repeat(3, 1fr); }
.m-p-stats div { display: flex; flex-direction: column; }
.m-p-stats div + div { padding-left: 12px; border-left: 1px solid var(--line-2); }
.m-p-stats b { font-size: 16px; font-weight: 500; font-variant-numeric: tabular-nums; }
.m-p-stats span { font-size: 12px; color: var(--ink-3); }
.m-p-note { margin: 0; font-size: 13px; color: var(--ink-2); }
.m-p-note b { color: var(--partly-ink); }
.m-p-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.m-filter { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--card); border-radius: 16px; padding: 10px 12px 10px 16px; font-size: 14px; }

/* buttons, fields, notes */
.m-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 52px; padding: 0 20px; border-radius: 99px; border: 0; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); font-weight: 500; font-size: 15px; color: var(--ink); text-decoration: none; cursor: pointer; white-space: nowrap; }
.m-btn.small { height: 40px; padding: 0 14px; font-size: 13.5px; }
.m-btn.block { width: 100%; }
.m-btn.primary { background: var(--ink); color: #fff; box-shadow: none; }
.m-btn.danger { background: var(--bad); color: #fff; box-shadow: none; }
.m-note { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--ink-2); padding: 12px 14px; border-radius: 16px; border: 1px dashed #cdc9bf; }
.m-note svg { flex: none; margin-top: 1px; }
.m-input { width: 100%; height: 52px; border: 0; border-radius: 16px; background: var(--card); padding: 0 16px; font-size: 16px; box-shadow: inset 0 0 0 1px var(--line); }
.m-input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--ink); }
.m-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.m-money { position: relative; display: block; }
.m-money i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--ink-3); font-size: 16px; }
.m-money .m-input { padding-left: 30px; }
.m-err { margin: 0; font-size: 13.5px; color: var(--bad); background: var(--bad-bg); padding: 10px 12px; border-radius: 12px; }
.m-kv { background: var(--card); border-radius: 18px; padding: 4px 16px; }
.m-kv div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; font-size: 14px; }
.m-kv div + div { border-top: 1px solid var(--line-2); }
.m-kv span:first-child { color: var(--ink-3); }
.m-kv span:last-child { text-align: right; font-variant-numeric: tabular-nums; }

/* bottom tabs */
.m-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); }
.m-tabs button { border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; font-size: 11.5px; color: var(--ink-3); min-height: 52px; }
.m-tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.m-tabs svg circle[r="1.6"] { fill: currentColor; stroke: none; }
.m-tabs button[aria-current="page"] { color: var(--ink); font-weight: 600; }
.m-tabs button[aria-current="page"] svg { color: var(--deyn); }

/* sheets */
.m-scrim { position: fixed; inset: 0; z-index: 30; background: #23272870; display: flex; align-items: flex-end; justify-content: center; }
.m-sheet { position: relative; width: 100%; max-width: 520px; max-height: 90dvh; overflow-y: auto; background: var(--bg); border-radius: 26px 26px 0 0; padding: 10px 16px calc(20px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 12px; }
.m-grip { width: 40px; height: 5px; border-radius: 99px; background: #cfcdc7; margin: 0 auto 4px; }
.m-close { all: unset; cursor: pointer; position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--card); }
.m-sheet h2 { margin: 0; font-size: 21px; font-weight: 500; letter-spacing: -0.02em; padding-right: 48px; }
.m-sheet p { margin: 0; font-size: 14.5px; color: var(--ink-2); }
.m-sheet p b { color: var(--ink); }

.m-sheet > * { flex-shrink: 0; }
