/* Spendly — dashboard */
body {
  background: var(--porcelain);
}
.shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
}
.shell[hidden],
.gate[hidden] {
  display: none;
}

/* ---------- sidebar */
.side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 1.4rem 1rem 1.25rem 1.5rem;
  border-right: 1px solid var(--line);
}
.side-nav {
  display: grid;
  gap: 2px;
}
.side-nav a {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: var(--r-sm);
  color: var(--slate);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--t-sm);
}
.side-nav a:hover {
  color: var(--graphite);
  background: rgba(255, 255, 255, 0.5);
}
.side-nav a[aria-current='page'] {
  color: var(--graphite);
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--line-soft);
  font-weight: 600;
}
.side-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.side-out {
  justify-content: flex-start;
}

/* ---------- top */
.main {
  min-width: 0;
  padding: 1.5rem clamp(16px, 3.5vw, 48px) 4rem;
}
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}
.top h1 {
  margin: 0;
  font-size: var(--t-2xl);
  letter-spacing: -0.04em;
  line-height: 1.1;
}
.top-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.who {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--line-soft);
  font-size: var(--t-xs);
  font-weight: 600;
  white-space: nowrap;
}
.chip i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
}
.chip.sol i {
  background: #9945ff;
}
.mode-chip {
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: var(--warn-tint);
  color: var(--warn);
  font-size: var(--t-xs);
  font-weight: 700;
}
.mode-chip[hidden] {
  display: none;
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .side {
    position: sticky;
    height: auto;
    z-index: 10;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: var(--nav-glass);
    backdrop-filter: blur(10px);
    overflow-x: auto;
  }
  .side-nav {
    display: flex;
    gap: 0.25rem;
  }
  .side-nav a {
    white-space: nowrap;
  }
  .side-foot {
    margin-left: auto;
  }
  .side-out {
    display: none;
  }
  .top {
    flex-direction: column;
    align-items: flex-start;
  }
  .who {
    justify-content: flex-start;
  }
}

/* ---------- blocks */
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 1100px) {
  .grid {
    grid-template-columns: 1fr;
  }
}
.panel {
  background: var(--paper);
  border-radius: var(--r-lg);
  box-shadow: inset 0 0 0 1px var(--line-soft);
  padding: 1.4rem 1.5rem;
}
.panel + .panel {
  margin-top: 1.25rem;
}
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.panel-head h2 {
  margin: 0;
  font-size: var(--t-lg);
  letter-spacing: -0.02em;
}
.panel-head a,
.link {
  color: var(--cobalt);
  font-size: var(--t-sm);
  font-weight: 600;
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.panel-head a:hover,
.link:hover {
  text-decoration: underline;
}
.muted {
  color: var(--slate);
}
.small {
  font-size: var(--t-sm);
}
.big-number {
  font-size: clamp(2.5rem, 5vw, 3.75rem);
  font-weight: 750;
  letter-spacing: -0.05em;
  line-height: 1;
  margin: 0.25rem 0 0.6rem;
}
.empty {
  padding: 1.5rem 0 0.5rem;
  color: var(--slate);
}
.empty b {
  color: var(--graphite);
}

/* asset rows */
.rows {
  list-style: none;
  margin: 0;
  padding: 0;
}
.rows li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 1rem;
  align-items: center;
  padding: 0.7rem 0;
  border-top: 1px solid var(--line-soft);
  font-size: var(--t-sm);
}
.rows li:first-child {
  border-top: 0;
}
.asset {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}
.asset .sym {
  font-weight: 700;
}
.asset .net {
  color: var(--slate);
}
.tok {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  color: #fff;
  font-size: 0.66rem;
  font-weight: 800;
}
.right {
  text-align: right;
}

/* ---------- gift cards */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.toolbar .spacer {
  flex: 1;
}
.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--line-soft);
}
.seg button {
  border: 0;
  background: transparent;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--slate);
  cursor: pointer;
}
.seg button[aria-pressed='true'] {
  background: var(--graphite);
  color: var(--on-graphite);
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.75rem 1.25rem;
}
.gc {
  display: grid;
  gap: 0.75rem;
}
.gc-face {
  position: relative;
  aspect-ratio: 1.586;
  border-radius: 14px;
  padding: 1.05rem 1.15rem;
  color: #fff;
  background: var(--brand, #222);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08), 0 14px 28px -16px rgba(26, 29, 33, 0.55);
  isolation: isolate;
}
/* subtle printed-plastic sheen */
.gc-face::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0) 38%), radial-gradient(120% 90% at 100% 100%, rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0) 60%);
}
.gc-face.empty-card {
  filter: grayscale(1);
  opacity: 0.55;
}
.gc-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}
.gc-top img {
  height: 26px;
  width: 92px;
  object-fit: contain;
  object-position: left center;
  filter: brightness(0) invert(1);
}
.gc-top .country {
  font-size: var(--t-xs);
  font-weight: 600;
  opacity: 0.85;
  text-align: right;
}
.gc-tag {
  display: inline-block;
  margin-top: 0.3rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 0.68rem;
  font-weight: 700;
}
.gc-bottom .label {
  font-size: var(--t-xs);
  opacity: 0.8;
}
.gc-bottom .bal {
  font-size: 1.85rem;
  font-weight: 750;
  letter-spacing: -0.04em;
  line-height: 1.05;
}
.gc-bottom .of {
  font-size: var(--t-sm);
  opacity: 0.8;
  font-weight: 500;
  letter-spacing: 0;
}
.meter {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.25);
  margin-top: 0.55rem;
  overflow: hidden;
}
.meter span {
  display: block;
  height: 100%;
  background: #fff;
  border-radius: 2px;
}
.gc-code {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--t-sm);
}
.gc-code code {
  font-family: var(--font);
  font-weight: 700;
  letter-spacing: 0.06em;
  user-select: all;
}
.gc-code .spacer {
  flex: 1;
}
.gc-note {
  margin: 0;
  font-size: var(--t-xs);
  color: var(--slate);
}
.gc-actions {
  display: flex;
  gap: 1rem;
  font-size: var(--t-xs);
}
.gc-actions .link {
  font-size: var(--t-xs);
}
.gc-actions .danger {
  color: var(--err);
}
.inline-edit {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* forms */
.form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.9rem 1rem;
  align-items: end;
}
.field {
  display: grid;
  gap: 0.3rem;
  font-size: var(--t-sm);
}
.field label {
  color: var(--slate);
  font-weight: 500;
}
.input,
.field input,
.field select {
  height: 2.6rem;
  padding: 0 0.75rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--white);
  font-size: var(--t-sm);
  min-width: 0;
}
.input:focus,
.field input:focus,
.field select:focus {
  outline: 2px solid var(--cobalt);
  outline-offset: -1px;
  border-color: transparent;
}
.form-err {
  color: var(--err);
  font-size: var(--t-sm);
  min-height: 1.25rem;
}

