/* House of Acts Calendar — mockup styles. Builds on tokens.css + components.css (BuildTrack Launch). */

body { background-image: var(--bt-mesh); background-attachment: fixed; }
[hidden] { display: none !important; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mt { margin-top: var(--bt-space-3); }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: var(--bt-space-3); font-weight: 700; font-size: var(--bt-text-md); letter-spacing: -0.01em; }
.brand b { background: var(--bt-gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand__mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--bt-radius-sm); background: var(--bt-accent-grad); color: #fff; font-size: 13px; font-weight: 800; box-shadow: 0 8px 20px rgba(79,124,255,.35); }
.brand--lg { font-size: var(--bt-text-lg); }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--bt-space-4); }
.login__card { width: min(420px, 100%); display: grid; gap: var(--bt-space-4); padding: var(--bt-space-8); backdrop-filter: blur(var(--bt-glass-blur)); box-shadow: var(--bt-shadow-2); animation: bt-view-in var(--bt-dur-slow) var(--bt-ease-out) both; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--bt-sidebar-w) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: var(--bt-space-6); padding: var(--bt-space-5); background: var(--bt-surface); backdrop-filter: blur(var(--bt-glass-blur)); border-right: 1px solid var(--bt-line); }
.nav { display: grid; gap: var(--bt-space-1); }
.nav__item { display: flex; align-items: center; gap: var(--bt-space-3); min-height: var(--bt-hit-min); padding: 0 var(--bt-space-4); border: 0; border-radius: var(--bt-radius-pill); background: none; color: var(--bt-text-muted); font: 600 var(--bt-text-sm) var(--bt-font-ui); cursor: pointer; text-align: left; transition: background-color var(--bt-dur-fast) var(--bt-ease-std), color var(--bt-dur-fast); }
.nav__item:hover { color: var(--bt-text); background: var(--bt-raised); }
.nav__item.is-active { color: var(--bt-text-on-accent); background: var(--bt-accent-grad); box-shadow: 0 8px 24px rgba(79,124,255,.35); }
.sidebar__foot { margin-top: auto; display: grid; gap: var(--bt-space-2); }
.who { display: flex; align-items: center; gap: var(--bt-space-3); font-size: var(--bt-text-sm); font-weight: 600; padding-bottom: var(--bt-space-2); min-width: 0; }
.who > div { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--bt-accent-soft); color: var(--bt-accent-text); font-size: 12px; font-weight: 800; }

.main { min-width: 0; }
.view { animation: bt-view-in var(--bt-dur-slow) var(--bt-ease-out) both; padding: 0 var(--bt-space-6) var(--bt-space-8); }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: var(--bt-space-3); flex-wrap: wrap; min-height: var(--bt-topbar-h); margin: 0 calc(var(--bt-space-6) * -1); padding: var(--bt-space-3) var(--bt-space-6); background: var(--bt-surface); backdrop-filter: blur(var(--bt-glass-blur)); border-bottom: 1px solid var(--bt-line); }
.topbar__left, .topbar__right { display: flex; align-items: center; gap: var(--bt-space-3); flex-wrap: wrap; }
.topbar h2 { font-size: var(--bt-text-lg); font-weight: 800; letter-spacing: -0.02em; }
.name-input { width: min(360px, 60vw); font-weight: 700; }

