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

:root {
    --bg: #dff3ff;
    --card: #ffffff;
    --text: #101828;
    --muted: #667085;
    --border: #e6eaf0;
    --primary: #315efb;
    --primary-dark: #264fdc;
    --danger: #b42318;
    --danger-bg: #fee4e2;
    --success: #027a48;
}

html, body {
    font-family: Tahoma, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

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

/* === Topbar === */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.topbar-inner {
    max-width: 720px;
    margin: 0 auto;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand { font-weight: 800; font-size: 17px; color: var(--primary); }
.logout-link { color: var(--muted); font-size: 14px; }

/* === Container === */
.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 18px;
}
.container.with-nav { padding-bottom: 90px; }

/* === Welcome === */
.welcome { margin-bottom: 18px; }
.welcome-name { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.welcome-sub { color: var(--muted); font-size: 14px; }

/* === Quick actions === */
.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 18px;
}
.quick-btn {
    padding: 18px;
    border-radius: 14px;
    background: var(--card);
    border: 1px solid var(--border);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 15px;
    color: var(--text);
    transition: transform 0.15s;
}
.quick-btn:active { transform: scale(0.97); }
.quick-btn.quick-work { background: linear-gradient(135deg, #315efb, #5580ff); color: white; border: none; }
.quick-btn.quick-pay { background: linear-gradient(135deg, #00b17c, #00c98c); color: white; border: none; }
.quick-icon { font-size: 22px; }

/* === Stat cards === */
.cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 22px;
}
.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
}
.stat-card.accent { border-top: 3px solid var(--primary); }
.stat-label { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.stat-value {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
    direction: rtl;
}

/* === Sections === */
.section { margin-top: 22px; }
.section-title { font-size: 16px; font-weight: 800; margin-bottom: 12px; }
.link-all { display: block; text-align: center; padding: 14px; color: var(--primary); font-weight: 700; }

/* === Lists === */
.list {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}
.list-row {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}
.list-row:last-child { border-bottom: none; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.list-sub { color: var(--muted); font-size: 13px; }
.list-side { text-align: left; }
.list-amount { font-weight: 800; font-size: 15px; direction: rtl; }
.list-amount.is-debtor { color: var(--danger); }
.amount-work { color: var(--primary); }
.amount-pay { color: var(--success); }
.badge-debtor {
    display: inline-block;
    margin-top: 4px;
    background: var(--danger-bg);
    color: var(--danger);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 700;
}

.type-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.type-dot.type-work { background: var(--primary); }
.type-dot.type-payment { background: var(--success); }

/* === Page header === */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    gap: 12px;
}
.page-title { font-size: 22px; font-weight: 800; }
.back-link { color: var(--muted); font-size: 14px; }
.btn-primary {
    background: var(--primary);
    color: white;
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    display: inline-block;
    text-align: center;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-full { width: 100%; padding: 15px; font-size: 16px; margin-top: 8px; }

/* === Form === */
.form { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.form label { display: block; margin-bottom: 6px; margin-top: 14px; font-size: 14px; color: #344054; font-weight: 700; }
.form label:first-of-type { margin-top: 0; }
.form input, .form select, .form textarea {
    width: 100%;
    padding: 13px;
    border: 1px solid #d6dce5;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    background: #fafbfc;
}
.form input:focus, .form select:focus, .form textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

/* === Errors === */
.error {
    background: var(--danger-bg);
    color: var(--danger);
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid #fecdca;
}

/* === Empty state === */
.empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}
.empty p { margin-bottom: 16px; }

/* === Login card === */
.login-container { max-width: 420px; margin: 0 auto; padding-top: 40px; }
.card {
    background: var(--card);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    border: 1px solid var(--border);
}
.card h1 { font-size: 22px; color: var(--text); margin-bottom: 8px; }
.card .sub { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.card label { display: block; margin-bottom: 6px; font-size: 14px; color: #344054; font-weight: 700; }
.card input {
    width: 100%; padding: 13px;
    border: 1px solid #d6dce5; border-radius: 10px;
    font-size: 15px; margin-bottom: 16px; font-family: inherit;
    background: #fafbfc;
}
.card input:focus { outline: none; border-color: var(--primary); background: white; }
.card button.primary {
    width: 100%; padding: 14px;
    background: var(--primary); color: white;
    border: none; border-radius: 10px;
    font-size: 16px; font-weight: 700;
    cursor: pointer; font-family: inherit;
    margin-top: 8px;
}

/* === Bottom nav (mobile) === */
.bottom-nav {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    background: white;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 8px 0 max(8px, env(safe-area-inset-bottom));
    z-index: 20;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 10px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    border-radius: 8px;
    min-width: 56px;
    transition: color 0.15s, background 0.15s;
}
.nav-item.active { color: var(--primary); background: #eaf0ff; }
.nav-item .icon { font-size: 20px; line-height: 1; }

/* === Desktop tweaks === */
@media (min-width: 720px) {
    .cards { grid-template-columns: repeat(3, 1fr); }
    .quick-actions { grid-template-columns: 1fr 1fr; }
}

/* Topbar actions */
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}
.topbar-link {
    color: #667085;
    font-size: 14px;
    text-decoration: none;
    font-weight: 600;
}
.topbar-link:hover {
    color: #315efb;
}

/* Success message */
.success {
    background: #d1fadf;
    color: #027a48;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid #a6f4c5;
}

/* Action buttons in list rows */
.list-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 8px;
}
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #f2f4f7;
    border: none;
    font-size: 16px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
    padding: 0;
}
.icon-btn:hover { background: #e6eaf0; }
.icon-btn.danger:hover { background: #fee4e2; }

/* Reports page */
.checkbox-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 10px;
    border: 1px solid #e6eaf0;
    max-height: 200px;
    overflow-y: auto;
}
.checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e6eaf0;
    cursor: pointer;
    font-size: 14px;
    margin: 0;
}
.checkbox-item input[type="checkbox"] {
    width: auto;
    margin: 0;
}
.checkbox-item span {
    font-weight: 600;
    color: #344054;
}
.form-actions {
    margin-top: 16px;
}
.form-actions button {
    width: 100%;
}
.report-actions {
    display: flex;
    gap: 10px;
    margin: 16px 0;
    flex-wrap: wrap;
}
.btn-secondary {
    padding: 10px 16px;
    background: #eef2f7;
    color: #344054;
    border: 1px solid #d6dce5;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}
.btn-secondary:hover {
    background: #e0e7ee;
}
.report-info {
    padding: 12px;
    background: #eaf0ff;
    border-radius: 10px;
    margin-bottom: 14px;
    font-size: 14px;
    color: #344054;
}
.report-header {
    background: #eef2f7;
    font-weight: 800;
    color: #344054;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 8px;
}
.report-header .list-main,
.report-header .list-amount {
    text-align: center;
    font-size: 13px;
}

/* Signup page (standalone) */
.signup-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

/* Admin panel */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}
@media (min-width: 720px) {
    .admin-stats { grid-template-columns: repeat(5, 1fr); }
}

.admin-user-list {
    display: grid;
    gap: 12px;
}
.admin-user-card {
    display: block;
    background: white;
    border: 1px solid #e6eaf0;
    border-radius: 14px;
    padding: 16px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.admin-user-card:hover {
    border-color: #315efb;
    box-shadow: 0 4px 12px rgba(49, 94, 251, 0.08);
}
.admin-user-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 10px;
}
.admin-user-name {
    font-weight: 800;
    font-size: 16px;
    color: #101828;
    margin-bottom: 2px;
}
.admin-user-username {
    color: #667085;
    font-size: 13px;
}
.admin-user-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
}
.badge-admin {
    background: #eaf0ff;
    color: #315efb;
}
.badge-inactive {
    background: #f2f4f7;
    color: #667085;
}
.badge-debtor {
    background: #fee4e2;
    color: #b42318;
}
.admin-user-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.admin-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.admin-stat-label {
    font-size: 11px;
    color: #667085;
}
.admin-stat-value {
    font-size: 13px;
    font-weight: 700;
    color: #101828;
}
.admin-stat-value.amount-work { color: #315efb; }
.admin-stat-value.amount-pay { color: #027a48; }
.admin-stat-value.is-debtor { color: #b42318; }

.admin-user-info {
    background: white;
    border: 1px solid #e6eaf0;
    border-radius: 14px;
    padding: 20px;
}
.admin-user-info-name {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 6px;
}
.admin-user-info-meta {
    color: #667085;
    font-size: 13px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Kind selector in forms */
.kind-selector {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}
.kind-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    background: #f9fafb;
    border: 2px solid #e6eaf0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    margin: 0;
    font-weight: 700;
    color: #344054;
}
.kind-option:hover {
    border-color: #d6dce5;
    background: #f2f4f7;
}
.kind-option input[type="radio"] {
    width: auto;
    margin: 0;
    accent-color: #315efb;
}
.kind-option:has(input[type="radio"]:checked) {
    border-color: #315efb;
    background: #eaf0ff;
    color: #315efb;
}

/* Color dots for consumable type */
.type-dot.type-consumable {
    background: #f79009;
}
.type-dot.type-payment-consumable {
    background: #f79009;
}

/* File input */
.file-input {
    padding: 10px;
    background: #f9fafb;
    border: 2px dashed #d6dce5;
    border-radius: 10px;
    font-size: 14px;
    width: 100%;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    color: #667085;
}
.file-input:hover {
    border-color: #315efb;
    background: #f2f6ff;
}
.file-input::file-selector-button {
    margin-left: 8px;
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    background: #315efb;
    color: white;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    font-size: 13px;
}

/* Current image preview */
.current-image {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: #f9fafb;
    border: 1px solid #e6eaf0;
    border-radius: 10px;
    margin-bottom: 10px;
}
.current-image img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e6eaf0;
}
.remove-image-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: #b42318;
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}
.remove-image-label input {
    width: auto;
    margin: 0;
    accent-color: #b42318;
}

/* Transaction thumbnail in list */
.transaction-image {
    margin-top: 8px;
}
.transaction-image img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e6eaf0;
    cursor: pointer;
    transition: transform 0.15s;
}
.transaction-image img:hover {
    transform: scale(1.1);
}

/* Consumable color */
.amount-consumable {
    color: #f79009;
}
.amount-payment-consumable {
    color: #f79009;
}

/* Clinic detail page */
.clinic-desc {
    color: #475467;
    font-size: 14px;
    background: white;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid #e6eaf0;
    margin-bottom: 16px;
    line-height: 1.8;
}

.clinic-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}
@media (max-width: 640px) {
    .clinic-stats { grid-template-columns: 1fr; }
}

.breakdown-box {
    background: white;
    border: 1px solid #e6eaf0;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 16px;
}
.breakdown-title {
    font-weight: 800;
    font-size: 14px;
    color: #344054;
    margin-bottom: 10px;
}
.breakdown-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
@media (min-width: 720px) {
    .breakdown-grid { grid-template-columns: repeat(4, 1fr); }
}
.breakdown-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px;
    background: #f9fafb;
    border-radius: 8px;
}
.breakdown-label {
    font-size: 12px;
    color: #667085;
}
.breakdown-value {
    font-size: 14px;
    font-weight: 800;
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 20px 0 12px;
}

/* Filter bar */
.filter-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0 10px;
    margin-bottom: 10px;
    -webkit-overflow-scrolling: touch;
}
.filter-btn {
    padding: 8px 14px;
    background: #f2f4f7;
    border: 1px solid #e6eaf0;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    color: #475467;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: all 0.15s;
}
.filter-btn:hover {
    background: #e6eaf0;
}
.filter-btn.active {
    background: #315efb;
    color: white;
    border-color: #315efb;
}

/* Ledger table */
.ledger-wrapper {
    background: white;
    border: 1px solid #e6eaf0;
    border-radius: 12px;
    overflow-x: auto;
}
.ledger-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 640px;
}
.ledger-table thead {
    background: #eef2f7;
}
.ledger-table th {
    padding: 10px 12px;
    text-align: right;
    font-weight: 800;
    color: #344054;
    font-size: 12px;
    white-space: nowrap;
}
.ledger-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eef1f5;
    vertical-align: middle;
}
.ledger-table tr:last-child td {
    border-bottom: none;
}
.ledger-table tr:hover td {
    background: #f9fafb;
}
.col-date { white-space: nowrap; color: #475467; font-size: 12px; }
.col-type { white-space: nowrap; }
.col-desc { max-width: 260px; word-break: break-word; color: #475467; font-size: 13px; }
.col-amount { white-space: nowrap; font-weight: 800; direction: rtl; text-align: center; }
.col-balance { white-space: nowrap; font-weight: 700; color: #344054; direction: rtl; text-align: center; }
.col-actions { white-space: nowrap; text-align: center; }
.col-actions .icon-btn {
    width: 30px;
    height: 30px;
    font-size: 13px;
}

.ledger-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
}
.ledger-badge.badge-work {
    background: #eaf0ff;
    color: #315efb;
}
.ledger-badge.badge-consumable {
    background: #fef0c7;
    color: #b54708;
}
.ledger-badge.badge-payment {
    background: #d1fadf;
    color: #027a48;
}
.ledger-badge.badge-payment-consumable {
    background: #ffead5;
    color: #b54708;
}

.ledger-thumb {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e6eaf0;
    vertical-align: middle;
    margin-right: 6px;
}
.ledger-img-link {
    display: inline-block;
    margin-right: 6px;
}

/* Clinic name as link */
.list-title-link {
    text-decoration: none;
    color: inherit;
}
.list-title-link:hover .list-title {
    color: #315efb;
}

/* Clinic quick links (reports page) */
.clinic-quick-section {
    background: white;
    border: 1px solid #e6eaf0;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 20px;
}
.clinic-links-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
@media (min-width: 720px) {
    .clinic-links-grid { grid-template-columns: repeat(3, 1fr); }
}
.clinic-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #f9fafb;
    border: 1px solid #e6eaf0;
    border-radius: 10px;
    text-decoration: none;
    color: #344054;
    font-weight: 700;
    font-size: 14px;
    transition: all 0.15s;
}
.clinic-link:hover {
    background: #eaf0ff;
    border-color: #315efb;
    color: #315efb;
}
.clinic-link-icon {
    font-size: 16px;
}

/* Breakdown table (clinic detail) */
.breakdown-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.breakdown-table tbody tr {
    border-bottom: 1px solid #eef1f5;
}
.breakdown-table tbody tr:last-child {
    border-bottom: none;
}
.breakdown-table td {
    padding: 10px 12px;
    vertical-align: middle;
}
.bt-label {
    text-align: right;
    color: #475467;
    font-weight: 600;
}
.bt-value {
    text-align: left;
    direction: rtl;
    font-weight: 800;
    font-size: 15px;
}
.bt-total {
    background: #f9fafb;
    border-top: 2px solid #e6eaf0;
    border-bottom: 2px solid #e6eaf0;
}
.bt-total .bt-label {
    font-weight: 800;
    color: #344054;
}
.bt-final {
    background: #eef4ff;
    border-radius: 0 0 8px 8px;
}
.bt-final .bt-label {
    font-weight: 800;
    color: #315efb;
}
.bt-final .bt-value {
    font-size: 17px;
}
.bt-final-debtor {
    background: #fef3f2;
}
.bt-final-debtor .bt-label {
    color: #b42318;
}

/* Hide old thumbnail in ledger */
.ledger-thumb {
    display: none;
}

/* Make 📷 button look like a button */
.icon-btn[title="مشاهده عکس"] {
    background: #eaf0ff;
}
.icon-btn[title="مشاهده عکس"]:hover {
    background: #d6e2ff;
}

/* Bulk payment info box */
.info-box {
    background: #f9fafb;
    border: 1px solid #e6eaf0;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #475467;
    line-height: 1.8;
}
.info-box-title {
    font-weight: 800;
    color: #344054;
    margin-bottom: 8px;
    font-size: 15px;
}
.sample-code {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 12px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    direction: ltr;
    text-align: left;
    overflow-x: auto;
    margin: 8px 0;
    white-space: pre;
}

/* Preview table */
.preview-table-wrapper {
    overflow-x: auto;
    background: white;
    border: 1px solid #e6eaf0;
    border-radius: 12px;
    margin-bottom: 16px;
}
.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 560px;
}
.preview-table thead {
    background: #eef2f7;
}
.preview-table th {
    padding: 10px 12px;
    text-align: right;
    font-weight: 800;
    color: #344054;
    font-size: 12px;
    white-space: nowrap;
}
.preview-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #eef1f5;
    vertical-align: middle;
}
.preview-table tr:last-child td {
    border-bottom: none;
}
.preview-table input[type="checkbox"] {
    width: auto;
    margin: 0;
    accent-color: #315efb;
    cursor: pointer;
}
.desc-input {
    width: 100%;
    padding: 6px 8px !important;
    font-size: 13px !important;
    margin: 0 !important;
}