/* table */
.table-wrap {
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-sm);
  min-width: 640px;
}
.table th {
  text-align: left;
  font-weight: 500;
  color: var(--slate);
  padding: 0 0.75rem 0.6rem 0;
  border-bottom: 1px solid var(--line);
}
.table td {
  padding: 0.8rem 0.75rem 0.8rem 0;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
.table tr:last-child td {
  border-bottom: 0;
}
.state {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: var(--t-xs);
  font-weight: 700;
}
.state.done {
  background: var(--ok-tint);
  color: var(--ok);
}
.state.simulated {
  background: var(--warn-tint);
  color: var(--warn);
}
.state.error {
  background: var(--err-tint);
  color: var(--err);
}

/* wallets */
.wallet-block {
  padding: 1.25rem 0;
  border-top: 1px solid var(--line-soft);
}
.wallet-block:first-of-type {
  border-top: 0;
  padding-top: 0.25rem;
}
.wallet-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  margin-bottom: 0.75rem;
}
.wallet-head h3 {
  margin: 0;
  font-size: var(--t-md);
}
.wallet-head .addr {
  font-size: var(--t-sm);
  color: var(--slate);
}
.wallet-head .acts {
  margin-left: auto;
  display: flex;
  gap: 1rem;
  align-items: center;
}
.badge {
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: var(--cobalt-tint);
  color: var(--cobalt);
  font-size: var(--t-xs);
  font-weight: 700;
}

/* extension */
.ext-state {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
}
.ext-state i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--mist);
}
.ext-state.ok i {
  background: var(--ok);
}
.ext-state.warn i {
  background: #d08a1c;
}
.steps-list {
  margin: 1rem 0 0;
  padding-left: 1.2rem;
  color: var(--slate);
  font-size: var(--t-sm);
  display: grid;
  gap: 0.4rem;
}
.steps-list code {
  background: var(--porcelain);
  padding: 0.05em 0.35em;
  border-radius: 4px;
}

/* store matrix (dashboard) */
.store-list {
  display: grid;
  gap: 0.75rem;
}
.store-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line-soft);
}
.store-row:first-child {
  border-top: 0;
}
.store-row img {
  height: 26px;
  width: 90px;
  object-fit: contain;
  object-position: left center;
}
.store-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.store-links a {
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: var(--t-xs);
  font-weight: 600;
  text-decoration: none;
  color: var(--graphite);
}
.store-links a:hover {
  box-shadow: inset 0 0 0 1px var(--graphite);
}

/* gate */
.gate {
  min-height: 100vh;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 1.25rem;
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 24px;
}
.gate h1 {
  margin: 1.5rem 0 0;
  font-size: clamp(2.2rem, 5vw, 3.75rem);
  line-height: 1;
  letter-spacing: -0.05em;
}
.gate p {
  margin: 0 0 0.75rem;
  color: var(--slate);
}

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 200;
  padding: 0.7rem 1rem;
  border-radius: var(--r-md);
  background: var(--graphite);
  color: var(--on-graphite);
  font-size: var(--t-sm);
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.45);
  animation: rise 0.25s var(--ease-out);
}
.toast[hidden] {
  display: none;
}
.skeleton {
  height: 1rem;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--line-soft), var(--paper), var(--line-soft));
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* dark theme: cards keep their brand colour, a hairline separates dark faces from the page */
:root[data-theme-effective='dark'] .gc-face {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07), 0 14px 28px -16px rgba(0, 0, 0, 0.8);
}
.store-row img {
  filter: var(--logo-filter);
}
.price-tag {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: var(--t-xs);
  font-weight: 700;
}
.price-tag.saving {
  background: var(--ok-tint);
  color: var(--ok);
}
.price-tag.fee {
  background: var(--warn-tint);
  color: var(--warn);
}
