:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #059669;
    --danger: #dc2626;
    --warning: #d97706;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 16px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 8px 30px rgba(15, 23, 42, 0.1);
    --space-xs: 6px;
    --space-sm: 10px;
    --space-md: 14px;
    --space-lg: 18px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Header */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
    gap: 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    font-size: 1.1rem;
}

.brand-logo {
    display: block;
    height: 40px;
    width: auto;
    object-fit: contain;
}

.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 1.2rem;
    cursor: pointer;
}

.main-nav {
    display: flex;
    gap: 8px;
}

.nav-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.main-nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--primary);
    background: var(--primary-light);
}

/* Main */
.main-content {
    flex: 1;
    padding: var(--space-md) 0 var(--space-lg);
}

.site-footer {
    padding: var(--space-sm) 0;
    border-top: 1px solid var(--border);
    background: var(--surface);
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

/* Alerts */
.alert {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius);
    margin-bottom: var(--space-md);
    font-size: 0.9rem;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: var(--space-md);
    overflow: hidden;
}

.card-header {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.card-header h2 {
    font-size: 0.98rem;
    font-weight: 600;
}

.card-body {
    padding: var(--space-md);
}

.form-section + .form-section {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border);
}

.form-section-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-sm);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

@media (min-width: 769px) {
    .form-grid-invoice-meta {
        grid-template-columns: repeat(4, 1fr);
    }
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

textarea.form-control {
    resize: vertical;
    min-height: 58px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.page-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
}

.calculations-layout {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    align-items: flex-start;
    justify-content: space-between;
}

.calculations-fields {
    flex: 1;
    min-width: 240px;
}

/* Items table */
.items-add-row {
    margin-top: var(--space-sm);
    display: flex;
    justify-content: flex-start;
}

.items-add-row .btn {
    width: 100%;
}

@media (min-width: 769px) {
    .items-add-row .btn {
        width: auto;
    }
}

.items-table-wrap {
    overflow-x: auto;
    margin: 0 -4px;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.items-table th,
.items-table td {
    padding: 6px 6px;
    text-align: right;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.items-table th {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    background: var(--bg);
}

.items-table .form-control {
    padding: 6px 8px;
    font-size: 0.85rem;
}

.items-table .row-total {
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
}

.btn-remove-row {
    background: #fee2e2;
    color: var(--danger);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-row:hover {
    background: #fecaca;
}

/* Totals */
.totals-box {
    background: var(--bg);
    border-radius: var(--radius);
    padding: var(--space-md);
    width: 320px;
    max-width: 100%;
    margin-right: auto;
    flex-shrink: 0;
    box-sizing: border-box;
}

.totals-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(10.5rem, 10.5rem);
    align-items: center;
    gap: var(--space-sm);
    padding: 6px 0;
    min-height: 34px;
    border-bottom: 1px dashed var(--border);
    font-size: 0.9rem;
}

.totals-row span:first-child {
    font-weight: 500;
    color: var(--text-muted);
}

.totals-row strong {
    text-align: left;
    font-size: 0.95rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.money-amount {
    display: inline-block;
    direction: rtl;
    unicode-bidi: isolate;
    white-space: nowrap;
}

.money-value {
    direction: ltr;
    unicode-bidi: embed;
}

.totals-row:last-child {
    border-bottom: none;
}

.totals-row.grand-total {
    padding-top: 8px;
    margin-top: 2px;
    border-top: 2px solid var(--primary);
    border-bottom: none;
}

.totals-row.grand-total span:first-child {
    color: var(--primary);
    font-weight: 700;
}

.totals-row.grand-total strong {
    color: var(--primary);
    font-weight: 700;
}

.amount-words {
    margin-top: var(--space-sm);
    padding: var(--space-sm) 12px;
    background: var(--primary-light);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--primary-dark);
    line-height: 1.6;
    min-height: 52px;
}

/* File input */
.file-input {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.file-input-native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.file-input-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border: 1.5px dashed var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.file-input-trigger:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.file-input.has-file .file-input-trigger {
    border-style: solid;
    border-color: rgba(37, 99, 235, 0.35);
    background: rgba(37, 99, 235, 0.04);
}

.file-input-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--bg);
    color: var(--primary);
    flex-shrink: 0;
}

.file-input-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.file-input-btn-text {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
}

.file-input-filename {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-input-filename.is-selected {
    color: var(--primary-dark);
    font-weight: 500;
}

.file-input-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.file-input-preview {
    margin-top: 2px;
}

.file-input-preview img {
    max-width: 120px;
    max-height: 72px;
    border-radius: 8px;
    border: 1px solid var(--border);
    object-fit: contain;
    background: #fff;
}

.backup-import-btn {
    margin-top: 12px;
}

/* Archive table */
.archive-search {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-bottom: var(--space-md);
}

.archive-search .form-control {
    flex: 1;
    min-width: 180px;
}

.archive-mobile-actions {
    display: contents;
}

.archive-quick-btn {
    display: none;
}

.archive-inv-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.archive-inv-icon {
    flex-shrink: 0;
    color: var(--primary);
    opacity: 0.85;
}

.archive-date-tag,
.archive-buyer-name,
.archive-amount-value {
    display: inline;
}

.data-table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}

.data-table th,
.data-table td {
    padding: 8px 10px;
    text-align: right;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
}

.data-table th {
    background: var(--bg);
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.data-table tr:hover td {
    background: #f8fafc;
}

.data-table .actions-dropdown {
    position: relative;
    display: inline-flex;
}

.data-table .actions-toggle {
    padding: 6px 10px;
    min-width: 34px;
}

.data-table .actions-toggle-icon {
    display: block;
}

.actions-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.data-table .actions-menu {
    display: none;
    position: fixed;
    z-index: 200;
    min-width: 155px;
    padding: 4px 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
}

.data-table .actions-dropdown.is-open .actions-menu {
    display: block;
}

.data-table .actions-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 14px;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    text-align: right;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.data-table .actions-menu-item:hover {
    background: var(--bg);
}

.data-table .actions-menu-item-success {
    color: var(--success);
}

.data-table .actions-menu-item-danger {
    color: var(--danger);
}

.data-table .actions-menu-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.8;
}

.empty-state {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 2.2rem;
    margin-bottom: 8px;
}

/* Invoice preview */
.invoice-preview {
    background: #fff;
    padding: var(--space-lg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-width: 800px;
    margin: 0 auto;
}

.invoice-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 2px solid var(--primary);
}

.invoice-preview-header .seller-logo img {
    max-width: 100px;
    max-height: 70px;
    object-fit: contain;
}

.invoice-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
}

.invoice-meta {
    text-align: left;
    font-size: 0.9rem;
}

.invoice-meta .labeled-field {
    justify-content: flex-end;
}

.invoice-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.party-box {
    background: var(--bg);
    padding: var(--space-sm) 12px;
    border-radius: 8px;
}

.party-box h4 {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.party-box p {
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.labeled-field {
    display: flex;
    flex-direction: row;
    direction: rtl;
    align-items: baseline;
    gap: 0.35em;
    flex-wrap: wrap;
}

.labeled-field__label {
    flex-shrink: 0;
    font-weight: 600;
}

.labeled-field__label::after {
    content: ':';
}

.preview-items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--space-lg);
}

.preview-items-table th,
.preview-items-table td {
    border: 1px solid var(--border);
    padding: 7px 10px;
    text-align: right;
    font-size: 0.85rem;
}

.preview-items-table th {
    background: var(--primary);
    color: #fff;
    font-weight: 500;
}

.preview-items-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

.preview-totals {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-md);
}

