/* ========================================
   STAR CHIPS - BILLING SOFTWARE
   Design System & Global Styles
   ======================================== */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* CSS Custom Properties */
:root {
    /* Colors */
    --primary: #6C5CE7;
    --primary-light: #A29BFE;
    --primary-dark: #5A4BD1;
    --primary-glow: rgba(108, 92, 231, 0.3);

    --accent: #00CEC9;
    --accent-light: #55EFC4;
    --accent-dark: #00B894;

    --success: #00B894;
    --success-light: rgba(0, 184, 148, 0.15);
    --warning: #FDCB6E;
    --warning-light: rgba(253, 203, 110, 0.15);
    --danger: #FF6B6B;
    --danger-light: rgba(255, 107, 107, 0.15);
    --info: #74B9FF;
    --info-light: rgba(116, 185, 255, 0.15);

    /* Dark Theme */
    --bg-primary: #0F0E17;
    --bg-secondary: #1A1A2E;
    --bg-tertiary: #16213E;
    --bg-card: rgba(26, 26, 46, 0.8);
    --bg-card-hover: rgba(26, 26, 46, 0.95);
    --bg-input: rgba(22, 33, 62, 0.6);
    --bg-modal: rgba(15, 14, 23, 0.95);

    --text-primary: #FFFFFE;
    --text-secondary: #A7A9BE;
    --text-muted: #72757E;
    --text-dim: #4A4D56;

    --border-color: rgba(167, 169, 190, 0.12);
    --border-hover: rgba(167, 169, 190, 0.25);
    --border-focus: var(--primary);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px var(--primary-glow);

    /* Spacing */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 50px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --header-height: 64px;

    --bg-header: rgba(15, 14, 23, 0.6);
    --hover-overlay: rgba(255, 255, 255, 0.05);
    --hover-subtle: rgba(255, 255, 255, 0.04);
    --input-focus-bg: rgba(22, 33, 62, 0.8);
}

[data-theme="light"] {
    /* Colors - tweak primary for better contrast if needed, but keeping primary similar works */

    /* Light Theme */
    --bg-primary: #F0F4F8;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #F8FAFC;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: rgba(255, 255, 255, 1);
    --bg-input: #FFFFFF;
    --bg-modal: rgba(255, 255, 255, 0.98);

    --text-primary: #1E293B;
    --text-secondary: #475569;
    --text-muted: #64748B;
    --text-dim: #94A3B8;

    --border-color: rgba(148, 163, 184, 0.3);
    --border-hover: rgba(148, 163, 184, 0.6);
    --border-focus: var(--primary);

    --bg-header: rgba(255, 255, 255, 0.6);
    --hover-overlay: rgba(0, 0, 0, 0.05);
    --hover-subtle: rgba(0, 0, 0, 0.03);
    --input-focus-bg: #FFFFFF;
}

/* Reset */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Background gradient effect */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 20% 20%, rgba(108, 92, 231, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0, 206, 201, 0.05) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
}

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

a:hover {
    color: var(--primary);
}

img {
    max-width: 100%;
    display: block;
}

/* ========================================
   LAYOUT
   ======================================== */

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

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform var(--transition-normal), width var(--transition-normal);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    color: white;
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
}

.sidebar-brand h1 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.3px;
    background: linear-gradient(135deg, var(--text-primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-brand span {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
}

.nav-section {
    margin-bottom: 8px;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-dim);
    padding: 12px 14px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: pointer;
    position: relative;
    margin-bottom: 2px;
}

.nav-item:hover {
    background: rgba(108, 92, 231, 0.08);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.15), rgba(0, 206, 201, 0.08));
    color: var(--primary-light);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.nav-item svg,
.nav-item i {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-item.active svg,
.nav-item.active i {
    opacity: 1;
}

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 12px 14px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.sidebar-user:hover {
    background: var(--hover-subtle);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: white;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-info .name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info .role {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: capitalize;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition-normal);
    max-width: 100%;
    overflow-x: hidden;
}

.content-header {
    padding: 18px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 16px;
}

.content-header h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.content-header .breadcrumb {
    font-size: 12px;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.content-body {
    padding: 24px 28px;
}

/* Mobile toggle */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
}

.sidebar-toggle:hover {
    background: var(--hover-overlay);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    backdrop-filter: blur(4px);
}

/* ========================================
   CARDS
   ======================================== */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    transition: all var(--transition-normal);
}

