:root {
  --green: #2f855a;
  --green-dark: #276749;
  --bg: #f4f6f5;
  --surface: #ffffff;
  --line: #e2e8e4;
  --text: #1f2a24;
  --muted: #6b7a72;
  --blue: #2b6cb0;
  --amber: #b7791f;
  --red: #c53030;
  --bubble-tech: #2f855a;
  --bubble-client: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; }
.hidden { display: none !important; }

/* ---------- Landing ---------- */
.landing { max-width: 760px; margin: 0 auto; padding: 48px 24px; }
.landing h1 { font-size: 28px; margin: 0 0 6px; }
.landing p.sub { color: var(--muted); margin: 0 0 32px; font-size: 15px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px; text-decoration: none; display: block; transition: border-color .15s, transform .1s; }
.pcard:hover { border-color: var(--green); transform: translateY(-2px); }
.pcard .ic { width: 42px; height: 42px; border-radius: 10px; background: #e8f2ec; color: var(--green); display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 14px; }
.pcard h3 { margin: 0 0 4px; font-size: 17px; }
.pcard p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.note { margin-top: 28px; background: #fff9ec; border: 1px solid #f0e2c0; color: #7a5c12; border-radius: 10px; padding: 14px 16px; font-size: 13px; line-height: 1.6; }

/* ---------- Phone frame ---------- */
.phone-wrap { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; padding: 18px 12px; }
.phone { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; overflow: hidden; display: flex; flex-direction: column; height: calc(100vh - 100px); height: calc(100dvh - 100px); min-height: 560px; }


.topswitch { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; justify-content: center; }
.topswitch select { padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: 13px; }
.topswitch a { font-size: 12px; color: var(--muted); text-decoration: none; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* safe-area-inset-top pushes content below the iPhone status bar in the
   installed app (env() is 0 on desktop, so this is harmless there) and the
   green keeps filling the strip behind the clock/battery. */
.appbar { background: var(--green); color: #fff; padding: calc(14px + env(safe-area-inset-top)) 16px 14px; display: flex; align-items: center; gap: 10px; }
.appbar .back { font-size: 28px; cursor: pointer; opacity: .9; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: -10px 0 -10px -12px; border-radius: 50%; -webkit-tap-highlight-color: rgba(255,255,255,.15); }
.appbar .back:active { background: rgba(255,255,255,.15); }
.appbar h2 { font-size: 16px; margin: 0; font-weight: 600; }
.appbar .sub { font-size: 12px; opacity: .85; }
.appbar .call { margin-left: auto; background: rgba(255,255,255,.18); border: none; color: #fff; width: 38px; height: 38px; border-radius: 50%; font-size: 17px; cursor: pointer; }

/* ---------- Client list ---------- */
.listwrap { flex: 1; overflow-y: auto; }
.techsearch { padding: 8px 12px; border-bottom: 1px solid var(--line); background: #fff; }
.techsearch input { width: 100%; box-sizing: border-box; padding: 8px 12px; border: 1px solid var(--line); border-radius: 18px; font-size: 13px; }
mark { background: #fef08a; border-radius: 3px; padding: 0 1px; }
.list-head { padding: 14px 16px 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.crow { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.crow:hover { background: #f7faf8; }
.crow-unread { background: #f2f9f5; }
.teamchip { background: #dd6b20; color: #fff; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 9px; white-space: nowrap; display: inline-block; margin-bottom: 2px; }
.teambanner { background: #e9e4f5; color: #44337a; font-size: 12.5px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.routechip { background: #e6f4ec; color: var(--green-dark); font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 8px; white-space: nowrap; }
.crow-unread .nm { font-weight: 700; }
.unreaddot { position: absolute; left: 5px; top: 50%; transform: translateY(-50%); width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.crow { position: relative; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.crow .meta { flex: 1; min-width: 0; }
.crow .meta .nm { font-size: 15px; font-weight: 600; }
.crow .meta .ln { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crow .rt { text-align: right; flex-shrink: 0; }
.crow .rt .tm { font-size: 11px; color: var(--muted); }

.badge { display: inline-block; font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 20px; margin-top: 3px; }
.b-active { background: #e6f4ec; color: var(--green-dark); }
.b-reply { background: #fdefe0; color: var(--amber); }
.b-closed { background: #eef1ef; color: var(--muted); }
.b-office { background: #e9e4f5; color: #6b46c1; }
.b-overdue { background: #fdecec; color: var(--red); }

/* ---------- Overdue escalation ---------- */
.pushbar { background: #2b6cb0; color: #fff; font-size: 13px; font-weight: 600; padding: 10px 16px; display: flex; align-items: center; gap: 10px; }
.pushbar span { flex: 1; cursor: pointer; }
.pushbar:active { opacity: .85; }
.pushx { cursor: pointer; opacity: .75; font-weight: 400; padding: 2px 6px; }
.pushx:hover { opacity: 1; }
.appavatar { margin-left: auto; width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.25); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; cursor: pointer; flex-shrink: 0; }
.appavatar:active { background: rgba(255,255,255,.4); }
.overduebar { background: #c53030; color: #fff; font-size: 13px; font-weight: 600; padding: 10px 16px; cursor: pointer; animation: odpulse 2s ease-in-out infinite; }
@keyframes odpulse { 0%,100% { opacity: 1; } 50% { opacity: .75; } }
.odsection { border-bottom: 2px solid #f5c6c6; background: #fff8f8; }
.odhead { font-size: 12px; font-weight: 700; color: var(--red); text-transform: uppercase; letter-spacing: .5px; padding: 12px 16px 6px; }
.odrow { font-size: 12.5px; padding: 8px 16px; cursor: pointer; border-top: 1px solid #fbe3e3; line-height: 1.5; }
.odrow:hover { background: #fdf1f1; }
.odrow .odtech { color: var(--muted); font-size: 11.5px; margin-left: 6px; }

/* ---------- Thread ---------- */
.thread { flex: 1; overflow-y: auto; padding: 16px; background: #f7f9f8; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.daystamp { text-align: center; font-size: 11px; color: var(--muted); margin: 4px 0; }
.bubble { max-width: 80%; padding: 9px 13px; font-size: 14px; line-height: 1.45; border-radius: 16px; position: relative; }
.b-tech { align-self: flex-end; background: var(--bubble-tech); color: #fff; border-bottom-right-radius: 5px; }
.b-client { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.b-office { align-self: flex-end; background: #4a5568; color:#fff; border-bottom-right-radius:5px; }
.bubble .tstamp { font-size: 10px; opacity: .7; margin-top: 3px; display: block; }
.callchip { align-self: center; background: #eef2f0; border: 1px solid var(--line); color: var(--muted); font-size: 12px; padding: 6px 12px; border-radius: 20px; max-width: 90%; }
.callchip .transcript { text-align: left; font-size: 11.5px; line-height: 1.6; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-top: 6px; color: #4a5568; max-height: 160px; overflow-y: auto; }
.flagchip { align-self: center; background: #fdecec; border: 1px solid #f5c6c6; color: var(--red); font-size: 11px; padding: 4px 10px; border-radius: 8px; max-width: 88%; text-align:center; }
.flagchip-reviewed { background: #eef1ef; border-color: var(--line); color: var(--muted); }
.testpill { background: #fff; border: 1px solid #dd6b20; color: #dd6b20; font-size: 9px; font-weight: 700; padding: 1px 6px; border-radius: 8px; letter-spacing: .3px; white-space: nowrap; }
.arbadge { background: #dd6b20; color: #fff; font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 4px; letter-spacing: .5px; cursor: help; }

.composer { border-top: 1px solid var(--line); padding: 10px; background: #fff; }
.etarow { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; touch-action: manipulation; }
.etalabel { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
/* 44px tap targets (Apple HIG minimum) — small buttons were being missed */
.etabtn { width: 46px; min-width: 46px; flex-shrink: 0; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 15px; font-weight: 700; color: var(--green-dark); cursor: pointer; touch-action: manipulation; }
.etaval { flex-shrink: 0; }
.etadelta { flex-shrink: 0; }
.etasrc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.etabtn:active { background: #eef6f1; }
.etaval { font-size: 15px; font-weight: 700; min-width: 52px; text-align: center; }
.etasrc { font-size: 10.5px; color: var(--muted); }
.etadelta { background: #fdefe0; color: var(--amber); font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.tpl-mine { border-color: #d9c8f5; color: #6b46c1; background: #f6f1fd; }
.tpl-new { border-style: dashed; color: var(--muted); }

/* ---------- Media attachments ---------- */
.msgmedia { display: block; max-width: 100%; max-height: 220px; border-radius: 10px; margin-bottom: 4px; }
.attach { width: 40px; height: 40px; border-radius: 50%; border: none; background: var(--green); display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.attach svg { width: 19px; height: 19px; }
.attach:active { background: var(--green-dark); }
.attachwrap { position: relative; flex-shrink: 0; }
.attachmenu { position: absolute; bottom: 46px; left: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 6px 18px rgba(20,40,30,.15); padding: 6px; z-index: 30; width: 175px; }
.attachmenu label { display: block; padding: 10px 12px; font-size: 14px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.attachmenu label:hover { background: #f2f6f3; }
.mediapreview { display: flex; gap: 6px; flex-wrap: wrap; }
.mediapreview:not(:empty) { margin-bottom: 8px; }
.mediachip { font-size: 12px; background: #eef6f1; border: 1px solid #cfe4d8; color: var(--green-dark); padding: 5px 10px; border-radius: 14px; }
.mediachip b { cursor: pointer; margin-left: 6px; }
.templates { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 8px; overscroll-behavior: contain; touch-action: pan-x; }
.tpl { white-space: nowrap; font-size: 12px; padding: 8px 12px; border-radius: 18px; border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--green-dark); touch-action: manipulation; }
.tpl:hover { background: #eef6f1; }
.inrow { display: flex; gap: 8px; align-items: flex-end; }
.inrow input, .inrow textarea { flex: 1; padding: 10px 14px; border: 1px solid var(--line); border-radius: 20px; font-size: 14px; }
.inrow textarea { resize: none; font-family: inherit; line-height: 1.4; max-height: 130px; overflow-y: auto; min-height: 40px; }
.inrow button { background: var(--green); color: #fff; border: none; width: 40px; height: 40px; border-radius: 50%; font-size: 16px; cursor: pointer; }

.empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- Call modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(20,30,25,.55); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: #1f2a24; color: #fff; border-radius: 18px; padding: 30px 26px; text-align: center; width: 280px; }
.modal .mavatar { width: 74px; height: 74px; border-radius: 50%; margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 600; }
.modal h3 { margin: 0 0 4px; font-size: 20px; }
.modal .via { font-size: 12px; opacity: .7; margin-bottom: 4px; }
.modal .status { font-size: 13px; opacity: .85; margin: 10px 0 20px; }
.modal .endbtn { background: var(--red); color: #fff; border: none; width: 56px; height: 56px; border-radius: 50%; font-size: 22px; cursor: pointer; }
.callhead { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 6px; }
.callhead h3 { margin: 0; font-size: 18px; }
.mavatar.sm { width: 40px; height: 40px; font-size: 14px; margin: 0; }
.callbtns { display: flex; gap: 10px; margin-top: 8px; }
.callbtns button { flex: 1; padding: 14px 12px; border-radius: 12px; font-size: 15px; font-weight: 600; cursor: pointer; border: none; white-space: nowrap; display: flex; align-items: center; justify-content: center; gap: 7px; }
.callnow svg { width: 17px; height: 17px; flex-shrink: 0; }
.callnow { background: var(--green); color: #fff; }
.callnow:active { background: var(--green-dark); }
.callcancel { background: rgba(255,255,255,.15); color: #fff; }
.callcancel:active { background: rgba(255,255,255,.28); }
.callcancel.wide { flex: none; width: 100%; }

/* ---------- Office ---------- */
.office { display: grid; grid-template-columns: 320px minmax(0, 1fr) 300px; height: 100vh; }
@media (max-width: 1024px) { .office { grid-template-columns: 260px minmax(0, 1fr) 250px; } }
.col { overflow-y: auto; }
.sidebar { border-right: 1px solid var(--line); background: var(--surface); }
.center { background: #f7f9f8; display: flex; flex-direction: column; }
.rightbar { border-left: 1px solid var(--line); background: var(--surface); }
.ohead { padding: 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.ohead h1 { font-size: 17px; margin: 0 0 2px; display:flex; align-items:center; gap:8px; }
.ohead .sync { font-size: 11px; color: var(--muted); }
.dayreview { background: #fff9ec; border-bottom: 1px solid #f0e2c0; padding: 10px 14px; }
.dr-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: #92700f; margin-bottom: 5px; }
.dr-line { font-size: 12.5px; color: #7a5c12; padding: 3px 0; cursor: pointer; }
.dr-line:hover { text-decoration: underline; }
.filterbar { display: flex; gap: 6px; padding: 10px 14px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.fbtn { font-size: 12px; padding: 5px 11px; border-radius: 16px; border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--muted); }
.fbtn.on { background: var(--green); color: #fff; border-color: var(--green); }
.modebtns { display: flex; gap: 6px; width: 100%; }
.modecount { font-size: 10px; background: rgba(0,0,0,.12); padding: 0 5px; border-radius: 8px; margin-left: 2px; }
.fbtn.on .modecount { background: rgba(255,255,255,.28); }
.orow { display: flex; gap: 11px; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; height: 80px; overflow: hidden; align-items: center; }
.orow.sel { background: #eef6f1; }
.orow:hover { background: #f5f9f7; }
.orow .meta { flex: 1; min-width: 0; }
.orow .meta .nm { font-size: 14px; font-weight: 600; }
.orow .meta .tech { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.orow .meta .tech .badge { margin-top: 0; vertical-align: 1px; line-height: 1.2; display: inline-block; }
.orow .meta .tech { line-height: 20px; }
.orow .meta .ln { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.orow .avatar.sm { width: 30px; height: 30px; font-size: 11px; }
.orow .rt-col { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0; }
.orow .rowdate { font-size: 11px; color: var(--muted); white-space: nowrap; }
.orow .star { font-size: 15px; color: #cbd5c9; cursor: pointer; line-height: 1; }
.orow .star.on { color: #e0a92e; }
.orow .star:hover { color: #e0a92e; }
.orow .fdot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); flex-shrink: 0; margin-top: 6px; }

.center .chead { padding: 14px 18px; border-bottom: 1px solid var(--line); background: #fff; display: flex; align-items: center; gap: 12px; }
.center .chead .nm { font-size: 16px; font-weight: 600; }
.center .chead .sub { font-size: 12px; color: var(--muted); }
.center .chead .num { margin-left: auto; font-size: 12px; color: var(--muted); text-align: right; }
.statusbtns { display: flex; flex-direction: column; gap: 5px; align-items: flex-end; margin-left: 12px; flex-shrink: 0; }
.statusbtns .fbtn { font-size: 11px; padding: 4px 9px; }
.othread { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.ojoin { border-top: 1px solid var(--line); padding: 10px 14px; background: #fff; display: flex; gap: 8px; align-items: flex-end; }
.ojoin input, .ojoin textarea { flex: 1; padding: 9px 13px; border: 1px solid var(--line); border-radius: 18px; font-size: 13px; }
.ojoin textarea { resize: none; font-family: inherit; line-height: 1.4; max-height: 130px; overflow-y: auto; min-height: 37px; }
.ojoin .sendclose { background: #2f855a; color: #fff; }
.ojoin .sendclose:hover { background: #276749; }
.ojoin button { background: #4a5568; color: #fff; border: none; padding: 9px 15px; border-radius: 18px; font-size: 13px; cursor: pointer; }

.mon-head { padding: 15px 16px; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 600; display:flex; align-items:center; gap:8px; position: sticky; top:0; background:var(--surface); }
.mon-empty { padding: 30px 18px; text-align: center; color: var(--muted); font-size: 13px; }
.flag { padding: 13px 16px; border-bottom: 1px solid var(--line); }
.flag-click { cursor: pointer; }
.flag-click:hover { background: #f7faf8; }
.flagnum { background: #2c2c2a; color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; }
.flagline { display: flex; gap: 8px; align-items: baseline; padding: 6px 0; border-top: 1px dashed rgba(0,0,0,.08); }
.flagline:first-of-type { border-top: none; }
.flagline-cat { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 6px; white-space: nowrap; flex-shrink: 0; }
.flagline-exc { font-size: 12px; color: #4a5568; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cond-reply { background: #fdecec; color: var(--red); }

/* ---------- Monitor cards: one client per rounded card ---------- */
.moncard { background: #fbfcfb; border: 1px solid var(--line); border-radius: 14px; margin: 10px 12px; padding: 12px 14px; cursor: pointer; transition: border-color .12s; }
.moncard:hover { border-color: var(--green); }
.moncard-waiting { background: #fdf6f4; border-color: #f0d9d2; }
.moncard-waiting:hover { border-color: #d88a75; }
.mc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.mc-name { font-size: 14px; font-weight: 700; }
.mc-tech { margin-left: auto; font-size: 11px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; }
.fsel { font-size: 12px; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); max-width: 150px; }
.searchrow { display: flex; gap: 6px; width: 100%; margin-bottom: 4px; }
.searchrow input { flex: 1; font-size: 12.5px; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); }
.newbtn { background: var(--green); color: #fff; border-color: var(--green); white-space: nowrap; }
.newbtn:hover { opacity: .9; }
.flag .top { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.sev { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 5px; text-transform: uppercase; letter-spacing: .3px; }
.sev-high { background: #fdecec; color: var(--red); }
.sev-medium { background: #fdf1e0; color: var(--amber); }
.sev-low { background: #eef2f0; color: var(--muted); }
.flag .cat { font-size: 13px; font-weight: 600; }
.flag .ctx { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.flag .exc { font-size: 12.5px; background: #f7f9f8; border-left: 3px solid #f0b6b6; padding: 6px 10px; border-radius: 0 6px 6px 0; color: #4a5568; margin-bottom: 6px; }
.flag .why { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.kindtag { font-size: 10px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }

.minibar { padding: 8px 12px; background: #1f2a24; color: #cfe0d7; font-size: 12px; display: flex; gap: 14px; align-items: center; justify-content: center; }
.minibar a { color: #fff; text-decoration: none; opacity: .85; }
.minibar a:hover { opacity: 1; }
.minibar .reset { margin-left: auto; cursor: pointer; opacity: .7; }
.mcdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #a0aec0; vertical-align: middle; }
.mc-steps { background: #fff9ec; border: 1px solid #f0e2c0; border-radius: 10px; padding: 12px 14px; }
.undotoast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #1f2a24; color: #fff; border-radius: 12px; padding: 10px 14px; display: flex; align-items: center; gap: 14px; font-size: 13.5px; box-shadow: 0 6px 20px rgba(0,0,0,.25); z-index: 100; }
.undotoast button { background: var(--green); color: #fff; border: none; border-radius: 8px; padding: 7px 16px; font-size: 13px; font-weight: 700; cursor: pointer; }
.undotoast button:hover { background: var(--green-dark); }
.undotoast b { cursor: pointer; opacity: .6; font-weight: 400; }
.undotoast b:hover { opacity: 1; }
.mc-addjob { display: flex; flex-wrap: wrap; gap: 8px; }
.mc-addjob input { flex: 1 1 140px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }

/* ---------- Login ---------- */
.loginwrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.loginbox { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 36px 32px; width: 100%; max-width: 360px; text-align: center; }
.loginlogo { width: 64px; height: 64px; border-radius: 16px; margin-bottom: 12px; }
.loginbox h1 { font-size: 22px; margin: 0 0 2px; }
.loginsub { color: var(--muted); font-size: 13px; margin: 0 0 24px; }
.loginbox input { width: 100%; box-sizing: border-box; padding: 12px 14px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; }
.loginbtn { width: 100%; padding: 12px; background: var(--green); color: #fff; border: none; border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer; margin-top: 4px; }
.loginbtn:active { opacity: .9; }
.loginlink { display: inline-block; margin-top: 14px; font-size: 13px; color: var(--muted); }
.loginhint { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.loginmsg { font-size: 13px; min-height: 18px; margin: 14px 0 0; }
.ordivider { display: flex; align-items: center; gap: 10px; margin: 16px 0 12px; color: var(--muted); font-size: 12px; }
.ordivider::before, .ordivider::after { content: ''; flex: 1; border-top: 1px solid var(--line); }

/* ---------- Templates manager ---------- */
.tpl-panel { background: #fff; border-radius: 14px; width: 640px; max-width: 92vw; max-height: 82vh; display: flex; flex-direction: column; color: var(--text); text-align: left; }
.tpl-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.tpl-head h2 { margin: 0; font-size: 17px; }
.tpl-x { cursor: pointer; color: var(--muted); font-size: 16px; }
.tpl-body { overflow-y: auto; padding: 6px 20px 14px; flex: 1; }
.tpl-section { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 16px 0 6px; }
.tpl-hint { text-transform: none; letter-spacing: 0; font-size: 11px; opacity: .8; }
.tpl-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tpl-meta { flex: 1; min-width: 0; }
.tpl-label { font-size: 13.5px; font-weight: 600; }
.tpl-text { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.tpl-actions { display: flex; gap: 6px; flex-shrink: 0; }
.tpl-empty { color: var(--muted); font-size: 13px; padding: 10px 0; }
.tpl-editing .tpl-meta { display: flex; flex-direction: column; gap: 6px; }
.tpl-editing input, .tpl-editing textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--green); border-radius: 8px; font-size: 13px; font-family: inherit; box-sizing: border-box; }
.tpl-editing textarea { resize: vertical; line-height: 1.5; }
.fbtn-save { background: var(--green); color: #fff; border-color: var(--green); }
.tpl-addrow { display: flex; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.tpl-addrow input { flex: 1; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.tpl-addrow button { background: var(--green); color: #fff; border: none; padding: 9px 14px; border-radius: 8px; font-size: 13px; cursor: pointer; white-space: nowrap; }

/* On a real phone the app is full-bleed — no frame, no wasted padding, and
   dvh keeps the composer above the browser chrome / home indicator. */
@media (max-width: 480px) {
  /* fixed inset:0 = the exact visible screen, no viewport-unit quirks —
     kills the stray strip below the composer on installed iPhones. */
  html, body { height: 100%; overflow: hidden; background: var(--surface); }
  .phone-wrap { position: fixed; inset: 0; padding: 0; height: auto; min-height: 0; }
  .topswitch { padding: 8px 6px 4px; margin-bottom: 0; }
  .phone { flex: 1; height: auto; min-height: 0; max-width: 100%; border: none; border-radius: 0; }
  /* sit lower: a bit under the home-indicator inset, floor of 8px */
  .composer { padding-bottom: max(8px, calc(env(safe-area-inset-bottom) - 12px)); }
  /* keyboard open: it covers the home-indicator zone, so no inset needed */
  body.kb-open .composer { padding-bottom: 8px; }
  /* 16px inputs stop iOS from auto-zooming the page on focus */
  .inrow input, .inrow textarea, .techsearch input, .loginbox input { font-size: 16px; }
}
