/*!*********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  !*** css ../../node_modules/.pnpm/next@15.5.19_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[14].oneOf[10].use[2]!../../node_modules/.pnpm/next@15.5.19_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[14].oneOf[10].use[3]!./src/app/globals.css ***!
  \*********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
/* Design tokens — token-driven theming per DESIGN-DOCUMENT §8 (CSS custom
   properties on [data-theme]); no utility framework. Fonts use a stack so the
   build stays offline/hermetic (no Google Fonts fetch). */

/* Theme-independent scales: spacing (4px base), radius, motion, focus ring. */
:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;
  --transition: 140ms ease;
  --ring: color-mix(in srgb, var(--accent) 50%, transparent);
  --icon-size: 16px;
}

:root,
[data-theme='dark'] {
  --bg: #0b0b0e;
  --bg-1: #100f14;
  --surface: #151419;
  --surface-2: #1b1a21;
  --surface-3: #22212b;
  --border: #262531;
  --border-2: #34333f;
  --text: #ececf1;
  --text-2: #a4a3b2;
  --text-3: #83828f;
  --accent: #6e8bff;
  --accent-2: #90a6ff;
  --accent-soft: rgba(110, 139, 255, 0.12);
  /* Button background: deeper than --accent so white labels pass WCAG AA (4.5:1).
     --accent stays for links/borders/soft fills (AA as text on --bg). */
  --primary: #5163d6;
  --primary-hover: #4858cc;
  --danger: #cf4444;
  --on-accent: #ffffff;
  --success: #3ecf8e;
  --warn: #f2c14e;
  --warn-soft: rgba(242, 193, 78, 0.14);
  --error: #ff6b6b;
  --info: #4cc4e0;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.5);
}

[data-theme='light'] {
  --bg: #f3f3f6;
  --bg-1: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f6f9;
  --surface-3: #ececf1;
  --border: #e4e4eb;
  --border-2: #d4d4dd;
  --text: #15151b;
  --text-2: #52525e;
  --text-3: #6e6e79;
  --accent: #4e5fd8;
  --accent-2: #3f4fc0;
  --accent-soft: rgba(78, 95, 216, 0.1);
  --primary: #4e5fd8;
  --primary-hover: #4150c2;
  --danger: #c0392b;
  --on-accent: #ffffff;
  /* Semantic colors deepened in light mode so small badge text passes WCAG AA. */
  --success: #0b6b44;
  --warn: #7d560f;
  --warn-soft: rgba(181, 132, 26, 0.12);
  --error: #ad2e23;
  --info: #156d86;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    'Manrope',
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
  font-size: 13.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
}

a {
  color: var(--accent);
  text-decoration: none;
}

/* ---- App shell ---- */
.app-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.user-card .avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
}
.user-card .logout {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-3);
  cursor: pointer;
  transition:
    color var(--transition),
    background var(--transition),
    border-color var(--transition);
}
.user-card .logout:hover {
  color: var(--text);
  border-color: var(--border-2);
}
.user-card .logout:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 18px;
}
.brand .logo {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--info));
}
.brand .name {
  font-weight: 800;
  letter-spacing: -0.01em;
}
/* App logo (BrandLogo). The artwork has a light background, so frame it as a
   white rounded tile with a hairline border — legible on both light and dark. */
.brand-logo {
  display: block;
  width: auto;
  border-radius: 8px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.pill {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 7px;
}

.nav-group {
  margin-top: 14px;
}
.nav-group > .label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 4px 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--text-2);
  font-weight: 600;
}
.nav-item {
  transition:
    background var(--transition),
    color var(--transition);
}
.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}
.nav-item.active {
  background: var(--accent-soft);
  color: var(--text);
  box-shadow: inset 2px 0 0 var(--accent);
}
.nav-item.active .icon {
  color: var(--accent);
}
/* small status dot (e.g. "Demo data") */
.dot {
  display: inline-block;
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: var(--radius-pill);
  background: currentColor;
}

/* ---- Topbar ---- */
.topbar {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 5;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
}
.crumb {
  color: var(--text-3);
  font-size: 12.5px;
}
.crumb b {
  color: var(--text);
}
.spacer {
  flex: 1 1;
}

/* ---- Main ---- */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.content {
  padding: 24px 28px;
  max-width: 1280px;
}
.page-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 2px;
}
.page-desc {
  color: var(--text-2);
  margin: 0 0 20px;
}

/* ---- Cards / KPIs ---- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  grid-gap: 12px;
  gap: 12px;
  margin-bottom: 22px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.kpi .k-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
}
.kpi .k-value {
  font-size: 26px;
  font-weight: 700;
  margin-top: 6px;
}
.kpi .k-sub {
  color: var(--text-2);
  font-size: 12px;
  margin-top: 2px;
}

/* ---- Table ---- */
.section-title {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 10px;
}
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  font-weight: 700;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.table tr:hover td {
  background: var(--surface-2);
}

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid var(--border-2);
  color: var(--text-2);
}
.badge.demo {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: transparent;
}
.badge.role {
  color: var(--accent-2);
  background: var(--accent-soft);
  border-color: transparent;
}

