:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafa;
    --bg-panel: #ffffff;
    --bg-panel-2: #f3f6f5;
    --bg-input: #f8fafa;
    --border-color: #d9e2df;
    --border-soft: rgba(0, 0, 0, 0.07);
    --text-primary: #1a2e28;
    --text-secondary: #4a6259;
    --text-muted: #7a9189;
    --accent-primary: #1fa06d;
    --accent-strong: #17875c;
    --accent-warm: #d4930a;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.08);
    --radius-sm: 8px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
    overflow-x: hidden;
}

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

button,
input {
    font-family: inherit;
}

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(16px);
}

.header-content {
    max-width: 1560px;
    margin: 0 auto;
    min-height: 68px;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-width: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 0 0 auto;
}

.logo-icon,
.auth-mark {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #1f9d68 0%, #f2b84b 100%);
    box-shadow: 0 0 30px rgba(41, 193, 132, 0.22);
}

.logo-icon .material-icons-round,
.auth-mark .material-icons-round {
    color: #ffffff;
    font-size: 25px;
}

.logo-text {
    font-size: 19px;
    font-weight: 800;
    white-space: nowrap;
}

.logo-subtitle {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

.nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.nav-link,
.btn {
    min-height: 38px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 9px 13px;
    background: transparent;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
    white-space: nowrap;
}

.nav-link:hover,
.btn-outline:hover {
    color: var(--text-primary);
    border-color: var(--accent-primary);
    background: rgba(41, 193, 132, 0.08);
}

.nav-link .material-icons-round,
.btn .material-icons-round {
    font-size: 18px;
    margin: 0;
    padding: 0;
    line-height: 1;
}

.nav-link.danger {
    color: var(--danger);
}

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

.account-menu {
    position: relative;
    flex: 0 0 auto;
}

.account-button {
    min-height: 38px;
    border: 1px solid rgba(41, 193, 132, 0.35);
    border-radius: 8px;
    padding: 6px 8px;
    background: rgba(41, 193, 132, 0.08);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
}

.account-button:hover {
    border-color: var(--accent-primary);
    background: rgba(41, 193, 132, 0.14);
}

.account-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--accent-primary);
    color: #ffffff;
    font-size: 16px;
}

.account-name {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-caret {
    color: var(--text-muted);
    font-size: 18px;
    transition: transform 0.18s ease;
}

.account-menu.is-open .account-caret {
    transform: rotate(180deg);
}

.account-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 230px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-panel);
    box-shadow: var(--shadow-lg);
    z-index: 300;
}

.account-menu.is-open .account-dropdown {
    display: grid;
    gap: 6px;
}

.account-dropdown-head {
    padding: 9px 10px 11px;
    border-bottom: 1px solid var(--border-soft);
    display: grid;
    gap: 2px;
}