/* Preview actions */
.preview-actions {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
}
.preview-actions .btn-secondary {
    padding: 12px 20px;
}
.preview-actions .btn-primary {
    padding: 12px 24px;
    font-size: 15px;
}

/* Editable cells in preview table */
.cell-input {
    width: 100%;
    padding: 8px 10px !important;
    font-size: 13px !important;
    margin: 0 !important;
    background: #f9fafb !important;
    border: 1px solid #d6dce5 !important;
    border-radius: 8px !important;
    font-family: inherit !important;
    color: #101828 !important;
    transition: border-color 0.15s, background 0.15s;
}
.cell-input:focus {
    outline: none !important;
    border-color: #315efb !important;
    background: white !important;
    box-shadow: 0 0 0 3px rgba(49, 94, 251, 0.1) !important;
}
.date-cell {
    direction: ltr;
    text-align: center;
    font-weight: 700;
    min-width: 110px;
}
.amount-cell {
    direction: ltr;
    text-align: right;
    font-weight: 700;
    min-width: 140px;
}
.desc-input {
    min-width: 180px;
}

/* ==========================================================
   Shamsi Date Picker (iOS style)
   ========================================================== */
.sp-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    direction: rtl;
    font-family: inherit;
}
.sp-overlay.open { display: block; }

