:root {
  --cb-green-900: #083d21;
  --cb-green-800: #0b532d;
  --cb-green-700: #0f6b3a;
  --cb-green-100: #e7f6ed;
  --cb-green-50: #f3fbf6;

  --cb-gold-600: #ca8a04;
  --cb-gold-400: #f5c518;
  --cb-gold-100: #fef9c3;
  --cb-gold-50: #fffdf0;

  --cb-blue-800: #0f3257;
  --cb-blue-700: #144272;
  --cb-blue-100: #e8f1fb;
  --cb-blue-50: #f4f8fd;

  --bg-page: #faf9f5;
  --bg-surface: #ffffff;
  --bg-muted: #f3f2ec;

  --ink-900: #16231c;
  --ink-700: #33463c;
  --ink-500: #5c6f65;
  --border-subtle: #e2e5df;
  --border-strong: #c8cfc6;

  --danger-700: #b91c1c;
  --danger-600: #dc2626;
  --danger-50: #fef2f2;

  --amber-700: #b45309;
  --amber-100: #fef3c7;

  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 8px rgba(8, 61, 33, 0.06);
  --shadow-md: 0 10px 28px rgba(8, 61, 33, 0.1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg-page);
  color: var(--ink-900);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  overflow-x: clip;
}

.hidden {
  display: none !important;
}

.hp-field {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

.corda-stripe {
  display: grid;
  grid-template-columns: 3fr 2fr 2fr 1fr;
  height: 6px;
  width: 100%;
}
.corda-green { background: var(--cb-green-700); }
.corda-yellow { background: var(--cb-gold-400); }
.corda-blue { background: var(--cb-blue-700); }
.corda-white { background: #ffffff; }

.container {
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 18px;
}

/* Header */
.site-header {
  background: linear-gradient(135deg, var(--cb-green-900) 0%, var(--cb-green-700) 68%, var(--cb-blue-800) 100%);
  color: #ffffff;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
  flex-shrink: 0;
}
.brand-back:hover {
  background: rgba(255, 255, 255, 0.24);
}

.brand-titles h1 {
  margin: 0;
  font-family: "Outfit", sans-serif;
  font-size: 1.18rem;
  font-weight: 800;
  line-height: 1.15;
}

.brand-titles span {
  display: block;
  font-size: 0.72rem;
  color: var(--cb-gold-400);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.header-actions,
.admin-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.admin-pill {
  background: var(--cb-gold-400);
  color: var(--cb-green-900);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  text-transform: uppercase;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  border: 1.5px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-sm { padding: 6px 11px; font-size: 0.8rem; }
.btn-primary { background: var(--cb-green-700); color: #ffffff; }
.btn-primary:hover { background: var(--cb-green-800); }
.btn-gold { background: var(--cb-gold-400); color: var(--cb-green-900); }
.btn-gold:hover { background: #ffd233; }
.btn-header-ghost { background: rgba(255, 255, 255, 0.14); color: #ffffff; border-color: rgba(255, 255, 255, 0.28); }
.btn-header-ghost:hover { background: rgba(255, 255, 255, 0.24); }
.btn-ghost { background: transparent; color: var(--ink-700); border-color: var(--border-subtle); }
.btn-ghost:hover { background: var(--bg-muted); }
.btn-outline-danger { background: var(--danger-50); color: var(--danger-700); border-color: #fecaca; }
.btn-outline-danger:hover { background: #fee2e2; }

.icon-btn {
  min-width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--ink-700);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}

/* Main */
.main-content {
  padding-top: 22px;
  padding-bottom: 56px;
}

.hero-summary {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-top: 4px solid var(--cb-gold-400);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero-copy h2 {
  margin: 0 0 6px;
  font-family: "Outfit", sans-serif;
  font-size: 1.32rem;
  font-weight: 800;
}

.hero-copy p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ink-500);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.stat-card {
  background: var(--bg-page);
  border: 1.5px solid var(--border-subtle);
  border-radius: 12px;
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}
.stat-card:hover { border-color: var(--cb-green-700); }
.stat-card.active {
  background: var(--cb-green-50);
  border-color: var(--cb-green-700);
}
.stat-num {
  font-family: "Outfit", sans-serif;
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--ink-900);
  line-height: 1.1;
}
.stat-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Controls */
.controls-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 13px 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}

.controls-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  padding: 6px 13px;
  border-radius: 999px;
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-page);
  color: var(--ink-700);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.chip.active {
  background: var(--cb-green-700);
  border-color: var(--cb-green-700);
  color: #ffffff;
}

.controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 260px;
  justify-content: flex-end;
}

.input-field,
.input-select,
.input-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: 10px;
  background: #ffffff;
  color: var(--ink-900);
  font-family: inherit;
  font-size: 0.92rem;
}
.input-field:focus,
.input-select:focus,
.input-textarea:focus {
  outline: none;
  border-color: var(--cb-green-700);
  box-shadow: 0 0 0 3px rgba(15, 107, 58, 0.14);
}
.input-search { max-width: 240px; }
.controls-right .input-select { width: auto; }

/* Tickets Board */
.tickets-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ticket-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 15px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 14px;
  align-items: flex-start;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.ticket-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.vote-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 8px 6px;
  border-radius: 11px;
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-page);
  color: var(--ink-700);
  font-family: inherit;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.vote-btn:hover { border-color: var(--cb-green-700); color: var(--cb-green-800); }
.vote-btn.is-voted {
  background: var(--cb-green-700);
  border-color: var(--cb-green-700);
  color: #ffffff;
}
.vote-arrow { font-size: 0.75rem; line-height: 1; }
.vote-num { font-size: 1rem; margin-top: 2px; }

.ticket-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 700;
}
.badge-bug { background: var(--danger-50); color: var(--danger-700); border: 1px solid #fecaca; }
.badge-feature { background: var(--cb-blue-100); color: var(--cb-blue-700); }
.badge-lyrics { background: var(--cb-gold-100); color: #854d0e; }

.status-new { background: #e0f2fe; color: #075985; }
.status-planned { background: #ede9fe; color: #5b21b6; }
.status-in_progress { background: var(--amber-100); color: var(--amber-700); }
.status-resolved { background: var(--cb-green-100); color: var(--cb-green-800); }
.status-closed { background: var(--bg-muted); color: var(--ink-500); }
.badge-song { background: var(--bg-muted); color: var(--ink-700); }

.ticket-title {
  margin: 0;
  font-family: "Outfit", sans-serif;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--ink-900);
  line-height: 1.25;
}

.ticket-desc {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-700);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
}

.ticket-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.ticket-thumb {
  width: 84px;
  height: 58px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  cursor: zoom-in;
}

.admin-reply-box {
  background: var(--cb-blue-50);
  border-left: 3px solid var(--cb-blue-700);
  border-radius: 0 8px 8px 0;
  padding: 8px 11px;
  font-size: 0.85rem;
  color: var(--ink-900);
  white-space: pre-wrap;
}

.ticket-meta {
  font-size: 0.78rem;
  color: var(--ink-500);
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  background: var(--bg-surface);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}
.empty-title { font-family: "Outfit", sans-serif; font-size: 1.18rem; font-weight: 700; margin: 0 0 6px; }
.empty-sub { color: var(--ink-500); margin: 0 0 18px; }

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 25, 16, 0.56);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 9999;
}

.modal-dialog {
  width: 100%;
  max-width: 680px;
  max-height: 92vh;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border-top: 5px solid var(--cb-green-700);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-sm { max-width: 420px; }
.modal-lg { max-width: 780px; }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.modal-header h2 {
  margin: 4px 0 0;
  font-family: "Outfit", sans-serif;
  font-size: 1.18rem;
  font-weight: 800;
}

.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1 1 auto;
  min-height: 0;
}
.modal-body > * { flex-shrink: 0; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.control-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-700);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.helper-text { margin: 0; font-size: 0.78rem; color: var(--ink-500); }
.form-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--danger-50);
  color: var(--danger-700);
  border: 1px solid #fecaca;
  font-size: 0.86rem;
  font-weight: 600;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}
