/* Orbit mobile – phone layout on top of styles.css (same colors, badges and dark mode). */

.m-body {
  height: 100%; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; font-size: 15px;
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
}
.m-body button { -webkit-user-select: none; user-select: none; }
.grow { flex: 1; }

/* top bar */
.m-top {
  flex: none; display: flex; align-items: center; gap: 4px; padding: calc(env(safe-area-inset-top) + 6px) 8px 6px;
  background: var(--topbar); border-bottom: 1px solid var(--border);
}
.m-icon-btn { border: 0; background: none; color: var(--text); font-size: 22px; width: 40px; height: 40px; border-radius: 10px; flex: none; }
.m-icon-btn:active { background: var(--hover); }
.m-titlebtn {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; border: 0; background: none; color: var(--text);
  font-weight: 800; font-size: 17px; padding: 6px 4px; text-align: left;
}
#m-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-caret { color: var(--muted); font-size: 12px; }
.m-sync { border: 0; background: none; font-size: 13px; font-weight: 700; color: var(--muted); padding: 6px 8px; border-radius: 8px; white-space: nowrap; }
.m-sync.ok { color: var(--u-done); }
.m-sync.syncing { color: var(--accent-text); animation: m-spin 1s linear infinite; }
.m-sync.warn { color: var(--u-soon2); background: var(--u-soon2-bg); }
.m-sync.err { color: var(--u-overdue); background: var(--u-overdue-bg); }
@keyframes m-spin { to { transform: rotate(360deg); } }

