@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  color-scheme: light;
  font-family: Inter, system-ui, sans-serif;
  color: #181c27;
  background: #f4f5f7;
  --muted: #5b6474;
  --line: #e4e6ec;
  --red: #b8182b;
  --nav: #10121a;
  --white: #fff;
}
.presence-online { color: #146839; white-space: nowrap; }
* { box-sizing: border-box; }
#cadastro-dialog { width: 96vw; max-width: 1500px; height: 96vh; max-height: 96vh; padding: 16px; border: 1px solid #ccc; border-radius: 8px; }
#cadastro-dialog[open] { display: flex; flex-direction: column; gap: 12px; }
#fechar-cadastro { align-self: flex-end; flex-shrink: 0; }
dialog::backdrop { background: #0008; }
#cadastro-frame { display: block; flex: 1; min-height: 0; width: 100%; border: 0; }
.popup-page { display: block; }
.popup-page main { padding: clamp(16px, 3vw, 36px); max-width: 1100px; }
.popup-page .narrow { max-width: none; }
label.required::after { content: " *"; color: #b8182b; }
.required-mark { color: #b8182b; font-weight: 700; }
input.field-invalid, select.field-invalid, textarea.field-invalid,
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border: 2px solid #b8182b; }
.errorlist:empty { display: none; }
.sale-row.entrada-row { grid-template-columns: 13ch minmax(220px, 1fr) 100px 135px auto; }
@media (min-width: 521px) and (max-width: 1000px) {
  .sale-row.entrada-row { grid-template-columns: 13ch minmax(0, 1fr); }
}
@media (max-width: 520px) { .sale-row.entrada-row { grid-template-columns: minmax(0, 1fr); } }
body { margin: 0; display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100vh; }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #4265ad; outline-offset: 3px; }
.sidebar { background: var(--nav); color: var(--white); display: flex; flex-direction: column; padding: 24px 15px; gap: 24px; min-width: 0; }
.brand { display: grid; place-items: center; background: #030303; border-radius: 8px; }
.brand img { width: 112px; aspect-ratio: 1; object-fit: contain; }
.sidebar-header .brand { width: 100%; }
.menu-toggle, .mobile-identity { display: none; }
.filter-panel > summary { display: none; }
.sidebar nav { display: grid; gap: 5px; }
.sidebar nav a { display: flex; gap: 10px; align-items: center; padding: 12px; color: #dddfe8; border-radius: 6px; font-size: .88rem; font-weight: 600; }
.menu-icon { width: 20px; height: 20px; flex: 0 0 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.account-action { display: inline-flex; align-items: center; gap: 8px; }
.account-action .menu-icon { width: 17px; height: 17px; flex-basis: 17px; }
.sidebar nav a.active { background: #392028; color: #fff; box-shadow: inset 3px 0 #ec4e62; }
.sidebar nav a:hover { background: #282631; text-decoration: none; }
.account { margin-top: auto; display: grid; gap: 8px; padding: 14px 12px 0; border-top: 1px solid #343642; overflow-wrap: anywhere; }
.account a, .link-button { color: #c7cad4; font-size: .83rem; }
.link-button { border: 0; background: none; padding: 0; cursor: pointer; }
.link-button:hover { text-decoration: underline; }
main { width: 100%; max-width: 1550px; margin: 0 auto; padding: clamp(18px, 3.1vw, 48px); min-width: 0; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: 0 0 24px; }
h1, h2, p { margin: 0; }
h1, h2 { font-family: 'Barlow Condensed', 'Arial Narrow', Inter, sans-serif; line-height: 1.04; }
h1 { font-size: clamp(2.15rem, 4vw, 3.25rem); letter-spacing: -.025em; }
h2 { font-size: 1.55rem; }
.eyebrow { margin-bottom: 8px; color: var(--muted); font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 9px 15px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); color: #252b36; font: 600 .86rem Inter, system-ui, sans-serif; cursor: pointer; }
.button:hover { background: #edeff4; text-decoration: none; }
.button.primary { background: var(--red); border-color: var(--red); color: #fff; }
.button.primary:hover { background: #961324; }
.button.danger { color: var(--red); }
.button:disabled { opacity: .55; cursor: default; }
.button.selected { background: #172032; color: #fff; }
.back { display: inline-block; margin-bottom: 9px; font-size: .84rem; }
.actions, .filters, .search { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.filters, .search { margin-bottom: 16px; }
.search input { flex: 1; min-width: 120px; max-width: 380px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.metrics article, .card { border-radius: 10px; border: 1px solid var(--line); background: var(--white); min-width: 0; }
.metrics article { display: grid; align-content: start; gap: 8px; padding: clamp(12px, 1.8vw, 22px); border-top: 3px solid #d8dce7; }
.metrics article:first-child { border-top-color: var(--red); }
.metrics strong { font-size: clamp(1.17rem, 2vw, 1.9rem); letter-spacing: -.04em; overflow-wrap: anywhere; }
.metrics span { font-size: .83rem; font-weight: 600; }
small, .empty, .hint, dt { color: var(--muted); }
small { display: block; margin-top: 4px; font-size: .76rem; }
.overview { display: grid; gap: 16px; grid-template-columns: minmax(0, 2fr) minmax(250px, 1fr); align-items: start; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; }
.card-head a { font-size: .8rem; font-weight: 600; white-space: nowrap; }
.padded { padding: 20px; }
.narrow { max-width: 620px; }
.spaced { margin-top: 18px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 12px 16px; border-top: 1px solid #edf0f4; font-size: .84rem; }
th { background: #f8f9fb; color: #4b5363; font-size: .74rem; white-space: nowrap; }
.money { white-space: nowrap; font-variant-numeric: tabular-nums; }
.empty { padding: 22px 16px; }
.tag { display: inline-block; border-radius: 5px; background: #edf0f5; color: #394458; font-size: .75rem; font-weight: 600; padding: 4px 7px; white-space: nowrap; }
.tag.low { color: #a11225; background: #fbe7eb; }
.tag.ok { color: #235b44; background: #e6f6ee; }
.stock-list { padding: 0; margin: 0; list-style: none; }
.stock-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid #edf0f4; padding: 12px 16px; font-size: .88rem; }
.notice { background: #e8edf8; color: #243856; border: 1px solid #d3ddf0; border-radius: 6px; padding: 12px; margin-bottom: 16px; }
.notice.success { background: #e7f5ed; color: #235b44; border-color: #cde9d8; }
.notice.error, .errorlist { color: #a11225; }
.errorlist { margin: 6px 0; padding-left: 20px; font-size: .84rem; }
.stack, .field-grid, .sale-row, .details { display: grid; gap: 14px; }
.field-grid, .details { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.field-grid { margin-top: 16px; }
label { display: block; margin-bottom: 5px; font-size: .83rem; font-weight: 600; }
input:not([type=checkbox]), select { width: 100%; min-height: 39px; padding: 8px 10px; border: 1px solid #d0d5df; border-radius: 5px; font: inherit; background: #fff; color: inherit; }
input[type=checkbox] { accent-color: var(--red); }
.hint { margin-bottom: 14px; font-size: .88rem; }
.sale-row { grid-template-columns: minmax(0, 3fr) minmax(92px, 1fr) minmax(130px, 1fr) auto; align-items: end; padding: 12px 0; border-bottom: 1px solid var(--line); }
.sale-row > .errorlist { grid-column: 1 / -1; }
.delete-item { display: flex; align-items: center; gap: 5px; min-height: 39px; }
.delete-item label { margin: 0; }
#add-item { margin-top: 12px; }
.details { margin: 0; }
dt { font-size: .78rem; }
dd { margin: 5px 0 0; }
.signed-out { display: grid; grid-template-columns: 1fr; place-items: center; }
.login-card { display: grid; grid-template-columns: 220px 1fr; max-width: 620px; margin: auto; border: 1px solid var(--line); border-radius: 12px; background: white; overflow: hidden; }
.login-brand { background: #030303; display: grid; place-items: center; }
.login-brand img { width: 100%; max-width: 210px; }
.login-card section { padding: 24px; }
.login-card h1 { font-size: 2rem; margin-bottom: 22px; }
.item-overview { display: flex; flex-wrap: wrap; gap: 22px; align-items: start; }
.item-overview .details { flex: 1 1 280px; }
.item-photo, .item-thumb { object-fit: contain; border: 1px solid var(--line); border-radius: 7px; background: #f8f9fb; }
.item-photo { width: min(100%, 190px); height: 190px; }
.item-thumb { display: block; width: 88px; height: 88px; margin-top: 8px; }
.price-group { min-width: 0; margin: 0; padding: 14px 16px 16px; border: 1px solid #cdd3df; border-radius: 7px; background: #f8f9fb; }
.price-group legend { padding: 0 7px; font-weight: 700; font-size: .9rem; }
.price-group dd { font-weight: 600; }
@media (max-width: 1100px) { .overview { grid-template-columns: 1fr; } }
@media (max-width: 800px) {
  body { grid-template-columns: 1fr; }
  .sidebar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: 8px 12px; }
  .brand img { width: 60px; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 2px; }
  .sidebar nav a { padding: 8px; font-size: .77rem; }
  .sidebar nav a .menu-icon { width: 17px; height: 17px; flex-basis: 17px; }
  .account { border: 0; padding: 0; margin: 0; font-size: .78rem; }
  .sale-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sale-row > div:first-of-type { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .login-card { grid-template-columns: 1fr; }
  .login-brand img { width: 110px; }
}

/* Navegação compacta, controles de toque e registros legíveis em telas pequenas. */
@media screen and (max-width: 800px) {
  body { display: block; min-height: 100dvh; }
  .sidebar { display: flex; padding: 10px 14px; gap: 12px; }
  .sidebar-header { display: flex; align-items: center; gap: 10px; width: 100%; }
  .sidebar-header .brand { width: 44px; flex: 0 0 44px; }
  .brand img { width: 44px; }
  .mobile-identity { display: grid; gap: 3px; min-width: 0; flex: 1; }
  .mobile-identity strong { font-size: .84rem; letter-spacing: .06em; }
  .mobile-identity span { color: #c7cad4; font-size: .78rem; overflow-wrap: anywhere; }
  .nav-ready .menu-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 12px; border: 1px solid #525460; border-radius: 6px; background: transparent; color: white; font: inherit; cursor: pointer; }
  .sidebar nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .sidebar nav a { min-height: 44px; padding: 11px; font-size: .85rem; }
  .sidebar .account { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 4px 0; border-top: 1px solid #343642; }
  .account .link-button { min-height: 44px; padding: 8px; }
  .nav-ready .sidebar:not(.menu-open) nav, .nav-ready .sidebar:not(.menu-open) .account { display: none; }
  main { padding: 20px 14px 32px; }
  .page-head { align-items: start; margin-bottom: 18px; }
  h1 { font-size: clamp(1.85rem, 7vw, 2.4rem); overflow-wrap: anywhere; }
  h2 { font-size: 1.4rem; }
  .page-head > *, .actions > *, .field-grid > *, .sale-row > *, .details > * { min-width: 0; }
  .page-head .actions { width: 100%; }
  .button { min-height: 44px; white-space: normal; text-align: center; }
  .actions .button { flex: 1 1 130px; }
  input:not([type=checkbox]), select, textarea { font-size: 16px; min-height: 44px; max-width: 100%; }
  textarea { width: 100%; padding: 10px; border: 1px solid #d0d5df; border-radius: 5px; font-family: inherit; resize: vertical; }
  input[type=checkbox] { width: 20px; height: 20px; flex-shrink: 0; }
  .delete-item { min-height: 44px; }
  .padded { padding: 16px; }
  .card-head { padding: 14px 16px; flex-wrap: wrap; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics article { padding: 13px; }
  .stock-list li, dd { overflow-wrap: anywhere; }
  .sale-row { row-gap: 14px; padding: 16px 0; }
  .search input { max-width: none; min-width: 0; }
  .login-card { width: 100%; max-width: 440px; grid-template-columns: 1fr; }
  .login-brand img { width: 96px; }
  .login-card section { padding: 22px; }
  #cadastro-dialog { width: calc(100vw - 12px); height: 96dvh; max-height: 96dvh; padding: 8px; }
  .popup-page main { padding: 14px 8px; }
}
@media screen and (max-width: 600px) {
  .table-wrap:has(.mobile-table) { overflow: visible; }
  .mobile-table, .mobile-table tbody { display: block; width: 100%; }
  .mobile-table thead { display: none; }
  .mobile-table .mobile-record { display: block; padding: 10px 14px; border-top: 1px solid var(--line); }
  .mobile-table .mobile-record:first-child { border-top: 0; }
  .mobile-table .mobile-record td { display: grid; grid-template-columns: minmax(88px, .75fr) minmax(0, 1.25fr); gap: 12px; align-items: baseline; border: 0; padding: 7px 0; font-size: .88rem; white-space: normal; }
  .mobile-table .mobile-record td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; font-weight: 600; }
  .mobile-table .cell-value { min-width: 0; overflow-wrap: anywhere; }
  .mobile-table .cell-value a { display: inline-block; padding: 4px 0; }
  .mobile-table td[colspan] { display: block; white-space: normal; }
  .mobile-table tr:has(td[colspan]) { display: block; }
}
@media screen and (max-width: 520px) {
  .field-grid, .details, .sale-row, .sale-row.entrada-row { grid-template-columns: minmax(0, 1fr); }
  .sale-row > div:first-of-type { grid-column: auto; }
  .page-head > .button { width: 100%; }
  .search { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .search input { width: 100%; }
  .item-overview .details { flex-basis: 100%; }
  .price-group { padding: 12px; }
}
@media screen and (max-width: 800px) {
  .filter-panel > summary { display: list-item; min-height: 44px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 7px; background: white; color: #252b36; font-weight: 600; cursor: pointer; }
  .filter-panel[open] > summary { margin-bottom: 10px; }
  .filter-panel[open] > form { margin-bottom: 16px; }
}

