
:root{
  --bg:#eef2f7;
  --surface:rgba(255,255,255,.82);
  --surface-solid:#ffffff;
  --surface-alt:#f7f9fc;
  --text:#162033;
  --muted:#6b7280;
  --line:rgba(15,23,42,.08);
  --primary:#2563eb;
  --primary-2:#4f46e5;
  --positive:#16a34a;
  --danger:#dc2626;
  --warning:#ea580c;
  --shadow:0 18px 45px rgba(15,23,42,.10);
  --radius-xl:28px;
  --radius-lg:20px;
  --radius-md:14px;
}

html[data-theme="dark"]{
  --bg:#0f1319;
  --surface:rgba(25,31,41,.82);
  --surface-solid:#191f29;
  --surface-alt:#202733;
  --text:#f4f7fb;
  --muted:#9ca7b8;
  --line:rgba(255,255,255,.08);
  --shadow:0 18px 45px rgba(0,0,0,.28);
}

*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0;
  min-height:100vh;
  font-family:Inter,"Segoe UI",Roboto,Arial,sans-serif;
  color:var(--text);
  background:
    radial-gradient(circle at top right,rgba(37,99,235,.13),transparent 28%),
    radial-gradient(circle at bottom left,rgba(79,70,229,.10),transparent 26%),
    var(--bg);
  transition:background .25s ease,color .25s ease;
}

button,input,select{font:inherit}
button{color:inherit}
button:focus-visible,input:focus-visible,select:focus-visible{
  outline:3px solid rgba(37,99,235,.24);
  outline-offset:2px;
}

.app-shell{
  min-height:100vh;
  display:grid;
  grid-template-columns:270px 1fr;
}

.sidebar{
  position:sticky;
  top:0;
  height:100vh;
  padding:26px 18px;
  border-right:1px solid var(--line);
  background:var(--surface);
  backdrop-filter:blur(24px);
  -webkit-backdrop-filter:blur(24px);
  display:flex;
  flex-direction:column;
  z-index:30;
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
  padding:4px 10px 24px;
}
.brand strong{display:block;font-size:15px;letter-spacing:-.01em}
.brand span{font-size:12px;color:var(--primary);font-weight:700}
.brand-mark{
  width:42px;height:42px;border-radius:13px;
  display:grid;place-items:center;
  background:linear-gradient(135deg,var(--primary),var(--primary-2));
  box-shadow:0 10px 22px rgba(37,99,235,.25);
}
.brand-mark svg{width:23px;height:23px;fill:none;stroke:white;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.brand-mark.large{width:60px;height:60px;border-radius:18px;margin-bottom:18px}

.nav-list{display:flex;flex-direction:column;gap:6px}
.nav-item{
  border:0;
  background:transparent;
  padding:12px 14px;
  border-radius:13px;
  display:flex;
  align-items:center;
  gap:11px;
  cursor:pointer;
  color:var(--muted);
  text-align:left;
  transition:.18s ease;
}
.nav-item:hover{background:var(--surface-alt);color:var(--text);transform:translateX(2px)}
.nav-item.active{
  color:#fff;
  background:linear-gradient(135deg,var(--primary),var(--primary-2));
  box-shadow:0 10px 20px rgba(37,99,235,.22);
}
.nav-item span:first-child{width:20px;text-align:center;font-weight:700}

.sidebar-bottom{margin-top:auto;display:grid;gap:10px}
.about-button{
  border:1px solid var(--line);
  background:var(--surface-alt);
  color:var(--muted);
  border-radius:12px;
  padding:10px 12px;
  cursor:pointer;
}

.main{padding:28px 34px 48px;min-width:0}
.topbar{
  min-height:72px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  margin-bottom:24px;
}
.topbar h1{margin:2px 0 0;font-size:clamp(28px,3vw,42px);letter-spacing:-.035em}
.eyebrow{
  margin:0;
  font-size:11px;
  letter-spacing:.16em;
  font-weight:800;
  color:var(--primary);
}
.top-actions{display:flex;gap:9px}
.icon-button{
  width:44px;height:44px;border-radius:14px;
  border:1px solid var(--line);
  background:var(--surface);
  cursor:pointer;
  box-shadow:0 8px 22px rgba(15,23,42,.05);
}
.mobile-only{display:none}

.view{display:none;animation:fadeIn .22s ease}
.view.active{display:block}
@keyframes fadeIn{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:none}}