/* ---- States ---- */
.state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-2);
}
.state h2 {
  color: var(--text);
}
.note {
  color: var(--text-3);
  font-size: 12px;
  margin-top: 18px;
}

/* ---- Status badges (trace rows / detail) ---- */
.badge.st-ok {
  color: var(--success);
  background: color-mix(in srgb, var(--success) 15%, transparent);
  border-color: transparent;
}
.badge.st-err {
  color: var(--error);
  background: color-mix(in srgb, var(--error) 15%, transparent);
  border-color: transparent;
}
.badge.st-warn {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: transparent;
}
.badge.st-info {
  color: var(--info);
  background: color-mix(in srgb, var(--info) 15%, transparent);
  border-color: transparent;
}
.badge.flag {
  font-size: 9.5px;
  color: var(--text-3);
}

/* ---- Trace list ---- */
a.trace-row,
.trace-row {
  display: grid;
  grid-template-columns: 84px 64px 1.4fr 110px 96px 92px 1fr;
  grid-gap: 10px;
  gap: 10px;
  align-items: center;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text);
  text-decoration: none;
}
a.trace-row:hover {
  background: var(--surface-2);
}
.trace-head {
  grid-template-columns: 84px 64px 1.4fr 110px 96px 92px 1fr;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  font-weight: 700;
}
.right {
  text-align: right;
}
.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.filter {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.filter {
  cursor: pointer;
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition);
}
.filter:hover {
  border-color: var(--border-2);
  color: var(--text);
}
.filter:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.filter.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}

/* ---- Trace detail ---- */
.msg {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}
.msg-role {
  padding: 8px 14px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.msg-body {
  padding: 13px 14px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
}
.msg.assistant {
  background: var(--accent-soft);
  border-color: var(--accent-line, var(--border-2));
}
.banner {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 12.5px;
  margin-bottom: 14px;
}
.banner.warn {
  background: var(--warn-soft);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
}
.banner.muted {
  background: var(--surface-2);
  border: 1px dashed var(--border-2);
  color: var(--text-2);
}
.back-link {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}

/* ---- Buttons (shared system; replaces ad-hoc inline button styles) ---- */
.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  --btn-bd: var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--btn-bd);
  border-radius: var(--radius-md);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}
.btn:hover {
  background: color-mix(in srgb, var(--btn-bg) 90%, var(--text));
  border-color: var(--border-2);
}
.btn:active {
  transform: translateY(0.5px);
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn:disabled,
.btn[aria-disabled='true'] {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  --btn-bg: var(--primary);
  --btn-fg: var(--on-accent);
  --btn-bd: transparent;
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: transparent;
}
.btn-secondary {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  --btn-bd: var(--border);
}
.btn-ghost {
  --btn-bg: transparent;
  --btn-fg: var(--text-2);
  --btn-bd: transparent;
}
.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: transparent;
}
.btn-danger {
  --btn-bg: transparent;
  --btn-fg: var(--error);
  --btn-bd: color-mix(in srgb, var(--error) 45%, transparent);
}
.btn-danger:hover,
.btn-danger.is-armed {
  background: var(--danger);
  color: #fff;
  border-color: transparent;
}

/* sizes */
.btn-sm {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  gap: var(--space-1);
}
.btn-lg {
  min-height: 44px;
  padding: 0 18px;
  font-size: 14px;
}
.btn-block {
  width: 100%;
}
/* icon-only square button */
.btn-icon {
  padding: 0;
  width: 38px;
}
.btn-icon.btn-sm {
  width: 32px;
}
/* generous hit area on touch devices (>=44px) */
@media (pointer: coarse) {
  .btn {
    min-height: 44px;
  }
  .btn-sm {
    min-height: 40px;
  }
}

/* ---- Form controls (shared; replaces repeated inline input/select styles) ---- */
.input,
.select {
  width: 100%;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}
textarea.input {
  min-height: auto;
  padding: 9px 11px;
  line-height: 1.55;
  resize: vertical;
}
.input::placeholder,
.input::-webkit-input-placeholder {
  color: var(--text-3);
}
.input:hover,
.select:hover {
  border-color: var(--border-2);
}
.input:focus,
.select:focus,
.input:focus-visible,
.select:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}
.select {
  -moz-appearance: none;
       appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237c7b8b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
}
@media (pointer: coarse) {
  .input,
  .select {
    min-height: 44px;
  }
}

/* ---- Switch (accessible toggle) ---- */
.switch {
  position: relative;
  display: inline-flex;
  flex: none;
  width: 44px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  cursor: pointer;
  transition:
    background var(--transition),
    border-color var(--transition);
}
.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-2);
  transition:
    transform var(--transition),
    background var(--transition);
}
.switch[aria-checked='true'],
.switch.is-on {
  background: var(--primary);
  border-color: transparent;
}
.switch[aria-checked='true']::after,
.switch.is-on::after {
  transform: translateX(18px);
  background: #fff;
}
.switch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.switch:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---- Icons (inline Lucide SVGs, currentColor; size set via the component) ---- */
.icon {
  flex: none;
  display: inline-block;
  vertical-align: middle;
  stroke: currentColor;
}

