:root {
    --fx-surface: #ffffff;
    --fx-border: #e3e8f0;
    --fx-text: #40403f;
    --fx-muted: #6b7268;
    --fx-accent: #9bbf24;
    --fx-accent-dark: #6d8a14;
    --fx-accent-soft: #f0f7dc;
    --fx-on-accent: #26330a;
    --fx-warn: #b7791f;
    --fx-ok: #5c8300;
    --fx-shadow-sm: 0 1px 2px rgba(30, 40, 10, .12), 0 2px 6px rgba(30, 40, 10, .12);
    --fx-shadow-md: 0 4px 10px rgba(30, 40, 10, .12), 0 10px 24px rgba(30, 40, 10, .12);
    --fx-shadow-lg: 0 10px 30px rgba(30, 40, 10, .18);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: linear-gradient(180deg, #9bbf24 0%, #7ea01c 40%, #566d13 75%, #3c4c0d 100%) fixed;
    color: var(--fx-text);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 15px;
    overscroll-behavior: none;
}

html {
    scrollbar-gutter: stable;
    overflow-y: scroll;
}

/* Keep content clear of notches/home indicator when installed as a standalone app */
.app-shell {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

h1, h2, h3 {
    margin: 0 0 .25rem 0;
    font-weight: 650;
    letter-spacing: -.01em;
}

/* ---------- Layout ---------- */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-main {
    padding: 1rem 1rem 7rem 1rem;
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
}

.version-badge {
    color: rgba(255, 255, 255, .72);
    font-size: .65rem;
    font-weight: 600;
    line-height: 1;
    pointer-events: none;
    user-select: none;
}

.version-badge-page {
    position: fixed;
    top: calc(.35rem + env(safe-area-inset-top));
    left: calc(.45rem + env(safe-area-inset-left));
    z-index: 40;
}

/* ---------- Top bar (buttons only, no drop-downs) ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .6rem 1rem;
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    background: transparent;
    box-shadow: none;
    border: none;
    border-radius: 0;
}

.topbar-brand {
    display: flex;
    align-items: center;
}

.topbar-title {
    color: var(--fx-text);
    font-size: .9rem;
    font-weight: 700;
    margin-right: auto;
    white-space: nowrap;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    margin-left: auto;
}

.btn-top {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--fx-border);
    border-radius: 50%;
    background: var(--fx-surface);
    color: var(--fx-text);
    font: inherit;
    cursor: pointer;
    box-shadow: var(--fx-shadow-sm);
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease, color .12s ease;
}

.btn-top svg {
    width: 20px;
    height: 20px;
}

.btn-top:hover {
    transform: translateY(-1px);
    box-shadow: var(--fx-shadow-md);
    background: var(--fx-accent-soft);
    color: var(--fx-accent-dark);
}

.btn-top:active {
    transform: translateY(0);
    box-shadow: var(--fx-shadow-sm);
}

.btn-top.active {
    background: #e6eeb0;

    border-color: #e6eeb0;
    color: var(--fx-text);
    box-shadow: var(--fx-shadow-md);
}

.btn-offline {
    margin-left: 0;
}

.btn-offline.offline-on {
    background: #b45309;
    border-color: #b45309;
    color: #fff;
    box-shadow: var(--fx-shadow-md);
}

.btn-offline:disabled {
    opacity: .6;
    cursor: default;
}

.offline-bar {
    padding: .5rem .9rem;
    background: transparent;
    color: rgba(255, 255, 255, .75);
    font-size: .85rem;
    text-align: center;
}

.offline-bar-error {
    background: transparent;
    color: rgba(255, 255, 255, .9);
}

.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--fx-accent-soft);
    color: var(--fx-on-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    box-shadow: var(--fx-shadow-sm);
    border: 1px solid rgba(255, 255, 255, .7);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.app-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    width: 100%;
    max-width: none;
    margin:0;
    padding: .6rem env(safe-area-inset-right) calc(.6rem + env(safe-area-inset-bottom)) env(safe-area-inset-left);
    display: flex;
    justify-content: center;
    gap: 5px;
    border-radius: 0;
    background: #fff;
    border: none;
    border-top: 1px solid var(--fx-border);
    box-shadow: var(--fx-shadow-lg);
}

.tabbar-item {
    min-width: 0;
    width: 80px;
    flex: 0 0 auto;
    height: 72px;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: var(--fx-muted);
    font: inherit;
    font-size: .58rem;
    font-weight: 400;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .25rem;
}

.tabbar-item svg {
    width: 35px;
    height: 35px;
}

.tabbar-item.active {
    background: #e3ebb5;
    background: linear-gradient(180deg, rgba(227, 235, 181, 1) 0%, rgba(158, 179, 89, 1) 100%);
    color: var(--fx-on-accent);
    box-shadow: var(--fx-shadow-md);
}

.tabbar-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--fx-border);
    border-radius: 50%;
    background: var(--fx-surface);
    color: var(--fx-text);
    font: inherit;
    cursor: pointer;
    box-shadow: var(--fx-shadow-sm);
    transition: transform .12s ease, box-shadow .12s ease, color .12s ease;
}

.btn-ghost svg {
    width: 18px;
    height: 18px;
}

.btn-ghost:hover {
    transform: translateY(-1px);
    box-shadow: var(--fx-shadow-md);
    color: var(--fx-accent-dark);
}

.btn-ghost:disabled {
    opacity: .5;
    cursor: default;
    transform: none;
}

.btn-ghost.active {
    background: var(--fx-accent);
    color: var(--fx-on-accent);
    border-color: var(--fx-accent);
}

.btn-ghost.active:hover {
    color: var(--fx-on-accent);
}

/* ---------- Page header ---------- */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.page-head-actions {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.auth-logo {
    height: 48px;
    width: auto;
    display: block;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .35));
}

.auth-brand {
    flex-direction: column;
    align-items: flex-start;
}

.home-logo {
    margin-top: -1.5rem;
    margin-bottom: 30px;
}

.app-main h1,
.app-main h3 {
    color: #fff;
}

.page-title-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 0rem;
}

.page-title-icon {
    width: 1em;
    height: 1em;
    flex: 0 0 auto;
}

.page-head .subtitle {
    color: #fff;
    font-size: .9rem;
}

.page-head .subtitle strong {
    color: #fff;
}

