/* =====================================================================
   Components: buttons, chips, cards, form fields, modals, toasts, menus,
   tabs, accordions, progress, loaders, certificate preview
   ===================================================================== */

/* ------------------------------------------------------------------ buttons
   Chunky, tactile "press-down" buttons — a 3D edge that squashes on tap. */
.btn {
  --btn-bg: var(--paper);
  --btn-fg: var(--ink);
  --btn-border: var(--line-2);
  --btn-edge: var(--line-2);
  --btn-h: 50px;
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55em;
  min-height: var(--btn-h);
  padding: 0.55em 1.35em;
  border-radius: var(--r-pill);
  border: 2px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: 600 1.0625rem/1.1 var(--f-head);
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  min-width: min-content;   /* overflow: hidden (below) would let a flex row squeeze it narrower than its label */
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 4px 0 var(--btn-edge), var(--sh-sm);
  transform: translateY(0);
  transition: transform var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out), background-color var(--dur-2), color var(--dur-2), border-color var(--dur-2), translate 0.3s var(--ease-out);
  isolation: isolate;
  overflow: hidden;
}
.btn .i { width: 1.2em; height: 1.2em; }
.btn:hover { color: var(--btn-fg); transform: translateY(-2px); box-shadow: 0 6px 0 var(--btn-edge), var(--sh-md); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--btn-edge), var(--sh-xs); transition-duration: 60ms; }
.btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; transform: none; box-shadow: 0 2px 0 var(--btn-edge); pointer-events: none; }
.btn::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.45) 48%, transparent 66%);
  transform: translateX(-120%); transition: transform 0.7s var(--ease-out);
}
.btn:hover::after { transform: translateX(120%); }
.btn .arrow { transition: transform var(--dur-2) var(--ease-out); }
.btn:hover .arrow { transform: translateX(4px); }

