/*
 * Single-screen shell, global search, drill-down window.
 *
 * Loaded after live.css and overrides it where the layout changed. The rule
 * this file enforces: the app is exactly viewport-height, and `main` never
 * scrolls. Anything that would overflow either paginates (tables) or splits
 * into tabs (panels).
 */

/* --- shell -------------------------------------------------------------- */

html, body { height: 100%; overflow: hidden; }

.app-shell {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  grid-template-rows: 56px minmax(0, 1fr) 28px;
  overflow: hidden;
}

.topbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 176px minmax(220px, 1fr) auto;
  align-items: center;
  gap: 16px;
  height: 56px;
  padding: 0 14px 0 13px;
  border-bottom: 1px solid var(--line);
  background: rgba(4, 5, 6, 0.94);
  z-index: 40;
}

.sidebar { grid-row: 2; overflow: hidden; border-right: 1px solid var(--line-soft); }
.nav-scroll { height: 100%; overflow-y: auto; padding: 8px 8px 16px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 11.5px;
  color: var(--muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.nav-item:hover { background: rgba(217, 175, 87, .07); color: var(--text); }
.nav-item.active {
  background: rgba(217, 175, 87, .12);
  border-left-color: var(--gold);
  color: var(--gold-bright);
  font-weight: 620;
}
.nav-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-flag { flex: 0 0 auto; font-size: 10px; color: var(--faint); }

.main {
  grid-column: 2;
  grid-row: 2;
  min-height: 0;
  min-width: 0;
  overflow: hidden;   /* the whole point: no page-level vertical scroll */
  padding: 12px 14px;
  display: flex;
}

.statusbar { grid-column: 1 / -1; grid-row: 3; height: 28px; }

/* --- page scaffold ------------------------------------------------------ */

.page {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: grid;
  /* minmax(0, 1fr) on the column, not just the rows: without it a grid item
     keeps its automatic minimum width and a wide table or KPI strip pushes the
     whole page past the viewport instead of shrinking to fit. */
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.page-head-text { min-width: 0; }
.page-title { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -.015em; }
.page-sub { margin: 2px 0 0; font-size: 11px; color: var(--muted); }
.page-head-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.page-body {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}
/* A body with a single child gives that child the whole area. */
.page-body > :only-child { grid-row: 1 / -1; }

.panel-fill {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.scroll-inner { overflow-y: auto; }

.panel-head-inline {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.panel-title-sm { font-size: 12px; font-weight: 660; }
.panel-sub-sm { font-size: 10px; color: var(--faint); }
.chart-fill { flex: 1 1 auto; min-height: 120px; display: flex; align-items: stretch; }
.chart-fill .live-chart { width: 100%; height: 100%; min-height: 120px; align-self: stretch; }

/* --- global search ------------------------------------------------------ */

.search-wrap { position: relative; min-width: 0; }

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-2);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.search-field:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(217, 175, 87, .1);
}
.search-icon { width: 14px; height: 14px; color: var(--faint); flex: 0 0 auto; }

#globalSearch {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  outline: none;
}
#globalSearch::placeholder { color: var(--faint); }
#globalSearch::-webkit-search-cancel-button { filter: invert(.6); }

.search-kbd {
  flex: 0 0 auto;
  padding: 1px 6px;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  font-size: 9.5px;
  color: var(--faint);
  font-family: inherit;
}
.search-field:focus-within .search-kbd { opacity: 0; }

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: min(60vh, 520px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  z-index: 60;
  padding: 6px;
}
.search-results[hidden] { display: none; }

.search-status {
  display: flex; align-items: center; gap: 8px;
  padding: 16px; font-size: 11.5px; color: var(--muted);
}
.search-status.error { color: var(--red); }
.search-took { color: var(--faint); font-size: 10px; }

.search-group + .search-group { margin-top: 4px; border-top: 1px solid var(--line-soft); padding-top: 4px; }
.search-group-head {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 5px 9px;
  font-size: 9.5px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--faint);
}
.search-group-err { color: var(--red); text-transform: none; letter-spacing: 0; font-weight: 500; }

.search-hit {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.search-hit:hover, .search-hit:focus-visible { background: rgba(217, 175, 87, .1); outline: none; }

.hit-kind {
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 9px; font-weight: 700; text-align: center;
  background: rgba(255, 255, 255, .06); color: var(--muted);
}
.hit-order { background: rgba(217, 175, 87, .16); color: var(--gold); }
.hit-product { background: rgba(88, 207, 145, .14); color: var(--green); }
.hit-customer { background: rgba(200, 184, 143, .16); color: var(--violet); }
.hit-content { background: rgba(240, 169, 66, .14); color: var(--amber); }

.hit-body { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.hit-title { font-size: 12px; font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hit-sub { font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hit-meta {
  font-size: 10px; color: var(--faint); max-width: 200px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.search-foot {
  padding: 7px 9px 4px;
  border-top: 1px solid var(--line-soft);
  font-size: 9.5px; color: var(--faint);
}

/* --- header actions ----------------------------------------------------- */

.header-actions { display: flex; align-items: center; gap: 8px; }

.icon-action {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .12s var(--ease), color .12s var(--ease), background .12s var(--ease);
}
.icon-action svg { width: 15px; height: 15px; }
.icon-action:hover { border-color: var(--line); color: var(--gold-bright); background: rgba(217, 175, 87, .08); }
.icon-action.spinning svg { animation: dp-spin .8s linear infinite; }

.avatar-wrap { position: relative; }

.avatar-btn {
  display: flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 7px 0 4px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  transition: border-color .12s var(--ease), background .12s var(--ease);
}
.avatar-btn:hover { border-color: var(--line); background: rgba(217, 175, 87, .08); }

.avatar {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--gold-deep), var(--gold));
  color: #100d07;
  font-size: 10px; font-weight: 750; letter-spacing: .02em;
}
.avatar-caret { width: 9px; height: 6px; color: var(--faint); }

.avatar-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 236px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  z-index: 60;
}
.avatar-menu[hidden] { display: none; }

.avatar-menu-head { padding: 8px 9px 9px; border-bottom: 1px solid var(--line-soft); margin-bottom: 4px; }
.avatar-menu-email { font-size: 11.5px; font-weight: 620; overflow: hidden; text-overflow: ellipsis; }
.avatar-menu-role { margin-top: 2px; font-size: 9.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; }

.avatar-menu-item {
  display: block; width: 100%;
  padding: 7px 9px;
  border: 0; border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 11.5px; text-align: left; text-decoration: none;
  cursor: pointer;
}
.avatar-menu-item:hover { background: rgba(217, 175, 87, .1); }
.avatar-menu-item.danger { color: #ff97a5; }
.avatar-menu-item.danger:hover { background: rgba(255, 102, 120, .1); }
.avatar-menu-sep { height: 1px; margin: 4px 0; background: var(--line-soft); }

/* --- KPI strip ---------------------------------------------------------- */

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 8px;
}

.kpi {
  display: flex; flex-direction: column; gap: 3px;
  padding: 9px 11px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: var(--surface);
  min-width: 0;
  transition: transform .13s var(--ease), border-color .13s var(--ease), box-shadow .13s var(--ease);
}
.kpi-label {
  font-size: 9px; font-weight: 680; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kpi-value { font-size: 21px; font-weight: 640; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-foot { min-height: 13px; font-size: 9.5px; }
.kpi-reason { color: var(--faint); font-size: 9.5px; }
.kpi-unavailable { border-style: dashed; opacity: .6; }
.kpi-unavailable .kpi-value { color: var(--faint); }

/* --- tabs --------------------------------------------------------------- */

.tab-strip {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--line-soft);
  overflow-x: auto;
}
.tab-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 13px;
  border: 0; border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px; font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color .12s var(--ease), border-color .12s var(--ease);
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--gold-bright); border-bottom-color: var(--gold); }
.tab-count {
  padding: 1px 6px; border-radius: 999px;
  background: rgba(255, 255, 255, .07);
  font-size: 9px; font-weight: 700;
}
.tab-btn.active .tab-count { background: rgba(217, 175, 87, .18); color: var(--gold-bright); }

.tab-panels { min-width: 0; min-height: 0; display: flex; }
.tab-panel { display: none; flex: 1 1 auto; min-width: 0; min-height: 0; }
.tab-panel.active { display: flex; flex-direction: column; }

/* The tab host owns the strip and the panels as one grid item. */
.tab-host {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
}
/*
 * A wrapper a view renders tabs into. Keyed on a class, not on each view's id:
 * an id-based rule silently missed Integration Control and let its tab host
 * grow past the viewport.
 */
.tab-mount { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.tab-mount > .tab-host { flex: 1 1 auto; min-height: 0; }

/* --- tables & pagination ------------------------------------------------ */

.table-wrap { flex: 1 1 auto; min-height: 0; overflow: hidden; }

.sync-table { width: 100%; border-collapse: collapse; font-size: 11.5px; table-layout: fixed; }
.sync-table th {
  padding: 6px 9px;
  position: sticky; top: 0; z-index: 1;
  background: var(--surface);
  text-align: left;
  font-size: 9px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--faint);
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
.sync-table td {
  padding: 7px 9px;
  border-bottom: 1px solid rgba(255, 255, 255, .03);
  vertical-align: middle;
  overflow: hidden; text-overflow: ellipsis;
}
.cell-strong { font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-sub { font-size: 10px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.cell-dim { color: var(--faint); }

.table-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding-top: 8px; margin-top: 6px;
  border-top: 1px solid var(--line-soft);
  font-size: 10px; color: var(--faint);
  flex: 0 0 auto;
}
.table-note { color: var(--faint); }

.pager { display: flex; align-items: center; gap: 3px; }
.pager-btn {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px; cursor: pointer;
}
.pager-btn:hover:not(:disabled) { border-color: var(--gold-deep); color: var(--gold-bright); }
.pager-btn:disabled { opacity: .3; cursor: default; }
.pager-state { padding: 0 7px; font-variant-numeric: tabular-nums; color: var(--muted); }

/* --- notices ------------------------------------------------------------ */

.notice {
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.5;
  margin-bottom: 10px;
  flex: 0 0 auto;
}
.notice-warn {
  border: 1px solid rgba(240, 169, 66, .3);
  background: rgba(240, 169, 66, .07);
  color: var(--gold-pale);
}

/* --- interactive components -------------------------------------------- */

/*
 * Everything that opens a drill-down lifts on hover and shows a focus ring on
 * keyboard focus, so "this is clickable" is discoverable without a tooltip.
 */
.is-drillable { cursor: pointer; transition: transform .13s var(--ease), background .13s var(--ease), border-color .13s var(--ease), box-shadow .13s var(--ease); }
.is-drillable:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.kpi.is-drillable:hover {
  transform: translateY(-2px);
  border-color: var(--gold-deep);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .45), var(--gold-glow);
}

tr.is-drillable:hover { background: rgba(217, 175, 87, .07); }
tr.is-drillable:hover .cell-strong { color: var(--gold-bright); }

.live-bar-row.is-drillable { padding: 3px 5px; margin: 0 -5px; border-radius: 6px; }
.live-bar-row.is-drillable:hover { background: rgba(217, 175, 87, .08); }
.live-bar-row.is-drillable:hover .live-bar-label { color: var(--gold-bright); }

.task-row.is-drillable { padding-left: 5px; padding-right: 5px; margin: 0 -5px; border-radius: 6px; }
.task-row.is-drillable:hover { background: rgba(217, 175, 87, .07); }

.connector-card.is-drillable:hover {
  transform: translateY(-2px);
  border-color: var(--gold-deep);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .45);
}

/* --- drill-down window -------------------------------------------------- */

body.drill-open { overflow: hidden; }

.drill-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 3, 4, .74);
  backdrop-filter: blur(6px);
  animation: drill-fade .14s var(--ease);
}
.drill-overlay[hidden] { display: none; }
@keyframes drill-fade { from { opacity: 0; } to { opacity: 1; } }

