/* VPN Premium - CI Layout + Modern Polish */

:root {
    --primary: #1d4ed8;
    --primary-hover: #1e40af;
    --primary-soft: #dbeafe;
    --primary-muted: #eff6ff;
    --gold: #92400e;
    --gold-soft: #fef3c7;
    --gold-border: #fcd34d;
    --purple: #6d28d9;
    --purple-soft: #ede9fe;
    --purple-border: #c4b5fd;
    --danger: #b91c1c;
    --danger-soft: #fef2f2;
    --danger-border: #fecaca;
    --act-edit: #0e7490;
    --act-edit-soft: #ecfeff;
    --act-edit-border: #67e8f9;
    --act-edit-hover: #0891b2;
    --act-qr: #9333ea;
    --act-qr-soft: #faf5ff;
    --act-qr-border: #d8b4fe;
    --act-qr-hover: #7e22ce;
    --act-link: #4338ca;
    --act-link-soft: #eef2ff;
    --act-link-border: #a5b4fc;
    --act-link-hover: #4f46e5;
    --act-del: #c2410c;
    --act-del-soft: #fff7ed;
    --act-del-border: #fdba74;
    --act-del-hover: #ea580c;
    --success: #15803d;
    --success-soft: #dcfce7;
    --success-border: #86efac;
    --content-bg: #e8eef4;
    --surface: #ffffff;
    --surface-muted: #f3f6fa;
    --surface-subtle: #f8fafc;
    --border: #d5dee8;
    --act-border: #b8c5d4;
    --text: #0f172a;
    --text-muted: #475569;
    --header-h: 56px;
    --layout-max: 1200px;
    --radius: 10px;
    --radius-sm: 7px;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.07), 0 1px 3px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.09);
    --font: 'Inter', system-ui, -apple-system, sans-serif;

    /* Typography scale - single source of truth */
    --fs-2xs: 10px;
    --fs-xs: 11px;
    --fs-sm: 12px;    /* breadcrumb, footer, badges, segments */
    --fs-base: 13px;  /* body, inputs, table cells */
    --fs-md: 14px;    /* panel titles, modal title */
    --fs-lg: 18px;    /* page title */
    --fs-xl: 22px;    /* stat numbers */
    --lh-tight: 1.35;
    --lh-normal: 1.5;
    --fw-normal: 400;
    --fw-medium: 500;
    --fw-semibold: 600;
    --control-h: 36px;
    --fw-bold: 700;
    --label-spacing: 0.05em;
}

* { box-sizing: border-box; }

body {
    font-family: var(--font);
    font-size: var(--fs-base);
    font-weight: var(--fw-normal);
    line-height: var(--lh-normal);
    color: var(--text);
    background: var(--content-bg);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Shared typography utilities */
.text-label {
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    letter-spacing: var(--label-spacing);
    text-transform: uppercase;
    color: var(--text-muted);
    line-height: var(--lh-tight);
}

.tabular { font-variant-numeric: tabular-nums; }

.wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Top bar ── */
.topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: var(--header-h);
    max-width: var(--layout-max);
    margin: 0 auto;
    padding: 0 20px;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text) !important;
    text-decoration: none;
    flex-shrink: 0;
}

.topbar-brand:hover .brand-text {
    color: var(--primary);
}

.brand-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 15px;
    flex-shrink: 0;
}

.brand-text {
    font-size: var(--fs-md);
    font-weight: var(--fw-bold);
    letter-spacing: -0.02em;
    line-height: var(--lh-tight);
    color: var(--text);
    transition: color 0.12s;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    min-width: 0;
}

.topbar-stats {
    display: flex;
    align-items: center;
    gap: 6px;
}

.topbar-stat,
.xray-pill,
.live-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 112px;
    height: 32px;
    padding: 0 14px;
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    line-height: 1;
    border-radius: 999px;
    white-space: nowrap;
    box-sizing: border-box;
    border: 1px solid transparent;
}

.topbar-stat {
    color: var(--primary);
    background: var(--primary-muted);
    border-color: var(--primary-soft);
}

