:root {
    color-scheme: light;
    --ink: #302c26;
    --muted: #6d665c;
    --subtle: #898174;
    --line: #e4ddd1;
    --paper: #fffdf8;
    --canvas: #f4f0e8;
    --green: #68704f;
    --green-dark: #4d563a;
    --green-soft: #eef0e7;
    --terracotta: #a45b43;
    --amber: #96632c;
    --amber-soft: #f7efe2;
    --red: #a34f43;
    --red-soft: #f8eeeb;
    --font-ui: "Instrument Serif", Georgia, serif;
    --radius: 12px;
    --shadow: 0 2px 8px rgb(51 43 32 / 4%);
    font-synthesis: weight style;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font: 18px/1.5 var(--font-ui);
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1,
h2,
h3,
strong,
.brand {
    font-family: var(--font-ui);
}

h1 {
    margin: 3px 0 0;
    font-size: clamp(24px, 2vw, 30px);
    letter-spacing: 0;
    line-height: 1.25;
}

h2 {
    margin: 0 0 5px;
    font-size: 22px;
    letter-spacing: 0;
    line-height: 1.3;
}

h3 {
    margin: 0;
    font-size: 19px;
    line-height: 1.35;
}

p,
.muted {
    color: var(--muted);
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    color: inherit;
}

:focus-visible {
    outline: 3px solid #68704f;
    outline-offset: 3px;
}

.skip-link,
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link:focus {
    z-index: 10;
    top: 10px;
    left: 10px;
    width: auto;
    height: auto;
    padding: 10px 14px;
    margin: 0;
    overflow: visible;
    clip: auto;
    border-radius: 8px;
    background: var(--paper);
    box-shadow: 0 4px 18px rgb(0 0 0 / 16%);
}

.app-shell {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    z-index: 2;
    inset: 0 auto 0 0;
    display: flex;
    width: 248px;
    flex-direction: column;
    padding: 24px 16px 15px;
    overflow-y: auto;
    border-right: 1px solid var(--line);
    background: var(--paper);
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 5px 30px;
}

.brand strong {
    display: block;
    font-size: 16px;
    letter-spacing: -0.02em;
}

.brand small {
    display: block;
    margin-top: 3px;
    color: var(--subtle);
    font-size: 14px;
    letter-spacing: 0.08em;
}

.brand-mark {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 11px;
    background: var(--terracotta);
    color: #fff;
    font-size: 14px;
    font-weight: 750;
}

.nav-label,
.eyebrow {
    color: var(--subtle);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.09em;
}

.nav-label {
    padding: 0 11px 9px;
}

.nav-label.spaced {
    margin-top: 23px;
}

.nav-link {
    display: flex;
    min-height: 42px;
    align-items: center;
    gap: 12px;
    margin-bottom: 3px;
    padding: 0 11px;
    border-radius: 8px;
    color: #625b51;
    font-size: 18px;
    line-height: 1.5;
    font-weight: 550;
    transition: background-color 120ms ease, color 120ms ease;
}

.nav-link:hover {
    background: #f6f2eb;
    color: var(--green-dark);
}

.nav-link.active {
    background: var(--green-soft);
    color: var(--green-dark);
    font-weight: 700;
}

.nav-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border: 1.5px solid currentColor;
    border-radius: 3px;
}

.nav-link.active .nav-dot {
    background: currentColor;
}

.sidebar-bottom {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding: 14px 2px 0;
    border-top: 1px solid var(--line);
}

.avatar {
    display: grid;
    width: 35px;
    height: 35px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    background: var(--green-soft);
    color: var(--green-dark);
    font-weight: 700;
}

.user-label {
    min-width: 0;
    flex: 1;
}

.user-label strong,
.user-label small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-panel table {
    white-space: normal;
}

.list-panel td,
.list-panel th {
    overflow-wrap: normal;
}

.list-panel td:first-child {
    overflow-wrap: anywhere;
}

.list-panel .cell-sub {
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
}

.list-panel .actions {
    display: table-cell;
    white-space: nowrap;
}

.list-panel .actions a {
    margin-right: 8px;
}

.user-label strong {
    font-size: 15px;
}

.user-label small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 14px;
}

.logout-button {
    min-height: 34px !important;
    padding: 0 9px !important;
    font-size: 14px !important;
}

.main-content {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    margin-left: 248px;
    min-width: 0;
}

.topbar {
    display: flex;
    min-height: 82px;
    align-items: center;
    justify-content: space-between;
    padding: 13px clamp(24px, 3vw, 50px);
    border-bottom: 1px solid var(--line);
    background: var(--paper);
}

