
/* ===== NORMA CALENDAR · liquid glass ===== */

.calendar-stack{
  position:relative;
  margin:0 0 24px;
  padding-bottom:0;
}

/* One calendar body. The information sheet overlaps its lower edge. */
.calendar-shell{
  position:relative;
  z-index:1;
  overflow:hidden;
  padding:18px 14px 78px;
  border-radius:27px;
  border:1px solid rgba(255,255,255,.82);
  background:
    radial-gradient(circle at 92% 5%,rgba(124,190,247,.24),transparent 34%),
    radial-gradient(circle at 5% 80%,rgba(218,238,255,.50),transparent 40%),
    linear-gradient(145deg,rgba(255,255,255,.78),rgba(237,247,255,.60));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.96),
    0 18px 42px rgba(35,82,127,.09);
  backdrop-filter:blur(22px);
  -webkit-backdrop-filter:blur(22px);
}

.calendar-week-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin:0 5px 12px;
}
.calendar-week-label{
  font-size:13px;
  font-weight:850;
  letter-spacing:.2px;
  color:#0b2c53;
}
.calendar-scroll-hint{display:none!important}

/* Horizontal date ribbon */
.calendar-week-strip.horizontal{
  display:flex!important;
  gap:7px!important;
  overflow-x:auto!important;
  overflow-y:hidden!important;
  padding:2px 2px 11px!important;
  scroll-snap-type:x proximity;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:none;
  touch-action:pan-x;
}
.calendar-week-strip.horizontal::-webkit-scrollbar{display:none}

