/* ============================================================
   EpilateMe dashboard — brand visual system (epilate-me.com)
   Light blue-grey canvas, white cards, brand navy ink, ONE
   chromatic accent (brand gold). Clean premium-minimal.
   ============================================================ */

[x-cloak] { display: none !important; }

:root {
  --canvas:  #f5f7fd;
  --surface: #ffffff;
  --ink:     #01195f;   /* brand navy */
  --muted:   #6b7280;
  --faint:   #9aa3b2;
  --signal:  #fbbf24;   /* brand gold accent */
  --wash:    #fef3c7;
  --darkk:   #01195f;
  --edge:    #e3e8f4;
  --input:   #cdd5e6;

  --radius-card: 10px;
  --shadow-soft: rgba(1,25,95,0.06) 0 4px 16px;
}

body {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.005em;
  background: var(--canvas);
  color: var(--ink);
}

/* ---- brand wordmark (inline gold-gradient SVG) ---- */
.brand-mark {
  display: block;
  height: 18px;
  width: auto;
}
.card-title {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}

/* ---- cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--radius-card);
  padding: 28px;
  box-shadow: var(--shadow-soft);
}

/* ---- KPI ---- */
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--radius-card);
  padding: 20px 22px;
  box-shadow: var(--shadow-soft);
}
.kpi-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}
.kpi-value {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
  font-size: 1.875rem;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.kpi-value.is-text {
  font-size: 1rem;
  line-height: 1.2;
  color: var(--ink);
}

.chart-title {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-bottom: 1rem;
  color: var(--ink);
}
.chart-box { position: relative; width: 100%; height: 240px; }
.chart-box > canvas { width: 100% !important; height: 100% !important; display: block; }

/* ---- pill period buttons ---- */
.pill {
  padding: 0.4rem 0.95rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: background .15s, color .15s, border-color .15s;
  border: 1px solid transparent;
}
.pill-off {
  background: var(--surface);
  color: var(--muted);
  border-color: var(--edge);
}
.pill-off:hover { color: var(--ink); border-color: var(--input); }
.pill-on {
  background: var(--signal);
  color: var(--ink);
  border-color: var(--signal);
}

/* ---- segmented control + nav ---- */
.seg {
  display: inline-flex;
  background: var(--canvas);
  border: 1px solid var(--edge);
  border-radius: 9999px;
  padding: 0.2rem;
}
.seg button {
  padding: 0.32rem 0.9rem; border-radius: 9999px;
  font-size: 0.8125rem; font-weight: 500; color: var(--muted); transition: all .15s;
}
.seg .seg-on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 0.06); }

.nav-btn {
  min-width: 2rem; height: 2rem;
  display: grid; place-items: center;
  border-radius: 9999px;
  background: var(--surface); border: 1px solid var(--edge); color: var(--ink);
  font-size: 1.1rem; line-height: 1; font-weight: 500; transition: background .15s, border-color .15s;
}
.nav-btn-wide { width: auto; padding: 0 0.85rem; font-size: 0.8125rem; font-weight: 500; }
.nav-btn:hover { background: var(--canvas); border-color: var(--input); }

/* ============ WEEK CALENDAR ============ */
.wk {
  display: grid;
  grid-template-columns: 3.2rem repeat(7, minmax(0, 1fr));
  border: 1px solid var(--edge);
  border-radius: var(--radius-card);
  overflow: hidden;
}
/* header row */
.wk-head {
  padding: 0.5rem 0.25rem; text-align: center;
  background: var(--canvas); border-bottom: 1px solid var(--edge);
}
.wk-head.is-today { background: var(--wash); }
.wk-head .dow { font-size: 0.6875rem; font-weight: 500; text-transform: uppercase; color: var(--faint); letter-spacing: .04em; }
.wk-head .dnum {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-size: 1.05rem; font-weight: 600; letter-spacing: -0.02em; color: var(--ink);
}
.wk-head.is-today .dnum { color: var(--ink); }
.wk-corner { background: var(--canvas); border-bottom: 1px solid var(--edge); }

