* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #f2f2f2;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Container central estilo mobile */
#app {
    width: 100%;
    max-width: 420px;
    height: 100vh;
    margin: 0 auto;
    background: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

/* Telas */
.screen {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 100%;
    transition: all 0.3s ease, opacity 0.2s;
    display: flex;
    opacity: 0;
    flex-direction: column;
}

/* Tela ativa */
.screen.active {
    left: 0;
    opacity: 1;
}

/* Tela saindo */
.screen.exit-left {
    left: -100%;
}

/* Header estilo app */
header {
    padding: 16px;
    background: #007bff;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

header button {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
}

/* Conteúdo */
main {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.home-filters {
    position: relative;
    z-index: 1;
}

.home-filter-button-active {
    font-weight: 700;
    color: #92400e;
    border-color: #f59e0b;
    background: #fef3c7;
}

.home-menu-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    justify-content: flex-end;
}

.home-menu-overlay[hidden] {
    display: none !important;
}

.home-menu-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    border-radius: 0;
    background: rgba(15, 23, 42, 0.35);
}

.home-menu {
    position: relative;
    z-index: 1;
    width: min(300px, 78vw);
    height: 100%;
    padding: 16px;
    background: #ffffff;
    color: #0f172a;
    box-shadow: -12px 0 30px rgba(15, 23, 42, 0.18);
}

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

.home-menu-body {
    padding-top: 4px;
}

.home-menu .btn {
    border-radius: 8px;
    font-size: 1rem;
}

.home-menu .btn-outline-secondary {
    color: #475569;
    background: #ffffff;
}

.home-menu .btn-outline-secondary:hover,
.home-menu .btn-outline-secondary:focus {
    color: #ffffff;
}

.home-summary-footer {
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
}

.home-resumo-item {
    padding: 14px 16px;
    border-bottom: 1px solid #eef2f7;
    background: #ffffff;
    color: #0f172a;
}

.home-resumo-item:last-child {
    border-bottom: 0;
}

.home-resumo-title {
    font-weight: 700;
}

.home-resumo-meta {
    margin-top: 4px;
    color: #475569;
    font-size: 0.9rem;
}

[data-home-list-body] tr[hidden] {
    display: none !important;
}

.compras-stack {
    position: relative;
    overflow: hidden;
}

.content-compra {
    transition: left 0.3s ease, opacity 0.2s ease, transform 0.3s ease;
}

.compra-fields {
    padding: 18px 16px;
    border: 1px solid #e9edf3;
    border-radius: 16px;
    background: #fcfcfd;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.compra-input {
    border: 0;
    border-bottom: 1px solid #d7dee7;
    border-radius: 0;
    background: transparent;
    padding-left: 0;
    padding-right: 0;
    box-shadow: none;
}

.compra-input:focus {
    background-color: #f3f4f6;
    border-color: #9fb5d1;
    box-shadow: none;
}

.compra-input::placeholder {
    color: #94a3b8;
}

.dia-field-group {
    width: 100%;
}

.dia-suggestions {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.dia-suggestions[hidden] {
    display: none !important;
}

.dia-suggestion-button {
    padding: 10px 0;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    background: #eef2ff;
    color: #1e293b;
    font-weight: 700;
    line-height: 1;
}

.dia-suggestion-button:hover,
.dia-suggestion-button:focus {
    background: #dbeafe;
    color: #0f172a;
    border-color: #93c5fd;
    box-shadow: none;
}

.content-compra[hidden] {
    display: none !important;
}

.content-compra [data-action="compraAnterior"]:disabled,
.content-compra [data-action="proximaCompra"]:disabled {
    background: #cbd5e1;
    border-color: #cbd5e1;
    color: #64748b;
    cursor: not-allowed;
    opacity: 1;
}

/* Botão padrão */
button {
    padding: 12px;
    border: none;
    background: #007bff;
    color: white;
    border-radius: 8px;
    font-size: 16px;
}


.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  background-color: currentColor;
  vertical-align: middle;
  flex-shrink: 0;
  -webkit-mask: var(--icon-url) no-repeat center;
  mask: var(--icon-url) no-repeat center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.icon-shopping-cart {
  --icon-url: url('../svg/shopping_cart.svg');
}

.icon-add-shopping-cart {
  --icon-url: url('../svg/add_shopping_cart.svg');
}

.icon-remove-shopping-cart {
  --icon-url: url('../svg/remove_shopping_cart.svg');
}

.icon-home {
  --icon-url: url('../svg/home.svg');
}

.icon-menu {
  --icon-url: url('../svg/menu.svg');
}

.icon-settings {
  --icon-url: url('../svg/settings.svg');
}

.icon-add-circle {
  --icon-url: url('../svg/add_circle.svg');
}


.badge-compras-criadas {
  min-width: 28px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #ffffff;
  color: #007bff;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}

.badge-compras-icone {
  position: absolute;
  top: -8px;
  right: -12px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ffffff;
  color: #007bff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

[data-compras-badge][hidden] {
  display: none !important;
}

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12px 16px 16px;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(3px);
}

.search-window {
  width: 100%;
  max-width: 360px;
  max-height: 50vh;
  max-height: 50dvh;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.search-window-input {
  border: 0;
  border-bottom: 1px solid #e2e8f0;
  border-radius: 0;
  padding: 16px;
  box-shadow: none;
}

.search-window-input:focus {
  box-shadow: none;
  border-color: #bfdbfe;
}

.search-suggestions {
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(50vh - 64px);
  max-height: calc(50dvh - 64px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.search-suggestion-item {
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid #eef2f7;
  background: #ffffff;
  color: #0f172a;
  text-align: left;
  font-size: 0.95rem;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.search-suggestion-item:last-child {
  border-bottom: 0;
}

.search-suggestion-item:active,
.search-suggestion-item:hover {
  background: #eff6ff;
  color: #0f172a;
}

.search-suggestions-empty {
  padding: 16px;
  color: #64748b;
  font-size: 0.9rem;
}

.search-suggestion-title {
  font-weight: 600;
}

.search-suggestion-subtitle {
  color: #64748b;
  font-size: 0.85rem;
}
