/* ── Подарочные сертификаты ─────────────────────────────────────────────
   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; }
/* One line per fact on the card: a long name is cut with «…», never wrapped. */
.gc-facts dd { margin: 0; color: var(--ink); text-align: right; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gc[data-open] { cursor: pointer; }

/* «Подробнее» on the card: a quiet text button pushed to the right. */
.gcd-more {
  margin-left: auto; padding: 8px 4px; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--subtle);
}
.gcd-more::after { content: " →"; }
.gcd-more:hover { color: var(--accent-ink); }

/* ── Certificate details (modal) ── */
.gcd { display: flex; flex-direction: column; gap: 18px; }

/* The ticket on top: the card's own face, a little taller, no hover lift. */
.gcd-hero, .gcd-hero:hover { transform: none; box-shadow: 0 18px 40px -24px rgba(43, 54, 85, .6); border-radius: 20px; }
.gcd-hero .gc-face { min-height: 0; padding: 20px 24px 22px; border-radius: 20px; }
.gcd-hero .gc-amount { font-size: 44px; margin-top: 26px; }
.gcd-hero .gc-amount span { font-size: 26px; }
.gcd-hero .gc-for { font-size: 16px; max-width: 75%; }
.gcd-status {
  margin-left: auto; position: relative; z-index: 1; margin-right: 96px;
  padding: 4px 11px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .22);
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
}
.gcd-ids { position: relative; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.gcd-glass {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, .35); border-radius: var(--r-md);
  background: rgba(255, 255, 255, .16); backdrop-filter: blur(6px); color: #fff; cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; font-weight: 700; letter-spacing: .04em;
  transition: background .12s ease;
}
.gcd-glass:hover { background: rgba(255, 255, 255, .26); }
.gcd-glass svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; opacity: .85; }
.gcd-pin-label { font-family: var(--font-ui); font-size: 11px; font-weight: 700; letter-spacing: .04em; opacity: .75; }

.gcd-wish {
  position: relative; margin: 0; padding: 14px 18px 14px 44px; border-radius: var(--r-lg);
  background: var(--paper-2); color: var(--ink-2); font-size: 15px; font-style: italic; line-height: 1.5;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.gcd-wish::before {
  content: "“"; position: absolute; left: 14px; top: 4px;
  font-family: Georgia, serif; font-size: 34px; font-style: normal; color: var(--accent); line-height: 1.2;
}

/* Tiles: each fact group is a small card, two per row, one on a phone. */
.gcd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.gcd-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0;
  padding: 14px 16px; border: 1px solid var(--divider); border-radius: var(--r-lg); background: var(--surface);
}
.gcd-tile h4 { margin: 0 0 2px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--subtle); }
.gcd-tile .gc-bar { width: 100%; margin: 4px 0 2px; }
.gcd-tile .gc-bar.hot i { background: var(--amber); }
.gcd-tile--closed { grid-column: 1 / -1; border-color: color-mix(in srgb, var(--red) 25%, transparent); background: color-mix(in srgb, var(--red-weak) 40%, var(--surface)); }
.gcd-big { font-size: 16px; font-weight: 700; color: var(--ink); line-height: 1.3; max-width: 100%; overflow-wrap: anywhere; }
.gcd-muted { font-size: 13px; color: var(--subtle); line-height: 1.4; }
.gcd-tel { font-size: 14px; font-weight: 600; color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.gcd-tel:hover { color: var(--accent-ink); }
.gcd-link { color: var(--ink); text-decoration: none; font-weight: 700; }
.gcd-link:hover { color: var(--accent-ink); }
.gcd-to-card span { color: var(--subtle); font-weight: 600; transition: transform .12s ease; display: inline-block; }
.gcd-to-card:hover span { color: var(--accent-ink); transform: translateX(2px); }
.gcd-tag {
  display: inline-flex; padding: 2px 9px; border-radius: var(--r-pill);
  background: var(--green-weak); color: var(--green); font-size: 12px; font-weight: 600;
}
.gcd-tag--muted { background: var(--elevated); color: var(--subtle); }
.gcd-chip {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 2px; padding: 4px 9px;
  border: 1px solid var(--stroke); border-radius: var(--r-sm); background: var(--paper-2); cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--ink-2);
}
.gcd-chip svg { width: 13px; height: 13px; fill: none; stroke: var(--subtle); stroke-width: 1.8; }
.gcd-chip:hover { border-color: var(--accent); }
.gcd-reason { font-size: 14px; color: var(--ink-2); padding-left: 10px; border-left: 3px solid color-mix(in srgb, var(--red) 40%, transparent); }

