:root {
    --bg: #eef3f8;
    --panel: rgba(255, 255, 255, 0.9);
    --panel-strong: rgba(247, 250, 254, 0.98);
    --ink: #1f2937;
    --muted: #5b6472;
    --accent: #0b5cab;
    --accent-dark: #083a73;
    --line: rgba(11, 92, 171, 0.16);
    --good: #1f6f53;
    --warn: #9a6700;
    --shadow: 0 20px 40px rgba(31, 41, 55, 0.12);
    --gold: #3b82f6;
    --gold-dark: #1d4ed8;
    --radius: 22px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", "Helvetica Neue", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.14), transparent 30%),
        radial-gradient(circle at bottom right, rgba(11, 92, 171, 0.10), transparent 26%),
        linear-gradient(145deg, #f6f9fc 0%, #e8eef5 48%, #fbfdff 100%);
    overflow-x: hidden;
}

body.auth-required .app-shell {
    display: none !important;
}

body.privacy-locked .app-shell {
    display: none !important;
}

.app-shell {
    min-height: 100vh;
    padding: 28px;
    width: 100%;
    display: grid;
    grid-template-columns: 0 minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 18px;
    row-gap: 14px;
    align-content: start;
    transition: grid-template-columns 180ms ease;
}

.app-topbar {
    position: relative;
    z-index: 80;
    grid-column: 1 / -1;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 10px 14px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent-dark), var(--accent));
    border: 1px solid rgba(8, 58, 115, 0.28);
    box-shadow: 0 14px 28px rgba(8, 58, 115, 0.18);
}

.topbar-spacer {
    flex: 1 1 auto;
    min-width: 0;
}

.topbar-brand {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 2px;
    color: #fff;
    overflow: hidden;
}

.topbar-brand-line {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.05;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0;
}

.app-shell.sidebar-open {
    grid-template-columns: 270px minmax(0, 1fr);
}

.sidebar-nav {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
    align-self: start;
    position: sticky;
    top: 28px;
    height: calc(100vh - 56px);
    overflow: hidden;
    transition: opacity 180ms ease, transform 180ms ease;
}

.app-shell:not(.sidebar-open) .sidebar-nav {
    opacity: 0;
    transform: translateX(-12px);
    pointer-events: none;
}

.app-body {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    align-self: start;
}

.user-chip {
    margin-left: auto;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 48px;
    min-width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: #fff;
    box-shadow: none;
    position: relative;
    overflow: hidden;
}

.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    background: transparent;
    color: #fff;
    font-size: 0;
    flex: none;
}

.user-avatar::before {
    content: "";
    width: 20px;
    height: 20px;
    background: currentColor;
    -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="black"><path d="M12 12c2.761 0 5-2.239 5-5s-2.239-5-5-5-5 2.239-5 5 2.239 5 5 5zm0 2c-4.418 0-8 2.239-8 5v3h16v-3c0-2.761-3.582-5-8-5z"/></svg>') center / contain no-repeat;
    mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="black"><path d="M12 12c2.761 0 5-2.239 5-5s-2.239-5-5-5-5 2.239-5 5 2.239 5 5 5zm0 2c-4.418 0-8 2.239-8 5v3h16v-3c0-2.761-3.582-5-8-5z"/></svg>') center / contain no-repeat;
}

.user-menu {
    position: absolute;
    top: 70px;
    right: 28px;
    display: none;
    z-index: 90;
    min-width: 220px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--panel-strong);
    box-shadow: var(--shadow);
    gap: 8px;
}

.user-menu.open {
    display: grid;
}

.user-menu-item {
    width: 100%;
    justify-content: flex-start;
    border-radius: 10px;
    background: rgba(11, 92, 171, 0.10);
    border: 1px solid rgba(11, 92, 171, 0.14);
}

body:not(.show-home-hero) .hero {
    display: none;
}

.hero[aria-hidden="true"] {
    display: none !important;
}

.hero {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
    padding: 28px;
    border-radius: calc(var(--radius) + 4px);
    background: linear-gradient(135deg, rgba(8, 58, 115, 0.96), rgba(11, 92, 171, 0.92));
    color: #f8fbff;
    box-shadow: var(--shadow);
}

.eyebrow,
.hero-kicker {
    margin: 0 0 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.74rem;
    opacity: 0.82;
}

.hero h1 {
    margin: 0;
    font-size: clamp(2.2rem, 4vw, 4rem);
    line-height: 0.95;
}

