/* ADMIN CSS 3/4 — components: buttons, forms, cards, list rows, chips, switch, modal, toast */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1.5px solid var(--line-2); border-radius: 12px; background: #fff; color: var(--text); font-weight: 700; font-size: 14.5px; cursor: pointer; text-decoration: none !important; white-space: nowrap; -webkit-tap-highlight-color: transparent; transition: background .12s, border-color .12s; }
.btn:hover { border-color: var(--brand); color: var(--brand-dark); } .btn:active { transform: scale(.98); } .btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); } .btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: var(--on-brand); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); } .btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: var(--on-accent); }
.btn-ghost { background: var(--brand-soft); border-color: transparent; color: var(--brand-dark); }
.btn-danger { color: var(--danger); border-color: #f3c3c9; } .btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn-solid-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; } .btn-lg { min-height: 50px; font-size: 16px; } .btn-block { width: 100%; }
.btn-icon { width: 38px; min-height: 38px; padding: 0; border-radius: 10px; }

/* forms */
.field { display: grid; gap: 6px; margin-bottom: 14px; min-width: 0; } .field > label, .lbl { font-weight: 700; font-size: 13.5px; color: var(--text-2); }
.field small.hint, .hint { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.field input:not([type=checkbox]):not([type=radio]):not([type=color]), .field select, .field textarea, .input {
  width: 100%; min-height: 46px; padding: 10px 13px; border: 1.5px solid var(--line-2); border-radius: 12px; background: #fff; font-size: 16px; outline: none; -webkit-appearance: none; appearance: none; transition: border-color .12s, box-shadow .12s; }
.field textarea { min-height: 96px; resize: vertical; line-height: 1.5; } .field textarea.tall { min-height: 160px; }
.field select, select.input { padding-right: 34px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2368778d' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M5 9l7 7 7-7'/%3E%3C/svg%3E") no-repeat right 12px center; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field input[type=color] { width: 56px; height: 46px; padding: 3px; border: 1.5px solid var(--line-2); border-radius: 12px; background: #fff; }
.form-grid { display: grid; gap: 0 14px; grid-template-columns: 1fr; } .form-grid .full { grid-column: 1 / -1; }
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid.three { grid-template-columns: repeat(3, 1fr); } }
.input-affix { display: flex; align-items: stretch; } .input-affix span { display: grid; place-items: center; padding: 0 12px; background: var(--bg); border: 1.5px solid var(--line-2); border-right: 0; border-radius: 12px 0 0 12px; font-weight: 700; color: var(--muted); } .input-affix input { border-radius: 0 12px 12px 0 !important; }
.alert { padding: 12px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 14px; } .alert-err { background: var(--danger-soft); color: #9c1f30; border: 1px solid #f5c2c9; } .alert-ok { background: var(--ok-soft); color: #0a6b45; border: 1px solid #b6e6d0; } .alert-info { background: var(--brand-soft); color: var(--brand-dark); border: 1px solid #c6dcff; } .alert-warn { background: var(--warn-soft); color: #7a5412; border: 1px solid #f1dca3; }

/* switch */
.switch { position: relative; display: inline-block; width: 46px; height: 27px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.switch i { position: absolute; inset: 0; background: #cbd5e1; border-radius: 99px; transition: background .15s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s; }
.switch input:checked + i { background: var(--ok); } .switch input:checked + i::after { transform: translateX(19px); }
.switch input:focus-visible + i { outline: 3px solid color-mix(in srgb, var(--brand) 50%, transparent); outline-offset: 2px; }
.sw-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); } .sw-row:last-child { border-bottom: 0; } .sw-row b { display: block; font-size: 14.5px; } .sw-row span.hint { display: block; }

/* cards & stats */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow-sm); } .card > h3:first-child, .card > h2:first-child { margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; } .card-head h3 { margin: 0; }
.stats { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; margin-bottom: 14px; } @media (min-width: 900px) { .stats { grid-template-columns: repeat(4, 1fr); gap: 14px; } }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow-sm); }
.stat .si { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); margin-bottom: 6px; }
.stat.s2 .si { background: var(--accent-soft); color: var(--accent-dark); } .stat.s3 .si { background: var(--ok-soft); color: var(--ok); } .stat.s4 .si { background: #f1eaff; color: #7c3aed; }
.stat small { color: var(--muted); font-weight: 600; font-size: 12.5px; } .stat b { font-size: 21px; line-height: 1.2; word-break: break-word; }

/* list rows (used for every list: phone friendly) */
.list { display: grid; gap: 8px; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); min-width: 0; }
a.item, .item.click { cursor: pointer; text-decoration: none !important; color: inherit; } a.item:hover, .item.click:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.item .thumb { width: 52px; height: 52px; border-radius: 10px; background: var(--bg); object-fit: cover; flex: none; display: grid; place-items: center; color: #9aa9bd; overflow: hidden; } .item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.item .thumb.wide { width: 120px; height: 36px; } .item .thumb.logo img { object-fit: contain; background: #fff; }
.item .body { flex: 1; min-width: 0; } .item .t { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; } .item .m { color: var(--muted); font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 2px 10px; }
.item .end { display: flex; align-items: center; gap: 6px; flex: none; } .item .price { font-weight: 800; color: var(--brand-dark); white-space: nowrap; }
.item.off { opacity: .6; }
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; flex-wrap: wrap; } .toolbar .input { flex: 1; min-width: 160px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; scrollbar-width: none; } .chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border: 1.5px solid var(--line-2); border-radius: 99px; background: #fff; font-weight: 700; font-size: 13.5px; color: var(--text-2); }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); } .chip small { opacity: .75; font-weight: 700; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 800; background: var(--bg); color: var(--text-2); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: #0a6b45; } .badge.warn { background: var(--warn-soft); color: #8a5a0a; } .badge.bad { background: var(--danger-soft); color: #a8222f; } .badge.info { background: var(--brand-soft); color: var(--brand-dark); } .badge.purple { background: #f1eaff; color: #6d28d9; }
.empty { text-align: center; padding: 38px 14px; background: #fff; border: 1px dashed var(--line-2); border-radius: var(--r-lg); color: var(--muted); } .empty .ic { width: 44px; height: 44px; color: #a9b6c9; margin-bottom: 6px; } .empty b { display: block; color: var(--text); margin-bottom: 4px; }
.skel { background: linear-gradient(100deg, #e9eef5 30%, #f6f8fb 50%, #e9eef5 70%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: 12px; } @keyframes shimmer { to { background-position: -200% 0; } }
.tabs { display: flex; gap: 4px; padding: 4px; background: #e9eef5; border-radius: 14px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; } .tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 1 0 auto; min-height: 40px; padding: 0 16px; border: 0; border-radius: 10px; background: none; font-weight: 700; color: var(--muted); white-space: nowrap; } .tabs button.on { background: #fff; color: var(--brand-dark); box-shadow: var(--shadow-sm); }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 14px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; font-weight: 600; }
.savebar { position: sticky; bottom: calc(var(--tab-h) + var(--safe-b) + 8px); z-index: 30; display: flex; justify-content: flex-end; gap: 10px; padding: 10px; background: rgba(255, 255, 255, .94); backdrop-filter: blur(6px); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); margin-top: 6px; }
@media (min-width: 1024px) { .savebar { bottom: 14px; } }

/* image field */
.imgf { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1.5px dashed var(--line-2); border-radius: 14px; background: #fff; }
.imgf .pv { width: 84px; height: 84px; border-radius: 12px; background: var(--bg); display: grid; place-items: center; color: #9aa9bd; overflow: hidden; flex: none; } .imgf .pv.wide { width: 140px; height: 56px; } .imgf .pv img { width: 100%; height: 100%; object-fit: cover; } .imgf .pv.contain img { object-fit: contain; }
.imgf .acts { display: flex; flex-wrap: wrap; gap: 8px; } .gal { display: flex; flex-wrap: wrap; gap: 8px; } .gal .g { position: relative; width: 70px; height: 70px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); } .gal img { width: 100%; height: 100%; object-fit: cover; } .gal button { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .65); color: #fff; line-height: 1; }

/* modal (full-screen sheet on phones, dialog on desktop) */
.modal-back { position: fixed; inset: 0; z-index: 300; background: rgba(8, 18, 34, .55); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.modal { width: 100%; max-height: 94vh; display: flex; flex-direction: column; background: #fff; border-radius: 22px 22px 0 0; animation: rise .2s ease; padding-bottom: var(--safe-b); }
@keyframes rise { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); } .modal-head h3 { margin: 0; flex: 1; font-size: 17px; }
.modal-body { padding: 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; } .modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); background: #fff; }
.modal-foot .btn { flex: 1; } @media (min-width: 700px) { .modal-back { align-items: center; padding: 20px; } .modal { max-width: 720px; border-radius: 20px; max-height: 90vh; } .modal.sm { max-width: 460px; } .modal.lg { max-width: 920px; } .modal-foot .btn { flex: none; min-width: 120px; } }
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 16px); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 400; max-width: calc(100vw - 24px); padding: 12px 16px; border-radius: 14px; background: var(--navy); color: #fff; box-shadow: var(--shadow-lg); font-size: 14.5px; display: flex; gap: 8px; align-items: center; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); } .toast.err { background: #9c1f30; } @media (min-width: 1024px) { .toast { bottom: 24px; } }
