@font-face {
    font-family: "IRANSans";
    src: url("../fonts/IRANSansWeb.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "IRANSans";
    src: url("../fonts/IRANSansWeb_Bold.ttf") format("truetype");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "IRANSansFaNum";
    src: url("../fonts/IRANSansWeb-FaNum.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    --app-bg: #f3efe6;
    --bg: var(--app-bg);
    --bg-deep: color-mix(in srgb, var(--app-bg) 82%, #cbbfa8);
    --ink: #1f2a24;
    --muted: #5f6b63;
    --accent: #0f6a56;
    --accent-2: #c45c26;
    --card: rgba(255, 255, 255, 0.72);
    --line: rgba(31, 42, 36, 0.12);
    --ok: #147a45;
    --err: #a12828;
    --shadow: 0 18px 40px rgba(31, 42, 36, 0.08);
    --radius: 18px;
    --font: "IRANSans", "IRANSansFaNum", "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
    font-family: var(--font);
    color: var(--ink);
    background:
        radial-gradient(circle at 10% 10%, rgba(15, 106, 86, 0.10), transparent 28%),
        radial-gradient(circle at 90% 0%, rgba(196, 92, 38, 0.10), transparent 32%),
        linear-gradient(160deg, var(--app-bg), var(--bg-deep));
}

a { color: var(--accent); text-decoration: none; }
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Hamido-style header */
.hamido-header {
    --hamido-blue: #1a5f8c;
    --hamido-blue-deep: #134a6e;
    --hamido-blue-soft: #2a74a5;
    --hamido-col-head: #3d8ab8;
    position: sticky;
    top: 0;
    z-index: 60;
    background: linear-gradient(180deg, #f7fafc 0%, #e8eef3 100%);
    border-bottom: 1px solid rgba(26, 95, 140, 0.18);
    box-shadow: 0 2px 10px rgba(19, 74, 110, 0.08);
    overflow: visible;
}
.hamido-header-bar {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "brand ribbon user";
    align-items: stretch;
    gap: 8px;
    padding: 6px 14px 4px;
    min-height: 78px;
    background: inherit;
}
.hamido-header-bar .hamido-brand { grid-area: brand; }
.hamido-header-bar .hamido-ribbon { grid-area: ribbon; }
.hamido-header-bar .hamido-user,
.hamido-header-bar .hamido-site-icon--solo,
.hamido-header-bar .hamido-header-actions { grid-area: user; }
.hamido-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    margin-inline-start: auto;
    align-self: center;
}
.hamido-view-toggle {
    appearance: none;
    border: 1px solid rgba(26, 95, 140, 0.22);
    background: #fff;
    color: #1f3a4a;
    cursor: pointer;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
    padding: 8px 10px;
    border-radius: 9px;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(19, 74, 110, 0.06);
}
.hamido-view-toggle:hover {
    background: rgba(26, 95, 140, 0.1);
    border-color: rgba(26, 95, 140, 0.3);
}
.hamido-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    padding: 4px 10px 4px 4px;
    border-left: 1px solid rgba(26, 95, 140, 0.14);
    margin-left: 4px;
    color: inherit;
    text-decoration: none;
}
.hamido-brand:hover { color: inherit; opacity: 0.92; }
.hamido-brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #1f8a70, #c45c26);
    color: #fff;
    font-size: 1.25rem;
    font-weight: 800;
    flex: 0 0 auto;
    object-fit: cover;
}
.hamido-brand-mark-img {
    background: #fff;
    border: 1px solid rgba(26, 95, 140, 0.18);
    padding: 0;
}
.hamido-brand strong {
    display: block;
    font-size: 0.95rem;
    color: var(--ink);
    line-height: 1.2;
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hamido-brand small { color: var(--muted); font-size: 0.72rem; }

.app-settings-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    max-width: 1100px;
    width: 100%;
    margin-inline: auto;
}
.app-settings-nav {
    position: sticky;
    top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}
.app-settings-nav-btn {
    appearance: none;
    border: 1px solid transparent;
    background: transparent;
    color: var(--ink);
    text-align: right;
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    font-size: 0.92rem;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.app-settings-nav-btn:hover {
    background: rgba(15, 23, 42, 0.04);
}
.app-settings-nav-btn.is-active {
    background: rgba(31, 138, 112, 0.12);
    border-color: rgba(31, 138, 112, 0.28);
    color: #0f5f4d;
    font-weight: 700;
}
.app-settings-panels { min-width: 0; }
.app-settings-panel[hidden] { display: none !important; }
.app-settings-panel.is-active { display: block; }
.app-settings-card {
    max-width: none;
    width: 100%;
    margin-inline: 0;
}
.app-settings-form { display: grid; gap: 18px; }
.app-settings-field { display: grid; gap: 8px; color: var(--muted); font-size: 0.92rem; }
.app-settings-label { color: var(--muted); }
@media (max-width: 900px) {
    .app-settings-layout {
        grid-template-columns: 1fr;
    }
    .app-settings-nav {
        position: static;
        flex-direction: row;
        overflow-x: auto;
        gap: 8px;
        padding: 8px;
    }
    .app-settings-nav-btn {
        white-space: nowrap;
        flex: 0 0 auto;
    }
}
.sg-day-schedule { width: 100%; border-collapse: collapse; }
.sg-day-schedule th,
.sg-day-schedule td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    text-align: right;
    vertical-align: middle;
}
.sg-day-schedule th { font-size: 0.84rem; color: var(--muted); font-weight: 600; }
.sg-day-schedule input[type="time"] { min-width: 120px; }
.app-clock-status {
    display: grid;
    gap: 6px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.02);
    font-size: 0.92rem;
}
.guest-landing-field {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 16px;
    margin: 0;
}
.guest-landing-field legend {
    padding: 0 6px;
    font-weight: 600;
    color: var(--ink);
}
.guest-landing-option { display: flex; align-items: center; gap: 8px; }
.store-icon-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.store-icon-preview {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    overflow: hidden;
    display: grid;
    place-items: center;
}
.store-icon-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.store-icon-fallback {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #1f8a70, #c45c26);
    color: #fff;
    font-size: 1.5rem;
    font-weight: 800;
}
.store-icon-controls { flex: 1; min-width: 200px; }
.color-picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.color-picker-row input[type="color"] {
    width: 52px;
    height: 42px;
    padding: 4px;
    border-radius: 10px;
    cursor: pointer;
}
.color-picker-row input[type="text"] {
    width: 120px;
    font-family: ui-monospace, Consolas, monospace;
}
.color-preview {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 1px solid var(--line);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}
.color-presets {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 8px;
    margin-top: 4px;
}
.color-swatch {
    width: 100%;
    aspect-ratio: 1;
    border: 1px solid rgba(31, 42, 36, 0.14);
    border-radius: 10px;
    cursor: pointer;
    padding: 0;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.color-swatch.is-selected {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
@media (max-width: 640px) {
    .color-presets { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

.hamido-ribbon {
    display: flex;
    align-items: stretch;
    gap: 2px;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.invoice-items .product-input {
    width: 100%;
    min-width: 0;
}
.invoice-items-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.invoice-items {
    table-layout: auto;
    min-width: 1100px;
    width: max(100%, 1100px);
}
.invoice-items th:nth-child(3),
.invoice-items td:nth-child(3) {
    width: 130px;
    min-width: 130px;
}
.invoice-items th:nth-child(4),
.invoice-items td:nth-child(4) {
    width: 110px;
    min-width: 110px;
}
.invoice-items th:nth-child(5),
.invoice-items td:nth-child(5) {
    width: 160px;
    min-width: 160px;
}
.invoice-items th:nth-child(6),
.invoice-items td:nth-child(6) {
    width: 110px;
    min-width: 110px;
}
.invoice-items th:nth-child(7),
.invoice-items td:nth-child(7) {
    width: 160px;
    min-width: 160px;
}
.invoice-items .product-code,
.invoice-items .few,
.invoice-items .discount,
.invoice-items .line-total {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
.invoice-entry .ie-price-cell .price {
    min-width: 120px;
    flex: 1 1 auto;
}
.hamido-ribbon-btn {
    appearance: none;
    border: 1px solid transparent;
    background: transparent;
    color: #1f3a4a;
    cursor: pointer;
    font: inherit;
    min-width: 88px;
    padding: 8px 12px 6px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 0 0 auto;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.hamido-ribbon-btn:hover,
.hamido-ribbon-btn.is-open,
.hamido-ribbon-btn.is-active {
    background: rgba(26, 95, 140, 0.1);
    border-color: rgba(26, 95, 140, 0.18);
}
.hamido-ribbon-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid rgba(26, 95, 140, 0.22);
    display: grid;
    place-items: center;
    color: var(--hamido-blue);
    box-shadow: 0 1px 2px rgba(19, 74, 110, 0.06);
}
.hamido-ribbon-label {
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

/* حساب کاربری — سمت چپ هدر؛ آیکن خانه چسبیده سمت راست دکمه */
.hamido-user {
    position: relative;
    flex: 0 0 auto;
    align-self: center;
    display: inline-flex;
    flex-direction: row;
    direction: ltr;
    align-items: center;
    gap: 2px;
    width: max-content;
    max-width: 280px;
    margin-inline-start: 0;
    padding: 0;
    border: 0;
}
.hamido-header-actions .hamido-site-icon--solo {
    margin-inline-start: 0;
}
.hamido-site-icon {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    color: var(--muted, #64748b);
    text-decoration: none;
    border: 1px solid transparent;
    flex: 0 0 auto;
    align-self: center;
    box-sizing: border-box;
}
.hamido-site-icon:hover {
    color: var(--ink, #0f172a);
    background: rgba(26, 95, 140, 0.1);
    border-color: rgba(26, 95, 140, 0.16);
}
.hamido-site-icon--solo {
    margin-inline-start: auto;
    align-self: center;
}
.hamido-user-btn {
    appearance: none;
    border: 1px solid transparent;
    background: transparent;
    color: #1f3a4a;
    cursor: pointer;
    font: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 10px;
    width: auto;
    max-width: 220px;
    flex: 0 1 auto;
    box-sizing: border-box;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.hamido-user-btn:hover,
.hamido-user.is-open .hamido-user-btn {
    background: rgba(26, 95, 140, 0.1);
    border-color: rgba(26, 95, 140, 0.18);
}
.hamido-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #fff;
    border: 1px solid rgba(26, 95, 140, 0.22);
    color: var(--hamido-blue);
    flex: 0 0 auto;
    box-shadow: 0 1px 2px rgba(19, 74, 110, 0.06);
}
.hamido-user-meta {
    display: grid;
    gap: 1px;
    text-align: right;
    min-width: 0;
}
.hamido-user-meta strong {
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hamido-user-meta small {
    color: var(--muted);
    font-size: 0.7rem;
    line-height: 1.2;
}
.hamido-user-caret {
    width: 0;
    height: 0;
    border-inline: 4px solid transparent;
    border-top: 5px solid #5f7a8a;
    flex: 0 0 auto;
    margin-inline-start: 2px;
    transition: transform 0.15s ease;
}
.hamido-user.is-open .hamido-user-caret {
    transform: rotate(180deg);
}
.hamido-user-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: auto;
    width: max-content;
    min-width: 180px;
    max-width: 260px;
    box-sizing: border-box;
    z-index: 80;
    background: #fff;
    border: 1px solid rgba(26, 95, 140, 0.18);
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(19, 74, 110, 0.18);
    overflow: hidden;
}
.hamido-user-menu[hidden] { display: none !important; }
.hamido-user-menu-head {
    display: grid;
    gap: 2px;
    padding: 12px 14px;
    background: linear-gradient(180deg, #f7fafc, #eef3f7);
    border-bottom: 1px solid rgba(26, 95, 140, 0.12);
}
.hamido-user-menu-head strong {
    font-size: 0.9rem;
    color: var(--ink);
}
.hamido-user-menu-head span {
    font-size: 0.75rem;
    color: var(--muted);
}
.hamido-user-menu a {
    display: block;
    padding: 10px 14px;
    color: var(--ink);
    font-size: 0.9rem;
    border-bottom: 1px solid var(--line);
}
.hamido-user-menu a:last-child { border-bottom: 0; }
.hamido-user-menu a:hover { background: rgba(26, 95, 140, 0.08); }
.hamido-user-menu a.is-danger { color: #a12828; }
.hamido-user-menu a.is-danger:hover { background: rgba(161, 40, 40, 0.08); }

.hamido-mega {
    position: absolute;
    top: 100%;
    right: 0;
    left: auto;
    z-index: 70;
    width: max-content;
    max-width: calc(100vw - 28px);
    background: transparent;
    color: #fff;
    padding: 0 0 12px;
    pointer-events: none;
    will-change: right;
}
.hamido-mega[hidden] { display: none !important; }
.hamido-mega-panel {
    pointer-events: auto;
    width: max-content;
    max-width: min(96vw, 920px);
}
.hamido-mega-panel[hidden] { display: none !important; }
.hamido-mega-cols {
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 0;
    overflow: hidden;
    background: var(--hamido-blue);
    border-radius: 0 0 10px 10px;
    box-shadow: 0 14px 28px rgba(19, 74, 110, 0.28);
}
.hamido-mega-cols--3 {
    max-width: min(96vw, 720px);
}
.hamido-mega-col {
    min-width: 180px;
    max-width: 240px;
    flex: 0 0 auto;
    border-left: 1px solid rgba(255, 255, 255, 0.22);
    padding-bottom: 10px;
}
.hamido-mega-cols--3 .hamido-mega-col {
    min-width: 170px;
    max-width: 220px;
    flex: 1 1 0;
}
.hamido-mega-col:last-child { border-left: 0; }
.hamido-mega-col h3 {
    margin: 0;
    padding: 10px 14px;
    font-size: 0.92rem;
    font-weight: 700;
    background: var(--hamido-col-head);
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}
.hamido-mega-col > a,
.hamido-menu-extra a {
    display: block;
    color: #fff;
    padding: 8px 14px;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.hamido-mega-col > a:hover,
.hamido-mega-col > a.is-active,
.hamido-menu-extra a:hover,
.hamido-menu-extra a.active,
.hamido-menu-extra a.is-active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}
.hamido-menu-extra .nav-group { margin: 0; gap: 0; }
.hamido-menu-extra .nav-group-title {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.78rem;
    padding: 10px 14px 4px;
    background: rgba(0, 0, 0, 0.08);
}

.content {
    padding: 22px 28px 28px;
    min-width: 0;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}
.content-panel {
    width: min(1100px, 100%);
    margin: 0 auto;
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 0;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
    padding: 22px 24px 24px;
    box-sizing: border-box;
}
.content-panel--wide {
    width: min(1280px, 100%);
}
.content-panel--fluid {
    width: min(1480px, 100%);
}
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.topbar-start { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.topbar h1 { margin: 0; font-size: 1.55rem; }
.dash-settings-btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    flex: 0 0 auto;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.dash-settings-btn:hover,
.dash-settings-btn[aria-expanded="true"] {
    color: var(--accent);
    border-color: rgba(15, 106, 86, 0.35);
    background: rgba(15, 106, 86, 0.06);
}
.dash-settings-btn svg { display: block; }

.dashboard-top-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    align-items: stretch;
    margin-bottom: 16px;
    direction: rtl; /* از راست: وظایف → اسناد → چت */
}
.dashboard-top-row > .card {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    margin-top: 0 !important;
    overflow: hidden;
    box-sizing: border-box;
}
/* از راست: ۱ وظایف، ۲ اسناد، ۳ چت */
.dashboard-top-row > .td-dash-card { order: 1; }
.dashboard-top-row > .docs-dash-card { order: 2; }
.dashboard-top-row > .sc-dash-card { order: 3; }
@media (min-width: 1100px) {
    .dashboard-top-row {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.docs-dash-card {
    border: 1px solid rgba(15, 106, 86, 0.12);
    box-shadow: 0 8px 24px rgba(20, 40, 50, 0.05);
    display: flex;
    flex-direction: column;
    min-height: 320px;
}
.docs-dash-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.docs-dash-head strong { display: block; font-size: 1.05rem; }
.docs-dash-sub { display: block; margin-top: 4px; font-size: 0.86rem; }
.docs-dash-select-wrap {
    display: grid;
    gap: 4px;
    margin-bottom: 10px;
}
.docs-dash-select-wrap select {
    width: 100%;
    min-height: 36px;
}
.docs-dash-body { min-height: 180px; }
.docs-dash-body.is-loading { opacity: 0.55; pointer-events: none; }
.docs-dash-empty { margin: 8px 0 0; }
.docs-dash-table-wrap { margin: 0 -4px; }
.docs-dash-table { width: 100%; }
.docs-dash-table th {
    font-size: 0.82rem;
    color: var(--muted);
    font-weight: 600;
}
.docs-dash-party {
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.docs-dash-table a {
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
}
.docs-dash-table a:hover { color: var(--accent); }
.docs-dash-party-link {
    color: var(--accent) !important;
    font-weight: 600;
}
.docs-dash-party-link:hover { text-decoration: underline; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(440px, 100%); display: grid; gap: 14px; }
.login-brand { margin-bottom: 4px; }
.login-brand small { color: var(--muted); }
.users-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.users-tabs { margin-top: 0; }
.perm-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.perm-toolbar__role {
    display: inline-flex;
    align-items: center;
    margin: 0;
}
.perm-toolbar__role select {
    min-width: 180px;
}
.perm-groups {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.perm-list { display: grid; gap: 8px; }
.perm-item { align-items: flex-start; }
.perm-item.is-muted { opacity: 0.7; }
.perm-row { display: grid; gap: 6px; }
.perm-row-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.perm-expand-btn {
    box-sizing: border-box;
    flex: 0 0 auto;
    width: 15px;
    height: 15px;
    padding: 0;
    margin: 0;
    border: 1px solid #7a7a7a;
    border-radius: 0;
    background: #fff;
    color: #222;
    font-family: Tahoma, "Segoe UI", sans-serif;
    font-size: 12px;
    font-weight: 700;
    line-height: 13px;
    text-align: center;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}
.perm-expand-btn {
    padding-bottom: 1px;
}
.perm-expand-btn:hover {
    background: #f3f3f3;
    border-color: #555;
}
.perm-children {
    margin-inline-start: 8px;
    padding: 10px 12px;
    border: 1px dashed var(--line);
    border-radius: 10px;
    background: rgba(15, 106, 86, 0.03);
    display: grid;
    gap: 10px;
}
.perm-children[hidden] {
    display: none !important;
}
.perm-children-title {
    font-size: 0.82rem;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 2px;
}
.perm-scope,
.perm-actions { display: grid; gap: 6px; }
.perm-inline-entry {
    margin-top: 6px;
    justify-content: flex-start;
}
.perm-widget-area {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}
.perm-widget-area:last-child { margin-bottom: 0; }
.perm-widget-area-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--muted);
}
.perm-scope-list {
    display: grid;
    gap: 4px;
    margin-top: 6px;
    padding-inline-start: 4px;
}
.perm-scope-block {
    border: 0;
    border-radius: 0;
    padding: 2px 0;
    background: transparent;
}
.perm-scope-title {
    font-weight: 600;
    font-size: 0.9rem;
}
.perm-scope-head { justify-content: flex-start; }
.perm-scope-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    background: transparent;
    padding: 2px 0;
    cursor: pointer;
    font: inherit;
    color: inherit;
}
.perm-scope-toggle .perm-expand-btn {
    pointer-events: none;
    position: relative;
    top: -1px;
}
.perm-scope-block .perm-children {
    margin-inline-start: 21px;
    margin-top: 6px;
    border: 0;
    padding: 0;
    background: transparent;
}

.grid { display: grid; gap: 16px; }
.grid.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    backdrop-filter: blur(8px);
}
.card h3 { margin: 0 0 8px; font-size: 0.95rem; color: var(--muted); font-weight: 600; }
.card .value { font-size: 1.8rem; font-weight: 800; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 0.9rem; }
tr:hover td { background: rgba(15, 106, 86, 0.04); }

.btn, button.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px; border: 0; cursor: pointer;
    background: var(--accent); color: #fff;
    padding: 10px 16px; border-radius: 12px; font: inherit;
}
.btn.secondary { background: #30443c; }
.btn.warn { background: var(--accent-2); }
.btn.danger {
    background: #c62828;
    color: #fff;
}
.btn.danger:hover {
    background: #b71c1c;
}
.sms-otp-timer {
    margin: 0;
    font-size: 0.92rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    color: var(--accent);
    text-align: center;
}
.sms-otp-timer.is-expired {
    color: var(--err);
}
.btn.btn-ghost { background: transparent; color: var(--text); border: 1px solid rgba(0,0,0,.12); }
.btn:disabled { opacity: 0.6; cursor: wait; }

.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
label { display: grid; gap: 6px; font-size: 0.92rem; color: var(--muted); }
input, select, textarea {
    width: 100%; border: 1px solid var(--line); border-radius: 12px;
    padding: 11px 12px; font: inherit; background: #fff; color: var(--ink);
}
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 12px; }
.alert.success { background: rgba(20, 122, 69, 0.12); color: var(--ok); }
.alert.error { background: rgba(161, 40, 40, 0.12); color: var(--err); }
.alert.info { background: rgba(15, 106, 86, 0.1); color: var(--accent); }
.muted { color: var(--muted); }
.container.narrow { max-width: 720px; margin: 40px auto; padding: 0 16px; }
.badge {
    display: inline-block; padding: 4px 10px; border-radius: 999px;
    background: rgba(15, 106, 86, 0.12); color: var(--accent); font-size: 0.85rem;
}
.badge.buy { background: rgba(196, 92, 38, 0.14); color: var(--accent-2); }
.badge.waste { background: rgba(120, 80, 40, 0.14); color: #7a5030; }
.badge.consign { background: rgba(40, 90, 140, 0.12); color: #285a8c; }
.btn-bank-verify {
    appearance: none;
    border: 1px solid var(--line);
    background: #fff;
    color: #8a9490;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-bank-verify:hover {
    border-color: rgba(15, 106, 86, 0.35);
    color: var(--accent);
    background: rgba(15, 106, 86, 0.06);
}
.btn-bank-verify.is-verified {
    border-color: rgba(15, 106, 86, 0.45);
    background: rgba(15, 106, 86, 0.12);
    color: var(--accent);
}
.btn-bank-verify.is-busy {
    opacity: 0.55;
    pointer-events: none;
}
.bank-row-verified td { background: rgba(15, 106, 86, 0.03); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.invoice-items-toolbar-actions {
    margin-inline-start: auto;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.pre-invoice-picker-overlay {
    position: fixed;
    inset: 0;
    z-index: 12000;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.pre-invoice-picker-overlay[hidden] { display: none !important; }
.pre-invoice-picker-modal {
    width: min(720px, 100%);
    max-height: min(80vh, 640px);
    background: #fff;
    border-radius: 14px;
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.pre-invoice-picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    background: rgba(15, 106, 86, 0.06);
}
.pre-invoice-picker-head strong { color: var(--accent); }
.pre-invoice-picker-close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    color: var(--ink);
}
.pre-invoice-picker-close:hover { background: rgba(0, 0, 0, 0.06); }
.pre-invoice-picker-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}
.pre-invoice-picker-tools .search { flex: 1 1 220px; min-width: 180px; }
.pre-invoice-picker-body {
    overflow: auto;
    padding: 8px 0;
    flex: 1 1 auto;
}
.pre-invoice-picker-item {
    display: grid;
    grid-template-columns: 90px 1fr auto;
    gap: 8px 12px;
    width: 100%;
    text-align: right;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: #fff;
    padding: 12px 16px;
    cursor: pointer;
    font: inherit;
    color: inherit;
}
.pre-invoice-picker-item:hover { background: rgba(15, 106, 86, 0.08); }
.pre-invoice-picker-item .code { background: transparent; color: var(--accent); padding: 0; font-weight: 700; }
.pre-invoice-picker-item .meta { color: var(--muted); font-size: 0.85rem; }
.pre-invoice-picker-item .amount { font-weight: 700; white-space: nowrap; }
.pre-invoice-picker-empty { padding: 24px 16px; color: var(--muted); text-align: center; }
.search { min-width: 240px; }
.code { font-family: Consolas, monospace; background: #15231f; color: #d8ffe9; padding: 14px; border-radius: 14px; overflow: auto; }

/* فاکتورنویسی شبیه حمیدو */
.invoice-type-bar {
    display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px;
}
.type-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px; border-radius: 999px;
    background: rgba(255,255,255,0.55);
    border: 1px solid var(--line); color: var(--ink); font-size: 0.92rem;
    text-decoration: none;
    font: inherit;
    line-height: 1.3;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
}
button.type-chip {
    margin: 0;
    font-family: inherit;
    font-weight: inherit;
}
.type-chip:hover { border-color: var(--accent); color: var(--accent); }
.type-chip.active {
    background: var(--accent); color: #fff; border-color: transparent;
}
.type-chip.active.buy { background: var(--accent-2); }
.type-chip.active.waste { background: #7a5030; }
.type-chip.active.consign { background: #285a8c; }
.type-chip.ghost { background: transparent; }
.type-chip.drafts-chip {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #334155;
}
.type-chip.drafts-chip:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
    color: #0f172a;
}

/* پاپ‌آپ پیش‌نویس‌های موقت — فلت و مرتب */
.invoice-drafts-overlay {
    position: fixed;
    inset: 0;
    z-index: 12000;
    background: rgba(15, 23, 42, 0.38);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.invoice-drafts-overlay[hidden] { display: none !important; }
.invoice-drafts-modal {
    width: min(640px, 100%);
    max-height: min(78vh, 560px);
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.invoice-drafts-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}
.invoice-drafts-head strong {
    color: #0f172a;
    font-size: 1rem;
    font-weight: 700;
}
.invoice-drafts-close {
    width: 32px;
    height: 32px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    color: #64748b;
}
.invoice-drafts-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}
.invoice-drafts-body {
    overflow: auto;
    padding: 0;
    flex: 1 1 auto;
    background: #fff;
}
.invoice-drafts-empty {
    padding: 28px 16px;
    color: #64748b;
    text-align: center;
    font-size: 0.95rem;
}
.invoice-drafts-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    padding: 12px 16px;
    border-bottom: 1px solid #eef2f7;
    background: #fff;
}
.invoice-drafts-row:last-child { border-bottom: 0; }
.invoice-drafts-row:hover { background: #f8fafc; }
.invoice-drafts-row__main {
    min-width: 0;
    flex: 1 1 220px;
    text-align: right;
}
.invoice-drafts-row__title {
    color: #0f172a;
    font-weight: 700;
    font-size: 0.95rem;
}
.invoice-drafts-row__meta {
    margin-top: 4px;
    color: #64748b;
    font-size: 0.84rem;
    line-height: 1.6;
}
.invoice-drafts-row__actions {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
}
.invoice-drafts-row__actions .btn {
    min-height: 34px;
    padding: 0 12px;
    border-radius: 8px;
    box-shadow: none;
    font-size: 0.88rem;
}
.invoice-drafts-row__actions .btn.secondary {
    background: #fff;
    border: 1px solid #d0d5dd;
    color: #334155;
}
.invoice-drafts-row__actions .btn.secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}
.invoice-drafts-row__actions .btn.danger-ghost {
    background: #fff;
    border: 1px solid #fecaca;
    color: #b91c1c;
}
.invoice-drafts-row__actions .btn.danger-ghost:hover {
    background: #fef2f2;
}
.invoice-card { position: relative; }
.invoice-header-grid {
    display: grid; gap: 12px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.invoice-header-grid.is-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.invoice-party {
    margin-top: 14px;
    display: grid; gap: 10px;
    grid-template-columns: minmax(180px, 1.4fr) minmax(90px, 0.7fr) minmax(110px, 0.85fr) minmax(160px, 1.5fr) auto;
    align-items: end;
}
.invoice-party > label,
.invoice-party > .party-search {
    display: grid;
    gap: 6px;
    align-content: end;
}
.party-search-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
    min-width: 0;
}
.party-search-row .customer-picker {
    flex: 1 1 auto;
    min-width: 0;
}
.party-search-row .customer-note-btn {
    flex: 0 0 auto;
    align-self: center;
    width: 44px;
    height: 44px;
}
.party-search-row .customer-note-btn[hidden] {
    display: none !important;
}
.customer-note-btn {
    appearance: none;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: #334155;
    cursor: pointer;
    border: 2px solid #cbd5e1;
    padding: 0;
}
.customer-note-btn--positive {
    border-color: #16a34a;
    color: #15803d;
    background: #f0fdf4;
}
.customer-note-btn--negative {
    border-color: #dc2626;
    color: #b91c1c;
    background: #fef2f2;
}
.customer-note-btn--neutral {
    border-color: transparent;
    box-shadow: inset 0 0 0 1px #e2e8f0;
}
.customer-note-modal[hidden] { display: none !important; }
.customer-note-modal {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: grid;
    place-items: center;
    padding: 18px;
}
.customer-note-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}
.customer-note-modal__panel {
    position: relative;
    width: min(560px, 100%);
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
    padding: 16px 18px 18px;
}
.customer-note-modal__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.customer-note-modal__meta { margin-top: 10px; }
.customer-note-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.84rem;
    font-weight: 700;
    background: #f1f5f9;
    color: #334155;
}
.customer-note-pill.is-positive { background: #dcfce7; color: #166534; }
.customer-note-pill.is-negative { background: #fee2e2; color: #991b1b; }
.customer-note-modal__body {
    margin-top: 12px;
    white-space: pre-wrap;
    line-height: 1.8;
    color: #0f172a;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 14px;
    max-height: min(50vh, 360px);
    overflow: auto;
}
.party-add-wrap {
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    padding-bottom: 0;
    align-self: end;
}
.party-add-customer-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-width: 44px;
    height: 49px;
    padding: 0 !important;
    border-radius: 12px;
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    background: #30443c !important;
    color: #fff !important;
}
.invoice-party input[readonly] {
    background: rgba(15, 106, 86, 0.05);
    color: var(--ink);
    cursor: default;
}
.party-meta {
    padding: 12px 14px; border-radius: 12px;
    background: rgba(15, 106, 86, 0.06); border: 1px solid var(--line);
}
.lookup-wrap { position: relative; }
.party-search {
    min-width: 0;
}
.party-field-label {
    font-size: 0.92rem;
    color: var(--muted);
}
.customer-balance-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin-top: 8px;
    padding: 0 2px;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.35;
}
.customer-balance-row[hidden] { display: none !important; }
.customer-balance-row.is-bed .customer-balance-text { color: #b42318; }
.customer-balance-row.is-bes .customer-balance-text { color: #027a48; }
.customer-balance-row.is-clear .customer-balance-text { color: #667; }
.party-moein-btn {
    flex: 0 0 auto;
    padding: 4px 10px;
    font-size: 0.82rem;
    line-height: 1.3;
    border-radius: 8px;
    white-space: nowrap;
    background: rgba(15, 106, 86, 0.08) !important;
    color: #1a3d34 !important;
    border: 1px solid rgba(15, 106, 86, 0.28);
    box-shadow: none;
}
.party-moein-btn:hover {
    background: rgba(15, 106, 86, 0.14) !important;
    color: #0f2f28 !important;
}
.party-moein-btn[hidden] { display: none !important; }
.lookup-balance.is-bed { color: #b42318 !important; }
.lookup-balance.is-bes { color: #027a48 !important; }
.lookup-balance.is-clear { color: #667 !important; }
.lookup-item .lookup-balance {
    font-weight: 600;
    font-size: 0.85rem;
}
.customer-picker {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 4px 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    gap: 6px;
    box-sizing: border-box;
}
.customer-picker:focus-within {
    outline: 2px solid rgba(15, 106, 86, 0.25);
    outline-offset: 1px;
}
.customer-picker #customer-search {
    flex: 1;
    min-width: 0;
    width: 100%;
    border: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    background: transparent !important;
    padding: 7px 8px !important;
}
.customer-picker #customer-search[hidden] { display: none !important; }
.customer-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 5px 8px 5px 6px;
    border: 1.5px dashed rgba(15, 106, 86, 0.55);
    border-radius: 999px;
    background: rgba(15, 106, 86, 0.07);
    color: var(--ink);
    font-weight: 600;
    line-height: 1.3;
    cursor: default;
    outline: none;
}
.customer-chip[hidden] { display: none !important; }
.customer-chip.is-armed {
    border-style: solid;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(15, 106, 86, 0.18);
    background: rgba(15, 106, 86, 0.12);
}
.customer-chip-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
}
.customer-chip-clear {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 50%;
    background: rgba(15, 106, 86, 0.12);
    color: var(--accent);
    cursor: pointer;
    font: inherit;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
}
.customer-chip-clear:hover {
    background: rgba(198, 40, 40, 0.12);
    color: #c62828;
}
.lookup-list {
    position: absolute; top: calc(100% + 4px); right: 0; left: 0;
    background: #fff; border: 1px solid var(--line); border-radius: 12px;
    box-shadow: var(--shadow); max-height: 280px; overflow: auto; z-index: 30;
}
.lookup-list.lookup-floating {
    position: fixed;
    right: auto;
    margin: 0;
    z-index: 10000;
}
.lookup-list.customer-lookup-floating,
.lookup-list.product-lookup-floating {
    max-width: none;
    box-sizing: border-box;
}
.product-lookup.lookup-list:not(.product-lookup-floating) { max-width: 520px; }
.lookup-item {
    display: grid; gap: 2px; width: 100%; text-align: right;
    border: 0; border-bottom: 1px solid var(--line);
    background: #fff; padding: 10px 12px; cursor: pointer; font: inherit; color: inherit;
}
.lookup-item:hover,
.lookup-item.is-active { background: rgba(15, 106, 86, 0.08); }
.lookup-item span { color: var(--muted); font-size: 0.85rem; }
.lookup-empty { padding: 12px; color: var(--muted); }
.invoice-items input { padding: 8px 10px; border-radius: 10px; }
.invoice-items .btn-remove { padding: 6px 10px; min-width: 36px; }
.invoice-items-wrap { min-height: 220px; }

/* مقادیر فیلدها و سلول‌های فاکتور وسط‌چین؛ نام کالا مستثنی */
.invoice-entry input:not([type="hidden"]):not([type="checkbox"]):not(.product-input),
.invoice-entry select,
.invoice-entry textarea,
.invoice-entry .party-meta,
.invoice-entry .row-no,
.invoice-entry .invoice-items th,
.invoice-entry .invoice-items td,
.invoice-view th,
.invoice-view td,
.invoices-table th,
.invoices-table td {
    text-align: center !important;
}
.invoice-entry .product-input,
.invoice-entry .invoice-items th:nth-child(2),
.invoice-entry .invoice-items td:nth-child(2),
.invoice-view th:first-child,
.invoice-view td:first-child {
    text-align: right !important;
}
.invoice-entry label {
    text-align: right;
}

.totals-grid {
    display: grid; gap: 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.total-strong input {
    font-weight: 800; font-size: 1.15rem; color: var(--accent);
    background: rgba(15, 106, 86, 0.06);
}
.invoice-actions {
    margin-top: 16px; justify-content: space-between; align-items: center;
}
.check-inline {
    display: inline-flex; align-items: center; gap: 8px;
    color: var(--muted); flex-direction: row;
}
.check-inline input { width: auto; }
.nav-group { display: grid; gap: 0; margin: 0; }
.nav-group-title {
    font-size: 0.75rem;
    padding: 8px 14px 2px;
    letter-spacing: 0.02em;
}
.nav-group a { padding: 8px 14px; font-size: 0.9rem; }
/* تنظیمات صفحه — مشترک داشبورد / لیست‌ها */
.screen-meta-links {
    display: flex;
    justify-content: flex-start;
    margin: -8px 0 10px;
}
.screen-meta-toggle {
    appearance: none;
    border: 1px solid var(--line);
    border-bottom: 0;
    background: #fff;
    color: var(--muted);
    font: inherit;
    font-size: 0.86rem;
    padding: 7px 14px;
    border-radius: 10px 10px 0 0;
    cursor: pointer;
    line-height: 1.2;
}
.screen-meta-toggle:hover,
.screen-meta-toggle[aria-expanded="true"] {
    color: var(--accent);
    background: rgba(15, 106, 86, 0.06);
}
.screen-options-wrap {
    display: none;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--line);
    border-radius: 0 14px 14px 14px;
    padding: 16px 18px;
    margin: 0 0 14px;
    box-shadow: var(--shadow);
}
.screen-options-wrap.dashboard-screen-options {
    border-radius: 14px;
    margin-top: -6px;
}
.screen-options-wrap.is-open { display: block; }
.screen-options-wrap h5 {
    margin: 0 0 10px;
    font-size: 0.9rem;
    color: var(--ink);
}
.screen-options-cols {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin: 0 0 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}
.screen-options-cols label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--ink);
    font-size: 0.9rem;
    cursor: pointer;
}
.screen-options-cols input {
    width: 15px;
    height: 15px;
    margin: 0;
}
.screen-options-cols input:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}
.screen-options-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.screen-options-note {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.quick-invoice-grid {
    display: grid; gap: 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 16px;
}
.quick-invoice-grid a {
    display: grid; gap: 4px; padding: 16px;
    border-radius: var(--radius); border: 1px solid var(--line);
    background: var(--card); color: var(--ink); box-shadow: var(--shadow);
}
.quick-invoice-grid a strong { font-size: 1.05rem; }
.quick-invoice-grid a span { color: var(--muted); font-size: 0.85rem; }
.quick-invoice-grid a:hover { border-color: var(--accent); }

.dash-panels {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}
.dash-panel {
    min-height: 108px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
}
.dash-panel--a { background: #e8f3ef; border-color: #d5e8e0; }
.dash-panel--b {
    background: #f4efe6;
    border-color: #ebe3d4;
    align-items: stretch;
}
.dash-panel--c { background: #eef1f5; border-color: #dde3ea; }
.dash-panel--d { background: #f3ebe8; border-color: #e8dbd5; }

.dash-panel-links {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 0;
    row-gap: 8px;
    width: 100%;
    align-content: center;
}
.dash-panel-links::before {
    content: "";
    position: absolute;
    top: 2px;
    bottom: 2px;
    left: 50%;
    width: 1px;
    background: rgba(15, 106, 86, 0.16);
    pointer-events: none;
}
.dash-panel-links a {
    color: var(--ink);
    font-size: 0.92rem;
    font-weight: 500;
    line-height: 1.35;
    padding: 2px 14px;
    text-align: center;
    transition: color 0.15s ease;
}
.dash-panel-links a:hover {
    color: var(--accent);
}

.dash-sale-closed {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    min-width: 0;
    text-align: center;
}
.dash-sale-closed__count {
    margin: 0 0 8px;
    color: #334155;
    font-size: 0.84rem;
    line-height: 1.55;
}
.dash-sale-closed__count strong {
    color: #9a3412;
    font-weight: 800;
}
.dash-sale-closed__stage {
    position: relative;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dash-sale-closed__slide {
    position: absolute;
    inset-inline: 0;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .45s ease, transform .45s ease;
    pointer-events: none;
    padding: 0 4px;
}
.dash-sale-closed__slide.is-active {
    opacity: 1;
    transform: none;
    pointer-events: auto;
    position: relative;
}
.dash-sale-closed__slide.is-empty {
    color: #64748b;
    font-size: 0.82rem;
}
.dash-sale-closed__name {
    display: block;
    color: #0f172a;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dash-sale-closed__dur {
    display: block;
    margin-top: 2px;
    color: #9a3412;
    font-size: 0.78rem;
    font-weight: 600;
}
.dash-sale-closed__link {
    display: inline-block;
    margin-top: 8px;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
}
.dash-sale-closed__link:hover {
    text-decoration: underline;
}

.moein-outer-card {
    width: 90%;
    margin-inline: auto;
}
.moein-summary .card {
    text-align: center;
}
.moein-summary .card h3,
.moein-summary .card .value,
.moein-summary .card .muted {
    text-align: center;
}
.moein-table-wrap {
    width: 100%;
}
.moein-table {
    width: 100%;
}
.moein-table th,
.moein-table td {
    text-align: center !important;
}
.moein-table tfoot th {
    background: rgba(15, 106, 86, 0.08);
    color: var(--ink);
    font-weight: 700;
}
.moein-comment-btn {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 0;
    margin: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
    max-width: 22rem;
    white-space: nowrap;
}
.moein-comment-btn:hover { color: inherit; text-decoration: none; }
.moein-comment-modal[hidden] { display: none !important; }
.moein-comment-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(20, 28, 36, 0.45);
}
.moein-comment-dialog {
    width: min(560px, 100%);
    max-height: min(70vh, 520px);
    overflow: auto;
    background: #fff;
    color: var(--ink);
    border-radius: 14px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
    padding: 16px 18px 18px;
}
.moein-comment-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.moein-comment-body {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.8;
    text-align: right;
    font-size: 0.98rem;
}
@media print {
    .hamido-header, .topbar, .toolbar .btn, .invoice-type-bar { display: none !important; }
    .app-shell { display: block; }
    .content { padding: 0; display: block; }
    .content-panel {
        width: 100% !important;
        max-width: none;
        margin: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        padding: 0;
    }
    .card { box-shadow: none; border: 1px solid #ccc; }
}

.pagination {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 12px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line);
}
.pagination-links { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pagination-links .btn { min-width: 42px; padding: 8px 12px; }

@media (max-width: 980px) {
    .hamido-header-bar {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "brand user"
            "ribbon ribbon";
        min-height: 0;
        padding: 8px 10px 10px;
        row-gap: 8px;
    }
    .hamido-brand {
        border-left: 0;
        margin-left: 0;
        min-width: 0;
        padding: 0 2px;
    }
    .hamido-header-actions {
        margin-inline-start: 0;
    }
    .hamido-user {
        margin-inline-start: 0;
    }
    .hamido-user::before { display: none; }
    .hamido-ribbon {
        width: 100%;
        overflow-x: visible;
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 6px;
        padding: 8px 2px 2px;
        border-top: 1px solid rgba(26, 95, 140, 0.12);
        margin-top: 2px;
    }
    .hamido-ribbon-btn {
        flex: 1 1 calc(25% - 6px);
        min-width: 78px;
        max-width: calc(33.333% - 6px);
        padding: 8px 6px;
    }
    .hamido-ribbon-icon { width: 36px; height: 36px; }
    .hamido-ribbon-icon svg { width: 22px; height: 22px; }
    .hamido-ribbon-label { font-size: 0.74rem; white-space: normal; text-align: center; }
    .hamido-mega-col { min-width: 150px; }
    .hamido-mega-panel { max-width: min(94vw, 920px); }

    .content { padding: 16px 14px 24px; }
    .content-panel { padding: 16px 14px 18px; border-radius: 0; }
    .topbar { margin-bottom: 14px; }
    .topbar h1 { font-size: 1.25rem; }
    .grid.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid, .users-grid { grid-template-columns: 1fr; }
    .invoice-header-grid, .invoice-party, .totals-grid, .quick-invoice-grid {
        grid-template-columns: 1fr;
    }
    .dash-panels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .dash-panels { grid-template-columns: 1fr; }
    .grid.stats { grid-template-columns: 1fr; }
    .hamido-user { max-width: none; }
    .hamido-user-btn { width: auto; max-width: none; }
    .hamido-user-meta { display: none; }
    .hamido-user-caret { display: none; }
    .hamido-mega-col { min-width: 140px; max-width: 200px; }
    .hamido-ribbon-btn {
        flex: 1 1 calc(33.333% - 6px);
        max-width: calc(33.333% - 6px);
    }
    .hamido-view-toggle {
        font-size: 0.68rem;
        padding: 7px 8px;
    }
}

/* نسخه پشتیبان */
.backup-card { max-width: 920px; margin: 0 auto; }
.backup-tabs {
    display: flex;
    gap: 8px;
    margin: -6px 0 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}
.backup-tab {
    flex: 1;
    text-align: center;
    padding: 10px 14px;
    border-radius: 12px;
    color: var(--muted);
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid transparent;
    font-weight: 600;
}
.backup-tab.is-active {
    color: var(--accent);
    background: rgba(15, 106, 86, 0.08);
    border-color: rgba(15, 106, 86, 0.18);
}
.backup-hint { margin: 0 0 16px; line-height: 1.7; }
.backup-hint code {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.05);
    font-size: 0.86rem;
}
.backup-mode-list { display: grid; gap: 10px; margin-bottom: 14px; }
.backup-mode-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
}
.backup-mode-item input { width: auto; margin-top: 3px; }
.backup-mode-item strong { display: block; color: var(--ink); }
.backup-mode-item small { color: var(--muted); }
.backup-parts {
    border: 1px dashed rgba(15, 106, 86, 0.28);
    border-radius: 12px;
    padding: 12px 14px 6px;
    margin: 0 0 8px;
    background: rgba(15, 106, 86, 0.03);
}
.backup-parts:disabled { opacity: 0.45; }
.backup-parts legend {
    padding: 0 6px;
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 600;
}
.backup-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    color: var(--ink);
    cursor: pointer;
}
.backup-check input { width: auto; }
.backup-check small { display: block; color: var(--muted); font-weight: 400; }
.backup-file-field { display: grid; gap: 8px; margin-bottom: 14px; color: var(--muted); }
.backup-confirm { margin-bottom: 8px; }
.backup-tabs .backup-tab { font-size: 0.92rem; padding: 10px 8px; }
.backup-sep {
    border: 0;
    border-top: 1px solid rgba(15, 106, 86, 0.09);
    margin: 16px 0 14px;
}
.backup-archive-box {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}
.backup-archive-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.backup-archive-head h3 {
    margin: 0;
    font-size: 1.05rem;
}
.backup-total-size {
    color: #c62828;
    font-weight: 700;
    font-size: 0.92em;
    margin-inline-start: 6px;
}
.backup-per-page select {
    width: auto;
    min-width: 7.5rem;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    font-size: 0.9rem;
    cursor: pointer;
}
.backup-archive-empty { margin: 0; }
.backup-archive-table-wrap { margin-bottom: 12px; }
.backup-archive-table { width: 100%; font-size: 0.9rem; }
.backup-archive-table th,
.backup-archive-table td {
    padding: 9px 10px;
    vertical-align: middle;
}
.backup-archive-table .backup-col-check {
    width: 36px;
    text-align: center;
}
.backup-archive-table .backup-col-check input { width: auto; margin: 0; }
.backup-archive-table .backup-col-check input:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.backup-archive-table .backup-col-lock {
    width: 52px;
    text-align: center;
}
.backup-lock-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: #6b7c76;
    cursor: pointer;
}
.backup-lock-btn:hover {
    background: rgba(15, 106, 86, 0.08);
    color: var(--accent);
}
.backup-lock-btn.is-locked {
    color: #c62828;
}
.backup-lock-btn.is-locked:hover {
    background: rgba(198, 40, 40, 0.08);
    color: #b71c1c;
}
.backup-lock-icon {
    width: 18px;
    height: 18px;
    display: none;
}
.backup-lock-btn .backup-lock-open { display: block; }
.backup-lock-btn.is-locked .backup-lock-open { display: none; }
.backup-lock-btn.is-locked .backup-lock-closed { display: block; }
.backup-archive-table tr.is-locked td {
    background: rgba(198, 40, 40, 0.03);
}
.backup-file-link {
    color: var(--accent);
    font-weight: 600;
    word-break: break-all;
}
.backup-file-link:hover { text-decoration: underline; }
.backup-archive-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.backup-archive-actions { margin: 0; }
.backup-pager {
    display: flex;
    align-items: center;
    gap: 8px;
}
.backup-pager-info {
    min-width: 3.5rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}
.backup-pager-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
}
.backup-pager-btn:hover {
    border-color: rgba(15, 106, 86, 0.35);
    color: var(--accent);
}
.backup-pager-btn.is-disabled {
    opacity: 0.4;
    pointer-events: none;
    cursor: default;
}
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* تغییر رمز */
.password-page {
    min-height: calc(100vh - 220px);
    display: grid;
    place-items: center;
    padding: 12px 8px 32px;
}
.password-card {
    width: min(480px, 100%);
    margin: 0 auto;
}
.password-form {
    display: grid;
    gap: 14px;
}
.password-field {
    position: relative;
    display: block;
}
.password-field input {
    width: 100%;
    padding-inline-end: 44px;
}
.password-eye {
    appearance: none;
    position: absolute;
    inset-inline-end: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: 0;
    background: transparent;
    color: var(--muted, #6b7c76);
    cursor: pointer;
    display: inline-grid;
    place-items: center;
    padding: 0;
    opacity: 0.7;
}
.password-eye:hover {
    opacity: 1;
    color: var(--accent);
}
.password-eye .eye-on { display: none; }
.password-eye .eye-off { display: block; }
.password-eye.is-off .eye-on { display: none; }
.password-eye.is-off .eye-off { display: block; }
.password-eye:not(.is-off) .eye-on { display: block; }
.password-eye:not(.is-off) .eye-off { display: none; }
.password-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}
.password-actions .btn { min-width: 160px; }
.password-hint {
    text-align: center;
    margin: 14px 0 0;
}
.password-match-msg {
    margin: -4px 0 0;
    font-size: 0.9rem;
    text-align: center;
}
.password-match-msg.is-ok { color: var(--ok); }
.password-match-msg.is-bad { color: var(--err); }
#new-password-confirm.is-match {
    border-color: rgba(20, 122, 69, 0.55);
    box-shadow: 0 0 0 3px rgba(20, 122, 69, 0.12);
}
#new-password-confirm.is-mismatch {
    border-color: rgba(161, 40, 40, 0.55);
    box-shadow: 0 0 0 3px rgba(161, 40, 40, 0.12);
}

/* ???? ????? ???? + ????? */
.date-fa-field {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 0;
    width: 100%;
    min-width: 0;
}
.date-fa-field > input.date-fa {
    flex: 1 1 auto;
    min-width: 0;
    border-start-end-radius: 0;
    border-end-end-radius: 0;
    text-align: center;
    letter-spacing: 0.02em;
}
.date-fa-trigger {
    appearance: none;
    flex: 0 0 42px;
    width: 42px;
    border: 1px solid var(--line);
    border-inline-start: 0;
    border-radius: 12px;
    border-start-start-radius: 0;
    border-end-start-radius: 0;
    background: #fff;
    color: var(--accent);
    cursor: pointer;
    display: inline-grid;
    place-items: center;
    padding: 0;
}
.date-fa-trigger:hover {
    background: rgba(15, 106, 86, 0.08);
}
.date-fa-trigger svg {
    width: 18px;
    height: 18px;
    display: block;
}
.date-fa-pop {
    position: fixed;
    z-index: 12000;
    min-width: 260px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow, 0 10px 30px rgba(0,0,0,.12));
}
.date-fa-pop[hidden] { display: none !important; }
.date-fa-pop-row {
    display: grid;
    grid-template-columns: 1.1fr 1.3fr 0.9fr;
    gap: 8px;
    margin-bottom: 10px;
}
.date-fa-pop-row select {
    width: 100%;
    padding: 8px 10px;
    border-radius: 10px;
}
.date-fa-pop-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-start;
}
.date-fa-pop-actions .btn {
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.9rem;
}

/* ???? ???? HH:MM */
.time-hm-wrap {
    display: grid;
    gap: 6px;
    width: 100%;
    min-width: 0;
}
.time-hm-wrap > input.time-hm {
    width: 100%;
    text-align: center;
    letter-spacing: 0.04em;
}
input.time-hm.is-invalid {
    border-color: rgba(161, 40, 40, 0.7) !important;
    box-shadow: 0 0 0 3px rgba(161, 40, 40, 0.12);
    background: rgba(161, 40, 40, 0.04);
}
.time-hm-error {
    color: var(--err, #a12828);
    font-size: 0.82rem;
    line-height: 1.35;
}

.lookup-item.is-active:focus { outline: none; }
.pre-invoice-picker-item.is-active {
    background: rgba(15, 106, 86, 0.08);
}
