/* Deluge date helper */
.dates [hidden] { display: none !important; }
.dhead { padding: 64px 0 28px; }
.dhead h1 { max-width: none; }
.dhead .private { margin-top: 10px; font-size: .95rem; }
.dhead .private b { color: var(--green); font-weight: 500; }
@media (max-width: 700px) { .dhead { padding: 44px 0 20px; } }

/* Mode switch */
.modes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 20px; }
@media (max-width: 860px) { .modes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.modes button { text-align: left; font: inherit; color: var(--text); padding: 12px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; transition: border-color .2s, background .2s; min-width: 0; }
.modes button:hover { border-color: rgba(91,207,230,.5); }
.modes button[aria-selected="true"] { border-color: var(--cyan); background: rgba(91,207,230,.10); }
.modes b { display: block; font-weight: 500; font-size: .96rem; }
.modes small { display: block; margin-top: 2px; color: var(--muted); font-size: .82rem; line-height: 1.4; }
.modes code { font-family: var(--mono); font-size: .92em; }
@media (max-width: 420px) { .modes small { display: none; } .modes button { padding: 11px 12px; } }

/* Inputs and outputs */
.dgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 28px; align-items: start; }
@media (max-width: 900px) { .dgrid { grid-template-columns: minmax(0, 1fr); } }
.ins, .outs { min-width: 0; }
.field + .field, .row2 + .field, .field + .row3, .row3 + .work, .row2 + .work, .field + .work, .field + details { margin-top: 20px; }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.row3 { display: grid; grid-template-columns: auto minmax(0, .7fr) minmax(0, 1fr); gap: 14px; align-items: end; margin-top: 20px; }
@media (max-width: 560px) { .row2 { grid-template-columns: minmax(0, 1fr); } .row3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .row3 > :first-child { grid-column: 1 / -1; } }
.dates input[type="datetime-local"], .dates input[type="date"] {
  display: block; width: 100%; min-width: 0; margin-top: 8px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: #0F161E;
  color: var(--text); font: inherit; font-family: var(--mono); font-size: .95rem; transition: border-color .2s, box-shadow .2s;
}
.dates input[type="datetime-local"]::-webkit-calendar-picker-indicator, .dates input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .7; }
#f-pat, #r-in { font-family: var(--mono); }
.with-btn { display: flex; gap: 8px; align-items: stretch; }
.with-btn input { flex: 1; }
.with-btn .btn { margin-top: 8px; flex: none; }
.dates .presets { margin: 12px 0 0; gap: 6px; }
.dates .chip { font-size: .84rem; padding: 6px 10px; }
.dates label .hint, .dates .lbl .hint { display: inline; margin: 0 0 0 4px; }
.op-row { margin-top: 8px !important; flex-wrap: nowrap !important; }
.op-row .chip { padding: 10px 12px; }

