@font-face {
    font-family: devix;
    font-style: normal;
    font-weight: 400;
    src: url('fonts/woff/YekanBakhFaNum-Regular.woff') format('woff'),url('fonts/woff2/YekanBakhFaNum-Regular.woff2') format('woff2')
}

@font-face {
    font-family: devix;
    font-style: normal;
    font-weight: 600;
    src: url('fonts/woff/YekanBakhFaNum-SemiBold.woff') format('woff'),url('fonts/woff2/YekanBakhFaNum-SemiBold.woff2') format('woff2')
}

@font-face {
    font-family: devix;
    font-style: normal;
    font-weight: 700;
    src: url('fonts/woff/YekanBakhFaNum-Bold.woff') format('woff'),url('fonts/woff2/YekanBakhFaNum-Bold.woff2') format('woff2')
}
:root {
    --bg: #f7f7f8;
    --card: #fff;
    --text: #111827;
    --muted: #6b7280;
    --line: #e5e7eb;
    --primary: #3254a5;
    --danger: #b91c1c;
    --ok: #047857;
    --shadow: 0 8px 24px rgba(15,23,42,.06)
}

* {
    box-sizing: border-box
}

html {
    font-size: 16px
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: devix, system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
    line-height: 1.7;
    padding-bottom: 76px
}

a {
    color: inherit;
    text-decoration: none
}

img {
    max-width: 100%;
    height: auto
}

button,input,select,textarea {
    font: inherit
}

h1,h2,h3,p {
    margin-top: 0
}

h1 {
    font-size: 1.35rem
}

h2 {
    font-size: 1.05rem
}

.container {
    width: min(100%,760px);
    margin: 0 auto;
    padding: 14px
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,.94);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    padding: 10px 14px
}

.brand {
    font-weight: 900;
    font-size: 1.35rem;
    display: flex;
}

.top-actions {
    display: flex;
    gap: 8px;
    align-items: center
}

.icon-link {
    font-size: .85rem;
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    position: relative
}

.dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    background: var(--danger);
    color: #fff;
    border-radius: 999px;
    font-size: .7rem;
    margin-inline-start:4px}

.bottom-nav {
    position: fixed;
    z-index: 20;
    right: 0;
    left: 0;
    bottom: 0;
    display: grid;
    grid-auto-flow: column;
    gap: 2px;
    background: #fff;
    border-top: 1px solid var(--line);
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 24px rgba(15,23,42,.04)
}

.bottom-nav a {
    text-align: center;
    font-size: .85rem;
    padding: 8px 4px;
    border-radius: 12px
}

.bottom-nav a:active,.bottom-nav a:hover {
    background: #f3f4f6
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 12px
}

.compact {
    padding: 14px
}

.inner {
    box-shadow: none;
    background: #fafafa
}

.auth-card {
    margin-top: 7vh
}

.center {
    text-align: center
}

.muted {
    color: var(--muted);
    font-size: .92rem
}

.stack {
    display: flex;
    gap: 12px;
    width: 100%;
    flex-direction: column;
}

.field {
    display: grid;
    gap: 5px;
    width: 100%;
}

.field label,.copy-label {
    font-weight: 700;
    font-size: .9rem
}

.field input,.field textarea,.field select,.copy-input,.search input,.search select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    color: var(--text);
    padding: 12px;
    min-height: 46px
}

.field textarea {
    resize: vertical
}

.field small {
    color: var(--muted)
}

.error {
    color: var(--danger)!important
}

.has-error input,.has-error textarea,.has-error select {
    border-color: var(--danger)
}

.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border: 0;
    border-radius: 14px;
    background: var(--primary);
    color: #fff;
    padding: 12px 15px;
    min-height: 46px;
    font-weight: 800;
    cursor: pointer
}

.btn-light {
    background: #f3f4f6;
    color: var(--text);
    border: 1px solid var(--line)
}

.btn-danger {
    background: var(--danger)
}

.btn.small {
    min-height: 34px;
    padding: 7px 11px;
    font-size: .85rem;
    border-radius: 10px
}

.full {
    width: 100%
}

.link {
    display: block;
    text-align: center;
    margin-top: 14px;
    color: #374151;
    font-weight: 700
}

.row {
    display: flex;
    align-items: center
}

.between {
    justify-content: space-between
}

.gap {
    gap: 10px
}

.grow {
    flex: 1
}

.mt {
    margin-top: 12px
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px
}

.page-head h1 {
    margin: 0
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 10px;
    margin-bottom: 12px
}

.stat {
    margin: 0
}

.stat span {
    color: var(--muted);
    font-size: .85rem
}

.stat strong {
    display: block;
    font-size: 1.25rem;
    margin-top: 4px
}

.grid-actions {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 8px
}

.cards {
    display: grid;
    gap: 10px
}

.badge {
    display: inline-flex;
    border-radius: 999px;
    background: #f3f4f6;
    border: 1px solid var(--line);
    padding: 4px 8px;
    font-size: .78rem;
    font-weight: 800
}

.badge-ok {
    background: #ecfdf5;
    color: var(--ok);
    border-color: #a7f3d0
}

.badge-payment {
    background: #eff6ff
}

.kv {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 8px;
    border-top: 1px dashed var(--line);
    padding: 9px 0
}

.kv span {
    color: var(--muted)
}