.home-hero {
    color: #fff;
    min-height: 190px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.home-hero h1 {
    font-size: clamp(2.2rem, 7vw, 4.6rem);
    line-height: .95;
    margin-top: 1rem;
}

.home-hero p {
    max-width: 32rem;
    margin: .75rem 0 0;
    color: rgba(255, 255, 255, .86);
    font-size: 1.05rem;
}

.home-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .85rem;
}

.home-panel,
.settings-admin-card {
    background: rgba(255, 255, 255, .9);
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 7px;
    box-shadow: var(--fx-shadow-md);
}

.home-panel {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.home-panel span {
    color: var(--fx-muted);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.home-panel strong {
    font-size: 1.35rem;
}

.home-section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin: 2rem 0 .85rem;
}

.home-section-heading h2 {
    margin: .15rem 0 0;
    font-size: 1.35rem;
}

.eyebrow {
    color: var(--fx-accent);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.home-alert-total {
    color: #e85c4a;
    font-size: 2rem;
    line-height: 1;
}

.age-warning-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: .75rem;
}

.age-warning-card {
    display: flex;
    align-items: center;
    gap: .85rem;
    min-height: 92px;
    padding: .75rem;
    border: 1px solid rgba(232, 92, 74, .35);
    border-left: 4px solid #e85c4a;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(232, 92, 74, .6), rgba(255, 255, 255, .3));
}

.age-warning-image {
    display: grid;
    place-items: center;
    width: 62px;
    height: 62px;
    flex: 0 0 62px;
    overflow: hidden;
    border-radius: 7px;
    background: rgba(255, 255, 255, .92);
    color: #e85c4a;
}

.age-warning-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.age-warning-copy {
    display: grid;
    gap: .3rem;
    min-width: 0;
}

.age-warning-copy span {
    overflow: hidden;
    color: #fff;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.age-warning-copy strong {
    color: #ffb4a7;
    font-size: .85rem;
}

.home-clear-state {
    padding: 1.15rem;
    border: 1px dashed var(--fx-border);
    border-radius: 8px;
    color: var(--fx-muted);
}

.store-page {
    display: grid;
    gap: .85rem;
    max-width: 760px;
    margin: 0 auto;
}

.store-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.store-page h1 {
    margin: 0;
    font-size: 1.35rem;
}

.store-new-order {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-left: auto;
    padding: .5rem .9rem;
    white-space: nowrap;
}

.store-new-order svg {
    width: 1.1rem;
    height: 1.1rem;
}

.store-new-order:disabled {
    opacity: .7;
    cursor: wait;
}

.store-page .error {
    overflow-wrap: anywhere;
}

.store-page .loading,
.store-page .home-clear-state {
    padding: 1rem;
    text-align: center;
}

.store-page .loading {
    color: var(--fx-muted);
}

.store-page .home-clear-state {
    border: 1px dashed var(--fx-border);
    border-radius: 10px;
    color: var(--fx-muted);
}

.store-page .store-page-count {
    color: var(--fx-muted);
    font-size: .85rem;
    font-variant-numeric: tabular-nums;
}

.sales-order-list {
    display: grid;
    gap: .5rem;
}

.sales-order-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    min-width: 0;
    padding: .7rem .75rem;
    border: 1px solid var(--fx-border);
    border-radius: 12px;
    background: var(--fx-surface);
    box-shadow: 0 2px 8px rgba(30, 40, 10, .07);
}

.sales-order-main {
    display: grid;
    gap: .15rem;
    min-width: 0;
}

.sales-order-title {
    display: flex;
    align-items: baseline;
    gap: .35rem;
    min-width: 0;
}

.sales-order-label {
    flex: 0 0 auto;
    color: var(--fx-muted);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.sales-order-title strong {
    flex: 0 0 auto;
    font-size: .92rem;
    font-variant-numeric: tabular-nums;
}

.sales-order-divider {
    flex: 0 0 auto;
    color: var(--fx-muted);
}

.sales-order-title .sales-order-customer {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    font-size: .88rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sales-order-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .2rem .65rem;
    color: var(--fx-muted);
    font-size: .75rem;
    font-variant-numeric: tabular-nums;
}

.sales-order-open,
.sales-order-page-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    cursor: pointer;
}

.sales-order-open {
    flex: 0 0 2.5rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 10px;
    color: var(--fx-accent-contrast, #26340a);
    background: var(--fx-accent-soft);
}

.sales-order-open:hover {
    background: var(--fx-accent);
}

.sales-order-open svg {
    width: 1.2rem;
    height: 1.2rem;
}

.sales-order-open:focus-visible,
.sales-order-page-button:focus-visible {
    outline: 3px solid var(--fx-accent);
    outline-offset: 2px;
}

.sales-order-pagination {
    position: sticky;
    bottom: .5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .4rem;
    border: 1px solid var(--fx-border);
    border-radius: 14px;
    background: var(--fx-surface);
    box-shadow: var(--fx-shadow-md);
}

.sales-order-pagination > span {
    color: var(--fx-muted);
    font-size: .72rem;
    text-align: center;
}

.sales-order-page-button {
    gap: .25rem;
    min-height: 2.65rem;
    padding: .4rem .65rem;
    border-radius: 10px;
    color: var(--fx-text);
    background: transparent;
    font-size: .83rem;
    font-weight: 650;
}

.sales-order-page-button:not(:disabled):hover {
    background: var(--fx-accent-soft);
}

.sales-order-page-button:disabled {
    cursor: default;
    opacity: .38;
}

.sales-order-page-button svg {
    width: 1.1rem;
    height: 1.1rem;
}

.sales-order-reload:disabled {
    opacity: .75;
    cursor: wait;
}

.sales-order-reload svg.spinning {
    animation: sales-order-spin .8s linear infinite;
}

@keyframes sales-order-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .sales-order-reload svg.spinning {
        animation: none;
    }
}

/* ---------- Sales order full-screen dialog ---------- */
.so-dialog {
    --so-gutter: max(1rem, calc((100vw - 760px) / 2));
    position: fixed;
    z-index: 1100;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: #f6f8f1;
    outline: none;
    animation: so-dialog-in .18s ease-out;
}

@keyframes so-dialog-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
}