.preview-totals:not(:has(.preview-desc-box)) {
    justify-content: flex-end;
}

.preview-totals .totals-box {
    margin-right: 0;
}

.preview-desc-box {
    flex: 1;
    min-width: 0;
    max-width: calc(100% - 340px);
    font-size: 0.9rem;
    padding-top: var(--space-sm);
}

.preview-desc-box .labeled-field {
    align-items: flex-start;
}

.preview-totals-box {
    min-width: 260px;
    width: fit-content;
    max-width: 100%;
}

.preview-signatures {
    display: flex;
    justify-content: space-between;
    margin-top: var(--space-lg);
    gap: var(--space-md);
}

.sig-box {
    text-align: center;
    flex: 1;
}

.sig-box img {
    max-width: 140px;
    max-height: 80px;
    object-fit: contain;
    margin-bottom: 8px;
}

.sig-box .sig-line {
    border-top: 1px solid var(--text);
    padding-top: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.preview-actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
}

/* Settings page */
.settings-page .page-header {
    margin-bottom: var(--space-sm);
}

.settings-page .card {
    margin-bottom: var(--space-sm);
}

.settings-page .card-body {
    padding: var(--space-sm) var(--space-md);
}

.settings-fields {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.settings-media {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.settings-media .file-input {
    gap: 4px;
}

.settings-media .file-input-trigger {
    padding: 8px 10px;
    gap: 8px;
}

.settings-media .file-input-icon {
    width: 32px;
    height: 32px;
}

.settings-media .file-input-icon svg {
    width: 18px;
    height: 18px;
}

.settings-media .file-input-btn-text {
    font-size: 0.8rem;
}

.settings-media .file-input-filename {
    font-size: 0.72rem;
}

.settings-media .file-input-preview img {
    max-width: 72px;
    max-height: 40px;
}

.settings-backup {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: var(--space-sm);
    padding-bottom: var(--space-sm);
}

.settings-backup-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-left: 4px;
}

.settings-restore-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}