.modal-footer-between { justify-content: space-between; }

/* Type selector */
.type-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.type-option {
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-page);
  border-radius: 11px;
  padding: 10px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.type-option strong { font-size: 0.86rem; color: var(--ink-900); }
.type-option span { font-size: 0.74rem; color: var(--ink-500); }
.type-option.active {
  border-color: var(--cb-green-700);
  background: var(--cb-green-50);
}

/* Upload zone */
.upload-zone {
  border: 1.5px dashed var(--border-strong);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  background: var(--bg-page);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.upload-zone:hover { border-color: var(--cb-green-700); background: var(--cb-green-50); }
.upload-zone span { font-size: 0.88rem; font-weight: 600; color: var(--cb-green-800); }
.upload-zone small { font-size: 0.76rem; color: var(--ink-500); }

.upload-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.upload-preview-item {
  position: relative;
  width: 110px;
  height: 78px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
}
.upload-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.upload-remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.72);
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
}

/* Detail & Timeline */
.detail-full-desc {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.6;
  color: var(--ink-900);
}
.detail-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.detail-attachment-img {
  max-width: 220px;
  max-height: 160px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  cursor: zoom-in;
  object-fit: cover;
}
.events-timeline {
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.events-timeline h3 {
  margin: 0;
  font-family: "Outfit", sans-serif;
  font-size: 0.96rem;
}
.event-row {
  background: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 0.83rem;
}
.admin-edit-box {
  background: var(--cb-blue-50);
  border: 1px solid #bfd6f2;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-edit-box h3 {
  margin: 0;
  font-family: "Outfit", sans-serif;
  font-size: 0.98rem;
  color: var(--cb-blue-800);
}
.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

/* Lightbox */
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10050;
}
.lightbox-backdrop img {
  max-width: 96vw;
  max-height: 90vh;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.lightbox-close {
  position: fixed;
  top: 16px;
  right: 18px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 1.6rem;
  cursor: pointer;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--cb-green-900);
  color: #ffffff;
  padding: 12px 17px;
  border-radius: 12px;
  border-left: 4px solid var(--cb-gold-400);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
  font-size: 0.88rem;
  font-weight: 600;
  z-index: 10100;
  max-width: 360px;
}
.toast.is-error { background: var(--danger-700); border-left-color: #ffffff; }

@media (max-width: 767px) {
  .container { padding: 0 12px; }
  .header-inner { flex-wrap: wrap; gap: 8px; }
  .brand-titles h1 { font-size: 1rem; }
  .brand-titles span { font-size: 0.64rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .type-selector { grid-template-columns: 1fr; }
  .form-row-2 { grid-template-columns: 1fr; }
  .controls-right { width: 100%; justify-content: stretch; }
  .input-search { max-width: none; }
  .chips-scroll { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .chips-scroll::-webkit-scrollbar { display: none; }
  .chip-row { flex-wrap: nowrap; width: max-content; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal-dialog, .modal-sm, .modal-lg { max-width: 100%; max-height: 92dvh; border-radius: 20px 20px 0 0; }
  .toast { left: 12px; right: 12px; bottom: 14px; max-width: none; }
}
