/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; cursor: pointer; font-weight: 600; font-size: .92rem;
  padding: 11px 20px; border-radius: 11px;
  background: var(--grad-brand); color: #050508;
  transition: transform var(--speed), box-shadow var(--speed), filter var(--speed);
  min-height: 42px; /* touch target */
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 26px rgba(85, 239, 228, .28); filter: saturate(1.15); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--line);
}
.btn-ghost:hover { box-shadow: none; border-color: var(--bio); color: var(--bio); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 7px 13px; font-size: .8rem; min-height: 34px; border-radius: 8px; }

/* glass card */
.card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(18px) saturate(130%);
}
@supports not (backdrop-filter: blur(1px)) {
  .card { background: var(--surface); }
}
.card h3 { font-size: 1.02rem; margin-bottom: 10px; }
.card .kicker { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .18em; color: var(--bio); text-transform: uppercase; display: block; margin-bottom: 8px; }
.stat-card .big { font-family: var(--font-mono); font-size: 1.9rem; font-weight: 600; }
.stat-card .big.gold { color: var(--marker); }
.stat-card .big.mint { color: var(--bio); }

/* forms */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: .78rem; color: var(--text-dim); margin-bottom: 6px; letter-spacing: .06em; }
.input, select.input, textarea.input {
  width: 100%; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 13px; color: var(--text); outline: none;
  transition: border-color var(--speed), box-shadow var(--speed);
  min-height: 42px;
}
.input:focus { border-color: var(--bio); box-shadow: 0 0 0 3px var(--bio-soft); }
textarea.input { min-height: 110px; resize: vertical; }
select.input option { background: var(--panel); color: var(--ink); }

/* badges */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  font-family: var(--font-mono);
}
.badge.status-open      { background: rgba(85,239,228,.14); color: var(--bio); }
.badge.status-pending   { background: rgba(240,163,94,.16); color: var(--warn); }
.badge.status-answered  { background: rgba(155,143,255,.16); color: var(--helix); }
.badge.status-resolved  { background: rgba(61,220,151,.15); color: var(--ok); }
.badge.status-closed    { background: var(--ink-15); color: var(--text-dim); }
.badge.pri-low      { background: var(--ink-15); color: var(--text-dim); }
.badge.pri-medium   { background: rgba(85,239,228,.14); color: var(--bio); }
.badge.pri-high     { background: rgba(240,163,94,.16); color: var(--warn); }
.badge.pri-critical { background: rgba(255,93,122,.16); color: var(--danger); }
.badge.role { background: var(--helix-soft); color: var(--helix); }
.badge.overdue { background: rgba(255,93,122,.16); color: var(--danger); animation: pulse 2s infinite; }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 640px; }
.tbl th {
  text-align: left; padding: 11px 14px; font-family: var(--font-mono);
  font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-35);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--ink-15); vertical-align: middle; }
.tbl tbody tr { cursor: pointer; transition: background var(--speed); }
.tbl tbody tr:hover { background: rgba(85, 239, 228, .05); }
.tbl tbody tr:last-child td { border-bottom: none; }

/* attachment chips */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 12px; font-size: .78rem; cursor: pointer;
  max-width: 250px;
}
.chip:hover { border-color: var(--bio); color: var(--bio); text-decoration: none; }
.chip .x { color: var(--danger); font-weight: 700; cursor: pointer; }
.chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* toast */
#toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 90; display: flex; flex-direction: column; gap: 10px; max-width: min(360px, calc(100vw - 36px)); }
.toast {
  padding: 13px 18px; border-radius: 12px; background: var(--panel-2);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  display: flex; gap: 10px; align-items: flex-start; font-size: .9rem;
  animation: toast-in .3s cubic-bezier(.2,.9,.3,1.2);
}
.toast.ok { border-color: rgba(61,220,151,.5); }
.toast.err { border-color: rgba(255,93,122,.5); }
.toast .t-icon { font-weight: 800; }
.toast.ok .t-icon { color: var(--ok); }
.toast.err .t-icon { color: var(--danger); }
@keyframes toast-in { from { transform: translateY(14px); opacity: 0; } }

