/* ==========================================================================
   Revenue Stack App v2 — Brutalist Dashboard Styles
   Source: mockups/v2/ui_kits/app/app.css
   ========================================================================== */

/* ==========================================================================
   APP LAYOUT
   ========================================================================== */

.app {
  display: grid;
  grid-template-columns: 208px 1fr;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: clip;
}

/* backward compat alias */
.app-layout { display: grid; grid-template-columns: 208px 1fr; min-height: 100vh; width: 100%; max-width: 100vw; overflow-x: clip; }


/* ==========================================================================
   SIDEBAR
   ========================================================================== */

.sb, .sidebar {
  border-right: 1px solid var(--ink);
  background: var(--paper);
  padding: 14px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 0;
  height: 100vh;
  box-sizing: border-box;
  z-index: var(--z-sticky);
}

.sb__bottom {
  margin-top: auto;
  padding: 0 18px;
}

.sb__brand, .sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px 14px;
  border-bottom: 1px solid var(--ink);
  text-decoration: none;
  color: var(--ink);
}

.sb__brand:hover, .sidebar-logo:hover {
  background: transparent;
  color: var(--ink);
}

.sb__group {
  padding: 14px 0;
  border-bottom: 1px dashed var(--ink-2);
  margin: 0 18px;
}

.sb__h {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
  display: block;
  margin-bottom: 8px;
}

.sb__nav {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.sb__item {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  border: 1px solid transparent;
  text-decoration: none;
  background: none;
  width: 100%;
  text-align: left;
}

.sb__item:hover {
  background: var(--paper-2);
  color: var(--ink);
}

.sb__item.is-active, .sb__item.active {
  background: var(--ink);
  color: var(--paper);
}

.sb__item.is-active:hover, .sb__item.active:hover {
  background: var(--ink);
  color: var(--paper);
}

.sb__count {
  margin-left: auto;
  font-size: 10px;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.sb__usermenu {
  position: relative;
}

.sb__usermenu-popover {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: var(--shadow-stamp-lg);
  padding: 6px 0;
  margin-bottom: 4px;
  z-index: 10;
}

.sb__usermenu-item {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  border: none;
  text-decoration: none;
  background: none;
  width: 100%;
  text-align: left;
}

.sb__usermenu-item:hover {
  background: var(--paper-2);
}

.sb__usermenu-item--danger {
  color: var(--hazard);
}

/* Sign-out is a CSRF-protected POST form (D20); display:contents keeps its
   button laid out as a plain popover item, with no wrapper box. */
.sb__usermenu-logout {
  display: contents;
}

.sb__user {
  padding: 16px 18px;
  border-top: 1px solid var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border-left: none;
  border-right: none;
  border-bottom: none;
  cursor: pointer;
  text-align: left;
}

.sb__user:hover {
  background: var(--paper-2);
}

.sb__avatar {
  width: 32px;
  height: 32px;
  background: var(--magenta);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  border: 1px solid var(--ink);
}

.sb__user__nm {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.sb__user__hd {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-2);
}

/* Backward compat nav item styling */
.sidebar-nav, .sidebar-bottom {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.nav-item {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  border: 1px solid transparent;
  text-decoration: none;
  background: none;
  width: 100%;
  text-align: left;
  border-radius: 0;
  transition: background var(--dur-base) var(--ease-snap);
}

.nav-item:hover {
  background: var(--paper-2);
  color: var(--ink);
}

.nav-item.active {
  background: var(--ink);
  color: var(--paper);
}

.nav-item.active:hover {
  background: var(--ink);
  color: var(--paper);
}

.nav-item-danger {
  color: var(--hazard-ink);
}

.nav-item-danger:hover {
  background: var(--paper-2);
  color: var(--hazard-ink);
}

.nav-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-left: auto;
}

.nav-status-dot.live { background: var(--lime); }
.nav-status-dot.idle { background: var(--hazard); }
.nav-status-dot.error { background: var(--hazard); }
.nav-status-dot.disconnected { background: var(--paper-3); }

.sidebar-close {
  display: none;
  position: absolute;
  top: var(--s-5);
  right: var(--s-5);
  padding: var(--s-3);
  min-width: 44px;
  min-height: 44px;
  background: none;
  border: none;
  color: var(--ink-2);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
}

.sidebar-close:hover {
  color: var(--ink);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: calc(var(--z-sticky) - 1);
}


/* ==========================================================================
   TOPBAR
   ========================================================================== */

.tb, .topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-bottom: 1px solid var(--ink);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 5;
  gap: var(--s-5);
}

.tb__crumbs, .topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.tb__crumbs span, .topbar-left .page-description {
  color: var(--ink-2);
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
}

.tb__crumbs strong {
  color: var(--ink);
  font-weight: 700;
}

.page-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-2);
  margin: 0;
}

