/* ==========================================================================
   AFINARA Application Hub — Neutral Flow Engineering UI Stylesheet
   ========================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--hub-font-ui);
  font-size: 13px;
  line-height: 1.5;
  color: var(--hub-ink-primary);
  background-color: var(--hub-bg-page);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Accessibility Focus Invariant (Neutral Focus Ring) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--hub-focus-ring) !important;
  outline-offset: 2px !important;
}

/* ==========================================================================
   01 HEADER BAR
   ========================================================================== */
.hub-header {
  height: 54px;
  border-bottom: 1px solid var(--hub-line);
  background-color: var(--hub-bg-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-wordmark {
  font-family: var(--hub-font-display);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--hub-ink-primary);
  user-select: none;
  font-synthesis: none;
  line-height: 1;
}

.brand-divider {
  color: var(--hub-line-strong);
  user-select: none;
  font-size: 13px;
}

.brand-context {
  font-size: 13px;
  font-weight: 500;
  color: var(--hub-ink-secondary);
}

.header-utilities {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-identity {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  cursor: default;
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--hub-bg-subtle);
  border: 1px solid var(--hub-line);
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--hub-ink-primary);
}

.user-name {
  font-weight: 500;
  color: var(--hub-ink-primary);
}

/* Segmented Theme Switcher */
.theme-segmented {
  display: inline-flex;
  background: var(--hub-bg-subtle);
  border: 1px solid var(--hub-line);
  border-radius: var(--hub-radius-md);
  padding: 2px;
  gap: 2px;
}

.theme-btn {
  background: none;
  border: 0;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--hub-ink-muted);
  border-radius: var(--hub-radius-sm);
  cursor: pointer;
  font-family: var(--hub-font-ui);
  transition: all 0.1s;
}

.theme-btn.active {
  background: var(--hub-bg-surface);
  color: var(--hub-ink-primary);
  font-weight: 500;
  box-shadow: var(--hub-shadow-sm);
}

/* ==========================================================================
   02 SESSION WARNING & NOTIFICATION BANNER
   ========================================================================== */
.session-banner {
  background: #fbf8f2;
  border-bottom: 1px solid #ebd9c0;
  color: #78350f;
  padding: 8px 28px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

[data-theme="dark"] .session-banner {
  background: #231b10;
  border-bottom-color: #4a341b;
  color: #fde68a;
}

.session-btn {
  background: #78350f;
  color: #ffffff;
  border: 0;
  padding: 3px 8px;
  border-radius: var(--hub-radius-sm);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}

/* ==========================================================================
   03 HUB MAIN CONTENT CONTAINER
   ========================================================================== */
.hub-main {
  flex: 1;
  padding: 28px 32px 56px;
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
}

.intro-group {
  margin-bottom: 22px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.hub-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--hub-ink-primary);
}

.hub-subtitle {
  font-size: 12px;
  color: var(--hub-ink-secondary);
  margin-top: 2px;
}

.hub-endpoint-caption {
  font-size: 11px;
  color: var(--hub-ink-muted);
}

/* ==========================================================================
   04 OMNIBAR SEARCH & DOMAIN CHIPS
   ========================================================================== */
.omnibar-region {
  margin-bottom: 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.omnibar-input-wrapper {
  position: relative;
  width: 100%;
}

.omnibar-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--hub-ink-muted);
  pointer-events: none;
  width: 14px;
  height: 14px;
}

.omnibar-field {
  width: 100%;
  height: 40px;
  border: 1px solid var(--hub-line);
  border-radius: var(--hub-radius-md);
  background: var(--hub-bg-surface);
  color: var(--hub-ink-primary);
  font-family: var(--hub-font-ui);
  font-size: 13px;
  padding: 0 44px 0 36px;
  outline: none;
  box-shadow: var(--hub-shadow-sm);
  transition: border-color 0.12s;
}

.omnibar-field:focus {
  border-color: var(--hub-line-strong);
}

.omnibar-key-hint {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--hub-bg-subtle);
  border: 1px solid var(--hub-line);
  border-radius: var(--hub-radius-sm);
  padding: 1px 5px;
  font-size: 10px;
  color: var(--hub-ink-muted);
  font-family: monospace;
  pointer-events: none;
}

.domain-chip-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}

.domain-chip {
  background: var(--hub-bg-surface);
  border: 1px solid var(--hub-line);
  color: var(--hub-ink-secondary);
  border-radius: 14px;
  padding: 3px 10px;
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.1s;
}

.domain-chip:hover {
  background: var(--hub-bg-hover);
  color: var(--hub-ink-primary);
}

.domain-chip.active {
  background: var(--hub-action-bg);
  border-color: var(--hub-action-bg);
  color: var(--hub-action-text);
  font-weight: 500;
}

.chip-counter {
  font-size: 10px;
  color: var(--hub-ink-muted);
}
.domain-chip.active .chip-counter {
  color: var(--hub-action-text);
  opacity: 0.85;
}

/* ==========================================================================
   05 SECTION HEADERS & PINNED WORKSPACE
   ========================================================================== */
.domain-section {
  margin-bottom: 28px;
}

.domain-section-header {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--hub-ink-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--hub-line);
  padding-bottom: 6px;
  margin-bottom: 8px;
}

.pinned-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
  margin-bottom: 22px;
}

.pinned-cell {
  background: var(--hub-bg-surface);
  border: 1px solid var(--hub-line);
  border-radius: var(--hub-radius-md);
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  box-shadow: var(--hub-shadow-sm);
  transition: all 0.1s;
}

