/* ---- Buttons ---------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 15px; border-radius: var(--r-sm); border: 1px solid var(--border-strong);
  font-size: 13px; font-weight: 500; white-space: nowrap; line-height: 1;
  transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease);
  background: none; color: var(--text-2);
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:disabled:hover { border-color: var(--border-strong); color: var(--text-2); }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
/* The hub's call to action: ink that turns to the accent when you reach for it. */
.btn-primary { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-primary:disabled:hover { background: var(--text); border-color: var(--text); color: var(--bg); transform: none; box-shadow: none; }
.btn-ghost { background: none; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); border-color: transparent; color: var(--text); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.06); background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-ghost { background: none; border-color: transparent; color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; border-radius: var(--r); }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; flex-shrink: 0;
  border: none; background: none; border-radius: var(--r-sm); color: var(--text-2); transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.active { color: var(--accent); background: var(--accent-soft); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn.sm svg { width: 16px; height: 16px; }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }
.link-btn { border: none; background: none; padding: 0; color: var(--accent); font-weight: 500; }
.link-btn:hover { text-decoration: underline; }

/* ---- Forms ------------------------------------------------------------------ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 14px; }
.label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.hint { font-size: 12px; color: var(--text-3); }
.error-text { font-size: 12.5px; color: var(--danger); }
.input, .textarea, .select {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--text);
  font-size: 13.5px; transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a94a6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.input.invalid { border-color: var(--danger); }
.input-sm { height: 32px; font-size: 13px; }
.input-icon { position: relative; }
.input-icon > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.input-icon > .input { padding-left: 34px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .field-row { grid-template-columns: 1fr; } }
input[type="date"], input[type="time"], input[type="datetime-local"] { min-width: 0; }

.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13.5px; user-select: none; }
.check input { appearance: none; width: 18px; height: 18px; margin: 0; border-radius: 5px; border: 1.5px solid var(--border-strong); background: var(--surface); display: grid; place-items: center; transition: background .15s, border-color .15s; flex-shrink: 0; cursor: pointer; }
.check input:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked::after { content: ""; width: 9px; height: 5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(1px, -1px); }
.check input.round { border-radius: 50%; }

.switch { position: relative; display: inline-flex; width: 38px; height: 22px; flex-shrink: 0; }
.switch input { appearance: none; margin: 0; width: 100%; height: 100%; border-radius: 22px; background: var(--surface-3); border: 1px solid var(--border-strong); cursor: pointer; transition: background .15s; }
.switch input:checked { background: var(--accent); border-color: var(--accent); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .18s var(--ease); pointer-events: none; }
.switch:has(input:checked)::after { transform: translateX(16px); }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--glass-2); border: 1px solid var(--glass-brd); border-radius: 12px; backdrop-filter: blur(12px) saturate(140%); -webkit-backdrop-filter: blur(12px) saturate(140%); }
.segmented button { border: none; background: none; height: 30px; padding: 0 12px; border-radius: 9px; font-size: 12.5px; font-weight: 500; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }
.segmented button svg { width: 15px; height: 15px; }
.segmented button:hover { color: var(--text); }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: var(--r-full);
  border: 1px solid var(--border-strong); background: none; font-size: 12px; font-weight: 500; color: var(--text-2); white-space: nowrap;
}
.chip svg { width: 14px; height: 14px; }
button.chip:hover { color: var(--accent); border-color: var(--accent); }
.chip.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.badge {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 10px; font-weight: 600; line-height: 1; box-shadow: 0 0 0 2px var(--surface);
}
.badge.soft { background: var(--accent-soft); color: var(--accent); box-shadow: none; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 7px; font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; background: var(--surface-3); color: var(--text-2); }
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tag.success { background: var(--success-soft); color: var(--success); }
