/* thePlanner layout. Colours, sizes and fonts come only from thePhaze tokens (var(--ph-*)). */
.ph-danger { color: var(--ph-danger); }
.small { font-size: var(--ph-text-xs); }
.mono { font-family: var(--ph-font-mono); }
.center { text-align: center; }
.wide { width: 100%; margin-top: var(--ph-space-lg); }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--ph-text); cursor: pointer; text-align: left; }
.link:hover { color: var(--ph-accent); }
.loading { padding: var(--ph-space-xl) 0; }
.partof { text-align: center; padding: var(--ph-space-lg) 0 calc(var(--ph-nav-height) + var(--ph-space-lg)); }
@media (min-width: 900px) { .partof { padding-bottom: var(--ph-space-lg); } }
.switcher { max-width: 45vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-icon { font-size: var(--ph-text-lg); line-height: 1; }

.view-head { margin-bottom: var(--ph-space-md); }
.view-head h1 { font-size: var(--ph-text-xxl); margin: var(--ph-space-sm) 0 var(--ph-space-xs); letter-spacing: -0.02em; }
.view-head p { margin: 0 0 var(--ph-space-md); }
.head-row { display: flex; align-items: center; gap: var(--ph-space-sm); flex-wrap: wrap; }
.row-actions { display: flex; gap: var(--ph-space-sm); justify-content: flex-end; align-items: center; margin-top: var(--ph-space-lg); flex-wrap: wrap; }

/* Rows */
.rows { display: grid; gap: var(--ph-space-sm); }
.phaser-row { display: flex; gap: var(--ph-space-md); align-items: flex-start; padding: var(--ph-space-md); }
.phaser-row .ph-check { margin-top: 1px; }
.row-body { flex: 1; min-width: 0; }
.row-title { font-weight: var(--ph-weight-medium); overflow-wrap: anywhere; }
.is-done .row-title, .check-title.is-done { color: var(--ph-text-faint); text-decoration: line-through; }
.row-chips { display: flex; flex-wrap: wrap; gap: var(--ph-space-xs); margin-top: var(--ph-space-xs); }
.ph-chip.overdue { color: var(--ph-danger); }
.ph-chip.tag::before { content: "#"; opacity: .6; }
.row-progress { display: flex; align-items: center; gap: var(--ph-space-sm); margin-top: var(--ph-space-sm); }
.row-progress .ph-progress { flex: 1; max-width: 220px; }
.dragging { opacity: .5; }
.done-group { margin-top: var(--ph-space-md); }
.done-group summary { cursor: pointer; list-style: none; }

.grid { display: grid; gap: var(--ph-space-sm); grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.project-card { display: flex; align-items: center; gap: var(--ph-space-md); }
.project-dot { width: 12px; height: 12px; }

.segmented, .chips-scroll { display: flex; gap: var(--ph-space-xs); overflow-x: auto; padding: var(--ph-space-xs) 0; scrollbar-width: none; }
.chips-scroll::-webkit-scrollbar { display: none; }
.chips-wrap { display: flex; gap: var(--ph-space-xs); flex-wrap: wrap; }
.segmented .ph-chip, .chips-scroll .ph-chip { min-height: 36px; padding: 0 var(--ph-space-md); }
.saved { display: inline-flex; }
.filters { display: grid; gap: var(--ph-space-sm); grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); margin: var(--ph-space-sm) 0; }

/* Board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(280px, 1fr); gap: var(--ph-space-md); overflow-x: auto; padding-bottom: var(--ph-space-md);
  scroll-snap-type: x mandatory; }
.lane { background: var(--ph-surface2); border-radius: var(--ph-radius-md); padding: 0 var(--ph-space-sm) var(--ph-space-sm); min-height: 200px; scroll-snap-align: start; }
.lane .ph-section { margin-top: var(--ph-space-md); }
.lane.drop { outline: 2px dashed var(--ph-accent); }

/* Calendar */
.cal-head { display: flex; align-items: center; gap: var(--ph-space-md); }
.cal-head h2 { margin: 0; font-size: var(--ph-text-lg); }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--ph-border); border: 1px solid var(--ph-border);
  border-radius: var(--ph-radius-md); overflow: hidden; margin-top: var(--ph-space-md); }