.hero-copy {
    max-width: 40rem;
    margin: 14px 0 0;
    color: rgba(248, 251, 255, 0.9);
    font-size: 1rem;
}

.hero-panel {
    align-self: end;
    padding: 20px;
    border-radius: var(--radius);
    background: rgba(255, 248, 239, 0.12);
    backdrop-filter: blur(6px);
}

.hero-panel ul {
    margin: 0;
    padding-left: 18px;
}

.layout {
    width: 100%;
    margin: 0;
    display: grid;
    gap: 22px;
    min-width: 0;
}

.mode-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.mode-tab.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
}

.mode-portal[hidden] {
    display: none;
}

.section-tabs {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    min-height: 100%;
    margin: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.section-tab {
    white-space: nowrap;
}

.menu-toggle {
    width: 48px;
    min-width: 48px;
    height: 48px;
    padding: 0;
    font-size: 1.1rem;
    line-height: 1;
    border-radius: 12px;
    background: transparent;
    color: #fff !important;
    border: 1px solid transparent;
    box-shadow: none;
    position: relative;
    overflow: hidden;
}

.menu-toggle::before {
    color: #fff;
}

.section-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin: 0;
}

.section-menu .section-tab {
    width: 100%;
    justify-content: flex-start;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.42);
    border: 1px solid rgba(11, 92, 171, 0.10);
}

.section-tab.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    border-color: rgba(8, 58, 115, 0.28);
}

.app-section {
    display: none;
}

.app-section.active {
    display: block;
}

.panel {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
    min-width: 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.panel h2 {
    margin: 0;
    font-size: 1.1rem;
}

.ghost-button,
button {
    border: none;
    border-radius: 999px;
    padding: 11px 16px;
    font: inherit;
    cursor: pointer;
    transition: transform 160ms ease, opacity 160ms ease;
}

button {
    background: var(--accent);
    color: white;
}

.ghost-button {
    background: rgba(15, 107, 87, 0.08);
    color: var(--accent-dark);
}

button:hover,
.ghost-button:hover {
    transform: translateY(-1px);
}

.metrics-grid,
.three-up,
.two-up {
    display: grid;
    gap: 18px;
}

.metrics-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.pawn-book-summary {
    margin: 12px 0 14px;
}

.metric {
    padding: 16px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(11, 92, 171, 0.08), rgba(255, 255, 255, 0.94));
    border: 1px solid rgba(11, 92, 171, 0.14);
}

.metric-label {
    color: var(--muted);
    font-size: 0.82rem;
}

.metric-value {
    margin-top: 8px;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--accent-dark);
}

.metric-compact .metric-value {
    font-size: 1.1rem;
}

.featured-card {
    margin-top: 18px;
    padding: 20px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(11, 92, 171, 0.08), rgba(255, 255, 255, 0.94));
    border: 1px solid rgba(11, 92, 171, 0.18);
}

.active-pawn-range-panel {
    margin-top: 18px;
    min-width: 0;
}

.active-pawn-range-panel .table-wrap {
    margin-top: 14px;
    width: 100%;
    max-width: 100%;
    display: block;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable both-edges;
    overscroll-behavior-x: contain;
    touch-action: pan-x pan-y;
}

.active-pawn-range-panel .metrics-grid {
    margin-top: 14px;
}

.active-range-search {
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto auto;
}

.active-pawn-range-panel .list-grid {
    display: none;
    margin-top: 14px;
}

.active-pawn-range-panel .data-table {
    width: max-content;
    min-width: 1460px;
    table-layout: auto;
}

.active-pawn-range-panel .data-table th,
.active-pawn-range-panel .data-table td {
    white-space: nowrap;
}

.featured-card h3 {
    margin: 0 0 8px;
}

.two-up {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three-up {
    grid-template-columns: 1.2fr 1.2fr 1fr;
}

.stacked-form,
.compact-grid {
    display: grid;
    gap: 14px;
}

.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.compact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.weight-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

label {
    display: grid;
    gap: 6px;
    font-size: 0.92rem;
    color: var(--muted);
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: white;
    color: var(--ink);
    font: inherit;
}

.inventory-picker {
    display: grid;
    gap: 10px;
    max-height: 220px;
    overflow: auto;
}

.inventory-option,
.list-card,
.sale-card {
    padding: 14px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--panel-strong);
}

.list-card.is-editable {
    cursor: pointer;
}

.inventory-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.inventory-option input {
    width: auto;
    margin-top: 4px;
}

.sold-row {
    opacity: 0.6;
}

