/* ==========================================================================
   GHE OS - component library
   ========================================================================== */

/* ---- card -------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s2);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
.card--pad3 { padding: var(--s3); }
.card--flush { padding: 0; overflow: hidden; }
.card--sunken { background: var(--surface-2); }
.card--hover:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.card--lift:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow-3); }
.card--glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-color: var(--glass-border);
}
.card--accent { border-color: var(--primary-ring); box-shadow: var(--glow-primary); }

.card__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s2); margin-bottom: var(--s2);
}
.card__title { font-size: var(--fs-base); font-weight: var(--fw-semi); letter-spacing: var(--track-tight); }
.card__sub { font-size: var(--fs-sm); color: var(--text-muted); margin-top: 2px; }
.card__foot { margin-top: var(--s2); padding-top: var(--s2); border-top: 1px solid var(--border); }
.card__divider { height: 1px; background: var(--border); margin: var(--s2) calc(var(--s2) * -1); }

/* ---- buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s1);
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; }
.btn svg { width: 16px; height: 16px; }

.btn--primary { background: var(--primary); color: var(--primary-ink); font-weight: var(--fw-semi); }
.btn--primary:hover:not(:disabled) { background: var(--primary-hover); box-shadow: 0 4px 16px rgba(73,212,37,.24); }
.btn--primary:active:not(:disabled) { background: var(--primary-press); }

.btn--secondary { background: var(--surface-3); color: var(--text); border-color: var(--border); }
.btn--secondary:hover:not(:disabled) { background: var(--surface-4); border-color: var(--border-strong); }

.btn--ghost { color: var(--text-2); }
.btn--ghost:hover:not(:disabled) { background: rgba(255,255,255,.06); color: var(--text); }

.btn--outline { border-color: var(--border-strong); color: var(--text-2); }
.btn--outline:hover:not(:disabled) { border-color: var(--primary-ring); color: var(--primary); background: var(--primary-softer); }

.btn--danger { background: var(--critical-soft); color: var(--critical); border-color: rgba(208,59,59,.34); }
.btn--danger:hover:not(:disabled) { background: var(--critical); color: #fff; border-color: var(--critical); }

.btn--sm { height: 30px; padding: 0 10px; font-size: var(--fs-sm); }
.btn--sm svg { width: 14px; height: 14px; }
.btn--lg { height: 42px; padding: 0 var(--s3); font-size: var(--fs-base); }
.btn--block { width: 100%; }
.btn--icon { width: 36px; padding: 0; }
.btn--sm.btn--icon { width: 30px; }

.btngroup { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 2px; gap: 2px; }
.btngroup .btn { height: 28px; border-radius: var(--r-xs); border: 0; font-size: var(--fs-sm); color: var(--text-muted); }
.btngroup .btn:hover { background: rgba(255,255,255,.05); color: var(--text-2); }
.btngroup .btn.is-active { background: var(--surface-4); color: var(--text); }

/* ---- badges & pills ---------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 21px; padding: 0 8px;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  background: rgba(255,255,255,.06);
  color: var(--text-2);
}
.badge svg { width: 12px; height: 12px; }
.badge--good     { background: var(--good-soft);     color: var(--good); }
.badge--warning  { background: var(--warning-soft);  color: var(--warning); }
.badge--serious  { background: var(--serious-soft);  color: var(--serious); }
.badge--critical { background: var(--critical-soft); color: var(--critical); }
.badge--info     { background: var(--info-soft);     color: var(--info); }
.badge--accent   { background: var(--primary-soft);  color: var(--primary); }
.badge--outline  { background: transparent; border: 1px solid var(--border-strong); color: var(--text-muted); }
.badge--dot::before { content: ""; width: 6px; height: 6px; border-radius: var(--r-full); background: currentColor; flex: none; }
.badge--sq { border-radius: var(--r-xs); }

/* priority chips read on shape+label, never colour alone */
.prio { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: var(--fw-medium); }
.prio svg { width: 12px; height: 12px; }
.prio--urgent { color: var(--critical); }
.prio--high   { color: var(--serious); }
.prio--medium { color: var(--warning); }
.prio--low    { color: var(--text-muted); }

.kbd {
  display: inline-flex; align-items: center; gap: 2px;
  height: 20px; padding: 0 6px;
  border-radius: var(--r-xs);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semi);
  font-family: var(--font);
}