.account-dropdown-head strong {
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-dropdown-head span {
    color: var(--text-muted);
    font-size: 12px;
}

.account-dropdown-item {
    min-height: 38px;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
}

.account-dropdown-item:hover {
    background: rgba(41, 193, 132, 0.08);
    color: var(--text-primary);
}

.account-dropdown-item .material-icons-round {
    font-size: 18px;
}

.account-dropdown-item.danger {
    color: var(--danger);
}

.btn-primary {
    color: #ffffff;
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.btn-primary:hover {
    background: var(--accent-strong);
}

.btn-success {
    color: #ffffff;
    background: var(--success);
    border-color: var(--success);
}

.btn.danger,
.btn-outline.danger {
    color: var(--danger);
}

.btn.danger:hover,
.btn-outline.danger:hover {
    border-color: var(--danger);
    background: rgba(248, 113, 113, 0.08);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-wide {
    width: 100%;
}

.btn-small {
    min-height: 36px;
    padding: 8px 11px;
    font-size: 13px;
}

.main-container {
    max-width: 1560px;
    margin: 0 auto;
    padding: 28px 24px 40px;
}

.page-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 20px;
    min-width: 0;
}

.page-title-row.no-pad {
    padding-bottom: 10px;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: 30px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

h2 {
    font-size: 16px;
}

p,
.muted {
    color: var(--text-secondary);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.metric,
.panel,
.auth-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.metric {
    min-height: 104px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
    background: linear-gradient(135deg, #f8fffe 0%, #f0faf6 100%);
    border: 1px solid rgba(31, 160, 109, 0.15);
    position: relative;
    overflow: hidden;
}

.metric::before {
    content: "";
    position: absolute;
    top: -20px;
    right: -20px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(31, 160, 109, 0.06);
}

.metric-label {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 700;
}

.metric strong {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(320px, 0.75fr);
    gap: 18px;
}

.report-filter {
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(180px, 240px) auto;
    align-items: end;
    gap: 12px;
    margin-bottom: 18px;
}

.compact-history-filter {
    grid-template-columns: minmax(150px, 190px) minmax(150px, 190px) minmax(220px, 1fr) auto;
    margin-bottom: 12px;
}

.camera-settings-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 12px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 18px;
}

.settings-form {
    display: grid;
    gap: 14px;
}

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

.scale-settings-form .settings-current,
.scale-settings-form .action-row {
    grid-column: 1 / -1;
}

.settings-current {
    min-height: 46px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 11px 12px;
    background: rgba(255, 255, 255, 0.025);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.settings-current span:last-child {
    min-width: 0;
    overflow-wrap: anywhere;
}

.price-settings-panel {
    margin-top: 18px;
}

.price-date-filter {
    display: grid;
    grid-template-columns: minmax(180px, 240px) auto;
    align-items: end;
    gap: 12px;
    margin-bottom: 14px;
}

.price-add-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px) auto;
    align-items: end;
    gap: 12px;
    margin-bottom: 14px;
}

.price-add-button {
    width: 44px;
    min-width: 44px;
    padding-inline: 0;
}

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

.price-editor-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(120px, 150px);
    align-items: center;
    gap: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.025);
}

.price-editor-list .empty-cell {
    grid-column: 1 / -1;
}

.price-editor-row strong,
.price-editor-row small {
    display: block;
}

.price-editor-row small {
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 12px;
}

.price-history {
    margin-top: 18px;
}

.settings-device-list {
    display: grid;
    gap: 10px;
    margin: 0;
}

.settings-device-list div {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.settings-device-list div:last-child {
    border-bottom: 0;
}

.settings-device-list dt {
    color: var(--text-secondary);
    font-weight: 700;
}

.settings-device-list dd {
    margin: 0;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.report-metrics {
    margin-top: 0;
}

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

.report-wide {
    grid-column: 1 / -1;
}

.report-list {
    display: grid;
    gap: 8px;
    max-height: 430px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.report-row {
    min-height: 58px;
    padding: 11px 12px;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-width: 0;
}

.report-row > * {
    min-width: 0;
}

.report-row strong,
.report-row span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.report-row span {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 3px;
}

.report-row-right {
    text-align: right;
    flex: 0 0 auto;
}

.metric-link {
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.metric-link:hover {
    border-color: var(--accent-primary);
    background: linear-gradient(135deg, #f0fdf8 0%, #e8f9f0 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(31, 160, 109, 0.12);
}

.order-metrics {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.orders-layout {
    display: grid;
    grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.orders-layout > aside.panel {
    padding: 14px;
}

.orders-layout > aside.panel .panel-heading h2 {
    font-size: 18px;
}

.orders-layout > aside.panel .form-label {
    font-size: 13px;
}

.orders-layout > aside.panel .form-input {
    min-height: 46px;
    font-size: 16px;
    font-weight: 800;
}

.orders-layout > aside.panel .textarea {
    min-height: 90px;
}

.orders-layout > aside.panel .btn {
    min-height: 46px;
    font-size: 16px;
}

.textarea {
    min-height: 96px;
    resize: vertical;
}

.order-filter {
    display: grid;
    grid-template-columns: minmax(180px, 1.2fr) minmax(160px, 0.8fr) minmax(150px, 0.7fr) minmax(150px, 0.7fr) auto;
    align-items: end;
    gap: 10px;
    margin-bottom: 14px;
}

.order-list {
    display: grid;
    gap: 10px;
}

.order-card {
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background: var(--bg-secondary);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 164px;
    gap: 12px;
    padding: 12px;
}

.order-card-main {
    min-width: 0;
}

.order-card-head,
.order-card-body,
.order-item-mini {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.order-card-head {
    justify-content: flex-start;
    margin-bottom: 12px;
}

.order-card-head strong {
    font-size: 17px;
    margin-right: 8px;
}

.order-card-head span:not(.status-pill) {
    color: var(--text-muted);
    margin-right: 12px;
}

.order-card-body span,
.order-note,
.order-items summary,
.order-item-mini span {
    color: var(--text-muted);
}

.order-card-body {
    display: grid;
    grid-template-columns: minmax(130px, 1fr) minmax(104px, 0.8fr) minmax(72px, 0.45fr) minmax(120px, 0.85fr) minmax(72px, 0.45fr) minmax(106px, 0.7fr) minmax(116px, 0.75fr);
    align-items: start;
}

.order-card-body > div {
    min-width: 0;
}

.order-card-body strong,
.order-card-body span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.order-label {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.order-note {
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(41, 193, 132, 0.07);
    overflow-wrap: anywhere;
}

.order-detail-panel {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-soft);
}

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

.order-detail-section h3 {
    margin: 0 0 8px;
    font-size: 13px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.order-detail-list {
    display: grid;
    gap: 6px;
}

.order-detail-row {
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background: var(--bg-secondary);
}

.order-detail-row.is-deleted {
    opacity: 0.68;
}

.order-detail-row strong,
.order-detail-row span {
    display: block;
    overflow-wrap: anywhere;
}

.order-detail-row span,
.order-detail-meta {
    color: var(--text-muted);
    font-size: 13px;
}

.order-items {
    margin-top: 10px;
}

.order-items summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
}

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

.order-item-mini {
    min-height: 36px;
    padding: 7px 9px;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background: var(--bg-secondary);
}

.order-item-mini.is-deleted {
    opacity: 0.68;
}

.item-row.is-deleted {
    opacity: 0.68;
}

.order-item-mini strong {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.order-actions {
    display: grid;
    align-content: center;
    justify-items: stretch;
    gap: 7px;
    text-align: center;
}

.order-actions strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.order-actions .order-label {
    justify-self: center;
    text-align: center;
}

.order-action-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.order-action-buttons form,
.order-action-buttons .btn {
    min-width: 0;
}

.order-action-buttons .btn {
    width: 100%;
}

.order-action-buttons .btn.is-active {
    color: var(--text-primary);
    border-color: var(--accent-primary);
    background: rgba(41, 193, 132, 0.08);
}

.pager {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    color: var(--text-secondary);
}

.panel {
    padding: 18px;
    min-width: 0;
}

.panel.compact {
    padding: 14px;
}

.panel-heading {
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

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

.operation-log-wrap {
    height: 360px;
    max-height: 50vh;
    overflow-x: auto;
    overflow-y: scroll;
    scrollbar-width: thin;
}

.report-order-wrap {
    max-height: 520px;
    overflow: auto;
    scrollbar-width: thin;
}

.report-order-wrap .data-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bg-panel);
}

.photo-link,
.text-link {
    color: var(--accent-primary);
    font-weight: 800;
}

.completion-thumb-link {
    position: relative;
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    display: inline-block;
    width: 96px;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    line-height: 0;
    vertical-align: top;
    cursor: pointer;
}

.completion-thumb {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.24);
}

.completion-thumb:hover {
    border-color: var(--accent-primary);
}

.cursor-photo-preview {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 560;
    width: min(520px, calc(100vw - 32px));
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-panel);
    box-shadow: var(--shadow-lg);
    pointer-events: none;
}

.cursor-photo-preview[hidden] {
    display: none;
}

.cursor-photo-preview img {
    width: 100%;
    height: min(292px, calc((100vw - 52px) * 9 / 16));
    max-height: calc(100vh - 52px);
    object-fit: cover;
    border-radius: 8px;
    background: #000;
}

.missing-photo {
    color: var(--danger);
    font-weight: 800;
}

.dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 500;
    padding: 24px;
    background: rgba(0, 0, 0, 0.4);
    display: grid;
    place-items: center;
}

.dialog-backdrop[hidden] {
    display: none;
}

.order-photo-dialog {
    width: min(1120px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-panel);
    box-shadow: var(--shadow-lg);
}

.dialog-heading {
    min-height: 62px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.dialog-heading span {
    color: var(--text-muted);
    font-size: 13px;
}

.icon-button {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    display: grid;
    place-items: center;
    cursor: pointer;
}

.icon-button:hover {
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.dialog-body {
    padding: 16px;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
    gap: 16px;
}

.dialog-photo-frame {
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: calc(100vh - 170px);
    border-radius: 8px;
    background: #000;
    overflow: hidden;
}

.dialog-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.dialog-details {
    margin: 0;
    display: grid;
    align-content: start;
    gap: 10px;
}

.dialog-details div {
    padding: 11px 12px;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background: var(--bg-secondary);
}

.dialog-details dt {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.dialog-details dd {
    margin: 4px 0 0;
    font-size: 17px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.compact-report-list {
    max-height: 300px;
}

.operation-log-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.operation-log-panel .operation-log-wrap {
    flex: 0 0 auto;
}

.operation-log-wrap .data-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bg-panel);
}

.operation-log-wrap::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.operation-log-wrap::-webkit-scrollbar-thumb {
    background: rgba(157, 180, 172, 0.45);
    border-radius: 8px;
}

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

.data-table th,
.data-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border-soft);
    text-align: left;
    white-space: nowrap;
}

.data-table th {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.empty-cell {
    color: var(--text-muted);
    text-align: center;
    padding: 18px;
}

.status-pill {
    min-width: 92px;
    min-height: 28px;
    padding: 5px 9px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
}

.status-waiting {
    color: var(--accent-warm);
    background: rgba(242, 184, 75, 0.12);
}

.status-processing {
    color: #67e8f9;
    background: rgba(103, 232, 249, 0.12);
}

.status-done {
    color: var(--success);
    background: rgba(34, 197, 94, 0.12);
}

.status-cancelled {
    color: var(--danger);
    background: rgba(248, 113, 113, 0.12);
}

.price-list,
.item-list,
.waiting-list {
    display: grid;
    gap: 8px;
}

.price-row,
.item-row,
.waiting-row {
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

.price-row > *,
.item-row > *,
.waiting-row > * {
    min-width: 0;
}

.auth-shell {
    min-height: calc(100vh - 68px);
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-panel {
    width: min(420px, 100%);
    padding: 28px;
    text-align: center;
}

.auth-panel .form-stack,
.auth-panel .form-label,
.auth-panel .form-input,
.auth-panel .check-row,
.auth-panel .password-field {
    text-align: left;
}

.auth-panel h1 {
    margin-bottom: 20px;
}

.auth-downloads {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-soft);
    display: grid;
    gap: 10px;
}

.auth-mark {
    width: 56px;
    height: 56px;
    margin: 0 auto 18px;
}

.form-stack,
.form-grid {
    display: grid;
    gap: 12px;
}

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

.form-group {
    display: grid;
    gap: 7px;
}

.form-label {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
}

.form-input {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-primary);
    outline: none;
}

.form-input:focus {
    border-color: var(--accent-primary);
}

.quick-login-select {
    cursor: pointer;
}

.auth-divider {
    min-height: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: var(--border-soft);
}

.auth-divider span {
    white-space: nowrap;
}

.password-field {
    position: relative;
    min-width: 0;
}

.password-field .form-input {
    padding-right: 46px;
}

.icon-button {
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    display: inline-grid;
    place-items: center;
    cursor: pointer;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    width: 34px;
    height: 34px;
    transform: translateY(-50%);
}

.password-toggle:hover {
    color: var(--text-primary);
    background: rgba(41, 193, 132, 0.08);
    border-color: var(--border-color);
}

.password-toggle .material-icons-round {
    font-size: 20px;
}

.check-row {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.check-row input {
    width: 17px;
    height: 17px;
    accent-color: var(--accent-primary);
}

.toast-stack {
    position: fixed;
    top: 82px;
    right: 18px;
    z-index: 200;
    display: grid;
    gap: 8px;
}

.toast {
    padding: 10px 13px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-panel-2);
}

.toast.error {
    color: var(--danger);
}

body[data-page="tablet"] {
    overflow: hidden;
}

body[data-page="tablet"] .header-content {
    max-width: none;
    min-height: 56px;
    padding: 8px 14px;
}

body[data-page="tablet"] .logo-icon {
    width: 34px;
    height: 34px;
}

body[data-page="tablet"] .logo-text {
    font-size: 16px;
}

body[data-page="tablet"] .logo-subtitle {
    font-size: 10px;
    letter-spacing: 0.6px;
}

body[data-page="tablet"] .nav-link {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 12px;
}

body[data-page="tablet"] .account-button {
    min-height: 32px;
    font-size: 12px;
}

body[data-page="tablet"] .account-avatar {
    width: 22px;
    height: 22px;
    font-size: 14px;
}

.tablet-shell {
    height: calc(100vh - 56px);
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(460px, 42vw) minmax(0, 1fr);
    gap: 0;
    overflow: hidden;
}

.tablet-left,
.tablet-right {
    min-width: 0;
    min-height: 0;
    padding: 10px;
}

.tablet-left {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1.2fr) minmax(0, 0.8fr);
    gap: 8px;
    border-right: 1px solid var(--border-color);
    overflow: hidden;
}

body[data-page="tablet"] .panel.compact {
    padding: 10px;
}

body[data-page="tablet"] .panel-heading {
    min-height: 28px;
    margin-bottom: 8px;
}

.tablet-right {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    overflow: hidden;
}

.tablet-topbar,
.order-summary {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-panel);
    padding: 10px;
    min-width: 0;
}

.tablet-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.eyebrow {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    font-weight: 800;
}

.live-weight {
    min-width: 134px;
    min-height: 62px;
    border: 1px solid rgba(41, 193, 132, 0.35);
    border-radius: 8px;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    background: rgba(41, 193, 132, 0.1);
}

.live-weight span {
    font-size: 34px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.staff-chip {
    min-height: 26px;
    margin-top: 5px;
    padding: 4px 8px;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    max-width: 100%;
}

.staff-chip .material-icons-round {
    color: var(--accent-primary);
    font-size: 16px;
}

.staff-chip strong {
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.customer-name {
    font-size: 19px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.order-summary .muted {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tablet-work-grid {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(180px, 0.9fr);
    gap: 8px;
    overflow: hidden;
}

.queue-panel,
.quick-panel,
.weigh-panel {
    min-height: 0;
    display: grid;
    overflow: hidden;
}

.queue-panel {
    grid-template-rows: auto minmax(0, 1fr);
}

.quick-panel,
.weigh-panel {
    grid-template-rows: auto minmax(0, 1fr);
}

.waiting-list,
.item-list {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.waiting-row,
.item-row {
    min-height: 44px;
    padding: 8px 10px;
}

.waiting-row strong,
.item-row strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tablet-order-form {
    display: grid;
    grid-template-columns: 1fr;
    align-content: start;
    gap: 7px;
    overflow: hidden;
}

.tablet-order-form .form-input {
    min-height: 36px;
    padding: 7px 9px;
    font-size: 13px;
}

.tablet-order-form .btn-wide {
    min-height: 38px;
}

.btn-record {
    min-height: 52px;
    font-size: 16px;
}

.weigh-panel {
    grid-template-rows: auto auto minmax(0, 1fr);
}

.weigh-actions {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    gap: 8px;
    margin-bottom: 8px;
}


.camera-stage {
    width: 100%;
    height: 100%;
    min-height: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #050907;
    overflow: hidden;
}

.camera-stage img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #050907;
}

.camera-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    color: var(--text-muted);
}

.camera-placeholder .material-icons-round {
    font-size: 54px;
}

.camera-placeholder.large .material-icons-round {
    font-size: 82px;
}

.scale-strip {
    min-height: 46px;
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    background: var(--bg-panel);
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.75);
    flex: 0 0 auto;
}

.waiting-row {
    cursor: pointer;
}

.waiting-row:hover {
    border-color: var(--accent-primary);
}

.item-row button {
    width: 34px;
    height: 34px;
    padding: 0;
}

@media (max-width: 1320px) {
    .metric-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .order-metrics {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .order-card-body {
        grid-template-columns: repeat(4, minmax(120px, 1fr));
    }
}

@media (max-width: 1100px) {
    .metric-grid,
    .dashboard-layout,
    .report-grid,
    .orders-layout {
        grid-template-columns: 1fr;
    }

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

    .main-container {
        padding: 22px 18px 32px;
    }

}

@media (max-width: 900px) {
    .tablet-shell {
        height: auto;
        min-height: calc(100vh - 56px);
        grid-template-columns: 1fr;
        overflow: visible;
    }

    body[data-page="tablet"] {
        overflow: auto;
    }

    .tablet-left {
        border-right: 0;
        border-bottom: 1px solid var(--border-color);
        overflow: visible;
    }

    .camera-stage {
        height: 52vh;
    }
}

@media (max-width: 720px) {
    .header-content,
    .page-title-row,
    .tablet-topbar {
        align-items: stretch;
        flex-direction: column;
    }

    .header-content {
        min-height: 0;
        padding: 10px 14px;
        gap: 10px;
    }

    .logo {
        width: 100%;
    }

    .logo-text {
        font-size: 17px;
    }

    .logo-subtitle {
        white-space: normal;
    }

    .nav {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 2px;
        scrollbar-width: thin;
    }

    .nav-link,
    .btn,
    .account-button {
        min-height: 36px;
        padding: 8px 10px;
        font-size: 13px;
    }

    .account-avatar {
        width: 24px;
        height: 24px;
        font-size: 15px;
    }

    .account-name {
        max-width: 96px;
    }

    .account-dropdown {
        position: fixed;
        top: 72px;
        right: 12px;
        width: min(260px, calc(100vw - 24px));
    }

    .page-title-row {
        padding-bottom: 14px;
    }

    .action-row {
        width: 100%;
        justify-content: flex-start;
    }

    h1 {
        font-size: 24px;
    }

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

    .metric {
        min-height: 86px;
        padding: 12px;
    }

    .metric strong {
        font-size: 22px;
    }

    .tablet-order-form,
    .tablet-work-grid,
    .weigh-actions,
    .report-filter,
    .order-filter,
    .form-grid,
    .camera-settings-form,
    .price-date-filter,
    .price-add-form,
    .price-editor-list,
    .price-editor-row,
    .scale-settings-form,
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .main-container,
    .tablet-left,
    .tablet-right {
        padding: 14px;
    }

    .panel,
    .auth-panel {
        padding: 14px;
    }

    .panel-heading {
        min-height: 28px;
        margin-bottom: 10px;
    }

    .data-table,
    .data-table thead,
    .data-table tbody,
    .data-table tr,
    .data-table th,
    .data-table td {
        display: block;
    }

    .data-table thead {
        display: none;
    }

    .data-table tr {
        border: 1px solid var(--border-soft);
        border-radius: 8px;
        background: var(--bg-secondary);
        margin-bottom: 8px;
        padding: 8px 10px;
    }

    .data-table td {
        min-height: 32px;
        padding: 6px 0;
        border-bottom: 1px solid var(--border-soft);
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        white-space: normal;
        text-align: right;
        overflow-wrap: anywhere;
    }

    .data-table td:last-child {
        border-bottom: 0;
    }

    .data-table td::before {
        color: var(--text-muted);
        font-size: 12px;
        font-weight: 800;
        text-transform: uppercase;
        text-align: left;
        content: "";
    }

    .data-table td:nth-child(1)::before {
        content: "Mã đơn";
    }

    .data-table td:nth-child(2)::before {
        content: "Khách";
    }

    .data-table td:nth-child(3)::before {
        content: "Trạng thái";
    }

    .data-table td:nth-child(4)::before {
        content: "Kg";
    }

    .data-table td:nth-child(5)::before {
        content: "Tiền";
    }

    .report-table td::before {
        content: attr(data-label);
    }

    .price-row,
    .report-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .dialog-backdrop {
        padding: 12px;
    }

    .dialog-body {
        grid-template-columns: 1fr;
    }

    .dialog-photo-frame {
        max-height: 42vh;
    }

    .report-row-right {
        text-align: left;
    }

    .order-card {
        grid-template-columns: 1fr;
    }

    .order-actions {
        grid-template-columns: 1fr;
    }

    .auth-shell {
        min-height: calc(100vh - 56px);
        padding: 14px;
        place-items: start center;
    }
}

@media (max-width: 460px) {
    .metric-grid {
        grid-template-columns: 1fr;
    }

    .order-metrics {
        grid-template-columns: 1fr;
    }

    .main-container {
        padding: 12px;
    }

    .status-pill {
        min-width: 0;
    }

    .form-input {
        min-height: 42px;
    }

    .order-card-body,
    .order-detail-grid {
        grid-template-columns: 1fr;
    }
}
