/* ============================================================
   CDate — themed calendar (js/cdate.js)
   Built to sit next to css/cselect.css: same button, same panel, same
   slim red furniture, so the date field and the dropdowns read as one set.
   ============================================================ */

.cd{ position:relative; display:block; }
.cd input{ display:none; }            /* kept for its value, never shown */

/* ---------- closed state ---------- */
.cd-btn{
  width:100%; display:flex; align-items:center; cursor:pointer; transition:.16s;
  padding:11px 34px 11px 37px; border-radius:10px; text-align:left;
  background:rgba(255,255,255,.03); border:1px solid var(--line-soft);
  font-family:var(--body); font-size:13px; color:var(--text);
}
.cd-btn:hover{ border-color:rgba(255,26,46,.3); }
.cd-btn:focus-visible{ outline:none; border-color:rgba(255,26,46,.55); background:rgba(255,26,46,.05); }
.cd-open .cd-btn{ border-color:rgba(255,26,46,.55); background:rgba(255,26,46,.05); }

.cd-label{ flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cd-label.cd-ph{ color:#5e5e68; }
/* a filled field keeps the red border, matching the inputs and dropdowns */
.cd-filled .cd-btn{ border-color:rgba(255,26,46,.55); }
/* the form puts .bad on the control, which is now hidden — js/cdate.js
   carries it out to the wrapper so a missed field still has a red box */
.cd-bad .cd-btn{ border-color:#ff5a68; background:rgba(255,90,104,.07); }

/* ---------- the panel ---------- */
.cd-panel{
  position:absolute; left:0; top:calc(100% + 6px); z-index:60;
  width:min(292px, 100%); padding:10px; border-radius:10px;
  background:#100a0c; border:1px solid rgba(255,26,46,.4);
  box-shadow:0 18px 44px rgba(0,0,0,.65); outline:none;
}
.cd-panel[hidden]{ display:none; }
.cd-panel.cd-up{ top:auto; bottom:calc(100% + 6px); }

/* ---------- month / year bar ---------- */
.cd-head{ display:flex; align-items:center; gap:4px; margin-bottom:8px; }

.cd-nav{
  flex:0 0 auto; width:26px; height:28px; display:grid; place-items:center;
  border-radius:7px; cursor:pointer; transition:.14s;
  background:rgba(255,255,255,.04); border:1px solid var(--line-soft);
}
.cd-nav[hidden]{ display:none; }
.cd-nav svg{ width:15px; height:15px; fill:none; stroke:#c4c4ce; stroke-width:2;
             stroke-linecap:round; stroke-linejoin:round; }
.cd-nav:hover:not(:disabled){ background:rgba(255,26,46,.16); border-color:rgba(255,26,46,.45); }
.cd-nav:hover:not(:disabled) svg{ stroke:#fff; }
/* the far edge of the allowed range: still there, plainly not usable */
.cd-nav:disabled{ opacity:.3; cursor:not-allowed; }
/* the year pair reads as the outer control of the two */
.cd-py svg, .cd-ny svg{ width:16px; height:16px; stroke:#8b8b95; }

/* the title is a button: it steps days → months → years */
.cd-title{
  flex:1; min-width:0; padding:6px 4px; border-radius:7px; cursor:pointer; transition:.14s;
  background:transparent; border:1px solid transparent;
  font-family:var(--head); font-size:11.5px; font-weight:700; letter-spacing:.04em;
  color:var(--text); text-transform:uppercase; white-space:nowrap;
}
.cd-title:hover{ background:rgba(255,26,46,.12); border-color:rgba(255,26,46,.32); }

/* ---------- weekday row ---------- */
.cd-dow{
  display:grid; grid-template-columns:repeat(7,1fr); gap:2px; margin-bottom:3px;
}
.cd-dow[hidden]{ display:none; }
.cd-dow span{
  text-align:center; padding:4px 0; font-family:var(--head); font-size:9.5px;
  font-weight:700; letter-spacing:.08em; color:#7f7f89;
}

/* ---------- the grid ---------- */
.cd-grid{ display:grid; gap:2px; }
.cd-grid.cd-day{ grid-template-columns:repeat(7,1fr); }
.cd-grid.cd-month, .cd-grid.cd-year{ grid-template-columns:repeat(3,1fr); gap:5px; }

.cd-grid button{
  border:1px solid transparent; border-radius:7px; cursor:pointer; transition:.12s;
  background:transparent; font-family:var(--body); color:#c4c4ce;
}
.cd-d{ height:32px; font-size:12.5px; }
.cd-m, .cd-y{ height:42px; font-size:12.5px; letter-spacing:.03em; }

.cd-grid button:hover:not(:disabled){ background:rgba(255,26,46,.14); color:#fff; }
.cd-grid button.on{
  background:rgba(255,26,46,.22); color:#fff; border-color:rgba(255,26,46,.55); font-weight:600;
}
/* the keyboard cursor, distinct from the chosen day */
.cd-d.cd-cur:not(.on){ border-color:rgba(255,26,46,.42); }
/* today gets a dot, not a fill — it is a landmark, not a choice */
.cd-d.cd-today{ position:relative; }
.cd-d.cd-today::after{
  content:''; position:absolute; left:50%; bottom:4px; width:3px; height:3px;
  margin-left:-1.5px; border-radius:50%; background:var(--red);
}
.cd-d.cd-out{ color:#4a4a52; }                 /* spill from the months either side */
.cd-grid button:disabled{ opacity:.28; cursor:not-allowed; }
.cd-grid button:disabled:hover{ background:transparent; }

@media (max-width:640px){
  .cd-panel{ width:min(280px, 100%); }
  .cd-d{ height:30px; }
}
