:root {
    --primary: #ff6b3d;
    --primary-600: #ff5722;
    --primary-50: #fff2ec;
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f7f8fc;
    --border: #e6e8ef;
    --text: #1a1f2c;
    --muted: #7a8194;
    --accent: #5e72e4;
    --success: #18b25a;
    --danger: #ef4444;
    --warning: #f5a524;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
    --shadow: 0 6px 24px rgba(15, 23, 42, .06);
    --shadow-lg: 0 12px 40px rgba(15, 23, 42, .10);
    --sidebar-w: 240px;
}
[data-theme="dark"] {
    --bg: #0f1320;
    --surface: #161b2c;
    --surface-2: #1c2238;
    --border: #262d44;
    --text: #e6e8ef;
    --muted: #9aa1b6;
    --shadow: 0 6px 24px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: 12px; }

/* Layout */
.layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}
.main { min-width: 0; display: flex; flex-direction: column; }
.page { padding: 24px 28px 80px; flex: 1; }

/* Sidebar */
.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 6px 14px;
    border-bottom: 1px dashed var(--border);
    position: relative;
}
.brand__logo {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, var(--primary), #ffae6b);
    color: #fff; border-radius: 10px;
    display: grid; place-items: center; font-size: 20px;
    box-shadow: 0 6px 18px rgba(255,107,61,.45);
}
.brand__logo--xl { width: 64px; height: 64px; font-size: 32px; border-radius: 18px; margin: 0 auto; }
.brand__text { flex: 1; }
.brand__name { font-weight: 800; letter-spacing: .3px; }
.brand__tag { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.sidebar__collapse {
    background: transparent; border: 0; color: var(--muted); cursor: pointer;
    width: 28px; height: 28px; border-radius: 8px;
}
.sidebar__collapse:hover { background: var(--surface-2); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav__item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text);
    font-weight: 500;
    transition: background .15s, color .15s;
}
.nav__item:hover { background: var(--surface-2); text-decoration: none; }
.nav__item.is-active {
    background: linear-gradient(135deg, var(--primary), var(--primary-600));
    color: #fff;
    box-shadow: 0 8px 20px rgba(255,87,34,.32);
}
.nav__item i { font-size: 16px; }
.show-more {
    margin-top: auto;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 9px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
}

/* Topbar */
.topbar {
    display: flex; align-items: center; gap: 18px;
    padding: 14px 26px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.topbar__pills { display: flex; gap: 10px; flex: 1; min-width: 0; flex-wrap: wrap; }
.pill {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--primary-50);
    color: var(--text);
    padding: 8px 14px;
    border-radius: 999px;
    font-weight: 500;
    font-size: 13px;
}
[data-theme="dark"] .pill { background: rgba(255,107,61,.12); }
.pill__eye { background: transparent; border: 0; cursor: pointer; color: var(--muted); }
.topbar__right { display: flex; align-items: center; gap: 8px; }
.search {
    display: flex; align-items: center; gap: 8px;
    background: var(--surface-2);
    border-radius: 999px;
    padding: 8px 16px;
    width: 280px;
    border: 1px solid var(--border);
}
.search input { border: 0; outline: 0; background: transparent; color: var(--text); width: 100%; font-size: 13px; }
.search i { color: var(--muted); }
.icon-btn {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    position: relative;
    text-decoration: none;
}
.icon-btn:hover { background: var(--primary-50); text-decoration: none; }
.icon-btn .badge {
    position: absolute; top: -2px; right: -2px;
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 11px; font-weight: 700;
    display: grid; place-items: center;
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    padding: 18px 20px;
    margin-bottom: 18px;
}
.card__head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
    gap: 12px;
    flex-wrap: wrap;
}
.card__head h3 { margin: 0; font-size: 15px; color: var(--muted); letter-spacing: .5px; text-transform: uppercase; }
.card--filter .card__head h3 { color: var(--accent); }

