/* Slipstack side panel. Tokens and primitives come from base.css, copied in by the build. */

body.panel {
  min-width: 320px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}

/* Served on the site under /ext/, the panel keeps the width it has in the browser. */
body.panel.is-web {
  max-width: 460px;
  margin-inline: auto;
  border-inline: 1px solid var(--line);
}
body.popup.is-web {
  margin-inline: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  margin-block: var(--s-7);
}

.pnl-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px var(--s-4);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.pnl-top .mark { width: 26px; height: 26px; border-radius: 8px; }
.pnl-top .mark svg { width: 26px; height: 26px; }
.pnl-brand { font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: -0.02em; }
.pnl-quota {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--muted);
  white-space: nowrap;
}

.pnl-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
}
.pnl-tab {
  min-height: 44px;
  padding: 9px 4px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.pnl-tab:hover { color: var(--text); background: var(--paper-3); }
.pnl-tab.is-active { color: var(--text); border-bottom-color: var(--accent); background: var(--paper); }

.pnl-body { flex: 1; overflow-y: auto; padding: var(--s-4); }
.pnl-view[hidden] { display: none; }

.pnl-note {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--paper-2);
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-bottom: var(--s-3);
}
.pnl-note--error { border-color: #eec9c5; background: var(--danger-soft); color: var(--danger); }
.pnl-note--ok { border-color: #c7e3d9; background: var(--accent-soft); color: var(--accent-strong); }
.pnl-note[hidden] { display: none; }

.pnl-drop {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: var(--s-6) var(--s-4);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-2);
  background: #fff;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.pnl-drop:hover, .pnl-drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.pnl-drop__title { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.pnl-drop__how { font-size: var(--fs-xs); color: var(--muted); }

.pnl-queue { display: grid; gap: 8px; margin-top: var(--s-3); }
.pnl-queue[hidden] { display: none; }
.pnl-queueitem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: #fff;
  font-size: var(--fs-xs);
}
.pnl-queueitem__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pnl-queueitem__state { font-family: var(--font-mono); color: var(--muted); }
.pnl-queueitem.is-done { border-color: #9fd0bf; background: var(--accent-soft); }
.pnl-queueitem.is-failed { border-color: #eec9c5; background: var(--danger-soft); }

.pnl-doc { display: grid; gap: var(--s-3); }
.pnl-docimg {
  width: 100%;
  max-height: 190px;
  object-fit: cover;
  object-position: top center;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: #fff;
}
.pnl-docbar { display: flex; align-items: center; gap: var(--s-2); }
.pnl-docbar__title { font-size: var(--fs-xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pnl-docbar .btn { margin-left: auto; }

.pnl-fields { display: grid; border: 1px solid var(--line); border-radius: var(--r-2); background: #fff; overflow: hidden; }
.pnl-field {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--paper-3);
}
.pnl-field:last-child { border-bottom: 0; }
.pnl-field__key { font-size: var(--fs-xs); font-weight: 500; color: var(--muted); }
.pnl-field__input {
  width: 100%;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.pnl-field__input:hover { border-color: var(--line); }
.pnl-field__input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
  background: #fff;
}
.pnl-field__input:focus:not(:focus-visible) { border-color: var(--accent); background: #fff; }
.pnl-copy {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.pnl-copy:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.pnl-copy.is-done { border-color: var(--accent); background: var(--accent); color: #fff; }
.pnl-copy svg { width: 13px; height: 13px; }

.pnl-items { border: 1px solid var(--line); border-radius: var(--r-2); background: #fff; overflow: hidden; }
.pnl-items[hidden] { display: none; }
.pnl-items__head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--muted);
}
.pnl-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--paper-3);
  font-size: var(--fs-xs);
}
.pnl-item:last-child { border-bottom: 0; }
.pnl-item__name { grid-column: 1; }
.pnl-item__meta { grid-column: 1; font-size: var(--fs-xs); color: var(--muted); }
.pnl-item__amount { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-family: var(--font-mono); }

.pnl-actions { display: grid; gap: 8px; }
.pnl-actions .btn { width: 100%; }

.pnl-list { display: grid; gap: 8px; }
.pnl-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.pnl-row:hover { border-color: var(--accent); background: var(--accent-soft); }
.pnl-row__thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.pnl-row__vendor { font-size: var(--fs-xs); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pnl-row__meta { font-size: var(--fs-xs); color: var(--muted); }
.pnl-row__total { font-family: var(--font-mono); font-size: var(--fs-xs); }

.pnl-empty {
  padding: var(--s-6) var(--s-4);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-2);
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.pnl-empty[hidden] { display: none; }

.pnl-form { display: grid; gap: 10px; margin-bottom: var(--s-4); }
.pnl-form label { font-size: var(--fs-xs); font-weight: 500; color: var(--muted); display: grid; gap: 4px; }
.pnl-form .input, .pnl-form .select { min-height: 36px; font-size: var(--fs-xs); }

.pnl-rule {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: #fff;
  font-size: var(--fs-xs);
}
.pnl-rule__vendor { font-weight: 600; }
.pnl-rule__meta { font-size: var(--fs-xs); color: var(--muted); }
.pnl-rule__del { grid-column: 2; grid-row: 1 / span 2; align-self: center; }

.pnl-ad {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: var(--paper-2);
}
.pnl-ad[hidden] { display: none; }
.pnl-ad__label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.pnl-ad__headline { font-size: var(--fs-xs); font-weight: 600; }
.pnl-ad__body { font-size: var(--fs-xs); color: var(--muted); }
.pnl-ad__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.pnl-ad__from { font-size: var(--fs-xs); color: var(--muted-2); }

.pnl-signin { display: grid; gap: 6px; }
.pnl-signin label { font-size: var(--fs-xs); font-weight: 500; color: var(--muted); margin-top: 6px; }
.pnl-signin .input { min-height: 38px; }

.pnl-meta { font-size: var(--fs-xs); color: var(--muted-2); }
.pnl-h { font-family: var(--font-display); font-size: 16px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 10px; }

/* Below the tablet break the pointer is a finger, so every control reaches 44px. */
@media (max-width: 430px) {
  .pnl-copy { width: 44px; height: 44px; }
  .btn--sm { min-height: 44px; padding: 0 16px; }
  .brand { min-height: 44px; }
}

/* Full-window pages that reuse the panel language: onboarding and the autofill sandbox. */
body.page {
  padding: var(--s-7) var(--s-5);
}
.page__wrap { max-width: 680px; margin-inline: auto; }
.page__steps { display: grid; gap: var(--s-4); margin-top: var(--s-6); }
.page__step {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: var(--s-4);
  padding: var(--s-5);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  background: #fff;
}
.page__index { font-family: var(--font-mono); font-size: 18px; color: var(--accent); }