.page-description {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
  margin: 0;
}

.tb__right, .topbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
}

.tb__live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background: var(--lime);
  color: var(--lime-ink);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid var(--ink);
}

/* Status pill colour tracks the real system-status state (core.context_processors
   .status_indicator). `.is-live` is the base lime; the rest recolour it. */
.tb__live.is-idle {
  background: var(--paper-2);
  color: var(--ink);
}

.tb__live.is-error {
  background: var(--hazard);
  color: var(--paper);
}

.tb__live.is-disconnected {
  background: var(--paper-2);
  color: var(--ink-2);
}

/* The template dot is a <span class="tb__live-dot">; `currentColor` keeps it in
   contrast with whichever state background the pill is showing. */
.tb__live-dot {
  width: 7px;
  height: 7px;
  background: currentColor;
  border-radius: 50%;
  animation: rs-blink 1.4s steps(2) infinite;
}

@keyframes rs-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.2; }
}

@media (prefers-reduced-motion: reduce) {
  .tb__live-dot { animation: none; }
}

.tb__btn {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  padding: 8px 14px;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  box-shadow: var(--shadow-stamp-sm);
  transition: transform var(--dur-base) var(--ease-snap), box-shadow var(--dur-base) var(--ease-snap);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tb__btn:hover {
  transform: translate(1px, 1px);
  box-shadow: none;
  background: var(--paper);
  color: var(--ink);
}

.tb__btn--primary {
  background: var(--lime);
  color: var(--lime-ink);
}

.tb__btn--primary:hover {
  background: var(--lime);
  color: var(--lime-ink);
}


/* ==========================================================================
   MAIN CONTENT
   ========================================================================== */

.main-content, .main {
  padding: 20px 24px 48px;
  max-width: 1320px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* As a grid item of .app, the default min-width:auto lets wide descendants
     (e.g. the links table) blow the 1fr track out past the viewport, which .app
     then clips — leaving the overflow unreachable. min-width:0 lets this column
     stay at the track width so inner overflow-x:auto containers can scroll. */
  min-width: 0;
  overflow-x: clip;
}

.h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 75%;
  font-size: 44px;
  line-height: 1;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  margin: 0 0 6px;
}

.h1__sub {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-2);
  margin: 0 0 24px;
}

.page-content {
  flex: 1;
  padding: 0;
}

.messages {
  padding: 0;
  padding-bottom: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}


/* ==========================================================================
   STAT GRID
   ========================================================================== */

.stats, .metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--ink);
  margin-bottom: 24px;
}

.stat, .metric-card {
  padding: 14px 16px;
  border-right: 1px solid var(--ink);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 120px;
  background: var(--paper);
  border-radius: 0;
  box-shadow: none;
}

.stat:last-child, .metric-card:last-child {
  border-right: 0;
}

.stat--em {
  background: var(--lime);
}

.stat__lbl, .metric-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.stat--em .stat__lbl {
  color: var(--lime-ink);
}

.stat__num, .metric-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 75%;
  font-size: 38px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  margin: 0;
}

.stat__delta, .metric-change {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  margin: 0;
}

.stat__delta.pos, .metric-change.positive {
  background: var(--ink);
  color: var(--lime);
}

.stat__delta.neg, .metric-change.negative {
  background: var(--hazard);
  color: var(--paper);
}

.stat__delta.flat {
  background: var(--paper-2);
  color: var(--ink-2);
  border: 1px solid var(--paper-3);
}

.stat--em .stat__delta.pos {
  background: var(--lime-ink);
  color: var(--lime);
}

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.metric-icon {
  display: none;
}


/* ==========================================================================
   CONTENT PANELS (replaces cards in dashboard context)
   ========================================================================== */