.settings-restore-form .file-input {
    flex: 1;
    min-width: 0;
}

.settings-restore-form .file-input-trigger {
    padding: 6px 10px;
}

.settings-restore-form .file-input-btn-text {
    font-size: 0.8rem;
}

.settings-restore-form .file-input-filename {
    font-size: 0.75rem;
}

@media (min-width: 769px) {
    .settings-backup {
        flex-wrap: nowrap;
        gap: 20px;
        padding: var(--space-md) var(--space-lg);
    }

    .settings-backup-label {
        font-size: 0.95rem;
        margin-left: 0;
        white-space: nowrap;
    }

    .settings-backup > .btn {
        flex-shrink: 0;
        min-width: 88px;
    }

    .settings-restore-form {
        gap: 14px;
        margin-inline-start: auto;
        padding-inline-start: 24px;
        border-inline-start: 1px solid var(--border);
    }

    .settings-restore-form .file-input {
        flex: 1;
        min-width: 240px;
        max-width: 400px;
    }

    .settings-restore-form .file-input-trigger {
        padding: 10px 14px;
        gap: 10px;
    }

    .settings-restore-form .file-input-icon {
        width: 36px;
        height: 36px;
    }

    .settings-restore-form .file-input-icon svg {
        width: 20px;
        height: 20px;
    }

    .settings-restore-form .file-input-btn-text {
        font-size: 0.88rem;
    }

    .settings-restore-form .file-input-filename {
        font-size: 0.8rem;
    }

    .settings-restore-form > .btn {
        flex-shrink: 0;
        white-space: nowrap;
        min-width: 88px;
    }
}

.settings-help .card-header h2 {
    font-size: 1rem;
}

.settings-help-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.settings-help-item h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.settings-help-item ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-help-item li {
    position: relative;
    padding-inline-start: 14px;
    font-size: 0.84rem;
    color: var(--text-muted);
    line-height: 1.65;
}

.settings-help-item li::before {
    content: '•';
    position: absolute;
    inset-inline-start: 0;
    color: var(--primary);
    font-weight: 700;
}

.settings-help-item code {
    font-family: inherit;
    font-size: 0.8rem;
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--bg);
    color: var(--primary-dark);
}

.settings-help-item-wide {
    grid-column: 1 / -1;
    padding-top: var(--space-sm);
    border-top: 1px solid var(--border);
}

/* Settings backup (legacy) */
.backup-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.backup-card {
    background: var(--bg);
    border-radius: var(--radius);
    padding: var(--space-md);
    border: 1px dashed var(--border);
}

.backup-card h3 {
    font-size: 1rem;
    margin-bottom: 8px;
}