.card:hover {
    border-color: var(--border-hover);
}

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.card-body {
    padding: 22px;
}

.card-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border-color);
}

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card.purple::before {
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
}

.stat-card.teal::before {
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
}

.stat-card.green::before {
    background: linear-gradient(90deg, var(--success), var(--accent-light));
}

.stat-card.orange::before {
    background: linear-gradient(90deg, #F39C12, var(--warning));
}

.stat-card.red::before {
    background: linear-gradient(90deg, var(--danger), #E17055);
}

.stat-card.blue::before {
    background: linear-gradient(90deg, var(--info), #A29BFE);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-hover);
}

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    font-size: 20px;
}

.stat-card.purple .stat-icon {
    background: rgba(108, 92, 231, 0.15);
    color: var(--primary-light);
}

.stat-card.teal .stat-icon {
    background: rgba(0, 206, 201, 0.15);
    color: var(--accent);
}

.stat-card.green .stat-icon {
    background: var(--success-light);
    color: var(--success);
}

.stat-card.orange .stat-icon {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-card.red .stat-icon {
    background: var(--danger-light);
    color: var(--danger);
}

.stat-card.blue .stat-icon {
    background: var(--info-light);
    color: var(--info);
}

.stat-card .stat-value {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.4;
}

.btn:active {
    transform: scale(0.97);
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 2px 12px var(--primary-glow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    box-shadow: 0 4px 20px var(--primary-glow);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, var(--success), var(--accent-dark));
    color: white;
}

.btn-success:hover {
    opacity: 0.9;
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #E17055);
    color: white;
}

.btn-danger:hover {
    opacity: 0.9;
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #F39C12);
    color: #1A1A2E;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary-light);
    background: rgba(108, 92, 231, 0.05);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 12px;
}

.btn-ghost:hover {
    background: var(--hover-overlay);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 14px 28px;
    font-size: 15px;
    border-radius: var(--radius-lg);
}

.btn-icon {
    padding: 8px;
    width: 36px;
    height: 36px;
}

.btn-icon.btn-sm {
    width: 30px;
    height: 30px;
    padding: 5px;
}

/* ========================================
   FORMS
   ======================================== */

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

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all var(--transition-fast);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--input-focus-bg);
}

.form-control::placeholder {
    color: var(--text-dim);
}

.form-control-sm {
    padding: 7px 12px;
    font-size: 13px;
}

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

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

.form-hint {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 4px;
}

.form-error {
    font-size: 12px;
    color: var(--danger);
    margin-top: 4px;
}

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

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

/* Checkbox */
.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-input);
    appearance: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.form-check input[type="checkbox"]:checked {
    background: var(--primary);
    border-color: var(--primary);
}

.form-check input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: 700;
}

.form-check label {
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

/* ========================================
   TABLE
   ======================================== */

.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.table thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    vertical-align: middle;
}

.table tbody tr {
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: rgba(108, 92, 231, 0.04);
}

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

.table .text-right {
    text-align: right;
}

.table .text-center {
    text-align: center;
}

/* ========================================
   BADGES
   ======================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-info {
    background: var(--info-light);
    color: var(--info);
}

.badge-purple {
    background: rgba(108, 92, 231, 0.15);
    color: var(--primary-light);
}

/* ========================================
   PAGINATION
   ======================================== */

.pagination-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    gap: 16px;
    flex-wrap: wrap;
}

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

.pagination {
    display: flex;
    gap: 4px;
    list-style: none;
}

.pagination .page-item .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    background: transparent;
    transition: all var(--transition-fast);
    cursor: pointer;
    text-decoration: none;
}