.row2, .content-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.content-grid-equal {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}


/* ==========================================================================
   CHART
   ========================================================================== */

.chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 180px;
  padding: 4px 0;
}

.chart__bar {
  flex: 1;
  background: var(--ink);
  position: relative;
}

.chart__bar.lime {
  background: var(--lime);
  border: 1px solid var(--ink);
  border-bottom: 0;
}

.chart__day {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-2);
  text-align: center;
  padding-top: 4px;
  flex: 1;
  text-transform: uppercase;
}

.chart__row {
  display: flex;
  gap: 4px;
}

.chart-placeholder {
  height: 300px;
  background: var(--paper-2);
  border: 1px dashed var(--ink-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
  gap: var(--s-3);
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: var(--ls-label);
}


/* ==========================================================================
   FEED
   ========================================================================== */

.feed {
  display: flex;
  flex-direction: column;
}

.feed__row {
  display: grid;
  grid-template-columns: auto 1fr 80px;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--ink-2);
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
}

.feed__row:last-child {
  border-bottom: 0;
}

.feed__amt {
  font-weight: 700;
  color: var(--lime-ink);
  background: var(--lime);
  padding: 2px 7px;
  font-size: 11px;
}

.feed__amt.click {
  color: var(--ink-2);
  background: var(--paper-2);
  border: 1px solid var(--paper-3);
}

.feed__txt strong {
  font-weight: 700;
}

.feed__txt small {
  color: var(--ink-2);
  display: block;
  font-size: 11px;
}

.feed__time {
  text-align: right;
  color: var(--ink-2);
  font-size: 11px;
}


/* ==========================================================================
   TABLES
   ========================================================================== */

.tbl, .table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 12px;
}

.tbl th, .table th {
  text-align: left;
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--ink);
  color: var(--ink);
  background: var(--paper-2);
}

.table th .table-sort-link,
.table th .table-sort-btn {
  color: inherit;
  text-decoration: none;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

.table th .table-sort-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-align: inherit;
}

.table th .table-sort-btn:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

.table th .table-sort-link:hover,
.table th .table-sort-btn:hover {
  color: var(--lime-ink);
}

.table-sort-indicator {
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.85;
}

.table-sort-link-right {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
}

.tbl td, .table td {
  padding: 12px 14px;
  border-bottom: 1px dashed var(--ink-2);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  font-size: 12px;
}

.tbl tr:hover td, .table tr:hover td {
  background: var(--paper-2);
}

.tbl .num, .table .text-right {
  text-align: right;
}

.table .text-center {
  text-align: center;
}

.table-container {
  border: 1px solid var(--ink);
  border-radius: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table td.dashboard-url-cell {
  vertical-align: top;
  max-width: min(360px, 40vw);
  min-width: 180px;
}

.dashboard-url-text {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.dashboard-url-text a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.dashboard-url-text a:hover {
  background: var(--lime);
  color: var(--lime-ink);
}

.dashboard-link-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex-wrap: wrap;
}

.list-item.dashboard-link-row {
  align-items: flex-start;
  gap: var(--s-4);
}

.list-item.dashboard-link-row .dashboard-link-row-actions {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  flex-shrink: 0;
}

.list-item.dashboard-link-row .dashboard-url-text {
  font-weight: 500;
  margin-bottom: 2px;
}

.dashboard-recent-links-row.list-item.dashboard-link-row {
  padding: var(--s-3) var(--s-4);
  margin-bottom: var(--s-1);
  gap: var(--s-3);
  align-items: center;
}

.dashboard-recent-links-row.list-item.dashboard-link-row:last-child {
  margin-bottom: 0;
}

.dashboard-recent-links-main {
  min-width: 0;
  flex: 1;
}

.dashboard-recent-links-url.dashboard-url-text {
  font-size: 11px;
  line-height: 1.35;
  margin-bottom: 0;
  font-weight: 500;
}

.dashboard-recent-links-meta.list-item-subtitle {
  font-size: 11px;
  margin-top: 2px;
  line-height: 1.3;
}

.dashboard-recent-links-actions.dashboard-link-row-actions {
  flex-direction: row;
  align-items: center;
  gap: 4px;
}

.dashboard-recent-links-actions .btn-sm {
  padding: 3px 8px;
  font-size: 11px;
}

/* Links page search */
.links-search-form .form-input {
  animation: none;
}

.links-table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--ink);
  background: var(--paper-2);
}