.backup-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* Print */
@media print {
    .site-header,
    .site-footer,
    .preview-actions,
    .no-print {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .main-content {
        padding: 0;
    }

    .invoice-preview {
        border: none;
        box-shadow: none;
        padding: 0;
        max-width: 100%;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    .preview-totals-box,
    .totals-box {
        width: 320px;
        max-width: 100%;
    }

    .totals-row {
        grid-template-columns: minmax(0, 1fr) auto;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }

    .main-content {
        padding: 8px 0 12px;
    }

    .card {
        margin-bottom: 10px;
    }

    .card-header {
        padding: 8px 10px;
    }

    .card-body {
        padding: 10px;
    }

    .page-header {
        margin-bottom: 8px;
        gap: 6px;
    }

    .nav-toggle {
        display: block;
    }

    .main-nav {
        display: none;
        position: absolute;
        top: 52px;
        right: 0;
        left: 0;
        background: var(--surface);
        flex-direction: column;
        padding: var(--space-sm) var(--space-md);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-lg);
    }

    .main-nav.open {
        display: flex;
    }

    .header-inner {
        position: relative;
    }

    .invoice-parties {
        grid-template-columns: 1fr;
    }

    .preview-totals {
        flex-direction: column;
    }

    .preview-desc-box {
        max-width: 100%;
    }

    .backup-section {
        grid-template-columns: 1fr;
    }

    .settings-fields,
    .settings-media {
        grid-template-columns: 1fr;
    }

    .settings-backup {
        flex-direction: column;
        align-items: stretch;
    }

    .settings-restore-form {
        flex-direction: column;
        align-items: stretch;
        margin-inline-start: 0;
        padding-inline-start: 0;
        border-inline-start: none;
    }

    .settings-restore-form .file-input {
        max-width: none;
    }

    .settings-help-grid {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }

    .settings-help-item h3 {
        font-size: 0.85rem;
    }

    .settings-help-item li {
        font-size: 0.8rem;
    }

    .page-header h1 {
        font-size: 1.25rem;
    }

    .form-grid-pairs {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .form-grid-pairs .form-group label {
        font-size: 0.78rem;
    }

    .form-grid-pairs .form-control {
        padding: 7px 8px;
        font-size: 0.85rem;
    }

    .form-grid-compact .form-group-file .file-input-trigger {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 8px;
    }

    .form-grid-compact .form-group-file .file-input-icon {
        width: 28px;
        height: 28px;
        align-self: center;
    }

    .form-grid-compact .form-group-file .file-input-icon svg {
        width: 16px;
        height: 16px;
    }

    .form-grid-compact .form-group-file .file-input-btn-text {
        font-size: 0.72rem;
        text-align: center;
    }

    .form-grid-compact .form-group-file .file-input-filename {
        font-size: 0.68rem;
        text-align: center;
    }

    .form-grid-compact .form-group-file .file-input-preview img {
        max-width: 100%;
        max-height: 44px;
    }

    .btn-group-create .btn {
        width: 100%;
    }

    .totals-box {
        width: 100%;
        max-width: 100%;
    }

    .totals-row {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .items-table-wrap {
        overflow-x: visible;
        margin: 0;
    }

    .items-table {
        display: block;
        min-width: 0;
    }

    .items-table thead {
        display: none;
    }

    .items-table tbody {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .items-table tbody tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "remove remove"
            "desc desc"
            "qty price"
            "total total";
        gap: 6px;
        padding: 8px;
        background: var(--bg);
        border: 1px solid var(--border);
        border-radius: var(--radius);
    }

    .items-table tbody tr:last-child {
        border-bottom: none;
    }

    .items-table td {
        display: block;
        width: auto;
        padding: 0;
        border-bottom: none;
    }

    .items-table td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.7rem;
        color: var(--text-muted);
        font-weight: 600;
        margin-bottom: 2px;
    }

    .items-table td:nth-child(1) { grid-area: desc; }
    .items-table td:nth-child(2) { grid-area: qty; }
    .items-table td:nth-child(3) { grid-area: price; }
    .items-table td:nth-child(4) { grid-area: total; }
    .items-table td:nth-child(5) { grid-area: remove; }

    .items-table .item-remove-cell::before {
        display: none;
    }

    .items-table .item-remove-cell {
        display: flex;
        justify-content: flex-end;
        margin-bottom: -4px;
    }

    .items-table .row-total {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 6px;
        padding-top: 2px;
        border-top: 1px dashed var(--border);
        font-size: 0.88rem;
    }

    .items-table .row-total::before {
        margin-bottom: 0;
    }

    .items-table .form-control {
        width: 100%;
    }

    .data-table-wrap {
        overflow-x: visible;
    }

    .data-table {
        display: block;
        min-width: 0;
    }

    .data-table thead {
        display: none;
    }

    .archive-page .page-header .btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }

    .archive-page .archive-search {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 12px;
        padding: 12px;
        background: linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
        border: 1px solid var(--border);
        border-radius: 12px;
    }

    .archive-page .archive-search .form-control {
        min-width: 0;
        width: 100%;
        padding: 10px 12px;
        border-radius: 10px;
        background: var(--surface);
    }

    .archive-page .archive-search .btn {
        padding: 9px 12px;
        font-size: 0.85rem;
        border-radius: 10px;
    }

    .archive-list .data-table tbody {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .archive-list .data-table tbody tr {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "number date"
            "buyer buyer"
            "amount amount"
            "actions actions";
        row-gap: 0;
        column-gap: 10px;
        padding: 0;
        background: var(--surface);
        border: 1px solid var(--border);
        border-inline-start: 4px solid var(--primary);
        border-radius: 14px;
        box-shadow: var(--shadow);
        overflow: hidden;
        transition: box-shadow 0.2s ease, transform 0.15s ease;
    }

    .archive-list .data-table tbody tr:active {
        transform: scale(0.995);
    }

    .archive-list .data-table tbody tr:hover td {
        background: transparent;
    }

    .archive-list .archive-table td {
        display: block;
        width: auto;
        min-width: 0;
        padding-inline: 16px;
        border-bottom: none;
    }

    .archive-list .archive-table td::before {
        content: none;
        display: none;
    }

    .archive-list .archive-table td:nth-child(1) { grid-area: number; }
    .archive-list .archive-table td:nth-child(2) { grid-area: date; }
    .archive-list .archive-table td:nth-child(3) { grid-area: buyer; }
    .archive-list .archive-table td:nth-child(4) { grid-area: amount; }
    .archive-list .archive-table td:nth-child(5) { grid-area: actions; }

    .archive-list .archive-cell-number {
        padding-block: 14px 8px;
    }

    .archive-list .archive-inv-badge {
        font-size: 1.02rem;
        color: var(--text);
    }

    .archive-list .archive-inv-badge strong {
        font-weight: 700;
        color: var(--primary-dark);
    }

    .archive-list .archive-cell-date {
        padding-block: 14px 8px;
        text-align: end;
    }

    .archive-list .archive-date-tag {
        display: inline-flex;
        align-items: center;
        padding: 5px 11px;
        background: var(--bg);
        border: 1px solid var(--border);
        border-radius: 20px;
        font-size: 0.78rem;
        font-weight: 500;
        color: var(--text-muted);
        white-space: nowrap;
    }

    .archive-list .archive-cell-buyer {
        padding-block: 2px 12px;
    }

    .archive-list .archive-buyer-name {
        display: block;
        font-size: 0.95rem;
        font-weight: 600;
        line-height: 1.5;
        color: var(--text);
        word-break: break-word;
    }

    .archive-list .archive-amount-cell {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin: 0;
        padding-block: 12px;
        background: linear-gradient(to left, rgba(219, 234, 254, 0.55), transparent);
        border-top: 1px solid var(--border);
        font-size: 0.9rem;
    }

    .archive-list .archive-amount-label {
        font-size: 0.75rem;
        font-weight: 600;
        color: var(--text-muted);
        flex-shrink: 0;
    }

    .archive-list .archive-amount-value {
        font-size: 1rem;
        font-weight: 700;
        color: var(--success);
        text-align: end;
        line-height: 1.3;
    }

    .archive-list .archive-actions-cell {
        padding-block: 10px 12px;
        border-top: 1px solid var(--border);
        background: #fafbfc;
    }

    .archive-list .archive-mobile-actions {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .archive-list .archive-mobile-actions::-webkit-scrollbar {
        display: none;
    }

    .archive-list .archive-quick-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        border-radius: 11px;
        background: var(--surface);
        border: 1px solid var(--border);
        color: var(--text);
        text-decoration: none;
        flex-shrink: 0;
        transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
    }

    .archive-list .archive-quick-btn svg {
        width: 18px;
        height: 18px;
    }

    .archive-list .archive-quick-btn:active {
        transform: scale(0.94);
        background: var(--primary-light);
        border-color: #bfdbfe;
        color: var(--primary-dark);
    }

    .archive-list .archive-quick-btn-success {
        color: var(--success);
        background: #ecfdf5;
        border-color: #a7f3d0;
    }

    .archive-list .archive-quick-btn-success:active {
        background: #d1fae5;
        border-color: #6ee7b7;
        color: #047857;
    }

    .archive-list .actions-dropdown {
        display: inline-flex;
        flex-shrink: 0;
        margin-inline-start: auto;
    }

    .archive-list .actions-toggle {
        width: 42px;
        height: 42px;
        padding: 0;
        border-radius: 11px;
        background: var(--surface);
    }

    /* Generic data-table mobile (non-archive pages) */
    .data-table:not(.archive-table) tbody {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .data-table:not(.archive-table) tbody tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        padding: 8px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius);
    }

    .data-table:not(.archive-table) tbody tr:hover td {
        background: transparent;
    }

    .data-table:not(.archive-table) td {
        display: block;
        width: auto;
        padding: 0;
        border-bottom: none;
    }

    .data-table:not(.archive-table) td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.7rem;
        color: var(--text-muted);
        font-weight: 600;
        margin-bottom: 2px;
    }

    .items-add-row {
        margin-top: 6px;
    }
}