.topbar-stat i {
    font-size: 11px;
    color: var(--primary);
    opacity: 1;
}

.topbar-stat-text {
    color: var(--primary);
    font-weight: var(--fw-medium);
}

.topbar-stat-text span,
.topbar-stat-text #user-count,
.topbar-stat-text #lifetime-count {
    font-weight: var(--fw-bold);
    font-variant-numeric: tabular-nums;
    color: var(--primary);
}

.topbar-stat-vip {
    color: var(--gold);
    background: var(--gold-soft);
    border-color: var(--gold-border);
}

.topbar-stat-vip i {
    color: var(--gold);
    opacity: 1;
}

.topbar-stat-vip .topbar-stat-text,
.topbar-stat-vip .topbar-stat-text span,
.topbar-stat-vip #lifetime-count {
    color: var(--gold);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.user-menu {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text) !important;
    font-size: var(--fs-base);
    font-weight: var(--fw-medium);
    line-height: var(--lh-tight);
    padding: 6px 10px 6px 6px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    border: 1px solid transparent;
    background: transparent;
    -webkit-tap-highlight-color: transparent;
}

.user-menu:hover,
.user-menu.show,
.user-menu:focus,
.user-menu:focus-visible,
.user-menu:active {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    outline: none;
    color: var(--text) !important;
}

.user-name {
    display: none;
}

.user-avatar {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    border-radius: 50%;
}

.live-pill {
    color: var(--success);
    background: var(--success-soft);
    border-color: var(--success-border);
}

.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 2px rgba(21, 128, 61, 0.22);
    animation: livePulse 2s ease-in-out infinite;
}

@keyframes livePulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(21, 128, 61, 0.22); }
    50% { box-shadow: 0 0 0 4px rgba(21, 128, 61, 0.14); }
}

/* ── Content ── */
.content-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.content { flex: 1; padding: 20px 0 28px; min-width: 0; }

.container-fluid {
    padding-left: 20px;
    padding-right: 20px;
    max-width: var(--layout-max);
    margin-left: auto;
    margin-right: auto;
}

/* ── Panel cards ── */
.panel-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0;
    box-shadow: var(--shadow);
    overflow: visible;
}

.panel-card > .table-responsive {
    overflow-x: auto;
    border-radius: 0;
}

.table-scroll {
    position: relative;
}

.panel-card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-muted);
    border-radius: 0;
}

