/* ─────────────────────────────────────────────────────────────────────
   components.css — reusable UI components. Ported from tp-next.
   ───────────────────────────────────────────────────────────────────── */

/* ═════════════ PILLS ═════════════ */
.pill {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 5px; padding: 0 7px; height: 20px;
  border-radius: 5px;
  font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.04em;
  justify-self: start; align-self: center; width: fit-content;
  line-height: 18px;
  border: 1px solid transparent;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pill-dot { width: 4.5px; height: 4.5px; border-radius: 50%; flex-shrink: 0; display: inline-block }

.pill-success { background: var(--success-soft);  color: var(--success);      border-color: var(--success-border) }
.pill-success .pill-dot { background: var(--success) }
.pill-danger  { background: var(--danger-soft);   color: var(--danger);       border-color: var(--danger-border) }
.pill-danger  .pill-dot { background: var(--danger) }
.pill-warning { background: var(--warning-soft);  color: var(--warning);      border-color: var(--warning-border) }
.pill-warning .pill-dot { background: var(--warning) }
.pill-neutral { background: var(--neutral-soft);  color: var(--neutral);      border-color: var(--neutral-border) }
.pill-neutral .pill-dot { background: var(--neutral) }
.pill-violet  { background: var(--violet-soft);   color: var(--violet);       border-color: var(--violet-border) }
.pill-violet  .pill-dot { background: var(--violet) }
.pill-primary { background: var(--primary-soft);  color: var(--primary-text); border-color: var(--primary-soft-2) }
.pill-primary .pill-dot { background: var(--primary) }

.pill-w-sm { min-width: 54px }
.pill-w-md { min-width: 72px }
.pill-w-lg { min-width: 90px }

/* ═════════════ HERO ═════════════ */
.hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: 0 0 0 1px rgba(15,17,21,0.04), 0 1px 2px rgba(15,17,21,0.04);
}
.hero-eyebrow    { font-size: 11px; text-transform: uppercase; color: var(--text-3); letter-spacing: 0.05em; font-weight: 500; display: flex; align-items: center; gap: 8px }
.hero-title      { font-size: 24px; font-weight: 600; letter-spacing: -0.018em; line-height: 1.1; margin: 6px 0 0 }
.hero-feature    { font-size: 32px; font-weight: 600; letter-spacing: -0.022em; line-height: 1.05; margin: 6px 0 0 }
.hero-stat       { display: flex; flex-direction: column; gap: 2px }
.hero-stat-value { font-size: 20px; font-weight: 600; letter-spacing: -0.012em; font-feature-settings: 'tnum' }
.hero-stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); font-weight: 500 }
.hero-divider    { width: 1px; background: var(--border); align-self: stretch }

/* ═════════════ COLLAPSIBLE ═════════════ */
details.collapse {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(15,17,21,0.02);
}
details.collapse > summary {
  list-style: none; cursor: pointer;
  padding: 13px 18px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 500; color: var(--text);
  user-select: none;
}
details.collapse > summary::-webkit-details-marker { display: none }
details.collapse > summary:hover                   { background: var(--surface-2) }
details.collapse > summary .chev                   { transition: transform .15s; color: var(--text-3) }
details.collapse[open] > summary .chev             { transform: rotate(90deg) }
details.collapse[open] > summary                   { border-bottom: 1px solid var(--border) }

/* ═════════════ BIG-NUM + TREND ═════════════ */
.actions { display: inline-flex; align-items: center; gap: 6px }
.big-num {
  font-family: 'Geist', sans-serif;
  font-feature-settings: 'tnum';
  letter-spacing: -0.022em;
  font-weight: 600;
}
.trend       { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 500; font-feature-settings: 'tnum' }
.trend-up    { color: var(--success) }
.trend-down  { color: var(--danger) }
.trend-flat  { color: var(--text-3) }

/* ═════════════ AVATARS ═════════════ */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}
.avatar-44 { width: 44px; height: 44px; font-size: 16px; border-radius: 12px }
.avatar-56 { width: 56px; height: 56px; font-size: 20px; border-radius: 14px }