.form-control-ltr {
    direction: ltr;
    text-align: left;
}

/* Jalali datepicker */
jdp-container {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    color: var(--text);
    background: linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    box-shadow: var(--shadow-lg), 0 12px 40px rgba(37, 99, 235, 0.12);
    min-width: 400px;
    max-width: 400px;
    padding: 0.75rem 0;
    overflow: hidden;
}

jdp-container .jdp-icon-minus,
jdp-container .jdp-icon-plus {
    border: 1.5px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    transition: border-color 0.2s ease, background 0.2s ease;
}

jdp-container .jdp-icon-minus:not(.not-in-range):hover,
jdp-container .jdp-icon-plus:not(.not-in-range):hover,
jdp-container .jdp-icon-minus:not(.not-in-range):active,
jdp-container .jdp-icon-plus:not(.not-in-range):active {
    background: var(--bg);
    border-color: var(--primary-light);
}

jdp-container .jdp-months,
jdp-container .jdp-years {
    margin: 0 6px;
    padding: 6px 10px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-weight: 600;
}

jdp-container .jdp-month select,
jdp-container .jdp-year select {
    font-family: inherit;
    font-weight: 600;
    color: var(--text);
}

jdp-container .jdp-days {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    padding: 0.75rem 0 0.5rem;
}