.topbar .eyebrow {
    font-size: 14px;
}

.page-body {
    width: 100%;
    max-width: 1740px;
    flex: 1;
    margin: 0 auto;
    padding: clamp(24px, 2.6vw, 42px) clamp(24px, 3vw, 50px) 42px;
    min-width: 0;
}

footer {
    margin: 0 clamp(24px, 3vw, 50px);
    padding: 16px 0 20px;
    border-top: 1px solid var(--line);
    color: var(--subtle);
    font-size: 14px;
}

footer span {
    float: right;
}

.welcome-row,
.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.welcome-row {
    margin-bottom: 22px;
}

.welcome-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.welcome-row h2 {
    font-size: clamp(20px, 1.7vw, 24px);
}

.welcome-row p,
.section-heading p,
.panel-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 18px;
}

.section-heading {
    margin: clamp(26px, 3vw, 34px) 0 15px;
}

.text-link {
    color: var(--green-dark);
    font-size: 18px;
    font-weight: 700;
}

.text-link span {
    margin-left: 4px;
    font-size: 16px;
}

.button {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 15px;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.button.primary {
    background: var(--green);
    color: #fff;
}

.button.primary:hover {
    background: var(--green-dark);
    transform: translateY(-1px);
}

.button.secondary {
    border-color: #d9d0c3;
    background: #fff;
    color: var(--green-dark);
}

.button.secondary:hover {
    background: var(--green-soft);
    transform: translateY(-1px);
}

.button.full {
    width: 100%;
    min-height: 46px;
    margin-top: 5px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 13px;
}

.stat-card {
    position: relative;
    min-height: 138px;
    padding: 19px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
}

.stat-card > span:first-child {
    display: block;
    max-width: calc(100% - 38px);
    color: var(--muted);
    font-size: 15px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.stat-card strong {
    display: block;
    margin: 11px 0 5px;
    font-size: clamp(19px, 2vw, 25px);
    letter-spacing: -0.04em;
    line-height: 1.2;
}

.stat-card small {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
}

.stat-card small.positive {
    color: var(--green-dark);
}

.stat-icon {
    position: absolute;
    top: 13px;
    right: 13px;
    display: grid;
    width: 27px;
    height: 27px;
    place-items: center;
    border-radius: 7px;
    font-size: 10px;
    font-weight: 700;
}

.green {
    background: var(--green-soft);
    color: var(--green-dark);
}

.violet,
.blue {
    background: #f2ece5;
    color: #765944;
}

.orange {
    background: var(--amber-soft);
    color: var(--amber);
}

.table-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 148px), 1fr));
    gap: 10px;
}

.table-tile {
    position: relative;
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 5px;
    overflow: hidden;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper);
    transition: transform 160ms ease, border-color 160ms ease;
}

a.table-tile:hover {
    transform: translateY(-2px);
    border-color: #c8bea9;
}

.table-tile.free {
    border-left: 3px solid #78805e;
}

.table-tile.occupied {
    border-left: 3px solid #b77750;
}

.table-number {
    color: var(--green-dark);
    font-size: 18px;
    font-weight: 750;
}

.table-tile > span:nth-child(2) {
    font-size: 15px;
    font-weight: 650;
}

.table-tile > small {
    color: var(--muted);
    font-size: 14px;
}

.table-tile > i {
    position: absolute;
    top: 15px;
    right: 12px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #78805e;
}

.occupied > i {
    background: #b77750;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 11px;
}

.quick-grid > a {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 11px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper);
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.quick-grid > a:hover {
    transform: translateY(-2px);
    border-color: #d1c7b7;
    box-shadow: var(--shadow);
}

.quick-grid > a > span:first-child {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 8px;
    background: var(--green-soft);
    color: var(--green-dark);
    font-size: 17px;
}

.quick-grid > a > div {
    min-width: 0;
    flex: 1;
}

.quick-grid strong,
.quick-grid small {
    display: block;
}

.quick-grid strong {
    font-size: 18px;
}

.quick-grid small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 14px;
}

.quick-grid .quick-arrow {
    color: var(--green-dark);
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1.6fr);
    align-items: start;
    gap: 15px;
}

.content-grid.order-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.product-grid.has-editor {
    grid-template-columns: minmax(300px, 0.72fr) minmax(0, 1.8fr);
}

.product-grid:not(.has-editor) {
    grid-template-columns: minmax(0, 1fr);
}