.drill-window {
  width: min(1180px, 100%);
  height: min(84vh, 860px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-2);
  box-shadow: 0 40px 100px rgba(0, 0, 0, .7);
  overflow: hidden;
  animation: drill-rise .18s var(--ease);
}
@keyframes drill-rise { from { transform: translateY(14px) scale(.99); opacity: 0; } to { transform: none; opacity: 1; } }

.drill-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: start;
  gap: 14px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
}
.drill-kicker {
  display: block;
  font-size: 9px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--gold);
}
.drill-title { margin: 3px 0 0; font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.drill-sub { margin: 3px 0 0; font-size: 11px; color: var(--muted); }
.drill-head-actions { display: flex; gap: 8px; }

.drill-close {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px; cursor: pointer;
}
.drill-close:hover { border-color: var(--red); color: var(--red); }

.drill-body { overflow-y: auto; padding: 16px 18px 20px; }

.drill-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.drill-kpi {
  display: flex; flex-direction: column; gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: var(--surface);
}
.drill-kpi-label {
  font-size: 9px; font-weight: 680; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted);
}
.drill-kpi-value { font-size: 19px; font-weight: 640; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.drill-kpi.kpi-unavailable { border-style: dashed; opacity: .6; }
.drill-kpi.kpi-unavailable .drill-kpi-value { color: var(--faint); }

.drill-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 14px; }
.drill-grid-wide { grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); }