/* ---- avatars ----------------------------------------------------------- */
.avatar {
  position: relative;
  width: 32px; height: 32px; flex: none;
  border-radius: var(--r-full);
  display: grid; place-items: center;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  letter-spacing: .01em;
  color: #0b0b0b;
  user-select: none;
  overflow: hidden;
}
.avatar--xs { width: 20px; height: 20px; font-size: 8px; }
.avatar--sm { width: 26px; height: 26px; font-size: 10px; }
.avatar--lg { width: 40px; height: 40px; font-size: var(--fs-md); }
.avatar--xl { width: 56px; height: 56px; font-size: var(--fs-lg); }
.avatar--xxl { width: 84px; height: 84px; font-size: var(--fs-2xl); }
.avatar--sq { border-radius: var(--r-sm); }
.avatar__status {
  position: absolute; right: -1px; bottom: -1px;
  width: 10px; height: 10px;
  border-radius: var(--r-full);
  border: 2px solid var(--surface);
}
.avatar__status--online { background: var(--good); }
.avatar__status--away   { background: var(--warning); }
.avatar__status--busy   { background: var(--critical); }
.avatar__status--offline{ background: var(--text-faint); }

.avatarstack { display: flex; }
.avatarstack .avatar { margin-left: -8px; box-shadow: 0 0 0 2px var(--surface); }
.avatarstack .avatar:first-child { margin-left: 0; }
.avatarstack__more {
  background: var(--surface-3) !important;
  color: var(--text-muted) !important;
  font-size: var(--fs-2xs);
}

/* ---- person cell ------------------------------------------------------- */
.person { display: flex; align-items: center; gap: var(--s1); min-width: 0; }
.person__body { min-width: 0; }
.person__name { font-size: var(--fs-md); font-weight: var(--fw-medium); color: var(--text); }
.person__role { font-size: var(--fs-xs); color: var(--text-muted); }

/* ---- inputs ------------------------------------------------------------ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-2); }
.field__hint { font-size: var(--fs-xs); color: var(--text-muted); }
.field__error { font-size: var(--fs-xs); color: var(--critical); display: flex; align-items: center; gap: 5px; }
.field__error svg { width: 13px; height: 13px; }

.input, .select, .textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--fs-md);
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary-ring);
  background: var(--surface-3);
  box-shadow: 0 0 0 3px var(--primary-softer);
}
.input.is-error, .select.is-error { border-color: var(--critical); }
.input:disabled, .select:disabled, .textarea:disabled { opacity: .5; cursor: not-allowed; }
.textarea { min-height: 92px; resize: vertical; line-height: var(--lh-base); }

.select {
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238B8B86' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.select option { background: var(--surface-3); color: var(--text); }

.input-icon { position: relative; }
.input-icon .input { padding-left: 34px; }
.input-icon > svg { position: absolute; left: 10px; top: 50%; margin-top: -8px; width: 16px; height: 16px; color: var(--text-faint); pointer-events: none; }

.checkbox, .radio { display: inline-flex; align-items: center; gap: var(--s1); cursor: pointer; font-size: var(--fs-md); color: var(--text-2); }
.checkbox input, .radio input { position: absolute; opacity: 0; width: 0; height: 0; }
.checkbox__box, .radio__box {
  width: 17px; height: 17px; flex: none;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-xs);
  display: grid; place-items: center;
  background: var(--surface-2);
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.radio__box { border-radius: var(--r-full); }
.checkbox__box svg { width: 12px; height: 12px; color: var(--primary-ink); opacity: 0; transform: scale(.6); transition: all var(--dur-fast) var(--ease); }
.checkbox input:checked + .checkbox__box { background: var(--primary); border-color: var(--primary); }
.checkbox input:checked + .checkbox__box svg { opacity: 1; transform: scale(1); }
.radio input:checked + .radio__box { border-color: var(--primary); border-width: 5px; }
.checkbox input:focus-visible + .checkbox__box,
.radio input:focus-visible + .radio__box { box-shadow: 0 0 0 3px var(--primary-softer); }

.switch { display: inline-flex; align-items: center; gap: var(--s1); cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
  width: 38px; height: 22px; flex: none;
  border-radius: var(--r-full);
  background: var(--surface-4);
  border: 1px solid var(--border-strong);
  padding: 2px;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.switch__thumb {
  width: 16px; height: 16px;
  border-radius: var(--r-full);
  background: var(--text-muted);
  transition: transform var(--dur) var(--ease-spring), background var(--dur) var(--ease);
}
.switch input:checked + .switch__track { background: var(--primary); border-color: var(--primary); }
.switch input:checked + .switch__track .switch__thumb { transform: translateX(16px); background: var(--primary-ink); }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 3px var(--primary-softer); }

/* ---- table ------------------------------------------------------------- */
.tablewrap { overflow-x: auto; }
.table { font-size: var(--fs-md); }
.table th {
  position: sticky; top: 0; z-index: 2;
  text-align: left;
  padding: 10px var(--s2);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}