.so-dialog-bar {
    flex: none;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: calc(.6rem + env(safe-area-inset-top)) var(--so-gutter) .6rem;
    background: var(--fx-surface) linear-gradient(135deg, var(--fx-accent-soft) 0%, transparent 70%);
    border-bottom: 2px solid var(--fx-accent);
}

.so-dialog-heading {
    display: grid;
    flex: 1;
    min-width: 0;
}

.so-dialog-heading h2 {
    margin: 0;
    font-size: 1.15rem;
    font-variant-numeric: tabular-nums;
}

.so-status {
    flex: none;
    padding: .2rem .6rem;
    border-radius: 999px;
    color: var(--fx-on-accent);
    background: var(--fx-accent-soft);
    font-size: .72rem;
    font-weight: 700;
}

.so-dialog-body {
    flex: 1;
    display: grid;
    align-content: start;
    gap: .9rem;
    padding: .9rem var(--so-gutter);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.so-info {
    display: grid;
    gap: .2rem;
    padding: .9rem 1rem;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, var(--fx-accent-dark), var(--fx-accent));
    box-shadow: var(--fx-shadow-sm);
}

.so-info-customer {
    flex: 1;
    min-width: 0;
    font-size: 1.1rem;
    overflow-wrap: anywhere;
}

.so-info-head {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
}

.so-info-edit.btn-ghost {
    flex: none;
    width: 34px;
    height: 34px;
    border-color: rgba(255, 255, 255, .55);
    color: #fff;
    background: rgba(255, 255, 255, .18);
    box-shadow: none;
}

.so-info-edit.btn-ghost:hover:not(:disabled) {
    color: var(--fx-on-accent);
    background: #fff;
}

.so-info-edit svg {
    width: 16px;
    height: 16px;
}

.so-customer-edit {
    display: grid;
    gap: .6rem;
    padding: .9rem 1rem;
    border: 2px solid var(--fx-accent);
    border-radius: 14px;
    background: var(--fx-surface);
    box-shadow: var(--fx-shadow-md);
}

.so-customer-edit > label {
    color: var(--fx-muted);
    font-size: .75rem;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.so-customer-note {
    margin: 0;
    color: var(--fx-muted);
    font-size: .8rem;
}

.so-customer-actions {
    display: flex;
    justify-content: flex-end;
    gap: .6rem;
}

.so-customer-actions .btn-primary {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.so-customer-option {
    display: grid;
    min-width: 0;
    line-height: 1.25;
}

.so-customer-option strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.so-customer-option span {
    color: var(--fx-muted);
    font-size: .78rem;
}

.so-customer-empty {
    padding: .75rem;
    color: var(--fx-muted);
}

.so-info-sub {
    font-size: .8rem;
    opacity: .9;
}

.so-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: .5rem .9rem;
    margin: .6rem 0 0;
    padding-top: .6rem;
    border-top: 1px solid rgba(255, 255, 255, .3);
}

.so-info-grid dt {
    font-size: .64rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    opacity: .8;
}

.so-info-grid dd {
    margin: 0;
    font-size: .88rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.so-lines {
    display: grid;
    gap: .5rem;
}

.so-lines h3 {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin: 0;
    color: var(--fx-muted);
    font-size: .75rem;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.so-lines-count {
    padding: 0 .45rem;
    border-radius: 999px;
    color: var(--fx-on-accent);
    background: var(--fx-accent-soft);
    font-size: .7rem;
    letter-spacing: 0;
}

.so-lines .loading,
.so-lines .home-clear-state {
    padding: 1rem;
    text-align: center;
    color: var(--fx-muted);
}

.so-line-list {
    display: grid;
    overflow: hidden;
    border: 1px solid var(--fx-border);
    border-radius: 12px;
    background: var(--fx-surface);
}

.so-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .6rem .75rem;
    border-bottom: 1px solid #f0f2ea;
}

.so-line:last-child {
    border-bottom: none;
}

.so-line-main {
    display: grid;
    gap: .1rem;
    min-width: 0;
}

.so-line-description {
    font-size: .88rem;
    overflow-wrap: anywhere;
}

.so-line-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .1rem .6rem;
    color: var(--fx-muted);
    font-size: .74rem;
    font-variant-numeric: tabular-nums;
}

.so-line-discount {
    color: var(--fx-warn);
    font-weight: 600;
}

.so-line-amount {
    flex: none;
    margin-left: auto;
    font-size: .9rem;
    font-variant-numeric: tabular-nums;
}

.so-line {
    flex-wrap: wrap;
}

.so-line-main {
    flex: 1 1 10rem;
}

.so-line-delete.btn-ghost {
    flex: none;
    width: 34px;
    height: 34px;
    color: var(--fx-muted);
    box-shadow: none;
}

.so-line-delete.btn-ghost:hover:not(:disabled) {
    color: #b42318;
    border-color: #f1b4ae;
}

.so-line-delete svg {
    width: 16px;
    height: 16px;
}

.so-line-confirm {
    background: #fdf1ef;
}

.so-line-confirm-bar {
    flex: 1 0 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: .5rem;
    padding-top: .5rem;
    border-top: 1px dashed #f1b4ae;
}

.so-line-confirm-bar span {
    margin-right: auto;
    color: #b42318;
    font-size: .85rem;
    font-weight: 700;
}

.so-line-confirm-bar .btn-text,
.so-line-confirm-bar .btn-primary {
    padding: .4rem .9rem;
    font-size: .85rem;
}

.btn-primary.btn-danger {
    background: #c0392b;
    color: #fff;
}

.btn-primary.btn-danger:hover:not(:disabled) {
    background: #a52a1e;
}

.so-add-on-order {
    margin-top: .3rem;
    padding: .35rem .6rem;
    border-radius: 8px;
    color: #35450f;
    background: #eef4d5;
    font-size: .85rem;
    font-weight: 600;
}

.so-line-comment {
    display: block;
    color: var(--fx-muted);
    background: #fafbf7;
    font-size: .8rem;
    font-style: italic;
}

.so-dialog-total {
    flex: none;
    display: grid;
    gap: .15rem;
    padding: .7rem var(--so-gutter) calc(.7rem + env(safe-area-inset-bottom));
    background: var(--fx-surface);
    border-top: 2px solid var(--fx-accent);
    box-shadow: 0 -6px 18px rgba(30, 40, 10, .08);
}

.so-total-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    color: var(--fx-muted);
    font-size: .8rem;
    font-variant-numeric: tabular-nums;
}