.list-grid,
.sales-list {
    display: grid;
    gap: 12px;
}

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

.tag {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 600;
}

.tag.active {
    background: rgba(11, 92, 171, 0.12);
    color: var(--good);
}

.tag.closed {
    background: rgba(11, 92, 171, 0.14);
    color: var(--warn);
}

.tag.alert {
    background: rgba(179, 50, 50, 0.14);
    color: #a22a2a;
}

.status-line {
    min-height: 20px;
    margin: 12px 0 0;
    color: var(--accent-dark);
}

.sale-summary {
    padding: 12px 14px;
    border: 1px dashed rgba(11, 92, 171, 0.24);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.64);
}

.sale-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.sale-summary-grid strong {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
    margin-bottom: 4px;
}

.sale-summary-grid div {
    color: var(--ink);
    font-size: 0.95rem;
}

.inline-search {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    margin-bottom: 12px;
}

.txn-inline-search {
    grid-template-columns: 1fr 1fr auto auto;
}

.reco-inline-search {
    grid-template-columns: 1.2fr 1fr 1fr auto auto;
}

.pawn-inline-actions {
    margin-top: 10px;
}

.pawn-inline-details {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(11, 92, 171, 0.18);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.5);
}

.pawn-inline-details summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--ink);
}

.pawn-inline-details summary::marker {
    color: var(--muted);
}

.pawn-inline-details > .pawn-inline-actions {
    margin-top: 10px;
}

.pawn-quick-actions {
    align-items: start;
}

.pawn-quick-actions .form-actions {
    grid-column: 1 / -1;
}

.pawn-quick-actions .meta {
    grid-column: 1 / -1;
}

.collateral-section {
    padding: 14px;
    border: 1px dashed rgba(11, 92, 171, 0.24);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.64);
}

.collateral-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.collateral-section-header strong {
    display: block;
    color: var(--ink);
}

.collateral-section-header .meta {
    margin: 4px 0 0;
}

body.section-controls-minimal .panel-header .form-actions > button:not(.logout-trigger) {
    display: none;
}

.collateral-items {
    display: grid;
    gap: 12px;
}

.collateral-row {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 0.9fr) minmax(140px, 0.75fr) minmax(140px, 0.75fr) auto;
    gap: 12px;
    align-items: end;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.55);
}

.collateral-row-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}

.icon-button {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    padding: 0;
    font-size: 1.5rem;
    line-height: 1;
    font-weight: 700;
    box-shadow: none;
}

.add-button {
    background: rgba(11, 92, 171, 0.12);
    color: var(--good);
    border: 1px solid rgba(11, 92, 171, 0.24);
}

.remove-button {
    background: rgba(11, 92, 171, 0.12);
    color: #b23a2f;
    border: 1px solid rgba(178, 58, 47, 0.24);
}

.collateral-row-gold {
    box-shadow: inset 4px 0 0 rgba(11, 92, 171, 0.34);
}

.collateral-row-silver {
    box-shadow: inset 4px 0 0 rgba(59, 130, 246, 0.34);
}

.collateral-row .ghost-button {
    height: 46px;
}

.print-row-full {
    grid-column: 1 / -1;
    align-items: start;
}

.print-row-full > div {
    white-space: normal;
}

.print-collateral-items {
    display: grid;
    gap: 4px;
}

.correction-form {
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr;
}

.pawn-transactions {
    margin-top: 10px;
    border-top: 1px dashed var(--line);
    padding-top: 10px;
}

.pawn-transactions h4 {
    margin: 0 0 8px;
    font-size: 0.85rem;
    color: var(--muted);
}

.txn-item {
    font-size: 0.82rem;
    color: var(--muted);
    padding: 4px 0;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel-strong);
}

#section-pawn-book .table-wrap,
#section-pawn-update .table-wrap,
#section-pawn-corrections .table-wrap {
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 340px);
    overflow-x: auto;
    overflow-y: auto;
    display: block;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable both-edges;
}

#section-pawn-book .data-table,
#section-pawn-update .data-table,
#section-pawn-corrections .data-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

#section-pawn-book .data-table th,
#section-pawn-book .data-table td,
#section-pawn-update .data-table th,
#section-pawn-update .data-table td,
#section-pawn-corrections .data-table th,
#section-pawn-corrections .data-table td {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.selected-row {
    background: rgba(11, 92, 171, 0.08);
}

.pawn-detail-panel {
    margin-top: 14px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(235, 242, 250, 0.92));
}