.panel {
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.panel-heading > div:first-child {
    min-width: min(100%, 180px);
    flex: 1 1 180px;
}

.panel-heading h2 {
    font-size: 16px;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.stack label,
.close-form label,
.movement-filters label {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 6px;
    color: #5e574d;
    font-size: 18px;
    font-weight: 650;
}

.report-filters label {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 6px;
    color: #5e574d;
    font-size: 16px;
    font-weight: 650;
}

.stack input,
.stack select,
.stack textarea,
.close-form input,
.search-form input,
.inline-form input,
.movement-filters input,
.movement-filters select,
.report-filters input {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding: 9px 11px;
    border: 1px solid #ddd5c9;
    border-radius: 7px;
    outline: none;
    background: #fff;
    color: var(--ink);
    font-size: 18px;
}

.stack textarea {
    min-height: 78px;
    resize: vertical;
}

.stack input:focus,
.stack select:focus,
.stack textarea:focus,
.search-form input:focus,
.inline-form input:focus,
.close-form input:focus,
.movement-filters input:focus,
.movement-filters select:focus {
    border-color: #77805d;
    box-shadow: 0 0 0 3px rgb(104 112 79 / 14%);
}

.report-filters input:focus {
    border-color: #77805d;
    box-shadow: 0 0 0 3px rgb(104 112 79 / 14%);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
}

.quick-sale-panel {
    max-width: 980px;
}

.quick-sale-items {
    display: grid;
    gap: 10px;
}

.quick-sale-row {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) minmax(110px, 0.7fr) minmax(120px, 0.8fr) auto;
    align-items: end;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fcfaf6;
}

.quick-sale-row label,
.quick-sale-payment {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 6px;
    color: #5e574d;
    font-size: 16px;
    font-weight: 650;
}

.quick-sale-row input,
.quick-sale-row select,
.quick-sale-payment select {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding: 9px 11px;
    border: 1px solid #ddd5c9;
    border-radius: 7px;
    outline: none;
    background: #fff;
    color: var(--ink);
    font-size: 16px;
}

.quick-sale-row select[data-product] {
    display: none;
}

.product-search-control {
    position: relative;
    width: 100%;
}

.product-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    left: 0;
    z-index: 5;
    display: grid;
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--paper);
    box-shadow: 0 6px 16px rgb(51 43 32 / 12%);
}

.product-suggestions[hidden] {
    display: none;
}

.product-suggestion {
    display: flex;
    min-height: 44px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 11px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    cursor: pointer;
    text-align: left;
}

.product-suggestion:last-child {
    border-bottom: 0;
}

.product-suggestion:hover,
.product-suggestion[aria-selected="true"] {
    background: var(--green-soft);
    color: var(--green-dark);
}

.product-suggestion-price {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 14px;
    font-weight: 400;
}

.product-search-status:not(.visually-hidden) {
    color: var(--muted);
    font-size: 14px;
    font-weight: 400;
}

.quick-sale-subtotal span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 14px;
}

.quick-sale-subtotal strong {
    display: block;
    min-height: 40px;
    padding: 9px 0;
    color: var(--ink);
}

.quick-sale-remove {
    white-space: nowrap;
}

.quick-sale-add {
    align-self: flex-start;
}

.quick-sale-total {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 0;
    border-top: 1px solid var(--line);
    color: var(--ink);
    font-size: 18px;
}

.quick-sale-total strong {
    font-size: 22px;
}

.quick-sale-payment {
    max-width: 380px;
}

.account-panel {
    max-width: 560px;
}

.check-label {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 8px !important;
}

.check-label input {
    width: auto;
    min-height: auto;
}

.divider {
    height: 1px;
    margin: 21px 0 15px;
    background: var(--line);
}

.panel h3 {
    margin-bottom: 10px;
}

.inline-form {
    display: flex;
    gap: 8px;
}

.inline-form .button {
    flex: 0 0 auto;
}

.search-form {
    position: relative;
    width: min(290px, 48%);
    flex: 0 1 290px;
}

.search-form input {
    min-height: 42px;
    padding-right: 38px;
    font-size: 18px;
}

.search-form button {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 36px;
    height: 40px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 18px;
}

.table-wrap {
    overflow: auto;
    max-width: 100%;
    margin: 0 -4px;
    overscroll-behavior-inline: contain;
}

.table-wrap table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    white-space: nowrap;
}

.table-wrap th {
    padding: 12px 11px;
    background: #f8f5ef;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.045em;
    text-transform: uppercase;
}

