/* =========================================================================
   Page-level layouts of the v2 UI: dashboard, orders list, order workspace.
   ========================================================================= */

.tone-brand { --tc: var(--brand); --tb: var(--brand-50); }
.tone-amber { --tc: var(--amber); --tb: var(--amber-50); }
.tone-blue { --tc: var(--blue); --tb: var(--blue-50); }
.tone-green { --tc: var(--green); --tb: var(--green-50); }
.tone-red { --tc: var(--red); --tb: var(--red-50); }
.tone-violet { --tc: var(--violet); --tb: var(--violet-50); }
.tone-teal { --tc: var(--teal); --tb: var(--teal-50); }
.tone-slate { --tc: var(--slate); --tb: var(--slate-50); }

/* =============================================================== dashboard */
.dx-top { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.25rem; margin-bottom: 1.25rem; }
.dx-welcome { position: relative; overflow: hidden; background: #fff; border-radius: 26px; padding: 1.9rem 2.1rem; box-shadow: var(--shadow); }
.dx-welcome::after { content: ''; position: absolute; inset-inline-end: -90px; top: -90px; width: 300px; height: 300px; border-radius: 50%; background: radial-gradient(circle, rgba(196, 154, 74, .22), transparent 68%); pointer-events: none; }
.dx-eyebrow { display: inline-flex; align-items: center; gap: .4rem; background: var(--brand-50); color: var(--brand-600); font-weight: 700; font-size: .78rem; padding: .25rem .8rem; border-radius: 99px; }
.dx-welcome h1 { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; margin: .8rem 0 .3rem; }
.dx-welcome p { color: var(--muted); font-size: 1.02rem; margin: 0 0 1.3rem; max-width: 40rem; }
.dx-welcome p b { color: var(--text); }
.dx-actions { display: flex; flex-wrap: wrap; gap: .6rem; position: relative; z-index: 1; }
.dx-actions .btn-lg { --bs-btn-padding-y: .62rem; font-size: .95rem; }

.dx-clock { position: relative; overflow: hidden; border-radius: 26px; padding: 1.5rem 1.6rem; color: #fff; background: linear-gradient(150deg, #2f1d10 0%, #5a3519 55%, #94582f 135%); box-shadow: 0 24px 44px -24px rgba(58, 32, 14, .85); display: flex; flex-direction: column; }
.dx-clock::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(115deg, rgba(255, 255, 255, .04) 0 2px, transparent 2px 20px); pointer-events: none; }
.dx-clock > * { position: relative; }
.dxc-time { font-size: 3.4rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; direction: ltr; display: inline-block; }
.dxc-sec { position: absolute; inset-inline-end: 1.4rem; top: 1.6rem; font-size: 1.15rem; opacity: .55; font-weight: 700; direction: ltr; }
.dxc-date { margin-top: .75rem; font-weight: 700; font-size: 1.02rem; }
.dxc-hijri { opacity: .72; font-size: .88rem; }
.dxc-foot { margin-top: auto; padding-top: 1rem; display: grid; gap: .3rem; font-size: .82rem; color: rgba(255, 255, 255, .8); }
.dxc-foot span { display: flex; align-items: center; gap: .45rem; }
.dxc-foot b { margin-inline-start: auto; background: rgba(255, 255, 255, .16); border-radius: 99px; padding: 0 .6rem; }

/* KPI tiles — one fixed anatomy so every card lines up: [icon + label] / value / description */
.dx-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kt { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: 2.75rem 2.6rem minmax(2.4rem, auto); grid-template-areas: 'ic l' 'v v' 'd d'; align-items: center; column-gap: .7rem; row-gap: .35rem; padding: 1.05rem 1.15rem 1rem; border-radius: 22px; background: linear-gradient(160deg, var(--tb, var(--slate-50)) 0%, #fff 78%); box-shadow: var(--shadow-sm), 0 0 0 1px color-mix(in srgb, var(--tc, var(--slate)) 12%, transparent); color: inherit; transition: transform .18s, box-shadow .18s; overflow: hidden; container-type: inline-size; text-align: start; }
a.kt:hover { transform: translateY(-3px); box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--tc, var(--slate)) 28%, transparent); color: inherit; }
.kt-ic { grid-area: ic; width: 2.6rem; height: 2.6rem; border-radius: 14px; background: var(--tc, var(--slate)); color: #fff; display: grid; place-items: center; font-size: 1.15rem; box-shadow: 0 10px 18px -10px var(--tc, var(--slate)); }
.kt-l { grid-area: l; font-weight: 700; color: #4a4540; font-size: .9rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kt-v { grid-area: v; align-self: end; display: flex; align-items: baseline; gap: .3rem; font-size: 2rem; font-weight: 800; letter-spacing: -.02em; line-height: 1; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.kt-v.is-money { font-size: 1.75rem; }
.kt-u { font-size: .8rem; font-weight: 700; color: var(--muted); letter-spacing: 0; }
@container (max-width: 215px) { .kt-v.is-money { font-size: 1.45rem; } }
@container (max-width: 180px) { .kt-v { font-size: 1.7rem; } .kt-v.is-money { font-size: 1.3rem; } }
.kt-d { grid-area: d; align-self: start; color: var(--muted); font-size: .8rem; line-height: 1.45; display: flex; align-items: center; gap: .1rem .4rem; flex-wrap: wrap; }
.kt-trend { display: inline-flex; align-items: center; font-weight: 800; border-radius: 99px; padding: 0 .4rem 0 .5rem; font-size: .76rem; }
.kt-trend.up { background: var(--green-50); color: var(--green); }
.kt-trend.down { background: var(--red-50); color: var(--red); }
.kt.is-alert { box-shadow: var(--shadow-sm), 0 0 0 1.5px color-mix(in srgb, var(--red) 45%, transparent); }
.kt.is-alert .kt-v { color: var(--red); }
.kt.is-alert .kt-ic { animation: ktPulse 2.4s infinite; }
@keyframes ktPulse { 0%, 100% { box-shadow: 0 10px 18px -10px var(--tc, red), 0 0 0 0 rgba(209, 66, 59, .4); } 50% { box-shadow: 0 10px 18px -10px var(--tc, red), 0 0 0 8px rgba(209, 66, 59, 0); } }

/* dashboard cards grid */
.dx-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; }
.dx-card { background: #fff; border-radius: 24px; padding: 1.3rem 1.4rem 1.2rem; box-shadow: var(--shadow); min-width: 0; }
.dx-span-12 { grid-column: span 12; } .dx-span-8 { grid-column: span 8; } .dx-span-7 { grid-column: span 7; } .dx-span-5 { grid-column: span 5; } .dx-span-4 { grid-column: span 4; }
.dx-h { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .9rem; }
.dx-h h2 { font-size: 1.08rem; font-weight: 800; margin: 0; display: flex; align-items: center; gap: .6rem; }
.dx-h small { color: var(--muted); display: block; margin-top: .1rem; font-size: .78rem; font-weight: 500; }
.dx-h > div:first-child small { margin-inline-start: 2.95rem; }
.dx-h-ic { width: 2.35rem; height: 2.35rem; border-radius: 13px; display: inline-grid; place-items: center; background: var(--tb); color: var(--tc); font-size: 1.05rem; flex: none; }
.dx-link { font-weight: 700; font-size: .84rem; color: var(--brand-600); display: inline-flex; align-items: center; gap: .3rem; }
.dx-link:hover { color: var(--brand); }

/* order lines — a real grid: every row shares the same columns, cells are centred under their heading */
.ol-list { --ol-cols: 2.7rem minmax(0, 1.6fr) minmax(8rem, .9fr) minmax(5.5rem, .5fr) 1rem; display: grid; gap: .15rem; }
.ol-list.has-money { --ol-cols: 2.7rem minmax(0, 1.6fr) minmax(8rem, .9fr) minmax(6rem, .6fr) minmax(5.5rem, .5fr) 1rem; }
.ol-2col { --ol-cols: 2.7rem minmax(0, 1fr) auto 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1.2rem; }
.ol-head, .ol { display: grid; grid-template-columns: var(--ol-cols); align-items: center; column-gap: .85rem; }
.ol-head { padding: .5rem .75rem; margin-bottom: .2rem; border-radius: 12px; background: var(--surface-2); color: var(--muted); font-size: .74rem; font-weight: 800; text-align: center; }
.ol-head > :nth-child(2) { text-align: start; }
.ol { padding: .65rem .75rem; border-radius: 16px; color: inherit; transition: background .15s; min-height: 4rem; }
.ol:hover { background: var(--surface-2); color: inherit; }
.ol + .ol { border-top: 1px solid rgba(60, 40, 20, .05); }
.ol-ic { width: 2.6rem; height: 2.6rem; border-radius: 14px; display: grid; place-items: center; background: var(--tb, var(--slate-50)); color: var(--tc, var(--slate)); font-size: 1.15rem; }
.ol-main { min-width: 0; display: grid; line-height: 1.4; }
.ol-main b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ol-main small { color: var(--muted); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ol-stage, .ol-money, .ol-duecell { display: flex; align-items: center; justify-content: center; text-align: center; min-width: 0; }
.ol-money { font-weight: 700; color: #4a4540; font-size: .88rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ol-due { display: inline-flex; align-items: center; justify-content: center; gap: .3rem; min-width: 5.2rem; font-size: .78rem; font-weight: 700; border-radius: 99px; padding: .25rem .65rem; white-space: nowrap; }
.ol-due-ok { background: var(--slate-50); color: var(--slate); }
.ol-due-soon { background: var(--amber-50); color: var(--amber); }
.ol-due-late { background: var(--red-50); color: var(--red); }
.ol-go { color: var(--faint); font-size: .8rem; transition: transform .15s; justify-self: center; }
.ol:hover .ol-go { transform: translateX(-3px); color: var(--brand); }
.ol .pill { white-space: nowrap; }
.dx-h .dx-title-link { color: inherit; display: inline-flex; align-items: center; gap: .6rem; }
.dx-h .dx-title-link:hover { color: var(--brand-600); }

/* production pipeline */
.pipe { display: grid; gap: .35rem; }
.pipe-row { display: flex; align-items: center; gap: .8rem; padding: .6rem .5rem; border-radius: 16px; color: inherit; transition: background .15s; }
.pipe-row:hover { background: var(--surface-2); color: inherit; }
.pipe-ic { width: 2.5rem; height: 2.5rem; border-radius: 14px; background: var(--tb); color: var(--tc); display: grid; place-items: center; font-size: 1.1rem; flex: none; }
.pipe-main { flex: 1; min-width: 0; }
.pipe-l { display: block; font-weight: 700; font-size: .9rem; margin-bottom: .35rem; }
.pipe-l em { font-style: normal; color: var(--red); font-size: .72rem; font-weight: 700; background: var(--red-50); border-radius: 99px; padding: 0 .5rem; margin-inline-start: .3rem; }
.pipe-bar { display: block; height: 7px; background: var(--slate-50); border-radius: 99px; overflow: hidden; }
.pipe-bar i { display: block; height: 100%; border-radius: 99px; background: var(--tc); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.pipe-n { font-size: 1.5rem; font-weight: 800; min-width: 2rem; text-align: end; }

/* activity feed */
.act { list-style: none; padding: 0; margin: 0; display: grid; gap: .1rem; position: relative; }
.act li { display: flex; align-items: flex-start; gap: .8rem; padding: .55rem .35rem; border-radius: 14px; position: relative; }
.act li:hover { background: var(--surface-2); }
.act-dot { width: .7rem; height: .7rem; border-radius: 50%; margin-top: .45rem; background: var(--faint); flex: none; box-shadow: 0 0 0 4px var(--slate-50); }
.act-ok .act-dot { background: var(--green); box-shadow: 0 0 0 4px var(--green-50); }
.act-bad .act-dot { background: var(--red); box-shadow: 0 0 0 4px var(--red-50); }
.act-info .act-dot { background: var(--blue); box-shadow: 0 0 0 4px var(--blue-50); }
.act-body { flex: 1; min-width: 0; display: grid; color: inherit; font-size: .88rem; line-height: 1.4; }
.act-body small { color: var(--muted); font-size: .76rem; }
.act-body:hover { color: inherit; }
.act-time { color: var(--faint); font-size: .74rem; white-space: nowrap; padding-top: .15rem; }
.split-stats { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: .75rem; }
.split-stats > div { background: var(--surface-2); border-radius: 14px; padding: .65rem .85rem; }
.split-stats small { display: block; color: var(--muted); font-size: .74rem; }
.split-stats b { font-size: .95rem; }
.chart-box.lg { height: 300px; }

@media (max-width: 1199.98px) {
    .dx-top { grid-template-columns: 1fr; }
    .dx-clock { flex-direction: row; align-items: center; flex-wrap: wrap; gap: .4rem 1.5rem; padding: 1.1rem 1.4rem; }
    .dxc-time { font-size: 2.5rem; } .dxc-sec { position: static; } .dxc-foot { display: none; }
    .dx-span-8, .dx-span-7, .dx-span-5, .dx-span-4 { grid-column: span 12; }
    .ol-2col { grid-template-columns: 1fr; }
}
@media (max-width: 767.98px) {
    .dx-welcome { padding: 1.3rem 1.2rem; border-radius: 22px; } .dx-welcome h1 { font-size: 1.5rem; }
    .dx-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
    .kt { padding: .85rem .9rem; border-radius: 18px; min-width: 0; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: 2.4rem 2.2rem minmax(2.2rem, auto); column-gap: .5rem; }
    .kt-ic { width: 2.2rem; height: 2.2rem; border-radius: 12px; font-size: 1rem; }
    .kt-l { font-size: .8rem; }
    .kt-v { font-size: 1.6rem; } .kt-v.is-money { font-size: 1.2rem; }
    .dx-card { padding: 1.05rem 1rem; border-radius: 20px; }
    .ol-head { display: none; }
    .ol-list, .ol-list.has-money { --ol-cols: 2.6rem minmax(0, 1fr) auto 1rem; }
    .ol .ol-stage, .ol .ol-money { display: none; }
    .dx-actions .btn-lg { flex: 1 1 100%; }
    .dx-h > div:first-child small { margin-inline-start: 0; }
}

/* ===================================================== order workspace (form) */
.wk-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.4rem; align-items: start; }
@media (min-width: 1200px) { .wk-layout.has-rail { grid-template-columns: minmax(0, 1fr) 320px; } }
.wk-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.1rem; min-width: 0; }
.wk-main > * { min-width: 0; }

.wk-type { background: #fff; border-radius: 24px; padding: 1.1rem 1.3rem 1.2rem; box-shadow: var(--shadow); }
.wk-type-h { font-weight: 800; margin-bottom: .75rem; display: flex; align-items: center; gap: .5rem; }
.wk-type-h i { color: var(--brand); }
.tseg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
.tchip { position: relative; cursor: pointer; display: flex; align-items: center; gap: .8rem; padding: .85rem 1rem; border-radius: 18px; background: var(--surface-2); border: 2px solid transparent; transition: all .18s; height: 100%; }
.tchip:hover { background: #fff; border-color: var(--brand-100); transform: translateY(-2px); box-shadow: var(--shadow); }
.tchip .ti { width: 2.9rem; height: 2.9rem; border-radius: 15px; background: #fff; color: var(--brand); display: grid; place-items: center; font-size: 1.45rem; flex: none; box-shadow: var(--shadow-sm); transition: all .18s; }
.tchip .tt { font-weight: 800; line-height: 1.25; }
.tchip .tick { position: absolute; inset-inline-end: .7rem; top: .6rem; color: var(--brand); opacity: 0; transform: scale(.5); transition: all .18s; }
.btn-check:checked + .tchip { background: var(--brand-50); border-color: var(--brand); box-shadow: 0 0 0 4px rgba(148, 88, 47, .12); }
.btn-check:checked + .tchip .ti { background-image: var(--brand-grad); color: #fff; }
.btn-check:checked + .tchip .tick { opacity: 1; transform: none; }
.btn-check:focus-visible + .tchip { outline: 2px solid var(--brand); outline-offset: 2px; }

.wk-sec { background: #fff; border-radius: 24px; padding: 1.25rem 1.5rem 1.5rem; box-shadow: var(--shadow); scroll-margin-top: 90px; animation: wkIn .35s ease both; }
@keyframes wkIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .wk-sec { animation: none; } }
.wk-h { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.wk-h h3 { font-size: 1.12rem; font-weight: 800; margin: 0; }
.wk-n { width: 2rem; height: 2rem; border-radius: 11px; background-image: var(--brand-grad); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .88rem; box-shadow: 0 8px 14px -8px rgba(110, 62, 30, .8); flex: none; }
.wk-hint { color: var(--muted); font-size: .8rem; }
.wk-ok { margin-inline-start: auto; color: var(--green); font-weight: 700; font-size: .8rem; display: inline-flex; align-items: center; gap: .3rem; background: var(--green-50); border-radius: 99px; padding: .15rem .7rem; }

/* flatten the old paper-style blocks: titles instead of boxes */
.wk-sec .spec-block { border: 0; padding: 0; background: transparent; margin-bottom: 1.4rem; border-radius: 0; }
.wk-sec .spec-block + .spec-block { padding-top: 1.2rem; border-top: 1px dashed var(--border-strong); }
.wk-sec .spec-title { font-size: .86rem; color: var(--brand-600); font-weight: 800; display: flex; align-items: center; gap: .45rem; margin-bottom: .8rem; }
.spec-row { background: var(--surface-2); border: 0; border-radius: 16px; }

/* one real table: header once, each added fabric is just another line */
.sp-tw { background: var(--surface-2); border-radius: 18px; padding: .3rem .5rem .5rem; }
.sp-table { width: 100%; min-width: 640px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.sp-table th { font-size: .74rem; font-weight: 800; color: var(--muted); padding: .65rem .35rem .4rem; text-align: start; white-space: nowrap; }
.sp-table td { padding: .22rem .3rem; vertical-align: top; }
.sp-table tbody tr + tr td { border-top: 1px solid rgba(60, 40, 20, .06); padding-top: .4rem; }
.sp-table .c-n { width: 2.6rem; text-align: center; }
.sp-table .c-x { width: 2.6rem; text-align: center; }
.sp-table th:nth-child(2) { width: 16%; } .sp-table th:nth-child(3) { width: 14%; }
.sp-table th:nth-child(4) { width: 22%; } .sp-table th:nth-child(5) { width: 13%; }
.sp-table .form-control { background: #fff; padding-block: .5rem; font-size: .9rem; }
.sp-table textarea.form-control { resize: none; overflow: hidden; line-height: 1.5; min-height: 2.7rem; white-space: pre-wrap; word-break: break-word; display: block; }
.sg-pop { position: absolute; inset-inline: .3rem; top: calc(100% - .1rem); z-index: 30; background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); padding: .3rem; max-height: 220px; overflow-y: auto; min-width: 11rem; }
.sg-pop[hidden] { display: none; }
.sg-item { display: block; width: 100%; text-align: start; border: 0; background: transparent; padding: .45rem .7rem; border-radius: 10px; font-size: .88rem; white-space: normal; }
.sg-item:hover { background: var(--brand-50); color: var(--brand-600); }
.sp-table .ir-n { display: inline-grid; margin-top: .3rem; }
.sp-table .ir-del { margin-top: .15rem; }
.sp-table tfoot td { padding: .35rem .3rem .1rem; }
.sp-add { width: 100%; border: 1.5px dashed var(--border-strong); background: transparent; color: var(--brand-600); font-weight: 700; font-size: .86rem; border-radius: 12px; padding: .55rem; transition: all .15s; }
.sp-add:hover { background: var(--brand-50); border-color: var(--brand); }
/* narrow container (side rail open / phone): same table, each line wraps onto 3 compact rows */
.sp-tw { container-type: inline-size; }
@container (max-width: 639px) {
    .sp-table { min-width: 0; display: block; }
    .sp-table thead { display: none; }
    .sp-table tbody, .sp-table tfoot, .sp-table tfoot tr, .sp-table tfoot td { display: block; }
    .sp-table tbody tr { display: grid; grid-template-columns: 2.2rem minmax(0, 1fr) minmax(0, 1fr) 2.2rem; gap: .4rem; padding: .6rem .2rem; align-items: start; }
    .sp-table tbody tr + tr { border-top: 1px solid rgba(60, 40, 20, .08); }
    .sp-table tbody td, .sp-table tbody tr + tr td { display: block; padding: 0; border: 0; width: auto; }
    .sp-table td:nth-child(1) { grid-column: 1; grid-row: 1; }
    .sp-table td:nth-child(2) { grid-column: 2; grid-row: 1; }
    .sp-table td:nth-child(3) { grid-column: 3; grid-row: 1; }
    .sp-table td:nth-child(7) { grid-column: 4; grid-row: 1; }
    .sp-table td:nth-child(4) { grid-column: 2; grid-row: 2; }
    .sp-table td:nth-child(5) { grid-column: 3; grid-row: 2; }
    .sp-table td:nth-child(6) { grid-column: 2 / span 2; grid-row: 3; }
}
.choice-group .choice { border-radius: 14px; border: 2px solid var(--border); background: var(--surface-2); padding: .65rem 1.2rem; font-weight: 700; }
.choice-group .btn-check:checked + .choice { background: var(--brand-50); border-color: var(--brand); }
.wk-body .row > [class*=col] { margin-bottom: .25rem; }

/* items */
.ir-cols { display: none; }
@media (min-width: 992px) {
    .ir-cols { display: grid; grid-template-columns: 2rem minmax(0, 1fr) 90px 140px 130px 2.2rem; gap: .7rem; color: var(--faint); font-weight: 700; font-size: .74rem; padding: 0 .85rem .3rem; }
}
.item-row { background: var(--surface-2); border: 0; border-radius: 18px; padding: .7rem .85rem; }
.item-row + .item-row { margin-top: .55rem; }
.ir-line { display: grid; grid-template-columns: 2rem minmax(0, 1fr) 90px 140px 130px 2.2rem; gap: .7rem; align-items: start; }
.ir-n { width: 2rem; height: 2rem; border-radius: 10px; background: #fff; color: var(--brand-600); display: grid; place-items: center; font-weight: 800; font-size: .82rem; margin-top: .35rem; box-shadow: var(--shadow-sm); }
.ir-lab { display: none; font-size: .72rem; color: var(--muted); font-weight: 700; margin-bottom: .15rem; }
.item-row .form-control { background: #fff; }
.item-row .line-total { font-weight: 800; padding-top: .55rem; font-size: .95rem; }
.ir-del { border: 0; background: transparent; color: var(--faint); width: 2.2rem; height: 2.2rem; border-radius: 10px; margin-top: .3rem; display: grid; place-items: center; }
.ir-del:hover { background: var(--red-50); color: var(--red); }
.ir-dims { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; margin-top: .65rem; padding-inline-start: 2.7rem; }
.ir-dims .ir-lab { display: block; }
.ir-dims.d-none { display: none; }
.ir-more { margin-top: .5rem; padding-inline-start: 2.7rem; }
.ir-more summary { cursor: pointer; font-size: .8rem; color: var(--brand-600); font-weight: 700; list-style: none; }
.ir-more summary::-webkit-details-marker { display: none; }
.ir-more summary span { color: var(--faint); font-weight: 500; }
@media (max-width: 991.98px) {
    .ir-line { grid-template-columns: 2rem minmax(0, 1fr) minmax(0, 1fr) 2.2rem; grid-template-areas: 'n name name del' 'qty qty price total'; row-gap: .55rem; column-gap: .55rem; }
    .ir-n { grid-area: n; } .ir-name { grid-area: name; } .ir-del { grid-area: del; }
    .ir-qty { grid-area: qty; } .ir-price { grid-area: price; } .ir-total { grid-area: total; }
    .ir-qty, .ir-price, .ir-total, .ir-name { min-width: 0; }
    .ir-lab { display: block; }
    .item-row .line-total { padding-top: .1rem; }
    .ir-dims, .ir-more { padding-inline-start: 0; }
}

.quick-add { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-top: .85rem; }
.quick-set { display: contents; }
.quick-l { color: var(--muted); font-size: .8rem; font-weight: 700; margin-inline-end: .2rem; }
.qchip { border: 0; background: var(--brand-50); color: var(--brand-600); font-weight: 700; font-size: .84rem; border-radius: 99px; padding: .4rem .95rem; transition: all .15s; }
.qchip:hover { background: var(--brand-100); transform: translateY(-1px); }
.qchip-main { background: var(--text); color: #fff; margin-inline-start: auto; }
.qchip-main:hover { background: #000; }

.wk-acc { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1.4rem; margin-top: 1.4rem; padding-top: 1.3rem; border-top: 1px dashed var(--border-strong); }
.wk-sum { margin-top: 1rem; background: var(--surface-2); border-radius: 16px; padding: .5rem 1rem; }
.summary-line { padding: .4rem 0; color: var(--muted); }
.summary-line.big { color: var(--text); font-size: 1.15rem; font-weight: 800; border-top: 1px dashed var(--border-strong); }
.t-green { color: var(--green); } .t-red { color: var(--red); font-weight: 700; }

/* side rail */
.wk-rail { position: sticky; top: 5rem; }
.wk-rail-card { background: #fff; border-radius: 24px; padding: 1.15rem; box-shadow: var(--shadow-lg); }
.wk-rail-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; }
.wk-rail-type { display: inline-flex; align-items: center; gap: .45rem; background: var(--brand-50); color: var(--brand-600); font-weight: 800; border-radius: 99px; padding: .25rem .85rem; font-size: .85rem; }
.wk-pct { font-weight: 800; color: var(--muted); }
.wk-bar-track { height: 7px; background: var(--slate-50); border-radius: 99px; overflow: hidden; margin-bottom: .9rem; }
.wk-bar-track i { display: block; height: 100%; background-image: var(--brand-grad); border-radius: 99px; transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.wk-list { list-style: none; padding: 0; margin: 0 0 .9rem; display: grid; gap: .15rem; }
.wk-list button { width: 100%; display: flex; align-items: center; gap: .65rem; padding: .5rem .55rem; border: 0; background: transparent; border-radius: 13px; text-align: start; font-weight: 700; font-size: .88rem; color: #4a4540; transition: background .15s; }
.wk-list button:hover { background: var(--surface-2); }
.wk-list button.active { background: var(--brand-50); color: var(--brand-600); }
.wl-dot { width: 1.55rem; height: 1.55rem; border-radius: 50%; background: var(--slate-50); color: var(--faint); display: grid; place-items: center; font-size: .9rem; flex: none; }
.wk-list button.done .wl-dot { background: var(--green); color: #fff; }
.wk-list button.warn .wl-dot { background: var(--amber-50); color: var(--amber); }
.wk-list button.error .wl-dot { background: var(--red); color: #fff; }
.wk-list button.active:not(.done) .wl-dot { background: var(--brand); color: #fff; }
.wl-t { flex: 1; }
.wl-s { font-size: .7rem; color: var(--amber); }
.wk-list button.error .wl-s { color: var(--red); font-weight: 800; }
.wk-rail-total { display: grid; grid-template-columns: 1fr auto; gap: .5rem 1rem; background: var(--surface-2); border-radius: 16px; padding: .75rem 1rem; margin-bottom: .9rem; }
.wk-rail-total > div { display: grid; }
.wk-rail-total small { color: var(--muted); font-size: .72rem; }
.wk-rail-total strong { font-size: 1.08rem; }

/* tablet/phone */
.wk-chips { display: none; }
.wk-bar { display: none; }
@media (max-width: 1199.98px) {
    .wk-layout { grid-template-columns: 1fr; }
    .wk-rail { display: none !important; }
    .wk-chips { display: flex; gap: .45rem; overflow-x: auto; position: sticky; top: 3.45rem; z-index: 6; margin: 0 -1rem .9rem; padding: .55rem 1rem; background: rgba(244, 241, 236, .92); backdrop-filter: blur(10px); scrollbar-width: none; }
    .wk-chips::-webkit-scrollbar { display: none; }
    .wk-chip { flex: none; display: inline-flex; align-items: center; gap: .4rem; border: 0; background: #fff; box-shadow: var(--shadow-sm); border-radius: 99px; padding: .45rem .95rem; font-weight: 700; font-size: .84rem; color: #4a4540; }
    .wk-chip.active { background: var(--brand-50); color: var(--brand-600); box-shadow: 0 0 0 1.5px var(--brand-100); }
    .wk-chip.done i { color: var(--green); } .wk-chip.error { background: var(--red-50); color: var(--red); } .wk-chip.warn i { color: var(--amber); }
    .wk-bar { display: flex; align-items: center; gap: .6rem; position: fixed; bottom: 0; inset-inline: 0; z-index: 1030; padding: .65rem 1rem calc(.65rem + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .94); backdrop-filter: blur(14px); box-shadow: 0 -12px 30px -16px rgba(48, 32, 18, .35); }
    .wk-bar[x-cloak] { display: none !important; }
    .wk-bar .btn { white-space: nowrap; }
    .wk-bar .btn-primary { flex: 1; }
    .wk-bar-info { display: grid; line-height: 1.2; margin-inline-end: auto; }
    .wk-bar-info small { color: var(--muted); font-size: .7rem; }
    .wk-bar-info strong { font-size: 1.05rem; }
    .tseg { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 992px) and (max-width: 1199.98px) { .wk-bar { inset-inline-start: var(--sidebar-w); } }
@media (max-width: 767.98px) {
    .wk-sec { padding: 1rem 1rem 1.2rem; border-radius: 20px; }
    .wk-type { border-radius: 20px; padding: 1rem; }
    .wk-acc { grid-template-columns: 1fr; }
    .tchip { flex-direction: column; text-align: center; padding: .8rem .4rem; gap: .45rem; } .tchip .ti { width: 2.6rem; height: 2.6rem; font-size: 1.3rem; } .tchip .tt { font-size: .86rem; } .tchip .tick { inset-inline-end: .5rem; top: .45rem; }
    .wk-hint { flex-basis: 100%; }
}

/* ===================================================== customer signature screen */
.sign-body { background: var(--bg); background-image: radial-gradient(900px 360px at 80% -80px, rgba(196, 154, 74, .2), transparent 70%); background-repeat: no-repeat; }
.sign-card { border: 0; border-radius: 28px; box-shadow: var(--shadow-lg); overflow: hidden; }
.sign-head { border-bottom: 0; background: linear-gradient(135deg, #fff 0%, #fbf5ee 100%); padding: 1.1rem 1.6rem; }
.sign-logo { width: 150px; height: auto; flex: none; }
.sign-details { background: var(--surface-2); border-radius: 16px; padding: .85rem 1.1rem; }
.sign-details summary { cursor: pointer; font-weight: 800; list-style: none; display: flex; align-items: center; gap: .5rem; }
.sign-details summary::-webkit-details-marker { display: none; }
.sign-details summary span { color: var(--muted); font-weight: 500; font-size: .82rem; }
.sign-details[open] summary { color: var(--brand-600); }
.sign-terms { border: 0; background: transparent; padding: 0 1.1rem 0 0; max-height: 14rem; }
.sign-total { background: var(--surface-2); color: var(--text); border-radius: 18px; }
.sign-total .k { color: var(--muted); font-weight: 700; }
.sign-total .v { font-size: 1.45rem; font-weight: 800; }
.sign-total .v[style*="6ee0a8"] { color: var(--green) !important; }
.sign-total .v[style*="ffb4b4"] { color: var(--red) !important; }
.sig-area { border-radius: 22px; background: #fff; border: 2px dashed var(--brand-100); box-shadow: inset 0 0 0 1px var(--border); }
#sign-submit { --bs-btn-padding-y: 1rem; font-size: 1.1rem; border-radius: 16px; }

/* ===================================================== order page: next steps */
.sign-cta { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; padding: 1.1rem 1.3rem; border-radius: var(--radius); background: linear-gradient(120deg, #fff7ea 0%, #fdeccd 100%); box-shadow: var(--shadow), 0 0 0 1.5px #f2d49c; }
.sign-cta .sc-ic { width: 3.2rem; height: 3.2rem; border-radius: 16px; background-image: var(--brand-grad); color: #fff; display: grid; place-items: center; font-size: 1.45rem; flex: none; box-shadow: 0 12px 22px -12px rgba(110, 62, 30, .9); }
.sign-cta .sc-t { flex: 1; min-width: 14rem; }
.sign-cta .sc-t b { display: block; font-size: 1.08rem; }
.sign-cta .sc-t small { color: #7a5a2a; }
.hero .chip, .hero .pill { font-size: .8rem; }

/* ===================================================== orders list */
.ox-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .9rem; }
.ox-bar .tabs-pill .tab { text-decoration: none; }
.ox-count { color: var(--muted); font-weight: 600; }
.ox-count b { color: var(--text); font-size: 1.1rem; }
.ox-filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1rem; }
.ox-filters .ox-search { flex: 1 1 260px; }
.ox-filters .form-select { width: auto; min-width: 9.5rem; background-color: #fff; border: 0; box-shadow: var(--shadow-sm); }
.ox-filters .ox-search .form-control { background: #fff; border: 0; box-shadow: var(--shadow-sm); }
.ox-check { background: #fff; border-radius: 12px; padding: .55rem .9rem; box-shadow: var(--shadow-sm); font-weight: 600; display: inline-flex; gap: .5rem; align-items: center; }

/* ===================================================== WhatsApp send screen */
.wa-page { max-width: 880px; }
.wa-hero { background: #fff; border-radius: 26px; padding: 1.5rem; box-shadow: var(--shadow); display: grid; gap: 1.1rem; }
.wa-hero .wa-file { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; background: var(--surface-2); border-radius: 18px; padding: 1rem 1.1rem; }
.wa-to { margin-inline-start: auto; display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; color: #4a4540; flex-wrap: wrap; }
.wa-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.wa-actions .btn-whatsapp, .wa-actions .btn-outline-success { flex: 1 1 15rem; }
.wa-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: .45rem; color: #4a4540; }
.wa-steps i { color: var(--green); margin-inline-end: .3rem; }
.wa-msg { background: var(--surface-2); border-radius: 16px; padding: .8rem 1rem; }
.wa-msg summary { cursor: pointer; font-weight: 800; list-style: none; }
.wa-msg summary::-webkit-details-marker { display: none; }
.wa-msg summary span { color: var(--muted); font-weight: 500; font-size: .82rem; }

/* ================================================== order log (timeline) */
.tl { list-style: none; margin: 0; padding: 0; display: grid; }
.tl-item { position: relative; display: grid; grid-template-columns: 2.2rem minmax(0, 1fr); column-gap: .8rem; padding-bottom: 1.15rem; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ''; position: absolute; inset-inline-start: calc(1.1rem - 1px); top: 2.3rem; bottom: .1rem; width: 2px; background: var(--border); border-radius: 2px; }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 2.2rem; height: 2.2rem; border-radius: 50%; display: grid; place-items: center; font-size: .95rem; background: var(--slate-50); color: var(--slate); box-shadow: 0 0 0 3px #fff; position: relative; z-index: 1; }
.tl-ok .tl-dot { background: var(--green-50); color: var(--green); }
.tl-bad .tl-dot { background: var(--red-50); color: var(--red); }
.tl-info .tl-dot { background: var(--blue-50); color: var(--blue); }
.tl-body { min-width: 0; padding-top: .1rem; }
.tl-t { font-weight: 700; font-size: .9rem; line-height: 1.4; color: var(--text); }
.tl-n { margin-top: .35rem; font-size: .82rem; line-height: 1.55; color: #4a4540; background: var(--surface-2); border-radius: 10px; padding: .45rem .7rem; }
.tl-m { margin-top: .25rem; font-size: .78rem; color: var(--muted); }
.tl-d { font-size: .74rem; color: var(--faint); direction: ltr; text-align: right; }
[dir=rtl] .tl-d { text-align: right; }

/* the step the order is standing at right now: blinks */
.tl-now .tl-dot { background: var(--brand); color: #fff; animation: tlPulse 1.6s ease-in-out infinite; }
.tl-now .tl-t { color: var(--brand-600); }
.tl-now.tl-problem .tl-dot { background: var(--red); animation-name: tlPulseRed; }
.tl-now.tl-problem .tl-t { color: var(--red); }
.tl-now .tl-body { animation: tlBlink 1.6s ease-in-out infinite; }
@keyframes tlPulse { 0%, 100% { box-shadow: 0 0 0 3px #fff, 0 0 0 3px rgba(140, 85, 48, .45); } 50% { box-shadow: 0 0 0 3px #fff, 0 0 0 11px rgba(140, 85, 48, 0); } }
@keyframes tlPulseRed { 0%, 100% { box-shadow: 0 0 0 3px #fff, 0 0 0 3px rgba(209, 66, 59, .5); } 50% { box-shadow: 0 0 0 3px #fff, 0 0 0 11px rgba(209, 66, 59, 0); } }
@keyframes tlBlink { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .tl-now .tl-dot, .tl-now .tl-body { animation: none; } }

/* ============================================ operations: workshop stages */
.prod-list { display: grid; gap: .75rem; }
.prod-row { display: grid; grid-template-columns: auto 9.5rem minmax(0, 1fr); gap: .9rem; align-items: start; padding: .85rem 1rem; border-radius: 16px; background: var(--surface-2); border: 1.5px solid transparent; transition: background .15s, border-color .15s; }
.prod-row.is-done { background: var(--green-50); border-color: color-mix(in srgb, var(--green) 28%, transparent); }
.prod-check { margin: .1rem 0 0; cursor: pointer; display: block; }
.prod-check.is-locked { cursor: default; }
.prod-check input { position: absolute; opacity: 0; pointer-events: none; }
.prod-box { width: 2.5rem; height: 2.5rem; border-radius: 12px; border: 2px solid var(--border-strong); background: #fff; display: grid; place-items: center; color: transparent; font-size: 1.4rem; transition: all .15s; }
.prod-check input:checked + .prod-box { background: var(--green); border-color: var(--green); color: #fff; }
.prod-check input:focus-visible + .prod-box { outline: 2px solid var(--brand); outline-offset: 2px; }
.prod-name { display: grid; align-content: start; gap: .1rem; padding-top: .1rem; }
.prod-name b { font-size: 1.05rem; font-weight: 800; }
.prod-name small { color: var(--muted); font-size: .74rem; line-height: 1.4; }
.prod-n { display: none; }
.prod-note { background: #fff; resize: none; overflow: hidden; line-height: 1.55; min-height: 3.2rem; }
.prod-note[readonly] { background: rgba(255, 255, 255, .6); }
.prod-foot { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }
.prod-saved { font-size: .78rem; font-weight: 700; }
.prod-saved.saving { color: var(--muted); } .prod-saved.saved { color: var(--green); } .prod-saved.error { color: var(--red); }
@media (max-width: 767.98px) {
    .prod-row { grid-template-columns: auto minmax(0, 1fr); }
    .prod-note { grid-column: 1 / -1; }
}

/* stage not needed for this order */
.prod-na { display: flex; align-items: center; gap: .35rem; margin-top: .25rem; font-size: .74rem; color: var(--muted); cursor: pointer; font-weight: 600; }
.prod-na input { width: .95rem; height: .95rem; margin: 0; accent-color: var(--slate); cursor: pointer; }
.prod-na-note { color: var(--slate); font-weight: 600; }
.prod-row.is-na { background: var(--slate-50); }
.prod-row.is-na .prod-box { background: var(--slate-50); border-style: dashed; opacity: .6; }
.prod-row.is-na .prod-name > b { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(0,0,0,.25); }

/* ---------------------------------------------- order page: sticky next-step bar */
.next-bar { position: fixed; top: .6rem; inset-inline: calc(var(--sidebar-w) + 1.25rem) 1.25rem; z-index: 1030; display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
    padding: .55rem .9rem; background: rgba(255, 255, 255, .97); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 14px 34px -14px rgba(48, 32, 18, .35);
    opacity: 0; transform: translateY(-120%); pointer-events: none; transition: opacity .15s, transform .15s; }
.next-bar.show { opacity: 1; transform: none; pointer-events: auto; }
.next-bar .nb-nav { display: flex; gap: .15rem; flex-wrap: wrap; }
.next-bar .nb-nav a { padding: .3rem .65rem; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: .82rem; }
.next-bar .nb-nav a:hover { background: var(--surface-2); color: var(--text); }
.next-bar .nb-actions { margin-inline-start: auto; display: flex; gap: .4rem; flex-wrap: wrap; }
#sec-details, #sec-items, #sec-sketches, #sec-finance, #sec-log { scroll-margin-top: 5.5rem; }
@media (max-width: 991.98px) {
    .next-bar { inset-inline: .5rem; top: .4rem; }
    .next-bar .nb-nav { display: none; }
}
@media print { .next-bar { display: none !important; } }

/* ---------------------------------------------------------------- calendar */
.cal-bar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.cal-title { font-size: 1.25rem; font-weight: 800; margin: 0 .4rem; min-width: 9rem; text-align: center; }
.cal-legend { margin-inline-start: auto; display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.cal-legend .dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 4px; vertical-align: -1px; margin-inline-end: .2rem; }
.dot-delivery { background: var(--blue-50); border: 1px solid var(--blue); }
.dot-late { background: var(--red-50); border: 1px solid var(--red); }
.dot-visit { background: var(--teal-50); border: 1px solid var(--teal); }
.dot-mine { background: #fff; border: 2px solid var(--brand); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .4rem; }
.cal-wd { text-align: center; font-weight: 800; font-size: .78rem; color: var(--brand-600); background: var(--brand-50); border-radius: 10px; padding: .45rem 0; }
.cal-day { background: #fff; border: 1px solid var(--border); border-radius: 12px; min-height: 7.2rem; padding: .4rem; display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.cal-day.out { background: transparent; opacity: .55; }
.cal-day.today { border: 2px solid var(--brand); }
.cal-n { display: flex; justify-content: space-between; align-items: baseline; font-weight: 800; font-size: .9rem; }
.cal-n small { display: none; color: var(--muted); font-weight: 600; }
.cal-ev { display: block; font-size: .74rem; font-weight: 600; padding: .2rem .4rem; border-radius: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); border-inline-start: 3px solid; }
.cal-ev.delivery { background: var(--blue-50); border-color: var(--blue); }
.cal-ev.late { background: var(--red-50); border-color: var(--red); }
.cal-ev.visit { background: var(--teal-50); border-color: var(--teal); }
.cal-ev.mine { box-shadow: inset 0 0 0 1.5px var(--brand); }
.cal-ev:hover { filter: brightness(.96); color: var(--text); }
@media (max-width: 767.98px) {
    /* phones: a simple list of the days that have something */
    .cal { grid-template-columns: 1fr; }
    .cal-wd, .cal-day.empty-day, .cal-day.out.empty-day { display: none; }
    .cal-day { min-height: 0; }
    .cal-n small { display: inline; }
    .cal-ev { white-space: normal; }
}

/* ---------------------------------------------------------------- workshop board */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: .8rem; overflow-x: auto; padding-bottom: .6rem; align-items: start; }
.kb-col { background: var(--surface-2); border-radius: 16px; padding: .55rem; border-top: 4px solid var(--tc); min-width: 0; }
.kb-head { display: flex; align-items: center; gap: .45rem; font-weight: 800; font-size: .86rem; color: var(--tc); padding: .35rem .3rem .6rem; }
.kb-count { margin-inline-start: auto; background: var(--tb); color: var(--tc); border-radius: 99px; padding: 0 .55rem; font-size: .78rem; }
.kb-body { display: flex; flex-direction: column; gap: .5rem; }
.kb-card { display: flex; flex-direction: column; gap: .3rem; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: .65rem .7rem; color: var(--text); box-shadow: var(--shadow-sm); }
.kb-card:hover { border-color: var(--tc); color: var(--text); }
.kb-card.late { border-inline-start: 3px solid var(--red); }
.kb-card .ono { font-size: .8rem; }
.kb-empty { text-align: center; color: var(--faint); font-size: .8rem; padding: 1.2rem 0; }