.pawn-detail-panel h3 {
    margin: 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 920px;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-size: 0.84rem;
    color: var(--ink);
    white-space: nowrap;
}

.data-table th {
    position: sticky;
    top: 0;
    background: linear-gradient(180deg, rgba(245, 248, 252, 0.98), rgba(226, 233, 243, 0.96));
    color: var(--accent-dark);
    font-weight: 600;
}

#section-pawn-book .data-table,
#section-pawn-update .data-table,
#section-pawn-corrections .data-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

#section-pawn-book .data-table th,
#section-pawn-book .data-table td,
#section-pawn-update .data-table th,
#section-pawn-update .data-table td,
#section-pawn-corrections .data-table th,
#section-pawn-corrections .data-table td {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.auth-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    min-height: 100vh;
    display: none;
    place-items: center;
    background: rgba(16, 24, 40, 0.72);
    backdrop-filter: blur(6px);
    z-index: 9999;
    padding: 18px;
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
}

.auth-overlay.visible {
    display: grid;
}

.auth-overlay.visible,
.auth-overlay.visible * {
    box-sizing: border-box;
}

.auth-card {
    width: min(420px, 100%);
    background: #ffffff;
    border: 2px solid rgba(11, 92, 171, 0.28);
    border-radius: 18px;
    box-shadow: 0 28px 72px rgba(16, 24, 40, 0.36);
    padding: 24px;
    display: grid;
    gap: 12px;
}

.auth-card label {
    display: grid;
    gap: 8px;
    color: var(--ink);
    font-weight: 600;
}

.auth-card h3 {
    color: var(--accent-dark);
    font-size: 1.25rem;
}

.auth-card .meta {
    color: var(--muted);
}

.auth-card input {
    background: #fff;
    border: 1px solid rgba(11, 92, 171, 0.22);
    min-height: 46px;
}

.auth-card button {
    width: 100%;
    min-height: 48px;
    box-shadow: none;
}

.auth-card h3 {
    margin: 0;
}

.review-card {
    width: min(760px, 100%);
    max-height: calc(100dvh - 36px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.success-card {
    width: min(880px, 100%);
}

.review-card > h3,
.review-card > .meta {
    flex: 0 0 auto;
}

.review-card > .review-grid {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding-right: 2px;
}

.review-card > .form-actions {
    flex: 0 0 auto;
    position: sticky;
    bottom: 0;
    margin-top: 8px;
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff 28%);
}

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

.review-item {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.7);
}

.review-item strong {
    display: block;
    margin-bottom: 4px;
    color: var(--accent-dark);
    font-size: 0.82rem;
}

.status-inline-action {
    margin-left: 8px;
}

.print-sheet {
    display: none;
}

.item-tag-sheet {
    width: 3.25in;
    min-height: 2in;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 0;
}

.tag-card {
    width: 100%;
    border: 1px solid var(--accent-dark);
    border-radius: 10px;
    padding: 12px;
    display: grid;
    gap: 10px;
    background: #fff;
}

.tag-header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: start;
}

.tag-store {
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.tag-sku {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-dark);
}

.tag-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink);
}

.tag-meta {
    font-size: 0.8rem;
    color: var(--muted);
}

.tag-price {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-dark);
}

.tag-code {
    border-top: 1px dashed rgba(11, 92, 171, 0.28);
    padding-top: 8px;
    font-family: "Courier New", monospace;
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    color: var(--ink);
}

.pawn-mobile-list {
    display: none;
    margin-bottom: 12px;
}

#inventoryMobileList,
#salesMobileList,
#activePawnRangeMobileList {
    display: none;
    margin-bottom: 12px;
}

.risk-mobile-list,
.txn-mobile-list {
    display: none;
    margin-bottom: 12px;
}

.scroll-controls {
    position: fixed;
    right: 16px;
    bottom: 16px;
    display: grid;
    gap: 10px;
    z-index: 50;
}

.scroll-button {
    width: 46px;
    height: 46px;
    padding: 0;
    border-radius: 50%;
    background: rgba(11, 92, 171, 0.16);
    color: var(--accent-dark);
    border: 1px solid rgba(11, 92, 171, 0.24);
    backdrop-filter: blur(6px);
    box-shadow: 0 10px 24px rgba(16, 24, 40, 0.12);
}

.scroll-button:hover {
    background: rgba(11, 92, 171, 0.24);
}

.print-sheet-inner {
    width: 7.6in;
    min-height: 10.1in;
    margin: 0 auto;
    background: #fff;
    color: var(--ink);
    font-family: "Segoe UI", sans-serif;
    position: relative;
    overflow: hidden;
}