.cal-day{
  position:relative;
  flex:0 0 54px;
  width:54px;
  min-width:54px;
  padding:9px 2px 10px;
  border:1px solid rgba(255,255,255,.72);
  border-radius:16px;
  background:rgba(255,255,255,.30);
  color:#75879a;
  text-align:center;
  scroll-snap-align:center;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.76);
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
}
.cal-day small{
  display:block;
  margin-bottom:5px;
  font-size:8px;
  font-weight:800;
  letter-spacing:.8px;
}
.cal-day b{
  display:block;
  color:#102d50;
  font-size:16px;
  line-height:1;
}
.cal-day.selected{
  color:#fff;
  border-color:rgba(255,255,255,.42);
  background:
    radial-gradient(circle at 30% 10%,rgba(67,151,226,.72),transparent 50%),
    linear-gradient(145deg,#103a6b,#0b5a99);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.36),
    0 8px 20px rgba(15,78,134,.24);
}
.cal-day.selected b{color:#fff}
.cal-day.has-event:after{
  content:"";
  position:absolute;
  left:50%;
  bottom:4px;
  width:4px;
  height:4px;
  border-radius:50%;
  background:#2f80c5;
  transform:translateX(-50%);
}
.cal-day.selected:after{background:#d7efff}

/* Month exists inside the same shell and is hidden behind the sheet. */
.calendar-month-wrap{
  max-height:0;
  overflow:hidden;
  opacity:0;
  transform:translateY(-8px);
  padding-top:0;
  transition:max-height .38s cubic-bezier(.2,.75,.2,1),
             opacity .22s ease,
             transform .32s ease,
             padding-top .32s ease;
}
.calendar-shell.expanded .calendar-month-wrap{
  max-height:500px;
  opacity:1;
  transform:none;
  padding-top:13px;
}

.calendar-weekdays,
.calendar-month-grid{
  display:grid;
  grid-template-columns:repeat(7,minmax(0,1fr));
  gap:6px;
}
.calendar-weekdays span{
  padding:3px 0;
  text-align:center;
  color:#8294a8;
  font-size:8px;
  font-weight:800;
}
.month-cell{
  position:relative;
  display:grid;
  place-items:center;
  aspect-ratio:1;
  border:1px solid transparent;
  border-radius:50%;
  background:transparent;
  color:#16314f;
  font-size:11px;
}
.month-cell.empty{visibility:hidden}
.month-cell.today{border-color:rgba(22,107,177,.46)}
.month-cell.selected{
  color:#fff;
  background:linear-gradient(145deg,#124376,#0b5f9f);
  box-shadow:0 6px 15px rgba(15,79,136,.20);
}
.month-cell.event-tax:not(.selected){background:rgba(215,237,255,.72)}
.month-cell.event-pay:not(.selected){background:rgba(218,246,237,.78)}
.month-cell.event-control:not(.selected){background:rgba(235,226,255,.72)}
.month-cell .mini-dot{
  position:absolute;
  bottom:4px;
  width:4px;
  height:4px;
  border-radius:50%;
  background:#2475ba;
}
.calendar-legend{display:none}

/* The sheet is physically over the bottom of the calendar. */
.calendar-sheet{
  position:relative;
  z-index:3;
  margin:-60px 8px 0;
  padding:5px 14px 15px;
  border-radius:25px;
  border:1px solid rgba(255,255,255,.88);
  background:
    radial-gradient(circle at 92% 5%,rgba(126,190,246,.17),transparent 38%),
    linear-gradient(145deg,rgba(255,255,255,.82),rgba(241,248,254,.68));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.98),
    0 -8px 26px rgba(42,89,133,.07),
    0 14px 34px rgba(42,89,133,.10);
  backdrop-filter:blur(24px);
  -webkit-backdrop-filter:blur(24px);
  touch-action:none;
  transition:margin-top .38s cubic-bezier(.2,.75,.2,1);
}
.calendar-stack.expanded .calendar-sheet{
  margin-top:-18px;
}

.sheet-handle-btn{
  display:flex;
  justify-content:center;
  width:100%;
  padding:3px 0 10px;
  border:0;
  background:transparent;
}
.sheet-handle{
  display:block;
  width:43px;
  height:4px;
  border-radius:99px;
  background:rgba(113,143,171,.28);
}

.calendar-today{padding:1px 1px 0}
.calendar-today .eyebrow{
  margin-bottom:5px;
  color:#5d7690;
  font-size:9px;
  font-weight:850;
  letter-spacing:1.6px;
}
.calendar-today h2{
  margin:0 0 10px;
  color:#0a264c;
  font-size:18px;
  line-height:1.15;
}
.calendar-today > p{
  margin:5px 0 2px;
  color:#657b92;
  font-size:11.5px;
  line-height:1.42;
}
.no-massive{
  display:inline-flex;
  margin:0 0 9px;
  padding:6px 9px;
  border:1px solid rgba(255,255,255,.75);
  border-radius:999px;
  background:rgba(226,240,252,.64);
  color:#47708f;
  font-size:8.5px;
  font-weight:850;
  letter-spacing:.2px;
}

.today-deadline{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 0 3px;
  border-top:1px solid rgba(112,143,170,.14);
}
.today-deadline .icobox{
  width:38px;
  height:38px;
  min-width:38px;
  border:1px solid rgba(255,255,255,.85);
  background:linear-gradient(145deg,rgba(231,245,255,.86),rgba(255,255,255,.60));
  box-shadow:inset 0 1px 0 #fff;
}
.today-deadline b{
  display:block;
  color:#102d50;
  font-size:12.5px;
  line-height:1.25;
}
.today-deadline small{
  display:block;
  margin-top:3px;
  color:#788ba0;
  font-size:10.2px;
  line-height:1.35;
}

/* Upcoming deadlines: only dated calendar obligations. */
.deadline-feed{margin-top:0}
.deadline-feed .section-title{
  margin:0 0 10px;
  color:#5f748b;
  font-size:11px;
  letter-spacing:2.5px;
}
.deadline-list{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.deadline-item{
  display:grid;
  grid-template-columns:58px minmax(0,1fr) 14px;
  align-items:center;
  gap:11px;
  padding:12px;
  border:1px solid rgba(255,255,255,.86);
  border-radius:21px;
  background:
    radial-gradient(circle at 8% 50%,rgba(209,236,255,.24),transparent 28%),
    linear-gradient(145deg,rgba(255,255,255,.80),rgba(247,251,255,.66));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.96),
    0 10px 26px rgba(43,86,128,.065);
  backdrop-filter:blur(18px);
  -webkit-backdrop-filter:blur(18px);
}
.deadline-date{
  width:56px;
  height:56px;
  border-radius:17px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  color:#0b315b;
  background:rgba(218,239,255,.78);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.92);
}
.deadline-date.pay{background:rgba(218,246,237,.82)}
.deadline-date.report{background:rgba(235,227,255,.80)}
.deadline-date.major{background:rgba(255,231,216,.80)}
.deadline-date b{font-size:17px;line-height:1}
.deadline-date small{margin-top:4px;font-size:8px;font-weight:850}
.deadline-item h3{
  margin:0 0 4px;
  color:#102b4d;
  font-size:12.7px;
  line-height:1.24;
}
.deadline-item p{
  margin:0;
  color:#7a8da2;
  font-size:10.3px;
  line-height:1.35;
}
.deadline-chevron{
  color:#83a0ba;
  font-size:20px;
  font-weight:300;
}

@media(max-width:390px){
  .calendar-shell{padding-left:11px;padding-right:11px}
  .cal-day{flex-basis:51px;width:51px;min-width:51px}
  .calendar-sheet{margin-left:5px;margin-right:5px}
  .deadline-item{grid-template-columns:54px minmax(0,1fr) 12px;padding:11px}
  .deadline-date{width:52px;height:52px}
}

/* ===== Calendar · unified timeline mechanics ===== */

/* Do not trap vertical page scrolling. */
.calendar-stack{position:relative;overflow:visible;border-radius:27px}
.calendar-shell{padding-bottom:18px}

.calendar-month-wrap{
  max-height:0!important;opacity:0!important;overflow:hidden!important;
  padding-top:0!important;pointer-events:none;
  transition:max-height .28s cubic-bezier(.22,.75,.2,1),
             opacity .16s ease,padding-top .24s ease!important;
}
.calendar-stack.expanded .calendar-month-wrap{
  max-height:500px!important;opacity:1!important;padding-top:13px!important;pointer-events:auto;
}

/* One continuous lower surface: selected day + title + all upcoming dates. */
.calendar-moving-content{
  position:relative;z-index:5;
  margin:-18px 8px 0;
  padding:0 0 8px;
  border:1px solid rgba(255,255,255,.86);
  border-radius:27px;
  background:
    radial-gradient(circle at 90% 4%,rgba(135,197,248,.14),transparent 34%),
    linear-gradient(145deg,rgba(255,255,255,.73),rgba(241,248,254,.59));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.96),0 14px 34px rgba(42,89,133,.08);
  backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px);
  transition:transform .22s cubic-bezier(.22,.75,.2,1),margin-top .22s ease;
  will-change:transform;
}
.calendar-stack.expanded + .calendar-moving-content{margin-top:-10px}
.calendar-moving-content.dragging{transition:none!important}