.avatar-cobalt  { background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%); color: #1e3a8a; border: 1px solid #bfdbfe }
.avatar-violet  { background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%); color: #5b21b6; border: 1px solid #ddd6fe }
.avatar-amber   { background: linear-gradient(135deg, #fef9c3 0%, #fde68a 100%); color: #78350f; border: 1px solid #fcd34d }
.avatar-stone   { background: linear-gradient(135deg, #f5f5f4 0%, #e7e5e4 100%); color: #44403c; border: 1px solid #d6d3d1 }
.avatar-emerald { background: linear-gradient(135deg, #ecfdf5 0%, #a7f3d0 100%); color: #065f46; border: 1px solid #6ee7b7 }

/* ═════════════ LIVE DOT ═════════════ */
.live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
  position: relative;
  display: inline-block;
}
.live-dot::after {
  content: "";
  position: absolute; inset: -3px;
  border-radius: 50%;
  background: var(--success);
  opacity: 0.3;
  animation: livepulse 1.6s ease-out infinite;
}
@keyframes livepulse {
  0%   { transform: scale(0.6); opacity: 0.5 }
  100% { transform: scale(1.6); opacity: 0 }
}

/* ═════════════ TAB BUTTONS ═════════════ */
.tab-btn {
  height: 26px; padding: 0 11px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 12px; font-weight: 500; color: var(--text-2);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: inherit;
}
.tab-btn:hover  { color: var(--text); background: rgba(0,0,0,0.02) }
.tab-btn.active { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border), 0 1px 2px rgba(15,17,21,0.04) }
.tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 16px; padding: 0 4px;
  border-radius: 4px;
  background: var(--surface-2); color: var(--text-3);
  font-family: 'Geist Mono', monospace; font-size: 11px; font-weight: 500;
}
.tab-btn.active .tab-count { background: var(--primary-soft); color: var(--primary-text) }

/* ═════════════ BUTTONS ═════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px;
  border-radius: 7px;
  font-size: 13px; font-weight: 500;
  border: 1px solid transparent;
  color: var(--text);
  transition: all .12s ease;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  background: transparent;
  font-family: inherit;
}
.btn:hover            { background: var(--surface-2) }
.btn-ghost            { color: var(--text-2); background: transparent }
.btn-ghost:hover      { color: var(--text); background: var(--surface-2) }
.btn-outline          { background: var(--surface); border-color: var(--border); color: var(--text) }
.btn-outline:hover    { background: var(--surface-2); border-color: var(--border-2) }
.btn-primary          { background: var(--text); color: var(--surface); border-color: var(--text) }
.btn-primary:hover    { background: #000; color: var(--surface) }
.btn-icon             { padding: 0; width: 30px; justify-content: center }
.btn-sm               { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 6px }
.btn-sm.btn-icon      { width: 26px; padding: 0 }

/* Keyboard key chip */
kbd {
  font-family: 'Geist Mono', monospace;
  font-size: 11px; font-weight: 500;
  padding: 1px 4px;
  min-width: 16px;
  text-align: center;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  box-shadow: inset 0 -1px 0 var(--border);
  line-height: 14px;
  display: inline-block;
}

/* ═════════════ PLAIN TABLE ═════════════ */
table.tbl { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px }
table.tbl thead th {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface-3);
  border-bottom: 1px solid var(--border);
  padding: 7px 10px; text-align: left;
  font-size: 11px; font-weight: 500;
  color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.05em;
  white-space: nowrap;
  height: 32px;
  user-select: none;
}
table.tbl tbody td       { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; height: 38px }
table.tbl tbody tr       { transition: background .08s ease }
table.tbl tbody tr:hover { background: var(--surface-3) }
table.tbl tbody tr.selected   td { background: var(--primary-soft); border-bottom-color: var(--primary-soft-2) }
table.tbl tbody tr.row-active    { background: #fcfcfb; box-shadow: inset 2px 0 0 var(--primary) }
table.tbl tbody tr.row-active td { background: #fcfcfb }

/* ═════════════ DIVIDERS ═════════════ */
.hairline { height: 1px; background: linear-gradient(to right, transparent, var(--border) 20%, var(--border) 80%, transparent) }
.seg-line { height: 1px; background-image: linear-gradient(to right, var(--text-3) 50%, transparent 0); background-size: 6px 1px; background-repeat: repeat-x; flex: 1 }

/* ═════════════ TABS ═════════════ */
.tabs       { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 16px; background: var(--surface) }
.tab        { padding: 10px 12px; font-size: 13px; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; transition: color .12s; text-decoration: none }
.tab:hover  { color: var(--text) }
.tab.active { color: var(--text); border-bottom-color: var(--text) }
.tab .count { margin-left: 6px; padding: 0 5px; font-size: 11px; background: var(--surface-2); border-radius: 4px; color: var(--text-2) }

/* ═════════════ TIMELINE ═════════════ */
.timeline { position: relative }
.timeline::before {
  content: "";
  position: absolute; left: 7px; top: 6px; bottom: 6px;
  width: 1px;
  background: linear-gradient(to bottom, var(--border) 0%, var(--border) 100%);
}
.timeline-item     { position: relative; padding-left: 26px; padding-bottom: 16px }
.timeline-dot      { position: absolute; left: 3px; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border); z-index: 2 }
.timeline-item.active  .timeline-dot { border-color: var(--primary); background: var(--primary) }
.timeline-item.success .timeline-dot { border-color: var(--success); background: var(--success) }
.timeline-item.danger  .timeline-dot { border-color: var(--danger);  background: var(--danger) }

/* ═════════════ SEGMENT ROW ═════════════ */
.seg-row     { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; padding: 12px 0 }
.seg-side    { display: flex; flex-direction: column; gap: 1px }
.seg-airport { font-size: 16px; font-weight: 600; letter-spacing: -0.015em }
.seg-time    { font-size: 13px; color: var(--text); font-feature-settings: 'tnum' }
.seg-meta    { font-size: 12px; color: var(--text-2) }
.seg-side.right { align-items: flex-end; text-align: right }
.seg-middle  { display: flex; flex-direction: column; align-items: center; min-width: 90px }

/* ═════════════ FORM FIELDS ═════════════ */
.field          { display: flex; flex-direction: column; gap: 4px }
.field-label    { font-size: 11px; text-transform: uppercase; color: var(--text-3); letter-spacing: 0.05em; font-weight: 500 }
.field-value    { font-size: 13px; color: var(--text) }
.field-row      { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 8px 0 }

input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-family: inherit; font-size: 13px;
  color: var(--text);
  background: var(--surface);
  transition: all .12s;
}
input[type=text]:focus, input[type=email]:focus, input[type=password]:focus,
input[type=date]:focus, input[type=number]:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
input[type=text][disabled] { background: var(--surface-2); color: var(--text-3) }
textarea { height: auto; padding: 8px 10px; line-height: 1.5; resize: vertical; min-height: 80px }

.form-help     { font-size: 11px; color: var(--text-3); margin-top: 4px }
.form-label    { font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; display: block }
.form-label .req { color: var(--danger) }

/* ═════════════ CMD INPUT ═════════════ */
.cmd-input {
  display: flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-3);
  width: 280px;
  cursor: pointer;
  transition: all .12s;
}
.cmd-input:hover { border-color: var(--border-2); background: var(--surface) }

/* ═════════════ SECTION CARD ═════════════ */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(15,17,21,0.04);
}