.hero-grid{
  display:grid;
  grid-template-columns:1fr 1.35fr;
  gap:18px;
}
.hero-card,.panel,.result-card{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius-xl);
  box-shadow:var(--shadow);
  backdrop-filter:blur(22px);
  -webkit-backdrop-filter:blur(22px);
}
.hero-card{
  min-height:230px;
  padding:28px;
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:24px;
  overflow:hidden;
  position:relative;
}
.hero-card h2,.panel h2,.section-heading h2{margin:8px 0 8px;letter-spacing:-.025em}
.hero-card h2{font-size:clamp(26px,3vw,38px)}
.muted{color:var(--muted);line-height:1.6}
.hero-orb{
  flex:0 0 120px;
  aspect-ratio:1;
  border-radius:50%;
  display:grid;
  place-content:center;
  text-align:center;
  background:linear-gradient(145deg,rgba(37,99,235,.14),rgba(79,70,229,.05));
  border:1px solid rgba(37,99,235,.14);
}
.hero-orb span{font-size:42px;font-weight:800;line-height:1}
.hero-orb small{margin-top:8px;text-transform:uppercase;letter-spacing:.15em;color:var(--primary);font-weight:800}
.accent-card::after{
  content:"";
  position:absolute;
  width:230px;height:230px;
  right:-75px;top:-85px;
  border-radius:50%;
  background:rgba(37,99,235,.08);
}
.quick-calc{
  min-width:230px;
  display:grid;
  gap:10px;
  z-index:1;
}
input[type="date"],select{
  width:100%;
  border:1px solid var(--line);
  color:var(--text);
  background:var(--surface-solid);
  border-radius:13px;
  padding:12px 13px;
}
.primary-button{
  border:0;
  border-radius:13px;
  padding:12px 16px;
  color:white;
  cursor:pointer;
  font-weight:800;
  background:linear-gradient(135deg,var(--primary),var(--primary-2));
  box-shadow:0 10px 22px rgba(37,99,235,.23);
  transition:.18s ease;
}
.primary-button:hover{transform:translateY(-1px);box-shadow:0 13px 25px rgba(37,99,235,.28)}

.result-card{
  margin-top:18px;
  padding:28px;
  text-align:center;
  transition:.25s ease;
}
.result-label{font-weight:700;color:var(--muted)}
.result-number{font-size:clamp(58px,10vw,108px);font-weight:900;line-height:.95;letter-spacing:-.055em;margin-top:10px}
.result-unit{text-transform:uppercase;letter-spacing:.22em;font-size:12px;font-weight:800;color:var(--primary);margin-top:8px}
.result-details{margin-top:18px;color:var(--muted)}
.hidden{display:none!important}

.section-block{margin-top:34px}
.section-heading{display:flex;justify-content:space-between;align-items:end;margin-bottom:15px}
.tool-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:14px;
}
.tool-card{
  border:1px solid var(--line);
  background:var(--surface);
  border-radius:var(--radius-lg);
  padding:22px;
  min-height:170px;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:8px;
  cursor:pointer;
  text-align:left;
  box-shadow:0 12px 30px rgba(15,23,42,.06);
  transition:.2s ease;
}
.tool-card:hover{transform:translateY(-4px);box-shadow:var(--shadow);border-color:rgba(37,99,235,.22)}
.tool-card strong{font-size:17px}
.tool-card small{color:var(--muted);line-height:1.45}
.tool-icon{
  width:44px;height:44px;border-radius:14px;
  display:grid;place-items:center;
  margin-bottom:8px;
  background:linear-gradient(145deg,rgba(37,99,235,.14),rgba(79,70,229,.06));
  color:var(--primary);
  font-weight:900;
}

.panel{padding:30px;min-height:230px}
.settings-panel{max-width:700px}
.setting-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:24px;
  padding:18px 0;
  border-top:1px solid var(--line);
  margin-top:20px;
}
.setting-row span{display:grid;gap:4px}
.setting-row small{color:var(--muted)}
.setting-row select{width:180px}

.modal-backdrop{
  position:fixed;
  inset:0;
  background:rgba(4,8,15,.52);
  backdrop-filter:blur(9px);
  -webkit-backdrop-filter:blur(9px);
  display:grid;
  place-items:center;
  padding:18px;
  z-index:100;
}
.modal{
  width:min(430px,100%);
  position:relative;
  background:var(--surface-solid);
  border:1px solid var(--line);
  border-radius:26px;
  padding:32px;
  box-shadow:0 28px 80px rgba(0,0,0,.28);
}
.modal-close{
  position:absolute;top:14px;right:14px;
  width:38px;height:38px;border-radius:12px;
  border:1px solid var(--line);background:var(--surface-alt);
  cursor:pointer;font-size:23px;
}
.about-box{
  margin-top:22px;
  border:1px solid var(--line);
  background:var(--surface-alt);
  border-radius:16px;
  padding:16px;
  display:grid;
  gap:3px;
}
.about-box span{font-size:13px;color:var(--muted)}

@media (max-width:1050px){
  .tool-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .hero-grid{grid-template-columns:1fr}
}

@media (max-width:820px){
  .app-shell{display:block}
  .sidebar{
    position:fixed;
    left:0;top:0;
    width:min(310px,86vw);
    transform:translateX(-105%);
    transition:transform .22s ease;
    box-shadow:20px 0 50px rgba(0,0,0,.18);
  }
  .sidebar.open{transform:translateX(0)}
  .main{padding:20px}
  .mobile-only{display:inline-grid;place-items:center}
  .topbar{justify-content:flex-start}
  .top-actions{margin-left:auto}
}

@media (max-width:620px){
  .main{padding:16px}
  .topbar{margin-bottom:16px}
  .topbar h1{font-size:30px}
  .hero-card{
    min-height:auto;
    padding:22px;
    align-items:flex-start;
    flex-direction:column;
  }
  .hero-orb{flex-basis:auto;width:98px;align-self:flex-end;margin-top:-48px}
  .hero-orb span{font-size:34px}
  .quick-calc{width:100%;min-width:0}
  .tool-grid{grid-template-columns:1fr}
  .tool-card{min-height:135px}
  .setting-row{align-items:flex-start;flex-direction:column}
  .setting-row select{width:100%}
}


