/* Buttons, inputs, cards, badges, modals, toast. */

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--primary); color: #fff;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background .15s, opacity .15s;
}
.btn:hover { background: var(--primary-600); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 11px; font-size: 13px; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--primary); border-color: var(--border); }
.btn-danger:hover { background: rgba(210, 31, 31, .08); }
.btn-solid-danger { background: var(--primary); color: #fff; border-color: transparent; }
.btn-solid-danger:hover { background: var(--primary-600); }

.icon-btn {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 40px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  font-size: 20px; line-height: 1; cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ---------- form controls ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

.input {
  width: 100%; padding: 11px 13px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text);
  font-size: 15px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(210, 31, 31, .15); }
textarea.input { resize: vertical; min-height: 42px; font-family: inherit; }

.select {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); font-size: 14px;
}
.select-block { width: 100%; }

/* ---------- cards & badges ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px;
}
.card + .card { margin-top: 18px; }
.card-flush { padding: 0; overflow: hidden; }

.panel-h { margin: 0 0 12px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.panel-sub { margin: 0 0 12px; font-size: 13px; }

.role-badge {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 7px; border-radius: var(--radius-pill);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}
.role-badge.admin {
  color: var(--accent); border-color: rgba(245, 166, 35, .4); background: rgba(245, 166, 35, .1);
}
.count-badge {
  font-size: 12px; font-weight: 700; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-pill); padding: 1px 8px;
}

.error-msg {
  background: rgba(210, 31, 31, .1); color: var(--primary-600);
  border: 1px solid rgba(210, 31, 31, .25);
  padding: 9px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px;
}

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, .45);
  display: grid; place-items: center; padding: 20px;
}
.modal {
  width: 100%; max-width: 400px; padding: 22px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  max-height: calc(100dvh - 40px); overflow-y: auto;
}
.modal h3 { margin: 0 0 14px; }
.modal-text { margin: 0 0 16px; color: var(--muted); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.sheet-handle { display: none; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(26px + var(--safe-bottom));
  transform: translateX(-50%) translateY(20px);
  background: #1c2024; color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  z-index: 100; max-width: min(90vw, 420px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--primary-600); }

/* ---------- icons ---------- */
.ico { flex: none; display: block; }
.btn .ico, .acc-item .ico, .tab-icon .ico { pointer-events: none; }
.panel-h .ico { color: var(--muted); }
.center-empty .big .ico, .dropzone .big .ico { margin: 0 auto; color: var(--muted); }
.ok-mark .ico { color: var(--ok); }
.err-mark .ico { color: var(--primary); }

/* input with a leading icon */
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon .ii-icon {
  position: absolute; left: 12px; color: var(--muted); pointer-events: none;
}
.input-icon .input { padding-left: 40px; }
.input-icon .input::-webkit-search-cancel-button { -webkit-appearance: none; }
