/* ==================================================================
   weekly-planner.css  (added 2026-09-27)
   Loaded only on /weekly-planner/. Every class starts with "wp-" and
   is written out in full here, so nothing depends on which Tailwind
   classes happen to be compiled into tailwind.min.css.
   ================================================================== */

/* ---------------- Page layout ---------------- */
.wp-page { max-width: 1320px; margin: 0 auto; padding: 16px 16px 40px; }
.wp-h1 { font-size: 2rem; font-weight: 800; color: #111827; line-height: 1.2; margin: 8px 0 8px; }
.wp-intro { color: #374151; font-size: 1rem; line-height: 1.6; margin: 0 0 20px; max-width: 820px; }

.wp-tool { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 24px; align-items: start; }
.wp-right { min-width: 0; }

/* ---------------- Options panel ---------------- */
.wp-panel { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px 16px; position: sticky; top: 12px; }
.wp-set { border: 0; border-bottom: 1px solid #e5e7eb; margin: 0; padding: 10px 0 14px; min-width: 0; }
.wp-set:last-child { border-bottom: 0; padding-bottom: 4px; }
.wp-set legend { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #1e3a8a; padding: 0; margin-bottom: 8px; float: left; width: 100%; }
.wp-set legend + * { clear: both; }
.wp-lbl { display: block; font-size: 0.82rem; font-weight: 600; color: #374151; margin: 10px 0 4px; }
.wp-panel select, .wp-panel input[type="date"] {
    width: 100%; font: inherit; font-size: 0.9rem; padding: 7px 8px; border: 1px solid #d1d5db;
    border-radius: 6px; background: #fff; color: #111827;
}
.wp-panel select:focus, .wp-panel input:focus-visible, .wp-panel button:focus-visible { outline: 2px solid #1e3a8a; outline-offset: 1px; }

.wp-seg { display: flex; gap: 6px; margin-top: 2px; }
.wp-seg label { flex: 1; display: flex; align-items: center; gap: 6px; font-size: 0.88rem; background: #fff;
    border: 1px solid #d1d5db; border-radius: 6px; padding: 7px 8px; cursor: pointer; }
.wp-seg label.is-on, .wp-seg label:has(input:checked) { border-color: #1e3a8a; background: #eef2ff; }

.wp-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.wp-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; background: #fff;
    border: 1px solid #d1d5db; border-radius: 8px; padding: 8px 4px; cursor: pointer; font-size: 0.86rem; font-weight: 600; }
.wp-card small { font-size: 0.7rem; font-weight: 400; color: #6b7280; }
.wp-card input { position: absolute; opacity: 0; pointer-events: none; }
.wp-card.is-on, .wp-card:has(input:checked) { border-color: #1e3a8a; background: #eef2ff; color: #1e3a8a; }
.wp-card:has(input:focus-visible) { outline: 2px solid #1e3a8a; outline-offset: 1px; }

.wp-check-lbl { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; margin: 6px 0; cursor: pointer; }
.wp-check-lbl input { width: 16px; height: 16px; accent-color: #1e3a8a; }

.wp-styles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.wp-style { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #d1d5db; border-radius: 6px;
    padding: 6px 8px; font-size: 0.86rem; cursor: pointer; }
.wp-style input { position: absolute; opacity: 0; pointer-events: none; }
.wp-style.is-on, .wp-style:has(input:checked) { border-color: #1e3a8a; background: #eef2ff; font-weight: 600; }
.wp-style:has(input:focus-visible) { outline: 2px solid #1e3a8a; outline-offset: 1px; }
.wp-sw { width: 18px; height: 18px; border-radius: 4px; flex: none; border: 1px solid #d1d5db; }
.wp-sw-simple { background: linear-gradient(135deg, #fff 50%, #111 50%); }
.wp-sw-classic { background: #1e3a8a; }
.wp-sw-cute { background: linear-gradient(135deg, #fbcfe8 50%, #bae6fd 50%); border-radius: 50%; }
.wp-sw-aesthetic { background: linear-gradient(135deg, #efe7dc 50%, #7b6a58 50%); }

.wp-daterow { display: flex; gap: 6px; align-items: center; }
.wp-daterow input { flex: 1; min-width: 0; }
.wp-mini { width: 34px; height: 34px; flex: none; border: 1px solid #d1d5db; border-radius: 6px; background: #fff;
    font-size: 1.25rem; line-height: 1; cursor: pointer; color: #1e3a8a; }
.wp-mini:hover { background: #eef2ff; }
.wp-link { background: none; border: 0; padding: 0; margin-top: 6px; color: #1e3a8a; text-decoration: underline; cursor: pointer; font-size: 0.85rem; }
.wp-weeklabel { font-size: 0.85rem; color: #111827; font-weight: 600; margin: 6px 0 4px; min-height: 1.2em; }

/* ---------------- Preview ---------------- */
.wp-stage { background: #eef0f3; border: 1px solid #e5e7eb; border-radius: 10px; padding: 16px; }
.wp-sheet-wrap { position: relative; width: 100%; margin: 0 auto; overflow: hidden; }
.wp-tip { font-size: 0.85rem; color: #4b5563; margin: 10px 2px 0; }
.wp-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.wp-btn { font: inherit; font-size: 0.95rem; font-weight: 600; padding: 10px 18px; border-radius: 6px; cursor: pointer;
    border: 1px solid #1e3a8a; background: #fff; color: #1e3a8a; }
.wp-btn:hover { background: #eef2ff; }
.wp-btn-primary { background: #1e3a8a; color: #fff; }
.wp-btn-primary:hover { background: #172e6e; }
.wp-btn[disabled] { opacity: 0.6; cursor: wait; }
.wp-btn-excel { text-decoration: none; display: inline-flex; align-items: center; border-color: #15803d; color: #15803d; }
.wp-btn-excel:hover { background: #f0fdf4; }
.wp-note { font-size: 0.82rem; color: #4b5563; margin: 8px 2px 0; }
.wp-note a { color: #1e3a8a; text-decoration: underline; }
.wp-content a.wp-use { display: inline-block; text-decoration: none; }
.wp-content h2 { scroll-margin-top: 16px; }
.wp-status { font-size: 0.85rem; color: #4b5563; min-height: 1.2em; margin: 8px 2px 0; }

/* ---------------- Content ---------------- */
.wp-content { max-width: 860px; margin: 36px auto 0; color: #1f2937; line-height: 1.65; }
.wp-content section { border-top: 1px solid #e5e7eb; padding-top: 22px; margin-top: 26px; }
.wp-content h2 { font-size: 1.45rem; font-weight: 700; color: #111827; margin: 0 0 10px; }
.wp-content h3 { font-size: 1.08rem; font-weight: 700; color: #111827; margin: 18px 0 4px; scroll-margin-top: 16px; }
.wp-content p { margin: 0 0 10px; }
.wp-content ol, .wp-content ul { margin: 0 0 12px; padding-left: 22px; }
.wp-content ol { list-style: decimal; }
.wp-content ul { list-style: disc; }
.wp-content li { margin: 4px 0; }
.wp-content a { color: #1e3a8a; text-decoration: underline; }
.wp-use { font: inherit; font-size: 0.88rem; font-weight: 600; color: #1e3a8a; background: #eef2ff; border: 1px solid #c7d2fe;
    border-radius: 6px; padding: 6px 12px; cursor: pointer; margin: 2px 0 6px; }
.wp-use:hover { background: #e0e7ff; }
.wp-content ul.wp-related { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 20px; }

@media (max-width: 900px) {
    .wp-tool { grid-template-columns: 1fr; }
    .wp-panel { position: static; }
    .wp-h1 { font-size: 1.6rem; }
    .wp-stage { padding: 8px; }
}
@media (max-width: 480px) {
    .wp-content ul.wp-related { grid-template-columns: 1fr; }
    .wp-btn { flex: 1 1 auto; }
}

/* ==================================================================
   THE PLANNER SHEET
   Drawn at real paper size (96 px per inch) and scaled down for the
   preview. All sizes are in em, so A5 simply uses a smaller font.
   ================================================================== */
.wp-sheet {
    position: absolute; top: 0; left: 0; transform-origin: 0 0;
    background: #fff; color: var(--ink); box-sizing: border-box;
    padding: 2.6em 2.8em 1.7em; display: flex; flex-direction: column;
    font-family: Inter, Arial, Helvetica, sans-serif; line-height: 1.3; overflow: hidden;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.14);
}
.wp-sheet * { box-sizing: border-box; }
.wp-sheet [contenteditable="true"] { outline: none; cursor: text; }
.wp-sheet [contenteditable="true"]:focus { background: rgba(250, 204, 21, 0.18); }

.wp-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1em;
    border-bottom: 0.2em solid var(--accent); padding-bottom: 0.35em; margin-bottom: 1em; }
/* Generous line-height + padding: the PDF/PNG renderer (html2canvas) draws text a little lower than the
   browser, so tight boxes cut the bottom of the letters off (fixed 2026-09-27). */
.wp-title { font-size: 2.2em; font-weight: 800; color: var(--accent); letter-spacing: -0.01em; line-height: 1.35; padding: 0.05em 0 0.12em; min-width: 3em; white-space: nowrap; overflow: visible; }
.wp-weekof { font-size: 1.05em; color: var(--muted); display: flex; align-items: flex-end; gap: 0.5em; white-space: nowrap; line-height: 1.4; padding-bottom: 0.2em; }
.wp-weekof strong { color: var(--ink); font-weight: 700; }
.wp-blank { display: inline-block; width: 12em; border-bottom: 1px solid var(--line-strong); height: 1.1em; }

.wp-main { flex: 1; display: flex; flex-direction: column; gap: 1em; min-height: 0; }
.wp-days { flex: 1; display: grid; gap: 0.6em; min-height: 0; }
.wp-l-vertical .wp-days { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.wp-l-horizontal .wp-days { grid-template-rows: repeat(7, minmax(0, 1fr)); }

.wp-day { border: 1px solid var(--line-strong); border-radius: var(--r); display: flex; flex-direction: column;
    min-height: 0; min-width: 0; overflow: hidden; background: #fff; }
.wp-l-horizontal .wp-day { flex-direction: row; }
.wp-dhead { background: var(--headbg); color: var(--headink); padding: 0.45em 0.6em 0.55em; line-height: 1.35; display: flex;
    justify-content: space-between; align-items: baseline; gap: 0.4em; flex: none; }
.wp-l-horizontal .wp-dhead { width: 16%; flex-direction: column; justify-content: center; align-items: flex-start; }
.wp-dname { font-weight: 700; font-size: 0.95em; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.wp-ddate { font-weight: 800; font-size: 1.15em; white-space: nowrap; }
.wp-dblank { display: inline-block; width: 2.2em; border-bottom: 1px solid currentColor; opacity: 0.55; height: 1em; }
.wp-hname { font-size: 0.72em; font-weight: 600; color: var(--hol); padding: 0.3em 0.7em 0; line-height: 1.2; flex: none; }
.wp-l-horizontal .wp-hname { padding: 0.2em 0 0; color: inherit; opacity: 0.9; }
.wp-daybody { flex: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0; }

.wp-lines { flex: 1; display: flex; flex-direction: column; padding: 0 0.7em 0.35em; min-height: 0; }
.wp-line { flex: 1 1 0; border-bottom: 1px solid var(--line); display: flex; align-items: flex-end; gap: 0.4em;
    min-height: 0; padding-bottom: 0.3em; }
.wp-edit { flex: 1; min-width: 1px; font-size: 0.95em; white-space: nowrap; overflow: hidden; line-height: 1.4; }
.wp-num { font-weight: 700; color: var(--accent); font-size: 0.9em; flex: none; }
.wp-check { width: 0.85em; height: 0.85em; border: 1px solid var(--line-strong); border-radius: 0.15em; flex: none; margin-bottom: 0.05em; }

.wp-extras { display: grid; gap: 0.8em; height: 23%; flex: none; }
.wp-o-portrait .wp-extras { height: 19%; }
.wp-l-hourly .wp-extras { height: 17%; }
.wp-box { border: 1px solid var(--line-strong); border-radius: var(--r); display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.wp-box-h { background: var(--softbg); color: var(--accent); font-weight: 700; font-size: 0.82em; text-transform: uppercase;
    letter-spacing: 0.05em; padding: 0.3em 0.7em 0.65em; line-height: 1.35; flex: none; }

/* Hourly grid */
.wp-hgrid { flex: 1; display: grid; min-height: 0; border: 1px solid var(--line-strong); border-radius: var(--r); overflow: hidden; }
.wp-hc { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-height: 0; min-width: 0;
    font-size: 0.8em; padding: 0 0.35em; overflow: hidden; white-space: nowrap; display: flex; align-items: center; }
.wp-hc.wp-half { border-bottom-style: dashed; }
.wp-hh { background: var(--headbg); color: var(--headink); font-weight: 700; flex-direction: column; justify-content: center;
    padding: 0.45em 0.2em 0.6em; white-space: normal; text-align: center; line-height: 1.3; font-size: 0.85em; }
.wp-hh .wp-dname { font-size: 1em; }
.wp-hh .wp-ddate { font-size: 1.1em; }
.wp-hh .wp-hname { padding: 0.15em 0 0; color: inherit; font-size: 0.8em; }
/* Time label: top of its hour, plain block (not flex) so the PDF/PNG renderer
   places the text exactly where the browser does. */
.wp-hc.wp-ht { display: block; text-align: right; color: var(--muted); font-weight: 600; padding: 0.35em 0.5em 0 0.2em;
    font-size: 0.72em; line-height: 1.3; background: var(--softbg); overflow: visible; }
.wp-corner { background: var(--headbg); }

.wp-foot { font-size: 0.7em; color: var(--muted); text-align: right; margin-top: 0.6em; flex: none; letter-spacing: 0.02em; }

/* ---------------- Styles (themes) ---------------- */
.wp-t-classic { --ink: #111827; --accent: #1e3a8a; --headbg: #1e3a8a; --headink: #fff; --softbg: #eef2ff;
    --line: #d5dbe5; --line-strong: #94a3b8; --muted: #6b7280; --hol: #b91c1c; --r: 0.35em; }
.wp-t-classic .wp-we .wp-dhead, .wp-t-classic .wp-hh.wp-we { background: #3b5bb5; }

.wp-t-simple { --ink: #111; --accent: #111; --headbg: #fff; --headink: #111; --softbg: #fff;
    --line: #c9c9c9; --line-strong: #2b2b2b; --muted: #555; --hol: #111; --r: 0; }
.wp-t-simple .wp-dhead, .wp-t-simple .wp-box-h { border-bottom: 1px solid var(--line-strong); }
.wp-t-simple .wp-l-horizontal .wp-dhead, .wp-t-simple.wp-l-horizontal .wp-dhead { border-bottom: 0; border-right: 1px solid var(--line-strong); }
.wp-t-simple .wp-hh { border-bottom: 1px solid var(--line-strong); }
.wp-t-simple .wp-hname { font-style: italic; }

.wp-t-cute { --ink: #4a3b4f; --accent: #d9468f; --headbg: #fce7f3; --headink: #4a3b4f; --softbg: #fdf2f8;
    --line: #f5cfe0; --line-strong: #efa9c8; --muted: #9d7a92; --hol: #c2185b; --r: 0.9em;
    font-family: "Trebuchet MS", Verdana, Arial, sans-serif; }
.wp-t-cute .wp-day, .wp-t-cute .wp-box { border-width: 2px; }
.wp-t-cute .wp-title { letter-spacing: 0.02em; }
.wp-t-cute .wp-head { border-bottom-style: dotted; border-bottom-width: 0.3em; }
.wp-t-cute .wp-c0 .wp-dhead, .wp-t-cute .wp-hh.wp-c0 { background: #fbcfe8; }
.wp-t-cute .wp-c1 .wp-dhead, .wp-t-cute .wp-hh.wp-c1 { background: #fed7aa; }
.wp-t-cute .wp-c2 .wp-dhead, .wp-t-cute .wp-hh.wp-c2 { background: #fef08a; }
.wp-t-cute .wp-c3 .wp-dhead, .wp-t-cute .wp-hh.wp-c3 { background: #bbf7d0; }
.wp-t-cute .wp-c4 .wp-dhead, .wp-t-cute .wp-hh.wp-c4 { background: #bae6fd; }
.wp-t-cute .wp-c5 .wp-dhead, .wp-t-cute .wp-hh.wp-c5 { background: #ddd6fe; }
.wp-t-cute .wp-c6 .wp-dhead, .wp-t-cute .wp-hh.wp-c6 { background: #fecdd3; }
.wp-t-cute .wp-check { border-radius: 50%; }

.wp-t-aesthetic { --ink: #3f3a36; --accent: #7b6a58; --headbg: #efe7dc; --headink: #5b4d40; --softbg: #f6f1ea;
    --line: #e4dbcf; --line-strong: #bcad9b; --muted: #8c7d6e; --hol: #9a5b3f; --r: 0.2em; }
.wp-t-aesthetic .wp-title { font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-style: italic; letter-spacing: 0.01em; }
.wp-t-aesthetic .wp-dname { font-family: Georgia, "Times New Roman", serif; font-weight: 400; text-transform: none; letter-spacing: 0.03em; font-size: 1.05em; }
.wp-t-aesthetic .wp-box-h { font-family: Georgia, "Times New Roman", serif; font-weight: 400; text-transform: none; letter-spacing: 0.02em; font-size: 0.95em; }
.wp-t-aesthetic .wp-head { border-bottom-width: 1px; }

/* Off-screen copy used while making the PDF or PNG */
.wp-export { position: absolute; left: -40000px; top: 0; }
.wp-export .wp-sheet { position: relative; box-shadow: none; transform: none !important; }
.wp-export [contenteditable="true"]:focus { background: none; }

/* ---------------- Printing ---------------- */
#wpPrint { display: none; }
@media print {
    body > *:not(#wpPrint) { display: none !important; }
    #wpPrint { display: block !important; }
    #wpPrint .wp-sheet { position: relative; box-shadow: none; transform: none !important; }
    #wpPrint [contenteditable="true"]:focus { background: none; }
}