.form-grid{
  display:grid;
  gap:16px;
  margin-top:24px;
}
.form-grid.two{grid-template-columns:repeat(2,minmax(0,1fr))}
.form-grid label{display:grid;gap:8px}
.form-grid label>span{font-size:13px;font-weight:800;color:var(--muted)}
input[type="text"]{
  width:100%;
  border:1px solid var(--line);
  color:var(--text);
  background:var(--surface-solid);
  border-radius:13px;
  padding:12px 13px;
}
.action-row{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:18px;
}
.secondary-button{
  border:1px solid var(--line);
  border-radius:13px;
  padding:12px 16px;
  background:var(--surface-alt);
  color:var(--text);
  cursor:pointer;
  font-weight:800;
}
.calc-result{
  margin-top:24px;
  padding:26px;
  border:1px solid var(--line);
  border-radius:22px;
  background:linear-gradient(145deg,rgba(37,99,235,.08),rgba(79,70,229,.03));
}
.calc-kicker{
  text-align:center;
  color:var(--muted);
  font-weight:800;
}
.calc-big{
  text-align:center;
  font-size:clamp(64px,11vw,118px);
  font-weight:900;
  letter-spacing:-.06em;
  line-height:.95;
  margin-top:8px;
  color:var(--primary);
}
.calc-unit{
  text-align:center;
  text-transform:uppercase;
  letter-spacing:.2em;
  font-size:12px;
  font-weight:800;
  color:var(--primary);
  margin-top:8px;
}
.metric-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
  margin-top:24px;
}
.metric-grid>div{
  padding:16px;
  border:1px solid var(--line);
  background:var(--surface-solid);
  border-radius:16px;
  display:grid;
  gap:6px;
}
.metric-grid span{font-size:12px;color:var(--muted);font-weight:700}
.metric-grid strong{font-size:17px}
.result-note{
  margin:18px 0 0;
  text-align:center;
  color:var(--muted);
  line-height:1.6;
}
.duration-line{
  display:flex;
  align-items:baseline;
  justify-content:center;
  gap:9px;
  flex-wrap:wrap;
  margin-top:14px;
}
.duration-line strong{
  font-size:clamp(34px,5vw,58px);
  letter-spacing:-.04em;
}
.duration-line span{
  color:var(--muted);
  font-weight:800;
  margin-right:8px;
}
@media (max-width:760px){
  .form-grid.two{grid-template-columns:1fr}
  .metric-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media (max-width:460px){
  .metric-grid{grid-template-columns:1fr}
}


.checkbox-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
  margin-top:18px;
}
.check-card{
  border:1px solid var(--line);
  background:var(--surface-solid);
  border-radius:16px;
  padding:15px 16px;
  display:flex;
  gap:12px;
  align-items:flex-start;
  cursor:pointer;
}
.check-card input{margin-top:4px;accent-color:var(--primary)}
.check-card span{display:grid;gap:3px}
.check-card small{color:var(--muted)}

.result-actions{
  display:flex;
  justify-content:center;
  margin-top:18px;
}

.favorites-empty{
  margin-top:24px;
  border:1px dashed var(--line);
  border-radius:18px;
  padding:28px;
  text-align:center;
  color:var(--muted);
}
.favorites-list{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
  margin-top:24px;
}
.favorite-card{
  border:1px solid var(--line);
  background:var(--surface-solid);
  border-radius:18px;
  padding:18px;
  display:grid;
  gap:13px;
  box-shadow:0 10px 26px rgba(15,23,42,.05);
}
.favorite-head{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:flex-start;
}
.favorite-head strong{
  font-size:17px;
  overflow-wrap:anywhere;
}
.favorite-date{
  color:var(--muted);
  font-size:13px;
}
.favorite-count{
  font-size:28px;
  font-weight:900;
  letter-spacing:-.04em;
}
.favorite-count.future{color:var(--primary)}
.favorite-count.past{color:var(--danger)}
.favorite-count.today{color:var(--positive)}
.favorite-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.mini-button{
  border:1px solid var(--line);
  background:var(--surface-alt);
  border-radius:10px;
  padding:8px 10px;
  cursor:pointer;
  font-size:12px;
  font-weight:800;
}
.mini-button.danger{color:var(--danger)}
.toast{
  position:fixed;
  right:22px;
  bottom:22px;
  z-index:120;
  background:var(--surface-solid);
  border:1px solid var(--line);
  box-shadow:var(--shadow);
  border-radius:14px;
  padding:12px 16px;
  color:var(--text);
  opacity:0;
  transform:translateY(12px);
  pointer-events:none;
  transition:.2s ease;
}
.toast.show{opacity:1;transform:none}

@media(max-width:760px){
  .checkbox-grid,.favorites-list{grid-template-columns:1fr}
}


.compact-button{padding:10px 13px}