/* Inner pieces lose their separate floating-card appearance. */
.calendar-moving-content .calendar-sheet{
  position:relative!important;left:auto!important;right:auto!important;bottom:auto!important;
  margin:0!important;padding:5px 18px 13px!important;
  border:0!important;border-radius:27px 27px 0 0!important;
  background:transparent!important;box-shadow:none!important;
  backdrop-filter:none!important;-webkit-backdrop-filter:none!important;
  max-height:none!important;height:auto!important;overflow:visible!important;
  touch-action:pan-y!important;
}
.calendar-moving-content .deadline-feed{
  position:relative;
  margin:0!important;padding:4px 18px 8px 42px;
}

/* Fix “БЛИЖАЙШИЕ ДАТЫ”: aligned with the unified timeline, no floating gap. */
.calendar-moving-content .deadline-feed .section-title{
  margin:3px 0 13px!important;
  color:#60778f;font-size:10px;font-weight:850;letter-spacing:2.2px;
}

/* Timeline line + nodes on the left, inspired by the reference. */
.calendar-moving-content .deadline-feed::before{
  content:"";position:absolute;left:25px;top:33px;bottom:34px;width:2px;
  border-radius:2px;background:linear-gradient(to bottom,rgba(70,157,224,.72),rgba(70,157,224,.18));
}
.calendar-moving-content .deadline-item{
  position:relative;
  grid-template-columns:58px minmax(0,1fr) 18px;
  margin:0 0 10px;padding:11px 11px 11px 12px;
  border:1px solid rgba(255,255,255,.62);
  border-radius:18px;
  background:rgba(255,255,255,.30);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.70);
}
.calendar-moving-content .deadline-item::before{
  content:"";position:absolute;left:-25px;top:28px;width:9px;height:9px;border-radius:50%;
  border:2px solid rgba(65,151,218,.80);background:#eef8ff;
  box-shadow:0 0 0 4px rgba(238,248,255,.75);
}

