:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --light: #f8fafc;
    --dark: #1e293b;
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --sidebar-width: 260px;
    --header-height: 64px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--gray-800);
    background-color: var(--gray-100);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.auth-box {
    background: var(--white);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 420px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo h1 {
    font-size: 24px;
    color: var(--primary);
    font-weight: 700;
}

.auth-logo p {
    color: var(--gray-500);
    margin-top: 5px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--gray-700);
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

.form-control.error {
    border-color: var(--danger);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    text-decoration: none;
    color: var(--white);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

.alert {
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--dark);
    color: var(--white);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--gray-700);
}

.sidebar-header h1 {
    font-size: 18px;
    font-weight: 700;
}

.sidebar-header span {
    font-size: 12px;
    color: var(--gray-400);
}

.sidebar-nav {
    padding: 15px 0;
}

.nav-section {
    padding: 0 15px;
    margin-bottom: 15px;
}

.nav-section-title {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--gray-500);
    padding: 10px 10px 5px;
    font-weight: 600;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    color: var(--gray-300);
    border-radius: 6px;
    margin: 2px 0;
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--gray-700);
    color: var(--white);
    text-decoration: none;
}

.nav-link.active {
    background: var(--primary);
    color: var(--white);
}

.nav-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

.header {
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--gray-100);
    border-radius: 8px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
}

.page-content {
    padding: 24px;
    flex: 1;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--gray-900);
}

.card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 24px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
}