.event-overview-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:14px;
}
.event-overview-card{
  border:1px solid var(--line);
  background:var(--surface);
  border-radius:20px;
  padding:18px;
  display:grid;
  gap:10px;
  cursor:pointer;
  box-shadow:0 10px 28px rgba(15,23,42,.05);
  transition:.2s ease;
}
.event-overview-card:hover{transform:translateY(-3px);box-shadow:var(--shadow)}
.event-overview-card .event-top{
  display:flex;
  justify-content:space-between;
  gap:12px;
}
.event-category{
  display:inline-flex;
  width:max-content;
  border-radius:999px;
  padding:5px 9px;
  font-size:11px;
  font-weight:800;
  background:var(--surface-alt);
  color:var(--muted);
}
.event-overview-card .days-large{
  font-size:38px;
  font-weight:900;
  letter-spacing:-.045em;
}
.event-overview-card .days-large.future{color:var(--primary)}
.event-overview-card .days-large.past{color:var(--danger)}
.event-overview-card .days-large.today{color:var(--positive)}
.event-progress{
  height:8px;
  background:var(--surface-alt);
  border-radius:999px;
  overflow:hidden;
}
.event-progress>span{
  display:block;
  height:100%;
  background:linear-gradient(90deg,var(--primary),var(--primary-2));
  border-radius:999px;
}
.favorite-meta{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  color:var(--muted);
  font-size:12px;
}
.favorite-note{
  color:var(--muted);
  line-height:1.45;
  font-size:13px;
}

.timeline-shell{
  position:relative;
  margin-top:26px;
  padding-left:28px;
}
.timeline-shell::before{
  content:"";
  position:absolute;
  left:8px;
  top:4px;
  bottom:4px;
  width:2px;
  background:linear-gradient(var(--primary),var(--line));
}
.timeline-item{
  position:relative;
  padding:0 0 24px 12px;
}
.timeline-item::before{
  content:"";
  position:absolute;
  left:-25px;
  top:5px;
  width:12px;height:12px;
  border-radius:50%;
  background:var(--primary);
  box-shadow:0 0 0 5px rgba(37,99,235,.12);
}
.timeline-item.past::before{background:var(--danger);box-shadow:0 0 0 5px rgba(220,38,38,.10)}
.timeline-item.today::before{background:var(--positive);box-shadow:0 0 0 5px rgba(22,163,74,.12)}
.timeline-card{
  border:1px solid var(--line);
  background:var(--surface-solid);
  border-radius:16px;
  padding:16px;
  display:grid;
  gap:7px;
}
.timeline-card .timeline-date{font-size:12px;color:var(--muted);font-weight:700}
.timeline-card .timeline-title{font-size:17px;font-weight:850}
.timeline-card .timeline-distance{font-weight:900}
.timeline-card .timeline-note{font-size:13px;color:var(--muted)}

@media(max-width:980px){
  .event-overview-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:620px){
  .event-overview-grid{grid-template-columns:1fr}
}

.calendar-toolbar{display:flex;justify-content:space-between;align-items:center;gap:16px;margin-bottom:22px}
.calendar-toolbar h2{margin:7px 0 0}
.calendar-actions{display:flex;gap:8px}
.calendar-weekdays,.calendar-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:7px}
.calendar-weekdays{margin-bottom:7px}
.calendar-weekdays span{text-align:center;font-size:11px;font-weight:850;color:var(--muted);padding:7px}
.calendar-day{
  min-height:112px;border:1px solid var(--line);background:var(--surface-solid);border-radius:15px;
  padding:9px;display:flex;flex-direction:column;gap:5px;overflow:hidden
}
.calendar-day.outside{opacity:.38}
.calendar-day.today{border-color:rgba(37,99,235,.55);box-shadow:inset 0 0 0 1px rgba(37,99,235,.22)}
.calendar-day-number{width:27px;height:27px;display:grid;place-items:center;border-radius:9px;font-size:12px;font-weight:850}
.calendar-day.today .calendar-day-number{background:var(--primary);color:white}
.calendar-event{
  border:0;text-align:left;width:100%;border-radius:8px;padding:5px 7px;cursor:pointer;
  background:rgba(37,99,235,.10);color:var(--text);font-size:10px;font-weight:750;overflow:hidden;text-overflow:ellipsis;white-space:nowrap
}
.calendar-event.recurring{background:rgba(79,70,229,.12)}
.calendar-event:hover{outline:1px solid rgba(37,99,235,.28)}
.calendar-more{font-size:10px;color:var(--muted);padding-left:4px}
.calendar-legend{display:flex;gap:18px;flex-wrap:wrap;margin-top:18px;color:var(--muted);font-size:11px}
.calendar-legend span{display:flex;align-items:center;gap:6px}
.legend-dot{width:9px;height:9px;border-radius:50%;background:var(--primary);display:inline-block}
.legend-dot.recurring{background:var(--primary-2)}
.legend-dot.today{background:var(--positive)}
@media(max-width:760px){
 .calendar-day{min-height:78px;padding:5px;border-radius:10px}
 .calendar-event{font-size:0;padding:0;width:7px;height:7px;border-radius:50%;display:inline-block}
 .calendar-weekdays,.calendar-grid{gap:3px}
 .calendar-toolbar{align-items:flex-start;flex-direction:column}
}


/* v0.5.1 UI hotfix */
html, body {
  min-height: 100%;
  overflow-x: hidden;
}

.app-shell {
  min-height: 100dvh;
}

/* Today is shown with the same green indicator used by the legend. */
.calendar-day.today {
  position: relative;
  border-color: rgba(22,163,74,.48);
  box-shadow: inset 0 0 0 1px rgba(22,163,74,.16);
}

.calendar-day.today::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--positive);
  box-shadow: 0 0 0 4px rgba(22,163,74,.12);
}

.calendar-day.today .calendar-day-number {
  background: var(--positive);
  color: white;
}