/* ---------- Editor controls ---------- */
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--bt-space-3); margin-top: var(--bt-space-5); }
.ctl-group { display: flex; gap: var(--bt-space-2); }
.ctl-group .bt-select { width: auto; min-width: 120px; padding-right: var(--bt-space-6); }
.seg { display: inline-flex; padding: 3px; border-radius: var(--bt-radius-pill); background: var(--bt-raised); border: 1px solid var(--bt-line); }
.seg button { min-height: 38px; padding: 0 var(--bt-space-4); border: 0; border-radius: var(--bt-radius-pill); background: none; color: var(--bt-text-muted); font: 600 var(--bt-text-sm) var(--bt-font-ui); cursor: pointer; transition: all var(--bt-dur-base) var(--bt-ease-snap); }
.seg button[aria-pressed="true"] { background: var(--bt-accent-grad); color: #fff; box-shadow: 0 6px 16px rgba(79,124,255,.35); }

.toolbar { position: sticky; top: calc(var(--bt-topbar-h) + 8px); z-index: 15; display: flex; flex-wrap: wrap; align-items: center; gap: var(--bt-space-2); margin-top: var(--bt-space-4); padding: var(--bt-space-2) var(--bt-space-3); border-radius: var(--bt-radius-md); background: var(--bt-surface); backdrop-filter: blur(var(--bt-glass-blur)); border: 1px solid var(--bt-line); box-shadow: var(--bt-shadow-2); }
.toolbar .bt-select { width: auto; min-height: 38px; }
.tb-font { min-width: 170px; }
.tb-size { min-width: 72px; }
.tb-btn { display: inline-grid; place-items: center; min-width: 38px; height: 38px; padding: 0 var(--bt-space-2); border: 1px solid transparent; border-radius: var(--bt-radius-sm); background: none; color: var(--bt-text); font: 600 16px Georgia, serif; cursor: pointer; transition: background-color var(--bt-dur-fast); }
.tb-btn--text { font: 600 var(--bt-text-sm) var(--bt-font-ui); color: var(--bt-text-muted); }
.tb-btn:hover { background: var(--bt-raised); }
.tb-btn.is-on { background: var(--bt-accent-soft); color: var(--bt-accent-text); border-color: color-mix(in srgb, var(--bt-accent) 40%, transparent); }
.tb-sep { width: 1px; height: 24px; background: var(--bt-line-strong); margin: 0 var(--bt-space-1); }
.swatches { display: flex; gap: 4px; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--bt-line-strong); cursor: pointer; padding: 0; transition: transform var(--bt-dur-fast) var(--bt-ease-snap); }
.swatch:hover { transform: scale(1.15); }
.tb-color { position: relative; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px dashed var(--bt-line-strong); color: var(--bt-text-muted); cursor: pointer; font-weight: 700; }
.tb-color input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.tb-target { margin-left: auto; }