.links-table-toolbar-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--ls-stamp);
  color: var(--ink-2);
}

.links-table-toolbar-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.links-table-filter-empty {
  padding: var(--s-8) var(--s-5);
  text-align: center;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 13px;
}

/* The .tbl has more columns than a phone is wide, and both .main-content and
   .app clip overflow-x — so without a local scroll container the Status and
   Actions columns are unreachable at 375px. Scroll only the table, leaving the
   filter toolbar fixed above it. Borderless: the panel already frames it. */
.links-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Compact, single-line URL cell. The full tracking URL is ~110 chars (two
   UUIDs); rendered verbatim with overflow-wrap it made rows ~300px tall. Show
   the host+path only, keep the full URL on href/title, and offer copy. */
.dashboard-url-compact {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
}

.dashboard-url-compact a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.dashboard-url-compact a:hover {
  background: var(--lime);
  color: var(--lime-ink);
}


/* ==========================================================================
   OFFERS
   ========================================================================== */

.offers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.offer {
  border: 1px solid var(--ink);
  background: var(--paper);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-stamp-sm);
  transition: transform var(--dur-base) var(--ease-snap), box-shadow var(--dur-base) var(--ease-snap);
  cursor: pointer;
}

.offer:hover {
  transform: translate(1px, 1px);
  box-shadow: none;
}

.offer.added {
  background: var(--lime);
}

.offer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.offer__logo {
  width: 40px;
  height: 40px;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 75%;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.offer__nm {
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 87.5%;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.offer__cat {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.offer__row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 12px;
}

.offer__row strong {
  font-weight: 700;
}

.offer__btn {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 8px;
  border: 1px solid var(--ink);
  background: var(--paper);
  cursor: pointer;
}

.offer.added .offer__btn {
  background: var(--ink);
  color: var(--lime);
}


/* ==========================================================================
   RECEIPT
   ========================================================================== */

.receipt {
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: 22px;
  box-shadow: var(--shadow-stamp-sm);
  font-family: var(--font-mono);
}

.receipt__h {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--ink-2);
}

.receipt__h strong {
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 75%;
  font-size: 24px;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.receipt__row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 12px;
}

.receipt__row.total {
  padding-top: 10px;
  border-top: 1px dashed var(--ink-2);
  margin-top: 8px;
  font-weight: 700;
  font-size: 14px;
}

.receipt__row .pos {
  color: var(--lime-ink);
  background: var(--lime);
  padding: 1px 6px;
}


/* ==========================================================================
   TOAST
   ========================================================================== */

.app-toast {
  position: fixed;
  bottom: var(--s-6);
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  z-index: var(--z-toast);
  max-width: min(90vw, 360px);
  padding: var(--s-4) var(--s-5);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--ls-label);
  color: var(--lime-ink);
  background: var(--lime);
  border: 1px solid var(--ink);
  box-shadow: var(--shadow-stamp);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-snap), transform var(--dur-base) var(--ease-snap);
}

.app-toast.app-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}


/* ==========================================================================
   LIST ITEMS
   ========================================================================== */

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-4);
  background: var(--paper);
  border-bottom: 1px dashed var(--ink-2);
  margin-bottom: 0;
}

.list-item:last-child {
  border-bottom: 0;
}

.list-item-content {
  display: flex;
  align-items: center;
  gap: var(--s-4);
}

.list-item-icon {
  width: 40px;
  height: 40px;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
}

.list-item-title {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.list-item-subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-2);
  margin-top: 2px;
}

.list-item-value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--lime-ink);
}


/* ==========================================================================
   QUICK ACTIONS
   ========================================================================== */

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-3);
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-5);
  background: var(--paper);
  border: 1px solid var(--ink);
  text-decoration: none;
  color: var(--ink);
  transition: transform var(--dur-base) var(--ease-snap), box-shadow var(--dur-base) var(--ease-snap);
  box-shadow: var(--shadow-stamp-sm);
}

.quick-action:hover {
  transform: translate(1px, 1px);
  box-shadow: none;
  background: var(--lime);
  color: var(--lime-ink);
}