.table-wrap td {
    padding: 13px 11px;
    border-bottom: 1px solid #efe9df;
    color: #5e574d;
    font-size: 18px;
    vertical-align: top;
}

.table-wrap tr:last-child td {
    border-bottom: 0;
}

.table-wrap td strong {
    color: var(--ink);
    font-size: 18px;
}

.cell-sub {
    display: block;
    max-width: 300px;
    margin-top: 3px;
    overflow: hidden;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
    text-overflow: ellipsis;
}

.pill {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.pill-green {
    background: var(--green-soft);
    color: var(--green-dark);
}

.pill-gray {
    background: #f1eee8;
    color: #645d53;
}

.pill-orange {
    background: var(--amber-soft);
    color: var(--amber);
}

.pill-red {
    background: var(--red-soft);
    color: var(--red);
}

.actions,
.tile-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.actions form,
.tile-actions form,
.tab-line form {
    display: inline;
}

.action-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--green-dark);
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
}

.danger-link {
    color: var(--red);
}

.empty {
    padding: 24px !important;
    color: var(--muted) !important;
    text-align: center;
}

.table-grid.large {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.table-grid.large .table-tile {
    min-height: 122px;
    padding: 13px;
}

.tile-actions {
    margin-top: 6px;
}

.tile-actions a {
    color: var(--green-dark);
    font-size: 14px;
    font-weight: 700;
}

.active-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 13px;
}

.tab-card {
    padding: 16px;
}

.tab-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.tab-title h3 {
    margin: 7px 0 3px;
}

.tab-title small {
    color: var(--muted);
    font-size: 14px;
}

.tab-title > strong {
    font-size: 18px;
    white-space: nowrap;
}

.order-lines {
    margin-top: 14px;
    border-top: 1px solid var(--line);
}

.order-line {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #efe9df;
    font-size: 18px;
}

.order-line > span:last-child {
    flex: 0 0 auto;
    text-align: right;
}

.order-line small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 14px;
}

.order-line b {
    color: var(--green-dark);
}

.inline {
    display: inline;
    margin-left: 8px;
}

.close-form {
    display: flex;
    justify-content: flex-end;
    margin-top: 13px;
}

.close-form .button {
    min-height: 37px;
}

.tip-box {
    margin-top: 16px;
    padding: 11px 12px;
    border-left: 3px solid #9b8062;
    border-radius: 4px;
    background: #f7f3ec;
    color: #5e574d;
    font-size: 15px;
    line-height: 1.55;
}

.empty-state {
    grid-column: 1 / -1;
    padding: 22px 16px;
    border: 1px dashed #d9d0c3;
    border-radius: 9px;
    background: rgb(255 255 255 / 65%);
    color: var(--muted);
    font-size: 18px;
    text-align: center;
}

.empty-state .text-link {
    margin-left: 4px;
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-bottom: 17px;
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 18px;
    line-height: 1.45;
}

.alert > span {
    display: grid;
    width: 19px;
    height: 19px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 800;
}

.alert.success {
    border-color: #e2e3d6;
    background: #f3f5ed;
    color: #4d563a;
}

.alert.success > span {
    background: #e5e9d9;
    color: #4d563a;
}

.alert.error {
    border-color: #f0d9d6;
    background: #fff4f2;
    color: #853b35;
}

.alert.error > span {
    background: #f8e1dd;
    color: #853b35;
}

.hint,
.field-help {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.login-page {
    min-height: 100vh;
    background: #f4f0e8;
}

.login-wrap {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: clamp(18px, 4vw, 40px);
}

.login-card {
    width: min(100%, 460px);
    padding: clamp(26px, 4vw, 40px);
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--paper);
}

.login-card .brand-mark {
    width: 44px;
    height: 44px;
    margin-bottom: 22px;
    border-radius: 12px;
    font-size: 16px;
}

.login-card .eyebrow {
    display: block;
    margin-bottom: 8px;
}

.login-card h1 {
    font-size: 26px;
}

.login-card > p {
    margin: 8px 0 22px;
    color: var(--muted);
    font-size: 18px;
}

.login-card .stack {
    gap: 15px;
}

.login-card .stack label {
    font-size: 18px;
}

.login-card .stack input {
    min-height: 44px;
}

.password-field {
    position: relative;
    display: block;
}

.password-field input {
    padding-right: 52px !important;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 4px;
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    padding: 0;
    transform: translateY(-50%);
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    touch-action: manipulation;
}

