:root {
    --color-primary: #6a0204;
    --color-primary-strong: #430102;
    --color-primary-soft: #f5e7e7;
    --color-secondary: #9e5f5f;
    --color-highlight: #d8bfc0;
    --color-ink: #241719;
    --color-muted: #7b696a;
    --color-line: #eadede;
    --color-bg: #fbf8f8;
    --color-surface: #ffffff;
    --color-surface-raised: #ffffff;
    --color-success: #247a51;
    --color-success-soft: #e8f5ee;
    --color-warning: #a66313;
    --color-warning-soft: #fff4df;
    --color-danger: #a3242d;
    --color-danger-soft: #fdecee;
    --shadow-sm: 0 4px 14px rgba(66, 15, 16, .06);
    --shadow-md: 0 12px 32px rgba(66, 15, 16, .10);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --max-content: 1440px;
    color-scheme: light;
}

[data-theme="dark"] {
    --color-primary: #c25b60;
    --color-primary-strong: #e18b8e;
    --color-primary-soft: #3b1d20;
    --color-secondary: #d49c9d;
    --color-highlight: #5d3c3e;
    --color-ink: #f8eded;
    --color-muted: #c5aaaa;
    --color-line: #4c3032;
    --color-bg: #1c1213;
    --color-surface: #251819;
    --color-surface-raised: #301e20;
    --color-success: #77d5a3;
    --color-success-soft: #173526;
    --color-warning: #f0bd74;
    --color-warning-soft: #3b2b18;
    --color-danger: #ff9ca2;
    --color-danger-soft: #451d21;
    --shadow-sm: 0 4px 18px rgba(0, 0, 0, .18);
    --shadow-md: 0 12px 32px rgba(0, 0, 0, .28);
    color-scheme: dark;
}

* { box-sizing: border-box; }
body,
body * {
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

input,
textarea,
select,
option,
[contenteditable],
[contenteditable] *,
[contenteditable="true"],
[contenteditable="plaintext-only"] {
    -webkit-user-select: text;
    -moz-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
}

html { min-width: 320px; scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--color-bg);
    color: var(--color-ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.4rem, 2vw, 1.8rem); line-height: 1.15; letter-spacing: -.03em; }
h2 { font-size: 1.1rem; line-height: 1.25; letter-spacing: -.02em; }
h3 { font-size: .98rem; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    width: 248px;
    display: flex;
    flex-direction: column;
    padding: 24px 14px 18px;
    background: var(--color-surface);
    border-right: 1px solid var(--color-line);
    overflow-y: auto;
    overscroll-behavior: contain;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 28px; }
.sidebar-brand img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; box-shadow: var(--shadow-sm); }
.sidebar-brand strong { display: block; color: var(--color-primary); font-size: 1.02rem; letter-spacing: -.02em; }
.sidebar-brand span { display: block; color: var(--color-muted); font-size: .58rem; letter-spacing: .02em; white-space: nowrap; }
.sidebar-nav { display: grid; gap: 5px; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 10px 13px;
    color: var(--color-muted);
    border: 0;
    border-radius: 12px;
    background: transparent;
    font-weight: 600;
    text-align: left;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}
