/* khatma: plan, today's portion, progress */
.kh { padding-top: 26px; padding-bottom: 30px; }
.khHero { text-align: center; margin-bottom: 18px; }
.khHero h1 { margin: 0; font-size: clamp(1.6rem, 4.5vw, 2.3rem); }
.khHero p { margin: 4px auto 10px; color: var(--muted); max-width: 620px; }
.khSaved { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 600; color: var(--primary); background: var(--primary-soft); border-radius: 99px; padding: .25rem .8rem; }
.khSaved svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }

.khCard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(16px, 3vw, 24px); box-shadow: var(--shadow-sm); margin-bottom: 14px; }
.khCard h2 { margin: 0 0 12px; font-size: 1.25rem; }
.khCard h3 { margin: 0 0 10px; font-size: 1.02rem; }
#setup { max-width: 760px; margin-inline: auto; }
.khStep { margin-bottom: 18px; }
.khLabel { display: block; margin-bottom: 8px; font-size: .98rem; }
.khLabel small { color: var(--muted); font-weight: 500; }
.khPresets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.khPresets button { display: grid; gap: 0; text-align: center; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 14px; padding: .65rem .4rem; font: inherit; cursor: pointer; transition: border-color .15s, background-color .15s; }
.khPresets button b { font-size: 1.02rem; }
.khPresets button small { color: var(--muted); font-size: .76rem; }
.khPresets button.on { border-color: var(--primary); background: var(--primary-soft); }
.khCustom { display: flex; align-items: end; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.khCustom label, .khField { display: grid; gap: 4px; font-size: .88rem; font-weight: 600; color: var(--muted); }
.khCustom input, .khField input, .khRadio input[type="number"], .khLog input { border: 1px solid var(--line); border-radius: 12px; padding: .5rem .7rem; font: inherit; font-size: 1rem; width: 9em; background: var(--surface); color: var(--ink); }
.khCustom span { color: var(--muted); padding-bottom: .6rem; }
.khRadio { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-weight: 500; flex-wrap: wrap; }
.khRadio input[type="number"] { width: 6em; padding: .3rem .5rem; }
.khDays { display: flex; flex-wrap: wrap; gap: 6px; }
.khDays button { border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 99px; padding: .3rem .8rem; font: inherit; font-size: .88rem; cursor: pointer; }
.khDays button.on { border-color: var(--rose); background: var(--rose-soft); color: var(--rose); text-decoration: line-through; }
.khPreview { background: var(--gold-soft); border-radius: 14px; padding: 12px 14px; margin: 0 0 14px; font-weight: 600; line-height: 1.9; }
.khGo { width: 100%; justify-content: center; padding: .8rem; font-size: 1.05rem; }

.khGrid { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 14px; }
.khGrid .khCard { margin: 0; }
.khRingCard { display: grid; place-items: center; text-align: center; }
.khRing { position: relative; width: 170px; height: 170px; }
.khRing svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.khRing circle { fill: none; stroke-width: 10; }
.khRing .bg { stroke: var(--primary-soft); }
.khRing .fg { stroke: var(--primary); stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset .8s ease; }
.khRing > div { position: absolute; inset: 0; display: grid; place-content: center; }
.khRing b { font-size: 2.2rem; line-height: 1; color: var(--primary); }
.khRing small { color: var(--muted); font-size: .82rem; }
.khDone { margin: 8px 0 0; color: var(--muted); font-size: .9rem; }

.khToday h2 { margin: 0; font-size: .95rem; color: var(--muted); font-weight: 600; }
.khToday .big { font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 800; margin: 2px 0; color: var(--ink); }
.khToday .range { color: var(--muted); margin: 0 0 10px; }
.khToday .bar { height: 8px; border-radius: 99px; background: var(--primary-soft); overflow: hidden; margin: 6px 0 4px; }
.khToday .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary-2), var(--primary)); border-radius: 99px; transition: width .5s ease; }
.khToday .sub { font-size: .86rem; color: var(--muted); margin: 0 0 12px; }
.khToday .row { display: flex; flex-wrap: wrap; gap: 8px; }
.khStatus { display: inline-block; border-radius: 99px; padding: .2rem .8rem; font-size: .84rem; font-weight: 700; margin-bottom: 10px; }
.khStatus.ok { background: var(--primary-soft); color: var(--primary); }
.khStatus.late { background: var(--rose-soft); color: var(--rose); }
.khStatus.ahead { background: var(--gold-soft); color: #8a5a0f; }
.khFinished { text-align: center; }
.khFinished .big { color: var(--primary); }

.khStats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.khStats div { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px; text-align: center; }
.khStats b { display: block; font-size: 1.25rem; color: var(--ink); }
.khStats small { color: var(--muted); font-size: .78rem; }

.khCal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.khCal .h { text-align: center; font-size: .72rem; color: var(--muted); font-weight: 600; }
.khCal span { aspect-ratio: 1; border-radius: 10px; display: grid; place-items: center; font-size: .78rem; font-weight: 600; background: var(--bg); color: var(--muted); border: 1px solid transparent; }
.khCal .d { background: var(--primary); color: #fff; }
.khCal .m { background: var(--rose-soft); color: var(--rose); }
.khCal .r { background: repeating-linear-gradient(45deg, var(--bg), var(--bg) 4px, var(--line) 4px, var(--line) 6px); }
.khCal .t { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft); }
.khCal .x { visibility: hidden; }
.khLegend { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin: 10px 0 0; font-size: .78rem; color: var(--muted); }
.khLegend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: -1px; margin-inline-end: 3px; }
.khLegend .d { background: var(--primary); } .khLegend .m { background: var(--rose-soft); border: 1px solid var(--rose); } .khLegend .r { background: var(--line); } .khLegend .t { border: 2px solid var(--gold); }

.khLog form { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; }
.khLog label { display: grid; gap: 4px; font-size: .9rem; font-weight: 600; color: var(--muted); }
.khActions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 10px 0 18px; }
.khActions .pill { cursor: pointer; font: inherit; font-weight: 600; font-size: .9rem; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 99px; padding: .5rem 1rem; display: inline-flex; align-items: center; gap: 6px; }
.khActions .pill svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.khActions .pill.danger { color: var(--rose); }
.khHist { margin: 0; padding-inline-start: 1.2em; }
.khHist li { margin: 4px 0; }
.khHist small { color: var(--muted); }

.khDlg { border: 0; border-radius: 20px; padding: 20px; width: min(440px, calc(100vw - 24px)); box-shadow: 0 30px 80px rgba(0, 0, 0, .3); }
.khDlg::backdrop { background: rgba(10, 30, 25, .45); }
.khDlg h2 { margin: 0 0 12px; font-size: 1.1rem; }
.khDlg .khField { margin-bottom: 12px; }
.khDlg .khField input { width: 100%; }
.khCol { display: grid; gap: 8px; margin-top: 10px; }
.khCol .btn { justify-content: center; text-decoration: none; }
.khDlg > .btn.ghost { width: 100%; justify-content: center; margin-top: 10px; }
.khNote { color: var(--muted); font-size: .84rem; margin: 10px 0 0; }

@media (max-width: 760px) {
  .khGrid { grid-template-columns: 1fr; }
  .khStats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .khPresets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
