/* Reusable components: cards, buttons, forms, switches, chips, toasts, dialogs, tables. */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head .ic { color: var(--accent); }
.grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
.stat { background: var(--surface-2); border-radius: var(--r-sm); padding: 12px 14px; }
.stat b { display: block; font-size: 1.5rem; line-height: 1.2; } .stat span { color: var(--muted); font-size: .84rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); } .btn.primary:hover { background: var(--accent-2); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; } .btn.sm { min-height: 36px; padding: 4px 12px; font-size: .9rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; } .row.between { justify-content: space-between; }
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; } .field:first-of-type { margin-top: 0; }
.field > label, .label { font-weight: 600; font-size: .95rem; }
.hint { color: var(--muted); font-size: .86rem; }
.input, .select, .textarea { width: 100%; min-height: 46px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); text-align: start; }
.textarea { min-height: 84px; resize: vertical; }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.input:focus, .select:focus, .textarea:focus { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.error { color: var(--danger); font-size: .88rem; min-height: 0; } .error:empty { display: none; }
.two { display: grid; gap: 12px; grid-template-columns: 1fr; } @media (min-width: 560px) { .two { grid-template-columns: 1fr 1fr; } }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.seg button { min-height: 44px; padding: 8px 16px; border: 0; background: transparent; cursor: pointer; font-weight: 600; color: var(--text); }
.seg button + button { border-inline-start: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.switch-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); } .switch-row:first-of-type { border-top: 0; padding-top: 0; }
.switch-row .txt { flex: 1; min-width: 0; } .switch-row .txt b { display: block; }
.switch { position: relative; flex: none; width: 54px; height: 32px; border: 0; border-radius: 16px; background: var(--line); cursor: pointer; transition: background .15s; padding: 0; }
.switch::after { content: ""; position: absolute; top: 4px; inset-inline-start: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35); transition: inset-inline-start .15s; }
.switch[aria-checked="true"] { background: var(--ok); } .switch[aria-checked="true"]::after { inset-inline-start: 26px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; } .chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); text-decoration: none; font-weight: 600; font-size: .92rem; cursor: pointer; }
.chip[aria-current="true"], .chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip.token { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; direction: ltr; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.tag.ok { background: var(--ok-bg); color: var(--ok); } .tag.warn { background: var(--warn-bg); color: var(--warn); } .tag.bad { background: var(--danger-bg); color: var(--danger); }
.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--warn-bg); color: var(--warn); font-size: .92rem; } .notice.ok { background: var(--ok-bg); color: var(--ok); } .notice.bad { background: var(--danger-bg); color: var(--danger); }
.list { list-style: none; margin: 0; padding: 0; } .list li { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); } .list li:first-child { border-top: 0; }
.empty { text-align: center; color: var(--muted); padding: 22px 8px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; } .tbl th, .tbl td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: start; } .tbl th { color: var(--muted); font-weight: 600; } .tbl .n { text-align: end; white-space: nowrap; }
.toasts { position: fixed; inset-inline: 12px; bottom: calc(var(--tab-h) + 14px + env(safe-area-inset-bottom)); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
@media (min-width: 900px) { .toasts { bottom: 20px; align-items: flex-end; inset-inline-start: 120px; } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 520px; width: 100%; padding: 12px 14px; border-radius: 12px; background: var(--brand); color: #fff; box-shadow: 0 8px 28px rgba(0,0,0,.28); animation: pop .18s ease-out; }
.toast.error { background: var(--danger); } .toast.ok { background: var(--ok); color: #fff; } .toast.out { opacity: 0; transition: opacity .2s; }
.toast span { flex: 1; } .toast button { border: 0; background: rgba(255,255,255,.18); color: inherit; border-radius: 8px; min-height: 34px; padding: 0 12px; cursor: pointer; font-weight: 700; } .toast .toast-x { padding: 0 10px; font-size: 1.1rem; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.dlg { border: 0; border-radius: var(--r); padding: 0; max-width: min(92vw, 440px); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.dlg::backdrop { background: rgba(8,16,30,.55); } .dlg form { padding: 20px; } .dlg p { margin-top: 8px; color: var(--muted); }
.dlg-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 18px; }
