/* Reusable UI: title, stacked card, buttons, forms, tags, stats. */

.title { margin-bottom: 1.25rem; }
.title h1 { margin: 0; font-size: 1.5rem; font-weight: 700; line-height: 1.25; }
.title p { margin: .375rem 0 0; color: var(--gray); }

/* ---------- Stacked card (offset back layer = "shadow") ---------- */
.stacked { position: relative; margin-bottom: 18px; border: 2px solid var(--ink); border-radius: 15px; background: var(--white); }
.stacked::after { content: ""; position: absolute; z-index: -1; left: 2.5%; bottom: -9px; width: 95%; height: 100%; border: 2px solid var(--ink); border-radius: 20px; background: var(--back, var(--shadow-base)); transition: .15s ease; }
.stacked:hover::after, .stacked:focus-within::after { transform: translateY(2px); }
.back-cream { --back: var(--shadow-cream); }
.back-mint { --back: var(--shadow-mint); }
.back-lavender { --back: var(--shadow-lavender); }
.group { padding: 1rem; }
.group h3 { margin: 0 0 .625rem; color: var(--gray); font-size: .75rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.group h3:not(:first-child) { margin-top: 1rem; }
.pin { position: absolute; top: -7px; left: calc(50% - 6px); width: 12px; height: 12px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 2px var(--white), 0 0 0 3px var(--ink); }

/* ---------- Segmented control ---------- */
.seg { display: flex; margin-bottom: 1.25rem; overflow: hidden; border: 2px solid var(--ink); border-radius: 15px; background: var(--white); }
.group .seg { margin-bottom: .75rem; }
.seg button { flex: 1; padding: .5rem; border: 0; background: transparent; font-weight: 700; }
.seg button + button { border-left: 2px solid var(--ink); }
.seg button:hover { background: var(--purple-hover); }
.seg button.active { background: var(--lime); }

/* ---------- Buttons ---------- */
.btn { position: relative; display: flex; align-items: center; justify-content: center; gap: .5rem; width: 100%; height: 54px; margin-bottom: 18px; border: 2px solid var(--ink); border-radius: 15px; background: var(--lime); font-size: 1.0625rem; font-weight: 800; transition: .15s ease; }
.btn::after { content: ""; position: absolute; z-index: -1; left: 2.5%; bottom: -9px; width: 95%; height: 100%; border: 2px solid var(--ink); border-radius: 20px; background: var(--shadow-lavender); transition: .15s ease; }
.btn:hover { background: var(--purple-hover); }
.btn:hover::after { transform: translateY(2px); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-light { background: var(--white); }
.btn-danger { background: var(--crimson); color: var(--white); }
.btn-danger:hover { background: var(--ink); }

.btn-sm { height: 36px; padding: 0 .875rem; border: 2px solid var(--ink); border-radius: 12px; background: var(--white); font-size: .875rem; font-weight: 700; transition: .15s ease; }
.btn-sm:hover { background: var(--purple-hover); }
.btn-sm.icon { display: inline-flex; align-items: center; gap: .375rem; }
.btn-sm.danger { background: var(--crimson); color: var(--white); }
.btn-sm.danger:hover { background: var(--ink); color: var(--white); }
.tools { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }

/* ---------- Forms ---------- */
.lbl { display: block; margin-bottom: .75rem; font-size: .8125rem; font-weight: 700; }
.lbl .input { margin-top: .25rem; }
.input { display: block; width: 100%; height: 44px; padding: 0 .75rem; border: 2px solid var(--ink); border-radius: 12px; background: var(--white); font-weight: 600; }
.input:focus { outline: 0; background: var(--white); box-shadow: 0 0 0 3px var(--purple-hover); }

/* ---------- Tags ---------- */
.tag { display: inline-flex; align-items: center; padding: 0 .5rem; border: 2px solid var(--ink); border-radius: 99px; background: var(--gray); color: var(--white); font-size: .6875rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }
.tag-run { background: var(--lime); color: var(--ink); }
.tag-ok { background: var(--green); color: var(--ink); }
.tag-err { background: var(--crimson); color: var(--white); }
.tag-wait { background: var(--gray); color: var(--white); }

/* ---------- Stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(68px, 1fr)); gap: .5rem; }
.stat { padding: .375rem .25rem; border: 2px solid var(--ink); border-radius: 12px; background: var(--white); text-align: center; }
.stat b { display: block; font-size: 1.125rem; font-weight: 800; line-height: 1.25; }
.stat span { color: var(--gray); font-size: .6875rem; font-weight: 600; }
.stat.hl { background: var(--green); }
.stat.hl span { color: var(--ink); }

.hint { margin: 0; color: var(--gray); font-size: .8125rem; }
.hint-top { margin-top: .75rem; }
.center { text-align: center; }
.btn-sm:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm:disabled:hover { background: var(--white); }
.btn-sm.primary { background: var(--lime); }

/* ---------- Neo-Brutalist Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(29, 29, 29, 0.45); backdrop-filter: blur(2px); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 1rem; animation: modalFadeIn .15s ease-out; }
.modal-backdrop[hidden] { display: none !important; }
.modal-box { width: 100%; max-width: 340px; padding: 1.125rem; margin-bottom: 0; box-shadow: 4px 4px 0 var(--ink); animation: modalSlideUp .18s ease-out; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .375rem; }
.modal-head h3 { margin: 0; font-size: 1.0625rem; font-weight: 800; color: var(--ink); }
.modal-close { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border: 2px solid var(--ink); border-radius: 6px; background: var(--white); color: var(--ink); font-size: .875rem; font-weight: 800; cursor: pointer; transition: background .12s ease; }
.modal-close:hover { background: var(--purple-hover); }
.modal-desc { font-size: .8125rem; color: var(--gray); margin: 0 0 .875rem; line-height: 1.35; }
.modal-desc b, .modal-desc span { color: var(--ink); font-weight: 800; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }

@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