.password-toggle:hover {
    background: var(--green-soft);
    color: var(--green-dark);
}

.password-toggle svg {
    width: 21px;
    height: 21px;
}

.password-toggle svg[hidden] {
    display: none;
}

.login-card .hint {
    margin: 19px 0 0;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: 14px;
    overflow-wrap: anywhere;
}

.login-card input:-webkit-autofill,
.login-card input:-webkit-autofill:hover,
.login-card input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--ink);
    box-shadow: 0 0 0 1000px var(--paper) inset;
}

.stock-forms {
    margin-bottom: 15px;
}

.stock-list-panel,
.movements-panel {
    margin-top: 15px;
}

.movement-filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto auto;
    align-items: end;
    gap: 10px;
    margin-bottom: 15px;
}

.movement-filters label {
    font-size: 15px;
}

.movement-filters input,
.movement-filters select {
    min-height: 42px;
}

.movement-filters .button {
    min-height: 42px;
    white-space: nowrap;
}

.report-filter-panel {
    margin-bottom: 14px;
}

.report-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(140px, 1fr)) auto auto;
    align-items: end;
    gap: 10px;
}

.report-filters input,
.report-filters select,
.report-filters .button {
    min-height: 42px;
}

.report-filters select {
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    color: var(--ink);
}

.report-custom-date[hidden],
[data-custom-apply][hidden] {
    display: none;
}

.report-filters .button {
    white-space: nowrap;
}

.report-filters .button.secondary {
    text-decoration: none;
}

.report-filter-error {
    margin: 12px 0 0;
    color: var(--red);
}

.report-period {
    margin: 0 0 14px;
    color: var(--muted);
}

.report-overview-chart,
.report-line-chart,
.report-ranking-chart,
.report-product-chart,
.report-sales-chart {
    display: flex;
    width: 100%;
    min-width: 0;
    justify-content: center;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
}

.report-overview-chart svg,
.report-line-chart svg,
.report-ranking-chart svg,
.report-product-chart svg,
.report-sales-chart svg {
    display: block;
    width: 100%;
    min-width: 520px;
    max-width: 900px;
    height: auto;
}

.report-overview-chart svg {
    min-width: 0;
    max-width: 680px;
}

.report-line-chart svg {
    min-width: 560px;
    max-width: 980px;
}

.report-sales-chart svg {
    min-width: 720px;
    max-width: 900px;
}

.report-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 14px;
}

.report-chart-panel {
    min-width: 0;
}

.report-chart-wide {
    grid-column: 1 / -1;
}

.report-chart-panel .panel-heading {
    min-height: 66px;
}

.report-line-chart svg {
    min-width: 560px;
    max-width: 980px;
}