.drill-card {
  padding: 14px 15px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--surface);
  min-width: 0;
}
.drill-card-title {
  margin: 0 0 9px;
  font-size: 9.5px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--faint);
}
.drill-card-title:not(:first-child) { margin-top: 16px; }

.drill-card .sync-table { table-layout: auto; }
.drill-card .sync-table th { background: var(--surface); }

.drill-scroll { max-height: 340px; overflow-y: auto; }

.drill-totals { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line-soft); }
.drill-total-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 3px 0; font-size: 11.5px; color: var(--muted);
}
.drill-total-row.strong {
  margin-top: 5px; padding-top: 7px;
  border-top: 1px solid var(--line-soft);
  color: var(--text); font-weight: 680; font-size: 13px;
}

.drill-note {
  margin-top: 11px; padding: 8px 10px;
  border-left: 2px solid var(--gold-deep);
  background: rgba(217, 175, 87, .05);
  font-size: 10.5px; line-height: 1.55; color: var(--muted);
}
.drill-text { margin: 0; font-size: 11.5px; line-height: 1.6; color: var(--muted); }
.drill-list { margin: 0; padding-left: 17px; font-size: 11px; line-height: 1.75; color: var(--muted); }
.drill-link { display: inline-flex; margin-top: 11px; text-decoration: none; }