.list-row {
    display: block;
    padding: 10px 0;
    border-top: 1px solid var(--line)
}

.list-row:first-of-type {
    border-top: 0
}

.list-row span {
    display: block;
    font-weight: 800
}

.list-row small {
    display: block;
    color: var(--muted)
}

.search {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    box-shadow: none
}

.search select {
    grid-column: 1/-1
}

.message {
    border-radius: 14px;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: #eff6ff;
    border: 1px solid #bfdbfe
}

.message.success {
    background: #ecfdf5;
    border-color: #a7f3d0
}

.message.error {
    background: #fef2f2;
    border-color: #fecaca
}

.quick-services {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px
}

.chip {
    white-space: nowrap;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 999px;
    padding: 7px 10px
}

.invoice-item {
    border: 1px dashed var(--line);
    border-radius: 16px;
    padding: 12px;
    margin-top: 10px;
    background: #fff
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: .88rem
}

.invoice-table th,.invoice-table td {
    border-bottom: 1px solid var(--line);
    padding: 8px 4px;
    text-align: right;
    vertical-align: top
}

.totals {
    display: grid;
    gap: 6px;
    margin-top: 10px
}

.totals div {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px dashed var(--line);
    padding: 6px 0
}

.totals .grand {
    font-size: 1.1rem;
    border-bottom: 0
}

.amount {
    font-size: 1.8rem;
    font-weight: 900
}

.qr-box {
    display: grid;
    place-items: center;
    border: 1px dashed var(--line);
    border-radius: 18px;
    padding: 12px;
    margin: 14px 0;
    background: #fafafa
}

.qr-box img {
    width: 180px;
    height: 180px;
    image-rendering: pixelated
}

.unread {
    border-color: #93c5fd
}

.rating-form ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(5,1fr);
    gap: 7px
}

.rating-form li label {
    display: block;
    text-align: center;
    background: #f3f4f6;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 4px
}

.datepicker {
    position: fixed;
    inset: auto 12px 12px 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: 0 20px 40px rgba(15,23,42,.2);
    padding: 14px;
    z-index: 50
}

.datepicker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px
}

.datepicker-grid {
    display: grid;
    grid-template-columns: repeat(7,1fr);
    gap: 4px
}

.datepicker button {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 10px;
    min-height: 38px
}

.datepicker .day-name {
    color: var(--muted);
    font-size: .8rem;
    text-align: center
}

.print-body {
    padding-bottom: 0;
    background: #fff
}

.print-body .topbar,.print-body .bottom-nav {
    display: none
}

@media (min-width: 640px) {
    .stats-grid {
        grid-template-columns:repeat(3,minmax(0,1fr))
    }

    .grid-actions {
        grid-template-columns: repeat(4,minmax(0,1fr))
    }

    .search {
        grid-template-columns: 1fr 180px auto
    }

    .search select {
        grid-column: auto
    }

    .bottom-nav {
        right: 50%;
        transform: translateX(50%);
        width: min(760px,100%);
        border-radius: 20px 20px 0 0
    }

    .container {
        padding: 18px
    }
}

@media print {
    body {
        background: #fff;
        padding: 0
    }

    .card {
        box-shadow: none;
        border: 0
    }

    .btn,.bottom-nav,.topbar {
        display: none!important
    }

    .container {
        width: 100%;
        padding: 0
    }

    .invoice-table th,.invoice-table td {
        border: 1px solid #ddd;
        padding: 6px
    }
}

.step-card {
    position: relative;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    width: 100%;
}

.step-card.is-primary {
    border-color: #c7d2fe;
    background: linear-gradient(180deg,#fff,#f8fafc)
}

.step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-weight: 900;
    margin-bottom: 10px
}

.quick-invoice .page-head {
    align-items: flex-start
}

.quick-invoice h2,.quick-invoice h3 {
    margin-bottom: 8px
}

.two-col {
    display: grid;
    gap: 12px
}

.field-address,.field-customer_notes {
    grid-column: 1/-1
}

.lookup-status {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px 12px;
    background: #f9fafb;
    font-size: .9rem
}

.lookup-status.found {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
    font-weight: 800
}

.lookup-status.new {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
    font-weight: 800
}

.lookup-status.loading {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8
}

.lookup-status.error {
    background: #fef2f2;
    border-color: #fecaca;
    color: var(--danger)
}

.history-box {
    margin-top: -4px
}

.mini-list {
    display: grid;
    gap: 6px;
    margin-top: 8px
}

.mini-row {
    border-top: 1px dashed var(--line);
    padding: 8px 0
}

.mini-row:first-child {
    border-top: 0
}

.mini-row strong,.mini-row small {
    display: block
}

.mini-row small {
    color: var(--muted);
    font-size: .84rem
}

.no-shadow {
    box-shadow: none
}

.totals-form {
    margin-top: 12px
}

.sticky-submit {
    position: sticky;
    bottom: 72px;
    z-index: 15;
    background: rgba(247,247,248,.92);
    backdrop-filter: blur(10px);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 10px;
    display: grid;
    gap: 6px;
    box-shadow: 0 10px 30px rgba(15,23,42,.12)
}

@media (min-width: 640px) {
    .two-col {
        grid-template-columns:repeat(2,minmax(0,1fr))
    }

    .sticky-submit {
        bottom: 82px
    }

    .quick-invoice .page-head {
        align-items: center
    }
}
