:where(button, .button) {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: #ffffff;
  background: var(--accent);
  font-weight: 700;
  text-decoration: none;
}
:where(button, .button):hover:not(:disabled) { background: var(--accent-hover); }
:where(button, .button):disabled { cursor: default; opacity: 0.48; }
.button-secondary {
  border-color: var(--line-strong);
  color: var(--accent);
  background: var(--surface);
}
.button-secondary:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-hover); background: var(--accent-soft); }
.button-danger { color: #ffffff; background: var(--danger); }
.button-danger:hover:not(:disabled) { background: #8b342f; }
.button-quiet { min-height: 36px; padding: 6px 10px; border-color: transparent; color: var(--info); background: transparent; }
.button-quiet:hover:not(:disabled) { color: var(--ink); background: var(--surface-subtle); }
.button-small { min-height: 32px; padding: 4px 9px; font-size: 13px; }

label { color: var(--ink-secondary); font-size: 14px; }
input, select {
  min-width: 0;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
}
input::placeholder { color: var(--muted); }
input:disabled, select:disabled { color: var(--muted); background: var(--surface-subtle); }

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--ink-secondary);
  background: var(--surface-subtle);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.status-pill.success { color: var(--success); background: #e6f1ea; }
.status-pill.warning { color: var(--warning); background: #f7efe1; }
.status-pill.danger { color: var(--danger); background: var(--danger-soft); }

.feedback { min-height: 20px; margin: 12px 0 0; color: var(--ink-secondary); font-size: 14px; }
.feedback[data-tone="success"] { color: var(--success); }
.feedback[data-tone="warning"] { color: var(--warning); }
.feedback[data-tone="error"] { color: var(--danger); }

.toast-region {
  position: fixed;
  top: 72px;
  right: 20px;
  z-index: 80;
  display: grid;
  width: min(360px, calc(100% - 32px));
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--info);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 14px;
  line-height: 1.5;
}
.toast.success { border-left-color: var(--success); }
.toast.warning { border-left-color: var(--warning); }
.toast.error { border-left-color: var(--danger); }

.table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
.data-table th, .data-table td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table th { color: var(--muted); font-weight: 650; white-space: nowrap; }
.data-table td { color: var(--ink); }
.data-table tbody tr:hover { background: rgba(230, 240, 236, 0.42); }
.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.empty-row td { padding: 32px 10px; color: var(--muted); text-align: center; }

.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.pagination-output { min-width: 72px; color: var(--muted); text-align: center; font-size: 13px; }

.dialog {
  width: min(480px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(23, 35, 31, 0.46); }
.dialog-header { display: flex; align-items: start; justify-content: space-between; gap: 16px; padding: 20px 20px 14px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 0; font-size: 18px; }
.dialog-close { min-width: 36px; min-height: 36px; padding: 4px; font-size: 22px; line-height: 1; }
.dialog-body { padding: 18px 20px; }
.dialog-body p { margin-top: 0; color: var(--ink-secondary); line-height: 1.6; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 20px; }

@media (max-width: 680px) {
  .toast-region { top: 64px; right: 16px; }
  .responsive-table { min-width: 0 !important; }
  .responsive-table thead { display: none; }
  .responsive-table tbody { display: grid; gap: 10px; padding-top: 10px; }
  .responsive-table tr:not(.empty-row) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px 16px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
  }
  .responsive-table td {
    min-width: 0;
    padding: 0;
    border: 0;
    overflow-wrap: anywhere;
  }
  .responsive-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
  }
  .responsive-table td[data-primary="true"] { grid-column: 1 / -1; font-size: 14px; font-weight: 700; }
  .responsive-table td.row-actions { grid-column: 1 / -1; justify-content: flex-start; padding-top: 8px; border-top: 1px solid var(--line); }
  .responsive-table .empty-row { display: table-row; }
  .responsive-table .empty-row td { display: table-cell; }
  .responsive-table .empty-row td::before { display: none; }
  .pagination { justify-content: space-between; }
}