jdp-container .jdp-day,
jdp-container .jdp-day-name {
    flex: 0 0 14.2857143%;
    width: 14.2857143%;
    max-width: 14.2857143%;
    margin: 2px 0;
    box-sizing: border-box;
}

jdp-container .jdp-day-name {
    background: transparent;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    height: 31px;
    line-height: 31px;
    border: none;
    border-radius: 0;
}

jdp-container .jdp-day-name.holly-day,
jdp-container .jdp-day-name.last-week,
jdp-container .jdp-day.holly-day,
jdp-container .jdp-day.last-week {
    color: var(--danger);
}

jdp-container .jdp-day {
    font-weight: 500;
    color: var(--text);
    border-radius: 6px;
    border: 1px solid transparent;
    height: 36px;
    line-height: 34px;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

jdp-container .jdp-day.today:not(.selected) {
    border-color: var(--primary-light);
    background: rgba(37, 99, 235, 0.08);
    color: var(--primary-dark);
}

jdp-container .jdp-day.selected,
jdp-container .jdp-day-name.selected {
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
    border-color: var(--primary);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28);
    color: #fff !important;
    font-weight: 700;
    opacity: 1 !important;
}

jdp-container .jdp-day.not-in-month {
    color: var(--text-muted);
}

jdp-container .jdp-day:not(.disabled-day):not(.selected):not(.today):hover {
    background: rgba(37, 99, 235, 0.08);
}

jdp-container .jdp-footer {
    border-top: 1px solid var(--border);
    padding: 0.75rem 0.5rem 0;
    margin: 0;
    justify-content: center;
}

jdp-container .jdp-btn-today,
jdp-container .jdp-btn-empty {
    display: none !important;
}