.table th.is-sortable { cursor: pointer; user-select: none; }
.table th.is-sortable:hover { color: var(--text-2); }
.table th .sortarrow { display: inline-block; width: 12px; height: 12px; vertical-align: -2px; margin-left: 3px; opacity: .35; transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
.table th.is-sorted .sortarrow { opacity: 1; color: var(--primary); }
.table th.is-sorted-desc .sortarrow { transform: rotate(180deg); }
.table td {
  padding: 11px var(--s2);
  border-bottom: 1px solid var(--border-faint);
  color: var(--text-2);
  vertical-align: middle;
}
.table tbody tr { transition: background var(--dur-fast) var(--ease); }
.table tbody tr:hover { background: rgba(255,255,255,.028); }
.table tbody tr.is-selected { background: var(--primary-softer); }
.table tbody tr.is-clickable { cursor: pointer; }
.table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table__primary { color: var(--text); font-weight: var(--fw-medium); }
.table--compact td { padding: 7px var(--s2); }
.table--compact th { padding: 7px var(--s2); }

.tabletoolbar {
  display: flex; align-items: center; gap: var(--s1);
  padding: var(--s2);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.tablefoot {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s2); padding: var(--s1) var(--s2);
  border-top: 1px solid var(--border);
  font-size: var(--fs-sm); color: var(--text-muted);
}
.pager { display: flex; align-items: center; gap: 2px; }
.pager__btn {
  min-width: 28px; height: 28px; padding: 0 6px;
  border-radius: var(--r-xs);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.pager__btn:hover:not(:disabled) { background: rgba(255,255,255,.06); color: var(--text); }
.pager__btn.is-active { background: var(--primary-soft); color: var(--primary); font-weight: var(--fw-semi); }
.pager__btn:disabled { opacity: .3; }

/* ---- progress ---------------------------------------------------------- */
.progress { height: 6px; border-radius: var(--r-full); background: var(--surface-4); overflow: hidden; }
.progress--thin { height: 4px; }
.progress__bar {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--primary);
  width: 0;
  transition: width var(--dur-slow) var(--ease-out);
}
.progress__bar--good { background: var(--good); }
.progress__bar--warning { background: var(--warning); }
.progress__bar--critical { background: var(--critical); }
.progress__bar--info { background: var(--info); }

/* ---- stat tile --------------------------------------------------------- */
.stat { display: flex; flex-direction: column; gap: var(--s1); }
.stat__top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s1); }
.stat__label { font-size: var(--fs-sm); color: var(--text-muted); font-weight: var(--fw-medium); }
/* hero/stat figures keep proportional figures per the viz spec */
.stat__value { font-size: var(--fs-2xl); font-weight: var(--fw-bold); letter-spacing: var(--track-tight); line-height: 1.1; }
.stat__value--lg { font-size: var(--fs-3xl); }
.stat__meta { display: flex; align-items: center; gap: var(--s1); font-size: var(--fs-xs); color: var(--text-muted); }
.stat__icon {
  width: 38px; height: 38px; flex: none;
  border-radius: var(--r-md);
  display: grid; place-items: center;
}
.stat__icon svg { width: 19px; height: 19px; }
/* delta cues ship an arrow glyph + label, never colour alone */
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: var(--fs-xs); font-weight: var(--fw-medium); }
.delta svg { width: 12px; height: 12px; }
.delta--up { color: var(--good); }
.delta--down { color: var(--critical); }
.delta--flat { color: var(--text-muted); }