/* ---- Spinner + reduced-motion ---- */
@keyframes tm-spin {
  to {
    transform: rotate(360deg);
  }
}
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid color-mix(in srgb, currentColor 28%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: tm-spin 0.6s linear infinite;
  flex: none;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---- Responsive grid utilities ---- */
.cols-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 16px;
  gap: 16px;
}
.cols-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-gap: 10px;
  gap: 10px;
}
@media (max-width: 760px) {
  .cols-4 {
    grid-template-columns: 1fr 1fr;
  }
  .cols-2 {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 480px) {
  .cols-4 {
    grid-template-columns: 1fr;
  }
}

/* ---- Responsive shell: sidebar becomes a wrapped top nav on small screens ---- */
@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar .brand {
    width: 100%;
    padding: 4px 4px 8px;
  }
  .nav-group {
    margin-top: 0;
    display: contents;
  }
  .nav-group > .label {
    display: none;
  }
  .nav-item {
    padding: 8px 10px;
    border: 1px solid var(--border);
    background: var(--surface);
  }
  .nav-item.active {
    box-shadow: none;
    border-color: var(--accent);
  }
  .user-card {
    margin-left: auto;
  }
  .content {
    padding: 16px;
  }
  .topbar {
    padding: 0 16px;
    gap: 10px;
  }
}
@media (max-width: 480px) {
  .crumb {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .page-title {
    font-size: 21px;
  }
}

/* Accessibility (A-13): skip link + visible focus. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 8px 14px;
  background: var(--accent);
  color: #fff;
  border-radius: 0 0 8px 0;
  font-weight: 700;
}
.skip-link:focus {
  left: 0;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ============================================================================
   Interactive affordances (UI/UX pass): overlays, drawer, modal, kebab menu,
   tooltip, progress bar, toast. Additive only — no existing class is restyled.
   ========================================================================= */

@keyframes tm-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes tm-slide-right {
  from {
    transform: translateX(16px);
    opacity: 0.4;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
@keyframes tm-pop-in {
  from {
    transform: translateY(6px) scale(0.98);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* ---- Overlay / backdrop ---- */
.tm-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  background: color-mix(in srgb, #000 46%, transparent);
  -webkit-backdrop-filter: blur(2px);
          backdrop-filter: blur(2px);
  animation: tm-fade-in var(--transition);
}
.tm-overlay-right {
  justify-content: flex-end;
}
.tm-overlay-center {
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* ---- Drawer (right sheet) ---- */
.tm-drawer {
  display: flex;
  flex-direction: column;
  max-width: 96vw;
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-pop);
  animation: tm-slide-right 160ms ease;
}
.tm-drawer-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.tm-drawer-head > div:first-child {
  flex: 1 1;
}
.tm-drawer-body {
  flex: 1 1;
  overflow-y: auto;
  padding: 18px;
}

/* ---- Modal (centered) ---- */
.tm-modal {
  max-width: 96vw;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  animation: tm-pop-in 160ms ease;
}
.tm-modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.tm-modal-head > div:first-child {
  flex: 1 1;
}
.tm-modal-body {
  padding: 16px;
}

/* ---- Kebab / dropdown menu ---- */
.tm-menu {
  position: fixed;
  z-index: 70;
  min-width: 184px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  animation: tm-pop-in 120ms ease;
}
.tm-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.tm-menu-item:hover,
.tm-menu-item:focus-visible {
  background: var(--surface-2);
}
.tm-menu-item.danger {
  color: var(--error);
}
.tm-menu-item.is-disabled {
  color: var(--text-3);
  cursor: not-allowed;
}
.tm-menu-item.is-disabled:hover {
  background: transparent;
}

/* ---- Tooltip (CSS, reveals on hover/focus of the .tip wrapper) ---- */
.tip {
  position: relative;
}
.tip[data-tip]:hover::after,
.tip[data-tip]:focus-visible::after,
.tip[data-tip]:focus-within::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  white-space: nowrap;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  box-shadow: var(--shadow-pop);
  pointer-events: none;
}

/* ---- Progress bar (spend/usage vs cap) ---- */
.tm-progress {
  position: relative;
  width: 100%;
  background: var(--surface-3);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.tm-progress-bar {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width var(--transition);
}
.tm-progress-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
}

/* ---- Toast stack ---- */
.tm-toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, 92vw);
}
.tm-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  font-size: 12.5px;
  animation: tm-slide-right 160ms ease;
}
.tm-toast.ok {
  border-left-color: var(--success);
}
.tm-toast.ok .icon {
  color: var(--success);
}
.tm-toast.err {
  border-left-color: var(--error);
}
.tm-toast.err .icon {
  color: var(--error);
}
.tm-toast.info .icon {
  color: var(--info);
}

@media (max-width: 480px) {
  .tm-toast-stack {
    left: 16px;
    right: 16px;
    max-width: none;
  }
}