.report-product-chart svg {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.report-data-chart[data-report-chart="donut"] svg {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.report-data-chart[data-report-chart="hourly"] svg {
    min-width: 720px;
    max-width: 820px;
}

.chart-grid-line {
    stroke: #e9e4db;
    stroke-dasharray: 3 6;
    stroke-width: 1;
}

.chart-axis-label {
    fill: #777064;
    font: 13px var(--font-ui);
}

.chart-area {
    fill: rgb(104 112 79 / 12%);
}

.chart-line {
    fill: none;
    stroke: var(--green);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 3.5;
}

.chart-point {
    fill: var(--paper);
    stroke: var(--green);
    stroke-width: 2.7;
    transition: r 120ms ease, fill 120ms ease;
}

.chart-point:hover {
    fill: var(--green-soft);
    r: 6;
}

.chart-category-label {
    fill: var(--ink);
    font: 15px var(--font-ui);
}

.chart-value-label {
    fill: var(--ink);
    font: 700 15px var(--font-ui);
}

.chart-detail-label {
    fill: var(--muted);
    font: 13px var(--font-ui);
}

.chart-bar-track {
    fill: #f0ede6;
}

.chart-bar {
    fill: var(--green);
}

.chart-bar-featured {
    fill: var(--terracotta);
}

.report-chart-empty {
    margin: 0;
    padding: 28px 0;
    text-align: center;
}

.report-kpis {
    margin-bottom: 18px;
}

.report-data-chart {
    display: flex;
    width: 100%;
    min-width: 0;
    justify-content: center;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
}

.report-data-chart svg {
    display: block;
    width: 100%;
    min-width: 520px;
    max-width: 900px;
    height: auto;
}

.report-data-chart[data-report-chart="columns"] svg {
    flex: 0 0 auto;
}

.chart-grid-overlay {
    pointer-events: none;
    opacity: 0.65;
}

@media (max-width: 900px) {
    .report-charts-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .report-chart-wide {
        grid-column: auto;
    }
}

.stock-alert-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.stock-alert-row {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
}

.stock-alert-row strong {
    min-width: 0;
    font-size: 18px;
}

.stock-alert-row small {
    margin-left: auto;
    color: var(--muted);
    font-size: 14px;
    text-align: right;
}

.heading-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

@media (max-width: 1200px) {
    .content-grid:not(.order-grid) {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 1150px) {
    .sidebar {
        width: 220px;
    }

    .main-content {
        margin-left: 220px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .content-grid {
        grid-template-columns: minmax(230px, 0.8fr) minmax(0, 1.5fr);
    }

    .content-grid:not(.order-grid) {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 900px) {
    .sidebar {
        position: static;
        width: auto;
        padding: 12px 15px 10px;
        overflow: visible;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .brand {
        padding: 0 0 12px;
    }

    .sidebar nav {
        display: flex;
        gap: 5px;
        overflow-x: auto;
        padding-bottom: 3px;
        scrollbar-width: thin;
    }

    .nav-label,
    .nav-label.spaced {
        display: none;
    }

    .nav-link {
        min-height: 38px;
        flex: 0 0 auto;
        margin: 0;
        padding: 0 10px;
        font-size: 14px;
    }

    .sidebar-bottom {
        margin-top: 9px;
        padding-top: 9px;
        border-top: 1px solid #efe9df;
    }

    .main-content {
        min-height: calc(100vh - 160px);
        margin-left: 0;
    }

    .topbar {
        min-height: 72px;
        padding: 11px clamp(16px, 4vw, 32px);
    }

    .page-body {
        padding: 24px clamp(16px, 4vw, 32px) 34px;
    }

    .content-grid:not(.order-grid) {
        grid-template-columns: minmax(0, 1fr);
    }

    .content-grid.order-grid {
        grid-template-columns: 1fr;
    }

    .active-tabs {
        grid-template-columns: 1fr;
    }

    .movement-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .report-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stock-alert-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .topbar h1 {
        font-size: 21px;
    }

    .welcome-row h2 {
        font-size: 20px;
    }

    .table-wrap table {
        min-width: 620px;
    }

    .order-grid .panel {
        min-width: 0;
    }

    .quick-sale-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}

@media (max-width: 500px) {
    .topbar {
        min-height: 66px;
    }

    .page-body {
        padding: 20px 14px 28px;
    }

    .panel {
        padding: 14px;
    }

    .welcome-row,
    .section-heading {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .welcome-row > .button {
        flex: 0 0 auto;
        padding: 0 10px;
        font-size: 14px;
    }

    .stats-grid {
        gap: 8px;
    }

    .stat-card {
        min-height: 124px;
        padding: 13px 11px;
    }

    .stat-card strong {
        font-size: 19px;
    }

    .stat-card > span:first-child {
        display: block;
        max-width: calc(100% - 26px);
        font-size: 14px;
    }

    .stat-card small {
        font-size: 14px;
    }

    .stat-icon {
        top: 9px;
        right: 9px;
        width: 22px;
        height: 22px;
    }

    .table-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .quick-grid {
        grid-template-columns: 1fr;
    }

    .panel-heading {
        align-items: flex-start;
    }

    .panel-heading .search-form {
        width: 100%;
        max-width: none;
        flex: 1 1 100%;
    }

    .search-form input {
        font-size: 18px;
    }

    .heading-actions {
        flex-wrap: wrap;
    }

    .movement-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .movement-filters .button {
        grid-column: span 2;
    }

    .report-filters .button {
        width: 100%;
    }

    .stock-alert-row {
        flex-wrap: wrap;
    }

    .stock-alert-row small {
        width: 100%;
        margin-left: 0;
        text-align: left;
    }

    .order-line {
        gap: 8px;
    }

    .inline-form {
        flex-wrap: wrap;
    }

    .inline-form input {
        flex: 1 1 160px;
    }

    footer {
        margin: 0 14px;
    }

    footer span {
        display: block;
        float: none;
        margin-top: 4px;
    }
}

@media (max-width: 380px) {
    .login-card {
        padding: 28px 22px;
    }

    .nav-link {
        font-size: 14px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        min-height: 110px;
    }
}

@keyframes surface-in {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.panel,
.stat-card {
    animation: surface-in 180ms ease-out both;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