/* ---- modal ------------------------------------------------------------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.62);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: var(--z-modal);
  display: grid; place-items: center;
  padding: var(--s4);
  animation: fadeIn var(--dur) var(--ease);
}
.modal {
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - var(--s8));
  display: flex; flex-direction: column;
  background: var(--surface-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-4);
  animation: modalIn var(--dur) var(--ease-out);
  overflow: hidden;
}
.modal--md { max-width: 680px; }
.modal--lg { max-width: 900px; }
.modal--xl { max-width: 1140px; }
.modal__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--s2); padding: var(--s3) var(--s3) var(--s2);
  flex: none;
}
.modal__title { font-size: var(--fs-lg); font-weight: var(--fw-semi); letter-spacing: var(--track-tight); }
.modal__sub { font-size: var(--fs-sm); color: var(--text-muted); margin-top: 3px; }
.modal__body { padding: 0 var(--s3) var(--s3); overflow-y: auto; flex: 1 1 auto; }
.modal__foot {
  display: flex; align-items: center; justify-content: flex-end; gap: var(--s1);
  padding: var(--s2) var(--s3);
  border-top: 1px solid var(--border);
  background: var(--surface-3);
  flex: none;
}
.modal__icon {
  width: 46px; height: 46px; flex: none;
  border-radius: var(--r-full);
  display: grid; place-items: center;
  margin-bottom: var(--s2);
}
.modal__icon svg { width: 24px; height: 24px; }

/* ---- drawer ------------------------------------------------------------ */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 480px; max-width: 92vw;
  background: var(--surface);
  border-left: 1px solid var(--border-strong);
  box-shadow: var(--shadow-4);
  z-index: var(--z-drawer);
  display: flex; flex-direction: column;
  animation: drawerIn var(--dur) var(--ease-out);
}
.drawer--wide { width: 720px; }
.drawer__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s2); padding: var(--s2) var(--s3);
  border-bottom: 1px solid var(--border); flex: none;
}
.drawer__body { flex: 1 1 auto; overflow-y: auto; padding: var(--s3); }
.drawer__foot {
  display: flex; align-items: center; justify-content: flex-end; gap: var(--s1);
  padding: var(--s2) var(--s3); border-top: 1px solid var(--border); flex: none;
}