jdp-container .jdp-btn-close {
    flex: 1;
    width: 100%;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0;
    font-weight: 600;
    padding: 0.65rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

jdp-container .jdp-btn-close::after {
    content: 'انصراف';
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.4;
}

jdp-container .jdp-btn-close:hover {
    background: rgba(37, 99, 235, 0.06);
    border-color: var(--primary-light);
    color: var(--text);
}

@media only screen and (max-width: 481px) {
    jdp-overlay {
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        background-color: rgba(15, 23, 42, 0.32);
    }

    jdp-container {
        position: fixed !important;
        inset: 0 !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        transform: none !important;
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        height: 100% !important;
        height: 100dvh !important;
        max-height: none !important;
        border-radius: 0 !important;
        overflow-y: auto;
        box-shadow: none;
        padding:
            max(16px, env(safe-area-inset-top))
            max(16px, env(safe-area-inset-right))
            max(16px, env(safe-area-inset-bottom))
            max(16px, env(safe-area-inset-left));
        animation: jdpFullscreenOpen 0.28s cubic-bezier(0.22, 1, 0.36, 1) !important;
    }

    jdp-container .jdp-days {
        min-height: calc(100dvh - 12.5rem);
        padding: 1rem 0 0.75rem;
    }

    jdp-container .jdp-day-name {
        height: 34px;
        line-height: 34px;
    }

    jdp-container .jdp-day {
        height: 44px;
        line-height: 42px;
        font-size: 0.95rem;
    }

    jdp-container .jdp-day:not(.disabled-day):active {
        background: rgba(37, 99, 235, 0.14);
        transform: scale(0.96);
    }

    jdp-container .jdp-footer {
        position: sticky;
        bottom: 0;
        padding: 14px 0 0;
    }

    jdp-container .jdp-btn-close {
        padding: 0.72rem 1rem;
    }

    jdp-container .jdp-btn-close::after {
        font-size: 0.92rem;
    }
}

@keyframes jdpFullscreenOpen {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Public share page */
.site-header-minimal .brand {
    cursor: default;
    text-decoration: none;
}

.share-public-actions {
    margin-bottom: 16px;
}

.share-not-found {
    margin-top: 24px;
}

.share-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    background: var(--text);
    color: #fff;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 0.9rem;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: var(--shadow-lg);
}

.share-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Landing page */
.landing-page .main-content {
    padding: 0;
}

.landing-container {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px;
}

.landing-container-narrow {
    max-width: 720px;
}

.landing-hero {
    background: linear-gradient(160deg, #eff6ff 0%, #f8fafc 50%, var(--bg) 100%);
    border-bottom: 1px solid var(--border);
    padding: 56px 0 64px;
    text-align: center;
}

.landing-badge {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--primary-dark);
    background: var(--primary-light);
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    padding: 6px 16px;
    margin-bottom: 20px;
    letter-spacing: 0.01em;
}

.landing-hero h1 {
    font-size: clamp(1.75rem, 4.5vw, 2.5rem);
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.landing-lead {
    color: var(--text-muted);
    font-size: clamp(0.95rem, 2vw, 1.1rem);
    max-width: 560px;
    margin: 0 auto 32px;
    line-height: 1.8;
}

.landing-cta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.landing-cta-center {
    margin-top: 36px;
}

.btn-lg {
    padding: 13px 28px;
    font-size: 1rem;
    border-radius: 10px;
}

.btn-lg .btn-icon {
    width: 20px;
    height: 20px;
}

.landing-section {
    padding: 56px 0;
}

.landing-section-alt {
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.landing-section-head {
    text-align: center;
    margin-bottom: 40px;
}

.landing-section-head h2,
.landing-seo-text h2 {
    font-size: clamp(1.2rem, 2.5vw, 1.5rem);
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: -0.01em;
}

.landing-section-head p {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.7;
}

.landing-features {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.landing-feature {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px 24px;
    text-align: center;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.landing-feature:hover {
    border-color: #bfdbfe;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.08);
}

.landing-feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--primary-light);
    color: var(--primary);
    margin-bottom: 16px;
}

.landing-feature-icon svg {
    width: 24px;
    height: 24px;
}

.landing-feature h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.landing-feature p {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.landing-steps {
    list-style: none;
    counter-reset: step;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.landing-steps li {
    counter-increment: step;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 28px 24px 24px;
    position: relative;
    background: var(--bg);
    border-radius: 12px;
    border: 1px solid var(--border);
    text-align: center;
}

.landing-steps li::before {
    content: counter(step);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    margin: 0 auto 8px;
}

.landing-steps strong {
    font-size: 0.95rem;
    font-weight: 600;
}

.landing-steps span {
    font-size: 0.86rem;
    color: var(--text-muted);
    line-height: 1.65;
}

.landing-faq {
    display: grid;
    gap: 12px;
    max-width: 720px;
    margin: 0 auto;
}

.landing-faq-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    transition: border-color 0.2s;
}

.landing-faq-item[open] {
    border-color: #bfdbfe;
}

.landing-faq-item summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 18px 48px 18px 24px;
    list-style: none;
    position: relative;
    line-height: 1.5;
    user-select: none;
}

.landing-faq-item summary::-webkit-details-marker {
    display: none;
}

.landing-faq-item summary::after {
    content: '';
    position: absolute;
    left: 24px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-left: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: translateY(-60%) rotate(-45deg);
    transition: transform 0.2s;
}

.landing-faq-item[open] summary::after {
    transform: translateY(-30%) rotate(135deg);
}

.landing-faq-item p {
    padding: 0 24px 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.75;
    border-top: 1px solid var(--border);
    margin-top: 0;
    padding-top: 16px;
}

.landing-promo-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: center;
}

.landing-promo-content h2 {
    font-size: clamp(1.25rem, 2.5vw, 1.45rem);
    font-weight: 700;
    line-height: 1.45;
    margin-bottom: 16px;
    letter-spacing: -0.01em;
}

.landing-promo-desc {
    color: var(--text-muted);
    font-size: 0.98rem;
    line-height: 1.85;
    margin-bottom: 20px;
}

.landing-promo-tagline {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 28px;
}

.landing-promo-cta {
    justify-content: flex-start;
}

.landing-promo-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.landing-promo-visual img {
    display: block;
    width: 100%;
    max-width: 420px;
    height: auto;
}

.landing-seo-text {
    padding-bottom: 64px;
    text-align: center;
}

.landing-seo-text h2 {
    margin-bottom: 16px;
}

.landing-seo-text p {
    font-size: 0.92rem;
    color: var(--text-muted);
    line-height: 1.85;
}

.landing-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    justify-content: center;
    align-items: center;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 18px;
}

.landing-breadcrumb a {
    color: var(--primary-dark);
    text-decoration: none;
}

.landing-breadcrumb a:hover {
    text-decoration: underline;
}

.landing-breadcrumb span[aria-hidden="true"] {
    opacity: 0.45;
}

.landing-figure {
    margin: 0 auto 40px;
    max-width: 640px;
    text-align: center;
}

.landing-figure img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
}

.landing-figure figcaption {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.landing-article {
    max-width: 760px;
    margin: 0 auto;
}

.landing-article h2 {
    font-size: clamp(1.15rem, 2.4vw, 1.4rem);
    font-weight: 700;
    margin: 36px 0 14px;
    letter-spacing: -0.01em;
    line-height: 1.45;
}

.landing-article h2:first-child {
    margin-top: 0;
}

.landing-article h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 28px 0 10px;
    line-height: 1.5;
}