/* Friendly rounded disclosure chevrons instead of thin sharp glyphs. */
.deadline-chevron{
  width:18px;height:18px;font-size:0!important;position:relative;color:transparent!important;
}
.deadline-chevron::before{
  content:"";position:absolute;left:4px;top:4px;width:7px;height:7px;
  border-right:2.5px solid #7894ad;border-top:2.5px solid #7894ad;
  border-radius:2px;transform:rotate(45deg);
}

/* Pull affordance: broad rounded chevron. */
.sheet-handle-btn{
  display:flex!important;align-items:center;justify-content:center;
  width:100%;height:31px;padding:0!important;border:0;background:transparent;
  touch-action:pan-y!important;
}
.sheet-handle{display:none!important}
.sheet-handle-btn::after{
  content:"";width:10px;height:10px;
  border-right:3px solid #7890a7;border-bottom:3px solid #7890a7;
  border-radius:2px;transform:rotate(45deg) translate(-2px,-2px);
  transition:transform .18s ease;
}
.calendar-stack.expanded + .calendar-moving-content .sheet-handle-btn::after{
  transform:rotate(225deg) translate(-2px,-2px);
}

/* Keep native vertical page scrolling everywhere. Gesture detection is passive. */
.calendar-moving-content,.calendar-moving-content *{overscroll-behavior:auto}
.calendar-expand-control{display:none!important}

@media(max-width:390px){
  .calendar-moving-content{margin-left:5px;margin-right:5px}
  .calendar-moving-content .deadline-feed{padding-left:39px;padding-right:13px}
  .calendar-moving-content .deadline-feed::before{left:23px}
  .calendar-moving-content .deadline-item::before{left:-23px}
}


/* ===== Calendar reveal-under-sheet refinement ===== */

/* Month is the layer underneath the lower glass surface. */
.calendar-stack{
  position:relative;
  z-index:1;
}
.calendar-shell{
  position:relative;
  z-index:1;
}

/* The unified selected-day + deadlines surface sits above the month. */
.calendar-moving-content{
  position:relative;
  z-index:6;
}

/* When expanded, month grows downward first; lower surface is displaced as one piece. */
.calendar-stack.expanded .calendar-month-wrap{
  position:relative;
  z-index:1;
}

/* The upper part of the information card is the pull zone. */
.calendar-sheet{
  position:relative;
}
.calendar-sheet::before{
  content:"";
  position:absolute;
  left:0;
  right:0;
  top:0;
  height:92px;
  pointer-events:none;
}


/* ===== FINAL calendar sheet mechanics: month stays UNDER the glass panel ===== */

.calendar-stack{
  position:relative!important;
  overflow:visible!important;
}

/* The calendar shell keeps a stable viewport; month expands inside it. */
.calendar-shell{
  position:relative!important;
  z-index:1!important;
  overflow:hidden!important;
  padding-bottom:18px!important;
  transition:height .18s cubic-bezier(.22,.8,.22,1)!important;
}

/* Hidden month occupies no visible space until reveal. */
.calendar-month-wrap{
  position:relative!important;
  z-index:1!important;
  max-height:0!important;
  opacity:0!important;
  overflow:hidden!important;
  padding-top:0!important;
  transform:translateY(-8px)!important;
  pointer-events:none!important;
  transition:
    max-height .18s cubic-bezier(.22,.8,.22,1),
    opacity .10s ease,
    transform .18s cubic-bezier(.22,.8,.22,1),
    padding-top .16s ease!important;
}
.calendar-stack.expanded .calendar-month-wrap{
  max-height:500px!important;
  opacity:1!important;
  padding-top:13px!important;
  transform:translateY(0)!important;
  pointer-events:auto!important;
}

/*
  The whole lower glass surface overlaps the calendar.
  When month opens, JS moves THIS WHOLE SURFACE down by exactly the revealed month height.
*/
.calendar-moving-content{
  position:relative!important;
  z-index:10!important;
  margin:-18px 8px 0!important;
  transform:translateY(0);
  transition:transform .18s cubic-bezier(.22,.8,.22,1)!important;
  will-change:transform;
}
.calendar-moving-content.dragging{
  transition:none!important;
}