.panel-card-header h2 {
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
    line-height: var(--lh-tight);
    margin: 0;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-card-header h2 i {
    color: var(--primary);
    opacity: 0.75;
    font-size: var(--fs-sm);
}

.panel-card-subtitle {
    margin-top: 4px;
    font-size: var(--fs-xs);
    color: var(--text-muted);
    line-height: var(--lh-tight);
}

.panel-card-body {
    padding: 16px 18px;
    border-radius: 0;
}

/* ── Form ── */
.form-shell {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.form-main {
    flex: 1;
    min-width: 0;
}

.form-action {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding-top: 20px;
}

.btn-add {
    min-width: 96px;
    padding: 0 16px;
    font-weight: var(--fw-semibold);
    box-shadow: var(--shadow);
}

.btn.btn-primary.btn-add {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn.btn-primary.btn-add:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
}

.btn-add:active {
    transform: scale(0.98);
}

.btn-add.is-loading {
    opacity: 0.7;
    pointer-events: none;
}

.btn-add:disabled {
    opacity: 0.7;
}

.btn-add i {
    font-size: 11px;
}

.form-row-main {
    display: grid;
    grid-template-columns: 1fr 150px 130px;
    gap: 12px;
    align-items: end;
}

.field-masa,
.field-hp { min-width: 0; }

.field label {
    display: block;
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    color: var(--text-muted);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: var(--label-spacing);
    line-height: var(--lh-tight);
}

.field-btn .btn { white-space: nowrap; }

.form-row-options {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.option-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.option-label {
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    color: var(--text-muted);
    min-width: 44px;
    text-transform: uppercase;
    letter-spacing: var(--label-spacing);
    line-height: var(--lh-tight);
}

.segment-group {
    display: inline-flex;
    gap: 3px;
    padding: 3px;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.segment-locked {
    background: var(--surface-muted);
}

.segment-btn {
    padding: 6px 14px;
    font-family: var(--font);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    line-height: var(--lh-tight);
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s, color 0.12s;
}

.segment-btn:hover:not(.active):not(.segment-fixed) {
    background: #fff;
    color: var(--text);
}

.segment-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.segment-btn.active {
    background: var(--primary);
    color: #fff;
    font-weight: var(--fw-semibold);
}

.segment-fixed {
    pointer-events: none;
    cursor: default;
    font-weight: var(--fw-semibold);
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    background: #dde4ed;
    min-width: 52px;
    text-align: center;
}

.form-control, .form-select {
    font-family: var(--font);
    font-size: var(--fs-base);
    font-weight: var(--fw-normal);
    line-height: var(--lh-tight);
    border-color: var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 11px;
    height: var(--control-h);
    color: var(--text);
}

select.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%2394a3b8' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control.is-invalid {
    border-color: #fca5a5;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

.field-error {
    margin: 4px 0 0;
    font-size: var(--fs-xs, 0.75rem);
    line-height: 1.35;
    color: #dc2626;
}

.form-control::placeholder {
    color: #94a3b8;
    font-weight: var(--fw-normal);
}

/* ── Unified control buttons (same height as form fields) ── */
.btn-control,
.act,
.btn.btn-refresh,
.modal-content .btn:not(.btn-close),
.modal-body .input-group .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: var(--control-h);
    min-height: var(--control-h);
    padding: 0 12px;
    font-family: var(--font);
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    line-height: 1;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    white-space: nowrap;
    cursor: pointer;
    box-sizing: border-box;
    transition: background 0.12s, color 0.12s, border-color 0.12s, transform 0.1s;
}

.btn-control:active,
.act:active,
.btn.btn-refresh:active,
.modal-content .btn:not(.btn-close):active {
    transform: translateY(1px);
}

.btn-control:focus-visible,
.act:focus-visible,
.btn.btn-refresh:focus-visible,
.modal-content .btn:not(.btn-close):focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.btn.btn-primary.btn-control,
.modal-content .btn.btn-primary:not(.btn-close) {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn.btn-primary.btn-control:hover,
.modal-content .btn.btn-primary:not(.btn-close):hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
}

.btn.btn-primary.btn-control:focus-visible,
.modal-content .btn.btn-primary:not(.btn-close):focus-visible {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.btn.btn-outline-primary.btn-refresh,
.btn.btn-outline-primary.btn-control {
    color: var(--primary);
    background: var(--primary-muted);
    border-color: var(--primary-soft);
}

.btn.btn-outline-primary.btn-refresh:hover,
.btn.btn-outline-primary.btn-control:hover {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

.btn.btn-outline-secondary.btn-control,
.modal-content .btn.btn-outline-secondary:not(.btn-close) {
    color: var(--text-muted);
    background: var(--surface-muted);
    border-color: var(--border);
}

.btn.btn-outline-secondary.btn-control:hover,
.modal-content .btn.btn-outline-secondary:not(.btn-close):hover {
    color: var(--text);
    background: #fff;
    border-color: var(--act-border);
}

.chevron-sm {
    font-size: var(--fs-xs);
    opacity: 0.45;
}

.modal-subtitle {
    font-size: var(--fs-sm);
    color: var(--text-muted);
    margin: 0;
    line-height: var(--lh-normal);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.modal-subtitle strong {
    color: var(--text);
    font-weight: var(--fw-semibold);
    text-transform: capitalize;
}

.input-group-merge .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group-merge .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.font-monospace {
    font-family: ui-monospace, 'SF Mono', 'Cascadia Code', monospace;
    font-size: var(--fs-sm);
    letter-spacing: -0.01em;
}

/* ── Table - unified cell typography ── */
.table-responsive {
    max-height: none;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    font-size: var(--fs-base);
    line-height: var(--lh-normal);
    table-layout: auto;
    width: 100%;
    min-width: 950px;
    --bs-table-bg: transparent;
    --bs-table-hover-bg: #f8fafc;
    --bs-table-striped-bg: #fafbfc;
    margin-bottom: 0;
}

.data-table.table > :not(caption) > * > * {
    border-bottom-color: #f1f5f9;
    box-shadow: none;
}

.data-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.data-table thead th {
    padding: 10px 14px;
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: var(--label-spacing);
    line-height: var(--lh-tight);
    color: var(--text-muted);
    background: var(--surface-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    vertical-align: middle;
    text-align: left;
}

.data-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

.data-table tbody tr {
    transition: background 0.12s ease;
}

.data-table tbody tr:hover {
    background: #eef2f7 !important;
}

.data-table td {
    padding: 10px 14px;
    font-size: var(--fs-base);
    font-weight: var(--fw-normal);
    line-height: var(--lh-normal);
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text);
    text-align: left;
}

.col-member {
    width: auto;
    min-width: 160px;
    white-space: nowrap;
}

.data-table td.col-member,
.data-table th.col-member {
    overflow: visible;
    padding-left: 18px;
}

.data-table td.col-member .member-cell {
    min-width: max-content;
}

.data-table td.col-member .member-info {
    min-width: max-content;
    flex: 0 1 auto;
}
.col-flow { width: 50px; }
.col-port { width: 46px; }
.col-dev { width: 38px; }
.col-traffic { width: 88px; }
.col-total { width: 68px; }
.col-sisa { width: 76px; }
.col-status { width: 66px; }
.col-date { width: 94px; }

.data-table th.col-traffic,
.data-table td.col-traffic {
    white-space: nowrap;
}

.data-table th.col-total,
.data-table td.col-total {
    white-space: nowrap;
}

.data-table th.col-sisa,
.data-table td.col-sisa {
    white-space: nowrap;
}

.col-sisa .tag,
.col-sisa .cell-num {
    white-space: nowrap;
}

.col-actions { width: 236px; }

.col-total,
.cell-total {
    white-space: nowrap;
}

.data-table td.col-total .cell-total {
    color: var(--primary);
    font-weight: var(--fw-semibold);
}

.created-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    line-height: var(--lh-tight);
}

.created-cell .cell-meta {
    max-width: none;
    white-space: nowrap;
}

.created-time {
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
}

.data-table th.col-actions,
.data-table td.col-actions {
    white-space: nowrap;
    padding-right: 18px;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr.row-new {
    animation: rowFlash 0.6s ease;
}

@keyframes rowFlash {
    from { background: #eff6ff; }
    to { background: transparent; }
}

.table-empty td {
    padding: 48px 20px !important;
    text-align: center;
    white-space: normal;
}

.table-empty-inner {
    color: var(--text-muted);
}

.table-empty-inner i {
    font-size: 28px;
    opacity: 0.25;
    display: block;
    margin-bottom: 10px;
}

.table-empty-inner p {
    font-size: var(--fs-base);
    font-weight: var(--fw-medium);
    margin: 0 0 4px;
    color: var(--text);
}

.table-empty-inner span {
    font-size: var(--fs-sm);
}

/* Table cell roles */
.cell-text {
    font-size: var(--fs-base);
    font-weight: var(--fw-normal);
    color: var(--text);
}

.cell-meta {
    font-size: var(--fs-sm);
    font-weight: var(--fw-normal);
    color: var(--text-muted);
}

.cell-placeholder {
    color: var(--text-muted);
    opacity: 0.72;
}

.cell-num {
    font-size: var(--fs-base);
    font-weight: var(--fw-normal);
    font-variant-numeric: tabular-nums;
    color: var(--text);
}

.cell-strong {
    font-size: var(--fs-base);
    font-weight: var(--fw-semibold);
    font-variant-numeric: tabular-nums;
    color: var(--text);
}

.cell-muted {
    font-size: var(--fs-base);
    font-weight: var(--fw-normal);
    color: var(--text-muted);
}

.member-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.member-avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    color: var(--primary);
    background: var(--primary-muted);
    border: 1px solid var(--primary-soft);
    position: relative;
}

.member-avatar .status-dot {
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 11px;
    height: 11px;
    margin: 0;
    align-self: auto;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.member-info {
    flex: 1;
    line-height: var(--lh-tight);
    min-width: 0;
}

.member-name-row {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 4px;
    font-weight: 400;
}

.data-table td.col-member .member-name {
    font-size: var(--fs-base);
    font-weight: 400 !important;
    line-height: var(--lh-tight);
    color: var(--text);
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    max-width: none;
}

.member-name {
    font-size: var(--fs-base);
    font-weight: 400 !important;
    line-height: var(--lh-tight);
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.member-sub {
    display: block;
    font-size: var(--fs-sm);
    font-weight: var(--fw-normal);
    line-height: var(--lh-tight);
    color: var(--text-muted);
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    font-variant-numeric: tabular-nums;
}

.member-sub.is-empty {
    color: #94a3b8;
    font-style: italic;
}

.tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 20px;
    padding: 0 8px;
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    line-height: 1;
    border-radius: 5px;
    vertical-align: middle;
    letter-spacing: 0.01em;
    white-space: nowrap;
    box-sizing: border-box;
}

.status-dot {
    display: block;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.on {
    background: #16a34a;
}

.status-dot.off { background: #94a3b8; }

.tag-vvip { color: var(--gold); background: var(--gold-soft); border: 1px solid var(--gold-border); }
.tag-pro { color: var(--purple); background: var(--purple-soft); border: 1px solid var(--purple-border); }
.tag-std { color: var(--text-muted); background: var(--surface-muted); border: 1px solid var(--border); }

.tag-flow-tcp {
    color: #fff;
    background: var(--primary);
    border: none;
    margin-left: 0;
}

.tag-flow-udp {
    color: #fff;
    background: var(--purple);
    border: none;
    margin-left: 0;
}

.tag-expired {
    color: #fff;
    background: var(--danger);
    border: none;
}

.tag-active {
    color: #fff;
    background: var(--success);
    border: none;
    margin-left: 0;
}

.tag-lifetime {
    color: var(--gold);
    background: var(--gold-soft);
    border: 1px solid var(--gold-border);
    margin-left: 0;
}

.port-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 20px;
    padding: 0 8px;
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    background: #dde4ed;
    border-radius: 5px;
    vertical-align: middle;
    letter-spacing: 0.01em;
    white-space: nowrap;
    box-sizing: border-box;
}

.traffic-cell {
    font-size: var(--fs-base);
    font-weight: var(--fw-normal);
    font-variant-numeric: tabular-nums;
    line-height: var(--lh-tight);
}

.traffic-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.traffic-stack span {
    white-space: nowrap;
}

.traffic-cell i {
    font-size: 9px;
    margin-right: 3px;
    opacity: 0.85;
}

.traffic-down { color: var(--danger); }
.traffic-up { color: var(--success); }

.traffic-cell.is-zero .traffic-down,
.traffic-cell.is-zero .traffic-up {
    color: var(--text-muted);
}

.actions {
    display: inline-flex;
    gap: 4px;
    justify-content: flex-start;
    flex-wrap: nowrap;
    min-width: max-content;
}


.act-qr,
.act-edit,
.act-del {
    border-width: 1px;
    border-style: solid;
}

.act-qr {
    color: var(--primary);
    background: var(--primary-muted);
    border-color: var(--primary-soft);
}

.act-qr:hover {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

.act-edit {
    color: var(--primary-hover);
    background: var(--primary-soft);
    border-color: var(--primary-soft);
}

.act-edit:hover {
    color: #fff;
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.act-link {
    color: var(--act-link);
    background: var(--act-link-soft);
    border-color: var(--act-link-border);
}

.act-link:hover {
    color: #fff;
    background: var(--act-link-hover);
    border-color: var(--act-link);
}

.act-del {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: var(--danger-border);
}

.act-del:hover {
    color: #fff;
    background: var(--danger);
    border-color: var(--danger);
}

/* Toast copy feedback */
.copy-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    color: #fff;
    background: #0f172a;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    animation: toastIn 0.2s ease, toastOut 0.2s ease 1.8s forwards;
}

.copy-toast.is-error {
    background: var(--danger);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
    to { opacity: 0; transform: translateY(4px); }
}

.main-footer {
    padding: 14px 20px;
    font-size: var(--fs-sm);
    font-weight: var(--fw-normal);
    line-height: var(--lh-tight);
    color: var(--text-muted);
    background: var(--surface);
    border-top: 1px solid var(--border);
}

/* ── Modal ── */
.modal-content {
    border: 1px solid var(--border);
    border-radius: 0;
    box-shadow: var(--shadow-md);
    font-size: var(--fs-base);
}

.modal-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
    line-height: var(--lh-tight);
}

.modal-body {
    padding: 14px 18px 18px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid var(--border);
}

.modal-content .btn.is-loading {
    opacity: 0.7;
    pointer-events: none;
}

.modal-body .text-muted {
    font-size: var(--fs-sm) !important;
    line-height: var(--lh-normal);
}

.modal-body .form-control,
.modal-body .form-select {
    font-size: var(--fs-sm);
    height: var(--control-h);
}

.edit-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.edit-form-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    padding-top: 4px;
}

.edit-modal-footer {
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    gap: 8px;
}


.qr-modal-dialog {
    max-width: 380px;
}

.qr-modal-body {
    text-align: center;
}

.qr-member-name {
    margin: 0 0 12px;
    font-size: var(--fs-base);
    font-weight: var(--fw-semibold);
    color: var(--text);
    line-height: var(--lh-tight);
    word-break: break-word;
}

.qr-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0;
    line-height: 0;
}

.qr-box canvas,
.qr-box img {
    display: block;
    width: 220px !important;
    height: 220px !important;
}

.qr-links {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    text-align: left;
}

.extend-modal-dialog {
    max-width: 400px;
}

.extend-member-name {
    margin: 0 0 4px;
    font-size: var(--fs-base);
    font-weight: var(--fw-semibold);
    color: var(--text);
    line-height: var(--lh-tight);
    word-break: break-word;
}

.extend-member-meta {
    margin: 0;
}

.extend-hint {
    line-height: var(--lh-normal);
}

@media (max-width: 1200px) {
    .form-row-main { grid-template-columns: 1fr 1fr; gap: 10px; }
    .form-row-options { gap: 12px 16px; }
    .segment-btn { padding: 6px 11px; }
}
.dropdown-menu {
    font-size: var(--fs-base);
}

.dropdown-item {
    font-size: var(--fs-base);
    font-weight: var(--fw-normal);
    padding: 8px 14px;
}

.table-responsive .data-table {
    margin-bottom: 0;
}

/* ── Mobile ── */
@media (min-width: 576px) {
    .user-name { display: inline; }
}

@media (max-width: 991.98px) {
    .form-shell { flex-direction: column; }
    .form-row-main { grid-template-columns: 1fr; }
    .field-masa { grid-column: auto; }
    .form-action {
        width: 100%;
        padding-top: 0;
    }
    .btn-add {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .container-fluid {
        padding-left: 14px;
        padding-right: 14px;
    }

    .content {
        padding: 14px 0 22px;
    }

    .panel-card-header {
        padding: 12px 14px;
    }

    .panel-card-body {
        padding: 14px;
    }

    .panel-card-header--toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .panel-card-header--toolbar h2 {
        width: 100%;
    }

    .form-shell,
    .form-main {
        min-width: 0;
        max-width: 100%;
        width: 100%;
    }

    .form-row-main {
        display: grid;
        grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
        gap: 10px;
        width: 100%;
        max-width: 100%;
    }

    .form-row-main .field-name {
        grid-column: 1 / -1;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .form-row-main .field-name .form-control {
        width: 100%;
        max-width: 100%;
        display: block;
    }

    .form-row-main .field-hp {
        grid-column: 1;
        width: 100%;
        min-width: 0;
    }

    .form-row-main .field-masa {
        grid-column: 2;
        width: 100%;
        min-width: 0;
    }

    .form-row-main .form-control,
    .form-row-main .form-select {
        width: 100%;
        max-width: 100%;
    }

    .form-row-options {
        display: flex;
        flex-wrap: nowrap;
        gap: 14px;
        align-items: center;
        justify-content: flex-start;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .form-row-options .option-item {
        flex: 0 0 auto;
        min-width: 0;
        gap: 6px;
    }

    .form-row-options .option-item--port {
        display: none;
    }

    .form-row-options .option-item--device {
        margin-left: 0;
    }

    .form-row-options .option-label {
        min-width: 0;
        flex-shrink: 0;
    }

    .form-row-options .segment-group {
        min-width: 0;
        max-width: 100%;
    }

    .form-row-options .segment-btn {
        padding: 6px 7px;
    }

    .form-row-options .option-item--device .segment-btn {
        width: 30px;
        height: 30px;
        min-width: 30px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        aspect-ratio: 1;
        line-height: 1;
    }
    .data-table thead th,
    .data-table td { padding: 10px 12px; }
    .data-table td.col-member,
    .data-table th.col-member { padding-left: 12px; }
    .data-table th.col-actions,
    .data-table td.col-actions { padding-right: 12px; }

    .table-pagination {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 14px;
    }

    .pagination-buttons {
        justify-content: center;
    }

    .actions {
        flex-wrap: wrap;
        row-gap: 4px;
        max-width: 148px;
    }

    .topbar-inner {
        flex-wrap: nowrap;
        align-items: center;
        height: var(--header-h);
        min-height: var(--header-h);
        padding: 0 14px;
        gap: 10px;
    }

    .topbar-right {
        width: auto;
        flex-direction: row;
        align-items: center;
        margin-left: auto;
        gap: 0;
    }

    .topbar-stats,
    .xray-pill,
    .live-pill {
        display: none !important;
    }

    .topbar-actions {
        display: flex;
        width: auto;
        gap: 0;
        justify-content: flex-end;
    }

    .topbar-actions .dropdown {
        flex: 0 0 auto;
        min-width: 0;
    }

    .user-menu {
        width: auto;
        justify-content: flex-end;
    }

    .brand-text { font-size: var(--fs-base); }

    .search-box {
        min-width: 0;
        flex: 1;
    }

    .table-toolbar {
        width: 100%;
    }

    .btn-refresh {
        flex-shrink: 0;
    }

    .modal-dialog {
        margin: 0.75rem;
    }

    .qr-modal-dialog,
    .extend-modal-dialog {
        max-width: none;
    }

    .main-footer {
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 12px 14px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .topbar-stat i,
    .live-pill .live-dot {
        display: none;
    }

    .xray-pill .xray-dot {
        flex-shrink: 0;
    }

    .login-layout {
        max-width: none;
    }

    .login-aside__title {
        font-size: var(--fs-md);
    }

    .profile-info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

/* ── Login & Password Pages ── */

.login-wrapper .content-wrapper,
.wrapper > .content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.login-content {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 28px 0 32px;
}

.login-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 400px);
    gap: 20px;
    align-items: stretch;
    width: 100%;
}

.login-layout--single {
    grid-template-columns: minmax(320px, 420px);
    justify-content: center;
}

.login-aside {
    margin: 0;
    background: linear-gradient(160deg, var(--primary-muted) 0%, var(--surface) 55%);
}

.login-aside__body {
    padding: 36px 32px;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-aside__icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius);
    font-size: 22px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
}

.login-aside__title {
    font-size: var(--fs-lg);
    font-weight: var(--fw-bold);
    line-height: var(--lh-tight);
    color: var(--text);
    margin: 0 0 10px;
}

.login-aside__text {
    font-size: var(--fs-base);
    line-height: var(--lh-normal);
    color: var(--text-muted);
    margin: 0 0 24px;
    max-width: 36ch;
}

.login-aside__pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.login-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px;
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    color: var(--primary);
    background: var(--surface);
    border: 1px solid var(--primary-soft);
    border-radius: 999px;
}

.login-pill i {
    font-size: 11px;
}

.login-card {
    margin: 0;
    align-self: center;
}

.login-card__lead {
    font-size: var(--fs-sm);
    color: var(--text-muted);
    margin: 0 0 18px;
    line-height: var(--lh-normal);
}

.login-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: var(--fs-sm);
    margin-bottom: 16px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
}

.login-form .field {
    margin-bottom: 14px;
}

.login-form__remember {
    margin-bottom: 18px;
}

.login-form__remember .form-check-label {
    font-size: var(--fs-sm);
    color: var(--text-muted);
}

.login-form__submit {
    min-height: 46px;
    font-weight: var(--fw-semibold);
    font-size: var(--fs-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-save-password {
    height: 42px;
    min-height: 42px;
    font-size: var(--fs-md);
    gap: 8px;
}

.btn-save-password i {
    font-size: 14px;
}

@media (max-width: 991px) {
    .login-layout {
        grid-template-columns: 1fr;
        max-width: 480px;
        margin: 0 auto;
    }

    .login-aside__body {
        padding: 24px 22px;
    }

    .login-aside__text {
        max-width: none;
    }

    .login-layout--single {
        max-width: 480px;
    }
}

@media (max-width: 576px) {
    .login-content {
        padding: 16px 0 24px;
    }

    .login-aside__body {
        padding: 20px 16px;
    }

    .login-aside__pills {
        gap: 6px;
    }

    .login-pill {
        font-size: var(--fs-xs);
        padding: 6px 10px;
    }

    .login-form__submit {
        min-height: var(--control-h);
        font-size: var(--fs-sm);
    }
}

/* ── Toolbar, status, pagination ── */
.panel-card-header--toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.table-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-box {
    position: relative;
    min-width: 220px;
}

.search-box i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: var(--fs-sm);
    pointer-events: none;
}

.search-box .form-control {
    padding-left: 32px;
    height: var(--control-h);
    font-size: var(--fs-sm);
}

.btn-refresh.is-loading i {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.xray-pill {
    background: var(--surface-muted);
    border-color: var(--border);
    color: var(--text-muted);
}

.xray-pill.is-online {
    background: var(--success-soft);
    border-color: var(--success-border);
    color: var(--success);
}

.xray-pill.is-offline {
    background: var(--danger-soft);
    border-color: var(--danger-border);
    color: var(--danger);
}

.xray-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
}

.xray-dot.off {
    background: var(--danger);
}

.table-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--surface-subtle);
}

.pagination-info {
    font-size: var(--fs-sm);
    color: var(--text-muted);
}

.pagination-buttons {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: var(--fs-sm);
    color: var(--text-muted);
    cursor: pointer;
}

.page-btn.is-active,
.page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-muted);
}

.tag-expiring {
    background: var(--gold-soft);
    border: 1px solid var(--gold-border);
    color: var(--gold);
}

.row-expiring {
    background: #fffbeb;
}

.panel-grid-bottom {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

@media (max-width: 768px) {
    .panel-grid-bottom {
        display: none;
    }
}

.activity-log-body,
.backup-list-body {
    max-height: 220px;
    overflow-y: auto;
}

.activity-item,
.backup-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.activity-item:last-child,
.backup-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.activity-desc,
.backup-name {
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
}

.activity-meta,
.backup-meta {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    margin-top: 2px;
}

.profile-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: var(--fs-sm);
}

.profile-info-row:last-child {
    border-bottom: none;
}

.profile-section-title {
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
    margin-bottom: 8px;
}

.two-factor-qr svg {
    max-width: 180px;
    height: auto;
}

.two-factor-recovery-list {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
    display: grid;
    gap: 8px;
}

.two-factor-recovery-list code {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    font-size: 0.95rem;
    letter-spacing: 0.04em;
}