.print-watermark {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    font-weight: 700;
    letter-spacing: 0.18em;
    color: rgba(11, 92, 171, 0.08);
    transform: rotate(-28deg);
    pointer-events: none;
    text-align: center;
    padding: 24px;
}

.print-content {
    position: relative;
    z-index: 1;
}

.print-header {
    border-bottom: 2px solid var(--accent);
    padding-bottom: 10px;
    margin-bottom: 18px;
}

.print-header h1 {
    margin: 0;
    font-size: 24px;
}

.print-sub {
    color: var(--muted);
    font-size: 12px;
    margin-top: 4px;
}

.print-title {
    margin: 18px 0 10px;
    font-size: 18px;
    font-weight: 700;
}

.print-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 20px;
    margin-bottom: 18px;
}

.print-row strong {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 4px;
}

.print-row div {
    font-size: 14px;
}

.print-notes {
    margin-top: 20px;
    border-top: 1px solid rgba(11, 92, 171, 0.22);
    padding-top: 12px;
    font-size: 12px;
    color: var(--accent-dark);
}

.print-transactions {
    margin-top: 18px;
}

.print-transactions h3 {
    margin: 0 0 10px;
    font-size: 14px;
    color: var(--accent-dark);
}

.print-transactions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.print-transactions-table th,
.print-transactions-table td {
    border: 1px solid rgba(11, 92, 171, 0.22);
    padding: 6px 8px;
    text-align: left;
    vertical-align: top;
}

.print-transactions-table th {
    background: linear-gradient(180deg, rgba(245, 248, 252, 0.98), rgba(226, 233, 243, 0.96));
    color: var(--accent-dark);
}

.print-collateral-table-wrap {
    display: grid;
    gap: 12px;
    margin-top: 6px;
}

.print-collateral-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.print-collateral-table th,
.print-collateral-table td {
    border: 1px solid rgba(11, 92, 171, 0.22);
    padding: 6px 8px;
    text-align: left;
    vertical-align: top;
}

.print-collateral-table th {
    background: linear-gradient(180deg, rgba(245, 248, 252, 0.98), rgba(226, 233, 243, 0.96));
    color: var(--accent-dark);
}

.print-collateral-summary {
    display: grid;
    gap: 6px;
    font-size: 12px;
    color: var(--ink);
}

.print-signatures {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    margin-top: 56px;
}

.print-signature-line {
    border-top: 1px solid var(--accent-dark);
    padding-top: 6px;
    font-size: 12px;
    color: var(--muted);
}