.quick-action-icon {
  width: 40px;
  height: 40px;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
}

.quick-action-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: var(--ls-label);
}


/* ==========================================================================
   EMPTY STATES
   ========================================================================== */

.empty-state {
  text-align: center;
  padding: var(--s-10) var(--s-6);
  color: var(--ink-2);
  font-family: var(--font-mono);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--s-5);
  color: var(--ink-3);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state-title {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--s-3);
  text-transform: uppercase;
  letter-spacing: var(--ls-label);
}

.empty-state-message {
  font-size: 13px;
  margin-bottom: var(--s-6);
  max-width: 40ch;
  margin-left: auto;
  margin-right: auto;
}


/* ==========================================================================
   SETTINGS LAYOUT
   ========================================================================== */

.settings-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--s-6);
  max-width: 1100px;
}

.settings-nav {
  position: sticky;
  top: var(--s-6);
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-nav-item {
  display: block;
  padding: 7px 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  text-decoration: none;
  transition: background var(--dur-base) var(--ease-snap);
}

.settings-nav-item:hover {
  background: var(--paper-2);
  color: var(--ink);
}

.settings-nav-item.active {
  background: var(--ink);
  color: var(--paper);
}

.settings-cards > .card,
.settings-cards > .card-danger {
  scroll-margin-top: var(--s-6);
}

.card-danger {
  background: var(--paper);
  border: 1px solid var(--hazard);
}

@media (max-width: 1100px) {
  .settings-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .settings-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 2px;
    padding-bottom: var(--s-5);
    scrollbar-width: none;
  }

  .settings-nav::-webkit-scrollbar {
    display: none;
  }

  .settings-nav-item {
    white-space: nowrap;
    flex-shrink: 0;
  }
}


/* ==========================================================================
   CMD-K PALETTE
   ========================================================================== */

/* Full-viewport flex centering for Alpine x-show modals. Kept as a class, not
   an inline style: Alpine 3.14's x-show "show" path calls
   el.style.removeProperty('display') on any element with more than one inline
   style property, which would delete an inline `display:flex` and collapse the
   centering to top-left. While hidden, x-show writes `display:none` (overriding
   this class); on show it removes only that, so this class's `display:flex`
   governs again. */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cmd-k-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: var(--z-modal);
}

.cmd-k-palette {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  z-index: calc(var(--z-modal) + 1);
  width: min(520px, 90vw);
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: var(--shadow-stamp-lg);
  overflow: hidden;
}

.cmd-k-header {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--ink);
  color: var(--ink-2);
  font-family: var(--font-mono);
}

.cmd-k-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  font-family: var(--font-mono);
  color: var(--ink);
}

.cmd-k-input::placeholder {
  color: var(--ink-2);
}

.cmd-k-kbd {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 2px 6px;
  border: 1px solid var(--ink);
  background: var(--paper-2);
  color: var(--ink-2);
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.cmd-k-list {
  max-height: 320px;
  overflow-y: auto;
  padding: var(--s-2);
}

.cmd-k-item {
  display: block;
  padding: 7px 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  transition: background var(--dur-base) var(--ease-snap);
}

.cmd-k-item:hover,
.cmd-k-item:focus {
  background: var(--lime);
  color: var(--lime-ink);
  outline: none;
}

.cmd-k-empty {
  padding: var(--s-8) var(--s-5);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-2);
}

.cmd-k-trigger {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  white-space: nowrap;
}

.cmd-k-trigger-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: var(--ls-label);
}

.cmd-k-trigger-kbd {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 2px 6px;
  border: 1px solid var(--ink);
  background: var(--paper-2);
  color: var(--ink-2);
  text-transform: uppercase;
}


/* ==========================================================================
   HELP BUTTON
   ========================================================================== */

.help-btn {
  position: fixed;
  bottom: var(--s-6);
  right: var(--s-6);
  z-index: var(--z-dropdown);
  width: 36px;
  height: 36px;
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: var(--shadow-stamp-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
  text-decoration: none;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  transition: transform var(--dur-base) var(--ease-snap), box-shadow var(--dur-base) var(--ease-snap);
}

.help-btn:hover {
  transform: translate(1px, 1px);
  box-shadow: none;
  background: var(--lime);
  color: var(--lime-ink);
}


/* ==========================================================================
   INTEGRATION TABS
   ========================================================================== */

.integration-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding-bottom: var(--s-5);
  border-bottom: 1px solid var(--ink);
  margin-bottom: var(--s-6);
}