.nav-link:hover { color: var(--color-primary); background: var(--color-primary-soft); }
.nav-link.is-active { color: #fff; background: var(--color-primary); box-shadow: 0 8px 20px rgba(106, 2, 4, .18); }
.sidebar-footer { margin-top: auto; padding: 14px 4px 0; border-top: 1px solid var(--color-line); }
.user-mini { display: flex; align-items: center; gap: 9px; padding: 10px 6px; }
.user-mini strong, .user-mini small { display: block; max-width: 148px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-mini strong { font-size: .82rem; }
.user-mini small { color: var(--color-muted); font-size: .7rem; }
.logout-form { margin: 3px 0 0; }
.button-link { width: 100%; }

.app-main { width: calc(100% - 248px); min-height: 100vh; margin-left: 248px; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 84px;
    padding: 18px clamp(18px, 4vw, 52px);
    background: color-mix(in srgb, var(--color-bg) 92%, transparent);
    border-bottom: 1px solid color-mix(in srgb, var(--color-line) 82%, transparent);
    backdrop-filter: blur(14px);
}
.topbar-title { min-width: 0; flex: 1; text-align: center; }
.topbar-title .eyebrow { display: block; margin-bottom: 3px; color: var(--color-secondary); font-size: .65rem; font-weight: 800; letter-spacing: .14em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-button, .avatar-link { display: inline-flex; align-items: center; justify-content: center; }
.icon-button {
    width: 42px;
    height: 42px;
    padding: 0;
    color: var(--color-muted);
    border: 1px solid var(--color-line);
    border-radius: 12px;
    background: var(--color-surface);
    transition: color .18s ease, border-color .18s ease, transform .18s ease;
}
.icon-button:hover { color: var(--color-primary); border-color: var(--color-secondary); transform: translateY(-1px); }
.mobile-menu { display: none; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex: 0 0 36px; color: #fff; border-radius: 50%; background: var(--color-primary); font-size: .85rem; font-weight: 800; }
.page-content { width: min(100%, var(--max-content)); min-width: 0; margin: 0 auto; padding: 28px clamp(18px, 4vw, 52px) 42px; }
.site-footer { padding: 0 clamp(18px, 4vw, 52px) 30px; color: var(--color-muted); font-size: .75rem; }

.alert { display: flex; align-items: center; gap: 10px; min-height: 46px; margin-bottom: 18px; padding: 11px 14px; border: 1px solid transparent; border-radius: 12px; font-weight: 600; }
.alert-success { color: var(--color-success); background: var(--color-success-soft); border-color: color-mix(in srgb, var(--color-success) 20%, transparent); }
.alert-error { color: var(--color-danger); background: var(--color-danger-soft); border-color: color-mix(in srgb, var(--color-danger) 20%, transparent); }
.alert-warning { color: var(--color-warning); background: var(--color-warning-soft); border-color: color-mix(in srgb, var(--color-warning) 20%, transparent); }

.page-intro { display: flex; align-items: end; justify-content: space-between; gap: 18px; min-width: 0; margin-bottom: 22px; }
.page-intro > div { min-width: 0; }
.page-intro p { margin-top: 5px; color: var(--color-muted); }
.page-intro-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; min-width: 0; margin-bottom: 22px; }
.metric-card { position: relative; overflow: hidden; min-height: 138px; padding: 19px; border: 1px solid var(--color-line); border-radius: var(--radius-md); background: var(--color-surface); box-shadow: var(--shadow-sm); }
.metric-card::after { position: absolute; right: -26px; bottom: -30px; width: 100px; height: 100px; border: 18px solid var(--color-primary-soft); border-radius: 50%; content: ""; opacity: .65; }
.metric-label { display: flex; align-items: center; gap: 7px; color: var(--color-muted); font-size: .77rem; font-weight: 700; }
.metric-label .icon { color: var(--color-secondary); }
.metric-value { display: block; margin-top: 14px; color: var(--color-ink); font-size: clamp(1.25rem, 2.5vw, 1.8rem); font-weight: 800; letter-spacing: -.04em; }
.metric-meta { display: block; margin-top: 4px; color: var(--color-muted); font-size: .72rem; }
.metric-card.is-primary { color: #fff; border-color: transparent; background: var(--color-primary); }
.metric-card.is-primary::after { border-color: rgba(255, 255, 255, .12); }
.metric-card.is-primary .metric-label, .metric-card.is-primary .metric-value, .metric-card.is-primary .metric-meta { color: #fff; }
.metric-card.is-primary .metric-label .icon { color: var(--color-highlight); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(300px, .7fr); gap: 18px; min-width: 0; }
.stack { display: grid; gap: 18px; align-content: start; }
.card { min-width: 0; border: 1px solid var(--color-line); border-radius: var(--radius-md); background: var(--color-surface); box-shadow: var(--shadow-sm); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 18px 13px; }
.card-header > div { min-width: 0; }
.card-header p { margin-top: 3px; color: var(--color-muted); font-size: .75rem; }
.card-body { padding: 0 18px 18px; }
.card-action { color: var(--color-primary); font-size: .76rem; font-weight: 800; }
.card-action:hover { text-decoration: underline; }
.stat-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 0 18px 18px; }
.stat-tile { padding: 13px; border-radius: 12px; background: var(--color-bg); }
.stat-tile span { display: block; color: var(--color-muted); font-size: .7rem; }
.stat-tile strong { display: block; margin-top: 6px; font-size: 1.05rem; }
.list { display: grid; gap: 0; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-top: 1px solid var(--color-line); }
.list-row:first-child { border-top: 0; }
.row-main { min-width: 0; }
.row-main strong, .row-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main strong { font-size: .84rem; }
.row-main small { margin-top: 2px; color: var(--color-muted); font-size: .72rem; }
.row-value { flex: 0 0 auto; text-align: right; }
.row-value strong, .row-value small { display: block; }
.row-value strong { font-size: .84rem; }
.row-value small { color: var(--color-muted); font-size: .7rem; }
.empty-state { padding: 24px 8px; color: var(--color-muted); text-align: center; font-size: .82rem; }
.empty-state .icon { display: block; margin: 0 auto 7px; color: var(--color-secondary); }
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 18px 0 4px; color: var(--color-muted); font-size: .74rem; text-align: center; }
.pagination .is-disabled { pointer-events: none; opacity: .45; }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 999px; font-size: .68rem; font-weight: 800; white-space: nowrap; }
.badge-low { color: var(--color-warning); background: var(--color-warning-soft); }
.badge-ok { color: var(--color-success); background: var(--color-success-soft); }
.badge-sale { color: var(--color-danger); background: var(--color-danger-soft); }
.badge-entry { color: var(--color-success); background: var(--color-success-soft); }
.badge-adjustment { color: var(--color-secondary); background: var(--color-primary-soft); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; margin-bottom: 18px; flex-wrap: wrap; }
.search-form { display: flex; flex: 1 1 280px; gap: 8px; }
.search-form .input-wrap { flex: 1; }
.filter-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.input-wrap { position: relative; }
.input-wrap > .icon { position: absolute; top: 50%; left: 12px; color: var(--color-muted); transform: translateY(-50%); pointer-events: none; }
.input-wrap input { padding-left: 40px; }
input, select, textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    color: var(--color-ink);
    border: 1px solid var(--color-line);
    border-radius: 11px;
    outline: 0;
    background: var(--color-surface);
    font-size: 16px;
    transition: border-color .18s ease, box-shadow .18s ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--color-secondary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-secondary) 18%, transparent); }
