:where(.ui-panel) {
  border: 1px solid var(--ui-color-line);
  border-radius: var(--ui-radius-lg);
  background: var(--ui-color-surface);
  box-shadow: var(--ui-shadow-soft);
}

:where(.ui-button) {
  min-height: var(--ui-control-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--ui-space-3);
  border: 0;
  border-radius: var(--ui-radius-sm);
  background: var(--ui-gradient-brand);
  color: #fff;
  font: 800 12px var(--ui-font-family);
  text-decoration: none;
  cursor: pointer;
}

:where(.ui-button--secondary) {
  border: 1px solid var(--ui-color-line);
  background: var(--ui-color-surface-soft);
  color: var(--ui-color-text);
}

:where(.ui-field) {
  min-width: 0;
  display: grid;
  gap: var(--ui-space-1);
}

:where(.ui-field > label) {
  color: var(--ui-color-text);
  font: 800 11px/1.35 var(--ui-font-family);
}

:where(.ui-control) {
  width: 100%;
  min-width: 0;
  min-height: var(--ui-control-height);
  padding: 5px 9px;
  border: 1px solid var(--ui-color-line);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-color-surface);
  color: var(--ui-color-text);
  font: 700 12px var(--ui-font-family);
}

:where(.ui-alert) {
  padding: 10px 12px;
  border: 1px solid var(--ui-color-line);
  border-radius: var(--ui-radius-md);
  background: var(--ui-color-surface-soft);
  color: var(--ui-color-text);
  font-weight: 800;
}

:where(.ui-alert--success) { color: var(--ui-color-success); }
:where(.ui-alert--warning) { color: var(--ui-color-warning); }
:where(.ui-alert--danger) { color: var(--ui-color-danger); }

/* Shared interactive components rendered by the application runtime. */
:where(.smart-select-list, .project-date-picker) {
  border: 1px solid var(--ui-color-line);
  border-radius: var(--ui-radius-md);
  background: var(--ui-color-surface);
  color: var(--ui-color-text);
  box-shadow: var(--ui-shadow-modal);
}

:where(.smart-select-option, .smart-select-empty) {
  border-radius: var(--ui-radius-sm);
  color: var(--ui-color-text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.6;
}

:where(.smart-select-option:hover, .smart-select-option.is-selected, .smart-select-option.is-active) {
  background: var(--ui-color-row-hover);
  color: var(--ui-color-primary-strong);
}

:where(.smart-select-empty) {
  color: var(--ui-color-muted);
}

:where(.project-date-picker-week) {
  color: var(--ui-color-muted);
  font-size: 11px;
  font-weight: 800;
}

:where(.project-date-picker-day) {
  border: 0;
  background: var(--ui-color-surface-soft);
  color: var(--ui-color-text);
  box-shadow: none;
}

:where(.project-date-picker-day:hover, .project-date-picker-day.is-selected) {
  background: var(--ui-gradient-brand);
  color: var(--ui-color-surface);
}

/* The approved date picker is a shared control, not an application-shell detail. */
.project-date-picker[hidden] { display: none !important; }
.project-date-picker { position: fixed; z-index: 2147483647; width: 280px; padding: 10px; }
.project-date-picker-head { display: grid; grid-template-columns: 34px 1fr 34px; align-items: center; gap: 6px; margin-bottom: 8px; }
.project-date-picker-head strong { text-align: center; }
.project-date-picker-head button { width: 34px; height: 30px; min-height: 30px; padding: 0; }
.project-date-picker-period { display: grid; grid-template-columns: minmax(0, 1fr) 76px; gap: 5px; }
.project-date-picker-period select { width: 100%; height: 30px; min-height: 30px; margin: 0; padding: 2px 5px; }
.project-date-picker-week,
.project-date-picker-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; text-align: center; }
.project-date-picker-week { margin-bottom: 4px; }
.project-date-picker-day { width: 34px; height: 30px; min-height: 30px; padding: 0; }
.project-date-picker-blank { width: 34px; height: 30px; }
.project-date-picker-foot { display: flex; justify-content: center; margin-top: 8px; padding-top: 7px; }
.project-date-picker-foot button { height: 30px; min-height: 30px; margin: 0; padding: 0 22px; }

