/* Pages added after the first release: calendar, tasks, contacts, analytics, reports. */
.navlabel + .nav { margin-top: 0; }
.monthname { min-width: 150px; text-align: center; font-family: var(--serif); font-size: 20px; font-weight: 500; }

.cal { overflow: hidden; }
.cal__head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 55%, var(--surface)); }
.cal__head span { padding: 10px 12px; font-size: 11px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.cal__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.day { min-height: 112px; padding: 8px 8px 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.day:nth-child(7n) { border-right: 0; }
.day--out { background: color-mix(in srgb, var(--paper) 70%, var(--surface)); }
.day--out .dn { color: var(--faint); }
.dn { font-size: 12.5px; font-weight: 500; color: var(--muted); align-self: flex-start; min-width: 22px; text-align: center; border-radius: 11px; line-height: 22px; }
.day--today .dn { background: var(--ink-btn); color: #fff; }
.ev { display: block; padding: 2px 6px; border-radius: 5px; font-size: 11.5px; line-height: 1.35; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev:hover { text-decoration: none; filter: brightness(0.96); }
.ev--close, .legend .lg--close { background: var(--hl); color: #3d2f08; }
.ev--key, .legend .lg--key { background: var(--blue-wash); color: var(--blue); }
.ev--task, .legend .lg--task { background: var(--sunken); color: var(--ink); }
.ev--late, .legend .lg--late { background: var(--peach); color: var(--red); }
.more-ev { font-size: 11.5px; color: var(--muted); padding-left: 6px; }

.panel { padding: 20px 24px 22px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.bars { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.bar { display: grid; grid-template-columns: 130px minmax(0, 1fr) 28px; gap: 12px; align-items: center; font-size: 13.5px; }
.bar__l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.bar__t { height: 12px; border-radius: 6px; background: var(--sunken); overflow: hidden; }
.bar__t i { display: block; height: 100%; border-radius: 6px; background: var(--green); }
.bar b { text-align: right; font-weight: 600; }
.table--static tbody tr { cursor: default; }
.toolbar .search { flex: 0 1 280px; }

@media (max-width: 1100px) { .two { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .tabbar { display: flex; overflow-x: auto; scrollbar-width: none; }
  .tabbar::-webkit-scrollbar { display: none; }
  .tabbar a { flex: 0 0 auto; min-width: 84px; }
  .day { min-height: 76px; padding: 4px 3px; }
  .ev { padding: 1px 3px; font-size: 10px; }
  .cal__head span { padding: 8px 4px; letter-spacing: 0; font-size: 10px; }
  .bar { grid-template-columns: 96px minmax(0, 1fr) 24px; }
  .monthname { min-width: 0; font-size: 17px; }
}
@media print {
  .rail, .crumbbar, .topbar, .tabbar, .noprint, #toasts { display: none !important; }
  .app { display: block; } .page { padding: 0; max-width: none; }
  body { background: #fff; }
}

/* ---------- Ready to Send ---------- */
.drafts { display: flex; flex-direction: column; gap: 18px; }
.draft { padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; }
.draft__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.draft__head h2 { font-family: var(--serif); font-size: 22px; font-weight: 500; margin-bottom: 2px; }
.draft__head a { color: var(--muted); font-size: 13.5px; }
.draft__body { min-height: 280px; line-height: 1.55; }
.draft input[readonly], .draft textarea[readonly] { background: var(--sunken); }
.draft__warn { color: var(--hl-ink); background: var(--hl-wash); padding: 8px 12px; border-radius: var(--r-field); font-weight: 500; }
.draft__actions { gap: 10px; }
@media (max-width: 760px) { .draft { padding: 16px; } .draft__head { flex-direction: column; } }

/* Compliance bar */
.comp { display: flex; align-items: center; gap: 10px; }
.comp__t { flex: 1; height: 10px; border-radius: 5px; background: var(--sunken); overflow: hidden; min-width: 70px; }
.comp__t i { display: block; height: 100%; border-radius: 5px; background: var(--green); }
.comp b { font-size: 13px; font-weight: 600; min-width: 38px; text-align: right; }

/* Price, tasks and contingency counts */
.table .price { font-weight: 600; white-space: nowrap; }
.cnt { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--muted); }
.cnt b { color: var(--ink); font-weight: 600; font-size: 14.5px; }
.cnt small { font-size: 12px; color: var(--muted); }
.cnt--late svg, .cnt--late small { color: var(--red); }
.cnt--late small { font-weight: 600; }
@media (max-width: 760px) { .table td.price { padding-top: 0; } }
.table--detail .progress { width: 150px; }
.table--detail .next { max-width: 200px; }

.tcav { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--sunken); color: var(--ink); font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }
.table--detail th, .table--detail td { padding-left: 12px; padding-right: 12px; }
.table--detail th:first-child, .table--detail td:first-child { padding-left: 20px; }

/* Add-task dropdown */
.menu { position: relative; display: inline-block; }
.menu__list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 270px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14); display: flex; flex-direction: column; }
.menu__list button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 10px 12px; border: 0; background: none; border-radius: 8px; text-align: left; font: inherit; color: var(--ink); cursor: pointer; }
.menu__list button:hover, .menu__list button:focus-visible { background: var(--sunken); }
.menu__list small { color: var(--muted); font-size: 12.5px; }

/* File page: tabs, collapsible Details panel */
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { white-space: nowrap; flex: 0 0 auto; }
.fbody { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 24px; align-items: start; }
.fbody--closed { grid-template-columns: minmax(0, 1fr) 52px; }
.fmain { min-width: 0; }
.fside { position: sticky; top: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.fside__head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; }
.fside__head h2 { margin: 0; font-size: 17px; }
.fside__toggle { font-size: 22px; line-height: 1; }
.fside__body { padding: 0 16px 16px; max-height: calc(100vh - 110px); overflow: auto; }
.fside__hint { font-size: 12.5px; margin-bottom: 12px; }
.fside .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fside .field.span2, .fside .field.span4 { grid-column: 1 / -1; }
.fside input:not([type='checkbox']), .fside select { width: 100%; min-width: 0; }
.fside--closed .fside__head { flex-direction: column; gap: 14px; padding: 12px 0; }
.fside--closed h2 { writing-mode: vertical-rl; font-size: 14px; }
@media (max-width: 1100px) {
  .fbody, .fbody--closed { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .fside { position: static; order: -1; }
  .fside__body { max-height: none; }
  .fside--closed .fside__head { flex-direction: row; gap: 0; padding: 14px 16px; }
  .fside--closed h2 { writing-mode: horizontal-tb; font-size: 17px; }
}

/* Participants, emails, notes, payout */
.plist, .notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pcard { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--line); }
.pcard:first-child { border-top: 0; }
.pcard__main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pcard__main > b { font-weight: 600; margin-right: 8px; }
.pcard__contact { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.pcard__body summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-top: 4px; }
.pcard__body pre { white-space: pre-wrap; font: inherit; line-height: 1.5; background: var(--sunken); padding: 12px 14px; border-radius: 10px; margin-top: 8px; }
.note { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.note:first-child { border-top: 0; }
.note__main { flex: 1; min-width: 0; white-space: pre-wrap; }
.note__main small { display: block; margin-top: 3px; }
.note--action { align-items: center; }
.note--done .note__main > div { color: var(--muted); text-decoration: line-through; }
.pstats { margin-top: 16px; display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.pstat { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--muted); }
.pstat b { color: var(--ink); font-weight: 600; }
.pstat--strong { color: var(--ink); font-size: 16px; border-bottom: 0; }
.pstat--strong b { font-size: 18px; }
@media (max-width: 760px) { .pcard { flex-direction: column; } }
.fmain .tab { padding-left: 12px; padding-right: 12px; }

/* Details panel: checkboxes in one tidy left-aligned column, label right beside each box */
.fside .field.span4 > .stack { align-items: stretch; }
.fside .check { display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; text-align: left; line-height: 1.3; }
.fside .check input { flex: none; width: 17px; height: 17px; margin: 0; }

/* ---- checklist setup and template editors ---- */
.setup-sec { margin-bottom: 30px; }
.setup-sec h2 { margin-bottom: 4px; }
.h1input { font: inherit; font-size: 26px; font-weight: 700; letter-spacing: -0.01em; width: 100%; max-width: 640px; border: 1px solid transparent; background: transparent; padding: 2px 8px; margin-left: -8px; border-radius: 8px; color: var(--ink); }
.h1input:hover { border-color: var(--line); }
.h1input:focus { border-color: var(--line-strong); background: var(--surface); outline: none; }
.tpl-item--edit { grid-template-columns: 110px minmax(0, 1fr) 190px auto; align-items: center; }
.ttlist { margin-top: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.ttrow { display: grid; grid-template-columns: 38px minmax(0, 1.5fr) minmax(0, 2fr) auto; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--line); align-items: start; }
.ttrow:last-child { border-bottom: 0; }
.ttrow__move { display: flex; flex-direction: column; gap: 2px; }
.ttrow__main { display: grid; gap: 6px; }
.ttrow__ctl { display: flex; flex-wrap: wrap; gap: 6px; }
.ttrow__ctl select, .ttrow__ctl input { width: auto; min-width: 0; }
.ttrow__n { width: 68px !important; }
.ttrow__rule { margin-top: 6px; font-size: 13px; }
.em-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.em-body { width: 100%; min-height: 320px; line-height: 1.5; }
.em-preview { white-space: pre-wrap; font: inherit; line-height: 1.5; margin: 8px 0 0; padding: 14px 16px; background: var(--sunken); border: 1px solid var(--line); border-radius: 10px; overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .em-grid { grid-template-columns: minmax(0, 1fr); }
  .ttrow { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .ttrow__move { flex-direction: row; }
  .tpl-item--edit { grid-template-columns: 1fr; }
}

.ttrow__mailrow { margin-top: 8px; }
.ttrow__mail { display: inline-flex; align-items: center; gap: 6px; }
.ttrow__mail.is-set { border-color: var(--accent, currentColor); font-weight: 600; }
.item__mail { display: inline-flex; }

.tag--pink { background: #fbe3ec; color: #a8325f; }
@media (prefers-color-scheme: dark) { .tag--pink { background: #3b2030; color: #f0a0c0; } }
