:root {
    --font-family: "Bricolage Grotesque", sans-serif;
    --primary: #4770FF;
    --black: #1A1F2C;
    --light-black: #576076;
    --text-main: #1A1F2C;
    --white: #ffffff;
    --bg-body: #F0F2F5;
    --paragraph: #616670;
    --border: #DBDFE5;

    --status-paid-bg: #d1fae5;
    --status-paid-text: #065f46;
    --status-unpaid-bg: #fee2e2;
    --status-unpaid-text: #991b1b;

    --font-size: 12px;
    --transition: all 0.15s ease-out;
    --radius-sm: 5px;
    --radius-md: 8px;
    --radius-lg: 11px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 3px 6px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-body);
    color: var(--text-main);
    font-size: var(--font-size);
    line-height: 1.5;
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* Mobile Block */
.mobile-block {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #1A1F2C 0%, #4770FF 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 20px;
    text-align: center;
}

.mobile-block-content h2 {
    font-size: 20px;
    margin: 16px 0 12px;
}

.mobile-block-content p {
    font-size: 13px;
    opacity: 0.9;
    margin: 6px 0;
}

/* Splash & Login */
#splash-screen,
#login-screen {
    position: fixed;
    inset: 0;
    background: var(--white);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.splash-content {
    text-align: center;
}

.splash-icon {
    font-size: 48px;
    color: var(--primary);
}

.loader-line {
    height: 3px;
    background: #eee;
    width: 80px;
    margin: 16px auto;
    border-radius: 2px;
    overflow: hidden;
}

.loader-line::after {
    content: '';
    display: block;
    width: 40%;
    height: 100%;
    background: var(--primary);
    animation: load 1s infinite;
}

@keyframes load {
    0% {
        margin-left: -40%;
    }

    100% {
        margin-left: 100%;
    }
}

.login-card {
    text-align: center;
    padding: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--white);
    box-shadow: var(--shadow-lg);
    max-width: 320px;
}

.login-card h2 {
    font-size: 18px;
    margin-bottom: 6px;
}

.login-subtitle {
    font-size: 12px;
    color: var(--paragraph);
}

.auth-btn-large {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 11px;
    margin-top: 20px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-family);
}

.auth-btn-large:hover {
    background: #f8fafc;
    border-color: var(--light-black);
}

.auth-btn-primary {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
    font-weight: 600;
}

.auth-btn-primary:hover {
    background: #3d5fe6 !important;
    border-color: #3d5fe6 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(71, 112, 255, 0.2);
}

.auth-btn-primary img {
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 360px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

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

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

.btn-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--light-black);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.btn-close:hover {
    background: #f1f5f9;
}

.modal-body {
    padding: 12px 16px;
}

.settings-section {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.section-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--light-black);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.account-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f8fafc;
    border-radius: var(--radius-md);
}

.account-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.account-name {
    font-weight: 600;
    font-size: 13px;
}

.account-email {
    font-size: 11px;
    color: var(--paragraph);
}

.settings-action-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: var(--transition);
    font-family: var(--font-family);
}

.settings-action-btn:hover {
    background: #f1f5f9;
}

.settings-action-btn.danger {
    color: var(--status-unpaid-text);
}

.settings-action-btn.danger:hover {
    background: var(--status-unpaid-bg);
}

.settings-action-btn .material-symbols-rounded {
    font-size: 18px;
}

.settings-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    color: var(--text-main);
    text-decoration: none;
    font-size: 12px;
    transition: var(--transition);
}

.settings-link:hover {
    color: var(--primary);
}

.settings-link .material-symbols-rounded {
    font-size: 16px;
    color: var(--light-black);
}

.developer-emails {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.developer-emails a {
    color: var(--primary);
    font-size: 11px;
    text-decoration: none;
}

.developer-emails a:hover {
    text-decoration: underline;
}

/* App Container */
.app-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 16px;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border);
}

.header-left h1 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.5px;
    margin-bottom: 2px;
}

.header-subtitle {
    font-size: 11px;
    color: var(--light-black);
}

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