.so-total-main {
    color: var(--fx-text);
    font-size: 1rem;
}

.so-total-main strong {
    font-size: 1.3rem;
}

.so-total-main small {
    margin-left: .25rem;
    color: var(--fx-muted);
    font-size: .75rem;
}

/* ---------- Add order line sheet ---------- */
.so-add-sheet {
    --so-gutter: max(1rem, calc((100vw - 760px) / 2));
    position: fixed;
    z-index: 1110;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: #f6f8f1;
    animation: so-sheet-in .2s ease-out;
}

@keyframes so-sheet-in {
    from {
        transform: translateY(100%);
    }
}

.so-add-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    padding: .9rem var(--so-gutter);
}

.so-add-scanner {
    padding: .75rem;
}

.so-barcode-frame {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    background: #111;
}

.so-barcode-frame .bc-video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Wide, low guide matching the decoded band: Code 39 labels are long and short. */
.so-barcode-frame .bc-guide {
    position: absolute;
    inset: 25% 6%;
    border: 2px solid rgba(255, 255, 255, .85);
    border-radius: 10px;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35);
    pointer-events: none;
}

.so-barcode-frame .bc-guide::after {
    content: "";
    position: absolute;
    left: 4%;
    right: 4%;
    top: 50%;
    height: 2px;
    background: #ff2d2d;
    box-shadow: 0 0 8px rgba(255, 45, 45, .9);
}

.so-add-hint {
    margin: .6rem 0 0;
    color: var(--fx-muted);
    font-size: .85rem;
    text-align: center;
}

.so-add-manual label,
.so-qty label {
    color: var(--fx-muted);
    font-size: .75rem;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.so-add-manual label {
    display: block;
    margin-bottom: .3rem;
}

.so-add-manual-row {
    display: flex;
    gap: .5rem;
}

.so-add-manual-row input {
    flex: 1;
    min-width: 0;
    padding: .6rem .8rem;
    border: 1px solid var(--fx-border);
    border-radius: 10px;
    background: var(--fx-surface);
    font-size: 1rem;
}

.so-add-success {
    padding: .7rem .9rem;
    border-left: 4px solid #66821f;
    background: #eef4d5;
    color: #35450f;
    font-weight: 700;
}

.so-add-item {
    display: grid;
    gap: .15rem;
    padding: .9rem 1rem;
    border-radius: 14px;
    background: var(--fx-surface);
    box-shadow: var(--fx-shadow-md);
}

.so-add-item-name {
    font-size: 1.05rem;
}

.so-add-item-price {
    color: var(--fx-muted);
    font-size: .85rem;
    font-variant-numeric: tabular-nums;
}

.so-add-blocked {
    margin-top: .3rem;
    color: var(--fx-warn);
    font-weight: 700;
}

.so-qty {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .75rem;
    margin-top: .6rem;
    padding-top: .6rem;
    border-top: 1px solid var(--fx-border);
}

.so-qty-stepper {
    display: flex;
    align-items: center;
    gap: .35rem;
}

.so-qty-stepper input {
    width: 4.5rem;
    height: 40px;
    padding: 0 .3rem;
    border: 1px solid var(--fx-border);
    border-radius: 10px;
    background: var(--fx-surface);
    font: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: center;
    -moz-appearance: textfield;
}

.so-qty-stepper input::-webkit-inner-spin-button,
.so-qty-stepper input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.so-qty-stepper input:focus {
    border-color: var(--fx-accent);
    outline: none;
}

.so-qty-stepper .btn-ghost {
    touch-action: manipulation;
}

.so-qty-unit {
    color: var(--fx-muted);
    font-size: .85rem;
    font-weight: 600;
}

.so-qty-total {
    margin-left: auto;
    font-size: 1.05rem;
    font-variant-numeric: tabular-nums;
}

.so-add-actions {
    flex: none;
    padding: .75rem var(--so-gutter) calc(.75rem + env(safe-area-inset-bottom));
    background: var(--fx-surface);
}

/* ---------- Cards & tables ---------- */
.card {
    background: var(--fx-surface);
    border-radius: 7px;
    box-shadow: var(--fx-shadow-md);
    overflow: hidden;
}

.table,
.table1 {
    width: 100%;
}

.k-listview {
    border-radius: 7px;
}

.table-row {
    display: grid;
    grid-template-columns: 2.4fr 1fr 1fr 1fr 1.4fr;
    align-items: center;
    border-bottom: 1px solid #f0f2ea;
}

.table-row:last-child {
    border-bottom: none;
}

.table-row > div {
    padding: 3px 5px;
    vertical-align: middle;
}

.table-row.table-head {
    text-align: left;
    font-size: .75rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--fx-muted);
    background: #f7faee;
    border-bottom: 2px solid var(--fx-accent);
    white-space: nowrap;
}

.table-row:not(.table-head):hover {
    background: var(--fx-accent-soft);
}

.row-link {
    cursor: pointer;
}

/* ---------- QR scanner ---------- */
.scanner-card {
    padding: 1rem;
}