.dow { background: var(--ph-surface2); font-size: var(--ph-text-xs); color: var(--ph-text-muted); padding: var(--ph-space-xs); text-align: center; }
.day { background: var(--ph-surface); min-height: 84px; padding: var(--ph-space-xs); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.day.other { background: var(--ph-bg); color: var(--ph-text-faint); }
.day.today .day-num { background: var(--ph-accent); color: var(--ph-on-accent); border-radius: var(--ph-radius-pill); padding: 0 6px; }
.day-num { font-size: var(--ph-text-xs); align-self: flex-start; }
.cal-item { border: 0; border-left: 3px solid var(--ph-status); background: var(--ph-surface2); color: var(--ph-text); font: inherit; font-size: var(--ph-text-xs);
  text-align: left; padding: 2px 4px; border-radius: var(--ph-radius-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
@media (max-width: 600px) { .day { min-height: 56px; } .cal-item { font-size: 10px; } }

/* Detail sheet */
.detail { display: grid; gap: var(--ph-space-md); }
.detail-head { display: grid; gap: var(--ph-space-xs); }
.crumbs { font-size: var(--ph-text-xs); }
.title-input { font: inherit; font-size: var(--ph-text-xl); font-weight: var(--ph-weight-bold); border: 0; background: transparent; color: var(--ph-text);
  resize: none; width: 100%; padding: 0; field-sizing: content; }
.title-input:focus { outline: none; box-shadow: 0 2px 0 var(--ph-accent); }
.status-chip.ph-on { background: var(--ph-status); color: var(--ph-surface); }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ph-space-sm) var(--ph-space-md); }
.detail-field .ph-label { margin-top: 0; }
.template-fields { display: grid; gap: var(--ph-space-sm); }
.checklist { display: grid; gap: 2px; margin: var(--ph-space-sm) 0; }
.check-row { display: flex; align-items: center; gap: var(--ph-space-md); min-height: var(--ph-touch); }
.check-title { flex: 1; }
.collapsible { border-top: 1px solid var(--ph-border); }
.collapsible summary { cursor: pointer; margin: var(--ph-space-md) 0; }
.collapsible-body { padding-bottom: var(--ph-space-md); }
.link-row { display: flex; align-items: center; gap: var(--ph-space-sm); min-height: 40px; }
.history { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--ph-space-sm); font-size: var(--ph-text-sm); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ph-space-xs); }

/* Forms */
.quick-add h2 { margin-top: 0; }
.quick-add .ph-input { font-size: var(--ph-text-lg); }
.quick-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--ph-space-sm); margin-top: var(--ph-space-sm); }
.quick-row > .ph-btn { grid-column: span 2; }
.signin { max-width: 420px; margin: 8vh auto 0; display: grid; gap: var(--ph-space-xl); }
.signin-brand .ph-wordmark { font-size: var(--ph-text-xxl); }
.settings-card { display: grid; gap: var(--ph-space-md); }
.color { width: 48px; height: 36px; border: 1px solid var(--ph-border); border-radius: var(--ph-radius-sm); background: none; }
.key-row { display: flex; align-items: center; gap: var(--ph-space-md); }
.editor-list { display: grid; gap: var(--ph-space-sm); }
.editor-row { display: flex; gap: var(--ph-space-xs); align-items: center; }
.editor-row .ph-input { flex: 2; min-width: 0; }
.editor-row .ph-select { flex: 1; min-width: 0; }
.editor-row .unit { flex: 0 0 80px; }
@media (max-width: 600px) { .detail-grid, .quick-row { grid-template-columns: 1fr; } .quick-row > .ph-btn { grid-column: auto; } }

[hidden] { display: none !important; }
.ph-wordmark { text-decoration: none; color: var(--ph-text); }

/* Comments, files, notifications */
.comments { list-style: none; padding: 0; margin: 0 0 var(--ph-space-md); display: grid; gap: var(--ph-space-sm); }
.comment { background: var(--ph-surface2); border-radius: var(--ph-radius-md); padding: var(--ph-space-sm) var(--ph-space-md); }
.comment.is-ai { border-left: 3px solid var(--ph-ai); }
.comment-head { display: flex; align-items: center; gap: var(--ph-space-sm); flex-wrap: wrap; font-size: var(--ph-text-sm); }
.comment-body { margin: var(--ph-space-xs) 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.mention { color: var(--ph-accent); font-weight: var(--ph-weight-medium); }
.comment-compose .ph-textarea { min-height: 64px; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: var(--ph-space-sm); margin-bottom: var(--ph-space-sm); }
.file { margin: 0; }
.file img, .file-icon { display: grid; place-items: center; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--ph-radius-md);
  border: 1px solid var(--ph-border); background: var(--ph-surface2); color: var(--ph-text-muted); font-weight: var(--ph-weight-bold); text-decoration: none; }
.file figcaption { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.bell { position: relative; }
.bell .ph-badge { position: absolute; top: 4px; right: 2px; }
.notices { display: grid; gap: 2px; }
.notice { display: grid; grid-template-columns: auto 1fr; gap: 2px var(--ph-space-sm); align-items: center; text-align: left; border: 0; background: none;
  color: var(--ph-text); font: inherit; padding: var(--ph-space-sm); border-radius: var(--ph-radius-sm); cursor: pointer; }
.notice:hover { background: var(--ph-surface2); }
.notice.unread { background: color-mix(in srgb, var(--ph-accent) 8%, transparent); }
.notice > .ph-faint { grid-column: 2; }
.notice-text { overflow-wrap: anywhere; }

/* Smart import */
.import-text { min-height: 160px; font-family: var(--ph-font); }
.proposal, .proposal ol { list-style: none; padding-left: 0; margin: var(--ph-space-sm) 0; display: grid; gap: var(--ph-space-xs); }
.proposal ol { padding-left: var(--ph-space-xl); }
.proposal-row { display: flex; gap: var(--ph-space-xs); align-items: center; }
.proposal-row .ph-input { flex: 1; min-height: 40px; }
.proposal-row .type { flex: 0 0 150px; min-height: 40px; }

/* Voice */
.handsfree { display: grid; gap: var(--ph-space-md); text-align: center; }
.hf-step { font-size: var(--ph-text-xxl); font-weight: var(--ph-weight-bold); margin: var(--ph-space-lg) 0; min-height: 3em; }
.hf-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: var(--ph-space-sm); }
.hf-btn { min-height: 72px; font-size: var(--ph-text-lg); }
