[hidden] { display: none !important; }
:root {
  --bg: #f4f1ec;
  --card: #ffffff;
  --ink: #1d2422;
  --muted: #6b7471;
  --line: #e6e1d9;
  --teal: #1f6f6b;
  --call: #e0574a;
  --call-soft: #fde7e4;
  --busy: #e3a237;
  --busy-soft: #fcf0d9;
  --free: #2f9461;
  --free-soft: #e2f4e9;
  --off: #7a8a99;
  --off-soft: #e9eef3;
  --radius: 22px;
  --g: #24a9c6;
  --g-dark: #13788f;
  --g-soft: #e8f6fa;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
.wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.hello { font-weight: 650; font-size: 17px; }
.install {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; border-radius: 999px; padding: 10px 14px;
  background: var(--teal); color: #fff; font-weight: 600; font-size: 14px;
}
.install svg { width: 18px; height: 18px; }
.install.wide { width: 100%; justify-content: center; padding: 14px; font-size: 16px; }

/* Зараз */
.now {
  margin-top: 12px; padding: 22px 20px 20px; border-radius: var(--radius);
  background: var(--off-soft);
}
.now[data-state="call"] { background: var(--call-soft); }
.now[data-state="busy"] { background: var(--busy-soft); }
.now[data-state="free"] { background: var(--free-soft); }
.now-emoji { font-size: 40px; line-height: 1; }
.now-title { margin-top: 10px; font-size: 28px; font-weight: 750; letter-spacing: -.01em; }
.now[data-state="call"] .now-title { color: #b3362b; }
.now[data-state="busy"] .now-title { color: #9a6410; }
.now[data-state="free"] .now-title { color: #1f6e46; }
.now-sub { margin-top: 4px; font-size: 19px; font-weight: 600; }
.now-next { margin-top: 10px; color: var(--muted); font-size: 15px; }
.now-next:empty { display: none; }

/* Календар (вигляд з прототипу Google Calendar Sync) */
.cal { margin-top: 14px; background: var(--card); border-radius: var(--radius); padding: 14px 12px 12px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px; }
.cal-month { font-size: 22px; font-weight: 750; letter-spacing: -.01em; }
.cal-tools { display: flex; gap: 6px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--g-soft); color: var(--g-dark); display: grid; place-items: center; position: relative; padding: 0; }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:disabled { opacity: .35; }
.today-btn span { position: absolute; top: 15px; left: 0; right: 0; text-align: center; font-size: 10px; font-weight: 750; }

.strip { display: grid; grid-template-columns: 44px repeat(5, 1fr); margin: 12px 0 6px; align-items: end; }
.strip .tz { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.2; padding-bottom: 8px; }
.sday { border: 0; background: none; padding: 0; display: grid; justify-items: center; gap: 4px; }
.sday small { font-size: 12px; color: var(--muted); }
.sday b { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; border: 2px solid transparent; }
.sday.past b { color: #9aa3a0; }
.sday.today small { color: var(--g-dark); font-weight: 700; }
.sday.today b { border-color: var(--g); color: var(--g-dark); }
.sday.on b { background: var(--g); border-color: var(--g); color: #fff; }

.grid-wrap { position: relative; touch-action: pan-y; }
.grid { position: relative; display: grid; grid-template-columns: 44px 1fr; }
.grid .hours { position: relative; }
.grid .hours span { position: absolute; left: 0; width: 40px; text-align: right; font-size: 12px; color: var(--muted); transform: translateY(-50%); }
.grid .cols { position: relative; display: grid; gap: 4px; }
.col { position: relative; border-radius: 12px; }
.col .slot { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.col.today-col { background: rgba(36, 169, 198, .06); }
.col.weekend { opacity: .5; }

.ev { position: absolute; border-radius: 9px; padding: 3px 8px; overflow: hidden; font-size: 12.5px; line-height: 1.25; cursor: default; border: 0; text-align: left; color: inherit; font-weight: 600; }
.ev.call { background: var(--g); color: #fff; }
.ev.busy { background: #e9e9e9; color: #3d4441; box-shadow: inset 3px 0 0 #9aa09e; }
.ev .ev-t { display: block; font-variant-numeric: tabular-nums; }
.ev .ev-n { display: block; font-weight: 500; opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev.tiny { padding-top: 0; padding-bottom: 0; display: flex; align-items: center; font-size: 11px; }
.ev.tiny .ev-n { display: none; }
.ev.edited::after { content: "✎"; position: absolute; right: 6px; top: 2px; font-size: 11px; }
.ev.deleted { background: repeating-linear-gradient(135deg, #f4f4f4 0 6px, #fff 6px 12px); color: #9aa09e; box-shadow: inset 0 0 0 1.5px #c9cecc; text-decoration: line-through; }
.ev.master { cursor: pointer; }
.cal.week .ev { padding: 2px 4px; font-size: 11px; border-radius: 7px; }
.cal.week .ev .ev-n { display: none; }
.nowline { position: absolute; left: -4px; right: 0; height: 0; border-top: 2px solid #e5484d; z-index: 3; pointer-events: none; }
.nowline::before { content: ""; position: absolute; left: -2px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: #e5484d; }
.empty-day { position: absolute; left: 0; right: 0; top: 40%; text-align: center; color: var(--muted); font-size: 15px; pointer-events: none; }
.master-note { margin: 12px 4px 0; font-size: 13px; color: var(--muted); }

.mseg {
  position: fixed; left: max(16px, calc(50% - 244px)); bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 6;
  display: flex; background: #fff; border: 1.2px solid #dcdfe0; border-radius: 18px; overflow: hidden;
  box-shadow: 0 4px 12px rgba(24, 24, 24, .12);
}
.mseg button { border: 0; background: none; padding: 9px 16px; font-size: 14px; font-weight: 650; }
.mseg button[aria-selected="true"] { background: var(--g); color: #fff; }

/* Правка події */
.ed-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ed-row label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.ed-row input { font: inherit; font-size: 20px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; color: var(--ink); background: #fff; width: 100%; }
.ed-label { margin: 14px 0 6px; font-size: 13px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 1.2px solid #dcdfe0; background: #fff; border-radius: 16px; padding: 7px 12px; font-size: 14px; font-weight: 600; }
.chips button.on { background: var(--g); border-color: var(--g); color: #fff; }
#edKind button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.ed-actions { display: grid; gap: 8px; margin-top: 18px; }
.btn { border: 1.5px solid var(--line); background: #fff; border-radius: 14px; padding: 13px; font-weight: 650; font-size: 16px; }
.btn.primary { background: var(--g); border-color: var(--g); color: #fff; }
.btn.danger { color: #c0392b; }
.btn.ghost { border-color: transparent; color: var(--g-dark); }
.ed-err { color: #c0392b; margin: 10px 0 0; font-size: 14px; }

.foot { padding-bottom: 64px; display: flex; justify-content: center; gap: 12px; margin-top: 16px; color: var(--muted); font-size: 13px; align-items: center; }
.link { border: 0; background: none; color: var(--teal); font-weight: 600; padding: 6px; }
.banner { margin-top: 12px; padding: 14px 16px; border-radius: 16px; background: #fff; display: flex; gap: 12px; align-items: center; justify-content: space-between; font-size: 15px; }

/* Помічник */
.sheet-bg { position: fixed; inset: 0; background: rgba(20, 24, 23, .45); z-index: 10; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; max-height: 92vh; overflow: auto;
  background: #fff; border-radius: 24px 24px 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
  max-width: 560px; margin: 0 auto;
}
.sheet h3 { margin: 0 34px 4px 0; font-size: 21px; }
.sheet-close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: #f1efeb; font-size: 16px; }
.sheet-lead { margin: 0 0 12px; color: var(--muted); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: #f1efeb; border-radius: 12px; padding: 3px; gap: 3px; }
.tabs button { border: 0; background: none; padding: 9px; border-radius: 10px; font-weight: 600; color: var(--muted); }
.tabs button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.steps { margin: 14px 0 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 12px; }
.steps[hidden] { display: none; }
.steps li { display: grid; grid-template-columns: 52px 1fr; gap: 12px; align-items: center; font-size: 16px; }
.steps li .pic svg { width: 52px; height: 52px; display: block; }
.steps li.warn, .steps li.big-action { grid-template-columns: 1fr; background: #fff6e5; border-radius: 14px; padding: 12px 14px; }
.steps li.big-action { background: var(--free-soft); }
.ico-share { display: inline-block; width: 14px; height: 16px; vertical-align: -2px; background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 16'%3E%3Cpath d='M7 1v9M4 4l3-3 3 3M4 7H2v8h10V7h-2' fill='none' stroke='%230a84ff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.sheet-foot { margin: 16px 0 0; color: var(--muted); font-size: 14px; }

.locked { margin-top: 30vh; text-align: center; color: var(--muted); padding: 0 20px; }