.btn--primary {
  --btn-bg: linear-gradient(180deg, #E0B04E 0%, #CC9933 55%, #BD8A28 100%);
  --btn-fg: #fff;
  --btn-border: #B8862A;
  --btn-edge: #8A6519;
  text-shadow: 0 1px 0 rgba(90, 60, 5, 0.4);
}
.btn--secondary { --btn-bg: var(--paper); --btn-fg: var(--gold-800); --btn-border: var(--gold-300); --btn-edge: var(--gold-300); }
.btn--secondary:hover { --btn-bg: var(--gold-25); }
.btn--soft { --btn-bg: var(--gold-50); --btn-fg: var(--gold-800); --btn-border: var(--gold-100); --btn-edge: var(--gold-200); }
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--ink-2); --btn-border: transparent; --btn-edge: transparent; box-shadow: none; }
.btn--ghost:hover { --btn-bg: var(--gold-50); box-shadow: none; transform: none; }
.btn--ghost:active { box-shadow: none; transform: scale(0.97); }
.btn--leaf { --btn-bg: linear-gradient(180deg, #5DBB82, #46A06A); --btn-fg: #fff; --btn-border: #3E8F5E; --btn-edge: #2E6F48; text-shadow: 0 1px 0 rgba(20, 70, 40, 0.35); }
.btn--rose { --btn-bg: linear-gradient(180deg, #F585A2, #E7637F); --btn-fg: #fff; --btn-border: #D95573; --btn-edge: #B23F5B; }
.btn--danger { --btn-bg: linear-gradient(180deg, #E8667A, #D9485F); --btn-fg: #fff; --btn-border: #C63F55; --btn-edge: #9E2E41; }
.btn--dark { --btn-bg: var(--ink); --btn-fg: #fff; --btn-border: var(--ink); --btn-edge: #000; }
.btn--white { --btn-bg: #fff; --btn-fg: var(--gold-800); --btn-border: #fff; --btn-edge: rgba(0, 0, 0, 0.15); }

.btn--sm { --btn-h: 40px; font-size: 0.9375rem; padding: 0.4em 1em; box-shadow: 0 3px 0 var(--btn-edge); }
.btn--sm:hover { box-shadow: 0 4px 0 var(--btn-edge); }
.btn--lg { --btn-h: 58px; font-size: 1.1875rem; padding: 0.6em 1.7em; }
/* Phones: a long label wraps onto a second line instead of being cut off at both edges (.btn is nowrap + overflow: hidden). */
@media (max-width: 480px) {
  .btn--lg { padding-inline: 1.15em; }
  .btn--lg, .btn--block { white-space: normal; text-align: center; text-wrap: balance; }
}
@media (max-width: 360px) { .btn--lg { font-size: 1.0625rem; } }
.btn--xl { --btn-h: 66px; font-size: 1.3125rem; padding: 0.7em 2em; }
.btn--block { width: 100%; }
.btn--icon { --btn-h: 46px; width: var(--btn-h); padding: 0; }
.btn--icon.btn--sm { --btn-h: 38px; }
.btn--icon .i { width: 22px; height: 22px; }
.btn--sm.btn--icon .i { width: 19px; height: 19px; }
.btn.is-pressed { transform: translateY(3px); box-shadow: 0 1px 0 var(--btn-edge); }

.link-btn {
  display: inline-flex; align-items: center; gap: 6px; font: 700 1rem/1.2 var(--f-head); color: var(--gold-800);
  text-decoration: none; padding: 6px 2px; border-radius: 8px;
}
.link-btn:hover { color: var(--gold-900); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }

/* ------------------------------------------------------------------ spinner & loader */
.spinner {
  width: 1.15em; height: 1.15em; border-radius: 50%; flex: none;
  border: 3px solid currentColor; border-right-color: transparent; opacity: 0.85;
  animation: spin 0.7s linear infinite;
}
.loader { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px 16px; color: var(--ink-3); font-weight: 700; }
.loader__flower { width: 56px; height: 56px; animation: spin 2.6s linear infinite; }
.loader__flower svg { width: 100%; height: 100%; }

/* ------------------------------------------------------------------ chips & badges */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: var(--r-pill);
  font: 700 0.875rem/1.1 var(--f-head); color: var(--gold-900);
  background: var(--gold-50); border: 1.5px solid var(--gold-200);
}
.chip .i { width: 16px; height: 16px; }
.chip svg.fl { width: 20px; height: 20px; }
.chip--white { background: rgba(255, 255, 255, 0.85); border-color: rgba(255, 255, 255, 0.9); backdrop-filter: blur(8px); box-shadow: var(--sh-sm); }
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: var(--r-pill);
  font: 700 0.75rem/1.4 var(--f-body); letter-spacing: 0.02em; white-space: nowrap;
  background: var(--cream-2); color: var(--ink-2); border: 1px solid var(--line);
}
.badge .i { width: 13px; height: 13px; }
.badge--gold { background: var(--gold-50); color: var(--gold-900); border-color: var(--gold-200); }
.badge--ok { background: var(--ok-bg); color: #1F6E44; border-color: var(--ok-line); }
.badge--bad, .badge--danger { background: var(--bad-bg); color: #A42F43; border-color: var(--bad-line); }
.badge--warn { background: var(--warn-bg); color: #8F5A0B; border-color: var(--warn-line); }
.badge--info { background: var(--info-bg); color: #245E9E; border-color: var(--info-line); }
.badge--lilac { background: var(--lilac-50); color: #5C45A8; border-color: var(--lilac-100); }
.badge--dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
kbd {
  font: 700 0.72rem/1 var(--f-mono); padding: 3px 6px; border-radius: 6px; color: var(--ink-2);
  background: #fff; border: 1px solid var(--line-2); box-shadow: 0 2px 0 var(--line-2);
}

/* ------------------------------------------------------------------ cards */
.card {
  position: relative; background: var(--paper); border: 1.5px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-sm);
}
.card--pad { padding: clamp(18px, 3vw, 28px); }
.card--glass { background: rgba(255, 255, 255, 0.72); border-color: rgba(255, 255, 255, 0.85); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); box-shadow: var(--sh-md); }
.card--hover { transition: transform var(--dur-3) var(--ease-out), box-shadow var(--dur-3) var(--ease-out), border-color var(--dur-2); }
.card--hover:hover { transform: translateY(-6px); box-shadow: var(--sh-lg); border-color: var(--gold-200); }
.card--gold { background: linear-gradient(145deg, #FFF8E6, #FDEBC1); border-color: var(--gold-200); }

/* ------------------------------------------------------------------ alerts */
.alert {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md);
  border: 1.5px solid var(--line); background: var(--cream-2); color: var(--ink-2); font-weight: 600; line-height: 1.5;
}
.alert .i { width: 22px; height: 22px; flex: none; margin-top: 1px; }
.alert--ok { background: var(--ok-bg); border-color: var(--ok-line); color: #1F6E44; }
.alert--bad, .alert--error { background: var(--bad-bg); border-color: var(--bad-line); color: #A42F43; }
.alert--warn { background: var(--warn-bg); border-color: var(--warn-line); color: #7C4E08; }
.alert--info { background: var(--info-bg); border-color: var(--info-line); color: #245E9E; }
.alert--gold { background: var(--gold-50); border-color: var(--gold-200); color: var(--gold-900); }
.alert[hidden] { display: none; }
.alert.is-shake { animation: shake 0.5s var(--ease-out); }

/* ------------------------------------------------------------------ form fields */
.form { display: grid; gap: 18px; }
.form-row, .field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 520px) { .form-row { grid-template-columns: 1fr; } }
.field { display: grid; gap: 7px; min-width: 0; }
.field__label {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font: 700 0.95rem/1.3 var(--f-head); color: var(--ink);
}
.field__label .opt { font: 700 0.72rem/1 var(--f-body); color: var(--ink-3); background: var(--cream-2); border: 1px solid var(--line); padding: 3px 8px; border-radius: var(--r-pill); }
.field__label .req { color: var(--bad); font-size: 0.8rem; }
.field__hint { font-size: 0.875rem; color: var(--ink-3); line-height: 1.45; }
.field__error { font-size: 0.875rem; font-weight: 700; color: var(--bad); display: flex; gap: 6px; align-items: center; animation: rise 0.25s var(--ease-out); }
.field__error::before { content: "!"; display: inline-grid; place-items: center; width: 17px; height: 17px; flex: none; border-radius: 50%; background: var(--bad); color: #fff; font-size: 0.72rem; }

.input, .select, .textarea {
  width: 100%; min-width: 0; min-height: 54px;
  padding: 0.75em 1em;
  border: 2px solid var(--line-2); border-radius: var(--r-md);
  background: #fff; color: var(--ink);
  font: 400 1.0625rem/1.35 var(--f-body);
  transition: border-color var(--dur-2), box-shadow var(--dur-2), background-color var(--dur-2);
  -webkit-appearance: none; appearance: none;
}
.textarea { min-height: 130px; resize: vertical; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: var(--ink-4); opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--gold-300); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--gold-500); box-shadow: 0 0 0 4px var(--gold-glow); background: #fff; }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 4px rgba(217, 72, 95, 0.12); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--cream-2); color: var(--ink-3); cursor: not-allowed; }
.input--upper { text-transform: uppercase; letter-spacing: 0.03em; }
.input--upper::placeholder { text-transform: none; letter-spacing: 0; }
.input--big { min-height: 64px; font-size: 1.35rem; font-family: var(--f-head); font-weight: 700; }
.select {
  padding-right: 2.6em; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A67B24' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 18px;
}
.input-icon, .input-wrap { position: relative; }
.input-icon > .i, .input-wrap > .i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 20px; height: 20px; pointer-events: none; }
.input-icon > .input, .input-wrap > .input { padding-left: 46px; }

/* Phone: [+][code] [number] */
.phone { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; }
.phone__code { position: relative; }
.phone__code::before {
  content: "+"; position: absolute; left: 14px; top: 50%; transform: translateY(-52%);
  font: 800 1.15rem/1 var(--f-head); color: var(--gold-800); pointer-events: none;
}
.phone__code .input { padding-left: 30px; font-family: var(--f-head); font-weight: 700; letter-spacing: 0.04em; }
.phone .input--num { font-family: var(--f-head); font-weight: 700; letter-spacing: 0.06em; }

/* Choice cards (gender, roles, avatar) */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.choice__card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  min-height: 100%; padding: 16px 12px; border-radius: var(--r-md); border: 2px solid var(--line-2); background: #fff;
  font: 700 1rem/1.2 var(--f-head); color: var(--ink-2);
  transition: border-color var(--dur-2), transform var(--dur-2) var(--ease-spring), box-shadow var(--dur-2), background-color var(--dur-2);
}
.choice__card svg.fl { width: 54px; height: 54px; transition: transform 0.5s var(--ease-spring); }
.choice input:hover + .choice__card { border-color: var(--gold-300); }
.choice input:focus-visible + .choice__card { outline: 3px solid var(--focus); outline-offset: 3px; }
.choice input:checked + .choice__card { border-color: var(--gold-500); background: var(--gold-25); color: var(--gold-900); box-shadow: 0 0 0 4px var(--gold-glow), var(--sh-sm); transform: translateY(-2px); }
.choice input:checked + .choice__card svg.fl { transform: scale(1.12) rotate(12deg); }
.choice__tick {
  position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; background: var(--gold-500); color: #fff; transform: scale(0); transition: transform 0.35s var(--ease-spring); z-index: 1;
}
.choice__tick .i { width: 15px; height: 15px; }
.choice input:checked ~ .choice__tick { transform: scale(1); }

/* Checkbox row */
.check { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md); background: var(--gold-25); border: 1.5px solid var(--gold-200); cursor: pointer; line-height: 1.5; font-weight: 600; color: var(--ink-2); }
.check input { width: 22px; height: 22px; margin-top: 1px; flex: none; accent-color: var(--gold-600); cursor: pointer; }

/* Switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 700; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track { width: 52px; height: 30px; border-radius: 99px; background: var(--line-2); position: relative; transition: background var(--dur-2); flex: none; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: var(--sh-sm); transition: transform 0.3s var(--ease-spring); }
.switch input:checked + .switch__track { background: var(--leaf); }
.switch input:checked + .switch__track::after { transform: translateX(22px); }
.switch input:focus-visible + .switch__track { outline: 3px solid var(--focus); outline-offset: 3px; }

/* Stepper (age picker) */
.stepper { display: grid; grid-template-columns: 56px minmax(0, 1fr) 56px; gap: 10px; align-items: center; }
.stepper .input { text-align: center; font-family: var(--f-head); font-size: 1.6rem; font-weight: 800; min-height: 64px; }
.stepper .btn { --btn-h: 56px; }

/* Segmented control */
.segmented, .seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: var(--r-pill); background: var(--cream-2); border: 1.5px solid var(--line); }
.segmented button, .seg button { padding: 8px 16px; border-radius: var(--r-pill); font: 700 0.9rem/1 var(--f-head); color: var(--ink-3); transition: background var(--dur-2), color var(--dur-2), box-shadow var(--dur-2); }
.segmented button[aria-pressed="true"], .seg button[aria-pressed="true"] { background: #fff; color: var(--gold-900); box-shadow: var(--sh-sm); }

/* File drop */
.dropzone, .drop {
  display: grid; place-items: center; gap: 6px; text-align: center; padding: 26px 18px; cursor: pointer;
  border: 2.5px dashed var(--gold-300); border-radius: var(--r-lg); background: var(--gold-25); color: var(--ink-2);
  transition: border-color var(--dur-2), background var(--dur-2), transform var(--dur-2);
}
.dropzone:hover, .dropzone.is-drag, .drop:hover, .drop.is-drag { border-color: var(--gold-600); background: var(--gold-50); transform: translateY(-2px); }
.dropzone .i, .drop .i { width: 34px; height: 34px; color: var(--gold-600); }
.dropzone strong, .drop strong { font-family: var(--f-head); color: var(--ink); }
.file-pill { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); background: #fff; border: 1.5px solid var(--gold-200); }
.file-pill .i { width: 24px; height: 24px; color: var(--leaf); }
.file-pill__name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ progress */
.bar { height: 12px; border-radius: 99px; background: var(--cream-3); overflow: hidden; position: relative; }
.bar__fill {
  height: 100%; width: calc(var(--p, 0) * 1%); border-radius: inherit;
  background: linear-gradient(90deg, var(--gold-400), var(--gold-600));
  transition: width 1.1s var(--ease-out);
  position: relative;
}
.bar__fill::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent); background-size: 200% 100%; animation: shimmer 2.4s linear infinite; }
.bar--leaf .bar__fill { background: linear-gradient(90deg, #7ED09A, var(--leaf)); }
.bar--rose .bar__fill { background: linear-gradient(90deg, #F9A8BD, var(--rose)); }
.bar--sm { height: 8px; }
.ring { position: relative; display: inline-grid; place-items: center; }
.ring svg { transform: rotate(-90deg); }
.ring__track { stroke: var(--cream-3); }
.ring__fill { stroke: url(#ring-grad); stroke-linecap: round; transition: stroke-dashoffset 1.3s var(--ease-out); }
.ring__label { position: absolute; text-align: center; line-height: 1; }

/* ------------------------------------------------------------------ avatars */
.avatar {
  --size: 44px;
  width: var(--size); height: var(--size); border-radius: 50%; flex: none;
  display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(circle at 35% 30%, #fff, var(--gold-50) 70%);
  border: 2px solid var(--gold-200);
}
.avatar svg { width: 86%; height: 86%; }
.avatar--initials { font: 800 calc(var(--size) * 0.38)/1 var(--f-head); color: var(--gold-800); }

/* ------------------------------------------------------------------ modals, sheets, drawers */
.modal { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; place-items: center; padding: 20px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(43, 35, 25, 0.44); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; transition: opacity 0.3s var(--ease-soft); }
.modal__panel {
  position: relative; width: min(100%, var(--modal-w, 560px)); max-height: min(92dvh, 900px);
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border-radius: var(--r-xl); box-shadow: var(--sh-xl);
  opacity: 0; transform: translateY(26px) scale(0.96);
  transition: transform 0.45s var(--ease-out), opacity 0.3s var(--ease-soft);
  outline: none;
}
.modal.is-open .modal__backdrop { opacity: 1; }
.modal.is-open .modal__panel { opacity: 1; transform: none; }
.modal.is-closing .modal__panel { transition-duration: 0.22s; transform: translateY(14px) scale(0.98); }
.modal--sm { --modal-w: 440px; }
.modal__panel:focus { outline: none; }
.modal--md { --modal-w: 580px; }
.modal--lg { --modal-w: 780px; }
.modal--xl { --modal-w: 1040px; }
.modal__head { display: flex; align-items: flex-start; gap: 12px; padding: 22px 22px 6px 26px; }
.modal__head--bare { position: absolute; right: 0; top: 0; z-index: 3; padding: 14px; }
.modal__icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--gold-50); color: var(--gold-700); flex: none; }
.modal__titles { flex: 1; min-width: 0; padding-top: 4px; }
.modal__title { font-size: 1.4rem; }
.modal__sub { color: var(--ink-3); margin-top: 4px; font-size: var(--fs-sm); }
.modal__x { margin-left: auto; }
.modal__body { padding: 14px 26px 26px; overflow-y: auto; overscroll-behavior: contain; }
.modal__foot { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding: 16px 26px 22px; border-top: 1.5px solid var(--line); background: var(--gold-25); }

/* Sheet = bottom sheet on phones */
@media (max-width: 640px) {
  .modal--sheet { place-items: end stretch; padding: 0; }
  .modal--sheet .modal__panel { width: 100%; max-height: 92dvh; border-radius: 28px 28px 0 0; transform: translateY(100%); }
  .modal--sheet .modal__panel::before { content: ""; display: block; width: 44px; height: 5px; border-radius: 9px; background: var(--line-2); margin: 10px auto 0; flex: none; }
  .modal--sheet.is-open .modal__panel { transform: none; }
  .modal--sheet.is-closing .modal__panel { transform: translateY(100%); }
  .modal__body { padding: 12px 18px 22px; }
  .modal__head { padding: 16px 16px 4px 20px; }
}
/* Drawer = right side panel */
.modal--drawer { place-items: stretch end; padding: 0; }
.modal--drawer .modal__panel { width: min(100%, var(--modal-w, 620px)); max-height: 100dvh; height: 100dvh; border-radius: var(--r-xl) 0 0 var(--r-xl); transform: translateX(100%); }
.modal--drawer.is-open .modal__panel { transform: none; }
.modal--drawer.is-closing .modal__panel { transform: translateX(100%); }
@media (max-width: 640px) { .modal--drawer .modal__panel { border-radius: 0; } }

/* Confirm dialog */
.confirm { text-align: center; padding: 18px 4px 4px; }
.confirm__icon { width: 64px; height: 64px; border-radius: 22px; display: grid; place-items: center; margin: 0 auto 14px; background: var(--gold-50); color: var(--gold-700); }
.confirm__icon .i { width: 32px; height: 32px; }
.confirm__icon--danger { background: var(--bad-bg); color: var(--bad); }
.confirm__title { font-size: 1.45rem; }
.confirm__msg { margin-top: 10px; color: var(--ink-2); line-height: 1.55; }
.confirm__actions { display: flex; gap: 12px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.confirm__actions .btn { flex: 1 1 150px; }

/* ------------------------------------------------------------------ toasts */
.toast-stack { position: fixed; z-index: var(--z-toast); top: 16px; right: 16px; display: grid; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
@media (max-width: 640px) { .toast-stack { left: 16px; right: 16px; width: auto; } }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 12px; padding: 14px 14px 14px 16px;
  border-radius: var(--r-md); background: #fff; border: 1.5px solid var(--line); box-shadow: var(--sh-lg);
  transform: translateY(-16px) scale(0.96); opacity: 0; transition: transform 0.45s var(--ease-spring), opacity 0.3s;
}
.toast.is-in { transform: none; opacity: 1; }
.toast.is-leaving { transform: translateX(30px); opacity: 0; transition-duration: 0.3s; }
.toast__icon { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--gold-50); color: var(--gold-700); }
.toast__icon .i { width: 20px; height: 20px; }
.toast--success .toast__icon, .toast--bloom .toast__icon { background: var(--ok-bg); color: var(--ok); }
.toast--error .toast__icon { background: var(--bad-bg); color: var(--bad); }
.toast--info .toast__icon { background: var(--info-bg); color: var(--info); }
.toast--bloom .toast__icon { background: var(--rose-50); color: var(--rose); }
.toast__body { flex: 1; min-width: 0; display: grid; gap: 2px; padding-top: 2px; }
.toast__title { font-family: var(--f-head); font-size: 1rem; }
.toast__msg { color: var(--ink-2); font-size: 0.95rem; line-height: 1.45; }
.toast__x { color: var(--ink-3); padding: 4px; border-radius: 8px; }
.toast__x:hover { background: var(--cream-2); color: var(--ink); }
.toast__x .i { width: 18px; height: 18px; }

/* ------------------------------------------------------------------ dropdown menu */
.menu {
  position: fixed; z-index: var(--z-menu); min-width: 220px; max-width: calc(100vw - 16px); padding: 6px;
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--r-md); box-shadow: var(--sh-lg);
  opacity: 0; transform: translateY(-6px) scale(0.98); transform-origin: top right; transition: opacity 0.18s, transform 0.25s var(--ease-out);
}
.menu.is-open { opacity: 1; transform: none; }
.menu__item { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; font-weight: 700; color: var(--ink-2); text-align: left; }
.menu__item:hover, .menu__item:focus-visible { background: var(--gold-50); color: var(--ink); outline: none; }
.menu__item .i { width: 18px; height: 18px; color: var(--ink-3); }
.menu__item kbd { margin-left: auto; }
.menu__item--danger { color: var(--bad); }
.menu__item--danger .i { color: var(--bad); }
.menu__item--danger:hover { background: var(--bad-bg); color: var(--bad); }
.menu__item:disabled { opacity: 0.45; }
.menu__sep { height: 1.5px; background: var(--line); margin: 6px 4px; }
.menu__head { padding: 8px 12px 4px; font: 700 0.72rem/1 var(--f-head); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }

/* ------------------------------------------------------------------ tabs */
.tabs__list { position: relative; display: flex; gap: 4px; padding: 5px; border-radius: var(--r-pill); background: var(--cream-2); border: 1.5px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs__list::-webkit-scrollbar { display: none; }
.tabs__tab { position: relative; z-index: 1; flex: none; padding: 10px 18px; border-radius: var(--r-pill); font: 700 0.95rem/1 var(--f-head); color: var(--ink-3); transition: color var(--dur-2); white-space: nowrap; }
.tabs__tab[aria-selected="true"] { color: var(--gold-900); }
.tabs__tab:hover { color: var(--ink); }
.tabs__ink { position: absolute; z-index: 0; top: 5px; bottom: 5px; left: 0; border-radius: var(--r-pill); background: #fff; box-shadow: var(--sh-sm); transition: transform 0.4s var(--ease-out), width 0.4s var(--ease-out); }

/* ------------------------------------------------------------------ accordion */
.acc { border-radius: var(--r-lg); background: #fff; border: 1.5px solid var(--line); transition: border-color var(--dur-2), box-shadow var(--dur-2); }
.acc + .acc { margin-top: 12px; }
.acc[open] { border-color: var(--gold-300); box-shadow: var(--sh-md); }
.acc > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 14px;
  padding: 18px 20px; font: 800 1.08rem/1.35 var(--f-head); color: var(--ink);
  border-radius: inherit;
}
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary:hover { color: var(--gold-900); }
.acc__plus { margin-left: auto; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--gold-50); color: var(--gold-700); flex: none; transition: transform 0.4s var(--ease-spring), background var(--dur-2); }
.acc__plus .i { width: 18px; height: 18px; }
.acc[open] > summary .acc__plus { transform: rotate(45deg); background: var(--gold-500); color: #fff; }
.acc__content { overflow: hidden; }
.acc__content > div { padding: 0 20px 20px; color: var(--ink-2); line-height: 1.7; }
.acc__content p + p { margin-top: 10px; }

/* ------------------------------------------------------------------ tooltip */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translate(-50%, 4px);
  padding: 6px 10px; border-radius: 10px; background: var(--ink); color: #fff; font: 700 0.78rem/1.3 var(--f-body);
  white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity 0.18s, transform 0.2s var(--ease-out); z-index: 20;
}
@media (hover: hover) { [data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); } }

/* ------------------------------------------------------------------ skeleton + empty */
.skeleton { border-radius: 12px; background: linear-gradient(90deg, var(--cream-2) 25%, var(--cream-3) 37%, var(--cream-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
.empty { display: grid; place-items: center; text-align: center; gap: 10px; padding: 44px 20px; color: var(--ink-3); }
.empty__art { width: 110px; height: 110px; }
.empty__title { font-family: var(--f-head); font-weight: 800; color: var(--ink); font-size: 1.2rem; }

/* ------------------------------------------------------------------ certificate preview */
.cert-preview { position: relative; container-type: inline-size; border-radius: 14px; overflow: hidden; box-shadow: var(--sh-lg); background: #fff; }
.cert-preview img { width: 100%; display: block; }
.cert-preview__name {
  position: absolute; left: var(--nx); top: var(--ny); transform: translate(-50%, -100%); margin-top: 0.25cqw;
  width: 76%; text-align: center; font: 700 var(--ns)/1 Helvetica, Arial, sans-serif; color: var(--nc); text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cert-preview__number { position: absolute; left: var(--cx); top: var(--cy); transform: translate(-50%, -50%); font: 700 var(--cs)/1 Helvetica, Arial, sans-serif; color: var(--cc); white-space: nowrap; }
.cert-preview.is-blurred img, .cert-preview.is-blurred span { filter: blur(6px) saturate(0.6); }
.cert-preview.is-blurred::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255, 251, 241, 0.2), rgba(255, 251, 241, 0.75)); }

/* ------------------------------------------------------------------ misc */
.divider-dots { display: flex; justify-content: center; gap: 10px; color: var(--gold-400); }
.copy-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-radius: 12px; background: var(--cream-2); border: 1.5px solid var(--line); font: 700 0.9rem/1.2 var(--f-mono); color: var(--ink); max-width: 100%; }
.copy-chip span { overflow-wrap: anywhere; }
.copy-chip button { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: var(--gold-800); flex: none; }
.copy-chip button:hover { background: var(--gold-100); }
.copy-chip .i { width: 16px; height: 16px; }
.petal-overlay { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: var(--z-overlay); }
.view-error { text-align: center; padding: 80px 20px; display: grid; gap: 16px; justify-items: center; }

/* ------------------------------------------------------------------ Aliases for the shared admin screens
   (written once for the three sister portals): their extra class names, in the garden style. */
.field__opt { font: 700 0.72rem/1 var(--f-body); color: var(--ink-3); background: var(--cream-2); border: 1px solid var(--line); padding: 3px 8px; border-radius: var(--r-pill); }
.field__req { font: 800 0.68rem/1 var(--f-body); letter-spacing: 0.06em; text-transform: uppercase; color: #B3384D; background: var(--bad-bg); border: 1px solid var(--bad-line); padding: 3px 7px; border-radius: var(--r-pill); }
.phone__plus { display: none; }
.drop__title { font-family: var(--f-head); font-weight: 700; color: var(--ink); }
.drop__sub { font-size: 0.875rem; color: var(--ink-3); }
.file-pill__meta { font-size: 0.82rem; color: var(--ink-3); }
.link { color: var(--gold-800); font-weight: 700; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.link:hover { color: var(--gold-900); }
.toast--warn .toast__icon { background: var(--warn-bg); color: #8F5A0B; }