/* body: time gutter + day columns */
.wk-gutter { position: relative; background: var(--canvas); border-right: 1px solid var(--edge); }
.wk-hour-label {
  position: absolute; right: 0.35rem; transform: translateY(-50%);
  font-size: 0.625rem; font-weight: 500; color: var(--faint);
}
.wk-col { position: relative; border-right: 1px solid var(--edge); }
.wk-col:last-child { border-right: 0; }
.wk-col.is-today { background: #fffbeb; }
.wk-hline { position: absolute; left: 0; right: 0; border-top: 1px solid #f1f0ee; }

.wk-ev {
  position: absolute;
  border-radius: 6px;
  padding: 0.2rem 0.4rem;
  overflow: hidden;
  color: #fff;
  cursor: default;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08);
  transition: filter .12s;
}
.wk-ev:hover { filter: brightness(0.95); }
.wk-ev .ev-t { font-size: 0.625rem; font-weight: 600; line-height: 1.1; opacity: .9; }
.wk-ev .ev-n { font-size: 0.6875rem; font-weight: 500; line-height: 1.15; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.wk-ev .ev-one { font-size: 0.625rem; font-weight: 500; line-height: 1.25; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }

/* estimated / booked sessions: lower-contrast fill + dashed border */
.wk-ev.is-estimate {
  color: var(--ink);
  background-color: transparent !important;
  border: 1px dashed currentColor;
  box-shadow: none;
}
.wk-ev.is-estimate .ev-t { opacity: .65; }

/* cancelled: faded, hatched */
.wk-ev.is-cancelled {
  opacity: 0.4;
  background-image: repeating-linear-gradient(45deg, rgb(255 255 255 / .3) 0 4px, transparent 4px 8px);
  text-decoration: line-through;
}
.wk-ev.is-cancelled.is-estimate { background-image: none; }

.wk-empty { padding: 2.5rem 1rem; text-align: center; color: var(--faint); font-weight: 500; }

/* ============ MONTH CALENDAR ============ */
.mo { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 0.4rem; }
.mo-dow { text-align: center; font-size: 0.6875rem; font-weight: 500; text-transform: uppercase; color: var(--faint); padding-bottom: 0.2rem; }
.mo-cell {
  min-height: 5rem; border-radius: 8px; background: var(--canvas);
  border: 1px solid var(--edge); padding: 0.45rem; display: flex; flex-direction: column; gap: 0.3rem;
  transition: box-shadow .15s, border-color .15s;
}
.mo-cell.has:hover { box-shadow: var(--shadow-soft); border-color: var(--input); cursor: pointer; }
.mo-cell.out { opacity: 0.4; }
.mo-cell.is-today { border-color: var(--signal); background: #fffbeb; }
.mo-daynum {
  font-size: 0.8125rem; font-weight: 500; color: var(--ink);
  display: flex; justify-content: space-between; align-items: center;
}
.mo-count {
  font-size: 0.625rem; font-weight: 600; color: var(--ink); background: var(--signal);
  border-radius: 9999px; padding: 0.05rem 0.45rem;
}
.mo-dots { display: flex; flex-wrap: wrap; gap: 3px; margin-top: auto; }
.mo-chip {
  height: 16px; border-radius: 4px; min-width: 0; flex: 1 1 100%;
  font-size: 0.5625rem; font-weight: 500; color: #fff;
  padding: 0 4px; line-height: 16px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mo-chip.is-estimate { background: transparent !important; color: var(--ink); border: 1px dashed currentColor; line-height: 14px; }
.mo-chip.is-cancelled { opacity: 0.4; text-decoration: line-through; }
.mo-more { font-size: 0.5625rem; font-weight: 500; color: var(--faint); }

/* ============ CUSTOM TOOLTIP (week + month blocks) ============ */
.epm-tip {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity .12s ease, transform .12s ease;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  padding: 10px 12px;
  max-width: 240px;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--ink);
}
.epm-tip.is-on { opacity: 1; transform: translateY(0); }
.epm-tip .tip-prog {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-weight: 600; font-size: 0.8125rem; letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.35rem;
}
.epm-tip .tip-prog .tip-swatch { width: 8px; height: 8px; border-radius: 9999px; flex: none; }
.epm-tip .tip-row { color: var(--muted); display: flex; justify-content: space-between; gap: 1rem; }
.epm-tip .tip-row b { color: var(--ink); font-weight: 500; }
.epm-tip .tip-tags { margin-top: 0.5rem; display: flex; gap: 0.35rem; flex-wrap: wrap; }
.epm-tip .tip-tag {
  font-size: 0.6875rem; font-weight: 500; border-radius: 9999px; padding: 0.1rem 0.55rem;
}
.epm-tip .tip-tag.real { background: var(--wash); color: #7a5b00; }
.epm-tip .tip-tag.est  { background: var(--canvas); color: var(--muted); border: 1px dashed var(--input); }
.epm-tip .tip-tag.cancel { background: #f5f5f4; color: var(--muted); }
.epm-tip .tip-tag.live { background: var(--signal); color: var(--ink); }

/* ============ LIVE "идёт сейчас" ============ */
.live-banner {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--signal);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  padding: 14px 18px;
}
.live-banner-body { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.6rem; min-width: 0; }
.live-banner-title {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-weight: 600; font-size: 0.95rem; letter-spacing: -0.015em; color: var(--ink);
}
.live-banner-meta { font-size: 0.8125rem; color: var(--muted); display: inline-flex; align-items: baseline; gap: 0.4rem; flex-wrap: wrap; }
.live-banner-sep { color: var(--faint); }
.live-banner-prog { color: var(--ink); font-weight: 500; }

/* pulsing signal-blue dot, shared by the banner and the week-block marker */
.live-dot {
  flex: none; width: 11px; height: 11px; border-radius: 9999px;
  background: var(--signal);
  box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.6);
  animation: epm-pulse 1.8s ease-out infinite;
}
@keyframes epm-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.6); }
  70%  { box-shadow: 0 0 0 8px rgba(251, 191, 36, 0); }
  100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); }
}

