/* ── Подарочные сертификаты ─────────────────────────────────────────────
   Each certificate is drawn as the gift card itself: a coloured face (colour by
   face value, ribbon + bow), a perforated tear line, and the working stub below
   — number, PIN, status, validity, buyer, actions. Faces use fixed colours on
   purpose: a card is an object, it looks the same in every mood of the panel. */

.gc-lead { margin: -8px 0 18px; max-width: 80ch; }
.gc-search { position: relative; display: block; flex: 0 1 340px; }
.gc-search svg {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; fill: none; stroke: var(--subtle); stroke-width: 2; stroke-linecap: round;
  pointer-events: none;
}
.gc-search input { width: 100%; padding-left: 38px; border-radius: var(--r-pill); }

/* KPI strip */
.gc-kpis {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--r-lg); overflow: hidden;
}
.gc-kpis:empty { display: none; }
.gc-kpi {
  display: flex; flex-direction: column; gap: 6px; padding: 14px 16px;
  background: transparent; border: 0; border-radius: 0;
  box-shadow: inset -1px 0 0 var(--divider), inset 0 -1px 0 var(--divider);
}
.gc-kpi-label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.gc-kpi-value {
  font-family: var(--font-ui); font-size: 26px; font-weight: 700; letter-spacing: -0.03em; line-height: 1;
  color: var(--ink); font-variant-numeric: tabular-nums lining-nums; white-space: nowrap;
}
.gc-kpi-sub { font-size: 13px; color: var(--ink-2); }
.gc-kpi.is-hot .gc-kpi-value { color: var(--amber); }

/* Filter chips */
.gc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.gc-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px;
  background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--r-pill);
  font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer;
  transition: border-color .12s ease, background .12s ease, color .12s ease;
}
.gc-chip:hover { border-color: var(--field-border); color: var(--ink); }
.gc-chip.on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.gc-chip-n { font-size: 11.5px; opacity: .6; font-variant-numeric: tabular-nums; }