.section-head {
  padding: 11px var(--table-edge-x);
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--surface-3);
  border-top-left-radius:  12px;
  border-top-right-radius: 12px;
}
.section-head h3 {
  font-size: 13px; font-weight: 600;
  letter-spacing: -0.005em;
  display: flex; align-items: center; gap: 8px;
  margin: 0;
}
.section-head h3 .count {
  font-weight: 500;
  color: var(--text-3);
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
}

.tag-text { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); font-weight: 500 }

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 14px 16px;
  box-shadow: 0 0 0 1px rgba(15,17,21,0.03);
}

/* ═════════════ TAB STRIP ═════════════ */
.tab-strip {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  overflow: hidden;
  height: 30px;
}
.tab-strip button,
.tab-strip a {
  padding: 0 14px;
  font-size: 12px; font-weight: 500;
  color: var(--text-2);
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  transition: background .12s;
  font-family: inherit;
  text-decoration: none;
  height: 100%;
}
.tab-strip button:last-child,
.tab-strip a:last-child                { border-right: none }
.tab-strip button:hover:not(.active),
.tab-strip a:hover:not(.active)        { background: var(--surface-3) }
.tab-strip button.active,
.tab-strip a.active                    { background: var(--primary-soft); color: var(--primary-text); font-weight: 600 }
.tab-strip button .count,
.tab-strip a .count {
  font-size: 11px;
  font-family: 'Geist Mono', monospace;
  font-variant-numeric: tabular-nums;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 99px;
  color: var(--text-3);
  font-weight: 500;
}
.tab-strip button.active .count { background: #fff; color: var(--primary) }

@media (max-width: 700px) {
  .tab-strip        { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch }
  .tab-strip button { flex-shrink: 0 }
}

/* ═════════════ CHIPS ═════════════ */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px;
  padding: 0 4px 0 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px; color: var(--text);
  transition: all .12s;
  cursor: pointer;
}
.chip:hover { border-color: var(--border-2); background: var(--surface-3) }
.chip-key   { color: var(--text-3); font-weight: 500 }
.chip-op    { color: var(--text-3); font-weight: 400 }
.chip-val   { color: var(--text);   font-weight: 500 }
.chip-x     { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 4px; color: var(--text-3); margin-left: 2px }
.chip-x:hover { background: var(--surface-2); color: var(--text) }