/* Prevent old expanded margin rules from pushing the block through document flow. */
.calendar-stack.expanded + .calendar-moving-content{
  margin-top:-18px!important;
}

/* Full pull zone = arrow + date/title + status + Rosstat row. */
.calendar-moving-content .calendar-sheet{
  touch-action:pan-y!important;
}

/* Arrow stays broad and rounded. */
.sheet-handle-btn{
  height:31px!important;
  touch-action:pan-y!important;
}


/* ===== Calendar overlay correction: no giant gap ===== */

/* Expansion is now pure layout reveal: the month grows inside calendar-stack,
   and the unified lower panel stays attached immediately to its lower edge. */
.calendar-moving-content,
.calendar-stack.expanded + .calendar-moving-content{
  transform:none!important;
  margin-top:-18px!important;
}
.calendar-moving-content.dragging{
  transition:none!important;
}

/* During finger tracking only a small visual pull is allowed via CSS variable. */
.calendar-moving-content.preview-pull{
  transform:translateY(var(--calendar-pull,0px))!important;
}

/* Full month remains in the same calendar shell; no absolute height calculations. */
.calendar-stack.expanded .calendar-month-wrap{
  max-height:430px!important;
}


/* ===== Calendar interactive reveal ===== */

/* Month no longer “opens” by itself. Its visible height is controlled continuously
   by the drag progress supplied from JS. */
.calendar-month-wrap,
.calendar-stack.expanded .calendar-month-wrap{
  max-height:var(--month-reveal, 0px)!important;
  height:auto!important;
  opacity:var(--month-opacity, 0)!important;
  overflow:hidden!important;
  padding-top:var(--month-pad, 0px)!important;
  transform:translateY(var(--month-shift, -10px))!important;
  pointer-events:none!important;
  transition:
    max-height .20s cubic-bezier(.22,.85,.25,1),
    opacity .14s ease,
    transform .20s cubic-bezier(.22,.85,.25,1),
    padding-top .18s ease!important;
  will-change:max-height,opacity,transform;
}

/* While finger is moving, calendar follows it 1:1 with no easing lag. */
.calendar-stack.calendar-dragging .calendar-month-wrap{
  transition:none!important;
}

/* Lower unified sheet stays attached to the revealed edge. */
.calendar-moving-content,
.calendar-stack.expanded + .calendar-moving-content{
  margin-top:-18px!important;
  transform:none!important;
  transition:none!important;
}

/* Slight spring only when settling after release. */
.calendar-stack.calendar-settling .calendar-month-wrap{
  transition:
    max-height .22s cubic-bezier(.18,.86,.26,1),
    opacity .13s ease,
    transform .22s cubic-bezier(.18,.86,.26,1),
    padding-top .18s ease!important;
}


/* ===== Calendar month date tap fix ===== */
.calendar-stack.expanded .calendar-month-wrap{
  pointer-events:auto!important;
}
.calendar-stack.expanded .calendar-month-grid,
.calendar-stack.expanded .month-cell{
  pointer-events:auto!important;
}
.month-cell{
  position:relative;
  z-index:3;
  cursor:pointer;
  touch-action:manipulation!important;
  -webkit-tap-highlight-color:transparent;
}


/* ===== Reliable month date interaction on iOS ===== */
.calendar-month-wrap{position:relative!important;}
.calendar-stack.expanded .calendar-month-wrap,
.calendar-stack.expanded .calendar-month-grid,
.calendar-stack.expanded .month-cell{pointer-events:auto!important;}
.calendar-month-grid{position:relative;z-index:20;}
.month-cell{position:relative;z-index:21;touch-action:manipulation!important;-webkit-user-select:none;user-select:none;}


/* ===== Month dates are real tap targets ===== */
.calendar-month-grid{
  position:relative!important;
  z-index:30!important;
}
.month-cell{
  position:relative!important;
  z-index:31!important;
  pointer-events:auto!important;
  touch-action:manipulation!important;
}
.month-cell::before{
  content:"";
  position:absolute;
  inset:-6px;
  border-radius:50%;
}
