/* PersonalOS 20 — Phase 4: Shared Component Library.
   Additive semantic skin. No component markup or application state is changed. */
:root {
  --pos20-component-focus: var(--pos20-focus-ring);
  --pos20-component-control: var(--pos20-control-height-md);
  --pos20-component-gap: var(--pos20-space-3);
}
:where(button, input, select, textarea) { font: inherit; }
:where(button, [role="button"], a, input, select, textarea, [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--pos20-component-focus);
}
:where(.btn, .btn-primary, .primary-button, .quick-add-button, .today-button, .icon-button) {
  transition: background-color var(--pos20-motion-fast) var(--pos20-motion-ease),
              border-color var(--pos20-motion-fast) var(--pos20-motion-ease),
              color var(--pos20-motion-fast) var(--pos20-motion-ease),
              box-shadow var(--pos20-motion-fast) var(--pos20-motion-ease),
              transform var(--pos20-motion-fast) var(--pos20-motion-ease);
}
:where(.btn, .btn-primary, .primary-button) { min-height: var(--pos20-component-control); border-radius: var(--pos20-radius-sm); }
:where(.btn-primary, .primary-button) { box-shadow: var(--pos20-elevation-1); }
:where(.btn-primary, .primary-button):active { transform: translateY(1px); }
:where(.card, .dashboard-card, .chart-card, .kpi-card, .document-card, .learning-card, .module-intro-card, .p18-card) {
  border-color: var(--pos20-color-border);
  border-radius: var(--pos20-radius-lg);
  box-shadow: var(--pos20-elevation-1);
}
:where(.card-header, .card-title-group) { border-color: var(--pos20-color-border); }
:where(.badge, .chip, .tag, .module-badge) {
  border-radius: var(--pos20-radius-xl);
  border-color: var(--pos20-color-border);
}
:where(.form-control, .input-control, .select-control, .textarea-control, input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]), select, textarea) {
  accent-color: var(--pos20-color-accent);
}
:where(.form-control, .input-control, .select-control, .textarea-control) {
  border-color: var(--pos20-color-border);
  border-radius: var(--pos20-radius-sm);
  transition: border-color var(--pos20-motion-fast) ease, box-shadow var(--pos20-motion-fast) ease;
}
:where(.form-control, .input-control, .select-control, .textarea-control):focus {
  border-color: var(--pos20-color-accent);
  box-shadow: var(--pos20-component-focus);
}
:where(.data-table, .p2-table, .p4-table, .os7-chemical-table) { border-color: var(--pos20-color-border); }
:where(.data-table th, .p2-table th, .p4-table th, .os7-chemical-table th) {
  color: var(--pos20-color-text);
  border-color: var(--pos20-color-border);
}
:where(.data-table td, .p2-table td, .p4-table td, .os7-chemical-table td) { border-color: var(--pos20-color-border); }
:where(.dropdown-menu, .account-popover, .modal-card, .modal-content, .dialog, .drawer-panel, .p3-modal-card, .p4-modal) {
  border-color: var(--pos20-color-border);
  border-radius: var(--pos20-radius-lg);
  box-shadow: var(--pos20-elevation-2);
}
:where(.modal-layer, .modal-backdrop, .p3-modal-backdrop) { overscroll-behavior: contain; }
:where(.empty-state, .empty-widget, .p2-empty, .p3-empty-state, .p4-empty) { color: var(--pos20-color-muted); }
:where(.nav-submenu, .dropdown-menu) { border-color: var(--pos20-color-border); }
:where(.p2-tabs, .p4-tabs, .p3-work-tabs) { border-color: var(--pos20-color-border); }
:where(.p2-tab, .p4-tab, .p11-learning-tab) { transition: color var(--pos20-motion-fast) ease, background-color var(--pos20-motion-fast) ease; }
:where(.form-hint, .p3-form-hint, .p4-form-hint) { color: var(--pos20-color-muted); }
:where(.form-error, .p4-form-error, [aria-invalid="true"]) { color: var(--pos20-color-danger); }
:where(.checked, [aria-checked="true"]) { accent-color: var(--pos20-color-accent); }
html[data-p20-material="glass"] :where(.dropdown-menu, .account-popover, .modal-card, .dialog) {
  background: color-mix(in srgb, var(--pos20-color-surface) 88%, transparent);
  backdrop-filter: blur(18px) saturate(140%);
}
html[data-p20-material="paper"] :where(.card, .dashboard-card, .modal-card) { box-shadow: none; }
html[data-p20-geometry="hard-edge"] :where(.card, .dashboard-card, .modal-card, .dialog, .btn, .input-control) { border-radius: 3px; }
html[data-p20-depth="hard-shadow"] :where(.card, .dashboard-card, .modal-card) { box-shadow: var(--pos20-elevation-1); }
@media (max-width: 640px) {
  :where(.modal-card, .modal-content, .dialog) { max-width: calc(100vw - 20px); }
  :where(.data-table-wrap, .p2-table-wrap, .p4-table-scroll) { max-width: 100%; overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) {
  :where(.btn, .btn-primary, .primary-button, .card, .p2-tab, .p4-tab) { transition: none !important; }
}