.pagination .page-item .page-link:hover {
    border-color: var(--primary);
    color: var(--primary-light);
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.pagination .page-item.disabled .page-link {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ========================================
   MODALS
   ======================================== */

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-backdrop.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    font-size: 20px;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ========================================
   ALERTS
   ======================================== */

.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.3s ease;
}

.alert-success {
    background: var(--success-light);
    border: 1px solid rgba(0, 184, 148, 0.3);
    color: var(--success);
}

.alert-danger {
    background: var(--danger-light);
    border: 1px solid rgba(255, 107, 107, 0.3);
    color: var(--danger);
}

.alert-warning {
    background: var(--warning-light);
    border: 1px solid rgba(253, 203, 110, 0.3);
    color: var(--warning);
}

.alert-info {
    background: var(--info-light);
    border: 1px solid rgba(116, 185, 255, 0.3);
    color: var(--info);
}

/* ========================================
   SEARCH BAR
   ======================================== */

.search-bar {
    position: relative;
    max-width: 360px;
}

.search-bar input {
    width: 100%;
    padding: 9px 14px 9px 38px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: all var(--transition-fast);
}

.search-bar input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-bar svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-dim);
    pointer-events: none;
}

/* ========================================
   EMPTY STATE
   ======================================== */

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--text-dim);
    margin: 0 auto 16px;
}

.empty-state h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ========================================
   UTILITIES
   ======================================== */

.text-primary {
    color: var(--primary-light) !important;
}