.scanner-frame {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

.scan-line {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 2px;
    background: linear-gradient(90deg, rgba(255, 0, 0, 0), #ff2d2d, rgba(255, 0, 0, 0));
    box-shadow: 0 0 8px rgba(255, 45, 45, .9);
    pointer-events: none;
    animation: fx-scan 2s ease-in-out infinite alternate;
}

@keyframes fx-scan {
    from { top: 0; }
    to { top: calc(100% - 2px); }
}

@media (prefers-reduced-motion: reduce) {
    .scan-line {
        animation: none;
        top: 50%;
    }
}

.settings-card {
    padding: 1.25rem;
    display: grid;
    gap: 1rem;
}

.settings-card label {
    display: flex;
    flex-direction: column;
    gap: .3rem;
}

.settings-card label > span {
    font-size: .7rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--fx-muted);
}

.settings-card input,
.settings-card select {
    font: inherit;
    padding: .6rem .75rem;
    border: 1px solid var(--fx-border);
    border-radius: 10px;
    background: #fff;
    color: var(--fx-text);
    box-shadow: var(--fx-shadow-sm);
}

.settings-foot {
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
}

.settings-admin-card {
    margin-top: 1rem;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.settings-admin-card h2 {
    color: var(--fx-text);
}

.settings-admin-card p {
    margin: .25rem 0 0;
    color: var(--fx-muted);
}

.settings-tabs {
    display: flex;
    gap: .5rem;
    padding: .75rem 1.25rem 0;
}

.login-card {
    max-width: 460px;
    margin: 0 auto;
    padding-bottom: 1.25rem;
}

.login-tabs {
    display: flex;
    justify-content: center;
    gap: .75rem;
    padding: 1.1rem 1.25rem .4rem;
}

.login-submit {
    display: flex;
    justify-content: center;
    padding: 3rem 1.25rem 0;
}

.login-submit .btn-primary {
    min-width: min(100%, 260px);
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    padding: 0 1.25rem;
    margin-top: 1rem;
}

.form-row .input {
    font: inherit;
    padding: .6rem .75rem;
    border: 1px solid var(--fx-border);
    border-radius: 10px;
    background: #fff;
    color: var(--fx-text);
    box-shadow: var(--fx-shadow-sm);
}

.settings-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .75rem;
    padding: .9rem 1.25rem;
    border-bottom: 1px solid #f0f2ea;
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-row select.input {
    font: inherit;
    padding: .5rem .6rem;
    border: 1px solid var(--fx-border);
    border-radius: 8px;
}

/* ---------- Admin users ---------- */
.section-head {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1.1rem 1.25rem .25rem;
}

.section-head h2 {
    margin: 0;
}

.section-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.6rem;
    height: 1.6rem;
    padding: 0 .45rem;
    border-radius: 999px;
    background: var(--fx-accent);
    color: var(--fx-on-accent);
    font-size: .78rem;
    font-weight: 800;
}

.admin-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f0f2ea;
    transition: background .12s ease;
}

.admin-row:last-child {
    border-bottom: none;
}

.admin-row:hover {
    background: var(--fx-accent-soft);
}

.admin-row .user-avatar {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    font-size: 1rem;
}

.admin-identity {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    min-width: 10rem;
}

.admin-identity strong {
    font-size: .98rem;
}

.admin-identity .subtitle {
    color: var(--fx-muted);
    font-size: .8rem;
}

.admin-controls {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    margin-left: auto;
}

.admin-toggle {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .82rem;
    font-weight: 600;
    color: var(--fx-text);
    cursor: pointer;
    user-select: none;
}

.admin-toggle input {
    accent-color: var(--fx-accent);
    width: 1.05rem;
    height: 1.05rem;
    cursor: pointer;
}

.admin-actions {
    display: flex;
    gap: .5rem;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .2rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .02em;
    background: var(--fx-accent-soft);
    color: var(--fx-accent-dark);
}

.role-badge svg {
    width: 13px;
    height: 13px;
}

.scan-error-card {
    padding: 2rem 1.5rem;
    display: grid;
    justify-items: center;
    gap: 1rem;
    text-align: center;
}

.scan-error-card svg {
    width: 56px;
    height: 56px;
    color: #c0392b;
}

.scan-error-card a {
    text-decoration: none;
}

.scanner-card #qr-reader {
    width: 100%;
}

.scanner-card #qr-reader video {
    width: 100% !important;
    height: auto !important;
    border-radius: 12px;
}

/* ---------- Certificate cards ---------- */.cert-list {
    display: flex;
    flex-direction: column;
    gap: .9rem;
}

.cert-card {
    padding: .9rem 1rem 1rem 1rem;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease;
}

.cert-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--fx-shadow-lg);
}

.cert-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding-bottom: .6rem;
    border-bottom: 1px solid var(--fx-border);
}

.cert-title {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    gap: .2rem;
}

.cert-icon {
    flex: 0 0 auto;
    color: var(--fx-primary);
    font-size: 2rem;
    line-height: 1;
    font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

.cert-icon-detail {
    font-size: 3rem;
    font-variation-settings: 'FILL' 0, 'wght' 100, 'GRAD' 0, 'opsz' 12;
}

.cert-no {
    font-size: 1.3rem;
    font-weight: 700;
}

.cert-card-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: .7rem 1.25rem;
    padding: .8rem 0;
}

.cert-card .info {
    color: var(--fx-text);
}

.cert-card .info small {
    color: var(--fx-muted);
    opacity: 1;
}

.status-summary-compact {
    margin-top: .35rem;
}

.status-summary-compact .status-chip {
    padding: .2rem .6rem;
}

.status-summary-compact .status-chip-count {
    font-size: .95rem;
}

.cert-card-foot {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding-top: .6rem;
    border-top: 1px solid var(--fx-border);
}

.cert-card-foot-label {
    font-size: .7rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--fx-muted);
}

.switch {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.switch span {
    position: relative;
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: #d8ddd0;
    box-shadow: var(--fx-shadow-sm);
    transition: background .15s ease;
}

.switch span::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: var(--fx-shadow-sm);
    transition: transform .15s ease;
}

.switch input:checked + span {
    background: var(--fx-accent);
}

.switch input:checked + span::after {
    transform: translateX(18px);
}

.switch input:disabled + span {
    opacity: .5;
}

.switch input:focus-visible + span {
    outline: 2px solid var(--fx-accent-dark);
    outline-offset: 2px;
}

.row-link-arrow {
    width: 1px;
    color: var(--fx-muted);
}

.row-link-arrow svg {
    width: 18px;
    height: 18px;
    display: block;
    opacity: 0;
    transition: opacity .12s ease, transform .12s ease;
}

.row-link:hover .row-link-arrow svg {
    opacity: 1;
    color: var(--fx-accent);
    transform: translateX(2px);
}

.mono {
    font-family: "Cascadia Mono", Consolas, monospace;
}

.line-object {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.line-age-warning {
    width: .7rem;
    height: .7rem;
    flex: 0 0 .7rem;
    border-radius: 50%;
    background: #d83b3b;
    box-shadow: 0 0 0 2px rgba(216, 59, 59, .18);
}

.line-image {
    width: 44px;
    flex: none;
}

.line-image img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    display: block;
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--fx-shadow-sm);
}

.dropdown-object-type {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.dropdown-object-type img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
}

.photo-gallery {
    display: grid;
    gap: .75rem;
}

.photo-gallery-stage {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 420px;
    max-height: 420px;
    overflow: hidden;
    border-radius: 8px;
    background: rgba(0, 0, 0, .18);
}