/* ---- dropdown / popover ------------------------------------------------ */
.menu {
  position: absolute;
  min-width: 200px;
  padding: var(--s05);
  background: var(--surface-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-3);
  z-index: var(--z-dropdown);
  animation: menuIn var(--dur-fast) var(--ease-out);
  max-height: 420px; overflow-y: auto;
}
.menu__item {
  display: flex; align-items: center; gap: var(--s1);
  width: 100%; padding: 8px 10px;
  border-radius: var(--r-xs);
  font-size: var(--fs-md);
  color: var(--text-2);
  text-align: left;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.menu__item svg { width: 16px; height: 16px; opacity: .8; flex: none; }
.menu__item:hover { background: rgba(255,255,255,.06); color: var(--text); }
.menu__item.is-danger { color: var(--critical); }
.menu__item.is-danger:hover { background: var(--critical-soft); }
.menu__item.is-active { color: var(--primary); background: var(--primary-softer); }
.menu__sep { height: 1px; background: var(--border); margin: var(--s05) 0; }
.menu__label {
  padding: 6px 10px 3px;
  font-size: var(--fs-2xs); font-weight: var(--fw-semi);
  letter-spacing: var(--track-wide); text-transform: uppercase;
  color: var(--text-faint);
}
.menu__kbd { margin-left: auto; }

/* ---- toast ------------------------------------------------------------- */
.toasts {
  position: fixed; right: var(--s3); bottom: var(--s3);
  display: flex; flex-direction: column; gap: var(--s1);
  z-index: var(--z-toast);
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: var(--s1);
  min-width: 300px; max-width: 420px;
  padding: 12px var(--s2);
  background: var(--surface-4);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--text-muted);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-3);
  animation: toastIn var(--dur) var(--ease-spring);
  pointer-events: auto;
}
.toast.is-leaving { animation: toastOut var(--dur) var(--ease-in) forwards; }
.toast__icon { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast__body { min-width: 0; flex: 1 1 auto; }
.toast__title { font-size: var(--fs-md); font-weight: var(--fw-semi); }
.toast__msg { font-size: var(--fs-sm); color: var(--text-muted); margin-top: 2px; }
.toast--success  { border-left-color: var(--good); }
.toast--success .toast__icon { color: var(--good); }
.toast--error    { border-left-color: var(--critical); }
.toast--error .toast__icon { color: var(--critical); }
.toast--warning  { border-left-color: var(--warning); }
.toast--warning .toast__icon { color: var(--warning); }
.toast--info     { border-left-color: var(--info); }
.toast--info .toast__icon { color: var(--info); }

/* ---- skeleton ---------------------------------------------------------- */
.sk {
  border-radius: var(--r-xs);
  background: linear-gradient(90deg, #1c1c1c 25%, #262626 50%, #1c1c1c 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.sk--text { height: 11px; margin: 5px 0; }
.sk--title { height: 17px; width: 40%; margin-bottom: var(--s1); }
.sk--line { height: 11px; width: 100%; }
.sk--line-70 { width: 70%; }
.sk--line-50 { width: 50%; }
.sk--circle { border-radius: var(--r-full); }
.sk--card { height: 108px; border-radius: var(--r-lg); }
.sk--chart { height: 220px; border-radius: var(--r-md); }
.sk--row { height: 42px; border-radius: var(--r-sm); margin-bottom: var(--s1); }

/* ---- empty / error states ---------------------------------------------- */
.state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: var(--s7) var(--s3);
  gap: var(--s1);
}
.state__icon {
  width: 56px; height: 56px;
  border-radius: var(--r-full);
  display: grid; place-items: center;
  background: var(--surface-3);
  color: var(--text-faint);
  margin-bottom: var(--s1);
}
.state__icon svg { width: 26px; height: 26px; }
.state__icon--error { background: var(--critical-soft); color: var(--critical); }
.state__title { font-size: var(--fs-lg); font-weight: var(--fw-semi); }
.state__msg { font-size: var(--fs-md); color: var(--text-muted); max-width: 420px; }
.state__actions { margin-top: var(--s2); display: flex; gap: var(--s1); }

/* ---- tooltip ----------------------------------------------------------- */
.tip {
  position: fixed;
  padding: 7px 10px;
  background: var(--surface-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-3);
  font-size: var(--fs-sm);
  color: var(--text);
  pointer-events: none;
  z-index: var(--z-toast);
  max-width: 280px;
  animation: fadeIn var(--dur-fast) var(--ease);
}
.tip__label { color: var(--text-muted); font-size: var(--fs-xs); }
.tip__row { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.tip__row + .tip__row { margin-top: 3px; }
.tip__swatch { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.tip__val { margin-left: auto; font-weight: var(--fw-semi); font-variant-numeric: tabular-nums; }

/* ---- command palette --------------------------------------------------- */
.palette-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.58);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-palette);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 12vh;
  animation: fadeIn var(--dur-fast) var(--ease);
}
.palette {
  width: 100%; max-width: 620px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-4);
  overflow: hidden;
  animation: modalIn var(--dur) var(--ease-out);
  display: flex; flex-direction: column;
  max-height: 62vh;
}
.palette__inputwrap { display: flex; align-items: center; gap: var(--s1); padding: var(--s2); border-bottom: 1px solid var(--border); flex: none; }
.palette__inputwrap > svg { width: 19px; height: 19px; color: var(--text-faint); flex: none; }
.palette__input { flex: 1 1 auto; background: none; border: 0; outline: none; font-size: var(--fs-lg); color: var(--text); }
.palette__input::placeholder { color: var(--text-faint); }
.palette__list { overflow-y: auto; padding: var(--s1); flex: 1 1 auto; }
.palette__group { padding: var(--s1) 10px 4px; }
.palette__item {
  display: flex; align-items: center; gap: var(--s1);
  width: 100%; padding: 9px 10px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: var(--fs-md);
  text-align: left;
}
.palette__item svg { width: 16px; height: 16px; opacity: .75; flex: none; }
.palette__item.is-cursor { background: var(--primary-soft); color: var(--primary); }
.palette__item.is-cursor svg { opacity: 1; }
.palette__hint { margin-left: auto; font-size: var(--fs-xs); color: var(--text-faint); }
.palette__foot {
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s1) var(--s2);
  border-top: 1px solid var(--border);
  font-size: var(--fs-xs); color: var(--text-faint);
  flex: none;
}