@media (max-width: 960px) {
    .hero,
    .two-up,
    .three-up,
    .compact-grid,
    .weight-summary-grid,
    .inline-search {
        grid-template-columns: 1fr;
    }

    .app-shell {
        padding: 16px;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto;
    }

    .app-shell.sidebar-open {
        grid-template-columns: 144px minmax(0, 1fr);
    }

    .hero {
        padding: 18px;
    }

    .panel {
        padding: 16px;
    }

    .panel-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .sidebar-nav {
        grid-column: 1;
        grid-row: 2;
        position: sticky;
        top: 16px;
        height: calc(100vh - 32px);
        max-height: none;
        z-index: auto;
        border-radius: 18px;
        box-shadow: var(--shadow);
        background: var(--panel-strong);
        overflow-y: auto;
    }

    .app-shell:not(.sidebar-open) .sidebar-nav {
        display: none;
    }

    .app-body {
        grid-column: 2;
        grid-row: 2;
    }

    .section-menu .section-tab {
        white-space: normal;
        text-align: center;
        line-height: 1.08;
        font-size: 0.8rem;
        padding: 11px 10px;
    }

    .form-actions {
        width: 100%;
    }

    .form-actions button {
        width: 100%;
    }

    .list-card {
        padding: 12px;
    }

    .pawn-inline-actions.compact-grid {
        grid-template-columns: 1fr;
    }

    .collateral-row {
        grid-template-columns: 1fr;
    }

    .collateral-row-actions {
        justify-content: flex-start;
    }

    .sale-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .active-range-search {
        grid-template-columns: 1fr 1fr;
    }

    .table-wrap {
        overflow-x: auto;
    }

    .data-table {
        min-width: 0;
        table-layout: fixed;
    }

    .data-table th,
    .data-table td {
        white-space: normal;
        word-break: break-word;
        overflow-wrap: anywhere;
        font-size: 0.78rem;
        padding: 8px 9px;
    }

    .active-pawn-range-panel .data-table {
        width: max-content;
        min-width: 1460px;
        table-layout: auto;
    }

    .active-pawn-range-panel .data-table th,
    .active-pawn-range-panel .data-table td {
        white-space: nowrap;
        word-break: normal;
        overflow-wrap: normal;
    }

    #section-pawn-book .table-wrap,
    #section-pawn-update .table-wrap,
    #section-pawn-corrections .table-wrap {
        display: none;
    }

    #section-pawn-book .pawn-mobile-list,
    #section-pawn-update .pawn-mobile-list,
    #section-pawn-corrections .pawn-mobile-list {
        display: grid;
    }

    #section-pawn-book .pawn-book-summary {
        display: none;
    }

    #section-pawn-book .pawn-detail-panel,
    #section-pawn-update .pawn-detail-panel,
    #section-pawn-corrections .pawn-detail-panel {
        margin-top: 10px;
        padding: 12px;
    }

    #section-pawn-update .pawn-detail-panel:not(.has-selection),
    #section-pawn-corrections .pawn-detail-panel:not(.has-selection) {
        display: none;
    }

    #section-pawn-risk .table-wrap,
    #section-pawn-transactions .table-wrap {
        display: none;
    }

    #activePawnRangePanel .table-wrap {
        display: block;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
    }

    #activePawnRangeMobileList {
        display: none;
    }

    #section-sales-inventory .table-wrap,
    #section-sales-history .table-wrap {
        display: none;
    }

    #inventoryMobileList,
    #salesMobileList {
        display: grid;
    }

    #section-pawn-risk .risk-mobile-list,
    #section-pawn-transactions .txn-mobile-list {
        display: grid;
    }

    .active-pawn-range-panel .metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .hero h1 {
        font-size: 1.45rem;
        line-height: 1.02;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    button,
    .ghost-button {
        width: 100%;
    }

    .menu-toggle {
        width: 44px;
        min-width: 44px;
        border-radius: 12px;
    }

    .app-topbar {
        width: calc(100vw - 32px);
        gap: 10px;
        justify-content: flex-start;
        padding: 8px 12px;
    }

    .topbar-brand-line {
        max-width: calc(100vw - 180px);
        font-size: 0.98rem;
    }

    .user-chip {
        margin-left: auto;
    }

    .user-menu {
        top: 60px;
        right: 16px;
        min-width: 0;
    }

    .sidebar-nav {
        top: 12px;
        height: calc(100vh - 24px);
    }

    .logout-trigger {
        width: auto;
    }

    .auth-card {
        padding: 16px;
    }

    .review-grid {
        grid-template-columns: 1fr;
    }

    .review-card {
        max-height: calc(100dvh - 24px);
        padding-bottom: 12px;
        width: min(100%, 100vw - 24px);
    }

    .review-card > .form-actions {
        gap: 8px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    }

    .review-card > .form-actions button {
        width: 100%;
    }

    #section-pawn-book .data-table,
    #section-pawn-update .data-table,
    #section-pawn-corrections .data-table,
    #section-pawn-risk .data-table {
        min-width: 860px;
    }

    #section-pawn-book .data-table,
    #section-pawn-update .data-table,
    #section-pawn-corrections .data-table {
        width: 100%;
        min-width: 0;
    }

    #section-pawn-book .table-wrap,
    #section-pawn-update .table-wrap,
    #section-pawn-corrections .table-wrap {
        max-height: none;
        overflow-x: auto;
        overflow-y: visible;
    }

    #section-pawn-update .pawn-mobile-list,
    #section-pawn-corrections .pawn-mobile-list {
        gap: 10px;
    }

    #section-pawn-update .list-card,
    #section-pawn-corrections .list-card {
        padding: 12px;
    }

    #section-pawn-update .inline-search,
    #section-pawn-update .pawn-inline-actions.compact-grid,
    #section-pawn-corrections .inline-search,
    #section-pawn-corrections .pawn-inline-actions.compact-grid {
        grid-template-columns: 1fr;
    }

    .scroll-controls {
        right: 12px;
        bottom: 12px;
    }

    .scroll-button {
        width: 42px;
        height: 42px;
    }
}

@media print {
    @page {
        size: 8.5in 11in;
        margin: 0.45in;
    }

    body {
        background: #fff;
    }

    .app-shell,
    .auth-overlay {
        display: none !important;
    }

    .print-sheet {
        display: block !important;
    }

    .print-grid {
        grid-template-columns: 1fr 1fr;
    }
}