/* Actions: quiet ones left, the money and the everyday one right. */
.gcd-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding-top: 16px; border-top: 1px solid var(--divider);
}
.gcd-actions .btn-primary { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; font-size: 14px; line-height: 1.2; border-radius: var(--r-pill); }
.gcd-btn { line-height: 1.2; }
.gcd-actions .btn-primary svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; }
.gcd-btn {
  padding: 10px 16px; border-radius: var(--r-pill); cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 700; transition: background .12s ease, border-color .12s ease;
}
.gcd-btn--quiet { border: 1px solid transparent; background: none; color: var(--subtle); }
.gcd-btn--quiet:hover { background: var(--elevated); color: var(--ink-2); }
.gcd-btn--danger { border: 1.5px solid color-mix(in srgb, var(--red) 55%, transparent); background: var(--surface); color: var(--red); }
.gcd-btn--danger:hover { background: var(--red-weak); border-color: var(--red); }
.gcd-btn:disabled { opacity: .5; cursor: default; }
/* In progress: the pressed button stays bright and spins, the rest fade. */
.gcd-btn.is-busy, .gcd-actions .btn-primary.is-busy { opacity: 1; display: inline-flex; align-items: center; gap: 8px; cursor: progress; }
.gcd-btn--danger.is-busy { background: var(--red-weak); border-color: var(--red); }
.gcd-spin {
  width: 14px; height: 14px; flex: 0 0 auto; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: tw-spin .7s linear infinite;
}
.gcd.is-busy .gcd-grid, .gcd.is-busy .gcd-hero { opacity: .6; transition: opacity .2s ease; pointer-events: none; }

.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; }
}

/* KPI tiles are filters (TNA-162). */
button.gc-kpi { font: inherit; text-align: left; cursor: pointer; }
button.gc-kpi:hover { background: var(--hover, rgba(0,0,0,.03)); }
.gc-kpi.on { outline: 2px solid var(--ink); outline-offset: -2px; }
@media (max-width: 480px) { .gcd-hero .gc-kind { display: none; } }

/* ── Void certificates: annulled or refunded ──
   Not a muted version of a live card but plainly dead: grey paper with
   hatching, the sum struck through, the bow faded, a big stamp across the
   face. A refund is stamped red, an annulment ink-grey. */
.gc.is-cancelled { box-shadow: 0 1px 2px rgba(43, 54, 85, .05); }
.gc.is-cancelled:hover { transform: none; box-shadow: 0 1px 2px rgba(43, 54, 85, .05), 0 10px 24px -18px rgba(43, 54, 85, .4); }
.gc.is-cancelled .gc-face {
  color: rgba(255, 255, 255, .92);
  background:
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, .07) 0 10px, transparent 10px 20px),
    linear-gradient(140deg, #a4a9b6, #7c8292);
}
.gc.is-cancelled .gc-bow { filter: grayscale(1); opacity: .45; }
.gc.is-cancelled .gc-ribbon { background: rgba(255, 255, 255, .14); }
.gc.is-cancelled .gc-peaks { fill: rgba(255, 255, 255, .06); }
.gc.is-cancelled .gc-amount {
  text-decoration: line-through; text-decoration-thickness: 3px; text-decoration-color: rgba(255, 255, 255, .75);
  text-shadow: none; opacity: .9;
}
.gc.is-cancelled .gc-stamp, .gc.is-expired .gc-stamp {
  right: 20px; bottom: 30px; transform: rotate(-10deg);
  padding: 6px 16px; border-width: 3px; border-radius: 10px;
  font-size: 16px; letter-spacing: .1em; backdrop-filter: none;
  box-shadow: 0 4px 14px rgba(20, 26, 44, .18);
}
.gc.is-cancelled .gc-stamp { color: #3b4254; background: rgba(255, 255, 255, .88); }
.gc.is-cancelled.is-refunded .gc-stamp { color: var(--red); background: rgba(255, 255, 255, .92); }
.gc.is-expired .gc-stamp { color: #8a5a00; background: rgba(255, 249, 235, .9); }
.gc.is-cancelled .gc-body { opacity: .78; }
.gc.is-cancelled .gc-code, .gc.is-cancelled .gc-pin { text-decoration: line-through; text-decoration-color: rgba(18, 23, 34, .35); }
.gc-pill--refunded { background: var(--red-weak); color: var(--red); }
.gc-pill--cancelled { background: var(--elevated); color: var(--ink-2); }