/* ---------- Paper (the printable calendar) ---------- */
.paper-area { margin-top: var(--bt-space-5); padding: var(--bt-space-6); border-radius: var(--bt-radius-lg); background: color-mix(in srgb, var(--bt-raised) 55%, transparent); border: 1px solid var(--bt-line); }
.sheet-wrap { position: relative; margin: 0 auto; }
.page {
  --pgw: 11in; --pgh: 8.5in;
  position: absolute; top: 0; left: 0; width: var(--pgw); height: var(--pgh); padding: 0.35in; transform-origin: 0 0;
  background: #fff; box-shadow: 0 30px 80px rgba(2,6,23,.55), 0 0 0 1px rgba(0,0,0,.08);
}
.page.is-portrait { --pgw: 8.5in; --pgh: 11in; }
.sheet {
  --pw: 10.3in; --ph: 7.8in;
  position: relative; width: var(--pw); height: var(--ph);
  display: flex; flex-direction: column; padding: 0.15in 0.2in 0.2in;
  background: #fff; color: #000;
  font-family: "Times New Roman", Times, serif; font-size: 12pt; line-height: 1.15;
  color-scheme: light;
}
.sheet.is-portrait { --pw: 7.8in; --ph: 10.3in; }
.sh-head { text-align: center; padding-bottom: 0.08in; max-height: 38%; overflow: hidden; transform-origin: top center; position: relative; }
.sh-head.is-overflow { box-shadow: inset 0 0 0 2px #D97706; background: #FEF3C7; }
.sh-month { font: 700 24pt "Times New Roman", serif; }
.sh-title { font: 700 22pt "Times New Roman", serif; }
.sh-notes { font: italic 11pt "Times New Roman", serif; margin-top: 0.06in; }
.rt { outline: none; border-radius: 3px; min-height: 1em; transition: box-shadow var(--bt-dur-fast); overflow-wrap: anywhere; }
.rt:hover { box-shadow: 0 0 0 1px rgba(79,124,255,.35); }
.rt:focus { box-shadow: 0 0 0 2px rgba(79,124,255,.85); }
.rt:empty::before { content: attr(data-ph); color: #9aa3b5; font-style: italic; font-weight: 400; }

.sh-grid { flex: 1; width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.sh-grid th { height: 0.36in; font: 700 13pt Arial, Helvetica, sans-serif; border-top: 3px solid #000; border-bottom: 3px solid #000; }
.sh-grid th + th { border-left: 1px dashed #bbb; }
.sh-grid td { position: relative; vertical-align: top; border-right: 1px solid #000; border-bottom: 1px solid #000; padding: 3px 5px; overflow: hidden; }
.sh-grid td.is-overflow { background: #FEF3C7; box-shadow: inset 0 0 0 2px #D97706; }
.sh-grid .cell { height: var(--cellh, auto); overflow: hidden; position: relative; }
.fit-note { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 1px 4px; background: #D97706; color: #fff; font: 600 7.5pt Arial, sans-serif; text-align: center; pointer-events: none; }
.dbox { transform-origin: top left; }
.sh-grid td:first-child { border-left: 1px solid #000; }
.sh-grid td.is-out { background: #fff; }
.dnum { font: 700 12pt "Times New Roman", serif; line-height: 1.1; user-select: none; }
.dbox { font: 700 12pt "Times New Roman", serif; min-height: calc(100% - 1.2em); }
.sh-grid td .dbox:empty::before { content: ""; }
.sh-grid td:hover .dbox:empty::before { content: "Type here"; color: #9aa3b5; font-weight: 400; font-style: italic; font-size: 10pt; }

/* ---------- In-app print preview ---------- */
.preview-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--bt-space-3); flex-wrap: wrap; margin-top: var(--bt-space-5); padding: var(--bt-space-3) var(--bt-space-4); border-radius: var(--bt-radius-md); background: var(--bt-surface); border: 1px solid var(--bt-line); box-shadow: var(--bt-shadow-2); }
.is-preview .controls, .is-preview .toolbar, .is-preview #previewBtn, .is-preview #newCal { display: none !important; }
.is-preview .paper-area { background: #6b7280; border-color: transparent; }
.is-preview .page { box-shadow: 0 20px 50px rgba(0,0,0,.45); }
.is-preview .rt, .is-preview .rt:hover, .is-preview .rt:focus { box-shadow: none !important; }
.is-preview .rt:empty::before, .is-preview .sh-grid td:hover .dbox:empty::before { content: "" !important; }
.pdf-render .rt:empty::before, .pdf-render .sh-grid td .dbox:empty::before, .pdf-render .sh-grid td:hover .dbox:empty::before { content: "" !important; }
.pdf-render .rt { box-shadow: none !important; }

/* ---------- Directory ---------- */
.dir-body, .admin-body { display: grid; gap: var(--bt-space-5); margin-top: var(--bt-space-5); }
.search { position: relative; display: flex; align-items: center; width: min(420px, 80vw); }
.search svg { position: absolute; left: 14px; color: var(--bt-text-faint); }
.search .bt-input { padding-left: 42px; border-radius: var(--bt-radius-pill); }
.dir-year { display: flex; align-items: center; gap: var(--bt-space-3); }
.dir-year .bt-btn--icon { width: 40px; font-size: 20px; }
.dir-year__label { font-size: var(--bt-text-xl); font-weight: 800; letter-spacing: -0.03em; min-width: 80px; text-align: center; }
.months { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--bt-space-3); }
.month-tile { display: grid; gap: 2px; padding: var(--bt-space-4); text-align: left; cursor: pointer; color: var(--bt-text); font: inherit; background: var(--bt-surface); border: 1px solid var(--bt-line); border-radius: var(--bt-radius-md); box-shadow: var(--bt-shadow-1); transition: transform var(--bt-dur-fast) var(--bt-ease-out), box-shadow var(--bt-dur-fast), border-color var(--bt-dur-fast); }
.month-tile:hover { transform: translateY(-3px); box-shadow: var(--bt-shadow-lift); }
.month-tile.is-active { border-color: var(--bt-accent); box-shadow: 0 0 0 3px var(--bt-accent-soft), var(--bt-shadow-1); }
.month-tile.is-current .month-tile__name::after { content: " · this month"; color: var(--bt-accent-text); font-weight: 600; font-size: var(--bt-text-xs); }
.month-tile__name { font-weight: 700; }
.month-tile__count { font-size: var(--bt-text-xs); color: var(--bt-text-muted); }
.month-tile.is-empty .month-tile__count { color: var(--bt-text-faint); }
.row-actions { display: flex; gap: var(--bt-space-1); justify-content: flex-end; }
.row-actions .bt-btn { min-height: 34px; padding: 0 var(--bt-space-3); }
.bt-table tbody tr.clickable { cursor: pointer; }
.empty { padding: var(--bt-space-6); text-align: center; color: var(--bt-text-muted); }
mark { background: var(--bt-accent-soft); color: var(--bt-accent-text); border-radius: 3px; padding: 0 2px; }

/* ---------- Admin ---------- */
.bt-tabs__ink { left: 0; }
.audit-filters { display: flex; gap: var(--bt-space-3); margin-bottom: var(--bt-space-3); flex-wrap: wrap; }
.audit-filters .bt-input { flex: 1; min-width: 220px; }
.audit-filters .bt-select { width: auto; min-width: 200px; }
.temp-pass { display: flex; align-items: center; justify-content: space-between; gap: var(--bt-space-3); padding: var(--bt-space-3) var(--bt-space-4); border-radius: var(--bt-radius-sm); background: var(--bt-raised); border: 1px solid var(--bt-line-strong); font-family: var(--bt-font-data); font-size: var(--bt-text-md); }

/* ---------- Per-file history ---------- */
.hist { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; display: grid; }
.hist li { display: flex; align-items: baseline; gap: var(--bt-space-2); padding: var(--bt-space-2) var(--bt-space-1); border-bottom: 1px solid var(--bt-line); font-size: var(--bt-text-sm); }
.hist li:last-child { border-bottom: 0; }
.hist__who { font-weight: 700; }
.hist__when { margin-left: auto; color: var(--bt-text-muted); white-space: nowrap; }

/* ---------- Modal ---------- */
.bt-modal { backdrop-filter: blur(24px); display: grid; gap: var(--bt-space-4); }
.bt-modal h3 { font-weight: 800; letter-spacing: -0.02em; }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--bt-space-2); margin-top: var(--bt-space-2); }

/* ---------- Motion: entrances, month swap, save flash ---------- */
@keyframes hoa-pop { from { opacity: 0; transform: translateY(var(--bt-rise)) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes hoa-swap-out { to { opacity: 0; transform: translateY(calc(var(--bt-rise) * -0.6)) scale(.99); } }
@keyframes hoa-save-flash {
  0% { box-shadow: 0 0 0 0 rgba(245,197,66,.0), 0 30px 80px rgba(2,6,23,.55); }
  30% { box-shadow: 0 0 0 6px rgba(245,197,66,.55), 0 0 60px rgba(245,197,66,.45); }
  100% { box-shadow: 0 0 0 0 rgba(245,197,66,0), 0 30px 80px rgba(2,6,23,.55); }
}
.controls, .toolbar, .paper-area { animation: hoa-pop var(--bt-dur-slow) var(--bt-ease-out) both; }
.toolbar { animation-delay: 60ms; }
.paper-area { animation-delay: 120ms; }
.sheet.is-swapping { animation: hoa-swap-out var(--bt-dur-base) var(--bt-ease-in) both; }
.sheet.is-arriving { animation: hoa-pop var(--bt-dur-slow) var(--bt-ease-out) both; }
.page.save-flash { animation: hoa-save-flash 900ms var(--bt-ease-out); }
.stagger > * { animation: bt-rise var(--bt-dur-slow) var(--bt-ease-out) both; animation-delay: calc(var(--i, 0) * var(--bt-stagger)); }
.no-anim .stagger > *, .no-anim.stagger > * { animation: none; }
.dirty-pop { animation: bt-toast-in var(--bt-dur-base) var(--bt-ease-snap) both; }
.swatch:active { transform: scale(.9); }
.tb-btn:active { transform: scale(.92); }
.nav__item { transition: background-color var(--bt-dur-fast) var(--bt-ease-std), color var(--bt-dur-fast), transform var(--bt-dur-base) var(--bt-ease-snap); }
.nav__item.is-active { animation: hoa-pop var(--bt-dur-base) var(--bt-ease-snap) both; }
@media (prefers-reduced-motion: reduce) {
  .controls, .toolbar, .paper-area, .sheet.is-swapping, .sheet.is-arriving, .page.save-flash, .stagger > *, .dirty-pop, .nav__item.is-active { animation: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; z-index: 30; height: auto; flex-direction: row; align-items: center; padding: var(--bt-space-2) var(--bt-space-4); border-right: 0; border-bottom: 1px solid var(--bt-line); gap: var(--bt-space-3); overflow-x: auto; }
  .sidebar .brand span:last-child, .who > div, .sidebar__foot #themeBtn { display: none; }
  .nav { display: flex; }
  .sidebar__foot { margin: 0 0 0 auto; display: flex; align-items: center; }
  .who { padding: 0; }
  .view { padding: 0 var(--bt-space-4) var(--bt-space-6); }
  .topbar { margin: 0 calc(var(--bt-space-4) * -1); padding: var(--bt-space-3) var(--bt-space-4); top: 61px; }
  .toolbar { position: static; }
  .months { grid-template-columns: repeat(3, 1fr); }
  .paper-area { padding: var(--bt-space-3); }
  .tb-target { display: none; }
}
@media (max-width: 520px) { .months { grid-template-columns: repeat(2, 1fr); } .nav__item { padding: 0 var(--bt-space-3); font-size: 0; gap: 0; } .nav__item svg { width: 20px; height: 20px; } }

/* Overflow warnings are screen-only guidance: print and PDF show the shrunk text, clipped at the box edge. */
@media print {
  .sh-head.is-overflow, .sh-grid td.is-overflow { background: #fff !important; box-shadow: none !important; }
  .fit-note { display: none !important; }
}
.pdf-render .sh-head.is-overflow, .pdf-render .sh-grid td.is-overflow { background: #fff !important; box-shadow: none !important; }
.pdf-render .fit-note { display: none !important; }

/* ---------- Print: only the sheet, actual size ---------- */
@media print {
  :root, :root[data-theme] { color-scheme: light !important; }
  html, body { background: #fff !important; height: auto; }
  body * { visibility: hidden; }
  .sheet, .sheet * { visibility: visible; }
  .no-print, .bt-toasts, .bt-scrim, .bt-modal { display: none !important; }
  .shell { display: block; }
  .view, .paper-area { padding: 0 !important; margin: 0 !important; border: 0 !important; background: none !important; animation: none !important; }
  .sheet-wrap { width: auto !important; height: auto !important; }
  .page { position: static; transform: none !important; width: auto; height: auto; padding: 0; box-shadow: none !important; }
  .sheet { position: static; transform: none !important; box-shadow: none; padding: 0; margin: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .rt, .rt:focus { box-shadow: none !important; }
  .rt:empty::before, .sh-grid td:hover .dbox:empty::before { content: "" !important; }
}