.sp-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(16, 24, 40, 0.45);
    animation: spFade 0.2s ease;
}
@keyframes spFade { from { opacity: 0; } to { opacity: 1; } }

.sp-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.18);
    max-width: 480px;
    margin: 0 auto;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    animation: spSlide 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes spSlide {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

.sp-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #e6eaf0;
}
.sp-title {
    font-size: 15px;
    font-weight: 800;
    color: #101828;
}
.sp-btn {
    background: none;
    border: none;
    font-size: 15px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
}
.sp-cancel { color: #667085; }
.sp-cancel:hover { background: #f2f4f7; }
.sp-ok { color: #315efb; }
.sp-ok:hover { background: #eaf0ff; }

/* Wheels area */
.sp-wheels {
    position: relative;
    display: flex;
    height: 220px;
    overflow: hidden;
    background: #ffffff;
}

/* Center highlight bar */
.sp-wheels::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 14px;
    right: 14px;
    height: 40px;
    transform: translateY(-50%);
    background: #f2f6ff;
    border-radius: 10px;
    pointer-events: none;
    z-index: 0;
}

/* Top/bottom fade mask */
.sp-wheels::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(255,255,255,1) 0%,
        rgba(255,255,255,0.9) 18%,
        rgba(255,255,255,0) 42%,
        rgba(255,255,255,0) 58%,
        rgba(255,255,255,0.9) 82%,
        rgba(255,255,255,1) 100%
    );
    pointer-events: none;
    z-index: 3;
}

.sp-wheel {
    position: relative;
    z-index: 1;
    height: 100%;
    overflow: hidden;
    flex: 1;
}
.sp-wheel[data-role="day"]   { flex: 0.7; }
.sp-wheel[data-role="month"] { flex: 1.5; }
.sp-wheel[data-role="year"]  { flex: 1.1; }

.sp-list {
    height: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.sp-list::-webkit-scrollbar { display: none; }

.sp-spacer {
    height: 90px;
    pointer-events: none;
}

.sp-item {
    height: 40px;
    line-height: 40px;
    text-align: center;
    font-size: 19px;
    color: #98a2b3;
    scroll-snap-align: center;
    user-select: none;
    cursor: pointer;
    transition: color 0.15s, font-weight 0.15s;
    font-variant-numeric: tabular-nums;
}
.sp-item.center-active {
    color: #101828;
    font-weight: 800;
}

/* Readonly input cue */
input[data-shamsi-picker] {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='18' rx='2'/><line x1='16' y1='2' x2='16' y2='6'/><line x1='8' y1='2' x2='8' y2='6'/><line x1='3' y1='10' x2='21' y2='10'/></svg>");
    background-repeat: no-repeat;
    background-position: left 12px center;
    background-size: 18px;
    padding-left: 40px !important;
}