.integration-tab {
  padding: 7px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--dur-base) var(--ease-snap);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: var(--ls-label);
}

.integration-tab:hover {
  background: var(--paper-2);
  color: var(--ink);
}

.integration-tab.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.integration-panel {
  animation: fadeIn 120ms var(--ease-snap);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .integration-panel { animation: none; }
}


/* ==========================================================================
   CODE BLOCK
   ========================================================================== */

.code-block {
  position: relative;
  background: var(--ink);
  border: 1px solid var(--ink);
  overflow: hidden;
  box-shadow: var(--shadow-stamp);
}

.code-block pre {
  margin: 0;
  padding: var(--s-5);
  padding-right: var(--s-10);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.code-block code {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--paper);
  white-space: pre;
  background: transparent;
  border: none;
  padding: 0;
}

.copy-btn {
  position: absolute;
  top: var(--s-3);
  right: var(--s-3);
  padding: 5px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--paper);
  cursor: pointer;
  transition: background var(--dur-base) var(--ease-snap);
}

.copy-btn:hover, .copy-btn.copied {
  background: var(--lime);
  color: var(--lime-ink);
}


/* ==========================================================================
   INTEGRATION STEPS
   ========================================================================== */

.integration-steps {
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
}

.integration-step {
  display: flex;
  align-items: flex-start;
  gap: var(--s-4);
}

.integration-step-num {
  width: 24px;
  height: 24px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.integration-step p {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-1);
  line-height: 1.55;
  margin: 0;
  padding-top: 2px;
}

.integration-step code {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 1px 4px;
  background: var(--paper-2);
  border: 1px solid var(--paper-3);
  color: var(--ink);
}

.integration-step a {
  color: var(--ink);
  text-decoration: underline;
}

.integration-step a:hover {
  background: var(--lime);
  color: var(--lime-ink);
}


/* ==========================================================================
   GRID UTILITIES
   ========================================================================== */

.grid {
  display: grid;
  gap: var(--s-5);
}

.grid-auto {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 0;
  border: 1px solid var(--ink);
}

@media (min-width: 640px) {
  .grid-auto { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .grid-auto { grid-template-columns: repeat(4, 1fr); }
}

.grid-2-1 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 1024px) {
  .grid-2-1 { grid-template-columns: 2fr 1fr; }
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-5);
}

@media (min-width: 768px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-5);
}

@media (min-width: 640px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}


/* ==========================================================================
   MOBILE RESPONSIVE
   ========================================================================== */

.mobile-menu-btn {
  display: none;
  position: fixed;
  top: var(--s-5);
  left: var(--s-5);
  z-index: calc(var(--z-sticky) - 2);
  padding: var(--s-3);
  min-width: 44px;
  min-height: 44px;
  background: var(--paper);
  border: 1px solid var(--ink);
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow-stamp-sm);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 16px;
}

@media (max-width: 1100px) {
  .app, .app-layout {
    grid-template-columns: 1fr;
  }

  .sb, .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    z-index: var(--z-sticky);
    width: 208px;
  }

  .sb.open, .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close {
    display: flex;
  }

  .sidebar-overlay.open {
    display: block;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .tb, .topbar {
    padding-left: 56px;
  }

  .stats, .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat:nth-child(2), .metric-card:nth-child(2) {
    border-right: 0;
  }

  .stat:nth-child(1), .stat:nth-child(2),
  .metric-card:nth-child(1), .metric-card:nth-child(2) {
    border-bottom: 1px solid var(--ink);
  }

  .row2, .content-grid, .content-grid-equal {
    grid-template-columns: 1fr;
  }

  .offers {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 639px) {
  .tb, .topbar {
    flex-direction: column;
    align-items: stretch;
    padding: var(--s-4);
    padding-left: 56px;
  }

  .tb__right, .topbar-actions {
    margin-top: var(--s-4);
    flex-wrap: wrap;
  }

  .main-content, .main {
    padding: var(--s-4);
  }

  .cmd-k-trigger-label,
  .cmd-k-trigger-kbd {
    display: none;
  }
}