.sync-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    color: var(--light-black);
}

.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Buttons */
.btn-icon {
    background: var(--white);
    border: 1px solid var(--border);
    color: var(--light-black);
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon .material-symbols-rounded {
    font-size: 18px;
}

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

/* Controls */
.controls-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.date-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-nav {
    background: var(--white);
    border: 1px solid var(--border);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--black);
}

.btn-nav .material-symbols-rounded {
    font-size: 18px;
}

.btn-nav:hover {
    background: #f8fafc;
    border-color: var(--light-black);
}

.date-display-main {
    background: var(--white);
    border: 1px solid var(--border);
    padding: 7px 14px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 12px;
    min-width: 140px;
    text-align: center;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
}

.date-display-main:hover {
    border-color: var(--primary);
}

.date-display-main input {
    position: absolute;
    opacity: 0;
    inset: 0;
    cursor: pointer;
}

.filter-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-box {
    position: relative;
}

.search-box input {
    padding: 7px 10px 7px 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 11px;
    outline: none;
    background: var(--white);
    width: 160px;
    height: 32px;
}

.search-box input:focus {
    border-color: var(--primary);
}

.search-box .material-symbols-rounded {
    position: absolute;
    left: 9px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: var(--light-black);
}

select {
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 11px;
    outline: none;
    background: var(--white);
    cursor: pointer;
    height: 32px;
}

select:focus {
    border-color: var(--primary);
}

/* Customer Card */
.customers-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.customer-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.customer-card:hover {
    box-shadow: var(--shadow-md);
}

.customer-card.collapsed .items-table,
.customer-card.collapsed .customer-total {
    display: none;
}

.customer-card.locked {
    opacity: 0.8;
}