/* content */
#m-view { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 12px 110px; }
.m-tabs {
  flex: none; display: flex; background: var(--topbar); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.m-tabs button {
  flex: 1; border: 0; background: none; color: var(--muted); font-size: 11.5px; font-weight: 700; padding: 7px 0 8px;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.m-tabs button span { font-size: 19px; }
.m-tabs button.on { color: var(--accent-text); }
.m-fab {
  position: fixed; right: 18px; bottom: calc(env(safe-area-inset-bottom) + 74px); width: 58px; height: 58px; border-radius: 50%;
  border: 0; background: var(--accent); color: #fff; font-size: 32px; line-height: 1; box-shadow: var(--shadow-pop); z-index: 10;
}
.m-fab:active { transform: scale(.94); }

.m-sec {
  display: flex; align-items: center; gap: 6px; margin: 18px 2px 6px; font-size: 12px; font-weight: 800; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted);
}
.m-sec span { font-weight: 600; }
.m-sec.alert { color: var(--u-overdue); }
.m-toggle { border: 0; background: none; padding: 0; width: 100%; text-align: left; }
.m-empty { color: var(--muted); text-align: center; padding: 48px 16px; line-height: 1.7; }
.m-empty.small { padding: 10px; }

/* rows */
.m-row {
  width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: var(--card); color: var(--text); text-align: left;
  border-radius: 12px; padding: 10px 12px; margin-bottom: 6px; box-shadow: var(--shadow-card); min-height: 52px; text-decoration: none;
}
.m-row:active, .m-main:active { filter: brightness(.96); }
.m-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; border: 0; background: none; color: inherit; padding: 0; text-align: left; }
.m-ttl { font-weight: 650; line-height: 1.3; word-break: break-word; }
.m-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12.5px; color: var(--muted); }
.m-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.m-notes { font-size: 12.5px; color: var(--text-2); }
.m-kind { font-weight: 700; color: var(--u-soon); }
.m-chev { color: var(--faint); font-size: 22px; flex: none; }
.m-icon { width: 22px; text-align: center; flex: none; }
.m-topic { border-left: 5px solid var(--c); }
.m-dot { display: none; }
.m-item { border-left: 4px solid var(--c); padding-left: 8px; }
.m-item.prio-high { border-left-color: #ef4444; }
.m-item.overdue { background: color-mix(in srgb, #ef4444 12%, var(--card)); }
.m-item.done .m-ttl { text-decoration: line-through; color: var(--muted); }
.m-check {
  flex: none; width: 30px; height: 30px; border-radius: 9px; border: 2px solid var(--border-strong); background: var(--input);
  color: #fff; font-size: 17px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.m-check.on { background: var(--u-done); border-color: var(--u-done); }
[data-theme="dark"] .m-check.on { background: #22c55e; border-color: #22c55e; color: #0b1a10; }

/* topic page */
.m-head { margin: 10px 0 4px; padding: 14px 14px 12px; border-radius: 14px; background: var(--card); border-left: 6px solid var(--c); box-shadow: var(--shadow-card); }
.m-head h2 { margin: 2px 0 8px; font-size: 22px; line-height: 1.25; }
.m-head .m-sub { gap: 6px; }
.m-head .pill { border: 0; font-size: 13px; padding: 3px 10px; }
.m-crumb { font-size: 12.5px; color: var(--muted); }
.m-desc { margin: 10px 0 0; color: var(--text-2); white-space: pre-wrap; word-break: break-word; line-height: 1.45; }
.m-card { background: var(--card); border-radius: 12px; box-shadow: var(--shadow-card); overflow: hidden; margin-bottom: 6px; }
.m-citem, .m-trow, .m-linkrow {
  width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: none; color: var(--text); text-align: left;
  padding: 10px 12px; border-bottom: 1px solid var(--border); min-height: 46px; text-decoration: none;
}
.m-citem:last-child, .m-trow:last-child, .m-linkrow:last-child { border-bottom: 0; }
.m-citem .m-check { width: 26px; height: 26px; font-size: 15px; }
.m-citem.done { color: var(--muted); text-decoration: line-through; }
.m-trow span:first-child { flex: 1; min-width: 0; }
.m-trow.done { opacity: .55; }
.m-trow .pill { flex: none; font-size: 11px; }
.m-linkrow span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--link); }
.m-note { border-radius: 10px; padding: 0; margin-bottom: 6px; color: #1f2937; box-shadow: 0 1px 4px rgba(0, 0, 0, .18); }
.m-note.note-yellow { background: #fff2a8; } .m-note.note-blue { background: #d7e8ff; } .m-note.note-green { background: #d4f5dc; }
.m-note.note-pink { background: #fde0ef; } .m-note.note-purple { background: #e7e0ff; } .m-note.note-white { background: #fff; }
.m-note-body { width: 100%; border: 0; background: none; color: inherit; text-align: left; padding: 11px 13px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; line-height: 1.45; }
.m-note-body .full { white-space: pre-wrap; word-break: break-word; }
.m-note a { color: #1d4ed8; }
.m-note .m-link-btn { margin: 0 13px 10px; color: #1d4ed8; }
.m-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; }
.m-thumb { position: relative; aspect-ratio: 1; border: 0; padding: 0; border-radius: 10px; overflow: hidden; background: var(--chip); color: var(--muted); }
.m-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.m-thumb i { position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 6px; font-size: 11px; font-style: normal; background: rgba(0, 0, 0, .55); color: #fff; text-align: left; }
.m-searchbar { position: sticky; top: 0; padding: 8px 0; background: var(--bg-app); z-index: 2; }
.m-searchbar input, .m-input {
  width: 100%; border: 1px solid var(--border-strong); background: var(--input); color: var(--text); border-radius: 10px;
  padding: 10px 12px; font: inherit; font-size: 16px; outline: none;
}
.m-input:focus, .m-searchbar input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }

/* sheets */
.m-sheet-back { position: fixed; inset: 0; background: rgba(8, 12, 25, 0); z-index: 50; display: flex; align-items: flex-end; transition: background .2s; }
.m-sheet-back.show { background: rgba(8, 12, 25, .45); }
.m-sheet {
  width: 100%; max-height: 92dvh; overflow-y: auto; background: var(--panel); border-radius: 18px 18px 0 0; padding: 6px 16px calc(env(safe-area-inset-bottom) + 16px);
  transform: translateY(100%); transition: transform .22s ease-out; box-shadow: var(--shadow-pop);
}
.m-sheet-back.show .m-sheet { transform: none; }
.m-grab { width: 40px; height: 5px; border-radius: 3px; background: var(--border-strong); margin: 4px auto 10px; }
.m-sheet-title { font-weight: 800; font-size: 17px; margin: 2px 0 12px; }
.m-sheet-title small { display: block; font-weight: 500; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.m-form { display: flex; flex-direction: column; gap: 10px; }
.m-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.m-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.m-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.m-btn { border: 1px solid var(--border-strong); background: var(--btn); color: var(--text); border-radius: 10px; padding: 11px 16px; font-weight: 700; font-size: 15px; }
.m-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.m-btn.danger { color: var(--danger); }
.m-btn.big { width: 100%; padding: 14px; font-size: 16px; }
.m-link-btn { border: 0; background: none; color: var(--link); font-weight: 600; padding: 8px 0; font-size: 14px; }
.m-seg { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; scrollbar-width: none; }
.m-seg::-webkit-scrollbar { display: none; }
.m-seg button { flex: none; border: 1px solid var(--border); background: var(--btn); color: var(--text-2); border-radius: 999px; padding: 7px 12px; font-weight: 700; font-size: 13.5px; }
.m-seg button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.m-photo { position: relative; display: flex !important; align-items: center; justify-content: center; min-height: 120px; border: 2px dashed var(--border-strong); border-radius: 12px; color: var(--text-2) !important; font-size: 15px !important; overflow: hidden; }
.m-photo input { position: absolute; inset: 0; opacity: 0; }
.m-photo img { max-width: 100%; max-height: 240px; display: block; }
.m-photo img:not([hidden]) + span, .m-photo span:has(+ img:not([hidden])) { display: none; }
.m-list .m-row { box-shadow: none; border: 1px solid var(--border); }
.m-hint { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.5; }
.m-hint code { word-break: break-all; }
.m-dl { margin: 0 0 8px; }
.m-dl dt { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 10px; }
.m-dl dd { margin: 2px 0 0; white-space: pre-wrap; word-break: break-word; line-height: 1.45; }
.m-setup { text-align: center; padding: 40px 12px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.m-setup h2 { margin: 4px 0 0; }
.m-setup p { color: var(--text-2); line-height: 1.5; margin: 0; }
.m-lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .92); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #eee; }
.m-lightbox img { max-width: 100%; max-height: 85dvh; object-fit: contain; }
/* board */
#m-board-wrap { flex: 1; position: relative; min-height: 0; overflow: hidden; }
.m-board { touch-action: none; }
.m-board .rel-handle { display: none; }
.m-board .node { cursor: default; }
.m-board-tools {
  position: absolute; left: 12px; bottom: 14px; display: flex; align-items: center; z-index: 5; background: var(--panel);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-card); overflow: hidden;
}
.m-board-tools button { border: 0; background: none; color: var(--text); font-weight: 800; font-size: 17px; min-width: 44px; height: 42px; }
.m-board-tools button[data-z="fit"] { font-size: 14px; border-left: 1px solid var(--border); padding: 0 12px; }
#zoom-label { font-size: 12.5px; font-weight: 700; color: var(--muted); min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; }
#m-tlabels { position: absolute; left: 0; top: 0; z-index: 4; pointer-events: none; }
.m-tlabel {
  position: absolute; transform: translate(-50%, -50%) scale(var(--iz, 1)); white-space: nowrap; font-weight: 800; font-size: 15px;
  color: var(--text); background: color-mix(in srgb, var(--card) 92%, transparent); border: 2px solid var(--c); border-radius: 10px;
  padding: 3px 10px; box-shadow: var(--shadow-card);
}
.m-tlabel.sub { font-size: 12.5px; font-weight: 700; border-width: 1.5px; }
.m-tlabel b { padding: 0 5px; border-radius: 5px; }
.m-board.m-far .node { opacity: .32; }
.m-board.m-far .link-line { opacity: .5; }
.m-board.m-far .rel-label { display: none; }
.m-board.m-far .frame-title { opacity: .9; }
body.m-on-board .m-fab { bottom: calc(env(safe-area-inset-bottom) + 74px); }
.m-onboard { border: 0; background: var(--accent-weak) !important; color: var(--accent-text) !important; }

#toasts { bottom: calc(env(safe-area-inset-bottom) + 140px); width: calc(100% - 32px); }
.toast { max-width: 100%; }
