/* ==========================================================
   BotHost — core design system (White + Blue premium theme)
   ========================================================== */
:root {
    --bg: #F7F9FC;
    --surface: #FFFFFF;
    --primary: #2563EB;
    --primary-2: #3B82F6;
    --navy: #14213D;
    --light: #EFF6FF;
    --border: #E5EAF2;
    --text: #172033;
    --muted: #64748B;
    --success: #16A34A;
    --warning: #F59E0B;
    --danger: #EF4444;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(20, 33, 61, .04), 0 1px 3px rgba(20, 33, 61, .06);
    --shadow: 0 4px 6px -1px rgba(20, 33, 61, .05), 0 10px 24px -6px rgba(20, 33, 61, .08);
    --shadow-lg: 0 20px 45px -12px rgba(20, 33, 61, .22);
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Hind Siliguri", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { color: var(--navy); line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 26px; } h2 { font-size: 20px; } h3 { font-size: 16px; }
p { margin: 0 0 1em; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: #1D4ED8; }
img, svg { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--border); margin: 8px 0; }
code, pre, .mono { font-family: var(--mono); }
code { background: var(--light); color: var(--primary); padding: 2px 6px; border-radius: 6px; font-size: 13px; }
.ic { flex-shrink: 0; vertical-align: middle; }
.muted { color: var(--muted); } .text-danger { color: var(--danger) !important; } .text-success { color: var(--success); }
.text-right { text-align: right; } .text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 16px; }
.flex { display: flex; } .items-center { align-items: center; } .gap-1 { gap: 8px; } .gap-2 { gap: 16px; } .wrap { flex-wrap: wrap; } .between { justify-content: space-between; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid transparent; font: 600 14px/1.2 var(--font); cursor: pointer; transition: all .18s ease; text-decoration: none; white-space: nowrap; }
.btn:disabled, .btn.is-loading { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(37, 99, 235, .3); }
.btn-primary:hover { background: #1D4ED8; color: #fff; transform: translateY(-1px); box-shadow: 0 6px 14px -4px rgba(37, 99, 235, .45); }
.btn-outline { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--primary-2); color: var(--primary); background: var(--light); }
.btn-soft { background: var(--light); color: var(--primary); } .btn-soft:hover { background: #DBEAFE; color: var(--primary); }
.btn-success { background: var(--success); color: #fff; } .btn-success:hover { background: #15803D; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; } .btn-danger:hover { background: #DC2626; color: #fff; }
.btn-danger-soft { background: #FEF2F2; color: var(--danger); } .btn-danger-soft:hover { background: #FEE2E2; color: var(--danger); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn-lg { padding: 14px 26px; font-size: 15.5px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn.is-loading::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; position: relative; transition: all .18s; }
.icon-btn:hover { background: var(--light); color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { margin: 0; }
.card-body { padding: 22px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 18px; }
label, .label { display: block; font-size: 13px; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
.input, select.input, textarea.input { width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; color: var(--text); font: 400 15px var(--font); transition: border-color .15s, box-shadow .15s; outline: none; }
.input:focus { border-color: var(--primary-2); box-shadow: 0 0 0 4px rgba(59, 130, 246, .15); }
.input::placeholder { color: #9AA6B8; }
textarea.input { resize: vertical; min-height: 96px; line-height: 1.5; }
.input[readonly] { background: #F8FAFC; color: var(--muted); }
.help { display: block; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.input-group { display: flex; gap: 8px; } .input-group .input { flex: 1; min-width: 0; }
.checkbox { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--primary); }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #CBD5E1; border-radius: 24px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: var(--shadow-sm); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(20px); }

/* ---------- Alerts / badges ---------- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid; font-size: 14px; margin-bottom: 18px; }
.alert-info { background: var(--light); border-color: #BFDBFE; color: #1E40AF; }
.alert-success { background: #F0FDF4; border-color: #BBF7D0; color: #166534; }
.alert-warning { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }
.alert-danger { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }
.badge-success { background: #DCFCE7; color: #15803D; } .badge-danger { background: #FEE2E2; color: #B91C1C; }
.badge-warning { background: #FEF3C7; color: #B45309; } .badge-muted { background: #F1F5F9; color: #475569; } .badge-info { background: #DBEAFE; color: #1D4ED8; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--light); color: var(--primary); font-size: 13px; font-weight: 600; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--border); background: #FBFCFE; white-space: nowrap; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #FBFCFE; }
.amount-pos { color: var(--success); font-weight: 600; } .amount-neg { color: var(--danger); font-weight: 600; }

/* ---------- Pagination, empty state, progress ---------- */
.pagination { display: flex; gap: 6px; justify-content: center; padding: 18px; flex-wrap: wrap; }
.pagination a { padding: 7px 13px; border: 1px solid var(--border); border-radius: 9px; color: var(--text); background: #fff; font-weight: 600; font-size: 13px; }
.pagination a:hover, .pagination a.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.empty { text-align: center; padding: 56px 24px; }
.empty .empty-ic { width: 64px; height: 64px; border-radius: 18px; background: var(--light); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.empty h3 { margin-bottom: 6px; } .empty p { color: var(--muted); max-width: 380px; margin: 0 auto 18px; }
.progress { height: 8px; background: #E2E8F0; border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-2)); border-radius: 99px; transition: width .4s; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(20, 33, 61, .45); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 1000; }
.modal.open { display: flex; animation: fade .15s ease; }
.modal-box { background: #fff; border-radius: 18px; width: 100%; max-width: 480px; max-height: 92vh; overflow: auto; box-shadow: var(--shadow-lg); animation: pop .2s ease; }
.modal-box.modal-lg { max-width: 720px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px 0; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-body { padding: 18px 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 24px 22px; }
.modal-ic { width: 46px; height: 46px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; background: var(--light); color: var(--primary); margin-bottom: 12px; }
.modal-ic.danger { background: #FEF2F2; color: var(--danger); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Toasts ---------- */
.toast-root { position: fixed; top: 18px; right: 18px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; max-width: calc(100vw - 36px); }
.toast { display: flex; gap: 10px; align-items: flex-start; min-width: 280px; max-width: 380px; padding: 14px 16px; background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 14px; animation: slide .25s ease; }
.toast.success { border-left-color: var(--success); } .toast.error, .toast.danger { border-left-color: var(--danger); } .toast.warning { border-left-color: var(--warning); }
.toast.leaving { opacity: 0; transform: translateX(20px); transition: all .25s; }
@keyframes slide { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* ---------- Skeleton / loading ---------- */
.skeleton { background: linear-gradient(90deg, #EEF2F7 25%, #F8FAFC 37%, #EEF2F7 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; min-height: 16px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 60; }
.dropdown.open .dropdown-menu { display: block; animation: pop .15s ease; }
.dropdown-menu a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--text); font-weight: 500; font-size: 14px; }
.dropdown-menu a:hover { background: var(--light); color: var(--primary); }
.dropdown-menu hr { margin: 6px 0; }

/* ---------- Misc ---------- */
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; color: var(--navy); letter-spacing: -.02em; }
.brand:hover { color: var(--navy); }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 6px 14px -4px rgba(37, 99, 235, .55); }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 500; } .kv dd { margin: 0; word-break: break-word; }
.copy-field { display: flex; gap: 8px; } .copy-field .input { font-family: var(--mono); font-size: 13px; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs a, .tabs button { padding: 10px 16px; border: 0; background: none; font: 600 14px var(--font); color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active, .tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }

.brand-mark.has-img { background: #fff; border: 1px solid var(--border); box-shadow: none; overflow: hidden; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