.photo-gallery-stage img {
    width: 100%;
    max-height: 54vh;
    object-fit: contain;
}

.photo-gallery-prev,
.photo-gallery-next {
    position: absolute;
    top: 50%;
    width: 2.4rem;
    height: 2.4rem;
    padding: 0;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, .48);
    color: #fff;
    font-size: 1.8rem;
}

.photo-gallery-prev { left: .6rem; }
.photo-gallery-next { right: .6rem; }

.photo-gallery-count {
    color: var(--fx-muted);
    text-align: center;
    font-size: .8rem;
}

.photo-gallery-empty {
    display: grid;
    min-height: 420px;
    max-height: 420px;
    place-items: center;
    border: 1px dashed var(--fx-border);
    border-radius: 8px;
    color: var(--fx-muted);
}

.photo-upload {
    display: grid;
    gap: .4rem;
}

.line-info {
    color: var(--fx-muted);
    font-size: 1rem;
}

.line-header {
    background: transparent;
    border-bottom: 1px solid var(--fx-accent);
    color: var(--fx-on-accent);
}

.line-header strong {
    font-size: 1.2rem;
    font-weight: 800;
}

.line-ok {
    background: #eaf5cf;
}

.line-bad {
    background: #fbe3e3;
}

.line-info-blue {
    background: #e0edfb;
}

.table-row.line-ok:hover {
    background: #e0efb9;
}

.table-row.line-bad:hover {
    background: #f7d2d2;
}

.table-row.line-info-blue:hover {
    background: #cee2f7;
}

/* Line opened from a QR scan. */
.line-scanned {
    border: 2px solid #ff8c00;
}

/* ---------- Fullscreen inspection dialog ---------- */
.dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(30, 40, 10, .55);
    backdrop-filter: blur(3px);
    display: flex;
}

.dialog {
    background: var(--fx-surface);
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: var(--fx-shadow-lg);
}

.dialog-head {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 2rem;
    border-bottom: 2px solid var(--fx-accent);
}

.dialog-compact .dialog-head {
    background: linear-gradient(135deg, var(--fx-accent-soft) 0%, transparent 70%);
}

.status-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
}

.status-chip {
    display: flex;
    align-items: baseline;
    gap: .4rem;
    padding: .35rem .8rem;
    border-radius: 7px;
    font-weight: 600;
    box-shadow: var(--fx-shadow-sm);
}

.status-chip-count {
    font-size: 1.1rem;
    font-weight: 800;
}

.status-chip-label {
    font-size: .68rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--fx-muted);
}

.status-chip-done {
    background: #e3f3e0;
    color: #2f6d2b;
}

.status-chip-pending {
    background: #fdeee0;
    color: #a05a12;
}

.status-progress {
    flex: 1 1 140px;
    height: 8px;
    border-radius: 999px;
    background: #eee;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px var(--fx-border);
}

.status-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #9eb359 0%, #4f8a3f 100%);
    transition: width .3s ease;
}

.approve-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .75rem 1rem;
    border-radius: 12px;
    background: #e3f3e0;
    color: #2f6d2b;
    font-weight: 600;
}

.btn-approve {
    padding: .5rem 1.1rem;
    border: none;
    border-radius: 999px;
    background: linear-gradient(180deg, #9eb359 0%, #4f8a3f 100%);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--fx-shadow-md);
}

.btn-approve:hover:not(:disabled) {
    filter: brightness(1.05);
}

.btn-approve:disabled {
    opacity: .6;
    cursor: default;
}

.dialog-head > div:not(.dialog-sub) {
    margin-right: auto;
}

.dialog-head h2 {
    margin: 0;
}

.dialog-sub {
    color: var(--fx-muted);
    font-size: .9rem;
}

.dialog-body {
    flex: 1;
    overflow: auto;
    padding: 1.5rem 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem 1.5rem;
    align-content: start;
}

.dialog-image {
    width: 55px;
    height: 55px;
    object-fit: contain;
    border-radius: 10px;
    background: #fff;
    box-shadow: var(--fx-shadow-sm);
    flex: 0 0 auto;
}

.dialog-wide {
    grid-column: 1 / -1;
}

.dialog-date-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
    margin-bottom: 7px;
}

.dialog-date-row .k-datepicker {
    width: 100%;
}

.dialog-body label {
    display: flex;
    flex-direction: column;
    gap: .3rem;
}

.dialog-body label > span {
    font-size: .9rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--fx-muted);
}

.dialog-body input,
.dialog-body select,
.dialog-body textarea {
    font: inherit;
    padding: .6rem .75rem;
    border: 1px solid var(--fx-border);
    border-radius: 0px;
    background: #fff;
    color: var(--fx-text);
    box-shadow: var(--fx-shadow-sm);
}

.dialog-body input:focus,
.dialog-body select:focus,
.dialog-body textarea:focus {
    outline: 2px solid var(--fx-accent);
    outline-offset: 1px;
}

.dialog-body input[readonly] {
    background: #f6f7f2;
    color: var(--fx-muted);
}

.dialog-foot {
    position: relative;
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
    padding: 1rem 2rem;
    border-top: 1px solid var(--fx-border);
}

.dialog-scan-button {
    margin-right: auto;
}

.dialog-qr-scanner {
    display: grid;
    gap: 1rem;
    width: 100%;
}

.dialog-qr-scanner h3,
.dialog-qr-scanner p {
    margin: 0;
}

.dialog-qr-actions {
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
}

.dialog-qr-saved {
    margin: 0 2rem 1rem;
    padding: .7rem 1rem;
    border-left: 4px solid #66821f;
    background: #eef4d5;
    color: #35450f;
    font-weight: 700;
}

.version-badge-dialog {
    position: absolute;
    left: 1rem;
    bottom: .75rem;
    color: rgba(64, 64, 63, .48);
}

.btn-primary {
    padding: .6rem 1.4rem;
    border: none;
    border-radius: 7px;
    background: #e3ebb5;
    background: linear-gradient(180deg, rgba(227, 235, 181, 1) 0%, rgba(158, 179, 89, 1) 100%);
    color: var(--fx-on-accent);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--fx-shadow-md);
}

.btn-primary:hover:not(:disabled) {
    background: var(--fx-accent-dark);
    color: #fff;
}

