/* == alert == */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 1px solid;
    border-inline-start-width: 5px;
    border-radius: var(--radius);
    font-weight: bold;
}
.alert-text { flex: 1; }
.alert-success { background: var(--c-success-soft); border-color: var(--c-success); color: #1d4d20; }
.alert-error   { background: var(--c-danger-soft);  border-color: var(--c-danger);  color: #7d1515; }
.alert-warning { background: var(--c-warning-soft); border-color: var(--c-warning); color: #6b3f00; }
.alert-info    { background: var(--c-info-soft);    border-color: var(--c-info);    color: #0d3f78; }
.alert-close {
    border: 0; background: transparent; font-size: 1.4rem; line-height: 1;
    cursor: pointer; color: inherit; padding: 0 4px;
}
html[lang="ur"] .alert { font-weight: normal; }
[data-theme="dark"] .alert { color: var(--c-text); }

/* == auth-hero == */
/* Login page: picture panel + form side by side on laptops, stacked on phones */
.auth-split {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    max-width: 1040px;
    margin: 8px auto 24px;
    align-items: stretch;
}
.auth-split .auth-form { align-self: center; width: 100%; max-width: 440px; margin: 0 auto; }
@media (min-width: 900px) {
    .auth-split { grid-template-columns: 1.15fr 1fr; gap: 0; margin-top: 32px;
        border: 1px solid var(--c-border-strong); border-radius: var(--radius); overflow: hidden;
        background: var(--c-surface); box-shadow: 0 6px 24px rgba(0, 0, 0, .08); }
    .auth-split .auth-form { padding: 32px; }
    .auth-split .auth-form .card { border: 0; box-shadow: none; }
}

.auth-hero {
    position: relative;
    padding: 18px 18px 16px;
    background-color: var(--c-accent-soft);
    background-image:
        repeating-linear-gradient(45deg, rgba(0,0,0,.025) 0 2px, transparent 2px 9px),
        repeating-linear-gradient(-45deg, rgba(0,0,0,.025) 0 2px, transparent 2px 9px);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    text-align: center;
}
/* stitched border inside the panel */
.auth-hero::before {
    content: "";
    position: absolute;
    inset: 8px;
    border: 2px dashed rgba(0, 0, 0, .14);
    border-radius: 2px;
    pointer-events: none;
}
.auth-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 12px;
    background: var(--c-primary);
    color: var(--c-on-primary);
    border-radius: 2px;
    font-weight: bold;
    font-size: .85rem;
    letter-spacing: .03em;
}
.auth-hero-art { max-width: 300px; margin: 12px auto 4px; }
.auth-hero-title { font-size: 1.3rem; color: var(--c-primary); margin: 6px 0 4px; }
.auth-hero-text { color: var(--c-muted); margin: 0 auto 8px; max-width: 360px; }
.auth-hero-points { display: none; list-style: none; padding: 0; margin: 14px auto 0; text-align: start; max-width: 300px; }
.auth-hero-points li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed rgba(0,0,0,.12); }
.auth-hero-points li:last-child { border-bottom: 0; }
.auth-hero-points .icon { color: var(--c-primary); }

@media (min-width: 900px) {
    .auth-hero { border: 0; border-radius: 0; border-inline-end: 1px solid var(--c-border); padding: 36px 32px; }
    .auth-hero::before { inset: 12px; }
    .auth-hero-art { max-width: 380px; margin-top: 24px; }
    .auth-hero-title { font-size: 1.6rem; }
    .auth-hero-points { display: block; }
}
@media (max-width: 899px) {
    .auth-hero-art { max-width: 230px; }
}

.auth-hero-logo { display: block; width: 88px; height: 88px; object-fit: contain; margin: 0 auto 10px;
    background: #fff; border: 2px solid var(--c-accent); border-radius: 8px; padding: 4px; position: relative; }

/* == button == */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: var(--tap);
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: bold;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 1px 0 rgba(0,0,0,.15);
}
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 1px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.btn-sm { min-height: 36px; padding: 4px 10px; font-size: .9rem; }
.btn-lg { min-height: 54px; padding: 10px 22px; font-size: 1.1rem; }
.btn-block { display: flex; width: 100%; }

.btn-primary   { background: var(--c-primary); color: var(--c-on-primary); border-color: var(--c-primary-dark); }
.btn-primary:hover { background: var(--c-primary-dark); }
.btn-secondary { background: var(--c-surface); color: var(--c-text); border-color: var(--c-border-strong); }
.btn-secondary:hover { background: var(--c-surface-2); }
.btn-success   { background: var(--c-success); color: #fff; border-color: #1f5e23; }
.btn-danger    { background: var(--c-surface); color: var(--c-danger); border-color: var(--c-danger); }
.btn-danger:hover { background: var(--c-danger-soft); }
.btn-warning   { background: var(--c-accent); color: #1E2329; border-color: #a77f10; }
.btn-whatsapp  { background: var(--c-whatsapp); color: #fff; border-color: #166b3b; }
.btn-ghost     { background: transparent; color: var(--c-primary); box-shadow: none; }
.btn-ghost:hover { background: var(--c-primary-soft); }

html[lang="ur"] .btn { font-weight: normal; line-height: 1.8; padding-top: 4px; padding-bottom: 4px; }

/* == card == */
.card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.card-primary { border-inline-start: 4px solid var(--c-primary); }
.card-success { border-inline-start: 4px solid var(--c-success); }
.card-warning { border-inline-start: 4px solid var(--c-accent); }
.card-danger  { border-inline-start: 4px solid var(--c-danger); }
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    background: var(--c-surface-2);
    border-bottom: 1.5px dashed var(--c-border-strong); /* stitched seam */
}
.card-title { margin: 0; font-size: 1rem; }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.card-body { padding: 12px; }
.card-flush { padding: 0; }
.card-foot { padding: 10px 12px; border-top: 1px solid var(--c-border); background: var(--c-surface-2); }

/* == form-field == */
.field { margin-bottom: 12px; min-width: 0; }
.field-label { display: block; font-weight: bold; font-size: .92rem; margin-bottom: 4px; }
.field-label .req { color: var(--c-danger); }
.input {
    display: block;
    width: 100%;
    min-height: var(--tap);
    padding: 8px 10px;
    background: var(--c-input);
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius);
    font-size: 16px; /* 16px stops iPhone zoom on focus */
}
textarea.input { min-height: 70px; resize: vertical; }
select.input { padding-inline-end: 28px; }
.input:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-soft); }
.field-hint { display: block; color: var(--c-muted); margin-top: 3px; }

.field-check, .field-radio {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    cursor: pointer;
}
.field-check input, .field-radio input { width: 20px; height: 20px; accent-color: var(--c-primary); }
.field-radios { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.field-radios .field-radio {
    padding: 4px 12px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius);
    background: var(--c-input);
}
.field-radios .field-radio:has(input:checked) { border-color: var(--c-primary); background: var(--c-primary-soft); font-weight: bold; }

html[lang="ur"] .field-label { font-weight: normal; }
html[lang="ur"] .input { line-height: 1.9; padding-top: 4px; padding-bottom: 4px; }

/* == icon == */
.icon { display: inline-block; vertical-align: middle; flex-shrink: 0; }
[dir="rtl"] .icon-flip { transform: scaleX(-1); }

/* == illustration == */
.ill { display: block; width: 100%; height: auto; overflow: visible; }
.ill-shadow   { fill: rgba(0, 0, 0, .10); }
.ill-body     { fill: var(--c-primary); }
.ill-dark     { fill: var(--c-primary-dark); }
.ill-accent   { fill: var(--c-accent); }
.ill-accent-dark { fill: #A87E12; }
[data-theme="green"] .ill-accent-dark { fill: #6B4422; }
.ill-shine    { fill: rgba(255, 255, 255, .14); }
.ill-light    { fill: #FFF6C8; filter: drop-shadow(0 0 4px #FFE680); }
.ill-metal    { fill: #C9CED6; }
.ill-metal-dark { fill: #8A94A3; }
.ill-fabric   { fill: #FFFFFF; stroke: var(--c-border-strong); stroke-width: 1.2; }
.ill-stitch   { fill: none; stroke: var(--c-danger); stroke-width: 2; stroke-dasharray: 6 5; stroke-linecap: round; }
.ill-thread   { fill: none; stroke: var(--c-accent); stroke-width: 1.4; }
.ill-spoke    { stroke: var(--c-accent); stroke-width: 2.4; stroke-linecap: round; }
.ill-needle-tip { stroke: #6B7280; stroke-width: 2; stroke-linecap: round; }
.ill-tape-strip { fill: none; stroke: #F2C94C; stroke-width: 7; stroke-linecap: round; stroke-dasharray: 1 4; }

/* --- motion --- */
.ill-animate .ill-needle { animation: ill-needle .45s ease-in-out infinite; }
.ill-animate .ill-stitch:not(.ill-stitch-done) { animation: ill-stitch .45s linear infinite; }
.ill-animate .ill-wheel  { transform-box: fill-box; transform-origin: center; animation: ill-spin 1.8s linear infinite; }
.ill-animate .ill-light  { animation: ill-glow 2.4s ease-in-out infinite; }

@keyframes ill-needle { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(9px); } }
@keyframes ill-stitch { to { stroke-dashoffset: -22; } }
@keyframes ill-spin   { to { transform: rotate(360deg); } }
@keyframes ill-glow   { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

@media (prefers-reduced-motion: reduce) {
    .ill-animate * { animation: none !important; }
}

/* small drawings for empty pages */
.ill-stroke { fill: none; stroke: var(--c-primary-dark); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.ill-stroke-thin { fill: none; stroke: var(--c-muted); stroke-width: 1.5; }
.ill-fabric-line { fill: none; stroke: rgba(255,255,255,.75); stroke-width: 1.6; stroke-dasharray: 4 3; }
.ill-tag { fill: #FFFDF5; stroke: var(--c-border-strong); }
.ill-tape-wide { fill: none; stroke: #F2C94C; stroke-width: 13; stroke-linecap: round; }
.ill-needle-body { stroke: #9AA3AE; stroke-width: 5; stroke-linecap: round; }
.ill-needle-eye { fill: var(--c-surface); stroke: #7A838E; stroke-width: 1.5; }
.ill-thread-wide { fill: none; stroke: var(--c-danger); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 7 5; }
.ill-ok { fill: var(--c-success); }
.ill-ok-tick { fill: none; stroke: #fff; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.ill-animate .ill-swing { transform-box: view-box; transform-origin: 80px 12px; animation: ill-swing 3s ease-in-out infinite; }
.ill-animate .ill-tag-swing { transform-box: view-box; transform-origin: 118px 40px; animation: ill-swing 2.4s ease-in-out infinite; }
.ill-animate .ill-roll { transform-box: fill-box; transform-origin: center; animation: ill-roll 4s ease-in-out infinite; }
.ill-animate .ill-thread-wide { animation: ill-stitch 1.2s linear infinite; }
@keyframes ill-swing { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes ill-roll  { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-25deg); } }

/* == topbar == */
.topbar {
    background: var(--c-header);
    color: var(--c-on-primary);
    border-bottom: 3px solid var(--c-accent);
    position: sticky;
    top: 0;
    z-index: 50;
    background-image: linear-gradient(180deg, rgba(255,255,255,.06), rgba(0,0,0,.08));
}
/* tailor's stitching line just above the gold border */
.topbar::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 4px;
    border-bottom: 2px dashed rgba(212, 160, 23, .55);
    pointer-events: none;
}
.topbar-inner {
    max-width: 980px;
    height: calc(var(--topbar-h) - 3px); /* 3px = gold bottom border */
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 12px;
    min-height: 52px;
}
.topbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: inherit;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.05rem;
    min-width: 0;
}
.topbar-brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46vw; }
.topbar-tools { display: flex; align-items: center; gap: 8px; }
.topbar-branch { margin: 0; }
.topbar-branch select {
    max-width: 38vw;
    min-height: 36px;
    padding: 2px 6px;
    border: 1px solid rgba(255,255,255,.5);
    border-radius: var(--radius);
    background: var(--c-primary-dark);
    color: #fff;
    font-size: .9rem;
}
.topbar-branch-name { font-size: .85rem; opacity: .9; white-space: nowrap; }
.topbar-lang {
    min-height: 36px;
    min-width: 48px;
    padding: 2px 10px;
    border: 1px solid rgba(255,255,255,.6);
    border-radius: var(--radius);
    background: transparent;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
}
.topbar-lang:hover { background: rgba(255,255,255,.12); }
/* Show "اردو" in the Urdu font even while the page is English */
.topbar-lang { font-family: var(--font-ur), var(--font); }
@media (min-width: 1100px) {
    .topbar-inner { max-width: none; padding: 0 28px 0 20px; }
    .topbar-brand { font-size: 1.15rem; }
    .topbar-brand span { max-width: 40vw; }
    .topbar-branch select { max-width: 260px; min-width: 160px; }
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.topbar-logo {
    width: 34px; height: 34px;
    object-fit: contain;
    background: #fff;
    border-radius: 4px;
    padding: 2px;
    border: 1px solid var(--c-accent);
}