/* ═════════════ ACTION TILE ═════════════ */
.action-tile {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  transition: all .15s;
  box-shadow: 0 0 0 1px rgba(15,17,21,0.02);
}
.action-tile:hover {
  border-color: var(--border-2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -2px rgba(15,17,21,0.06);
}
.action-tile-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid;
  flex-shrink: 0;
}
.action-tile-title { font-size: 13px; font-weight: 500; letter-spacing: -0.005em }
.action-tile-meta  { font-size: 11px; color: var(--text-3); margin-top: 1px }

/* ═════════════ FEED ROW ═════════════ */
.feed-row     { display: flex; gap: 11px; padding: 10px 0; border-bottom: 1px solid var(--border) }
.feed-row:last-child  { border-bottom: 0 }
.feed-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-4);
  margin-top: 6px;
  flex-shrink: 0;
}
.feed-dot.success { background: var(--success) }
.feed-dot.danger  { background: var(--danger) }
.feed-dot.warning { background: var(--warning) }
.feed-dot.primary { background: var(--primary) }
.feed-dot.violet  { background: var(--violet) }

/* ═════════════ ACTION LINK ═════════════ */
.action-link {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-decoration: none;
  color: var(--text);
  transition: all .12s;
  background: var(--surface);
}
.action-link:hover {
  background: var(--surface-2);
  border-color: var(--border-2);
}

@media (max-width: 700px) {
  .section-head    { padding: 9px 12px; flex-wrap: wrap; row-gap: 8px }
  .section-head h3 { font-size: 12px }
  .section-head > .row,
  .section-head > .row-between { flex-wrap: wrap; row-gap: 6px }
}

/* ═════════════ PICK CHIP + POPOVER (Tabulator columns menu) ═════════════ */
.pick-anchor { position: relative }
.pick-chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px; font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  font-family: inherit;
  transition: background .12s, border-color .12s;
}
.pick-chip:hover { background: var(--surface-2); border-color: var(--border-2); color: var(--text) }
.pick-chip .chev { margin-left: 2px; color: var(--text-3) }
.pick-chip[aria-expanded="true"] { background: var(--surface-2); border-color: var(--border-2); color: var(--text) }

.pick-popover {
  position: absolute; top: calc(100% + 4px); right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px -4px rgba(15,17,21,0.10), 0 2px 4px rgba(15,17,21,0.04);
  padding: 6px;
  display: none;
  z-index: 50;
  overflow-y: auto;
}
.pick-popover.open { display: block }
.pick-option {
  padding: 6px 8px;
  font-size: 12.5px;
  border-radius: 5px;
  border: 0;
  background: transparent;
  width: 100%;
  font-family: inherit;
  color: var(--text);
}
.pick-option:hover { background: var(--surface-2) }
.pick-divider { height: 1px; background: var(--border); margin: 4px 0 }