.btn-text {
    padding: .6rem 1.2rem;
    border: 1px solid var(--fx-border);
    border-radius: 10px;
    background: var(--fx-surface);
    color: var(--fx-text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--fx-shadow-sm);
}

.btn-primary:disabled,
.btn-text:disabled {
    opacity: .6;
    cursor: default;
}

.badge {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 7px;
    font-size: .90rem;
    font-weight: 700;
    box-shadow: var(--fx-shadow-sm);
}

.badge-open {
background: #f0dfc2;
background: linear-gradient(180deg, rgba(240, 223, 194, 1) 0%, rgba(201, 179, 99, 1) 100%);
    color: #9c6d1a;
}

.badge-done {
    background: var(--fx-accent-soft);
    color: var(--fx-ok);
}

.empty, .loading {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--fx-muted);
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .9rem;
}

.btn-primary .k-loader {
    margin-right: .4rem;
    vertical-align: middle;
}

.quick-work {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: 7px;
}

.quick-work .k-button-solid-primary {
    background-color: var(--fx-accent);
    border-color: var(--fx-accent);
    color: var(--fx-on-accent);
}

.quick-work-icon.k-button {
    width: 33px;
    height: 33px;
    min-width: 33px;
    padding: 0;
    border-radius: 50%;
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    opacity: .55;
}

.quick-work-icon.k-button.is-active {
    opacity: 1;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, .15);
}

.quick-work-icon-serviced.k-button {
    background-color: #93dd56;
    border-color: #93dd56;
}

.quick-work-icon-new.k-button {
    background-color: #5a8cc5;
    border-color: #5a8cc5;
}

.object-age-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.25rem;
    padding: 1rem 1.5rem;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--fx-accent-soft) 0%, #fff 75%);
    box-shadow: var(--fx-shadow-sm);
}

.object-age-metric {
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.object-age-value {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1;
}

.object-age-label {
    font-size: .68rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--fx-muted);
}

.object-age-metric-age .object-age-value {
    color: var(--fx-text);
}

.object-age-metric-renewal .object-age-value {
    color: var(--fx-ok);
}

.object-age-metric-overdue .object-age-value {
    color: #c62828;
}

.object-age-divider {
    width: 1px;
    align-self: stretch;
    background: var(--fx-border);
}

.object-age-bar {
    flex: 1 1 100%;
    height: 8px;
    border-radius: 999px;
    background: #eee;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px var(--fx-border);
}

.object-age-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #9eb359 0%, #4f8a3f 100%);
    transition: width .3s ease;
}

.object-age-bar-fill.is-overdue {
    background: linear-gradient(90deg, #e57373 0%, #c62828 100%);
}

.error {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    background: #fdecec;
    color: #a3242a;
    box-shadow: var(--fx-shadow-sm);
    margin-bottom: 1rem;
}

.warning {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    background: #fff4e0;
    color: #8a5a00;
    box-shadow: var(--fx-shadow-sm);
    margin-bottom: 1rem;
}

.chip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: .75rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: .9rem 1.5rem;
    margin-bottom: 1.5rem;
    color: #fff;
}

.info {
    display: flex;
    flex-direction: column;
}

.info small {
    font-size: .7rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    opacity: .8;
}

.info span {
    font-weight: 600;
}

.certificate-note {
    padding: 1rem;
    margin-bottom: 1rem;
}

.certificate-note-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.certificate-note-head h3 {
    margin: 0;
}

.certificate-note-text {
    margin: .5rem 0 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.contact-field,
.contact-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

html:has(.contacts-backdrop) {
    overflow: hidden;
    scrollbar-gutter: auto;
}

.contacts-backdrop {
    width: 100vw;
    height: 100dvh;
}

.contacts-dialog {
    color: var(--fx-text);
    min-height: 0;
    overflow: hidden;
}

.contacts-dialog .dialog-head {
    flex-shrink: 0;
    padding: .8rem 1rem;
    gap: .75rem;
}

.contacts-dialog .dialog-head > div {
    min-width: 0;
}

.contacts-dialog .dialog-head h2 {
    font-size: 1.2rem;
}

.contacts-dialog .dialog-sub {
    font-size: .8rem;
    overflow-wrap: anywhere;
}

.contacts-dialog .btn-ghost {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
}

.contacts-dialog .dialog-body {
    min-height: 0;
    padding: .75rem;
    gap: .75rem;
}

.contacts-body {
    grid-template-columns: minmax(0, 1fr);
    background: #f6f8f2;
}

.contacts-section-heading {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.contacts-section-heading h3,
.contacts-add-panel h3 {
    margin: 0;
    font-size: .95rem;
    color: var(--fx-text);
}

.contacts-count {
    display: inline-flex;
    justify-content: center;
    min-width: 1.6rem;
    padding: .15rem .4rem;
    border-radius: 1rem;
    background: var(--fx-accent-soft);
    color: var(--fx-accent-dark);
    font-size: .8rem;
    font-variant-numeric: tabular-nums;
}

.contacts-hint {
    margin: .25rem 0 .6rem;
    color: var(--fx-muted);
    font-size: .75rem;
}

.contact-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
    gap: .5rem;
}

.contact-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    align-content: start;
    gap: .4rem;
    border: 1px solid var(--fx-border);
    border-radius: 12px;
    padding: .65rem .5rem .65rem .75rem;
    background: var(--fx-surface);
}

.contact-info {
    min-width: 0;
    overflow-wrap: anywhere;
}

.contact-identity {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin-bottom: .25rem;
}

.contact-avatar {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    flex: 0 0 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--fx-accent-soft);
    color: var(--fx-accent-dark);
    font-size: .8rem;
}

.contact-heading {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.contact-heading strong {
    font-size: .95rem;
}

.contact-info .contact-role {
    color: var(--fx-muted);
    font-size: .75rem;
    font-weight: 400;
}

.contact-channel {
    display: flex;
    align-items: center;
    gap: .45rem;
    width: fit-content;
    max-width: 100%;
    min-height: 44px;
    color: var(--fx-text);
    text-decoration: none;
    font-size: .85rem;
}

.contact-channel:hover {
    color: var(--fx-accent-dark);
    text-decoration: underline;
}

.contact-channel svg,
.contact-create-button svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.contact-channel-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
}

.contact-note {
    margin-top: .1rem;
    color: var(--fx-muted);
    font-size: .8rem;
}