.card-body {
    padding: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-label {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-card.primary {
    background: var(--primary);
    color: var(--white);
}

.stat-card.primary .stat-label,
.stat-card.primary .stat-value {
    color: var(--white);
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    font-size: 12px;
    text-transform: uppercase;
}

tr:hover {
    background: var(--gray-50);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-row.three {
    grid-template-columns: repeat(3, 1fr);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.text-muted {
    color: var(--gray-500);
}

.text-small {
    font-size: 12px;
}

.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

.tos-content {
    max-height: 400px;
    overflow-y: auto;
    padding: 20px;
    background: var(--gray-50);
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    margin-bottom: 20px;
}

.tos-content h1, .tos-content h2 {
    margin-top: 20px;
    margin-bottom: 10px;
}

.tos-content p {
    margin-bottom: 10px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    color: var(--gray-400);
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--gray-700);
}

/* Two-column form layout */
.form-grid.two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

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

.form-group.half {
    flex: 1;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group.half {
    flex: 1;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-200);
}

.input-group {
    display: flex;
    gap: 8px;
}

.input-group .form-control {
    flex: 1;
}

.phone-input {
    display: flex;
    gap: 8px;
}

.form-text {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 4px;
}

.required {
    color: var(--danger);
}

/* Toggle switches */
.toggle-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toggle-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
}

.toggle-item:last-child {
    border-bottom: none;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-300);
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--success);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Checkbox list */
.checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* Radio group */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* Tabs navigation */
.tabs-nav {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 24px;
    background: var(--white);
    padding: 0 20px;
    border-radius: 12px 12px 0 0;
}

.tab-link {
    padding: 14px 20px;
    color: var(--gray-600);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.tab-link:hover {
    color: var(--primary);
    text-decoration: none;
}

.tab-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Profile page layout */
.page-header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.page-header-left h1 {
    font-size: 24px;
    font-weight: 600;
}

.page-header-left .subtitle {
    color: var(--gray-500);
}

.page-header-right {
    display: flex;
    gap: 10px;
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 20px;
    text-transform: capitalize;
}

.status-badge.status-active { background: #dcfce7; color: #166534; }
.status-badge.status-pending { background: #fef3c7; color: #92400e; }
.status-badge.status-pending_kyc { background: #fef3c7; color: #92400e; }
.status-badge.status-suspended { background: #fee2e2; color: #991b1b; }
.status-badge.status-inactive { background: var(--gray-200); color: var(--gray-600); }
.status-badge.status-closed { background: var(--gray-300); color: var(--gray-700); }
.status-badge.status-paid { background: #dcfce7; color: #166534; }
.status-badge.status-unpaid { background: #fee2e2; color: #991b1b; }
.status-badge.status-draft { background: var(--gray-200); color: var(--gray-600); }
.status-badge.status-cancelled { background: var(--gray-300); color: var(--gray-700); }
.status-badge.status-refunded { background: #dbeafe; color: #1e40af; }
.status-badge.status-open { background: #dbeafe; color: #1e40af; }
.status-badge.status-answered { background: #dcfce7; color: #166534; }
.status-badge.status-customer-reply { background: #fef3c7; color: #92400e; }
.status-badge.status-on-hold { background: var(--gray-200); color: var(--gray-600); }
.status-badge.status-in-progress { background: #dbeafe; color: #1e40af; }

/* Profile grid (3-column) */
.profile-grid.three-column {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1fr;
    gap: 24px;
}

.profile-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Info list */
.info-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.info-item label {
    font-size: 12px;
    color: var(--gray-500);
    font-weight: 500;
}

.info-item span {
    color: var(--gray-800);
}

/* Stats in summary */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.stat-item {
    text-align: center;
    padding: 10px;
    background: var(--gray-50);
    border-radius: 8px;
}

.stat-item .stat-label {
    display: block;
    font-size: 11px;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.stat-item .stat-value {
    display: block;
    font-size: 20px;
    font-weight: 600;
}

.stat-item .stat-amount {
    display: block;
    font-size: 12px;
    color: var(--gray-600);
}

.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

/* Billing summary */
.billing-summary {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--gray-200);
}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
}

/* Quick actions */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

/* Service stats */
.service-stats {
    display: flex;
    flex-direction: column;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
}

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

/* Action list */
.action-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-link {
    display: block;
    padding: 8px 12px;
    background: var(--gray-50);
    border-radius: 6px;
    color: var(--gray-700);
    transition: all 0.2s;
    border: none;
    text-align: left;
    cursor: pointer;
    width: 100%;
    font-size: 14px;
}

.action-link:hover {
    background: var(--gray-100);
    text-decoration: none;
}

.action-link.text-danger {
    color: var(--danger);
}

.action-link.text-success {
    color: var(--success);
}

/* Inline form */
.inline-form {
    display: inline;
}

/* Card header link */
.card-header .header-link {
    font-size: 12px;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.card-actions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--gray-200);
}

/* Data table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.data-table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    font-size: 12px;
    text-transform: uppercase;
}

.data-table tr:hover {
    background: var(--gray-50);
}

.btn-xs {
    padding: 4px 8px;
    font-size: 11px;
}

/* Filter bar */
.filter-bar {
    margin-bottom: 20px;
    padding: 15px;
    background: var(--gray-50);
    border-radius: 8px;
}

.filter-form {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group label {
    font-size: 12px;
    color: var(--gray-600);
}

/* Bulk actions */
.bulk-actions {
    margin-top: 15px;
    padding: 15px;
    background: var(--gray-50);
    border-radius: 8px;
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Stats bar */
.stats-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 24px;
}

.stat-box {
    flex: 1;
    background: var(--white);
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-box .stat-label {
    display: block;
    font-size: 12px;
    color: var(--gray-500);
    margin-bottom: 5px;
}

.stat-box .stat-value {
    display: block;
    font-size: 24px;
    font-weight: 600;
    color: var(--gray-800);
}

/* Email list */
.email-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.email-list li {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
}

.email-list li:last-child {
    border-bottom: none;
}

.email-subject {
    color: var(--gray-800);
}

.email-date {
    font-size: 12px;
    color: var(--gray-500);
}

/* Alert error list */
.alert ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

@media (max-width: 1200px) {
    .profile-grid.three-column {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 992px) {
    .form-grid.two-column {
        grid-template-columns: 1fr;
    }
    
    .profile-grid.three-column {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .tabs-nav {
        overflow-x: auto;
        padding: 0 10px;
    }
    
    .tab-link {
        padding: 12px 15px;
        white-space: nowrap;
    }
    
    .stats-bar {
        flex-wrap: wrap;
    }
    
    .stat-box {
        flex: 1 1 45%;
    }
}
