/* The panel of Promag in Telegram: light or dark as the theme (Telegram sets those colours, these the fallbacks),
   but the accent always blue — the same panel on every device, whatever accent a person chose in their Telegram
   (the decision of 2026-11-14). data-scheme: Telegram's light or dark (tg.ts); outside Telegram the system's. */
:root {
  --bg: var(--tg-theme-secondary-bg-color, #f1f1f4);
  --section: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #fff));
  --text: var(--tg-theme-text-color, #111);
  --hint: var(--tg-theme-hint-color, #8a8a8e);
  --link: #2481cc;
  --button: #2481cc;
  --button-text: #fff;
  --danger: var(--tg-theme-destructive-text-color, #e53935);
  --header: var(--hint);
  --sep: color-mix(in srgb, var(--hint) 25%, transparent);
  --ok: #34a853;
  --warn: #e8a000;
}
:root[data-scheme='dark'] {
  --link: #6ab3f3;
  --button: #3e88f7;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-scheme]) {
    --bg: #0f0f0f;
    --section: #1c1c1e;
    --text: #f2f2f2;
    --hint: #8d8e93;
    --link: #6ab3f3;
    --button: #3e88f7;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.35 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
/* on the whole screen (a phone, a tablet) Telegram's own buttons lie over the top of the page: the page
   begins below them, and what scrolls is covered there */
:root { --top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)); }
body { padding: calc(8px + var(--top)) 0 calc(92px + env(safe-area-inset-bottom)); min-height: 100vh; }
body::before { content: ''; position: fixed; top: 0; left: 0; right: 0; height: var(--top); background: var(--bg); z-index: 7; }
.splash { display: grid; place-items: center; height: 80vh; color: var(--hint); font-size: 20px; }
h1 { font-size: 22px; margin: 8px 16px 4px; }
.sub { color: var(--hint); font-size: 14px; margin: 0 16px 12px; }
.section { background: var(--section); border-radius: 12px; margin: 0 12px 14px; overflow: hidden; }
.section-title { color: var(--header); font-size: 13px; text-transform: uppercase; letter-spacing: .02em; margin: 14px 28px 6px; }
.row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; min-height: 46px; border-top: 1px solid var(--sep); }
.row:first-child { border-top: 0; }
.row.tap { cursor: pointer; }
.row.tap:active { background: color-mix(in srgb, var(--hint) 12%, transparent); }
.row .main { flex: 1; min-width: 0; }
.row .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .title.wrap, .row.wrap .subtitle { white-space: normal; }
.row .subtitle { color: var(--hint); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .chevron { color: var(--hint); font-size: 20px; }
.row a { color: var(--link); text-decoration: none; }
.badge { font-size: 12px; padding: 2px 7px; border-radius: 10px; white-space: nowrap; }
.badge.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.badge.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.badge.bad { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.search { position: sticky; top: 0; z-index: 2; padding: 6px 12px 10px; background: var(--bg); }
input, textarea { width: 100%; font: inherit; color: var(--text); background: var(--section); border: 1px solid var(--sep); border-radius: 10px; padding: 11px 12px; outline: none; }
input:focus, textarea:focus { border-color: var(--button); }
textarea { min-height: 84px; resize: vertical; }
textarea.code { min-height: 40vh; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.45; }
textarea.code.short { min-height: 20vh; }
.notice { padding: 10px 12px; border-radius: 10px; font-size: 14px; background: color-mix(in srgb, var(--warn) 15%, transparent); }
.notice.bad { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.form { padding: 12px 14px; display: grid; gap: 10px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
button { font: inherit; border: 0; border-radius: 10px; padding: 10px 14px; cursor: pointer; background: var(--button); color: var(--button-text); }
button.plain { background: transparent; color: var(--link); padding: 10px 6px; }
button.danger { background: transparent; color: var(--danger); padding: 10px 6px; }
button.small { padding: 6px 10px; font-size: 14px; }
button:disabled { opacity: .5; }
.wide { width: calc(100% - 24px); margin: 0 12px 14px; display: block; }
.empty { color: var(--hint); text-align: center; padding: 26px 16px; }
.suggestions .row { font-size: 15px; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--sep); border-radius: 15px; transition: .2s; }
.switch span::before { content: ''; position: absolute; width: 26px; height: 26px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px #0003; }
.switch input:checked + span { background: var(--danger); }
.switch input:checked + span::before { transform: translateX(20px); }
.toast { position: fixed; left: 50%; bottom: calc(78px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: color-mix(in srgb, var(--text) 88%, transparent); color: var(--section); padding: 10px 16px; border-radius: 12px; font-size: 15px; z-index: 10; max-width: calc(100% - 32px); }
.spinner { width: 22px; height: 22px; border: 3px solid var(--sep); border-top-color: var(--button); border-radius: 50%; animation: spin .8s linear infinite; margin: 26px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.map { position: relative; overflow: hidden; background: var(--sep); }
.map img { position: absolute; width: 256px; height: 256px; user-select: none; pointer-events: none; }
.pin { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -22px 0 0 -11px; background: var(--danger); border: 3px solid #fff; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); box-shadow: 0 2px 6px #0006; }
.map-zoom { position: absolute; right: 8px; top: 8px; display: grid; gap: 4px; }
.map-zoom button { width: 34px; height: 34px; padding: 0; font-size: 20px; }
.map-open { position: absolute; left: 8px; bottom: 8px; }
.map.area { touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.map-legend { display: flex; flex-wrap: wrap; gap: 4px 6px; padding: 10px 12px 2px; font-size: 13px; color: var(--hint); }
.map-legend label { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 8px; cursor: pointer; user-select: none; -webkit-user-select: none; }
.map-legend label.off { opacity: 0.45; }
.map-legend input { width: 16px; height: 16px; margin: 0; accent-color: var(--button); }
.map-legend i { width: 11px; height: 11px; border-radius: 50%; box-shadow: 0 0 0 1px rgb(0 0 0 / 0.15); }
.map-legend b { color: var(--text); font-weight: 600; }
.map-note { color: var(--hint); font-size: 13px; padding: 8px 16px 10px; }
.map canvas { position: absolute; left: 0; top: 0; pointer-events: none; }
.map-credit { position: absolute; right: 4px; bottom: 2px; font-size: 10px; color: #333; background: #fff9; padding: 0 3px; border-radius: 3px; }

/* outside production: a bar at the top that says where this is, and which version */
.env-bar { position: sticky; top: var(--top); z-index: 6; margin: -8px 0 8px; padding: 3px 12px; background: #f47b2a; color: #232323; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-align: center; }

/* the tabs: a dark bar whatever the theme, white icons over their names, the tab shown in the blue of the
   theme (its links: light enough on the dark bar) */
.tabs { --tabs-bg: #232323; --tabs-text: #fff; --tabs-on: var(--link); position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; background: var(--tabs-bg); border-radius: 14px 14px 0 0; padding: 4px 4px env(safe-area-inset-bottom); box-shadow: 0 -2px 12px rgb(0 0 0 / 0.18); }
.tabs button { flex: 1; min-width: 0; background: transparent; color: var(--tabs-text); border-radius: 0; padding: 10px 0 12px; font-size: 13px; font-weight: 400; display: grid; gap: 6px; justify-items: center; }
.tabs button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs button svg { width: 29px; height: 29px; display: block; fill: currentColor; }
.tabs button.on { color: var(--tabs-on); }
.hint { color: var(--hint); font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--bg); color: var(--text); border: 1px solid var(--sep); border-radius: 16px; padding: 6px 12px; font-size: 14px; }
.chip.on { background: var(--button); color: var(--button-text); border-color: var(--button); }
.week-row { display: grid; grid-template-columns: 74px 1fr 1fr; gap: 8px; align-items: center; }
.week-row .day { display: flex; gap: 6px; align-items: center; }
.week-row .day input { width: 20px; height: 20px; }
input[type=time], input[type=date] { padding: 8px 10px; }
input:disabled { opacity: .45; }
.dates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dates label { display: grid; gap: 4px; color: var(--hint); font-size: 13px; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 12px 14px; }
.tile { background: var(--section); border-radius: 12px; padding: 12px 14px; display: grid; gap: 2px; text-align: left; color: var(--text); }
.tile .value { font-size: 26px; font-weight: 600; line-height: 1.1; }
.tile .label { color: var(--hint); font-size: 13px; }
.tile.warn .value { color: var(--warn); }
.tile.bad .value { color: var(--danger); }
.tile.ok .value { color: var(--ok); }
.strip { display: grid; grid-template-columns: 28px repeat(7, 1fr) 28px; gap: 4px; margin: 0 8px 12px; align-items: stretch; }
.strip button { background: var(--section); color: var(--text); padding: 6px 0; border-radius: 10px; display: grid; justify-items: center; gap: 1px; font-size: 12px; }
.strip button .n { font-size: 17px; font-weight: 600; }
.strip button .c { font-size: 11px; color: var(--hint); min-height: 14px; }
.strip button.on { background: var(--button); color: var(--button-text); }
.strip button.on .c { color: var(--button-text); }
.strip button.today .n { text-decoration: underline; }
.strip .arrow { background: transparent; color: var(--link); font-size: 22px; padding: 0; }
.strip button:disabled { opacity: .35; }
.clip { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal !important; }

.chat { display: grid; gap: 8px; margin: 0 12px 14px; }
.bubble { max-width: 85%; padding: 9px 12px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.agent { justify-self: start; background: var(--section); border-bottom-left-radius: 4px; }
.bubble.caller { justify-self: end; background: var(--button); color: var(--button-text); border-bottom-right-radius: 4px; }
.chat .note { justify-self: center; color: var(--hint); font-size: 13px; }
.hangup { position: sticky; bottom: calc(70px + env(safe-area-inset-bottom)); padding: 0 12px; }
.danger-fill { width: 100%; background: var(--danger); color: #fff; }

/* the panel fills the width it is given — the window of Telegram on a computer, a tablet, the whole
   screen — up to a width lines still read well at; wider than that: in the middle, the tabs under it */
#app { max-width: 1100px; margin: 0 auto; }
.tabs { left: 50%; right: auto; width: min(1100px, 100%); transform: translateX(-50%); }
.tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
/* on a computer: the whole screen and back, in the corner */
.fullscreen { position: fixed; top: calc(var(--top) + 6px); right: 10px; z-index: 8; padding: 4px 10px; font-size: 12px; font-weight: 500; border-radius: 999px; background: var(--section); color: var(--hint); box-shadow: 0 1px 4px rgb(0 0 0 / 0.18); }

/* START: the target being filled, and the way to it from the first screen */
.target { font-size: 17px; font-weight: 600; }
button.start { font-size: 17px; font-weight: 600; padding: 14px; }
/* the technicians of the day, one under another: who, how many visits, back when, room for how many */
.picks { display: grid; }
.pick { display: grid; grid-template-columns: 1fr 56px 56px 56px 80px; gap: 8px; align-items: center; padding: 11px 14px; background: transparent; color: var(--text); border-radius: 0; border-top: 1px solid var(--sep); text-align: left; font-size: 15px; }
.pick span + span { text-align: right; font-variant-numeric: tabular-nums; }
.pick.head { color: var(--hint); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; padding: 4px 14px 6px; border-top: 0; }
.pick.on { background: var(--button); color: var(--button-text); font-weight: 600; }
.pick.three { grid-template-columns: 1fr 72px 84px; }
.pick.four { grid-template-columns: 1fr 64px 72px 64px; }
.pick .note { display: block; font-size: 12px; font-weight: 400; opacity: .75; }

/* A wide screen (a laptop, a tablet lying down): the tabs stand at the left edge instead of lying at the
   bottom, the page takes the width it is given, and a screen made of two parts (START: the target and its
   day; whom to call) shows them side by side. */
.cols > div { min-width: 0; }
@media (min-width: 1000px) {
  body { padding-left: 92px; padding-bottom: 24px; }
  #app { max-width: 1560px; }
  .tabs { left: 0; top: 0; bottom: 0; right: auto; width: 92px; transform: none; flex-direction: column; justify-content: flex-start; gap: 4px; border-radius: 0; padding: calc(var(--top) + 14px) 4px 12px; box-shadow: 1px 0 0 var(--sep); }
  .tabs button { flex: none; padding: 12px 0; }
  .cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 6px; align-items: start; }
  .toast { bottom: 24px; }
  .hangup { bottom: 16px; }
  h1 { font-size: 26px; }
}


/* START (2026-11-14): the three steps, and where the calls go now — the test, or live (red) */
.steps { margin: 4px 16px 14px; padding-left: 20px; color: var(--hint); font-size: 14px; display: grid; gap: 2px; }
.steps b { color: var(--text); font-weight: 600; }
.mode { margin: 0 12px 14px; padding: 12px 14px; border-radius: 12px; background: var(--section); display: grid; gap: 8px; }
.mode .actions { margin: 0; }
.mode.live { border: 2px solid var(--danger); }
.mode.live b { color: var(--danger); }

/* a file to choose (DANE: the workbook to import), looking like a button */
label.button { display: inline-block; justify-self: start; font: inherit; border-radius: 10px; padding: 10px 14px; cursor: pointer; background: var(--button); color: var(--button-text); }