/* Grid of cards */
.gc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 20px; }
.gc {
  --face-a: #3fae8d; --face-b: #24795a; --ribbon: rgba(255, 255, 255, .22); --bow: #fff3df;
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 18px; box-shadow: 0 1px 2px rgba(43, 54, 85, .06), 0 14px 30px -20px rgba(43, 54, 85, .45);
  transition: transform .18s ease, box-shadow .18s ease;
}
.gc:hover { transform: translateY(-2px); box-shadow: 0 1px 2px rgba(43, 54, 85, .06), 0 22px 40px -22px rgba(43, 54, 85, .55); }
.gc--ocean { --face-a: #5b7fd6; --face-b: #2c4a9f; }
.gc--ember { --face-a: #f59a63; --face-b: #d45a22; }
.gc--navy  { --face-a: #3a4874; --face-b: #1b2238; --ribbon: rgba(226, 182, 90, .55); --bow: #e8c06e; }
.gc--gold  { --face-a: #e6bd5d; --face-b: #a8741a; --ribbon: rgba(255, 250, 235, .35); --bow: #fff8e6; }

.gc-face {
  position: relative; overflow: hidden; min-height: 168px; padding: 18px 20px 18px;
  border-radius: 18px 18px 0 0; color: #fff;
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(255, 255, 255, .22), transparent 55%),
    linear-gradient(140deg, var(--face-a), var(--face-b));
}
/* Gift ribbon: a vertical band with a bow where it meets the top edge. */
.gc-ribbon { position: absolute; top: 0; bottom: 0; right: 58px; width: 16px; background: var(--ribbon); }
.gc-bow {
  position: absolute; top: 0; right: 34px; width: 64px; height: 48px;
  fill: var(--bow); filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .2));
}
.gc-bow .gc-bow-tail { opacity: .85; }
.gc-peaks { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 56px; fill: rgba(255, 255, 255, .10); }
.gc-top { position: relative; display: flex; align-items: center; gap: 8px; }
.gc-brand {
  font-family: var(--font-display); font-weight: 700; font-size: 12px; letter-spacing: .04em;
  padding: 3px 7px; border-radius: 6px; background: rgba(255, 255, 255, .2);
}
.gc-kind { font-size: 12px; font-weight: 600; opacity: .9; }
.gc-amount {
  position: relative; margin-top: 22px;
  font-family: var(--font-display); font-weight: 700; font-size: 34px; line-height: 1; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums; text-shadow: 0 2px 10px rgba(0, 0, 0, .12);
}
.gc-amount span { font-size: 22px; opacity: .85; }
.gc-for {
  position: relative; margin-top: 10px; max-width: 70%;
  font-size: 14px; font-weight: 600; opacity: .95;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Rubber stamp on a card that can no longer pay for anything. */
.gc-stamp {
  position: absolute; z-index: 2; right: 16px; bottom: 18px;
  transform: rotate(-9deg);
  padding: 4px 11px; border: 2.5px solid currentColor; border-radius: 8px;
  font-family: var(--font-display); font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: #fff; background: rgba(20, 26, 44, .28); backdrop-filter: blur(1px);
  mix-blend-mode: normal; white-space: nowrap;
}
.gc.is-redeemed .gc-face, .gc.is-cancelled .gc-face, .gc.is-expired .gc-face {
  background: linear-gradient(140deg, color-mix(in srgb, var(--face-a) 35%, #9aa0b2), color-mix(in srgb, var(--face-b) 35%, #6f768c));
}
.gc.is-cancelled .gc-stamp, .gc.is-expired .gc-stamp { color: #ffd9dd; background: rgba(150, 30, 45, .35); }
.gc.is-pending .gc-face::after {
  content: ""; position: absolute; inset: 8px; border: 2px dashed rgba(255, 255, 255, .55); border-radius: 12px; pointer-events: none;
}

/* Perforated tear line with notches cut out of both edges. */
.gc-perf { position: relative; height: 0; margin: 0 16px; border-top: 2px dashed var(--stroke); }
.gc-perf::before, .gc-perf::after {
  content: ""; position: absolute; top: -12px; width: 22px; height: 22px; border-radius: 50%; background: var(--bg);
}
.gc-perf::before { left: -28px; }
.gc-perf::after { right: -28px; }

.gc-body { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px 18px; flex: 1; }
.gc-ids { display: flex; gap: 8px; flex-wrap: wrap; }
.gc-code, .gc-pin {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px;
  border: 1px solid var(--stroke); border-radius: var(--r-md); background: var(--paper-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; font-weight: 600;
  color: var(--ink); letter-spacing: .03em; cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.gc-code { flex: 1 1 auto; justify-content: space-between; }
.gc-code svg { width: 15px; height: 15px; fill: none; stroke: var(--subtle); stroke-width: 1.8; }
.gc-code:hover, .gc-pin:hover { border-color: var(--accent); background: var(--accent-weak); }
.gc-code:hover svg { stroke: var(--accent-ink); }
.gc-pin-label { font-family: var(--font-ui); font-size: 11px; font-weight: 700; color: var(--subtle); letter-spacing: 0; }
.gc-pin-val { min-width: 4ch; text-align: center; }
.gc-pin.open { border-color: var(--accent); background: var(--accent-weak); }

.gc-state { display: flex; gap: 6px; flex-wrap: wrap; }
.gc-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; background: var(--elevated); color: var(--ink-2);
}
.gc-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.gc-pill--paid { background: var(--green-weak); color: var(--green); }
.gc-pill--pending { background: var(--amber-weak); color: var(--amber); }
.gc-pill--expired, .gc-pill--cancelled { background: var(--red-weak); color: var(--red); }
.gc-pill--redeemed { background: var(--blue-weak); color: var(--blue); }
.gc-pill--hot { background: var(--amber-weak); color: var(--amber); }

.gc-validity { display: flex; flex-direction: column; gap: 6px; }
.gc-validity-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--subtle); }
.gc-validity-top span:first-child { font-weight: 600; color: var(--ink-2); }
.gc-bar { height: 6px; border-radius: var(--r-pill); background: var(--elevated); overflow: hidden; }
.gc-bar i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.gc-validity.hot .gc-bar i { background: var(--amber); }
.gc-validity.hot .gc-validity-top span:first-child { color: var(--amber); }

.gc-wish {
  position: relative; margin: 0; padding: 10px 12px 10px 30px; border-radius: var(--r-md);
  background: var(--paper-2); font-size: 13px; font-style: italic; color: var(--ink-2);
  white-space: pre-wrap; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.gc-wish::before {
  content: "“"; position: absolute; left: 10px; top: 2px;
  font-family: Georgia, serif; font-size: 28px; font-style: normal; color: var(--accent); line-height: 1.2;
}

.gc-facts { display: grid; gap: 6px; margin: 0; }
.gc-facts > div { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.gc-facts dt { color: var(--subtle); flex: 0 0 auto; }
.gc-facts dd { margin: 0; color: var(--ink); text-align: right; min-width: 0; overflow-wrap: anywhere; }

.gc-actions {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-top: auto; padding-top: 12px; border-top: 1px solid var(--divider);
}
.gc-actions .btn-primary { display: inline-flex; align-items: center; gap: 6px; }
.gc-actions .btn-primary svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; }
.gc-actions a.btn-small { text-decoration: none; }

.gc-empty {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 56px 20px; text-align: center; color: var(--subtle);
  background: var(--surface); border: 1px dashed var(--field-border); border-radius: var(--r-xl);
}
.gc-empty svg { width: 40px; height: 40px; fill: none; stroke: var(--accent); stroke-width: 1.5; }
.gc-empty p { max-width: 46ch; font-size: 14px; }

@media (max-width: 1100px) { .gc-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  #view-certificates .view-head { flex-wrap: wrap; }
  .gc-search { flex: 1 1 100%; }
  .gc-kpi { padding: 12px 14px; }
  .gc-kpi-value { font-size: 18px; }
  .gc-amount { font-size: 30px; }
}