/* Pattern letters */
.letters { margin-top: 20px; border: 1px solid var(--line); border-radius: 8px; padding: 0 14px; }
.letters summary { cursor: pointer; padding: 11px 0; font-size: .92rem; font-weight: 500; }
.letters[open] summary { border-bottom: 1px solid var(--line); }
.ltable { width: 100%; border-collapse: collapse; margin: 8px 0 4px; font-size: .86rem; }
.ltable th, .ltable td { text-align: left; padding: 5px 8px 5px 0; vertical-align: top; border-bottom: 1px solid var(--line); }
.ltable thead th { color: var(--muted); font-weight: 500; font-size: .8rem; }
.ltable tbody th { width: 3.2em; font-weight: 400; }
.ltable td:last-child { color: var(--muted); }
.ltable code, .letters .hint code { font-family: var(--mono); font-size: .92em; color: #CFF3FB; }
.letters .hint { margin: 8px 0 14px; }

/* Result */
.outs > .lbl { color: var(--muted); font-weight: 400; font-size: .84rem; }
.result { display: block; margin-top: 6px; padding: 14px 16px; border-radius: 8px; border: 1px solid rgba(74,222,128,.45); background: rgba(74,222,128,.06); font-family: var(--mono); font-size: 1.15rem; color: var(--text); overflow-wrap: anywhere; min-height: 54px; }
.result.bad { border-color: rgba(247,200,115,.55); background: rgba(247,200,115,.06); color: #FBDDA6; }
.warn { margin-top: 10px; padding: 10px 12px; border-radius: 8px; border: 1px solid rgba(247,200,115,.55); background: rgba(247,200,115,.08); color: #FBDDA6; font-size: .9rem; }
.codewrap { margin-top: 16px; }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.code-head .lbl { color: var(--muted); font-weight: 400; font-size: .84rem; }
.dcode { margin: 0; padding: 14px 16px; border-radius: 8px; background: #0F161E; border: 1px solid var(--line); font-family: var(--mono); font-size: .84rem; line-height: 1.7; color: var(--text); white-space: pre-wrap; overflow-wrap: break-word; min-height: 52px; }
.dcode .s { color: #86EFAC; }
.dcode .fn { color: #7DD3FC; }
.dcode .n { color: #F7C873; }
.dcode .cm { color: #7D8894; }
.outs > .hint { margin-top: 12px; font-size: .86rem; }
.outs > .btn { margin-top: 12px; }

/* Examples (Read) */
#r-examples .ex { font-size: .76rem; }

/* Weekends and holidays */
.work { padding-top: 18px; border-top: 1px solid var(--line); }
.work > .lbl { margin-bottom: 8px; }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.days .op { padding: 8px 0; font-size: .8rem; text-align: center; }
.work .quick { margin-top: 10px; }
.hol-l { margin-top: 18px; }
.hols { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.hols:empty { display: none; }
.hols li { display: flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 6px; background: rgba(91,207,230,.08); border: 1px solid rgba(91,207,230,.35); }
.hols code { font-family: var(--mono); font-size: .8rem; }
.hols button { width: 24px; height: 24px; border: 0; border-radius: 5px; background: none; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; }
.hols button:hover { color: var(--text); background: rgba(255,255,255,.08); }

/* Between: three answers */
.answers { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.answers li { padding: 14px 14px 12px; background: #18212C; min-width: 0; }
.answers b { display: block; font-family: var(--mono); font-size: 1.5rem; font-weight: 500; line-height: 1.2; }
.answers span { display: block; font-size: .86rem; color: var(--muted); }
.answers code { display: block; margin-top: 6px; font-family: var(--mono); font-size: .74rem; color: var(--cyan); overflow-wrap: anywhere; }
.answers:empty { display: none; }
@media (max-width: 420px) { .answers b { font-size: 1.25rem; } .answers li { padding: 12px 10px; } }

/* Quick reference */
.ref { margin: 44px 0 0; }
.ref h2 { margin: 0; font-size: 1.35rem; letter-spacing: -.02em; }
.ref-hint { margin: 6px 0 0; font-size: .9rem; }
.ref-list { list-style: none; margin: 16px 0 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); }
.ref-list li { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr); gap: 4px 18px; align-items: center; padding: 10px 16px; }
.ref-list li + li { border-top: 1px solid var(--line); }
.ref-copy { justify-self: start; max-width: 100%; text-align: left; font: inherit; padding: 4px 8px; margin: -4px -8px; border: 1px solid transparent; border-radius: 6px; background: none; cursor: pointer; color: inherit; }
.ref-copy:hover { border-color: rgba(91,207,230,.5); }
.ref-copy code { font-family: var(--mono); font-size: .84rem; color: #CFF3FB; overflow-wrap: anywhere; }
.ref-list .what { color: var(--muted); font-size: .9rem; }
.ref-list .val { font-family: var(--mono); font-size: .84rem; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .ref-list li { grid-template-columns: minmax(0, 1fr) auto; }
  .ref-copy { grid-column: 1 / -1; }
  .ref-list .val { text-align: right; }
}