/* On pages whose content fits, do not create a tiny extra scroll range
   because of viewport rounding / sticky layout interaction. */
@supports (height: 100dvh) {
  .sidebar {
    height: 100dvh;
  }
}

.milestone-summary{margin-top:24px;padding:24px;border:1px solid var(--line);border-radius:20px;background:linear-gradient(145deg,rgba(37,99,235,.08),rgba(79,70,229,.03))}
.milestone-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:13px;margin-top:18px}
.milestone-card{border:1px solid var(--line);background:var(--surface-solid);border-radius:18px;padding:17px;display:grid;gap:8px}
.milestone-card.reached{opacity:.72}
.milestone-card.next{border-color:rgba(37,99,235,.38);box-shadow:0 12px 30px rgba(37,99,235,.10)}
.milestone-value{font-size:28px;font-weight:900;letter-spacing:-.04em;color:var(--primary)}
.milestone-card.reached .milestone-value{color:var(--positive)}
.milestone-status{font-size:12px;font-weight:800}
.milestone-date{font-size:12px;color:var(--muted);line-height:1.4}
@media(max-width:900px){.milestone-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:560px){.milestone-grid{grid-template-columns:1fr}}

.tool-grid{grid-template-columns:repeat(auto-fit,minmax(190px,1fr));}

.events-toolbar{
  display:grid;
  grid-template-columns:1.4fr .8fr .8fr;
  gap:10px;
  margin-top:24px;
}
.event-search-wrap{
  display:flex;
  align-items:center;
  gap:8px;
  border:1px solid var(--line);
  background:var(--surface-solid);
  border-radius:13px;
  padding:0 12px;
}
.event-search-wrap span{color:var(--muted);font-size:18px}
.event-search-wrap input{
  border:0!important;
  background:transparent!important;
  padding-left:0!important;
  outline:0!important;
  box-shadow:none!important;
}
.settings-divider{
  height:1px;
  background:var(--line);
  margin:30px 0;
}
.backup-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
  margin-top:18px;
}
.file-button{
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
}
.file-button input{display:none}
.danger-outline{color:var(--danger);border-color:rgba(220,38,38,.22)}
.backup-meta{color:var(--muted);font-size:12px;margin-top:12px}
.event-stats{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:14px;
}
.event-stat-pill{
  border:1px solid var(--line);
  background:var(--surface-alt);
  border-radius:999px;
  padding:6px 10px;
  font-size:11px;
  color:var(--muted);
  font-weight:800;
}
@media(max-width:820px){
  .events-toolbar{grid-template-columns:1fr}
  .backup-grid{grid-template-columns:1fr}
}

.event-detail-modal{width:min(720px,100%)}
.event-detail-meta{display:flex;gap:8px;flex-wrap:wrap;margin:10px 0 4px}
.smart-metric-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
  margin-top:22px;
}
.smart-metric-grid>div{
  border:1px solid var(--line);
  background:var(--surface-alt);
  border-radius:16px;
  padding:16px;
  display:grid;
  gap:6px;
}
.smart-metric-grid span{font-size:12px;color:var(--muted);font-weight:800}
.smart-metric-grid strong{font-size:20px;letter-spacing:-.02em}
.smart-note{
  margin-top:16px;
  border:1px solid var(--line);
  background:var(--surface-alt);
  border-radius:14px;
  padding:14px;
  color:var(--muted);
  line-height:1.55;
}
.event-detail-actions{margin-top:20px}
.smart-hint{
  margin-top:8px;
  color:var(--muted);
  font-size:12px;
}
@media(max-width:620px){
  .smart-metric-grid{grid-template-columns:1fr}
}

.timeline-card{cursor:pointer;transition:.18s ease}.timeline-card:hover{transform:translateY(-2px);box-shadow:0 10px 24px rgba(15,23,42,.07)}

.smart-today-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
}
.smart-today-card{
  border:1px solid var(--line);
  background:var(--surface-solid);
  border-radius:22px;
  padding:20px;
  min-height:165px;
  display:flex;
  flex-direction:column;
  gap:9px;
  box-shadow:0 10px 28px rgba(15,23,42,.05);
}
.smart-today-card.hero-smart{
  background:linear-gradient(145deg,rgba(37,99,235,.12),rgba(79,70,229,.04));
  border-color:rgba(37,99,235,.20);
  cursor:pointer;
}
.smart-today-card.hero-smart:hover{box-shadow:var(--shadow)}
.smart-card-label{font-size:10px;letter-spacing:.12em;font-weight:900;color:var(--muted)}
.smart-today-card>strong{font-size:18px}
.smart-card-value{font-size:42px;font-weight:950;letter-spacing:-.05em;color:var(--primary);line-height:1}
.smart-card-value.small-value{font-size:27px}
.smart-today-card small{color:var(--muted);line-height:1.45}
.smart-list{display:grid;gap:6px;margin-top:2px}
.smart-list-item{
  display:flex;justify-content:space-between;gap:12px;
  border-top:1px solid var(--line);padding-top:7px;
  font-size:12px;
}
.smart-list-item span:last-child{color:var(--muted);white-space:nowrap}
.smart-insight{
  margin-top:14px;
  border:1px solid rgba(79,70,229,.18);
  background:linear-gradient(135deg,rgba(79,70,229,.08),rgba(37,99,235,.04));
  border-radius:18px;
  padding:16px 18px;
  display:flex;
  gap:13px;
  align-items:flex-start;
}
.smart-insight-icon{font-size:22px;color:var(--primary-2)}
.smart-insight p{margin:4px 0 0;color:var(--muted);line-height:1.5}
@media(max-width:760px){.smart-today-grid{grid-template-columns:1fr}}