.drill-row { cursor: pointer; }
.drill-row:hover { background: rgba(217, 175, 87, .08); }

/* --- responsive --------------------------------------------------------- */

@media (max-width: 1180px) {
  .drill-grid, .drill-grid-wide { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; grid-template-rows: auto auto minmax(0, 1fr) 28px; }
  .topbar { grid-template-columns: 1fr auto; row-gap: 8px; height: auto; padding: 9px 12px; }
  .search-wrap { grid-column: 1 / -1; order: 3; }
  .sidebar { grid-row: 2; max-height: 120px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-scroll { display: flex; gap: 12px; overflow-x: auto; }
  .nav-group { flex: 0 0 auto; }
  .main { grid-column: 1; grid-row: 3; padding: 10px; }
  .drill-window { height: 92vh; }
}

/* --- boot guard ---------------------------------------------------------- */

.boot-error {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #050506;
  color: #f5f3ee;
  font-family: Inter, ui-sans-serif, -apple-system, "Segoe UI", sans-serif;
}
.boot-error[hidden] { display: none !important; }
.boot-card {
  max-width: 560px;
  padding: 28px 30px;
  border: 1px solid rgba(220, 177, 88, .3);
  border-radius: 12px;
  background: #0a0b0d;
  line-height: 1.6;
}
.boot-card h1 { margin: 0 0 12px; font-size: 19px; color: #f1d477; }
.boot-card p { margin: 0 0 11px; font-size: 13px; color: #aaa59c; }
.boot-card code {
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .07);
  font-size: 12px;
  color: #ffe9a6;
}
.boot-how { margin-top: 14px !important; padding-top: 13px; border-top: 1px solid rgba(220, 177, 88, .16); }

/* --- product images ------------------------------------------------------ */

.thumb {
  width: 34px;
  height: 34px;
  display: block;
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
}
.thumb-empty {
  display: grid;
  place-items: center;
  color: var(--faint);
  font-size: 11px;
}
.thumb-broken { position: relative; }

.gallery { display: flex; flex-wrap: wrap; gap: 8px; }
.gallery-item {
  display: block;
  width: 84px;
  height: 84px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
  transition: border-color .13s var(--ease), transform .13s var(--ease);
}
.gallery-item:hover { border-color: var(--gold); transform: translateY(-2px); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* --- credential entry ---------------------------------------------------- */

.cred-form { display: flex; flex-direction: column; gap: 12px; }

.cred-field { display: flex; flex-direction: column; gap: 5px; }

.cred-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 10.5px;
}
.cred-label code {
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .06);
  color: var(--gold-pale);
  font-size: 10px;
}

.cred-set {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(88, 207, 145, .13);
  color: var(--green);
  font-size: 9px;
  font-weight: 650;
  white-space: nowrap;
}
.cred-unset {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .05);
  color: var(--faint);
  font-size: 9px;
  font-weight: 650;
}

.cred-input-row { display: flex; gap: 7px; align-items: stretch; }

.cred-input-row input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 11px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.cred-input-row input:focus {
  border-color: var(--gold);
  outline: none;
  box-shadow: 0 0 0 3px rgba(217, 175, 87, .1);
}
.cred-input-row input::placeholder { font-family: inherit; color: var(--faint); }

.cred-clear { flex: 0 0 auto; }

.cred-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.cred-status { font-size: 10.5px; color: var(--muted); line-height: 1.5; flex: 1 1 200px; }
.cred-status.good { color: var(--green); }
.cred-status.warn { color: var(--amber); }
.cred-status.bad  { color: var(--red); }