.pinned-cell:hover {
  background: var(--hub-bg-hover);
  border-color: var(--hub-line-strong);
}

.pinned-name {
  font-size: 12px;
  font-weight: 550;
  color: var(--hub-ink-primary);
}

.pinned-desc {
  font-size: 10px;
  color: var(--hub-ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

/* Star Pin Button */
.star-btn {
  background: none;
  border: 0;
  color: var(--hub-line-strong);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: var(--hub-radius-sm);
  line-height: 1;
  transition: color 0.1s;
}

.star-btn:hover, .star-btn.starred {
  color: #b45309; /* Restrained warm amber */
}

/* Status Tags (Pilot, Preview, Maintenance only) */
.lifecycle-tag {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1px 5px;
  border-radius: var(--hub-radius-sm);
  display: inline-flex;
  align-items: center;
  line-height: 13px;
}

.tag-pilot {
  background: var(--hub-tag-pilot-bg);
  border: 1px solid var(--hub-tag-pilot-line);
  color: var(--hub-tag-pilot-text);
}

.tag-preview {
  background: var(--hub-tag-preview-bg);
  border: 1px solid var(--hub-tag-preview-line);
  color: var(--hub-tag-preview-text);
}

.tag-unavailable {
  background: var(--hub-tag-maint-bg);
  border: 1px solid var(--hub-tag-maint-line);
  color: var(--hub-tag-maint-text);
}

/* ==========================================================================
   06 STRUCTURED LIST / ROW LAYOUT (RECOMMENDED PRODUCTION DEFAULT)
   ========================================================================== */
.structured-list {
  background: var(--hub-bg-surface);
  border: 1px solid var(--hub-line);
  border-radius: var(--hub-radius-md);
  overflow: hidden;
  box-shadow: var(--hub-shadow-sm);
}

.app-row {
  display: flex;
  align-items: center;
  padding: 9px 12px;
  border-bottom: 1px solid var(--hub-line-subtle);
  gap: 10px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background-color 0.1s;
}

.app-row:last-child {
  border-bottom: 0;
}

.app-row:hover {
  background-color: var(--hub-bg-hover);
}

.row-identity {
  width: 210px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.row-title {
  font-size: 13px;
  font-weight: 550;
  color: var(--hub-ink-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-task-desc {
  font-size: 12px;
  color: var(--hub-ink-secondary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.row-action-arrow {
  color: var(--hub-ink-muted);
  font-size: 13px;
  flex-shrink: 0;
  padding-left: 6px;
  transition: color 0.1s, transform 0.1s;
}

.app-row:hover .row-action-arrow {
  color: var(--hub-ink-primary);
  transform: translate(2px, -2px);
}

/* ==========================================================================
   07 COMPACT CARDS LAYOUT (REVIEW ALTERNATIVE)
   ========================================================================== */
.compact-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.compact-card {
  background: var(--hub-bg-surface);
  border: 1px solid var(--hub-line);
  border-radius: var(--hub-radius-md);
  padding: 12px 14px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 105px;
  box-shadow: var(--hub-shadow-sm);
  cursor: pointer;
  transition: all 0.1s;
}

.compact-card:hover {
  background: var(--hub-bg-hover);
  border-color: var(--hub-line-strong);
}

.card-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.card-title-text {
  font-size: 13px;
  font-weight: 550;
  color: var(--hub-ink-primary);
}

.card-task-copy {
  font-size: 12px;
  color: var(--hub-ink-secondary);
  line-height: 1.45;
  margin-top: 4px;
}

.card-meta-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--hub-line-subtle);
}

/* ==========================================================================
   08 SKELETON & EMPTY STATES
   ========================================================================== */
.skeleton-bar {
  background: var(--hub-line);
  border-radius: var(--hub-radius-sm);
  animation: hub-skeleton-pulse 1.4s ease-in-out infinite;
}

@keyframes hub-skeleton-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.8; }
}

.empty-state-notice {
  padding: 38px 20px;
  text-align: center;
  background: var(--hub-bg-surface);
  border: 1px dashed var(--hub-line);
  border-radius: var(--hub-radius-md);
}

.empty-state-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.empty-state-message {
  font-size: 12px;
  color: var(--hub-ink-muted);
  margin-bottom: 12px;
}

.action-btn-neutral {
  padding: 6px 12px;
  border-radius: var(--hub-radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--hub-action-bg);
  background: var(--hub-action-bg);
  color: var(--hub-action-text);
  transition: all 0.1s;
}

.action-btn-neutral:hover {
  background: var(--hub-action-hover);
  border-color: var(--hub-action-hover);
}

/* ==========================================================================
   09 FOOTER AREA
   ========================================================================== */
.hub-footer {
  border-top: 1px solid var(--hub-line);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--hub-ink-muted);
  background: var(--hub-bg-surface);
  margin-top: auto;
}

/* ==========================================================================
   10 RESPONSIVE VIEWPORT BREAKPOINTS
   ========================================================================== */
@media (max-width: 680px) {
  .hub-header { padding: 0 16px; }
  .hub-main { padding: 18px 16px 36px; }
  .hub-footer { padding: 12px 16px; flex-direction: column; gap: 6px; text-align: center; }
  .hub-title { font-size: 17px; }
  .row-identity { width: auto; }
  .app-row { flex-wrap: wrap; gap: 4px; padding: 10px; }
  .row-task-desc { width: 100%; white-space: normal; }
  .brand-divider, .brand-context, .user-name { display: none; }
}