.customer-header {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.customer-name-input {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    border: none;
    background: transparent;
    outline: none;
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.customer-name-input:hover:not(:disabled) {
    background: rgba(71, 112, 255, 0.05);
}

.customer-name-input:focus {
    background: rgba(71, 112, 255, 0.08);
}

.customer-name-input:disabled {
    color: var(--light-black);
}

.customer-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.customer-toggle-icon {
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    user-select: none;
    font-size: 18px;
}

.customer-toggle-icon:hover {
    background: rgba(71, 112, 255, 0.1);
}

.btn-status {
    padding: 4px 11px;
    border-radius: 12px;
    border: none;
    font-size: 9px;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-status.paid {
    background: var(--status-paid-bg);
    color: var(--status-paid-text);
}

.btn-status.unpaid {
    background: var(--status-unpaid-bg);
    color: var(--status-unpaid-text);
}

.btn-status:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-lock,
.btn-delete {
    font-size: 14px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-lock:hover {
    background: #f8fafc;
}

.btn-delete {
    color: var(--status-unpaid-text);
}

.btn-delete .material-symbols-rounded {
    font-size: 14px;
}

.btn-delete:hover {
    background: var(--status-unpaid-bg);
}

/* Items Table */
.items-table {
    width: 100%;
}

.items-header {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) 70px 90px 90px 30px;
    gap: 8px;
    padding: 10px 14px;
    background: #fafbfc;
    font-size: 9px;
    font-weight: 600;
    color: var(--light-black);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-right: 1px solid var(--border);
}

.items-header>div:nth-child(2),
.items-header>div:nth-child(3) {
    text-align: center;
}

.items-header>div {
    border-right: 1px solid var(--border);
    padding-right: 8px;
}

.items-header>div:last-child {
    border-right: none;
}

.item-row {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) 70px 90px 90px 30px;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid #f1f5f9;
    align-items: center;
}

.item-row>* {
    border-right: 1px solid #f1f5f9;
    padding-right: 8px;
}

.item-row>*:last-child {
    border-right: none;
}

.item-row:hover {
    background: #fafbfc;
}

.item-input {
    border: none;
    background: transparent;
    outline: none;
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-family: inherit;
    transition: var(--transition);
}

/* Bullet point for first column (Items) */
.item-desc-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.item-desc-wrapper::before {
    content: '•';
    color: var(--primary);
    font-size: 16px;
    font-weight: bold;
    margin-right: 8px;
    flex-shrink: 0;
}

.item-input:hover:not(:disabled) {
    background: #f1f5f9;
}

.item-input:focus {
    background: #e0e7ff;
}

.item-input:disabled {
    color: var(--light-black);
}

.item-input.qty,
.item-input.price {
    text-align: center;
    font-weight: 500;
}

.item-total {
    font-weight: 600;
    text-align: right;
    font-size: 11px;
}

.btn-delete-item {
    background: transparent;
    border: none;
    color: var(--light-black);
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    transition: var(--transition);
}

.btn-delete-item .material-symbols-rounded {
    font-size: 14px;
}

.btn-delete-item:hover {
    background: var(--status-unpaid-bg);
    color: var(--status-unpaid-text);
}

.btn-delete-item:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.add-item-row {
    padding: 10px 14px;
    border-top: 1px dashed var(--border);
}

.btn-add-item {
    background: transparent;
    border: 1px dashed var(--border);
    color: var(--light-black);
    padding: 7px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    width: 100%;
    justify-content: center;
    font-family: var(--font-family);
    transition: var(--transition);
}

.btn-add-item .material-symbols-rounded {
    font-size: 14px;
}

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

/* Customer Total */
.customer-total {
    background: #fafbfc;
    padding: 12px 14px;
    border-top: 2px solid var(--border);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

.customer-total-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--light-black);
    text-transform: uppercase;
}

.customer-total-amount {
    font-size: 14px;
    font-weight: 700;
}

/* Add Customer */
.btn-add-customer {
    background: linear-gradient(135deg, var(--primary) 0%, #3d5fe6 100%);
    border: none;
    color: white;
    padding: 16px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    font-family: var(--font-family);
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(71, 112, 255, 0.3);
}

.btn-add-customer .material-symbols-rounded {
    font-size: 20px;
}

.btn-add-customer:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(71, 112, 255, 0.4);
}

/* Grand Total */
.grand-total-section {
    margin-top: 20px;
}

.grand-totals-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.grand-total-card {
    background: linear-gradient(135deg, var(--black) 0%, #2d3748 100%);
    color: white;
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.grand-total-card.paid {
    background: linear-gradient(135deg, #065f46 0%, #047857 100%);
}

.grand-total-card.unpaid {
    background: linear-gradient(135deg, #991b1b 0%, #b91c1c 100%);
}

.total-label {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px;
    opacity: 0.95;
}

.total-amount {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    padding: 6px;
    z-index: 10000;
    animation: contextFadeIn 0.15s ease-out;
}

@keyframes contextFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

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

.context-menu-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition);
    user-select: none;
}

.context-menu-item:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.context-menu-item .shortcut {
    font-size: 10px;
    color: var(--light-black);
    font-weight: 500;
    opacity: 0.7;
}

.context-menu-separator {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* Tablet (500-750px) */
@media (min-width: 500px) and (max-width: 750px) {
    .app-container {
        padding: 12px;
    }

    .header-left h1 {
        font-size: 18px;
    }

    .controls-section {
        flex-direction: column;
        align-items: stretch;
    }

    .date-controls {
        justify-content: center;
    }

    .filter-controls {
        justify-content: center;
    }

    .search-box input {
        width: 140px;
    }

    .items-header {
        grid-template-columns: 1fr 60px 80px 80px 28px;
        font-size: 8px;
        padding: 8px 10px;
    }

    .item-row {
        grid-template-columns: 1fr 60px 80px 80px 28px;
        padding: 8px 10px;
    }

    .item-input {
        font-size: 10px;
        padding: 4px 6px;
    }

    .customer-header {
        padding: 10px 12px;
    }

    .customer-name-input {
        font-size: 12px;
    }

    .grand-totals-split {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .total-amount {
        font-size: 26px;
    }
}

/* Small Tablets */
@media (max-width: 600px) and (min-width: 500px) {
    .header-right {
        gap: 6px;
    }

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

    .btn-icon .material-symbols-rounded {
        font-size: 16px;
    }
}