.contact-note summary {
    cursor: pointer;
    padding: .4rem 0;
}

.contact-note p {
    margin: .25rem 0 0;
    white-space: pre-wrap;
}

.contact-remove {
    box-shadow: none;
}

.contact-remove-confirm {
    grid-column: 1 / -1;
    border-top: 1px solid var(--fx-border);
    padding-top: .5rem;
    font-size: .8rem;
}

.contact-remove-confirm > span {
    flex-basis: 100%;
}

.contacts-add-panel {
    min-width: 0;
    padding: .75rem;
    border: 1px solid var(--fx-border);
    border-radius: 12px;
    background: var(--fx-surface);
}

.contacts-add-panel > label {
    margin: .5rem 0;
}

.contacts-add-panel > .contact-info {
    margin: .5rem 0;
}

.contacts-add-panel .contact-actions > button {
    width: 100%;
    min-height: 44px;
}

.contacts-dialog .dialog-foot {
    flex-shrink: 0;
    padding: .6rem .75rem max(.6rem, env(safe-area-inset-bottom));
}

.contact-create-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 44px;
}

.contacts-create-body {
    grid-template-columns: minmax(0, 1fr);
}

.contact-create-form fieldset {
    border: 0;
    padding: 0;
    margin: 0;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 1rem;
}

.contact-create-form input,
.contact-create-form textarea {
    width: 100%;
    min-width: 0;
    font-size: 16px;
}

.contact-create-form .contact-actions {
    justify-content: flex-end;
}

@media (max-width: 700px) {
    .contacts-dialog .dialog-head {
        padding: max(.6rem, env(safe-area-inset-top)) .65rem .6rem;
    }

    .contacts-dialog .dialog-body {
        padding: .5rem;
        gap: .6rem;
    }

    .contacts-dialog .dialog-foot .contact-create-button {
        flex: 1;
    }
}

.chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .7rem .9rem;
    background: var(--fx-surface);
    border-radius: 12px;
    box-shadow: var(--fx-shadow-sm);
    font-weight: 600;
}

.chip small {
    color: var(--fx-muted);
    font-weight: 500;
}

/* ---------- Phone layout ---------- */
@media (max-width: 700px) {
    .app-main {
        padding: 1rem .75rem 7rem .75rem;
    }

    .topbar {
        gap: .55rem;
        padding: .5rem .75rem;
    }

    .topbar-title {
        font-size: .72rem;
    }

    .auth-logo {
        height: 36px;
    }

    .topbar-nav {
        gap: .4rem;
    }

    .btn-top,
    .user-avatar {
        width: 38px;
        height: 38px;
    }

    .home-hero {
        min-height: 170px;
        display: grid;
        align-items: end;
    }

    .home-grid {
        grid-template-columns: 1fr;
    }

    .settings-admin-card {
        display: grid;
    }

    .info-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .75rem 1rem;
    }

    .table-head {
        display: none;
    }

    .card:has(.k-listview) {
        background: transparent;
        box-shadow: none;
        overflow: visible;
    }

    .table-row {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: .4rem;
        padding: 3px 5px;
        margin: 0 5px .5rem;
        border: 1px solid var(--fx-border);
        border-radius: 7px;
        background: var(--fx-surface);
        box-shadow: var(--fx-shadow-sm);
        transition: transform .1s ease, box-shadow .1s ease;
    }

    .table-row.row-link:active {
        transform: scale(.98);
        box-shadow: var(--fx-shadow-sm);
    }

    .table-row.line-ok {
        background: #eaf5cf;
    }

    .table-row.line-bad {
        background: #fbe3e3;
    }

    .table-row.line-info-blue {
        background: #e0edfb;
    }

    .table-row.line-ok:active {
        background: #e0efb9;
    }

    .table-row.line-bad:active {
        background: #f7d2d2;
    }

    .table-row.line-info-blue:active {
        background: #cee2f7;
    }

    .table-row.line-scanned {
        border: 2px solid #ff8c00;
        border-radius: 14px;
    }

    .table-row > div {
        padding: 0;
        border: none;
        display: flex;
        gap: .3rem;
        align-items: center;
    }

    .table-row > div:empty,
    .table-row > div.cell-empty {
        display: none;
    }

    .table-row > div:not([data-label]) {
        display: flex;
        flex: 1 1 100%;
        text-align: left;
    }

    .line-image {
        width: auto;
    }

    .line-image img {
        width: 36px;
        height: 36px;
    }

    .line-info {
        font-size: 1rem;
        font-weight: 600;
        color: var(--fx-text);
    }

    .table-row > div[data-label] {
        flex: 0 0 auto;
        padding: .25rem .55rem;
        border-radius: 7px;
        background: #f0f0f0;
        font-size: .72rem;
        font-weight: 700;
        color: var(--fx-text);
        border: 1px solid #a8a7a7;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    }

    .table-row > div[data-label]::before {
        content: attr(data-label);
        flex: 0 0 auto;
        font-size: .62rem;
        letter-spacing: .04em;
        text-transform: uppercase;
        font-weight: 600;
        color: var(--fx-muted);
    }

    .table-row.line-header {
        background: transparent;
        border: none;
        box-shadow: none;
        padding: .5rem .2rem .35rem;
        margin-bottom: 0;
    }

    .line-header {
        text-align: left;
    }

    .row-link-arrow {
        display: none;
    }

    .dialog-head,
    .dialog-body,
    .dialog-foot {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .dialog-body {
        grid-template-columns: 1fr;
    }

    .dialog-compact .dialog-head {
        padding-top: .6rem;
        padding-bottom: .6rem;
        gap: .6rem;
    }

    .dialog-compact .dialog-head h2 {
        font-size: 1.05rem;
    }

    .dialog-compact .dialog-body {
        padding-top: .85rem;
        padding-bottom: .85rem;
        gap: .6rem .8rem;
    }

    .dialog-compact .dialog-body label {
        gap: .15rem;
    }

    .dialog-compact .dialog-foot {
        padding-top: .6rem;
        padding-bottom: .6rem;
    }

    .status-summary {
        gap: .4rem;
    }

    .status-chip {
        padding: .25rem .6rem;
    }

    .approve-banner {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .btn-approve {
        width: 100%;
    }
}

/* ---------- Blazor error ui ---------- */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}