.backup-grid{grid-template-columns:repeat(auto-fit,minmax(170px,1fr))}
.release-badge{
  display:inline-flex;align-items:center;gap:7px;border-radius:999px;padding:6px 10px;
  background:rgba(22,163,74,.10);color:var(--positive);font-size:11px;font-weight:900;
  border:1px solid rgba(22,163,74,.16)
}
.empty-action{margin-top:12px}

.custom-milestone-row{
  display:grid;grid-template-columns:1fr auto;gap:10px;align-items:end;margin-top:18px
}
.custom-milestone-row label{display:grid;gap:7px}
.custom-milestone-chips{display:flex;gap:7px;flex-wrap:wrap;margin-top:10px}
.custom-chip{
  border:1px solid var(--line);background:var(--surface-alt);border-radius:999px;
  padding:6px 9px;font-size:11px;font-weight:800;display:flex;gap:7px;align-items:center
}
.custom-chip button{border:0;background:transparent;cursor:pointer;color:var(--danger);font-weight:900}
.recurrence-grid{margin-top:18px}
@media(max-width:560px){.custom-milestone-row{grid-template-columns:1fr}}

/* ============================================================
   v1.2 – Windows 11 / Fluent refinement
   ============================================================ */
:root{
  --win-bg:#f3f3f3;
  --win-card:rgba(255,255,255,.72);
  --win-stroke:rgba(0,0,0,.075);
}
html[data-theme="dark"]{
  --win-bg:#202020;
  --win-card:rgba(44,44,44,.76);
  --win-stroke:rgba(255,255,255,.075);
}
body{
  font-family:"Segoe UI Variable","Segoe UI",Inter,Roboto,Arial,sans-serif;
  background:
    radial-gradient(circle at 85% 7%,rgba(0,120,212,.11),transparent 25%),
    radial-gradient(circle at 18% 92%,rgba(96,205,255,.09),transparent 26%),
    var(--bg);
}
.sidebar,.topbar .icon-button,.hero-card,.panel,.result-card,.tool-card,.smart-today-card,.event-overview-card{
  backdrop-filter:blur(28px) saturate(135%);
  -webkit-backdrop-filter:blur(28px) saturate(135%);
}
.sidebar{
  border-right:1px solid var(--win-stroke);
  box-shadow:1px 0 0 rgba(255,255,255,.28);
}
.nav-item{border-radius:8px}
.nav-item.active{
  position:relative;
  background:rgba(37,99,235,.11);
  color:var(--primary);
  box-shadow:none;
}
.nav-item.active::before{
  content:"";
  position:absolute;
  left:2px;top:8px;bottom:8px;width:3px;border-radius:3px;background:var(--primary);
}
.icon-button,.secondary-button,input[type="date"],input[type="text"],input[type="number"],select{
  border-radius:8px;
}
.primary-button{border-radius:8px}
.hero-card,.panel,.result-card{border-radius:16px}
.tool-card,.smart-today-card,.event-overview-card,.favorite-card{border-radius:12px}
.tool-card:hover,.event-overview-card:hover{transform:translateY(-2px)}
.topbar{border-bottom:1px solid transparent}

/* date arithmetic */
.date-operation{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
  margin-top:18px;
}
.choice-card{
  border:1px solid var(--line);
  background:var(--surface-solid);
  border-radius:10px;
  padding:15px 16px;
  display:flex;
  gap:11px;
  align-items:flex-start;
  cursor:pointer;
}
.choice-card input{margin-top:4px;accent-color:var(--primary)}
.choice-card span{display:grid;gap:3px}
.choice-card small{color:var(--muted)}
.date-result-large{
  text-align:center;
  font-size:clamp(36px,7vw,70px);
  font-weight:900;
  letter-spacing:-.045em;
  color:var(--primary);
  margin-top:10px;
}
.date-result-weekday{text-align:center;color:var(--muted);font-weight:800;margin-top:4px}

/* holidays */
.holiday-options{margin-top:16px}
.holiday-hint{
  border:1px solid var(--line);
  background:var(--surface-alt);
  border-radius:10px;
  padding:13px 14px;
  display:grid;
  gap:4px;
}
.holiday-hint small{color:var(--muted);line-height:1.45}
.holiday-result{
  margin-top:18px;
  border-top:1px solid var(--line);
  padding-top:16px;
}
#workHolidayList{display:grid;gap:7px;margin-top:10px}
.holiday-row{
  display:flex;justify-content:space-between;gap:12px;
  padding:9px 11px;border:1px solid var(--line);background:var(--surface-solid);border-radius:9px;
  font-size:12px;
}
.holiday-row span:last-child{color:var(--muted);white-space:nowrap}

@media(max-width:620px){
  .date-operation{grid-template-columns:1fr}
}

/* ============================================================
   v1.2.1 – Fluent UI Overhaul
   ============================================================ */