/* ---- notifications panel ----------------------------------------------- */
.notifpanel {
  position: absolute; top: calc(var(--topbar-h) - 6px); right: var(--s3);
  width: 400px; max-height: 74vh;
  background: var(--surface-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-4);
  z-index: var(--z-dropdown);
  display: flex; flex-direction: column;
  animation: menuIn var(--dur-fast) var(--ease-out);
  overflow: hidden;
}
.notifpanel__head { display: flex; align-items: center; justify-content: space-between; padding: var(--s2); border-bottom: 1px solid var(--border); flex: none; }
.notifpanel__list { overflow-y: auto; flex: 1 1 auto; }
.notif {
  display: flex; gap: var(--s1);
  padding: 12px var(--s2);
  border-bottom: 1px solid var(--border-faint);
  transition: background var(--dur-fast) var(--ease);
  cursor: pointer;
  width: 100%; text-align: left;
}
.notif:hover { background: rgba(255,255,255,.035); }
.notif.is-unread { background: var(--primary-softer); }
.notif__dot { width: 7px; height: 7px; border-radius: var(--r-full); background: var(--primary); flex: none; margin-top: 6px; }
.notif__dot.is-read { background: transparent; }
.notif__body { min-width: 0; flex: 1 1 auto; }
.notif__title { font-size: var(--fs-md); color: var(--text); }
.notif__meta { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 3px; display: flex; align-items: center; gap: 6px; }

/* ---- profile dropdown -------------------------------------------------- */
.profilebtn {
  display: flex; align-items: center; gap: var(--s1);
  padding: 4px 8px 4px 4px;
  border-radius: var(--r-full);
  transition: background var(--dur-fast) var(--ease);
}
.profilebtn:hover { background: rgba(255,255,255,.06); }
.profilebtn__body { text-align: left; line-height: 1.25; }
.profilebtn__name { font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.profilebtn__role { font-size: var(--fs-2xs); color: var(--text-muted); }

/* ---- segmented filter row --------------------------------------------- */
.filterbar {
  display: flex; align-items: center; gap: var(--s1);
  flex-wrap: wrap;
  margin-bottom: var(--s2);
}
.filterbar__spacer { flex: 1 1 auto; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 30px; padding: 0 10px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  white-space: nowrap;
  transition: all var(--dur-fast) var(--ease);
}
.chip svg { width: 13px; height: 13px; }
.chip:hover { border-color: var(--border-strong); color: var(--text-2); }
.chip.is-active { background: var(--primary-soft); border-color: var(--primary-ring); color: var(--primary); }

/* ---- timeline ---------------------------------------------------------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before {
  content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px;
  width: 1px; background: var(--border-strong);
}
.tl-item { position: relative; padding-bottom: var(--s2); }
.tl-item:last-child { padding-bottom: 0; }
.tl-item__dot {
  position: absolute; left: -26px; top: 3px;
  width: 17px; height: 17px;
  border-radius: var(--r-full);
  display: grid; place-items: center;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
}
.tl-item__dot svg { width: 10px; height: 10px; }
.tl-item__title { font-size: var(--fs-md); color: var(--text); }
.tl-item__meta { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }

/* ---- misc -------------------------------------------------------------- */
.divider { height: 1px; background: var(--border); }
.dot-sep { color: var(--text-faint); }
.linkish { color: var(--primary); }
.linkish:hover { text-decoration: underline; }

.keyvals { display: grid; grid-template-columns: auto 1fr; gap: 10px var(--s2); align-items: baseline; font-size: var(--fs-md); }
.keyvals dt { color: var(--text-muted); font-size: var(--fs-sm); white-space: nowrap; }
.keyvals dd { color: var(--text); margin: 0; }

/* ---- animations -------------------------------------------------------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
@keyframes menuIn {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
@keyframes drawerIn { from { transform: translateX(100%); } to { transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(24px) scale(.97); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

.page-enter { animation: pageIn var(--dur) var(--ease-out); }
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--primary);
  border-radius: var(--r-full);
  animation: spin .7s linear infinite;
}
.spinner--lg { width: 28px; height: 28px; border-width: 3px; }
.livedot { width: 7px; height: 7px; border-radius: var(--r-full); background: var(--good); animation: pulse 2s var(--ease) infinite; flex: none; }