.text-success {
    color: var(--success) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.text-warning {
    color: var(--warning) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-right {
    text-align: right !important;
}

.text-center {
    text-align: center !important;
}

.text-bold {
    font-weight: 700 !important;
}

.mt-0 {
    margin-top: 0 !important;
}

.mt-1 {
    margin-top: 8px !important;
}

.mt-2 {
    margin-top: 16px !important;
}

.mt-3 {
    margin-top: 24px !important;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mb-1 {
    margin-bottom: 8px !important;
}

.mb-2 {
    margin-bottom: 16px !important;
}

.mb-3 {
    margin-bottom: 24px !important;
}

.d-flex {
    display: flex;
}

.align-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 {
    gap: 8px;
}

.gap-2 {
    gap: 16px;
}

.flex-wrap {
    flex-wrap: wrap;
}

.w-100 {
    width: 100% !important;
}

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Product Image */
.product-thumb {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    object-fit: cover;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
}

.product-thumb-placeholder {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: rgba(108, 92, 231, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-light);
    font-weight: 700;
    font-size: 14px;
    border: 1px solid var(--border-color);
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .sidebar-toggle {
        display: flex;
    }

    .main-content {
        margin-left: 0;
    }

    .content-header {
        padding: 10px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .mobile-hide {
        display: none !important;
    }

    .content-header h2 {
        font-size: 17px;
    }

    .content-body {
        padding: 12px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 16px;
    }

    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
    }

    .header-actions {
        gap: 6px;
    }

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

    .btn-lg {
        padding: 12px 20px;
        font-size: 14px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-card .stat-value {
        font-size: 20px;
    }

    .stat-card .stat-icon {
        width: 38px;
        height: 38px;
        margin-bottom: 10px;
    }

    .card-header {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }

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

    .card-footer {
        padding: 10px 16px;
    }

    .search-bar {
        max-width: 100%;
    }

    .card-header .search-bar {
        width: 100%;
        max-width: 100%;
    }

    .table {
        font-size: 12px;
    }

    .table thead th,
    .table tbody td {
        padding: 8px 10px;
    }

    .pagination-wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .billing-items-table th,
    .billing-items-table td {
        padding: 7px 6px;
        font-size: 12px;
    }

    .toast-container {
        top: auto;
        bottom: 16px;
        right: 12px;
        left: 12px;
    }

    .toast {
        max-width: 100%;
    }

    .modal-backdrop {
        padding: 12px;
    }

    .modal-body,
    .modal-header,
    .modal-footer {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .content-header h2 {
        font-size: 15px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-card .stat-value {
        font-size: 18px;
    }

    .stat-card .stat-icon {
        width: 32px;
        height: 32px;
        margin-bottom: 8px;
        font-size: 16px;
    }

    .card-body {
        padding: 12px;
    }

    .modal {
        margin: 8px;
        max-width: calc(100% - 16px);
    }

    .table {
        font-size: 11px;
    }

    .table thead th,
    .table tbody td {
        padding: 6px 8px;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .sidebar {
        width: 220px;
    }

    .main-content {
        margin-left: 220px;
    }

    .content-body {
        padding: 20px;
    }
}

/* ========================================
   RESPONSIVE GRID UTILITIES
   ======================================== */

.dashboard-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.dashboard-grid-2-1 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

/* Detail page responsive grids */
.detail-grid-2-1 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    align-items: start;
}

.detail-grid-1-380 {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
    align-items: start;
}

/* Quick stats 2x2 mini grid */
.quick-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 900px) {
    .dashboard-grid-2,
    .dashboard-grid-2-1,
    .detail-grid-2-1,
    .detail-grid-1-380 {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .quick-stats-grid {
        gap: 10px;
    }

    .quick-stats-grid > div {
        padding: 12px !important;
    }

    .quick-stats-grid > div > div:first-child {
        font-size: 22px !important;
    }
}

/* ========================================
   CHART PLACEHOLDER
   ======================================== */

.chart-container {
    height: 200px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 16px 0;
}

.chart-bar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.chart-bar {
    width: 100%;
    max-width: 36px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: linear-gradient(180deg, var(--primary), var(--primary-dark));
    transition: height var(--transition-slow);
    min-height: 4px;
    position: relative;
}

.chart-bar:hover {
    background: linear-gradient(180deg, var(--primary-light), var(--primary));
}

.chart-bar .chart-tooltip {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
}

.chart-bar:hover .chart-tooltip {
    opacity: 1;
}

.chart-label {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {

    .sidebar,
    .sidebar-overlay,
    .content-header,
    .no-print {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    body {
        background: white;
        color: black;
    }

    .card {
        background: white;
        border: 1px solid #ddd;
    }
}

/* ========================================
   LOGIN PAGE
   ======================================== */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 30%, rgba(108, 92, 231, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 70% 70%, rgba(0, 206, 201, 0.08) 0%, transparent 50%);
    animation: loginBg 20s ease-in-out infinite alternate;
}

@keyframes loginBg {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    100% {
        transform: translate(-5%, -5%) rotate(3deg);
    }
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 40px;
    position: relative;
    backdrop-filter: blur(20px);
    animation: slideUp 0.5s ease;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo .logo-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 28px;
    font-weight: 900;
    color: white;
    box-shadow: 0 0 30px var(--primary-glow);
}

.login-logo h2 {
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-logo p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

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

.login-card .btn-primary {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    margin-top: 8px;
}

/* ========================================
   BILLING PAGE SPECIFIC
   ======================================== */

.billing-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
    align-items: start;
}

.billing-items-table {
    width: 100%;
}

.billing-items-table th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.billing-items-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.billing-items-table .form-control {
    padding: 7px 10px;
    font-size: 13px;
}

.billing-summary {
    position: sticky;
    top: 80px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
}

.summary-row.total {
    border-top: 2px solid var(--border-color);
    margin-top: 8px;
    padding-top: 12px;
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
}

.summary-row .label {
    color: var(--text-muted);
}

.credit-info {
    background: var(--warning-light);
    border: 1px solid rgba(253, 203, 110, 0.2);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 16px;
}

.credit-info .credit-label {
    font-size: 11px;
    color: #f20e0e;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.credit-info .credit-amount {
    font-size: 20px;
    font-weight: 800;
    color: #f20e0e;
    margin-top: 2px;
}

/* Item remove button */
.item-remove {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.item-remove:hover {
    background: var(--danger-light);
    color: var(--danger);
}

/* Autocomplete dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    max-height: 250px;
    overflow-y: auto;
    z-index: 500;
    box-shadow: var(--shadow-lg);
    display: none;
}

.autocomplete-dropdown.active {
    display: block;
}

.autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background var(--transition-fast);
    font-size: 13px;
}

.autocomplete-item:hover {
    background: rgba(108, 92, 231, 0.08);
}

.autocomplete-item .item-name {
    font-weight: 500;
    color: var(--text-primary);
}

.autocomplete-item .item-detail {
    font-size: 11px;
    color: var(--text-muted);
}

.autocomplete-item .item-price {
    margin-left: auto;
    font-weight: 600;
    color: var(--accent);
}

@media (max-width: 900px) {
    .billing-layout {
        grid-template-columns: 1fr;
    }

    .billing-summary {
        position: static;
    }

    /* Billing table mobile fixes */
    .billing-items-table th,
    .billing-items-table td {
        padding: 8px 6px;
        font-size: 12px;
    }

    .billing-items-table th:first-child,
    .billing-items-table td:first-child {
        min-width: auto;
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .billing-items-table th:nth-child(2),
    .billing-items-table td:nth-child(2) {
        width: 50px;
    }

    .billing-items-table th:nth-child(3),
    .billing-items-table td:nth-child(3),
    .billing-items-table th:nth-child(4),
    .billing-items-table td:nth-child(4) {
        width: 60px;
    }

    .billing-items-table th:nth-child(5),
    .billing-items-table td:nth-child(5) {
        width: 70px;
    }

    .billing-items-table .form-control {
        padding: 5px 6px;
        font-size: 12px;
    }

    /* Custom price cell - stack vertically */
    .billing-items-table td:nth-child(4) > div {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .billing-items-table td:nth-child(4) .form-control {
        width: 100% !important;
    }

    /* Hide button text on mobile, show only icon */
    .card-header .btn span,
    .card-header .btn:not(.btn-icon) svg + * {
        display: none;
    }

    .card-header .btn {
        padding: 8px;
    }

    .card-header .btn svg {
        margin: 0;
    }
}

/* ========================================
   THERMAL PRINT
   ======================================== */

.thermal-print {
    width: 80mm;
    max-width: 80mm;
    margin: 0 auto;
    padding: 10px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #000;
    background: #fff;
}

.thermal-print .shop-name {
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 4px;
}

.thermal-print .divider {
    border: none;
    border-top: 1px dashed #000;
    margin: 6px 0;
}

.thermal-print table {
    width: 100%;
    border-collapse: collapse;
}

.thermal-print table th,
.thermal-print table td {
    padding: 2px 4px;
    font-size: 11px;
}

.thermal-print table th {
    border-bottom: 1px solid #000;
}

.thermal-print .total-section {
    margin-top: 8px;
    font-weight: bold;
}

/* Normal (A4) Print */
.a4-print {
    width: 210mm;
    max-width: 210mm;
    margin: 0 auto;
    padding: 30px;
    font-family: 'Inter', sans-serif;
    color: #1a1a2e;
    background: white;
}

.a4-print .invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid #6C5CE7;
}

.a4-print .company-info h1 {
    font-size: 28px;
    font-weight: 800;
    color: #6C5CE7;
}

.a4-print .invoice-details {
    text-align: right;
}

.a4-print .invoice-details h2 {
    font-size: 22px;
    color: #6C5CE7;
    margin-bottom: 8px;
}

.a4-print table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.a4-print table th {
    background: #6C5CE7;
    color: white;
    padding: 10px 14px;
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
}

.a4-print table td {
    padding: 10px 14px;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}

.a4-print table tr:nth-child(even) {
    background: #f8f9fa;
}

.a4-print .summary-section {
    display: flex;
    justify-content: flex-end;
}

.a4-print .summary-table {
    width: 280px;
}

.a4-print .summary-table td {
    padding: 6px 12px;
}

.a4-print .summary-table .total-row {
    font-size: 16px;
    font-weight: 800;
    color: #6C5CE7;
    border-top: 2px solid #6C5CE7;
}

/* WhatsApp share button */
.btn-whatsapp {
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: white;
}

.btn-whatsapp:hover {
    opacity: 0.9;
    color: white;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-dim);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Image upload */
.image-upload {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.image-upload:hover {
    border-color: var(--primary);
    background: rgba(108, 92, 231, 0.04);
}

.image-upload input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.image-upload .upload-icon {
    font-size: 32px;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.image-upload .upload-text {
    font-size: 13px;
    color: var(--text-muted);
}

.image-upload .upload-hint {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 4px;
}

.image-preview {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-lg);
    object-fit: cover;
    border: 2px solid var(--border-color);
    margin-top: 12px;
}

/* Filters bar */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.filters-bar .form-control {
    max-width: 180px;
}

.filters-bar .search-bar {
    flex: 1;
    min-width: 200px;
}

@media (max-width: 768px) {
    .filters-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 12px;
        gap: 8px;
    }

    .filters-bar form {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px;
    }

    .filters-bar .form-control,
    .filters-bar .search-bar,
    .filters-bar input,
    .filters-bar select {
        max-width: 100% !important;
        width: 100% !important;
    }

    .filters-bar .btn {
        width: 100%;
    }
}

/* Toast notification */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    animation: slideDown 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 360px;
    pointer-events: auto;
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--danger);
}

/* Loading spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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