:root{
  --bg:#eef4fb;
  --surface:rgba(255,255,255,.66);
  --surface-solid:#ffffff;
  --surface-alt:#f7f9fc;
  --text:#1f1f1f;
  --muted:#6f7480;
  --line:rgba(0,0,0,.075);
  --primary:#0f6cbd;
  --primary-2:#115ea3;
  --positive:#107c10;
  --danger:#c42b1c;
  --warning:#f7630c;
  --shadow:0 4px 14px rgba(0,0,0,.08);
  --radius-xl:14px;
  --radius-lg:12px;
  --radius-md:8px;
}
html[data-theme="dark"]{
  --bg:#1e1e1e;
  --surface:rgba(45,45,45,.72);
  --surface-solid:#2b2b2b;
  --surface-alt:#323232;
  --text:#f5f5f5;
  --muted:#b7b7b7;
  --line:rgba(255,255,255,.075);
  --shadow:0 4px 14px rgba(0,0,0,.28);
}

body{
  background:
    radial-gradient(circle at 95% 7%,rgba(15,108,189,.13),transparent 24%),
    linear-gradient(180deg,#f8fbff 0%,var(--bg) 100%);
}
html[data-theme="dark"] body{
  background:
    radial-gradient(circle at 95% 7%,rgba(15,108,189,.13),transparent 24%),
    linear-gradient(180deg,#202020 0%,var(--bg) 100%);
}

.app-shell{
  grid-template-columns:218px 1fr;
  max-width:1500px;
  margin:18px auto;
  min-height:calc(100dvh - 36px);
  border:1px solid rgba(0,0,0,.08);
  border-radius:12px;
  overflow:hidden;
  background:rgba(255,255,255,.34);
  box-shadow:0 16px 40px rgba(0,0,0,.10);
}
html[data-theme="dark"] .app-shell{
  border-color:rgba(255,255,255,.08);
  background:rgba(20,20,20,.38);
}

.sidebar{
  position:relative;
  height:auto;
  min-height:calc(100dvh - 36px);
  padding:12px 10px;
  background:rgba(248,250,253,.78);
  border-right:1px solid var(--line);
  backdrop-filter:blur(32px) saturate(140%);
  box-shadow:none;
}
html[data-theme="dark"] .sidebar{
  background:rgba(36,36,36,.82);
}
.brand{
  padding:4px 8px 14px;
  gap:10px;
}
.brand-mark{
  width:30px;height:30px;border-radius:7px;
  box-shadow:none;
}
.brand-mark svg{width:17px;height:17px}
.brand strong{font-size:13px}
.brand span{font-size:10px}

.nav-list{gap:2px}
.nav-item{
  padding:8px 10px;
  border-radius:6px;
  font-size:13px;
  min-height:36px;
}
.nav-item:hover{
  background:rgba(0,0,0,.045);
  transform:none;
}
html[data-theme="dark"] .nav-item:hover{background:rgba(255,255,255,.05)}
.nav-item.active{
  background:rgba(15,108,189,.10);
  color:var(--text);
  font-weight:650;
}
.nav-item.active::before{
  left:0;top:9px;bottom:9px;width:3px;
}
.nav-item span:first-child{
  font-size:14px;width:18px;color:var(--primary);
}
.about-button{
  border-radius:6px;
  padding:7px 10px;
  background:transparent;
  font-size:11px;
}

.main{
  padding:0 22px 30px;
  background:rgba(255,255,255,.18);
}
html[data-theme="dark"] .main{background:rgba(0,0,0,.08)}

.topbar{
  height:58px;
  min-height:58px;
  margin:0 -22px 18px;
  padding:0 18px;
  border-bottom:1px solid var(--line);
  background:rgba(255,255,255,.72);
  backdrop-filter:blur(28px) saturate(145%);
}
html[data-theme="dark"] .topbar{
  background:rgba(34,34,34,.78);
}
.topbar-title{display:flex;align-items:center;gap:10px}
.topbar-app-icon{
  width:28px;height:28px;border-radius:6px;display:grid;place-items:center;
  background:rgba(15,108,189,.10);color:var(--primary);font-size:14px;font-weight:800;
}
.topbar h1{
  font-size:16px;
  letter-spacing:-.01em;
  margin:0;
  font-weight:650;
}
.topbar .eyebrow{display:none}
.top-actions{gap:4px}
.icon-button{
  width:34px;height:34px;border-radius:6px;
  box-shadow:none;
  background:transparent;
}
.icon-button:hover{background:rgba(0,0,0,.045)}
html[data-theme="dark"] .icon-button:hover{background:rgba(255,255,255,.05)}

.fluent-greeting{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  margin-bottom:14px;
}
.fluent-greeting>div:first-child{display:grid;gap:2px}
.fluent-greeting-kicker{font-size:11px;color:var(--muted);font-weight:600}
.fluent-greeting strong{font-size:18px}
.fluent-greeting-badge{
  border:1px solid rgba(16,124,16,.14);
  background:rgba(16,124,16,.08);
  color:var(--positive);
  border-radius:999px;
  padding:5px 9px;
  font-size:10px;
  font-weight:700;
}

.hero-grid{
  grid-template-columns:1fr 1.3fr;
  gap:12px;
}
.hero-card,.panel,.result-card{
  background:var(--surface);
  border:1px solid var(--line);
  box-shadow:0 2px 8px rgba(0,0,0,.045);
  border-radius:12px;
}
.hero-card{
  min-height:180px;
  padding:18px;
}
.hero-card h2{font-size:25px}
.hero-orb{
  flex-basis:92px;
  width:92px;
  border-radius:50%;
}
.hero-orb span{font-size:31px}
.quick-calc{min-width:210px}

.section-block{margin-top:22px}
.section-heading{margin-bottom:10px}
.section-heading h2,.panel h2{
  font-size:18px;
  margin:4px 0 6px;
}
.eyebrow{
  font-size:9px;
  letter-spacing:.12em;
}
.muted{font-size:13px}

.smart-today-grid{
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:10px;
}
.smart-today-card{
  min-height:145px;
  padding:14px;
  border-radius:10px;
  box-shadow:0 2px 6px rgba(0,0,0,.035);
}
.smart-card-label{font-size:9px}
.smart-today-card>strong{font-size:15px}
.smart-card-value{font-size:30px}
.smart-card-value.small-value{font-size:22px}
.smart-list-item{font-size:11px}

.smart-insight{
  border-radius:10px;
  padding:12px 14px;
}

.event-overview-grid{
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
}
.event-overview-card{
  border-radius:10px;
  padding:14px;
}
.event-overview-card .days-large{font-size:28px}

.tool-grid{
  gap:10px;
  grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
}
.tool-card{
  min-height:128px;
  border-radius:10px;
  padding:16px;
  box-shadow:0 2px 6px rgba(0,0,0,.035);
}
.tool-icon{
  width:34px;height:34px;border-radius:7px;margin-bottom:5px;
  background:rgba(15,108,189,.08);
}
.tool-card strong{font-size:14px}
.tool-card small{font-size:11px}

.panel{padding:18px;min-height:180px}
.form-grid{gap:12px;margin-top:16px}
.form-grid label>span{font-size:11px}
input[type="date"],input[type="text"],input[type="number"],select{
  min-height:34px;
  padding:7px 9px;
  background:rgba(255,255,255,.78);
}
html[data-theme="dark"] input[type="date"],
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] select{
  background:rgba(50,50,50,.9);
}
.primary-button,.secondary-button{
  min-height:34px;
  padding:7px 12px;
  font-size:12px;
}
.primary-button{
  background:var(--primary);
  box-shadow:none;
}
.primary-button:hover{
  background:var(--primary-2);
  transform:none;
  box-shadow:none;
}
.secondary-button{
  background:rgba(255,255,255,.7);
}
html[data-theme="dark"] .secondary-button{
  background:rgba(255,255,255,.04);
}

.calc-result{
  border-radius:10px;
  padding:18px;
}
.metric-grid{
  gap:9px;
  margin-top:16px;
}
.metric-grid>div{
  border-radius:9px;
  padding:12px;
}
.metric-grid span{font-size:10px}
.metric-grid strong{font-size:15px}

.favorite-card,.timeline-card,.milestone-card{
  border-radius:10px;
  box-shadow:0 2px 6px rgba(0,0,0,.035);
}
.calendar-day{
  border-radius:8px;
  min-height:96px;
}
.calendar-event{border-radius:5px}

.modal{
  border-radius:12px;
  box-shadow:0 18px 48px rgba(0,0,0,.20);
}
.modal-close{border-radius:6px}

@media(max-width:1180px){
  .smart-today-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:820px){
  .app-shell{
    margin:0;
    min-height:100dvh;
    border-radius:0;
    border:0;
  }
  .sidebar{min-height:100dvh}
  .main{padding:0 16px 24px}
  .topbar{margin:0 -16px 16px}
}

/* v1.2.3 – Dark-mode number input + overflow fix */
html[data-theme="dark"] input[type="number"]{
  color:var(--text) !important;
  -webkit-text-fill-color:var(--text);
  color-scheme:dark;
}
html[data-theme="dark"] input[type="number"]::-webkit-inner-spin-button,
html[data-theme="dark"] input[type="number"]::-webkit-outer-spin-button{
  opacity:1;
  filter:invert(1);
}
input[type="number"]{
  box-sizing:border-box;
  width:100%;
  max-width:100%;
  min-width:0;
}
.form-grid,
.form-grid > label,
.panel,
.view,
.main{
  min-width:0;
}
body{
  overflow-x:hidden;
}


/* ============================================================
   v1.2.4 – Mobile / narrow-window navigation hotfix
   ============================================================ */
@media (max-width: 820px) {
  html,
  body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    overflow-x: hidden;
  }

  .app-shell {
    display: block !important;
    width: 100%;
    max-width: none;
    min-height: 100dvh;
    margin: 0 !important;
    border: 0;
    border-radius: 0;
    overflow: visible;
  }

  .sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(310px, 86vw);
    height: 100dvh !important;
    min-height: 0 !important;
    margin: 0;
    overflow-y: auto;
    overflow-x: hidden;
    transform: translateX(-105%);
    transition: transform .22s ease;
    z-index: 1000;
    box-shadow: 18px 0 42px rgba(0,0,0,.22);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    width: 100%;
    min-height: 100dvh;
    margin: 0;
    padding: 0 16px 24px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    margin: 0 -16px 16px;
  }

  .mobile-only {
    display: inline-grid !important;
    place-items: center;
  }
}

@media (max-width: 480px) {
  .sidebar {
    width: min(300px, 90vw);
  }
}