.landing-article p {
    font-size: 0.98rem;
    color: var(--text);
    line-height: 2;
    margin-bottom: 16px;
}

.landing-article ul,
.landing-article ol {
    margin: 0 0 20px;
    padding-right: 22px;
    color: var(--text);
}

.landing-article li {
    font-size: 0.96rem;
    line-height: 1.9;
    margin-bottom: 8px;
}

.landing-article a {
    color: var(--primary-dark);
    font-weight: 500;
}

.landing-article a:hover {
    text-decoration: underline;
}

.landing-callout {
    background: var(--primary-light);
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 20px 22px;
    margin: 28px 0;
}

.landing-callout p {
    margin: 0;
    color: var(--primary-dark);
    font-size: 0.95rem;
    line-height: 1.85;
}

.landing-related {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.landing-related-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.landing-related-card:hover {
    border-color: #bfdbfe;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.08);
}

.landing-related-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
    background: #eff6ff;
}

.landing-related-body {
    padding: 18px 16px 20px;
}

.landing-related-body h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.45;
    color: var(--text);
}

.landing-related-body p {
    font-size: 0.84rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin: 0;
}

.landing-related-home {
    text-align: center;
    margin-top: 28px;
    font-size: 0.92rem;
    color: var(--text-muted);
    line-height: 1.8;
}

.landing-related-home a {
    color: var(--primary-dark);
    font-weight: 500;
}

.landing-guides {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.landing-guide-card {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 18px;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.landing-guide-card:hover {
    border-color: #bfdbfe;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.08);
}

.landing-guide-card img {
    width: 120px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    background: #eff6ff;
}

.landing-guide-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.landing-guide-card p {
    font-size: 0.86rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin: 0;
}

.site-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    justify-content: center;
    margin-bottom: 12px;
}

.site-footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
}

.site-footer-links a:hover {
    color: var(--primary-dark);
}

@media (max-width: 900px) {
    .landing-features {
        grid-template-columns: repeat(2, 1fr);
    }

    .landing-steps {
        grid-template-columns: 1fr;
        max-width: 480px;
    }

    .landing-promo-inner {
        grid-template-columns: 1fr;
        gap: 36px;
        text-align: center;
    }

    .landing-promo-cta {
        justify-content: center;
    }

    .landing-promo-visual img {
        max-width: 340px;
    }

    .landing-related {
        grid-template-columns: 1fr;
        max-width: 420px;
        margin: 0 auto;
    }

    .landing-guides {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .landing-container {
        padding: 0 20px;
    }

    .landing-hero {
        padding: 40px 0 48px;
    }

    .landing-section {
        padding: 40px 0;
    }

    .landing-features {
        grid-template-columns: 1fr;
    }

    .landing-feature {
        text-align: right;
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        column-gap: 16px;
        row-gap: 4px;
        padding: 20px;
    }

    .landing-feature-icon {
        grid-row: 1 / 3;
        margin-bottom: 0;
        width: 44px;
        height: 44px;
    }

    .landing-feature h3 {
        align-self: end;
        margin-bottom: 0;
    }

    .landing-cta .btn-lg {
        width: 100%;
    }

    .landing-guide-card {
        grid-template-columns: 88px 1fr;
        gap: 12px;
        padding: 12px;
    }

    .landing-guide-card img {
        width: 88px;
        height: 72px;
    }
}

/* Admin panel */
.admin-login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 140px);
    padding: 24px 0;
}

.admin-login-card {
    width: 100%;
    max-width: 400px;
}

.admin-login-form .form-group {
    margin-bottom: 16px;
}

.page-header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.admin-stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 16px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.admin-stat-card-highlight {
    border-color: var(--primary-light);
    background: linear-gradient(135deg, #eff6ff 0%, var(--surface) 100%);
}

.admin-stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}

.admin-stat-label {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.admin-card-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 400;
}

.admin-code {
    font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
    font-size: 0.8rem;
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 4px;
    direction: ltr;
    display: inline-block;
}

.admin-session-link {
    font-family: ui-monospace, Consolas, monospace;
    font-size: 0.85rem;
}

.admin-badge {
    display: inline-block;
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--bg);
    color: var(--text-muted);
    margin-left: 4px;
}

.admin-badge-success {
    background: #d1fae5;
    color: #065f46;
}

.admin-badge-info {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.admin-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px 24px;
}

.admin-detail-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

@media (max-width: 900px) {
    .admin-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .admin-detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .admin-stats-grid {
        grid-template-columns: 1fr;
    }
}
