/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: 9px; font-size: 13px; font-weight: 600;
  cursor: pointer; border: 1px solid transparent; font-family: inherit;
  transition: all var(--duration) var(--ease); white-space: nowrap; line-height: 1;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { flex: none; }
.btn-primary, .btn-dark { background: var(--dark); color: #fff; }
.btn-primary:hover, .btn-dark:hover { background: var(--dark-hover); }
.btn-accent { background: var(--accent-grad); color: #fff; box-shadow: 0 6px 16px rgba(109,84,255,.28); }
.btn-accent:hover { box-shadow: 0 8px 20px rgba(109,84,255,.4); transform: translateY(-1px); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-2); }
.btn-secondary:hover { border-color: var(--muted-3); background: var(--subtle-3); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--subtle); color: var(--text); }
.btn-ghost.danger, .btn-danger { background: var(--red-dim); color: var(--red); }
.btn-danger:hover { background: #F6DAD6; }
.btn-danger-solid { background: #DC2626; color: #fff; border-color: #DC2626; }
.btn-danger-solid:hover { background: #B91C1C; }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 12px 22px; font-size: 14px; }
.btn-icon {
  width: 36px; height: 36px; padding: 0; border-radius: 9px;
  background: var(--surface); border: 1px solid var(--border-2); color: var(--text-2);
  cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 15px;
  transition: all var(--duration) var(--ease);
}
.btn-icon:hover { border-color: var(--muted-3); color: var(--text); }

/* ── Inputs ────────────────────────────────────────────── */
.input {
  width: 100%; background: var(--surface); border: 1px solid var(--border-2);
  border-radius: 10px; padding: 10px 12px; color: var(--text);
  font-size: 13.5px; font-family: inherit; outline: none;
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.input::placeholder { color: var(--muted-3); }
textarea.input { resize: vertical; line-height: 1.45; }
.select {
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 10px;
  padding: 10px 34px 10px 12px; color: var(--text); font-size: 13.5px; font-weight: 500;
  outline: none; cursor: pointer; appearance: none; font-family: inherit;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%239C9A92'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  transition: border-color var(--duration) var(--ease);
}
.select:focus, .select:hover { border-color: var(--accent); }

/* ── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl);
  overflow: hidden; transition: all var(--duration) var(--ease);
}
.card:hover { box-shadow: var(--shadow-card); }
.card-body { padding: 16px; }
.card-header { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted-2); }

/* ── Badge ─────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; }
.badge-accent { background: var(--accent-tint); color: var(--accent); }
.badge-green { background: var(--st-pub-tint); color: var(--st-pub); }
.badge-yellow { background: var(--st-sched-tint); color: var(--st-sched-fg); }
.badge-blue { background: var(--blue-dim); color: var(--blue); }

/* ── Modal ─────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(20,18,16,.5);
  z-index: 3000; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: 20px; width: 560px; max-width: 92vw; max-height: 86vh;
  overflow-y: auto; box-shadow: var(--shadow-lg); animation: modalIn .2s var(--ease);
}
@keyframes modalIn { from { opacity: 0; transform: scale(.97) translateY(8px); } }
.modal-head { padding: 20px 22px 14px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border-3); }
.modal-head h2, .modal-head h3 { font-size: 16px; font-weight: 700; flex: 1; }
.modal-close, .close-x { background: none; border: 1px solid var(--border-2); color: var(--muted-2); font-size: 18px; line-height: 1; cursor: pointer; width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.modal-close:hover, .close-x:hover { color: var(--text); background: var(--subtle); }
.modal-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ── Toast (bottom-center dark pill) ───────────────────── */
#toast-container { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 3500; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: var(--dark); color: #fff; border-radius: 12px;
  padding: 12px 18px; display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow-pop); pointer-events: all; min-width: 220px; max-width: 460px;
  animation: toastIn .3s var(--ease); font-size: 13.5px; font-weight: 600;
}
.toast-icon { font-size: 15px; flex-shrink: 0; }
.toast-msg { flex: 1; }
.toast.success { box-shadow: var(--shadow-pop), inset 3px 0 0 var(--st-pub-dot); }
.toast.error { box-shadow: var(--shadow-pop), inset 3px 0 0 #F87171; }
.toast.info { box-shadow: var(--shadow-pop), inset 3px 0 0 var(--accent-2); }
.toast.achievement { box-shadow: var(--shadow-pop), inset 3px 0 0 var(--warning); }
.toast.loading .spinner { width: 14px; height: 14px; flex-shrink: 0; border: 2px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(16px); } }

/* generic spinner */
.spinner { width: 16px; height: 16px; border: 2px solid var(--border-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
.spinner-big { width: 34px; height: 34px; border: 3px solid var(--accent-tint); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }

/* ── Skeleton ──────────────────────────────────────────── */
.skeleton { background: linear-gradient(90deg, var(--subtle) 25%, var(--subtle-2) 50%, var(--subtle) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }

/* ── Empty state ───────────────────────────────────────── */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 48px; color: var(--muted); text-align: center; }
.empty-state .icon { font-size: 42px; margin-bottom: 4px; opacity: .5; }
.empty-state p { font-size: 13.5px; max-width: 280px; }

/* ── Stat widget ───────────────────────────────────────── */
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1; font-family: 'JetBrains Mono', monospace; }
.stat-label { font-size: 11.5px; color: var(--muted); font-weight: 500; }

/* ── Progress ring ─────────────────────────────────────── */
.progress-ring { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.progress-ring svg { transform: rotate(-90deg); }
.progress-ring circle { fill: none; stroke-linecap: round; transition: stroke-dashoffset .4s var(--ease); }
.progress-ring .track { stroke: var(--subtle-2); }
.progress-ring .fill { stroke: var(--accent); }
.progress-ring .value { position: absolute; font-size: 14px; font-weight: 800; }

/* ── Custom confirm/input modals ───────────────────────── */
.cmodal-overlay { z-index: 3300; }
.cmodal { max-width: 420px; width: 92vw; padding: 22px 24px; display: flex; flex-direction: column; gap: 12px; border-radius: 18px; animation: modalIn .18s ease; }
.cmodal-title { font-size: 16px; font-weight: 700; }
.cmodal-message { font-size: 13.5px; color: var(--text-2); line-height: 1.55; white-space: pre-line; }
.cmodal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.cmodal-input { width: 100%; }

/* ── kbd help ──────────────────────────────────────────── */
.kbd-list { display: flex; flex-direction: column; gap: 8px; }
.kbd-row { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.kbd-row span { margin-left: 8px; color: var(--text-2); }
.kbd-row kbd { font-family: 'JetBrains Mono', monospace; font-size: 11px; background: var(--subtle-2); border: 1px solid var(--border-2); border-radius: 5px; padding: 2px 7px; color: var(--text-2); }

/* ── Auth (login / setup) ──────────────────────────────── */
#auth-screen { position: fixed; inset: 0; z-index: 4000; background: var(--bg); display: flex; align-items: center; justify-content: center; }
.auth-card { width: 380px; max-width: 92vw; background: var(--surface); border: 1px solid var(--border-2); border-radius: 20px; padding: 32px 30px; box-shadow: var(--shadow-soft); display: flex; flex-direction: column; gap: 6px; animation: rise .25s ease both; }
.auth-logo { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 14px; color: var(--text); }
.auth-logo span { color: var(--accent); }
.auth-title { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.auth-sub { font-size: 13px; color: var(--text-2); line-height: 1.5; margin-bottom: 8px; }
.auth-label { font-size: 11px; font-weight: 600; color: var(--muted-2); text-transform: uppercase; letter-spacing: .05em; margin: 10px 0 4px; display: block; }
.auth-submit { width: 100%; margin-top: 18px; }
.auth-error { background: var(--red-dim); color: var(--red); border-radius: 9px; padding: 9px 12px; font-size: 12.5px; margin: 6px 0; }
.auth-notice { background: var(--accent-tint); color: var(--accent); border-radius: 9px; padding: 9px 12px; font-size: 12.5px; margin: 6px 0; }

/* ── User manager ──────────────────────────────────────── */
.um-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; }
.um-row.inactive { opacity: .5; }
.um-avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; background: var(--subtle-2); color: var(--text); font-weight: 700; display: flex; align-items: center; justify-content: center; }
.um-info { flex: 1; min-width: 0; }
.um-name { font-size: 13px; font-weight: 600; }
.um-you { color: var(--muted); font-weight: 400; font-size: 12px; }
.um-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.um-actions { display: flex; gap: 6px; }

/* ── Section label (forms) ─────────────────────────────── */
.section-label { font-size: 11.5px; font-weight: 700; color: var(--muted-2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.form-grid { display: grid; gap: 12px; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