/* modal (sweetalert-style) */
#modal-root:not(:empty) {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center;
  background: rgba(3, 4, 7, .7); backdrop-filter: blur(6px);
  padding: 18px;
}
.modal {
  width: min(440px, 100%); background: var(--panel);
  border: 1px solid var(--glass-border); border-radius: 16px;
  padding: 26px; box-shadow: var(--shadow); text-align: center;
  animation: modal-in .25s cubic-bezier(.2,.9,.3,1.15);
  /* Adaptive: never taller than the viewport — a long form scrolls inside
     the modal instead of pushing its action buttons out of frame. */
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
/* Editor dialogs put their fields in this scroll area so Save/Cancel stay
   visible without any scrolling at all. */
.ed-scroll { max-height: min(58vh, 100%); overflow-y: auto; padding-right: 6px; text-align: left; }
.modal.wide { width: min(660px, 100%); text-align: left; }
@keyframes modal-in { from { transform: scale(.92); opacity: 0; } }
.modal h3 { font-size: 1.15rem; }
.modal .m-icon { font-size: 2.1rem; margin-bottom: 10px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.modal.wide .modal-actions { justify-content: flex-end; }

/* first-login EULA gate */
.eula-scroll {
  max-height: 44vh; overflow-y: auto; margin-top: 14px; padding: 14px 16px;
  border: 1px solid var(--glass-border); border-radius: 12px;
  background: var(--glass);
  font-size: .88rem; line-height: 1.55;
}
.eula-scroll ul { padding-left: 18px; margin: 8px 0; }
.eula-scroll li { margin: 7px 0; }
.eula-ack {
  display: flex; gap: 9px; align-items: flex-start; margin-top: 14px;
  font-size: .86rem; cursor: pointer; user-select: none;
}
.eula-ack input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--bio); }

/* misc */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filters .input { width: auto; min-width: 130px; flex: 0 1 auto; }
.filters .grow { flex: 1 1 180px; }
.empty { text-align: center; padding: 46px 20px; color: var(--ink-35); }
.empty .e-icon { font-size: 2rem; margin-bottom: 8px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 90px; padding-top: 10px; }
.bars .bar { flex: 1; background: var(--grad-brand); border-radius: 4px 4px 0 0; min-height: 3px; opacity: .85; position: relative; }
.bars .bar span { position: absolute; top: -19px; left: 50%; transform: translateX(-50%); font-size: .62rem; font-family: var(--font-mono); color: var(--ink-50); }
.bars .bar em { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-size: .6rem; font-style: normal; color: var(--ink-35); }
.rating-stars { display: inline-flex; gap: 4px; font-size: 1.5rem; cursor: pointer; }
.rating-stars b { color: var(--ink-15); transition: color .15s; cursor: pointer; }
.rating-stars b.on { color: var(--marker); }
.timeline { border-left: 2px solid var(--ink-15); padding-left: 16px; display: flex; flex-direction: column; gap: 12px; }
.timeline .tl-item { position: relative; font-size: .82rem; }
.timeline .tl-item::before {
  content: ""; position: absolute; left: -21.5px; top: 6px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--bio);
}
.kb-body h1, .kb-body h2, .kb-body h3 { margin-top: 1.2em; }
.kb-body table { border-collapse: collapse; margin: 12px 0; }
.kb-body th, .kb-body td { border: 1px solid var(--line); padding: 7px 12px; font-size: .88rem; }
.kb-body code { background: var(--surface-2); padding: 2px 6px; border-radius: 5px; font-family: var(--font-mono); font-size: .85em; }
.kb-body img, .kb-body video { max-width: 100%; border-radius: 10px; display: block; margin: 12px 0; }
.announce {
  border-left: 3px solid var(--marker); background: rgba(246,217,123,.06);
  padding: 12px 16px; border-radius: 0 10px 10px 0; margin-bottom: 12px;
}
