.thd-calendar-app {
  --thd-black:#111;
  --thd-text:#222;
  --thd-muted:#6d6d6d;
  --thd-border:#d8d8d8;
  --thd-soft:#f7f7f7;
  --thd-emergence:#2563a6;
  --thd-contrast:#b52d2d;
  --thd-integration:#23763b;
  --thd-mixed:#8a6a12;
  width:100%;
  max-width:1320px;
  margin:0 auto;
  color:var(--thd-text);
  line-height:1.45;
}
.thd-calendar-app, .thd-calendar-app * { box-sizing:border-box; }
.thd-calendar-app button, .thd-calendar-app input, .thd-calendar-app select { font:inherit; }
.thd-header { text-align:center; padding:8px 16px 18px; }
.thd-header h2 { margin:0; color:var(--thd-black); font-size:clamp(30px,4.6vw,50px); line-height:1.08; }
.thd-header p { margin:5px 0 0; color:#444; font-size:clamp(15px,2vw,19px); }
.thd-nav-row { display:flex; justify-content:center; align-items:center; flex-wrap:wrap; gap:10px; margin:0 auto 16px; }
.thd-icon-btn, .thd-btn, .thd-date-control input, .thd-range-control select { min-height:44px; border:1px solid var(--thd-border); border-radius:8px; background:#fff; color:var(--thd-black); }
.thd-icon-btn { width:48px; padding:0; font-size:29px; line-height:1; cursor:pointer; }
.thd-btn { padding:10px 16px; font-weight:700; cursor:pointer; }
.thd-btn-small { min-height:44px; padding:8px 18px; }
.thd-btn-outline { border-color:#222; background:#fff; }
.thd-btn:hover, .thd-icon-btn:hover { background:#f2f2f2; }
.thd-date-control input { min-width:210px; padding:8px 12px; text-align:center; font-weight:700; }
.thd-range-control { display:flex; align-items:center; gap:8px; margin-left:6px; font-size:13px; font-weight:700; }
.thd-range-control select { padding:8px 34px 8px 11px; }
.thd-tabs { display:flex; align-items:flex-end; gap:0; margin-top:6px; border-bottom:1px solid var(--thd-border); }
.thd-tab { padding:12px 24px; border:1px solid var(--thd-border); border-bottom:0; border-radius:9px 9px 0 0; background:#f4f4f4; color:#222; font-size:17px; cursor:pointer; }
.thd-tab + .thd-tab { margin-left:2px; }
.thd-tab.is-active { background:#fff; font-weight:700; position:relative; top:1px; }
.thd-panel { display:none; }
.thd-panel.is-active { display:block; }
.thd-toolbar { display:flex; justify-content:center; flex-wrap:wrap; gap:10px; padding:14px; border:1px solid var(--thd-border); border-top:0; background:#fff; }
.thd-toolbar .thd-btn { min-width:210px; }
.thd-layout { display:grid; grid-template-columns:minmax(0,2.25fr) minmax(285px,.95fr); gap:14px; margin-top:14px; align-items:start; }
.thd-card { background:#fff; border:1px solid var(--thd-border); border-radius:8px; padding:16px; }
.thd-card h3 { margin:0 0 9px; color:var(--thd-black); font-size:22px; line-height:1.2; }
.thd-card h3 em { font-size:.72em; font-weight:400; }
.thd-selected-card { display:grid; grid-template-columns:minmax(190px,.8fr) minmax(0,2.5fr) minmax(170px,.75fr); gap:18px; align-items:center; margin-bottom:14px; }
.thd-selected-date { padding-right:18px; border-right:1px solid var(--thd-border); }
.thd-eyebrow { display:block; margin-bottom:6px; font-style:italic; }
.thd-selected-date strong { display:block; color:#111; font-size:clamp(25px,3vw,34px); line-height:1.1; }
.thd-selected-date > span:last-child { display:block; margin-top:4px; color:#444; font-size:18px; }
.thd-phase-stack { display:grid; grid-template-columns:repeat(5,minmax(90px,1fr)); gap:9px; }
.thd-phase-card { min-width:0; padding:10px 7px; border:1px solid var(--thd-border); border-radius:7px; background:#fafafa; text-align:center; }
.thd-phase-card .thd-layer-name { display:block; margin-bottom:8px; font-size:12px; color:#555; }
.thd-phase-label { display:inline-flex; align-items:center; justify-content:center; gap:6px; font-size:13px; font-weight:700; white-space:nowrap; }
.thd-phase-dot { width:10px; height:10px; border:1px solid #777; border-radius:50%; background:#ddd; flex:0 0 auto; }
.thd-phase-dot.emergence { background:var(--thd-emergence); border-color:var(--thd-emergence); }
.thd-phase-dot.contrast { background:var(--thd-contrast); border-color:var(--thd-contrast); }
.thd-phase-dot.integration { background:var(--thd-integration); border-color:var(--thd-integration); }
.thd-phase-dot.mixed { background:var(--thd-mixed); border-color:var(--thd-mixed); }
.thd-phase-dot.skip { background:#fff; border-color:#888; }
.thd-alignment-summary { padding-left:16px; border-left:1px solid var(--thd-border); text-align:center; }
.thd-alignment-summary strong { display:block; margin-bottom:7px; font-size:16px; }
.thd-align-dots { display:flex; justify-content:center; gap:8px; margin:8px 0; }
.thd-align-dot { width:18px; height:18px; border:1.5px solid #777; border-radius:50%; background:#fff; }
.thd-align-dot.is-on { background:#111; border-color:#111; }
.thd-align-score { font-size:14px; color:#444; }
.thd-section-heading { display:flex; align-items:flex-end; justify-content:space-between; gap:12px; margin-bottom:12px; }
.thd-section-heading h3 { margin:0; font-size:27px; }
.thd-section-heading p { margin:2px 0 0; color:#555; }
.thd-pagination { display:flex; align-items:center; justify-content:flex-end; gap:8px; color:#555; font-size:13px; }
.thd-pagination button { width:38px; height:38px; border:1px solid var(--thd-border); border-radius:7px; background:#fff; cursor:pointer; }
.thd-pagination button:disabled { opacity:.35; cursor:default; }
.thd-table-wrap, .thd-guide-table-wrap { width:100%; overflow:auto; }
.thd-calendar-table { width:100%; border-collapse:collapse; font-size:13px; min-width:760px; }
.thd-calendar-table th, .thd-calendar-table td { padding:8px 9px; border:1px solid #e1e1e1; text-align:left; vertical-align:middle; white-space:nowrap; }
.thd-calendar-table th { background:#f4f4f4; color:#111; font-weight:700; }
.thd-calendar-table tbody tr:nth-child(even) { background:#fafafa; }
.thd-date-cell strong { font-weight:600; }
.thd-date-cell small { margin-left:5px; color:#777; font-style:italic; }
.thd-phase-cell { font-weight:600; }
.thd-phase-cell .thd-phase-dot { display:inline-block; margin-right:6px; vertical-align:-1px; }
.thd-alignment-cell { min-width:122px; }
.thd-alignment-phase { display:block; margin-top:3px; color:#666; font-size:11px; font-weight:600; }
.thd-mini-dots { display:inline-flex; gap:4px; margin-right:7px; vertical-align:middle; }
.thd-mini-dot { width:9px; height:9px; border:1px solid #777; border-radius:50%; background:#fff; }
.thd-mini-dot.is-on { background:#111; border-color:#111; }
.thd-table-footer { margin-top:10px; color:#666; font-size:12px; }
.thd-side { display:grid; gap:14px; }
.thd-toggle-row { display:grid; grid-template-columns:1fr auto; gap:10px; align-items:start; }
.thd-toggle-row p { margin:0; color:#555; font-size:14px; }
.thd-switch { position:relative; display:inline-block; width:48px; height:26px; margin-top:2px; }
.thd-switch input { opacity:0; width:0; height:0; }
.thd-slider { position:absolute; inset:0; border-radius:26px; background:#777; cursor:pointer; transition:.2s; }
.thd-slider:before { content:''; position:absolute; width:20px; height:20px; left:3px; top:3px; border-radius:50%; background:#fff; transition:.2s; }
.thd-switch input:checked + .thd-slider { background:#111; }
.thd-switch input:checked + .thd-slider:before { transform:translateX(22px); }
.thd-personal-settings { margin-top:14px; padding-top:14px; border-top:1px solid var(--thd-border); }
.thd-personal-settings label strong { display:block; margin-bottom:6px; }
.thd-personal-settings input { width:100%; min-height:42px; padding:8px 10px; border:1px solid var(--thd-border); border-radius:7px; }
.thd-privacy, .thd-help { margin:8px 0 0; color:#666; font-size:12px; }
.thd-privacy { padding:8px 10px; border-left:3px solid #222; background:#f7f7f7; }
.thd-phase-legend { display:grid; gap:0; }
.thd-phase-legend > div { display:grid; grid-template-columns:18px 100px 1fr; gap:7px; align-items:center; padding:10px 0; border-top:1px solid #e2e2e2; }
.thd-phase-legend > div:first-child { border-top:0; }
.thd-phase-legend span:last-child { color:#555; font-size:13px; }
.thd-info-bar { display:flex; gap:8px; margin-top:14px; padding:12px 14px; border:1px solid var(--thd-border); border-radius:8px; background:#fff; font-size:13px; }
.thd-guide { margin-top:14px; padding:22px; }
.thd-guide h3 { margin-top:28px; font-size:24px; }
.thd-guide h3:first-child { margin-top:0; }
.thd-guide p { margin:8px 0 12px; }
.thd-guide table { width:100%; min-width:680px; border-collapse:collapse; }
.thd-guide th, .thd-guide td { padding:10px; border:1px solid var(--thd-border); text-align:left; vertical-align:top; }
.thd-guide th { background:#111; color:#fff; }
.thd-note { padding:11px 13px; border-left:4px solid #111; background:#f5f5f5; }
.thd-phase-guide-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; }
.thd-phase-guide-grid > div { padding:14px; border:1px solid var(--thd-border); border-radius:8px; }
.thd-phase-guide-grid strong { font-size:18px; }
.thd-phase-guide-grid p { margin-bottom:0; }
.thd-print-area { display:none; }
.thd-calendar-app .screen-reader-text { position:absolute!important; width:1px!important; height:1px!important; padding:0!important; margin:-1px!important; overflow:hidden!important; clip:rect(0,0,0,0)!important; white-space:nowrap!important; border:0!important; }
@media (max-width:1050px) {
  .thd-layout { grid-template-columns:1fr; }
  .thd-side { grid-template-columns:1fr 1fr; }
  .thd-selected-card { grid-template-columns:1fr; }
  .thd-selected-date, .thd-alignment-summary { border:0; padding:0; }
}
@media (max-width:780px) {
  .thd-phase-stack { grid-template-columns:repeat(2,1fr); }
  .thd-toolbar { display:grid; grid-template-columns:1fr; }
  .thd-toolbar .thd-btn { width:100%; min-width:0; }
  .thd-side, .thd-phase-guide-grid { grid-template-columns:1fr; }
  .thd-info-bar { display:block; }
  .thd-range-control { width:100%; justify-content:center; }
  .thd-section-heading { align-items:flex-start; flex-direction:column; }
  .thd-pagination { justify-content:flex-start; }
}
@media (max-width:520px) {
  .thd-date-control { order:2; width:calc(100% - 116px); }
  .thd-date-control input { width:100%; min-width:0; }
  .thd-nav-row [data-action="previous-day"] { order:1; }
  .thd-nav-row [data-action="next-day"] { order:3; }
  .thd-nav-row [data-action="today"] { order:4; }
  .thd-range-control { order:5; }
  .thd-tab { flex:1; padding:11px 10px; }
  .thd-phase-stack { grid-template-columns:1fr; }
}

@media print {
  body.thd-print-active * { visibility:hidden!important; }
  .thd-calendar-app.is-printing .thd-print-area, .thd-calendar-app.is-printing .thd-print-area * { visibility:visible!important; }
  .thd-calendar-app.is-printing .thd-print-area { display:block!important; position:absolute; left:0; top:0; width:100%; color:#000; }
  .thd-print-area h1 { margin:0 0 4px; font-size:24px; }
  .thd-print-area .thd-print-meta { margin-bottom:12px; font-size:11px; color:#444; }
  .thd-print-area table { width:100%; border-collapse:collapse; font-size:9px; }
  .thd-print-area th, .thd-print-area td { padding:4px 5px; border:1px solid #bbb; text-align:left; white-space:nowrap; }
  .thd-print-area th { background:#eee!important; }
  .thd-print-area tr { break-inside:avoid; page-break-inside:avoid; }
  @page { margin:10mm; size:landscape; }
}

/* 2.1 full-width personal calendar layout */
.thd-main-full { width:100%; margin-top:14px; }
.thd-personal-wide { margin-top:14px; }
.thd-personal-wide-row { display:grid; grid-template-columns:minmax(260px,.8fr) minmax(0,2fr); gap:22px; align-items:start; }
.thd-personal-wide .thd-toggle-row { min-height:54px; }
.thd-personal-wide .thd-personal-settings { margin:0; padding:0 0 0 22px; border-top:0; border-left:1px solid var(--thd-border); display:grid; grid-template-columns:minmax(210px,.55fr) minmax(0,1.45fr); gap:18px; align-items:start; }
.thd-personal-wide .thd-birth-field strong { display:block; margin-bottom:6px; }
.thd-personal-wide .thd-birth-field input { width:100%; min-height:42px; padding:8px 10px; border:1px solid var(--thd-border); border-radius:7px; }
.thd-personal-setting-copy .thd-help { margin-top:0; }
.thd-personal-setting-copy .thd-privacy { margin-top:8px; }
.thd-personal-selected { margin-top:14px; padding-top:14px; border-top:1px solid var(--thd-border); display:grid; grid-template-columns:minmax(220px,.6fr) minmax(0,1.8fr); gap:18px; align-items:center; }
.thd-personal-selected[hidden] { display:none!important; }
.thd-personal-selected-label strong { display:block; margin-bottom:7px; font-size:17px; }
.thd-personal-selected-label > span { color:#555; font-size:13px; }
.thd-personal-selected-stack { display:grid; grid-template-columns:repeat(5,minmax(105px,1fr)); gap:9px; }
.thd-personal-range-card[hidden] { display:none!important; }
.thd-personal-match-key { max-width:440px; color:#666; font-size:12px; text-align:right; }
.thd-legend-wide { margin-top:14px; }
.thd-legend-wide .thd-phase-legend { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; }
.thd-legend-wide .thd-phase-legend > div { grid-template-columns:18px 95px 1fr; padding:10px 12px; border:1px solid #e2e2e2; border-radius:7px; }
.thd-legend-wide .thd-phase-legend > div:first-child { border-top:1px solid #e2e2e2; }
.thd-collective-table { min-width:760px; }
.thd-personal-table { min-width:860px; }

@media (max-width:900px) {
  .thd-personal-wide-row { grid-template-columns:1fr; gap:14px; }
  .thd-personal-wide .thd-personal-settings { padding:14px 0 0; border-left:0; border-top:1px solid var(--thd-border); grid-template-columns:1fr; }
  .thd-personal-selected { grid-template-columns:1fr; }
  .thd-personal-selected-stack { grid-template-columns:repeat(2,1fr); }
  .thd-legend-wide .thd-phase-legend { grid-template-columns:1fr; }
  .thd-personal-match-key { max-width:none; text-align:left; }
}

@media (max-width:560px) {
  .thd-personal-selected-stack { grid-template-columns:1fr; }
}

@media print {
  .thd-print-area h2 { margin:16px 0 6px; font-size:15px; }
}

/* 2.4 comprehensive user guide */
.thd-guide-video-section { display:grid; grid-template-columns:minmax(250px,.72fr) minmax(0,1.28fr); gap:24px; align-items:center; margin-bottom:30px; padding:18px; border:1px solid var(--thd-border); border-radius:9px; background:#fafafa; }
.thd-guide-video-copy h3 { margin:4px 0 8px!important; }
.thd-guide-video-copy p { margin-bottom:0; color:#555; }
.thd-guide-kicker { display:block; margin-bottom:3px; color:#555; font-size:12px; font-weight:800; letter-spacing:.09em; text-transform:uppercase; }
.thd-guide-video-frame { position:relative; width:100%; aspect-ratio:16 / 9; overflow:hidden; border-radius:8px; background:#000; }
.thd-guide-video-frame iframe, .thd-guide-video-frame video, .thd-guide-video-frame > div { position:absolute; inset:0; width:100%!important; height:100%!important; border:0; }
.thd-guide-wide-table { min-width:1080px!important; }
.thd-guide-phase-name { font-weight:800; }
.thd-guide-phase-name.emergence { color:var(--thd-emergence); }
.thd-guide-phase-name.contrast { color:var(--thd-contrast); }
.thd-guide-phase-name.integration { color:var(--thd-integration); }
.thd-nested-flow { display:grid; grid-template-columns:1fr auto 1fr auto 1fr auto 1fr auto 1fr; gap:9px; align-items:center; margin:16px 0 18px; padding:14px; border:1px solid var(--thd-border); border-radius:8px; background:#fafafa; }
.thd-nested-flow > div { min-height:76px; display:flex; flex-direction:column; justify-content:center; padding:10px; border:1px solid var(--thd-border); border-radius:7px; background:#fff; text-align:center; }
.thd-nested-flow > div strong { color:#111; }
.thd-nested-flow > div span { margin-top:4px; color:#666; font-size:12px; }
.thd-nested-flow > span { color:#555; font-size:20px; text-align:center; }
.thd-guide-summary-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; margin:14px 0 6px; }
.thd-guide-summary-grid > div { padding:14px; border:1px solid var(--thd-border); border-radius:8px; background:#fafafa; }
.thd-guide-summary-grid strong { display:block; margin-bottom:5px; color:#111; }
.thd-guide-summary-grid span { color:#555; font-size:13px; }
.thd-matrix-table td:first-child, .thd-matrix-table th:first-child { min-width:170px; }

@media (max-width:900px) {
  .thd-guide-video-section { grid-template-columns:1fr; }
  .thd-nested-flow { grid-template-columns:1fr; }
  .thd-nested-flow > span { transform:rotate(90deg); }
  .thd-guide-summary-grid { grid-template-columns:1fr; }
}

/* 2.4.4 UX QA */
.thd-personal-selected-label > span { display:block; margin-top:5px; }
.thd-calendar-app button:focus-visible,
.thd-calendar-app input:focus-visible,
.thd-calendar-app select:focus-visible {
  outline:2px solid currentColor;
  outline-offset:2px;
}
.thd-tab[aria-selected="true"] { cursor:default; }