/* Networks grid */
.networks {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
.network {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text);
    transition: transform .15s, border-color .15s, background .15s, box-shadow .15s;
}
.network:hover { transform: translateY(-2px); border-color: var(--c, var(--primary)); box-shadow: var(--shadow); }
.network.is-active {
    border-color: var(--c, var(--primary));
    background: var(--surface);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--c, var(--primary)) 25%, transparent);
}
.network i { color: var(--c, var(--primary)); font-size: 16px; }
@media (max-width: 1100px) { .networks { grid-template-columns: repeat(2, 1fr); } }

/* Order grid */
.grid { display: grid; gap: 18px; }
.grid--order { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.grid--2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 1100px) { .grid--order, .grid--2 { grid-template-columns: 1fr; } }

/* Tabs */
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.tab {
    background: var(--surface-2);
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: .5px;
    text-transform: uppercase;
    cursor: pointer;
}
.tab.is-active {
    background: linear-gradient(135deg, var(--primary), var(--primary-600));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 8px 20px rgba(255,87,34,.32);
}
.tab i { margin-right: 6px; }

/* Forms */
.order-form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; position: relative; }
.field > span { font-size: 12px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea, .select, .textarea {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    color: var(--text);
    font-size: 14px;
    width: 100%;
    outline: none;
    font-family: inherit;
}
.field input:focus, .select:focus, .textarea:focus { border-color: var(--primary); }
.textarea { resize: vertical; font-family: 'Inter', monospace; }
.field--search {
    position: relative;
}
.field--search input { padding-left: 38px; }
.field--search i {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--muted);
}
.field__hint { color: var(--muted); font-size: 11px; }
.readonly {
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    color: var(--text);
}
.readonly--charge {
    background: linear-gradient(135deg, var(--primary), var(--primary-600));
    color: #fff;
    font-weight: 700;
    border: 0;
}
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
.dripfeed-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Combobox */
.combo { position: relative; }
.combo input {
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 12px 36px 12px 14px;
    width: 100%;
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
}
.combo > i {
    position: absolute; right: 14px; top: 50%;
    transform: translateY(-50%); color: var(--muted); pointer-events: none;
}
.combo__menu {
    position: absolute; left: 0; right: 0; top: calc(100% + 4px);
    max-height: 320px; overflow: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    display: none;
    padding: 6px;
}
.combo.is-open .combo__menu { display: block; }
.combo__item {
    padding: 9px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 8px;
}
.combo__item:hover { background: var(--surface-2); }
.combo__item.is-active { background: var(--primary); color: #fff; }
.combo__item .price { color: var(--success); font-weight: 700; white-space: nowrap; }
.combo__item.is-active .price { color: #fff; }
.combo__empty { color: var(--muted); padding: 10px; text-align: center; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 0;
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    transition: transform .12s, box-shadow .12s;
}
.btn:hover { transform: translateY(-1px); }
.btn--primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-600));
    color: #fff;
    box-shadow: 0 8px 22px rgba(255,87,34,.35);
}
.btn--primary:hover { box-shadow: 0 10px 28px rgba(255,87,34,.45); }
.btn--ghost {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn--block { width: 100%; }

/* Side card */
.card--side { background: var(--surface); display: flex; flex-direction: column; gap: 14px; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.side-head h4 { margin: 0; color: var(--accent); font-size: 13px; letter-spacing: 1px; }
.search--mini { width: 200px; padding: 6px 12px; font-size: 12px; }
.search--mini input { font-size: 12px; }
.side-body p { margin: 0; }
.side-body .svc-line {
    background: var(--surface-2);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 13px;
}
.side-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
    background: var(--surface-2);
    padding: 14px;
    border-radius: var(--radius-sm);
}
.side-grid > div { display: flex; flex-direction: column; gap: 4px; }
.side-grid label { font-size: 11px; color: var(--muted); letter-spacing: .5px; }
.side-grid strong { font-weight: 700; color: var(--primary); font-size: 14px; }

/* Auth */
.auth-body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(1200px 600px at -10% -20%, rgba(255,107,61,.25), transparent 60%),
                radial-gradient(900px 500px at 110% 110%, rgba(94,114,228,.20), transparent 55%),
                var(--bg);
    display: grid; place-items: center;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    padding: 24px;
}
.auth-wrap {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    gap: 0;
    background: var(--surface);
    border-radius: 22px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    width: min(1000px, 100%);
    border: 1px solid var(--border);
}
.auth-card { padding: 40px 44px; }
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand h1 { margin: 14px 0 4px; font-size: 26px; }
.auth-brand p { margin: 0; color: var(--muted); font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form h2 { margin: 4px 0 6px; font-size: 18px; }
.auth-form label { display: flex; flex-direction: column; gap: 4px; }
.auth-form label > span { font-size: 12px; color: var(--muted); }
.auth-form input {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    color: var(--text);
    outline: none;
    font-size: 14px;
}
.auth-form input:focus { border-color: var(--primary); }
.auth-form__foot { color: var(--muted); margin: 6px 0 0; text-align: center; }
.auth-form__hint { color: var(--muted); margin: 0; text-align: center; font-size: 12px; }
.auth-side {
    background: linear-gradient(160deg, #ff6b3d, #ff8d3d 60%, #ffb86b);
    color: #fff;
    padding: 48px 40px;
    display: flex; flex-direction: column; justify-content: center;
}
.auth-side h2 { font-size: 26px; margin-top: 0; }
.auth-side ul { padding-left: 0; list-style: none; display: grid; gap: 8px; }
.auth-side li { display: flex; align-items: center; gap: 8px; opacity: .95; }
@media (max-width: 800px) { .auth-wrap { grid-template-columns: 1fr; } .auth-side { display: none; } }

/* Alerts */
.alert { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 12px; font-size: 13px; }
.alert--error { background: rgba(239,68,68,.12); color: var(--danger); border: 1px solid rgba(239,68,68,.3); }
.alert--info  { background: rgba(94,114,228,.10); color: var(--accent); border: 1px solid rgba(94,114,228,.3); }
.alert--warn  { background: rgba(245,165,36,.12); color: var(--warning); border: 1px solid rgba(245,165,36,.3); }

/* Tables */
.table-wrap { overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead th {
    text-align: left; padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .5px;
    position: sticky; top: 0; background: var(--surface);
}
.table tbody td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: var(--surface-2); }
.table .ellipsis { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.status--pending, .status--in.progress, .status--processing { background: rgba(245,165,36,.15); color: var(--warning); }
.status--completed { background: rgba(24,178,90,.15); color: var(--success); }
.status--canceled, .status--partial { background: rgba(239,68,68,.15); color: var(--danger); }
.status--open { background: rgba(94,114,228,.15); color: var(--accent); }
.status--deposit { background: rgba(24,178,90,.15); color: var(--success); }
.status--order   { background: rgba(255,107,61,.15); color: var(--primary); }
.status--refund  { background: rgba(94,114,228,.15); color: var(--accent); }
.pos { color: var(--success); font-weight: 600; }
.neg { color: var(--danger); font-weight: 600; }

/* Tickets */
.ticket { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 10px; }
.ticket header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }

/* Filters */
.filters { display: flex; gap: 8px; align-items: center; }
.filters .select, .filters input { min-width: 200px; }

/* FAB */
.fab {
    position: fixed; right: 24px; bottom: 24px;
    width: 54px; height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-600));
    color: #fff;
    border: 0; cursor: pointer;
    box-shadow: 0 12px 28px rgba(255,87,34,.45);
    font-size: 22px;
    z-index: 1000;
}

/* Toasts */
.toast-host {
    position: fixed; bottom: 24px; left: 50%;
    transform: translateX(-50%); display: flex;
    flex-direction: column; gap: 10px; z-index: 2000;
}
.toast {
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    padding: 12px 18px; border-radius: var(--radius-sm);
    color: var(--text);
    min-width: 280px; max-width: 400px;
    display: flex; align-items: center; gap: 10px;
    animation: toast-in .25s ease-out;
}
.toast--ok { border-color: var(--success); }
.toast--err { border-color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.muted { color: var(--muted); }

/* Responsive */
@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar { position: relative; height: auto; }
    .search { width: 100%; }
}
