:root {
    --color-bg: #f3f4f7;
    --color-surface: #ffffff;
    --color-primary: #145c3b;      /* سبز تیره نزدیک به فضای سایت */
    --color-primary-soft: #1f7a4d;
    --color-accent: #c89a3b;       /* طلایی ملایم */
    --color-border: #dde3ea;
    --color-border-strong: #c2c9d6;
    --color-text: #222222;
    --color-muted: #6b7280;
    --shadow-soft: 0 14px 30px rgba(0, 0, 0, 0.08);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    font-family: "Tahoma", "IRANSans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    margin: 0;
    background: radial-gradient(circle at top, #fdfaf5 0, #f3f4f7 36%, #edf1f7 100%);
    color: var(--color-text);
    direction: rtl;
}

/* App Shell */

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content {
    flex: 1;
    width: 100%;
    max-width: 1100px;
    margin: 24px auto 40px;
    padding: 0 16px;
}

/* Topbar, close to jamalolhagh.ir look */

.topbar {
    background: linear-gradient(120deg, #103625, #145c3b);
    color: #fefefe;
    box-shadow: 0 13px 30px rgba(0, 0, 0, 0.35);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

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

.brand-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.brand-subtitle {
    font-size: 0.8rem;
    opacity: 0.9;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
}

.topbar-nav a {
    color: #fefefe;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: all 0.18s ease-out;
}

.topbar-nav a:hover {
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(0, 0, 0, 0.12);
}

/* Cards & sections */

.page-section {
    margin-top: 16px;
}

.page-section-narrow {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.card {
    background: var(--color-surface);
    border-radius: 18px;
    padding: 20px 20px 22px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255, 255, 255, 0.9);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: "";
    position: absolute;
    inset-inline-end: -60px;
    inset-block-start: -60px;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(200, 154, 59, 0.1), transparent);
    pointer-events: none;
}

.card-narrow {
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    position: relative;
    z-index: 1;
}

.card-header-compact {
    margin-bottom: 10px;
}

.card-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.card-subtitle {
    margin: 4px 0 0;
    font-size: 0.85rem;
    color: var(--color-muted);
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    margin-top: 16px;
}

/* Page header */

.page-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.page-title {
    margin: 0;
    font-size: 1.3rem;
}

.page-subtitle {
    margin: 4px 0 0;
    font-size: 0.85rem;
    color: var(--color-muted);
}

.page-header-actions {
    display: flex;
    gap: 8px;
}

/* Forms */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px 18px;
    margin-top: 10px;
    position: relative;
    z-index: 1;
}

.form-vertical {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 8px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.9rem;
}

.form-full {
    grid-column: 1 / -1;
}

label {
    font-weight: 600;
}

.required {
    color: #e11d48;
    margin-inline-start: 4px;
}

input[type="text"],
input[type="tel"],
input[type="password"],
input[type="number"],
input[type="file"],
textarea {
    border-radius: 10px;
    border: 1px solid var(--color-border);
    padding: 7px 10px;
    font-size: 0.9rem;
    background: #f9fafb;
    outline: none;
    transition: border-color 0.15s ease-out, box-shadow 0.15s ease-out, background 0.15s ease-out;
}

textarea {
    resize: vertical;
    min-height: 70px;
}

input:focus,
textarea:focus,
input:hover,
textarea:hover {
    border-color: var(--color-primary-soft);
    background: #ffffff;
    box-shadow: 0 0 0 1px rgba(20, 92, 59, 0.07);
}

.helper-text {
    font-size: 0.78rem;
    color: var(--color-muted);
}

.form-separator {
    border: none;
    border-top: 1px dashed var(--color-border);
    margin: 6px 0 4px;
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    margin-top: 4px;
}

.admin-link {
    font-size: 0.8rem;
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 999px;
    border: 1px solid transparent;
    padding: 7px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.16s ease-out;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(130deg, var(--color-primary-soft), var(--color-primary));
    color: #ffffff;
    box-shadow: 0 10px 20px rgba(20, 92, 59, 0.35);
}

.btn-primary:hover {
    filter: brightness(1.05);
    box-shadow: 0 12px 24px rgba(20, 92, 59, 0.45);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(20, 92, 59, 0.08);
    color: var(--color-primary);
    border-color: rgba(20, 92, 59, 0.18);
}

.btn-secondary:hover {
    background: rgba(20, 92, 59, 0.12);
}

.btn-ghost {
    background: transparent;
    color: var(--color-primary);
    border-color: rgba(20, 92, 59, 0.12);
}

.btn-ghost:hover {
    background: rgba(20, 92, 59, 0.06);
}

.btn-outline {
    background: #ffffff;
    color: var(--color-primary);
    border-color: rgba(20, 92, 59, 0.35);
}

.btn-outline:hover {
    background: rgba(20, 92, 59, 0.05);
}

.btn-sm {
    padding-block: 4px;
    padding-inline: 9px;
    font-size: 0.75rem;
}

/* Tables */

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin-top: 6px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table thead {
    background: linear-gradient(90deg, #103625, #145c3b);
    color: #ffffff;
}

.data-table th,
.data-table td {
    padding: 7px 8px;
    text-align: center;
    border-bottom: 1px solid var(--color-border);
}

.data-table th {
    font-weight: 600;
}

.data-table tbody tr:nth-child(even) {
    background: rgba(248, 249, 252, 0.95);
}

.data-table tbody tr:hover {
    background: rgba(222, 243, 232, 0.7);
}

.empty-state {
    padding-block: 14px;
    color: var(--color-muted);
}

/* Order detail */

.order-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px 20px;
    margin-top: 6px;
}

.order-detail-group {
    background: linear-gradient(135deg, rgba(16, 54, 37, 0.03), rgba(200, 154, 59, 0.02));
    border-radius: 14px;
    padding: 10px 12px 12px;
    border: 1px solid rgba(222, 231, 238, 0.9);
}

.order-detail-heading {
    margin: 0 0 6px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-primary);
}