/* live week-calendar block: solid signal-blue fill + pulsing border */
.wk-ev.wk-ev-live {
  background: var(--signal) !important;
  color: var(--ink) !important;
  border: 2px solid #d97706;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08);
  z-index: 5;
  animation: epm-live-border 1.6s ease-in-out infinite;
}
.wk-ev.wk-ev-live .ev-t { opacity: 0.95; }
.wk-ev.wk-ev-live:hover { filter: none; }
.wk-live-now {
  position: absolute; top: 3px; right: 5px;
  font-size: 0.5625rem; font-weight: 600; line-height: 1;
  color: var(--ink); opacity: 0.95;
}
@keyframes epm-live-border {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.55), 0 1px 2px rgb(0 0 0 / 0.08); }
  50%      { box-shadow: 0 0 0 4px rgba(251, 191, 36, 0), 0 1px 2px rgb(0 0 0 / 0.08); }
}

/* finished-but-unsynced telemetry session: blue fill, dashed amber border,
   no pulse — distinct from the live block, held until the bundle catches up */
.wk-ev.wk-ev-pending {
  background: var(--signal) !important;
  color: var(--ink) !important;
  border: 2px dashed #d97706;
  opacity: 0.9;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08);
  z-index: 4;
}
.wk-ev.wk-ev-pending:hover { filter: none; opacity: 1; }
.wk-unsync-now {
  position: absolute; top: 3px; right: 5px;
  font-size: 0.5625rem; font-weight: 600; line-height: 1;
  color: var(--ink); opacity: 0.85;
}
.epm-tip .tip-tag.unsync { background: var(--canvas); color: #92400e; border: 1px dashed #d97706; }

@media (max-width: 640px) {
  .wk { min-width: 640px; }
  #cal-week { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .mo-cell { min-height: 3.75rem; }
  .card { padding: 20px; }
  .epm-tip { max-width: 200px; }
}
