.btn, .btn-primary, .btn-ghost, .btn-danger, .btn-text, .icon-btn,
summary, .menu button, .mobile-nav button, .sidebar button, .calendar-day {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  max-width: 100%;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r1);
  background: var(--surface);
  font-size: .875rem;
  font-weight: 640;
  line-height: 1.4;
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
  transition: background var(--speed), border-color var(--speed), transform var(--speed);
}
:is(.btn, .btn-ghost, summary, .icon-btn, .calendar-day):hover { background: var(--soft); }
:is(.btn, .btn-primary, .btn-danger, .btn-text, .icon-btn):active { transform: translateY(1px); }
.btn-primary, .btn.primary {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}
.btn-primary:hover, .btn.primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--risk); border-color: currentColor; }
.btn-danger:hover { background: var(--risk-bg); }
.btn-text, .btn-ghost, .icon-btn { border-color: transparent; }
button:disabled { opacity: .55; cursor: default; }
button[aria-pressed="true"] { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
button[aria-busy="true"] { cursor: progress; opacity: .7; }
.brand { display: inline-flex; min-height: 44px; align-items: center; gap: 10px; font-size: 1.25rem; font-weight: 700; text-decoration: none; }
.brand img { width: 34px; height: 34px; }
.card, article.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r2); padding: clamp(16px, 2vw, 24px); min-width: 0; }
.raised { box-shadow: var(--s1); }
.stack, .form { display: grid; gap: 16px; }
.row, .actions, .head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.head { justify-content: space-between; margin: 8px 0 24px; gap: 16px; }
.head :is(h1,h2,h3) { margin: 0; }
.two, .three, .four { display: grid; gap: 16px; align-items: stretch; }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.badge { display: inline-flex; align-items: center; gap: 4px; background: var(--soft); padding: 3px 9px; border-radius: 24px; font-size: .8125rem; }
.badge svg.lucide { width: 15px; height: 15px; }
.info { background: var(--info-bg); color: var(--info); }
.success { background: var(--success-bg); color: var(--success); }
.warn { background: var(--warn-bg); color: var(--warn); }
.risk { background: var(--risk-bg); color: var(--risk); }
.indigo { background: var(--primary-soft); color: var(--primary); }
.slate { background: var(--slate-bg); color: var(--slate); }
.rose { background: var(--rose-bg); color: var(--rose); }
.entry { padding: 12px 0; border-bottom: 1px solid var(--line); }
.entry:last-child { border: 0; }
.entry p { white-space: pre-line; }
.empty { display: grid; gap: 8px; justify-items: start; color: var(--muted); padding: 16px 0; }
.empty > svg.lucide { color: var(--primary); background: var(--primary-soft); border-radius: 12px; padding: 10px; width: 44px; height: 44px; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 12; width: max-content; min-width: 176px; max-width: 86vw; padding: 8px; display: grid; background: var(--surface); box-shadow: var(--s2); border: 1px solid var(--line); border-radius: var(--r2); max-height: 70dvh; overflow: auto; }
.menu > * { justify-content: flex-start; text-align: left; }
.menu > button, .menu > a { min-height: 44px; border-color: transparent; }
.menu > button:hover, .menu > a:hover { background: var(--soft); }
.menu a { display: flex; align-items: center; padding: 8px 14px; }
dialog { color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r3); padding: 24px; width: min(680px, 94vw); max-height: 88dvh; box-shadow: var(--s3); }
dialog::backdrop { background: var(--veil); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.dlg-head h2 { margin: 0; }
.err { color: var(--risk); white-space: pre-line; }
.err:not(:empty)::before { content: "⚠ "; }
.err:empty { display: none; }
.preview { max-height: 40vh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--soft); padding: 16px; border-radius: var(--r1); font: .875rem/1.6 var(--font); }
.rule { color: var(--muted); font-size: .875rem; }
.actions { margin: 4px 0; }
label.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
#toast:not(:empty) { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); width: max-content; max-width: 85vw; background: var(--toast); color: var(--on-toast); border-radius: var(--r2); padding: 12px 16px; z-index: 25; }
#toast:not(:empty)::before { content: "ⓘ "; }
progress { width: 100%; accent-color: var(--primary); height: 9px; }
details.explain > summary { display: flex; justify-content: space-between; text-align: left; }
details.explain > p { margin: 8px 0; }
#print-area { display: none; }
@media (max-width: 850px) { .four, .three { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .two, .three, .four { grid-template-columns: 1fr; }
  .four.metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  dialog { width: 100%; max-width: 100%; max-height: 88dvh; margin: auto 0 0; border-radius: var(--r3) var(--r3) 0 0; padding: 16px; }
  dialog::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 4px; margin: 0 auto 12px; background: var(--line-strong); }
  #toast:not(:empty) { bottom: 84px; }
}