:root {
    color-scheme: dark;
    --bg: #080b10;
    --surface: #0e131a;
    --surface-2: #121923;
    --surface-3: #17202b;
    --border: #202b38;
    --border-light: #2a3745;
    --text: #eef4f8;
    --muted: #82909f;
    --muted-2: #5e6b78;
    --primary: #26d99a;
    --primary-strong: #16c884;
    --primary-soft: rgba(38, 217, 154, .11);
    --warning: #f4b64a;
    --warning-soft: rgba(244, 182, 74, .11);
    --danger: #ff6577;
    --danger-soft: rgba(255, 101, 119, .11);
    --blue: #5ca9ff;
    --blue-soft: rgba(92, 169, 255, .11);
    --radius: 16px;
    --shadow: 0 24px 60px rgba(0, 0, 0, .32);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-width: 320px;
    background:
        radial-gradient(circle at 76% -5%, rgba(33, 177, 128, .09), transparent 28rem),
        radial-gradient(circle at 10% 20%, rgba(66, 126, 196, .045), transparent 22rem),
        var(--bg);
    color: var(--text);
    font-family: Vazirmatn, "Segoe UI", Tahoma, sans-serif;
    font-size: 14px;
    line-height: 1.65;
    min-height: 100vh;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.muted { color: var(--muted-2); }
.app-shell { width: min(1480px, calc(100% - 48px)); margin: 0 auto; }

.topbar { height: 88px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(42, 55, 69, .7); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 44px; height: 44px; border: 1px solid rgba(38, 217, 154, .36); border-radius: 12px; display: grid; place-items: center; color: var(--primary); background: linear-gradient(145deg, rgba(38,217,154,.14), rgba(38,217,154,.04)); box-shadow: inset 0 0 16px rgba(38,217,154,.04); }
.brand-mark span { direction: ltr; font: 700 15px Consolas, monospace; }
.brand > span:last-child { display: flex; flex-direction: column; line-height: 1.25; }
.brand strong { font-size: 17px; font-weight: 800; letter-spacing: -.4px; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 4px; }
.top-actions { display: flex; align-items: center; gap: 10px; }

.button { border: 1px solid var(--border-light); border-radius: 10px; min-height: 42px; padding: 0 17px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--surface-2); color: var(--text); cursor: pointer; font-weight: 600; transition: .18s ease; }
.button svg { width: 18px; height: 18px; }
.button:hover { border-color: #3a4a5b; background: var(--surface-3); transform: translateY(-1px); }
.button-primary { background: var(--primary); border-color: var(--primary); color: #04120d; box-shadow: 0 8px 22px rgba(38, 217, 154, .12); }
.button-primary:hover { color: #04120d; background: #41e5ab; border-color: #41e5ab; }
.button-ghost { background: transparent; color: #c8d2da; }
.button-danger { background: var(--danger); border-color: var(--danger); color: white; }
.button-danger:hover { background: #ff7c8c; border-color: #ff7c8c; }
.icon-button { width: 38px; height: 38px; padding: 0; border: 1px solid transparent; border-radius: 9px; display: grid; place-items: center; background: transparent; color: var(--muted); cursor: pointer; }
.icon-button:hover { color: var(--text); background: var(--surface-3); border-color: var(--border); }

main { padding: 42px 0 30px; }
.welcome { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 28px; }
.eyebrow { display: flex; align-items: center; gap: 8px; margin: 0 0 9px; color: var(--primary); font-size: 12px; font-weight: 600; }
.live-dot { position: relative; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 4px rgba(38, 217, 154, .1); }
.welcome h1 { margin: 0; font-size: clamp(25px, 3vw, 34px); line-height: 1.35; letter-spacing: -1.1px; }
.welcome > div > p:last-child { color: var(--muted); margin: 8px 0 0; }
.attention-pill { display: flex; align-items: center; gap: 11px; border: 1px solid rgba(244, 182, 74, .24); background: var(--warning-soft); color: var(--warning); border-radius: 13px; padding: 10px 14px; }
.attention-pill svg { width: 22px; height: 22px; }
.attention-pill > span:last-child { display: flex; flex-direction: column; line-height: 1.4; }
.attention-pill strong { font-size: 13px; }
.attention-pill span span, .attention-pill small { color: #b58e4d; font-size: 10px; }
.attention-pill.is-clear { color: var(--primary); border-color: rgba(38,217,154,.22); background: var(--primary-soft); }
.attention-pill.is-clear > span:last-child { color: var(--primary); }
.attention-pill.is-clear .check { font-size: 23px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { min-height: 127px; display: flex; align-items: center; gap: 16px; background: linear-gradient(145deg, rgba(18,25,35,.96), rgba(13,18,25,.96)); border: 1px solid var(--border); border-radius: var(--radius); padding: 21px; position: relative; overflow: hidden; }
.stat-card::after { content: ''; width: 100px; height: 100px; position: absolute; left: -45px; top: -55px; border-radius: 50%; background: currentColor; opacity: .035; filter: blur(2px); }
.stat-icon { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); }
.stat-icon svg { width: 22px; height: 22px; }
.stat-card > div { display: grid; }
.stat-card > div > span { color: var(--muted); font-size: 12px; }
.stat-card strong { font-size: 25px; line-height: 1.35; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat-card small { color: var(--muted-2); font-size: 10px; }
.stat-soon .stat-icon { color: var(--warning); background: var(--warning-soft); }
.stat-expired .stat-icon { color: var(--danger); background: var(--danger-soft); }
.stat-revenue .stat-icon { color: var(--primary); background: var(--primary-soft); }
.stat-revenue .money-value { font-size: 21px; }

.panel { background: rgba(14,19,26,.94); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 15px 45px rgba(0,0,0,.08); }
.panel-head { min-height: 89px; padding: 19px 22px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--border); }
.panel-head h2 { font-size: 16px; margin: 0; }
.panel-head h2 span { color: var(--primary); background: var(--primary-soft); padding: 2px 8px; border-radius: 20px; margin-right: 5px; font-size: 11px; }
.panel-head p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.filter-form { display: flex; align-items: center; gap: 9px; }
.search-box { width: min(330px, 30vw); height: 42px; display: flex; align-items: center; gap: 9px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: #0a0f15; color: var(--muted-2); transition: .18s; }
.search-box:focus-within { border-color: rgba(38,217,154,.58); box-shadow: 0 0 0 3px rgba(38,217,154,.07); color: var(--primary); }
.search-box svg { width: 18px; height: 18px; }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; background: none; color: var(--text); font-size: 12px; }
select, input, textarea { border: 1px solid var(--border-light); background: #0b1118; color: var(--text); border-radius: 9px; outline: none; transition: .18s; }
select:focus, input:focus, textarea:focus { border-color: rgba(38,217,154,.58); box-shadow: 0 0 0 3px rgba(38,217,154,.07); }
.filter-form select { height: 42px; min-width: 154px; padding: 0 12px; font-size: 12px; }

.table-wrap { overflow-x: auto; overflow-y: visible; }
table { width: 100%; border-collapse: collapse; min-width: 1050px; }
th { height: 44px; background: rgba(11, 16, 22, .7); color: var(--muted-2); font-weight: 500; font-size: 10px; text-align: right; padding: 0 18px; border-bottom: 1px solid var(--border); }
td { height: 83px; padding: 13px 18px; border-bottom: 1px solid rgba(32,43,56,.74); vertical-align: middle; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(255,255,255,.014); }
tbody tr:last-child td { border-bottom: 0; }
.row-expired { background: linear-gradient(90deg, transparent 60%, rgba(255,101,119,.025)); }
.row-soon { background: linear-gradient(90deg, transparent 60%, rgba(244,182,74,.02)); }
.customer-cell { display: flex; align-items: center; gap: 11px; min-width: 175px; }
.avatar { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(145deg, #1d3940, #13292d); border: 1px solid #24484c; color: #7ce7c2; font-size: 14px; font-weight: 700; }
.customer-cell > div, .plan-cell, .due-cell > div { display: flex; flex-direction: column; }
.customer-cell strong { font-size: 12px; font-weight: 600; }
.customer-cell code { color: var(--muted); font-size: 10px; margin-top: 2px; }
code { font-family: Consolas, Monaco, monospace; }
.server-cell { display: flex; align-items: center; gap: 7px; color: #b8c4cd; font-size: 11px; white-space: nowrap; }
.server-pulse { width: 6px; height: 6px; background: var(--primary); border-radius: 50%; box-shadow: 0 0 0 3px rgba(38,217,154,.08); }
.plan-cell { min-width: 90px; }
.plan-cell strong { font-size: 11px; font-variant-numeric: tabular-nums; }
.plan-cell strong small { color: var(--muted); font-size: 8px; font-weight: 500; }
.plan-cell > span { color: var(--muted); font-size: 9px; margin-top: 2px; }
.due-cell { min-width: 142px; }
.due-cell > div { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
.due-cell strong { font: 600 11px Consolas, monospace; }
.due-cell span { color: var(--muted); font-size: 9px; white-space: nowrap; }
.progress { display: block; height: 3px; background: #242d36; border-radius: 10px; margin-top: 8px; overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.row-soon .progress i { background: var(--warning); }
.row-expired .progress i { width: 100% !important; background: var(--danger); opacity: .45; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 20px; font-size: 9px; font-weight: 600; white-space: nowrap; }
.status i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-healthy { color: var(--primary); background: var(--primary-soft); }
.status-soon { color: var(--warning); background: var(--warning-soft); }
.status-expired { color: var(--danger); background: var(--danger-soft); }
.status-paused { color: var(--muted); background: rgba(130,144,159,.1); }
.unpaid-note { color: var(--danger); font-size: 8px; display: block; margin-top: 4px; white-space: nowrap; }
.actions-cell { display: flex; justify-content: flex-end; align-items: center; gap: 5px; min-width: 135px; }
.renew-button { min-height: 36px; padding: 0 12px; color: var(--primary); background: var(--primary-soft); border-color: rgba(38,217,154,.17); font-size: 10px; }
.renew-button:hover { background: rgba(38,217,154,.17); border-color: rgba(38,217,154,.32); }
.more-wrap { position: relative; }
.row-menu { position: absolute; z-index: 20; left: 0; top: calc(100% + 5px); width: 175px; padding: 6px; border: 1px solid var(--border-light); background: #121922; border-radius: 11px; box-shadow: var(--shadow); opacity: 0; visibility: hidden; transform: translateY(-4px); transition: .14s; }
.row-menu.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
.row-menu button { width: 100%; height: 36px; padding: 0 9px; display: flex; align-items: center; gap: 8px; border: 0; border-radius: 7px; background: none; color: #bac5ce; cursor: pointer; font-size: 10px; text-align: right; }
.row-menu button:hover { background: var(--surface-3); color: white; }
.row-menu button svg { width: 15px; height: 15px; }
.row-menu .danger { color: var(--danger); }
.row-menu .settle-action { color: var(--primary); }
.empty-state { text-align: center; height: 300px; color: var(--muted); }
.empty-state .empty-icon { display: grid; place-items: center; margin: 0 auto 13px; width: 54px; height: 54px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 15px; color: var(--muted-2); }
.empty-state strong { display: block; color: var(--text); font-size: 14px; }
.empty-state p { margin: 5px 0 17px; font-size: 11px; }
.empty-state .button { width: fit-content; margin: auto; }

.activity-panel { margin-top: 20px; }
.activity-panel .panel-head { min-height: 75px; }
.activity-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.activity-item { min-height: 78px; display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 11px; padding: 13px 21px; border-bottom: 1px solid var(--border); }
.activity-item:nth-child(odd) { border-left: 1px solid var(--border); }
.activity-item:nth-last-child(-n+2) { border-bottom: 0; }
.activity-icon { width: 35px; height: 35px; border-radius: 10px; display: grid; place-items: center; color: var(--primary); background: var(--primary-soft); }
.activity-icon svg { width: 17px; }
.activity-item > div { display: flex; flex-direction: column; min-width: 0; }
.activity-item > div strong { font-size: 11px; }
.activity-item > div span { color: var(--muted); font-size: 9px; }
.activity-amount { text-align: left; }
.activity-amount strong { color: var(--primary); }
.activity-unpaid .activity-icon, .activity-unpaid .activity-amount strong { color: var(--danger); background-color: var(--danger-soft); }
.activity-unpaid .activity-amount strong { background: none; }

footer { min-height: 70px; display: flex; justify-content: space-between; align-items: center; color: var(--muted-2); font-size: 10px; }
footer > span:first-child { color: var(--muted); font-weight: 600; }

.modal { width: min(720px, calc(100% - 28px)); max-height: min(90vh, 900px); margin: auto; padding: 0; border: 1px solid var(--border-light); border-radius: 18px; background: #0e141c; color: var(--text); box-shadow: var(--shadow); overflow: auto; opacity: 0; transform: translateY(12px) scale(.985); transition: opacity .18s, transform .18s, overlay .18s allow-discrete, display .18s allow-discrete; }
.modal[open] { opacity: 1; transform: translateY(0) scale(1); }
@starting-style { .modal[open] { opacity: 0; transform: translateY(12px) scale(.985); } }
.modal::backdrop { background: rgba(1, 5, 9, .78); backdrop-filter: blur(5px); }
.modal-small { width: min(600px, calc(100% - 28px)); }
.modal-tiny { width: min(460px, calc(100% - 28px)); }
.modal-head { min-height: 83px; display: flex; justify-content: space-between; align-items: center; padding: 17px 21px; border-bottom: 1px solid var(--border); }
.modal-head > div { display: flex; align-items: center; gap: 11px; }
.modal-icon { width: 41px; height: 41px; display: grid; place-items: center; color: var(--blue); background: var(--blue-soft); border-radius: 11px; }
.modal-icon.renew { color: var(--primary); background: var(--primary-soft); }
.modal-icon.danger { color: var(--danger); background: var(--danger-soft); }
.modal-head h2 { margin: 0; font-size: 15px; }
.modal-head p { margin: 2px 0 0; color: var(--muted); font-size: 10px; }
.modal-body { padding: 22px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; color: #bdc8d1; font-size: 10px; }
.form-grid label > span b { color: var(--danger); }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; min-height: 43px; padding: 9px 11px; font-size: 12px; }
.form-grid textarea { resize: vertical; }
.form-grid .wide { grid-column: 1 / -1; }
.date-card { margin: 18px 0; padding: 14px; border: 1px solid var(--border); background: rgba(18,25,35,.55); border-radius: 12px; }
.date-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; color: var(--muted); font-size: 10px; }
.date-card-head button { border: 0; background: none; color: var(--primary); cursor: pointer; font-size: 9px; }
.modal-footer { min-height: 72px; padding: 13px 21px; display: flex; justify-content: flex-end; gap: 9px; align-items: center; border-top: 1px solid var(--border); }
.modal-footer .button { min-width: 105px; }
.renew-summary { display: grid; grid-template-columns: 1fr auto auto auto auto; align-items: center; gap: 8px; margin-bottom: 18px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; color: var(--muted); font-size: 9px; }
.renew-summary strong { color: var(--text); font: 600 11px Consolas, monospace; }
.renew-summary strong:last-child { color: var(--primary); }
.renew-summary i { color: var(--muted-2); font-style: normal; }
.checkbox-label { min-height: 63px; display: flex; flex-direction: row !important; align-items: center; gap: 7px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; background: rgba(18,25,35,.55); cursor: pointer; }
.checkbox-label input { width: 17px; min-height: 17px; accent-color: var(--primary); }
.checkbox-label > span { display: flex; flex-direction: column; }
.checkbox-label strong { color: var(--text); font-size: 10px; }
.checkbox-label small { color: var(--muted); font-size: 8px; }
.initial-payment { margin-top: 12px; }
.settle-hint { margin: 14px 0 0; color: var(--muted); font-size: 10px; }
.delete-copy { margin: 0; color: var(--muted); }
.delete-copy strong { color: var(--text); }
.modal-open { overflow: hidden; }

.toast { position: fixed; z-index: 100; left: 22px; bottom: 22px; max-width: min(440px, calc(100% - 44px)); min-height: 55px; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid rgba(38,217,154,.3); border-radius: 12px; color: var(--text); background: #13221e; box-shadow: var(--shadow); animation: toast-in .35s ease; transition: .3s; }
.toast > span { width: 27px; height: 27px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: #04120d; font-weight: 800; }
.toast p { margin: 0; flex: 1; font-size: 11px; }
.toast button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 18px; }
.toast-warning { background: #251e12; border-color: rgba(244,182,74,.3); }
.toast-warning > span { background: var(--warning); }
.toast-error { background: #28151a; border-color: rgba(255,101,119,.3); }
.toast-error > span { background: var(--danger); color: white; }
.toast.is-hidden { opacity: 0; transform: translateY(15px); pointer-events: none; }
@keyframes toast-in { from { opacity: 0; transform: translateY(15px); } }

@media (max-width: 1050px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .panel-head { align-items: flex-start; flex-direction: column; }
    .filter-form { width: 100%; }
    .search-box { width: 100%; }
}

@media (max-width: 680px) {
    .app-shell { width: min(100% - 24px, 1480px); }
    .topbar { height: 73px; }
    .brand small, .hide-mobile { display: none; }
    .brand-mark { width: 38px; height: 38px; }
    .top-actions .button-primary { min-height: 39px; padding: 0 12px; font-size: 11px; }
    main { padding-top: 28px; }
    .welcome { align-items: flex-start; flex-direction: column; gap: 16px; }
    .welcome h1 { font-size: 25px; }
    .welcome > div > p:last-child { font-size: 11px; }
    .attention-pill { align-self: stretch; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
    .stat-card { min-height: 112px; gap: 10px; padding: 14px; }
    .stat-icon { width: 38px; height: 38px; border-radius: 10px; }
    .stat-card strong { font-size: 21px; }
    .stat-card > div > span { font-size: 10px; }
    .stat-card small { font-size: 8px; }
    .stat-revenue .money-value { font-size: 15px; }
    .panel-head { padding: 16px; }
    .filter-form { flex-direction: column; }
    .filter-form select { width: 100%; }
    .table-wrap { overflow: visible; }
    table { min-width: 0; }
    thead { display: none; }
    tbody { display: grid; gap: 10px; padding: 10px; }
    tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 15px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-2); }
    tbody td { display: block; height: auto; padding: 0; border: 0; }
    tbody td::before { content: attr(data-label); display: block; color: var(--muted-2); font-size: 8px; margin-bottom: 4px; }
    tbody td:first-child, tbody .actions-cell, tbody .empty-state { grid-column: 1 / -1; }
    tbody td:first-child::before, tbody .actions-cell::before { display: none; }
    .actions-cell { padding-top: 9px; border-top: 1px solid var(--border); }
    .renew-button { flex: 1; }
    .due-cell { min-width: 0; }
    .empty-state { height: 260px; display: flex; flex-direction: column; justify-content: center; }
    .activity-list { grid-template-columns: 1fr; }
    .activity-item:nth-child(odd) { border-left: 0; }
    .activity-item:nth-last-child(-n+2) { border-bottom: 1px solid var(--border); }
    .activity-item:last-child { border-bottom: 0; }
    footer { flex-direction: column; justify-content: center; gap: 2px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .wide { grid-column: auto; }
    .modal-head, .modal-footer { padding-left: 15px; padding-right: 15px; }
    .modal-body { padding: 16px; }
    .renew-summary { grid-template-columns: 1fr auto; }
    .renew-summary i { display: none; }
    .modal-footer .button { min-width: 0; flex: 1; }
}