.definition-list {
    margin: 0;
    padding: 0;
}

.definition-row {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 4px 12px;
    font-size: 0.86rem;
    padding-block: 3px;
}

.definition-row + .definition-row {
    border-top: 1px dashed rgba(209, 213, 219, 0.8);
    padding-top: 6px;
    margin-top: 3px;
}

.definition-row dt {
    font-weight: 600;
    color: var(--color-muted);
}

.definition-row dd {
    margin: 0;
}

.slip-section {
    margin-top: 12px;
}

.slip-preview {
    margin-top: 6px;
    border-radius: 14px;
    border: 1px solid var(--color-border);
    padding: 8px;
    background: #f9fafb;
}

.slip-preview img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 10px;
}

/* Badges */

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 0.75rem;
    border: 1px solid transparent;
}

.badge-soft {
    background: rgba(16, 54, 37, 0.06);
    border-color: rgba(16, 54, 37, 0.18);
    color: var(--color-primary);
}

/* Live indicator */

.live-indicator {
    font-size: 0.78rem;
    color: var(--color-muted);
    min-width: 130px;
    text-align: left;
}

.live-indicator--active {
    color: #dc2626;
    font-weight: 600;
}

/* Text helpers */

.mono {
    font-family: "Courier New", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier", monospace;
    font-size: 0.8rem;
}

.actions-footer {
    margin-top: 16px;
    justify-content: flex-start;
}

/* Flash messages */

.flash-container {
    margin-bottom: 12px;
}

.flash {
    padding: 8px 11px;
    border-radius: 12px;
    font-size: 0.85rem;
    background: #fef3c7;
    border: 1px solid #fbbf24;
    color: #92400e;
}

.flash-error {
    background: #fee2e2;
    border-color: #f97373;
    color: #b91c1c;
}

/* Footer */

.app-footer {
    border-top: 1px solid rgba(209, 213, 219, 0.7);
    background: rgba(250, 250, 250, 0.95);
}

.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 10px 16px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    color: var(--color-muted);
}

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

.footer-inner a:hover {
    text-decoration: underline;
}

.footer-separator {
    opacity: 0.6;
}

/* Responsive */

@media (max-width: 640px) {
    .topbar-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .card {
        padding-inline: 16px;
    }
}

/* Print styles for order detail */

@media print {
    .topbar,
    .app-footer,
    .btn,
    .flash-container,
    .page-header-row,
    .page-section > .card:not(.printable) {
        display: none !important;
    }

    body {
        background: #ffffff;
    }

    .content {
        max-width: 100%;
        margin: 0;
        padding: 0 10mm;
    }

    .card.printable {
        box-shadow: none;
        border: 1px solid #00000033;
        border-radius: 0;
        padding: 0;
    }
}