textarea { min-height: 96px; resize: vertical; }
label { display: grid; gap: 6px; color: var(--color-ink); font-size: .78rem; font-weight: 750; }
label small { color: var(--color-muted); font-size: .7rem; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 15px; }
.field-3 { grid-column: span 3; }
.field-4 { grid-column: span 4; }
.field-6 { grid-column: span 6; }
.field-8 { grid-column: span 8; }
.field-12 { grid-column: span 12; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; padding-top: 17px; border-top: 1px solid var(--color-line); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 9px 14px; border: 1px solid transparent; border-radius: 11px; font-weight: 800; transition: transform .18s ease, box-shadow .18s ease, background .18s ease; }
.btn:hover { transform: translateY(-1px); }
.btn:disabled { cursor: not-allowed; opacity: .55; transform: none; box-shadow: none; }
.btn-primary { color: #fff; background: var(--color-primary); box-shadow: 0 7px 15px rgba(106, 2, 4, .15); }
.btn-primary:hover { background: var(--color-primary-strong); }
.btn-soft { color: var(--color-primary); border-color: var(--color-line); background: var(--color-primary-soft); }
.btn-ghost { color: var(--color-muted); border-color: var(--color-line); background: var(--color-surface); }
.btn-danger { color: #fff; background: var(--color-danger); }
.btn-success { color: #fff; background: var(--color-success); }
.btn-sm { min-height: 44px; padding: 7px 10px; border-radius: 9px; font-size: .75rem; }
.btn-icon { width: 35px; padding: 0; }

.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.product-card { display: flex; flex-direction: column; min-width: 0; padding: 16px; border: 1px solid var(--color-line); border-radius: var(--radius-md); background: var(--color-surface); box-shadow: var(--shadow-sm); }
.product-card.is-archived { opacity: .84; }
.product-code { color: var(--color-muted); font-size: .7rem; font-weight: 700; letter-spacing: .04em; }
.icon-action { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; color: var(--color-muted); border: 1px solid var(--color-line); border-radius: 9px; background: var(--color-surface); }
.icon-action:hover { color: var(--color-primary); border-color: var(--color-secondary); }
.icon-action.danger:hover { color: var(--color-danger); }
.management-list { display: grid; gap: 0; }
.management-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--color-line); }
.management-item:first-child { border-top: 0; }
.action-cluster { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.action-cluster form { display: contents; }
.category-form-actions { display: grid; gap: 7px; align-content: end; }
.palette-swatch { width: 34px; height: 34px; flex: 0 0 34px; border: 1px solid var(--color-line); border-radius: 10px; }
.swatch-primary { background: #6A0204; }
.swatch-secondary { background: #9E5F5F; }
.swatch-highlight { background: #D8BFC0; }
.swatch-neutral { background: #FEFEFE; }

.data-table-wrap { width: 100%; max-width: 100%; min-width: 0; display: block; overflow-x: auto; overflow-y: hidden; border: 1px solid var(--color-line); border-radius: var(--radius-md); background: var(--color-surface); -webkit-overflow-scrolling: touch; overscroll-behavior-inline: contain; }
.data-table { width: 100%; min-width: 720px; border-collapse: collapse; }
.report-table { min-width: 560px; }
.data-table th, .data-table td { padding: 13px 15px; border-bottom: 1px solid var(--color-line); text-align: left; vertical-align: middle; }
.data-table th { color: var(--color-muted); font-size: .67rem; letter-spacing: .08em; text-transform: uppercase; }
.data-table td { font-size: .8rem; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td strong, .data-table td small { display: block; }
.data-table td small { color: var(--color-muted); font-size: .7rem; }
.text-right { text-align: right !important; }
.movement-direction { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; }
.movement-direction.in { color: var(--color-success); }
.movement-direction.out { color: var(--color-danger); }

.dialog { width: min(92vw, 470px); padding: 0; color: var(--color-ink); border: 1px solid var(--color-line); border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: var(--shadow-md); }
.dialog::backdrop { background: rgba(26, 8, 9, .55); backdrop-filter: blur(3px); }
.dialog-header { display: flex; align-items: start; justify-content: space-between; gap: 14px; padding: 20px 20px 13px; border-bottom: 1px solid var(--color-line); }
.dialog-header p { margin-top: 4px; color: var(--color-muted); font-size: .75rem; }
.dialog-body { padding: 18px 20px 20px; }
.dialog-body .form-actions { margin-top: 17px; }

.report-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; min-width: 0; margin-bottom: 18px; }
.summary-card { padding: 16px; border: 1px solid var(--color-line); border-radius: 14px; background: var(--color-surface); }
.summary-card span { color: var(--color-muted); font-size: .72rem; }
.summary-card strong { display: block; margin-top: 6px; font-size: 1.15rem; letter-spacing: -.03em; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .6fr); gap: 18px; min-width: 0; }
.two-col > .card { min-width: 0; }

.report-filter-form { width: 100%; align-items: end; }
.report-filter-form label { min-width: 140px; flex: 1 1 160px; }
.report-filter-form .btn { flex: 0 0 auto; }
.report-filter-form input[type="date"] { min-width: 0; }
.report-mobile-list { display: none; }
.report-product-card { display: grid; gap: 11px; padding: 12px; border: 1px solid var(--color-line); border-radius: 12px; background: var(--color-bg); }
.report-product-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.report-product-head .row-main { min-width: 0; }
.report-product-head .row-main strong, .report-product-head .row-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-product-head .row-main strong { font-size: .84rem; }
.report-product-head .row-main small { margin-top: 2px; color: var(--color-muted); font-size: .7rem; }
.report-product-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.report-product-metrics > div { min-width: 0; padding: 8px 9px; border-radius: 9px; background: var(--color-surface); }
.report-product-metrics span, .report-product-metrics strong { display: block; }
.report-product-metrics span { color: var(--color-muted); font-size: .68rem; }
.report-product-metrics strong { margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; }

.login-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: radial-gradient(circle at 15% 10%, var(--color-primary-soft), transparent 38%), var(--color-bg); }
.login-card { width: min(100%, 420px); padding: 28px; border: 1px solid var(--color-line); border-radius: 26px; background: var(--color-surface); box-shadow: var(--shadow-md); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.login-brand img { width: 62px; height: 62px; border-radius: 50%; object-fit: cover; }
.login-brand strong { display: block; color: var(--color-primary); font-size: 1.35rem; }
.login-brand span { color: var(--color-muted); font-size: .75rem; }
.login-card h1 { margin-bottom: 6px; font-size: 1.45rem; }
.login-card > p { margin-bottom: 22px; color: var(--color-muted); font-size: .82rem; }
.login-card form { display: grid; gap: 15px; }
.login-card .btn { width: 100%; margin-top: 5px; }
.install-page { max-width: 720px; margin: 0 auto; padding: 36px 18px; }
.install-page .login-brand { margin-bottom: 18px; }
.install-step { margin-top: 18px; padding: 20px; border: 1px solid var(--color-line); border-radius: 16px; background: var(--color-surface); }
.install-step ol { margin: 12px 0 0; padding-left: 20px; color: var(--color-muted); }
.install-step code { padding: 2px 5px; border-radius: 5px; background: var(--color-primary-soft); }

.bottom-nav { display: none; }
.muted { color: var(--color-muted); }
.w-full { width: 100%; }
.form-card-body { padding-top: 18px; }
.mt-0 { margin-top: 0; }
.mt-18 { margin-top: 18px; }
.mb-0 { margin-bottom: 0; }
.hidden { display: none !important; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

/* Catálogo inspirado no mockup mobile enviado: busca em cápsula, categorias e cards compactos. */
.shop-intro { margin-bottom: 16px; }
.shop-toolbar { display: grid; grid-template-columns: 46px minmax(0, 1fr); align-items: center; gap: 8px; margin-bottom: 10px; }
.catalog-grid-toggle { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; color: var(--color-secondary); border: 1px solid var(--color-line); border-radius: 13px; background: var(--color-surface); }
.catalog-grid-toggle.is-active, .catalog-grid-toggle:hover { color: #fff; border-color: var(--color-primary); background: var(--color-primary); }
.catalog-search { width: 100%; min-width: 0; gap: 7px; }
.catalog-search .input-wrap { min-width: 0; }
.catalog-search .input-wrap input { border-radius: 999px; }
.catalog-search .search-submit { width: 46px; flex: 0 0 46px; padding: 0; border-radius: 999px; }
.catalog-filter-row { margin-bottom: 16px; }
.catalog-filter { width: min(100%, 360px); }
.catalog-filter select { color: #fff; border-color: var(--color-primary); background: var(--color-primary); border-radius: 999px; font-weight: 750; }
.catalog-filter select option { color: var(--color-ink); background: var(--color-surface); }
.catalog-sections { display: grid; gap: 18px; }
.catalog-section { min-width: 0; }
.category-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 8px 14px; color: #fff; border-radius: 999px; background: var(--color-primary); box-shadow: 0 8px 18px rgba(106, 2, 4, .12); }
.category-bar > div { min-width: 0; }
.category-bar strong, .category-bar small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-bar strong { font-size: .86rem; }
.category-bar small { margin-top: 1px; color: var(--color-highlight); font-size: .66rem; }
.catalog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; margin-top: 12px; }
.product-tile { min-width: 0; padding: 8px 7px 9px; border-radius: 14px; box-shadow: none; }
.product-art { position: relative; display: grid; place-items: center; aspect-ratio: 1 / 1; overflow: hidden; color: var(--color-secondary); border: 1px solid color-mix(in srgb, var(--color-secondary) 20%, transparent); border-radius: 5px; background: linear-gradient(145deg, var(--color-primary-soft), var(--color-highlight)); }
.product-art::after { position: absolute; right: -18px; bottom: -26px; width: 72px; height: 72px; border: 11px solid rgba(255, 255, 255, .34); border-radius: 50%; content: ""; }
.product-art > .icon { position: relative; z-index: 1; width: 48%; height: 48%; color: var(--color-primary); stroke-width: 1.35; }
.product-art-star { position: absolute; top: 7px; left: 7px; z-index: 2; display: inline-flex; color: #fff; }
.product-art-star .icon { fill: var(--color-secondary); stroke: #fff; stroke-width: 1.4; }
.product-tile-heading { min-width: 0; margin-top: 8px; text-align: center; }
.product-tile-heading h3 { display: -webkit-box; overflow: hidden; font-size: .76rem; line-height: 1.15; text-overflow: ellipsis; white-space: normal; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.product-tile-heading .product-code { display: block; overflow: hidden; margin-top: 2px; text-overflow: ellipsis; white-space: nowrap; font-size: .59rem; }
.product-tile-price { display: block; margin-top: 4px; color: var(--color-primary); font-size: .82rem; text-align: center; }
.product-tile-meta { display: flex; justify-content: center; gap: 4px; min-width: 0; margin-top: 5px; color: var(--color-muted); font-size: .59rem; }
.product-tile-meta span { max-width: 50%; overflow: hidden; padding: 2px 4px; border-radius: 5px; background: var(--color-bg); text-overflow: ellipsis; white-space: nowrap; }
.product-rating { display: flex; align-items: center; justify-content: center; gap: 1px; min-height: 21px; margin-top: 3px; color: var(--color-secondary); }
.product-rating .icon { fill: currentColor; stroke-width: 1; }
.product-rating span { margin-left: 3px; color: var(--color-muted); font-size: .58rem; }
.product-tile-stock { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-top: 6px; padding: 5px 6px; color: var(--color-muted); border-radius: 7px; background: var(--color-bg); font-size: .57rem; }
.product-tile-stock strong { color: var(--color-ink); font-size: .68rem; }
.product-tile-stock.is-low { color: var(--color-warning); background: var(--color-warning-soft); }
.product-tile-stock.is-low strong { color: var(--color-warning); }
.product-tile-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin-top: 7px; }
.product-tile-actions form { display: contents; }
.tile-action { display: inline-flex; align-items: center; justify-content: center; width: 100%; min-width: 0; min-height: 40px; padding: 0; color: var(--color-primary); border: 1px solid var(--color-line); border-radius: 8px; background: var(--color-surface); }
.tile-action:hover { color: #fff; border-color: var(--color-primary); background: var(--color-primary); }
.tile-action.tile-entry { color: var(--color-success); }
.tile-action.tile-entry:hover { color: #fff; border-color: var(--color-success); background: var(--color-success); }
.tile-action.tile-sale { color: var(--color-primary); }
.tile-action.tile-delete:hover { color: #fff; border-color: var(--color-danger); background: var(--color-danger); }
.product-tile-archive { display: flex; align-items: center; justify-content: space-between; gap: 5px; margin-top: 8px; }
.product-tile-archive small { color: var(--color-muted); font-size: .6rem; }
.product-tile-archive .btn { min-height: 36px; padding: 5px 7px; font-size: .62rem; }
.shop-empty { padding: 38px 12px; }

@media (max-width: 1180px) {
    .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1023px) {
    .sidebar { transform: translateX(-105%); transition: transform .22s ease; box-shadow: var(--shadow-md); }
    .sidebar.is-open { transform: translateX(0); }
    .app-main { width: 100%; margin-left: 0; }
    .mobile-menu { display: inline-flex; }
    .bottom-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr); padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); border-top: 1px solid var(--color-line); background: color-mix(in srgb, var(--color-surface) 94%, transparent); box-shadow: 0 -5px 20px rgba(50, 10, 12, .08); backdrop-filter: blur(14px); }
    .bottom-nav-link { display: grid; min-height: 44px; justify-items: center; gap: 3px; padding: 5px 2px; color: var(--color-muted); font-size: .62rem; font-weight: 750; }
    .bottom-nav-link.is-active { color: var(--color-primary); }
    .page-content { padding-bottom: 104px; }
    .site-footer { padding-bottom: 90px; }
    .dashboard-grid, .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
    .topbar { min-height: 70px; padding: 13px 15px; }
    .topbar-title .eyebrow { font-size: .58rem; }
    .topbar-title h1 { font-size: 1.2rem; }
    .topbar-actions .avatar-link { display: none; }
    .topbar-title .eyebrow { display: none; }
    .topbar-title { text-align: center; }
    .topbar-theme { display: inline-flex; }
    .topbar-cart { display: none; color: var(--color-primary); }
    .topbar-cart.is-contextual { display: inline-flex; }
    .topbar-cart.is-contextual ~ .topbar-theme { display: none; }
    .page-content { padding: 20px 15px 100px; }
    .page-intro { align-items: start; flex-direction: column; margin-bottom: 17px; }
    .page-intro-actions { width: 100%; }
    .page-intro-actions .btn { flex: 1; }
    .metrics-grid { gap: 10px; margin-bottom: 15px; }
    .metric-card { min-height: 124px; padding: 14px; }
    .metric-value { margin-top: 10px; font-size: 1.15rem; }
    .metric-label { font-size: .69rem; }
    .metric-meta { font-size: .65rem; }
    .stat-strip { grid-template-columns: 1fr; }
    .product-grid { grid-template-columns: 1fr; }
    .product-grid.catalog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .toolbar { display: grid; grid-template-columns: minmax(0, 1fr); }
    .toolbar > *, .search-form, .filter-form { width: 100%; min-width: 0; }
    .search-form { display: flex; }
    .filter-form > * { flex: 1; min-width: 0; }
    .report-filter-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
    .report-filter-form label { min-width: 0; }
    .report-filter-form input[type="date"] { width: 100%; min-width: 0; padding-right: 8px; padding-left: 8px; font-size: 14px; }
    .report-filter-form .btn { width: 100%; grid-column: 1 / -1; }
    .desktop-report-table { display: none; }
    .report-mobile-list { display: grid; gap: 9px; }
    .sales-filter-form, .finance-filter-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
    .sales-filter-form label:nth-of-type(3), .sales-filter-form .btn,
    .finance-filter-form .btn { width: 100%; grid-column: 1 / -1; }
    .sales-filter-form input[type="date"] { min-width: 0; padding-right: 8px; padding-left: 8px; font-size: 14px; }
    .movement-filter-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
    .movement-filter-form label:last-of-type, .movement-filter-form .btn { grid-column: span 2; }
    .management-item { align-items: stretch; flex-direction: column; }
    .action-cluster { justify-content: flex-start; width: 100%; }
    .action-cluster .badge { margin-right: auto; }
    .form-grid { gap: 12px; }
    .field-3, .field-4, .field-6, .field-8 { grid-column: span 12; }
    .form-actions { flex-direction: column-reverse; }
    .form-actions .btn { width: 100%; }
    .card-header { padding: 15px 14px 11px; }
    .card-body { padding: 0 14px 14px; }
    .report-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
    .summary-card { padding: 13px; }
    .summary-card strong { font-size: .98rem; }
    .login-card { padding: 23px 19px; }
    .shop-intro .page-intro-actions { width: 100%; }
    .shop-intro .page-intro-actions .btn { width: 100%; }
    .catalog-filter { width: 100%; }
}

@media (max-width: 390px) {
    .metrics-grid { grid-template-columns: 1fr; }
    .report-summary { grid-template-columns: 1fr; }
    .search-form { gap: 6px; }
    .search-form .btn { padding-right: 11px; padding-left: 11px; }
}

@media (max-width: 360px) {
    .product-grid.catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .product-tile-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .product-tile-heading h3 { font-size: .8rem; }
    .product-tile-price { font-size: .9rem; }
    .report-filter-form { grid-template-columns: 1fr; }
    .report-filter-form .btn { grid-column: auto; }
}

@media (min-width: 1181px) {
    .product-grid.catalog-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
    .topbar-title { flex: 0 1 auto; text-align: left; }
}

@media print {
    .sidebar, .topbar, .bottom-nav, .page-intro-actions, .shop-toolbar, .catalog-filter-row, .product-tile-actions, .site-footer { display: none !important; }
    .app-main { width: 100%; margin: 0; }
    .page-content { padding: 0; }
}

/* Módulos integrados: PDV, CRM e financeiro. Componentes reutilizam os mesmos tokens da marca. */
.customer-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.customer-card { min-width: 0; padding: 16px; }
.customer-card-head, .sale-card-head, .finance-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.customer-card-head .row-main, .sale-card-head > div, .finance-card-head > div { min-width: 0; }
.customer-card h3, .sale-card h3, .finance-card h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-avatar { width: 38px; height: 38px; flex-basis: 38px; }
.customer-card-head .row-main { flex: 1; }
.customer-contact { display: grid; gap: 6px; margin-top: 15px; color: var(--color-muted); font-size: .76rem; }
.customer-contact span { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-card-stats { display: flex; align-items: end; justify-content: space-between; gap: 10px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--color-line); }
.customer-card-stats span { color: var(--color-muted); font-size: .72rem; }
.customer-card-stats strong { color: var(--color-primary); }
.customer-card-actions, .finance-card-actions { display: flex; align-items: center; gap: 8px; margin-top: 15px; }
.customer-card-actions form, .finance-card-actions form { margin: 0; }
.is-archived { opacity: .8; }

.pdv-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(310px, .8fr); align-items: start; gap: 18px; }
.pdv-catalog { min-width: 0; }
.pdv-catalog-card { margin-bottom: 14px; }
.pdv-search { display: flex; align-items: center; gap: 8px; }
.pdv-search .input-wrap { flex: 1; min-width: 0; }
.pdv-category-row { display: flex; gap: 7px; margin-top: 13px; overflow-x: auto; scrollbar-width: thin; }
.category-chip { display: inline-flex; align-items: center; min-height: 36px; flex: 0 0 auto; padding: 6px 13px; color: var(--color-secondary); border: 1px solid var(--color-line); border-radius: 999px; background: var(--color-surface); font-size: .73rem; font-weight: 700; }
.category-chip:hover, .category-chip.is-active { color: #fff; border-color: var(--color-primary); background: var(--color-primary); }
.pos-product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pos-product-card { display: flex; min-width: 0; padding: 10px; }
.pos-product-art { display: grid; width: 76px; height: 76px; flex: 0 0 76px; place-items: center; color: var(--color-primary); border-radius: 12px; background: linear-gradient(145deg, var(--color-primary-soft), var(--color-highlight)); }
.pos-product-art .icon { stroke-width: 1.45; }
.pos-product-content { display: flex; min-width: 0; flex: 1; flex-direction: column; padding-left: 10px; }
.pos-product-category { margin-bottom: 2px; font-size: .56rem; }
.pos-product-content h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos-product-content > small { overflow: hidden; margin-top: 2px; color: var(--color-muted); text-overflow: ellipsis; white-space: nowrap; font-size: .66rem; }
.pos-product-bottom { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 8px 0; }
.pos-product-bottom strong { color: var(--color-primary); font-size: .88rem; }
.pos-product-bottom span { color: var(--color-muted); font-size: .66rem; }
.pdv-cart-card { position: sticky; top: 102px; min-width: 0; }
.pdv-cart-form { padding: 0 18px 18px; }
.pdv-cart-items { display: grid; max-height: 360px; gap: 8px; overflow-y: auto; padding: 2px 0 10px; }
.pdv-cart-items .empty-state { min-height: 120px; padding: 25px 10px; }
.pdv-cart-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px; border: 1px solid var(--color-line); border-radius: 12px; background: var(--color-bg); }
.pdv-cart-line .row-main { min-width: 0; }
.pdv-cart-line .row-main strong, .pdv-cart-line .row-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdv-cart-controls { display: flex; align-items: center; gap: 5px; flex: 0 0 auto; }
.quantity-button { display: inline-flex; width: 32px; height: 32px; align-items: center; justify-content: center; padding: 0; color: var(--color-primary); border: 1px solid var(--color-line); border-radius: 8px; background: var(--color-surface); font-weight: 800; }
.quantity-value { min-width: 18px; text-align: center; }
.pdv-remove-item { padding: 0 4px; color: var(--color-danger); border: 0; background: transparent; font-size: .62rem; }
.pdv-totals { display: grid; gap: 9px; margin: 4px 0 15px; padding: 12px 0; border-top: 1px solid var(--color-line); border-bottom: 1px solid var(--color-line); }
.pdv-totals > div, .pdv-totals > label { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--color-muted); font-size: .78rem; }
.pdv-totals input { width: 112px; min-height: 38px; padding: 7px 10px; text-align: right; }
.pdv-total { padding-top: 5px; color: var(--color-ink) !important; font-size: .95rem !important; }
.pdv-total strong { color: var(--color-primary); font-size: 1.22rem; }
.pdv-checkout-fields { gap: 10px; }
.sale-card, .finance-card { min-width: 0; padding: 16px; }
.sales-list, .finance-list { display: grid; gap: 12px; }
.sale-card-main, .finance-card-main { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--color-line); }
.sale-card-main .row-main, .finance-card-main .row-main { min-width: 0; }
.sale-card-main .row-main small, .finance-card-main .row-main small { display: block; color: var(--color-muted); font-size: .7rem; }
.sale-card-main .row-value { flex: 0 0 auto; }
.sale-card-main .row-value strong { color: var(--color-primary); }
.sale-card-main .row-value small { display: block; color: var(--color-muted); font-size: .67rem; text-align: right; }
.sale-cancel-form { display: flex; align-items: center; gap: 8px; margin-top: 13px; }
.sale-cancel-form input { min-width: 0; flex: 1; min-height: 38px; }
.sale-note { margin-top: 13px; padding: 9px 10px; color: var(--color-muted); border-radius: 9px; background: var(--color-bg); font-size: .74rem; }
.is-cancelled { border-color: color-mix(in srgb, var(--color-danger) 20%, var(--color-line)); }
.finance-card-main .row-main { display: grid; gap: 4px; }
.finance-amount { flex: 0 0 auto; font-size: 1.05rem; }
.finance-amount.is-income { color: var(--color-success); }
.finance-amount.is-expense { color: var(--color-danger); }
.finance-card-actions { justify-content: flex-end; }
.finance-summary small { display: block; margin-top: 4px; color: var(--color-muted); font-size: .67rem; }

@media (max-width: 1180px) {
    .customer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pos-product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1023px) {
    .pdv-layout { grid-template-columns: 1fr; }
    .pdv-cart-card { position: static; order: -1; }
}

@media (max-width: 680px) {
    .customer-grid, .pos-product-grid { grid-template-columns: 1fr; }
    .pos-product-card { padding: 9px; }
    .pos-product-art { width: 68px; height: 68px; flex-basis: 68px; }
    .pdv-search { align-items: stretch; flex-direction: column; }
    .pdv-search .btn { width: 100%; }
    .pdv-cart-form { padding-right: 14px; padding-left: 14px; }
    .pdv-cart-line { align-items: flex-start; flex-direction: column; }
    .pdv-cart-controls { width: 100%; justify-content: flex-end; }
    .sale-cancel-form { align-items: stretch; flex-direction: column; }
    .sale-cancel-form .btn { width: 100%; }
    .sale-card-main, .finance-card-main { align-items: flex-start; flex-direction: column; }
    .sale-card-main .row-value { width: 100%; }
    .sale-card-main .row-value small { text-align: left; }
    .finance-amount { align-self: flex-start; }
}

@media (max-width: 390px) {
    .pdv-category-row { margin-right: -14px; padding-right: 14px; }
    .customer-card-actions, .finance-card-actions { align-items: stretch; flex-direction: column; }
    .customer-card-actions .btn, .finance-card-actions .btn { width: 100%; }
}