:where(.badge, .role-pill, .type-badge, .status-pill, .record-count) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ui-color-line);
  border-radius: 999px;
  background: var(--ui-color-surface-soft);
  color: var(--ui-color-primary-strong);
  font-weight: 800;
}

/* Shared package-directory components used by application hubs. */
:where(.ui-section-intro) {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ui-space-4);
  padding: var(--ui-space-4);
  border: 1px solid var(--ui-color-line);
  border-radius: var(--ui-radius-lg);
  background: linear-gradient(145deg,
    color-mix(in srgb, var(--ui-color-primary) 4%, var(--ui-color-surface)) 0%,
    var(--ui-color-surface) 54%,
    color-mix(in srgb, var(--ui-color-accent) 4%, var(--ui-color-surface-soft)) 100%);
  box-shadow: var(--ui-shadow-soft);
}

:where(.ui-section-intro-copy) {
  min-width: 0;
}

:where(.ui-section-intro-copy > span) {
  color: var(--ui-color-primary);
  font-weight: 900;
}

:where(.ui-section-intro-copy > h1) {
  margin: 2px 0 3px;
  color: var(--ui-color-text);
  font-size: 22px;
}

:where(.ui-section-intro-copy > p) {
  margin: 0;
  color: var(--ui-color-muted);
  line-height: 1.65;
}

:where(.ui-section-count) {
  flex: 0 0 auto;
  min-width: 112px;
  padding: 10px 14px;
  border-radius: var(--ui-radius-md);
  background: var(--ui-gradient-brand);
  color: #fff;
  text-align: center;
  font-size: 23px;
  font-weight: 900;
  box-shadow: var(--ui-shadow-control);
}

:where(.ui-section-count > small) {
  font-size: 11px;
}

:where(.ui-package-grid) {
  min-width: 0;
  min-height: 0;
  display: grid;
  gap: 10px;
}

:where(.ui-package-card) {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 13px 15px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--ui-color-primary) 15%, var(--ui-color-line));
  border-radius: var(--ui-radius-lg);
  background: linear-gradient(155deg,
    color-mix(in srgb, var(--ui-color-primary) 4%, var(--ui-color-surface)) 0%,
    var(--ui-color-surface) 48%,
    color-mix(in srgb, var(--ui-color-accent) 4%, var(--ui-color-surface-soft)) 100%);
  box-shadow: var(--ui-shadow-soft);
  color: var(--ui-color-text);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

:where(.ui-package-card)::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--ui-gradient-brand);
  opacity: .82;
}

:where(.ui-package-card):nth-child(even)::before {
  background: linear-gradient(90deg, var(--ui-color-accent), var(--ui-color-primary));
}

:where(.ui-package-card):hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--ui-color-accent) 34%, var(--ui-color-line));
  box-shadow: var(--ui-shadow-control-hover);
}

:where(.ui-package-card):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--ui-color-accent) 78%, #fff);
  outline-offset: 3px;
  border-color: color-mix(in srgb, var(--ui-color-accent) 48%, var(--ui-color-line));
  box-shadow: var(--ui-shadow-control-hover);
}

:where(.ui-package-card):active {
  transform: translateY(0);
}

:where(.ui-package-icon) {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  outline: 4px solid color-mix(in srgb, var(--ui-color-accent) 7%, transparent);
  background: var(--ui-gradient-brand);
  color: #fff;
  font-size: 19px;
  font-weight: 900;
  box-shadow: var(--ui-shadow-control);
}

:where(.ui-package-icon) .ui-icon,
.user-badge-icon .ui-icon {
  width: 21px;
  height: 21px;
  display: block;
}

:where(.ui-package-card > h2, .ui-package-card > h3) {
  margin: 7px 0 1px;
  color: var(--ui-color-text);
}

:where(.ui-package-card > p) {
  width: 100%;
  min-height: 0;
  margin: 0;
  color: var(--ui-color-muted);
  font-size: 12px;
  line-height: 1.65;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
