:root {
  --bg: #f4efe6;
  --paper: #fffdf8;
  --ink: #1f1a16;
  --line: #ddc9ac;
  --line-strong: #b79b7a;
  --accent: #ba2b2b;
  --accent-dark: #8f1f1f;
  --ok: #2e7d32;
  --ticket-width: 80mm;
  --group-tab-bg: #fff9f1;
  --group-tab-text: #2e1f14;
  --group-tab-border: #b89b79;
  --group-tab-active-bg: #fff1f1;
  --group-tab-active-text: #ba2b2b;
  --group-tab-active-border: #8f1f1f;
  --menu-groups-width: 178px;
  --layout-groups-font-size: 14px;
  --layout-menu-items-font-size: 15px;
  --layout-order-items-font-size: 17px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top left, #fff9f0 0%, #f6efe4 30%, var(--bg) 100%);
  color: var(--ink);
  font-family: "Nunito", "Trebuchet MS", sans-serif;
}

body.burger-menu-open {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.9rem;
}

/* === SIDEBAR LAYOUT (desktop) === */
@media (min-width: 762px) {
  .app-shell:not(.table-mode) {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0;
    padding: 0;
    max-width: 100%;
    min-height: 100dvh;
  }

  .app-shell:not(.table-mode) .topbar {
    flex: 0 0 88px;
    width: 88px;
    min-height: 100dvh;
    position: sticky;
    top: 0;
    z-index: 1201; /* sopra il banco-screen (1200) */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 0 0 0.75rem;
    border: none;
    border-right: 1px solid var(--line);
    border-radius: 0;
    background: #fffdf8;
    box-shadow: 2px 0 12px rgba(42, 26, 11, 0.06);
  }

  .app-shell:not(.table-mode) .topbar-menu {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.75rem 0;
  }

  .app-shell:not(.table-mode) .topbar-burger-btn {
    border: none;
    background: transparent;
    box-shadow: none;
  }

  .app-shell:not(.table-mode) .topbar-title {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    overflow: hidden;
  }

  .app-shell:not(.table-mode) .topbar-title h1 {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-size: 1.1rem;
    letter-spacing: 0.12em;
    white-space: nowrap;
  }

  .app-shell:not(.table-mode) .topbar-title p {
    display: none;
  }

  .app-shell:not(.table-mode) .topbar-actions {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0 0 0.5rem;
  }

  .app-shell:not(.table-mode) .topbar-actions .sync-status {
    display: none;
  }

  .app-shell:not(.table-mode) .topbar-actions button {
    width: 40px;
    min-height: 40px;
    padding: 0;
    font-size: 0;
    border-radius: 10px;
  }

  .app-shell:not(.table-mode) .topbar-actions button::before {
    content: "↻";
    font-size: 1.1rem;
    display: block;
  }

  /* room-select-row ora è dentro tables-panel */

  .app-shell:not(.table-mode) > #mainLayout {
    flex: 1 1 auto;
    min-width: 0;
    padding: 1rem 1rem 1rem 1rem;
  }

  /* Voci di navigazione nella sidebar */
  .topbar-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 0.25rem;
    padding: 0.5rem 0;
    border-top: 1px solid var(--line);
    margin-top: 0.25rem;
  }

  .topbar-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 72px;
    min-height: 60px;
    padding: 0.4rem 0.2rem;
    border: none;
    background: transparent;
    border-radius: 12px;
    color: #6b5040;
    cursor: pointer;
    transition: background 0.13s, color 0.13s;
  }

  .topbar-nav-btn span {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1;
  }

  .topbar-nav-btn:hover,
  .topbar-nav-btn.active {
    background: #fff1e6;
    color: var(--accent);
  }
}

.app-shell.table-mode .topbar,
.app-shell.table-mode .sync-status {
  display: none;
}

.app-shell.table-mode .room-select-row {
  display: none;
}

.topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.8rem;
  padding: 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff9ee;
}

.topbar-menu {
  position: relative;
  align-self: start;
}

.topbar-burger-btn {
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
}

.burger-line {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: #4d3624;
}

/* === BURGER MENU DRAWER (stile Tilby) === */

/* Il wrapper è il trigger point, non il pannello visibile */
.topbar-burger-menu {
  position: static;
  display: contents; /* non occupa spazio, i figli si posizionano da soli */
}

/* Overlay scuro dietro il pannello */
.burger-overlay {
  position: fixed;
  inset: 0;
  z-index: 1290;
  background: rgba(20, 10, 0, 0.38);
  opacity: 1;
  transition: opacity 0.22s ease;
}

.topbar-burger-menu.hidden .burger-overlay {
  opacity: 0;
  pointer-events: none;
}

/* Pannello laterale */
.burger-panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1300;
  width: min(80vw, 280px);
  background: #ffffff;
  box-shadow: 4px 0 24px rgba(20, 10, 0, 0.18);
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}

.topbar-burger-menu.hidden .burger-panel {
  transform: translateX(-100%);
}

/* Header del pannello con pulsante X */
.burger-panel-header {
  display: flex;
  align-items: center;
  padding: 0.6rem 0.75rem;
  min-height: 52px;
}

.burger-close-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  border: none;
  background: none;
  font-size: 1.1rem;
  color: #555;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.burger-close-btn:hover {
  background: #f0f0f0;
}

/* User box con avatar */
.burger-user-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem 1rem;
  border-bottom: 1px solid #f0ece6;
}

.burger-avatar {
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: 50%;
  background: #3a7bd5;
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
}

.burger-user-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.burger-user-btn {
  background: none;
  border: none;
  padding: 0;
  font-weight: 700;
  font-size: 0.92rem;
  color: #1a1a1a;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.burger-user-btn:hover {
  color: var(--accent);
}

.burger-env-label {
  display: block;
  font-size: 0.72rem;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Env switch */
.burger-env-switch {
  display: grid;
  gap: 0.36rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f0ece6;
}

/* Voci di navigazione */
.burger-nav {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0.5rem;
  flex: 1;
  gap: 0.15rem;
}

.burger-nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  min-height: 48px;
  padding: 0 0.85rem;
  border: none;
  background: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #2a2a2a;
  text-align: left;
  cursor: pointer;
  transition: background 0.13s;
}

.burger-nav-item:hover,
.burger-nav-item.active {
  background: #f0f4ff;
  color: #1a56db;
}

.burger-nav-item.active {
  font-weight: 700;
}

.burger-nav-icon {
  font-size: 1.15rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.burger-env-switch label {
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
  color: #5f4935;
  letter-spacing: 0.3px;
}

.burger-env-switch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.34rem;
  align-items: center;
}

.burger-env-switch-row select {
  min-height: 40px;
}

.burger-env-switch-row button {
  min-height: 40px;
  min-width: 76px;
  text-align: center;
}

.topbar-title {
  min-width: 0;
}

.topbar-title h1 {
  margin: 0;
  font-family: "Bebas Neue", "Oswald", Arial, sans-serif;
  font-size: 2rem;
  letter-spacing: 0.8px;
  color: var(--accent);
}

.topbar-title p {
  margin: 0.2rem 0 0;
  font-size: 0.92rem;
}

.topbar-actions {
  display: grid;
  grid-template-columns: auto;
  align-content: start;
  justify-content: end;
  gap: 0.45rem;
}

.topbar-actions .sync-status {
  grid-column: 1 / -1;
  justify-self: end;
  margin: 0;
  min-height: 34px;
  max-width: min(92vw, 360px);
  padding: 0.26rem 0.56rem;
  font-size: 0.76rem;
  display: flex;
  align-items: center;
}

.room-select-row {
  margin: 0.62rem 0 0.2rem;
  display: flex;
  align-items: flex-end;
}

.room-select-row label {
  width: min(320px, 100%);
}

label {
  display: grid;
  gap: 0.26rem;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 800;
}

input,
select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.46rem 0.6rem;
  background: #fffefb;
}

button {
  min-height: 42px;
  border: 1px solid #b89b79;
  border-radius: 10px;
  background: #fff9f1;
  font-weight: 800;
  padding: 0.4rem 0.82rem;
  color: #2e1f14;
  cursor: pointer;
}

button:active {
  transform: translateY(1px);
}

button.primary {
  border-color: var(--accent-dark);
  background: var(--accent);
  color: #fff;
}

button.danger {
  border-color: #d08f8f;
  background: #fff1f1;
  color: #7b1f1f;
}

.sync-status {
  margin: 0.65rem 0;
  padding: 0.44rem 0.68rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf8;
  font-weight: 700;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.28rem 0.34rem;
}

.sync-status-text {
  min-width: 140px;
  flex: 1 1 auto;
}

.sync-status.ok {
  border-color: #a9cda7;
  color: #1f5f23;
  background: #f2fbf2;
}

.sync-status.warn {
  border-color: #deb88f;
  color: #7d4a11;
  background: #fff9ef;
}

.sync-status.err {
  border-color: #daa5a5;
  color: #7e1818;
  background: #fff2f2;
}

.table-notice {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1200;
  width: min(86vw, 360px);
  margin: 0;
  padding: 0.82rem 0.92rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf8;
  font-weight: 800;
  font-size: 1rem;
  text-align: center;
  box-shadow: 0 14px 38px rgba(32, 20, 7, 0.25);
  pointer-events: none;
}

.table-notice.ok {
  border-color: #a9cda7;
  color: #1f5f23;
  background: #f2fbf2;
}

.table-notice.warn {
  border-color: #deb88f;
  color: #7d4a11;
  background: #fff9ef;
}

.table-notice.err {
  border-color: #daa5a5;
  color: #7e1818;
  background: #fff2f2;
}

.layout {
  display: grid;
  grid-template-columns: 250px minmax(420px, 1fr) minmax(390px, 1fr);
  gap: 0.8rem;
}

.layout.screen-tables {
  grid-template-columns: 1fr;
}

.layout.screen-tables .table-screen-only {
  display: none;
}

/* Tavoli senza box contenitore */
.layout.screen-tables .tables-panel {
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

/* Barra titolo "Sale e Tavoli" + sale selector orizzontale */
@media (min-width: 762px) {
  .app-shell:not(.table-mode) > #mainLayout {
    padding-top: 0;
    display: flex;
    flex-direction: column;
  }

  /* Barra titolo + tab sale: blocco unico attaccato */
  .layout.screen-tables .tables-panel .panel-head {
    background: #fffdf8;
    border: none;
    border-bottom: none;
    box-shadow: none;
    margin: 0 -1rem 0;
    padding: 0 1rem;
    min-height: calc(42px + 1.5rem);
    display: flex;
    align-items: center;
    gap: 1.2rem;
  }

  .layout.screen-tables .tables-panel .panel-head h2 {
    font-family: "Bebas Neue", "Oswald", Arial, sans-serif;
    font-size: 1.1rem;
    letter-spacing: 0.1em;
    color: var(--ink);
    font-weight: 400;
    margin: 0;
    flex-shrink: 0;
  }

  /* Statistiche generali nella barra titolo */
  .tables-stats {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.9rem;
    margin-left: auto;
    margin-right: 0.5rem;
  }

  .tables-stats-totals {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    text-align: right;
  }

  .tables-stats-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    justify-content: flex-end;
    line-height: 1.3;
  }

  .tables-stats-label {
    font-size: 0.72rem;
    color: #8a7060;
    font-weight: 600;
  }

  .tables-stats-value {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--ink);
  }

  .tables-stats-coperti {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    color: #6b5040;
    border-left: 1px solid var(--line);
    padding-left: 0.9rem;
  }

  .tables-stats-coperti svg {
    flex-shrink: 0;
  }

  .tables-stats-coperti-num {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--ink);
  }

  /* Room tabs attaccati al panel-head, stesso sfondo */
  .layout.screen-tables .tables-panel .room-tabs-bar {
    margin: 0 -1rem 1rem;
    background: #fffdf8;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 2px 8px rgba(42, 26, 11, 0.05);
  }

}

/* === MENU ⋮ SALE E TAVOLI === */
.tables-panel-menu {
  position: relative;
  margin-left: auto;
  flex-shrink: 0;
}

.tables-panel-menu-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 36px;
  min-height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.12s;
}

.tables-panel-menu-btn span {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink);
  opacity: 0.55;
}

.tables-panel-menu-btn:hover span {
  opacity: 1;
}

.tables-panel-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 200;
  min-width: 180px;
  background: #fffdf8;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(30, 15, 5, 0.18);
  padding: 0.35rem;
  display: grid;
  gap: 0.1rem;
}

.tables-panel-dropdown.hidden {
  display: none;
}

.tables-panel-dropdown-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.1s;
  min-height: 0;
}

.tables-panel-dropdown-item:hover {
  background: #f5ede2;
}

.tables-panel-dropdown-divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 0.2rem 0.4rem;
}

/* === MAPPA TAVOLI === */
.tables-grid.table-map-mode {
  position: relative;
  height: 70vh;
  min-height: 500px;
  overflow: auto;
  background: #f8f3ea;
  border-radius: 12px;
  border: 1px solid var(--line);
  /* reset grid */
  display: block;
}

.tables-grid.table-map-mode.table-map-editing {
  background:
    linear-gradient(rgba(183, 155, 122, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(183, 155, 122, 0.12) 1px, transparent 1px);
  background-size: 40px 40px;
}

.table-card-map {
  position: absolute;
  width: 110px;
  height: 90px;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: box-shadow 0.12s;
}

.tables-grid.table-map-mode.table-map-editing .table-card-map {
  cursor: grab;
  touch-action: none;
}

.tables-grid.table-map-mode.table-map-dragging .table-card-map:not(.dragging) {
  pointer-events: none;
}

.table-card-map:hover {
  z-index: 5;
}

.table-card-map.dragging {
  cursor: grabbing;
  z-index: 100;
  box-shadow: 0 12px 32px rgba(30, 15, 5, 0.25);
  opacity: 0.9;
  transition: none;
}

/* In modalità mappa i bottoni hanno dimensioni fisse */
.table-card-map .table-btn {
  width: 110px;
  height: 90px;
  min-height: 0;
  cursor: pointer;
  pointer-events: auto;
  border-radius: 12px;
  align-content: center;
  justify-items: center;
  text-align: center;
  padding: 0.4rem;
  padding-right: 0.4rem;
}

.tables-grid.table-map-mode.table-map-editing .table-card-map .table-btn {
  cursor: inherit;
  pointer-events: none;
}

/* === TAB SALE === */
.room-tabs-bar {
  display: flex;
  margin: 0 -1rem 1rem;
  border-bottom: 1px solid var(--line);
  background: #fffdf8;
  overflow-x: auto;
  scrollbar-width: none;
}

.room-tabs-bar::-webkit-scrollbar {
  display: none;
}

.room-tab {
  flex: 1 1 0;
  min-width: 80px;
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #7a6350;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.7rem 0.5rem;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  transition: color 0.12s, border-color 0.12s;
  letter-spacing: 0.02em;
}

.room-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: transparent;
}

@media (hover: hover) {
  .room-tab:not(.active):hover {
    color: var(--ink);
    background: #fdf5ea;
  }
}

/* Nascondi la barra tab se c'è una sola sala */
.room-tabs-bar:has(.room-tab:only-child) {
  display: none;
}

.layout.screen-table {
  grid-template-columns: minmax(420px, 1fr) minmax(390px, 1fr);
}

.layout.screen-table .tables-panel {
  display: none;
}

.panel {
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--paper);
  padding: 0.72rem;
  min-height: 220px;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.45rem;
  border-bottom: 1px solid #e7d6bf;
  margin-bottom: 0.62rem;
  padding-bottom: 0.42rem;
}

.panel-head h2 {
  margin: 0;
  font-family: "Oswald", Arial, sans-serif;
  letter-spacing: 0.5px;
  font-size: 1.4rem;
}

.panel-head small {
  font-weight: 700;
  font-size: 0.78rem;
  color: #5a4a38;
}

.panel-head-order {
  align-items: center;
}

.ghost-btn {
  min-height: 34px;
  padding: 0.2rem 0.56rem;
  font-size: 0.82rem;
  border-style: dashed;
}

.tables-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
  margin-bottom: 0.6rem;
}

.tables-tools input {
  min-height: 38px;
}

.tables-tools button {
  min-height: 38px;
  white-space: nowrap;
}

.tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 0.55rem;
}

.table-merge-bar {
  border: 1px solid #7e9fd8;
  border-radius: 10px;
  background: #eef5ff;
  padding: 0.5rem;
  margin-bottom: 0.55rem;
  display: grid;
  gap: 0.42rem;
}

.table-merge-bar[hidden] {
  display: none !important;
}

.table-merge-label {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 800;
  color: #1f3f6f;
}

.table-merge-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.42rem;
}

.table-card {
  position: relative;
}

.table-card .table-btn {
  width: 100%;
}

.table-btn {
  position: relative;
  min-height: 78px;
  background: #fffdf8;
  border: 1px solid #d7c1a3;
  border-radius: 10px;
  font-weight: 800;
  display: grid;
  justify-items: start;
  align-content: start;
  gap: 0.2rem;
  text-align: left;
  padding: 0.48rem 0.56rem;
  padding-right: 1.65rem;
}

.table-label {
  font-family: "Oswald", Arial, sans-serif;
  font-size: 1rem;
  letter-spacing: 0.2px;
  line-height: 1.05;
}

.table-id {
  font-size: 0.69rem;
  font-weight: 800;
  color: #705946;
  letter-spacing: 0.25px;
}

.table-total {
  font-size: 0.86rem;
  font-weight: 900;
  color: #7f1f1f;
}

.table-timer {
  font-size: 0.68rem;
  font-weight: 800;
  color: #6f5941;
  line-height: 1;
}

.table-btn.active {
  border-color: var(--accent-dark);
  color: var(--accent);
  background: #fff2f2;
}

.table-btn.has-open {
  border-color: #7fa977;
  background: #f4fbf3;
}

.table-btn.status-conto {
  border-color: #d9a448;
  background: #fff8e9;
}

.table-btn.status-closed {
  border-color: #d7c1a3;
  background: #fffdf8;
}

.table-btn.occupied {
  border-color: #9f1111;
  background: #ffd0d0;
  color: #6f0909;
}

.table-btn.occupied .table-total {
  color: #7e0b0b;
}

.table-btn.merge-selected {
  border-color: #3a6ec5;
  background: #dfeeff;
  color: #163763;
}

.table-btn.merge-selected .table-total,
.table-btn.merge-selected .table-timer {
  color: #204978;
}

.table-btn.merge-master {
  border-color: #2e5cab;
  box-shadow: 0 0 0 2px rgba(58, 110, 197, 0.25) inset;
}

.table-btn.transfer-source {
  border-color: #c89d1e;
  background: #fff4c4;
  color: #5f4500;
  box-shadow: 0 0 0 2px rgba(200, 157, 30, 0.24) inset;
}

.table-btn.transfer-destination {
  border-color: #3a7f45;
  background: #eaf8ed;
}

.table-merge-icon {
  position: absolute;
  right: 6px;
  bottom: 6px;
  min-width: 18px;
  min-height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: var(--merge-icon-bg, #e5f0ff);
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
  pointer-events: none;
}

.table-move-lines-list {
  display: grid;
  gap: 0.42rem;
  max-height: min(52vh, 420px);
  overflow: auto;
  padding-right: 0.1rem;
}

.table-move-line {
  border: 1px solid #e6d2b7;
  border-radius: 10px;
  background: #fffefb;
  padding: 0.44rem;
  display: grid;
  gap: 0.26rem;
  touch-action: pan-y;
  user-select: none;
  transition: transform 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
}

.table-move-line.swiping {
  background: #fff7ea;
}

.table-move-line.selected {
  border-color: #5c8f55;
  background: #f4fbf3;
  box-shadow: 0 0 0 2px rgba(92, 143, 85, 0.16);
}

.table-move-line-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

.table-move-line-name {
  margin: 0;
  font-family: "Oswald", Arial, sans-serif;
  font-size: 1rem;
  letter-spacing: 0.24px;
}

.table-move-line-meta {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 800;
  color: #6b553f;
}

.fiscal-emit-mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.36rem;
}

.fiscal-emit-mode-tabs button {
  min-height: 38px;
  padding: 0.25rem 0.45rem;
  font-size: 0.82rem;
}

.fiscal-emit-mode-tabs button.active {
  border-color: #af7a35;
  background: #ffeecf;
  color: #5a3612;
}

.fiscal-emit-panel {
  display: grid;
  gap: 0.35rem;
}

.fiscal-emit-roman-list,
.fiscal-emit-payments-list {
  display: grid;
  gap: 0.34rem;
  max-height: min(34vh, 260px);
  overflow: auto;
}

.fiscal-emit-roman-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid #dfc4a3;
  border-radius: 9px;
  background: #fffefb;
  padding: 0.38rem 0.42rem;
}

.fiscal-emit-roman-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
}

.fiscal-emit-roman-name {
  font-size: 0.84rem;
  font-weight: 800;
  color: #2f2117;
}

.fiscal-emit-roman-amount {
  font-size: 0.82rem;
  font-weight: 900;
  color: #7f1f1f;
}

.fiscal-emit-payment-row {
  border: 1px solid #dfc4a3;
  border-radius: 9px;
  background: #fffefb;
  padding: 0.34rem;
  display: grid;
  gap: 0.3rem;
}

.fiscal-emit-payment-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 150px) auto;
  gap: 0.35rem;
  align-items: end;
}

.fiscal-emit-payment-grid label {
  text-transform: none;
  letter-spacing: 0.2px;
  font-size: 0.74rem;
}

.fiscal-emit-payment-grid .danger {
  min-height: 38px;
  padding: 0.24rem 0.5rem;
}

.fiscal-emit-item-row {
  cursor: pointer;
}

.table-badge {
  position: absolute;
  top: -7px;
  left: -6px;
  min-width: 22px;
  min-height: 22px;
  border-radius: 999px;
  background: #2f7a33;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.73rem;
  font-weight: 900;
  border: 2px solid #fff;
}

.table-meta-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.55rem;
  margin-bottom: 0.55rem;
}

.table-status-box {
  display: grid;
  align-content: start;
  gap: 0.32rem;
}

.table-status-pill {
  min-height: 40px;
  min-width: 110px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Oswald", Arial, sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  border: 1px solid #d8c2a7;
  background: #fef8ef;
}

.table-status-pill.open {
  border-color: #7ba576;
  color: #255f2a;
  background: #eef8ed;
}

.table-status-pill.conto {
  border-color: #d39f45;
  color: #8b5f15;
  background: #fff5e3;
}

.table-status-pill.closed {
  border-color: #b8b8b8;
  color: #5a5a5a;
  background: #f0f0f0;
}

.table-status-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
}

.table-status-actions button {
  min-height: 34px;
  font-size: 0.82rem;
  padding: 0.2rem 0.45rem;
}

.order-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0.45rem 0 0;
  padding: 0.3rem 0.08rem 0.08rem;
  border-top: 1px dashed #e3cfb4;
  background: var(--paper);
  position: relative;
  z-index: 2;
}

.menu-order-actions {
  margin: 0 0 0.35rem;
  padding: 0 0.08rem 0.3rem;
  border-top: 0;
  border-bottom: 1px dashed #e3cfb4;
}

.order-workspace {
  display: block;
}

.turns-panel {
  display: none;
}

.order-list {
  display: grid;
  gap: 0.58rem;
  touch-action: pan-y;
}

.turn-section {
  border: 1px solid #e5cdae;
  border-radius: 10px;
  background: #fffdf9;
  padding: 0.35rem;
  display: grid;
  gap: 0.35rem;
}

.turn-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.42rem;
}

.turn-collapse-btn {
  min-height: 30px;
  min-width: 34px;
  padding: 0 0.45rem;
  border-radius: 8px;
  border: 1px solid #d4b98f;
  background: #fff8ed;
  color: #5b432d;
  font-size: 1rem;
  font-weight: 900;
}

.turn-collapsed-summary {
  font-size: 0.8rem;
  font-weight: 800;
  color: #60472e;
  padding: 0.1rem 0.16rem 0.2rem;
}

.turn-section.active {
  border-color: var(--accent-dark);
  box-shadow: 0 0 0 1px rgba(186, 43, 43, 0.08);
}

.turn-section.sent-turn {
  border-color: #d7be65;
  background: #fff7d2;
  box-shadow: 0 0 0 1px rgba(210, 181, 76, 0.18);
}

.turn-section.drag-over {
  border-color: #2f7a33;
  box-shadow: 0 0 0 2px rgba(47, 122, 51, 0.15);
  background: #f5fcf4;
}

.turn-section-btn {
  min-height: 34px;
  border-radius: 999px;
  border: 1px solid #cfb08c;
  background: #fff8ef;
  color: #553d27;
  font-family: "Oswald", Arial, sans-serif;
  font-size: 0.94rem;
  letter-spacing: 0.28px;
  padding: 0.12rem 0.72rem;
  justify-self: start;
}

.turn-section-btn.move-target {
  border-color: #5c8f55;
  background: #f3fbf0;
  color: #2f5f2f;
}

.turn-section-btn.move-source {
  border-color: #2f5f2f;
  background: #2f5f2f;
  color: #fff;
}

.turn-section.active .turn-section-btn {
  background: var(--accent);
  border-color: var(--accent-dark);
  color: #fff;
}

.turn-section.sent-turn .turn-section-btn {
  border-color: #c8a93e;
  background: #f6df88;
  color: #4c3b04;
}

.turn-section.sent-turn .turn-collapse-btn {
  border-color: #c8a93e;
  background: #f6df88;
  color: #4c3b04;
}

.turn-section.sent-turn.active .turn-section-btn {
  border-color: #c8a93e;
  background: #f6df88;
  color: #4c3b04;
}

.turn-section.active .turn-section-btn.move-target {
  border-color: #5c8f55;
  background: #f3fbf0;
  color: #2f5f2f;
}

.turn-section.active .turn-section-btn.move-source {
  border-color: #2f5f2f;
  background: #2f5f2f;
  color: #fff;
}

.turn-section-lines {
  display: grid;
  gap: 0.42rem;
  min-height: 2.1rem;
}

.turn-drop-empty {
  min-height: 2.1rem;
}

.order-totals-box {
  border: 1px solid #dcbf98;
  border-radius: 10px;
  background: #fff8ed;
  padding: 0.5rem 0.58rem;
  margin-bottom: 0.62rem;
  display: grid;
  gap: 0.24rem;
}

.order-total-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

.order-total-head strong {
  font-family: "Oswald", Arial, sans-serif;
  font-size: 1.02rem;
  letter-spacing: 0.45px;
}

.order-total-value {
  color: #7f1f1f;
  font-weight: 900;
  font-size: 1.02rem;
}

.order-total-lines {
  display: grid;
  gap: 0.1rem;
}

.order-total-line {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #53412f;
}

.order-total-line span:last-child {
  font-weight: 900;
  color: #2f2419;
}

.order-empty {
  border: 1px dashed #ceb391;
  border-radius: 10px;
  padding: 1rem 0.8rem;
  text-align: center;
  font-weight: 700;
  color: #6f573f;
  background: #fffaf2;
}

.order-block {
  border: 1px solid #e6d2b7;
  border-radius: 10px;
  background: #fffefb;
  padding: 0.45rem;
  display: grid;
  gap: 0.36rem;
  touch-action: pan-y;
  user-select: none;
  transition: transform 0.16s ease, background-color 0.16s ease;
}

.order-block.draggable {
  cursor: grab;
}

.order-block.draggable:active {
  cursor: grabbing;
}

.order-block.sent {
  opacity: 0.9;
  background: #f9f8f5;
}

.order-block.cancelled {
  opacity: 0.92;
  border-color: #e2b2b2;
  background: #fff7f7;
}

.order-block.cancelled .line-top {
  position: relative;
  padding-top: 0.22rem;
}

.order-block.cancelled .line-top::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 999px;
  background: #c82626;
}

.order-block.cancelled .line-name {
  color: #7b2222;
}

.order-block.dragging {
  opacity: 0.42;
  border-style: dashed;
}

.order-block.dragging-turn {
  z-index: 2;
  box-shadow: 0 8px 18px rgba(60, 45, 30, 0.22);
  border-color: #84ad7f;
  background: #fbfff9;
}

.order-block.swiping {
  background: #fff7ea;
}

.order-block.move-selected {
  border-color: #5c8f55;
  background: #f4fbf3;
  box-shadow: 0 0 0 2px rgba(92, 143, 85, 0.16);
}

.line-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

.line-name {
  margin: 0;
  font-family: "Oswald", Arial, sans-serif;
  font-size: var(--layout-order-items-font-size, 17px);
  letter-spacing: 0.3px;
}

.line-top-right {
  display: grid;
  justify-items: end;
  gap: 0.18rem;
}

.line-qty-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 24px;
  border-radius: 999px;
  border: 1px solid #d9c3a5;
  background: #fff7ee;
  font-size: 0.78rem;
  font-weight: 900;
  color: #4a3724;
}

.line-meta {
  margin: 0;
  font-size: 0.78rem;
  color: #66513e;
  font-weight: 700;
}

.line-gesture-help {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 800;
  color: #7a6147;
}

.line-controls {
  display: grid;
  grid-template-columns: 120px minmax(120px, 1fr);
  gap: 0.44rem;
  align-items: center;
}

.qty-controls {
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  gap: 0.25rem;
  align-items: center;
}

.qty-controls button {
  min-height: 34px;
  padding: 0;
  font-size: 1.05rem;
}

.qty-value {
  text-align: center;
  font-weight: 900;
}

.line-controls .remove-btn {
  min-height: 34px;
}

.line-note {
  width: 100%;
}

.state-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 900;
}

.state-pill.new {
  background: #fff3d7;
  color: #7b4f11;
}

.state-pill.sent {
  background: #e5f3e6;
  color: #1f6a24;
}

.state-pill.cancelled {
  background: #fde3e3;
  color: #9f1717;
}

.history-box {
  border-top: 1px solid #e7d8c4;
  margin-top: 0.72rem;
  padding-top: 0.56rem;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.history-head h3 {
  margin: 0;
  font-family: "Oswald", Arial, sans-serif;
  font-size: 1.15rem;
}

.history-head button {
  min-height: 32px;
  font-size: 0.79rem;
  padding: 0.18rem 0.52rem;
}

.history-list {
  display: grid;
  gap: 0.34rem;
  margin-top: 0.45rem;
  max-height: 240px;
  overflow: auto;
}

.history-empty {
  border: 1px dashed #ceb391;
  border-radius: 9px;
  padding: 0.58rem;
  text-align: center;
  font-size: 0.86rem;
  font-weight: 700;
  color: #6f573f;
}

.history-item {
  border: 1px solid #ead6bf;
  border-radius: 9px;
  background: #fffdf8;
  padding: 0.4rem 0.48rem;
  display: grid;
  gap: 0.12rem;
}

.history-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

.history-text {
  font-size: 0.84rem;
  font-weight: 700;
}

.history-printer-row {
  margin-top: 0.22rem;
}

.history-time {
  font-size: 0.72rem;
  color: #685340;
  font-weight: 700;
}

.history-del {
  min-height: 28px;
  min-width: 28px;
  width: 28px;
  padding: 0;
  border-radius: 8px;
  border-color: #d7aaaa;
  background: #fff3f3;
}

.sync-printer-badges,
.history-printer-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.24rem;
  align-items: center;
}

.sync-printer-badges {
  margin-left: auto;
}

.printer-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.1rem 0.42rem;
  border-radius: 999px;
  border: 1px solid #b7aa95;
  background: #f5ede2;
  color: #4a3320;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.25px;
  line-height: 1.2;
}

.printer-badge.tone-0 {
  border-color: #ceb28b;
  background: #f9efdf;
  color: #6b4721;
}

.printer-badge.tone-1 {
  border-color: #c9b0d4;
  background: #f3ecf8;
  color: #5a3c69;
}

.printer-badge.tone-2 {
  border-color: #a5c9d2;
  background: #eaf6f9;
  color: #1f5969;
}

.printer-badge.tone-3 {
  border-color: #b9cfa2;
  background: #eef7e4;
  color: #3e6224;
}

.printer-badge.tone-4 {
  border-color: #d6ba93;
  background: #fff2df;
  color: #6f4c22;
}

.printer-badge.tone-5 {
  border-color: #c7bcc7;
  background: #f4f1f5;
  color: #5a4e5a;
}

.printer-badge.tone-6 {
  border-color: #d5b1ae;
  background: #fdf0ef;
  color: #7b3232;
}

.printer-badge.tone-7 {
  border-color: #adc1da;
  background: #edf3fc;
  color: #2f4f79;
}

.search-wrap {
  margin-bottom: 0.42rem;
}

.menu-browser {
  display: grid;
  grid-template-columns: minmax(96px, var(--menu-groups-width, 178px)) minmax(0, 1fr);
  gap: 0.56rem;
  align-items: start;
}

.menu-items-pane {
  min-width: 0;
}

.dish-suggestions {
  display: none;
  border: 1px solid #d8c1a2;
  border-radius: 10px;
  background: #fffef9;
  padding: 0.25rem;
  max-height: 210px;
  overflow: auto;
  touch-action: pan-y;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.dish-suggestions.open {
  display: grid;
  gap: 0.25rem;
}

.suggestion-btn {
  min-height: 38px;
  text-align: left;
  border-radius: 8px;
  border: 1px solid #ead8c0;
  background: #fff;
}

.section-tabs {
  display: grid;
  gap: 0.3rem;
  margin: 0;
  align-content: start;
  max-height: 72vh;
  overflow: auto;
  padding-right: 0.1rem;
}

@media (min-width: 761px) {
  body.table-mode-active {
    height: 100dvh;
    overflow: hidden;
  }

  .app-shell.table-mode {
    height: 100dvh;
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .app-shell.table-mode .layout.screen-table {
    flex: 1 1 auto;
    min-height: 0;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 55%) minmax(0, 45%);
    overflow: hidden;
  }

  .app-shell.table-mode .order-panel,
  .app-shell.table-mode .menu-panel {
    min-height: 0;
    overflow: hidden;
  }

  .app-shell.table-mode .order-panel {
    display: flex;
    flex-direction: column;
  }

  .app-shell.table-mode .order-workspace {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  .app-shell.table-mode .order-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-right: 0.12rem;
  }

  .app-shell.table-mode .menu-order-actions {
    flex: 0 0 auto;
    margin: 0 0 0.35rem;
  }

  .app-shell.table-mode .menu-panel {
    display: flex;
    flex-direction: column;
  }

  .app-shell.table-mode .menu-browser {
    flex: 1 1 auto;
    min-height: 0;
    align-items: stretch;
    overflow: hidden;
  }

  .app-shell.table-mode .section-tabs {
    max-height: none;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .app-shell.table-mode .menu-items-pane {
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-right: 0;
    scrollbar-width: thin;
  }
}

.section-tab {
  min-height: 40px;
  border: 1px solid var(--group-tab-border);
  color: var(--group-tab-text);
  background: var(--group-tab-bg);
  border-radius: 10px;
  padding: 0.26rem 0.6rem;
  font-size: var(--layout-groups-font-size, 14px);
  text-align: left;
  width: 100%;
  text-transform: uppercase;
  letter-spacing: 0.35px;
}

.section-tab.active {
  border-color: var(--group-tab-active-border);
  color: var(--group-tab-active-text);
  background: var(--group-tab-active-bg);
}

.dish-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.42rem;
}

.dish-btn {
  min-height: 58px;
  text-align: left;
  border-radius: 10px;
  display: grid;
  gap: 0.04rem;
  align-content: center;
  padding: 0.34rem 0.56rem;
  font-size: var(--layout-menu-items-font-size, 15px);
}

.dish-btn strong {
  font-size: 1em;
  line-height: 1.12;
}

.dish-btn .dish-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.dish-stock {
  display: inline-block;
  min-width: 2ch;
  padding: 0.08rem 0.34rem;
  border: 1px solid #cfb08c;
  border-radius: 999px;
  font-style: normal;
  font-size: 0.75rem;
  line-height: 1;
  color: #5c432c;
  background: #fff7ea;
}

.dish-stock.zero {
  color: #8b4f00;
  border-color: #d4a458;
  background: #fff3de;
}

.dish-stock.neg {
  color: #a00000;
  border-color: #d78d8d;
  background: #fff1f1;
}

.dish-btn span {
  font-size: 0.75em;
  color: #6f5941;
  font-weight: 700;
}

.menu-empty {
  border: 1px dashed #cfb99c;
  border-radius: 10px;
  padding: 0.8rem;
  text-align: center;
  font-weight: 700;
  color: #6e5539;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: rgba(10, 8, 7, 0.45);
  padding: 1rem;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(460px, 100%);
  max-height: min(90vh, 820px);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fffdf8;
  padding: 0.8rem;
  display: grid;
  gap: 0.55rem;
  overflow: auto;
}

.modal-card-compact {
  width: min(360px, 100%);
}

.quick-input-card {
  width: min(340px, calc(100vw - 2rem));
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(10, 5, 2, 0.28);
}

.quick-input-card h3 {
  font-size: 1.1rem;
  letter-spacing: 0.04em;
}

.quick-input-card input {
  width: 100%;
  min-height: 46px;
  font-size: 1rem;
}

.auth-modal-card {
  width: min(430px, 100%);
}

.auth-login-modal {
  background:
    radial-gradient(circle at 15% 10%, rgba(213, 47, 47, 0.12) 0%, rgba(213, 47, 47, 0) 40%),
    radial-gradient(circle at 85% 90%, rgba(180, 30, 30, 0.09) 0%, rgba(180, 30, 30, 0) 45%),
    linear-gradient(135deg, #1a0a06 0%, #2c1208 100%);
}

.auth-login-modal .auth-modal-card {
  width: min(480px, calc(100vw - 1.3rem));
  border-radius: 20px;
  border: 1px solid rgba(220, 180, 150, 0.2);
  background: #fffdf8;
  box-shadow: 0 32px 64px rgba(10, 4, 2, 0.55);
  padding: 0;
  gap: 0;
  overflow: hidden;
}

.auth-login-hero {
  display: grid;
  grid-template-columns: minmax(72px, 88px) minmax(0, 1fr);
  gap: 0.9rem;
  align-items: center;
  padding: 1.4rem 1.3rem 1.2rem;
  background: linear-gradient(135deg, #c42020 0%, #7e1212 100%);
}

.auth-login-logo {
  width: 100%;
  max-width: 88px;
  height: auto;
  object-fit: contain;
  filter: brightness(0) invert(1) drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
}

.auth-login-brand h3 {
  margin: 0;
  font-family: "Oswald", Arial, sans-serif;
  font-size: 1.45rem;
  letter-spacing: 0.04em;
  color: #ffffff;
  text-transform: uppercase;
}

.auth-login-subtitle {
  margin: 0.3rem 0 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(255, 220, 200, 0.85);
  line-height: 1.35;
}

#authModalHint {
  margin: 0;
  padding: 0.55rem 1.3rem;
  background: #fff4ec;
  border-bottom: 1px solid #f0dece;
  font-size: 0.78rem;
  font-weight: 700;
  color: #6b4530;
  text-align: center;
}

.auth-login-view {
  border: none;
  border-radius: 0;
  background: #fffdf8;
  padding: 1.1rem 1.3rem 1.4rem;
  display: grid;
  gap: 0.65rem;
}

.auth-login-view label {
  font-weight: 800;
  font-size: 0.72rem;
  color: #5a3b28;
  gap: 0.26rem;
}

.auth-login-view input,
.auth-login-view select {
  margin-top: 0;
  border: 1.5px solid #d8bfa4;
  background: #fff9f3;
  border-radius: 10px;
  min-height: 48px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-login-view input:focus,
.auth-login-view select:focus {
  border-color: #ba2b2b;
  box-shadow: 0 0 0 3px rgba(186, 43, 43, 0.14);
  outline: none;
}

.auth-login-view .modal-actions {
  margin-top: 0.2rem;
}

.auth-login-view .primary {
  min-height: 50px;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #d52f2f 0%, #9e1c1c 100%);
  border: none;
  box-shadow: 0 4px 16px rgba(186, 43, 43, 0.38);
  transition: filter 0.15s, transform 0.1s;
}

.auth-login-view .primary:active {
  filter: brightness(0.9);
  transform: scale(0.98);
}

@media (hover: hover) {
  .auth-login-view .primary:hover {
    filter: brightness(1.07);
  }
}

@media (max-width: 520px) {
  .auth-login-hero {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 0.5rem;
    padding: 1.2rem 1rem 1rem;
  }

  .auth-login-logo {
    max-width: 72px;
  }

  .auth-login-brand h3 {
    font-size: 1.35rem;
  }
}

.modal-card h3 {
  margin: 0;
  font-family: "Oswald", Arial, sans-serif;
  font-size: 1.28rem;
  letter-spacing: 0.4px;
}

.modal.summary-fullscreen {
  padding: 0;
  place-items: stretch;
  background: #f4eee3;
}

.modal.summary-fullscreen .modal-card {
  width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  border-radius: 0;
  border: none;
  padding: 0.68rem;
  background: #f4eee3;
  overflow: hidden;
}

.modal.summary-fullscreen #printerModalCard > h3 {
  display: none;
}

.modal.summary-fullscreen #settingsSummaryView {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}

.modal.summary-fullscreen #settingsSummaryView .settings-section {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.modal.summary-fullscreen #settingsSummaryList {
  min-height: 0;
  max-height: none;
  overflow: auto;
}

body.menu-standalone-open {
  overflow: hidden;
}

.menu-standalone {
  position: fixed;
  inset: 0;
  z-index: 10020;
  background: #f4eee3;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 0.6rem;
  gap: 0.5rem;
}

.menu-standalone.hidden {
  display: none;
}

.menu-standalone-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.menu-standalone-head h3 {
  margin: 0;
  font-family: "Oswald", Arial, sans-serif;
  font-size: 1.22rem;
  letter-spacing: 0.35px;
  color: #2d1f15;
}

.menu-standalone-frame {
  width: 100%;
  height: 100%;
  border: 1px solid #ccb495;
  border-radius: 12px;
  background: #fff;
}

.table-action-hint {
  margin: 0;
  min-height: 1.2rem;
  font-size: 0.84rem;
  font-weight: 800;
  color: #5f4935;
}

.table-action-hint.warn {
  color: #9b5b08;
}

.table-action-hint.err {
  color: #b12626;
}

.table-action-hint.ok {
  color: #256a2f;
}

.table-action-totals {
  border: 1px solid #ddc1a0;
  border-radius: 10px;
  background: #fff8ef;
  padding: 0.45rem 0.55rem;
  display: grid;
  gap: 0.22rem;
}

.table-action-totals-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 900;
  color: #5f4935;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.table-action-totals-head strong {
  font-size: 1.02rem;
  color: #7f1f1f;
}

.table-action-totals-meta {
  font-size: 0.8rem;
  font-weight: 800;
  color: #5f4935;
}

.table-rename-row {
  display: grid;
  gap: 0.24rem;
  font-size: 0.84rem;
  font-weight: 800;
  color: #5f4935;
}

.printer-config-info {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: #5f4935;
}

.printer-pickers {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.4rem;
  align-items: end;
}

.printer-pickers button {
  min-height: 42px;
}

.printer-picker-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(90px, 1fr));
  gap: 0.4rem;
}

.settings-printer-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.settings-printer-tab {
  min-height: 40px;
  font-family: "Oswald", Arial, sans-serif;
  font-size: 0.92rem;
  letter-spacing: 0.32px;
}

.settings-printer-tab.active {
  background: #d6af6f;
  color: #3f2815;
  border-color: #b38341;
}

.printer-collapse {
  border: 1px solid #dfc4a4;
  border-radius: 10px;
  background: #fffdf8;
  padding: 0.26rem 0.42rem;
  display: grid;
  gap: 0.4rem;
}

.printer-collapse > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: "Oswald", Arial, sans-serif;
  font-size: 0.92rem;
  letter-spacing: 0.25px;
  color: #3a291a;
  text-transform: uppercase;
  user-select: none;
}

.printer-collapse > summary::-webkit-details-marker {
  display: none;
}

.printer-collapse > summary::after {
  content: "▾";
  font-size: 0.88rem;
  transition: transform 0.18s ease;
}

.printer-collapse[open] > summary::after {
  transform: rotate(180deg);
}

.printer-group-routing-list {
  display: grid;
  gap: 0.34rem;
  max-height: min(30vh, 230px);
  overflow: auto;
}

.settings-section .checkbox-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 42px;
  border: 1px solid #e4c7a4;
  border-radius: 10px;
  background: #fffef8;
  padding: 0.3rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 800;
  color: #5f4935;
}

.settings-section .checkbox-inline input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
}

.printer-style-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
}

.printer-style-hint {
  margin: 0;
  font-size: 0.72rem;
  color: #6d5640;
  font-weight: 700;
}

.layout-width-value {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 800;
  color: #5f4935;
}

.settings-view {
  display: grid;
  gap: 0.5rem;
}

#invoicingGeneratePanel {
  display: grid;
  gap: 0.5rem;
}

.settings-view[hidden] {
  display: none !important;
}

.settings-menu-list {
  display: grid;
  gap: 0.45rem;
}

.settings-menu-btn {
  min-height: 44px;
  justify-content: center;
  font-family: "Oswald", Arial, sans-serif;
  font-size: 1rem;
  letter-spacing: 0.35px;
}

.settings-view-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.settings-view-head h4 {
  margin: 0;
  font-family: "Oswald", Arial, sans-serif;
  font-size: 1.08rem;
  letter-spacing: 0.3px;
}

.settings-section {
  border: 1px solid #e5ceb0;
  border-radius: 10px;
  background: #fff9ef;
  padding: 0.5rem;
  display: grid;
  gap: 0.45rem;
}

.settings-section h4 {
  margin: 0;
  font-family: "Oswald", Arial, sans-serif;
  font-size: 1rem;
  letter-spacing: 0.3px;
}

.settings-fiscal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
}

.settings-fiscal-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

.settings-fiscal-list-head button {
  min-height: 34px;
  padding: 0.16rem 0.54rem;
}

.settings-fiscal-list {
  display: grid;
  gap: 0.34rem;
}

.settings-fiscal-row {
  border: 1px solid #dfc4a3;
  border-radius: 9px;
  background: #fffefb;
  padding: 0.4rem;
  display: grid;
  gap: 0.35rem;
}

.settings-fiscal-row-grid {
  display: grid;
  gap: 0.35rem;
}

.settings-fiscal-row-grid.vat {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 96px;
}

.settings-fiscal-row-grid.department {
  grid-template-columns: 84px minmax(0, 1fr) minmax(0, 1fr);
}

.settings-fiscal-row-grid.payment {
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) 120px;
}

.settings-fiscal-row-grid label {
  font-size: 0.68rem;
}

.settings-fiscal-row-tools {
  display: flex;
  justify-content: flex-end;
  gap: 0.35rem;
}

.settings-fiscal-row-tools button {
  min-height: 32px;
  min-width: 96px;
  padding: 0.16rem 0.44rem;
}

.settings-fiscal-coverage-list {
  display: grid;
  gap: 0.35rem;
  max-height: min(34vh, 290px);
  overflow: auto;
}

.settings-fiscal-coverage-row {
  border: 1px solid #dfc4a3;
  border-radius: 9px;
  background: #fffefb;
  padding: 0.34rem 0.42rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(128px, 168px);
  gap: 0.45rem;
  align-items: center;
}

.settings-fiscal-coverage-main {
  min-width: 0;
  display: grid;
  gap: 0.08rem;
}

.settings-fiscal-coverage-title {
  font-size: 0.86rem;
  font-weight: 900;
  color: #2f2117;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-fiscal-coverage-meta {
  font-size: 0.74rem;
  font-weight: 800;
  color: #6f5a46;
}

.settings-fiscal-doc-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  min-width: 66px;
  padding: 0 0.42rem;
  border-radius: 999px;
  border: 1px solid #cfb08c;
  background: #fff7ea;
  color: #5c432c;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}

.settings-fiscal-doc-status.sent {
  border-color: #9ec3a4;
  background: #eefaf0;
  color: #235e2f;
}

.settings-fiscal-doc-status.error {
  border-color: #d78d8d;
  background: #fff1f1;
  color: #a00000;
}

.settings-tables-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.4rem;
}

.invoice-customer-suggestions {
  display: grid;
  gap: 0.28rem;
  margin-top: 0.2rem;
  max-height: min(26vh, 220px);
  overflow: auto;
  padding: 0.3rem;
  border: 1px solid #d8c1a2;
  border-radius: 10px;
  background: #fffef9;
}

.invoice-customer-suggestions[hidden] {
  display: none;
}

.invoice-customer-suggestion-btn {
  min-height: 40px;
  width: 100%;
  display: grid;
  gap: 0.08rem;
  text-align: left;
  justify-items: start;
  border-radius: 8px;
  border: 1px solid #e7d4bc;
  background: #fff;
  padding: 0.34rem 0.5rem;
}

.invoice-customer-suggestion-name {
  font-size: 0.83rem;
  font-weight: 900;
  color: #332315;
}

.invoice-customer-suggestion-meta {
  font-size: 0.71rem;
  font-weight: 700;
  color: #6b543d;
}

.settings-rooms-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.4rem;
}

.settings-room-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.4rem;
  align-items: end;
}

.settings-room-picker button {
  min-height: 42px;
}

.settings-tables-list {
  display: grid;
  gap: 0.35rem;
  max-height: min(34vh, 280px);
  overflow: auto;
}

.settings-table-row {
  border: 1px solid #dfc4a3;
  border-radius: 9px;
  background: #fffefb;
  padding: 0.34rem 0.42rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

.settings-table-meta {
  min-width: 0;
  display: grid;
  gap: 0.08rem;
}

.settings-table-name {
  font-size: 0.88rem;
  font-weight: 900;
  color: #2f2117;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-table-id {
  font-size: 0.74rem;
  font-weight: 800;
  color: #6f5a46;
}

.settings-table-delete {
  min-height: 32px;
  min-width: 90px;
  padding: 0.22rem 0.5rem;
}

.settings-table-empty {
  border: 1px dashed #d1b493;
  border-radius: 9px;
  padding: 0.5rem;
  text-align: center;
  font-size: 0.84rem;
  font-weight: 700;
  color: #6a533d;
  background: #fffdf9;
}

.settings-coperto-groups-list {
  display: grid;
  gap: 0.34rem;
  max-height: min(32vh, 240px);
  overflow: auto;
}

.settings-coperto-group-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid #dfc4a3;
  border-radius: 9px;
  background: #fffefb;
  padding: 0.38rem 0.42rem;
}

.settings-coperto-group-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
}

.settings-coperto-group-name {
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 800;
  color: #2f2117;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-summary-filters {
  display: grid;
  gap: 0.42rem;
}

.settings-summary-range-btn {
  min-height: 40px;
}

.settings-summary-range-label {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 800;
  color: #2f2117;
}

.settings-summary-filter-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
}

.settings-summary-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
}

.settings-summary-mode-switch button {
  min-height: 36px;
}

.settings-summary-mode-switch button.active {
  background: #f4e4d2;
  border-color: #be9263;
  color: #2f2117;
}

.settings-summary-stats {
  border: 1px solid #e2c8a8;
  border-radius: 9px;
  background: #fffefb;
  padding: 0.45rem 0.55rem;
  display: grid;
  gap: 0.2rem;
}

.settings-summary-stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.86rem;
  font-weight: 800;
  color: #3a281b;
}

.settings-summary-stat strong {
  font-family: "Oswald", Arial, sans-serif;
  font-size: 1rem;
  letter-spacing: 0.3px;
  color: #2a1a10;
}

.settings-summary-list {
  display: grid;
  gap: 0.35rem;
  max-height: min(40vh, 340px);
  overflow: auto;
}

.settings-stock-list {
  display: grid;
  gap: 0.35rem;
  max-height: min(40vh, 340px);
  overflow: auto;
}

.settings-stock-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
}

.settings-stock-actions button {
  min-height: 36px;
  background: #fff8ef;
  border-color: #c9a67d;
  color: #513523;
}

.settings-stock-actions button.active {
  background: #ba2b2b;
  border-color: #7f1a1a;
  color: #ffffff;
}

.settings-stock-deleted-wrap {
  display: grid;
  gap: 0.35rem;
}

.settings-summary-stats[hidden],
.settings-stock-list[hidden],
.settings-stock-deleted-wrap[hidden] {
  display: none !important;
}

.settings-stock-deleted-wrap h5 {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 900;
  color: #402d1d;
}

.settings-summary-entry {
  border: 1px solid #dfc4a3;
  border-radius: 9px;
  background: #fffefb;
  padding: 0.4rem 0.46rem;
  display: grid;
  gap: 0.15rem;
}

.settings-summary-entry[data-action="pick-fiscal-customer"] {
  cursor: pointer;
}

.settings-summary-entry.active {
  border-color: #cf7272;
  background: #fff5f5;
  box-shadow: inset 0 0 0 1px rgba(207, 114, 114, 0.24);
}

.settings-summary-entry-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.settings-summary-entry-title {
  font-size: 0.9rem;
  font-weight: 900;
  color: #2f2117;
  line-height: 1.15;
}

.settings-summary-entry-amount {
  font-family: "Oswald", Arial, sans-serif;
  font-size: 1.04rem;
  font-weight: 700;
  color: #214f2d;
  letter-spacing: 0.2px;
}

.settings-summary-entry-meta {
  font-size: 0.76rem;
  font-weight: 800;
  color: #6f5a46;
}

.admin-env-entry {
  gap: 0.32rem;
}

.admin-env-status {
  font-weight: 900;
}

.admin-env-status.active {
  color: #2a6d34;
}

.admin-env-status.blocked {
  color: #a23a3a;
}

.admin-env-status.expired {
  color: #a56b18;
}

.admin-env-status.trial {
  color: #286c8d;
}

.admin-env-tools {
  display: grid;
  gap: 0.36rem;
}

.admin-env-trial-row {
  display: grid;
  gap: 0.2rem;
  font-size: 0.74rem;
  font-weight: 900;
  color: #5b4330;
}

.admin-env-trial-row input {
  min-height: 34px;
}

.admin-env-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
}

.admin-env-actions button {
  min-height: 34px;
}

.settings-doc-entry {
  gap: 0.26rem;
}

.settings-doc-head-left {
  min-width: 0;
  display: grid;
  gap: 0.14rem;
}

.settings-doc-type-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  border-radius: 999px;
  padding: 0 0.42rem;
  border: 1px solid #cfb08c;
  background: #fff7ea;
  color: #5c432c;
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.22px;
}

.settings-doc-type-badge.scontrino {
  border-color: #a5c9d2;
  background: #eaf6f9;
  color: #1f5969;
}

.settings-doc-type-badge.fattura {
  border-color: #b9cfa2;
  background: #eef7e4;
  color: #3e6224;
}

.settings-doc-type-badge.pagato {
  border-color: #d6ba93;
  background: #fff2df;
  color: #6f4c22;
}

.settings-doc-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  border-radius: 999px;
  padding: 0 0.45rem;
  border: 1px solid #cfb08c;
  background: #fff7ea;
  color: #5c432c;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.22px;
}

.settings-doc-status.sent {
  border-color: #9ec3a4;
  background: #eefaf0;
  color: #235e2f;
}

.settings-doc-status.error {
  border-color: #d78d8d;
  background: #fff1f1;
  color: #a00000;
}

.settings-doc-status.queued {
  border-color: #d4a458;
  background: #fff3de;
  color: #8b4f00;
}

.settings-doc-status.paid {
  border-color: #d6ba93;
  background: #fff2df;
  color: #6f4c22;
}

.settings-document-detail-body {
  margin: 0;
  border: 1px solid #dfc4a3;
  border-radius: 10px;
  background: #fffefb;
  padding: 0.5rem 0.56rem;
  max-height: min(62vh, 520px);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.76rem;
  font-weight: 700;
  color: #3f2c1c;
}

.settings-stock-entry {
  gap: 0.22rem;
}

.settings-stock-deleted-entry {
  border-style: dashed;
  background: #fff8ef;
}

.settings-stock-deleted-qty {
  font-family: "Oswald", Arial, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: #8a2d2d;
}

.settings-stock-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.76rem;
  font-weight: 800;
  color: #5f4935;
}

.settings-stock-remaining {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 26px;
  border-radius: 999px;
  border: 1px solid #cfb08c;
  background: #fff7ea;
  color: #5c432c;
  font-family: "Oswald", Arial, sans-serif;
  font-size: 0.96rem;
  letter-spacing: 0.2px;
}

.settings-stock-remaining.pos {
  color: #235e2f;
  border-color: #9ec3a4;
  background: #eefaf0;
}

.settings-stock-remaining.zero {
  color: #8b4f00;
  border-color: #d4a458;
  background: #fff3de;
}

.settings-stock-remaining.neg {
  color: #a00000;
  border-color: #d78d8d;
  background: #fff1f1;
}

.settings-summary-sold-group .settings-summary-entry-amount {
  color: #8a5a20;
}

.settings-summary-pie-card {
  gap: 0.35rem;
}

.settings-summary-pie-wrap {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.55rem;
  align-items: center;
}

.settings-summary-pie {
  --summary-pie: #d6bc9d 0% 100%;
  width: 118px;
  height: 118px;
  border-radius: 999px;
  border: 1px solid #d4b797;
  background: conic-gradient(var(--summary-pie));
  position: relative;
  display: grid;
  place-items: center;
  margin-inline: auto;
}

.settings-summary-pie::after {
  content: "";
  width: 44%;
  height: 44%;
  border-radius: 50%;
  background: #fffefb;
  border: 1px solid #e3caad;
}

.settings-summary-pie-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  z-index: 1;
  pointer-events: none;
}

.settings-summary-pie-center strong {
  font-family: "Oswald", Arial, sans-serif;
  font-size: 1.05rem;
  color: #2f2117;
  line-height: 1;
}

.settings-summary-pie-center span {
  margin-top: 0.06rem;
  font-size: 0.67rem;
  font-weight: 800;
  color: #6f5a46;
  text-transform: uppercase;
}

.settings-summary-pie-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.22rem;
}

.settings-summary-pie-legend li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.34rem;
}

.settings-summary-pie-dot {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 50%;
  border: 1px solid rgba(47, 33, 23, 0.22);
  background: var(--pie-color, #8d6b4c);
}

.settings-summary-pie-group {
  font-size: 0.77rem;
  font-weight: 800;
  color: #2f2117;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-summary-pie-values {
  font-family: "Oswald", Arial, sans-serif;
  font-size: 0.86rem;
  color: #67441f;
  letter-spacing: 0.2px;
}

.settings-sold-items {
  display: grid;
  gap: 0.18rem;
}

.settings-sold-item-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.45rem;
  border-top: 1px dashed #ead4b7;
  padding-top: 0.16rem;
}

.settings-sold-item-name {
  font-size: 0.83rem;
  font-weight: 800;
  color: #2f2117;
}

.settings-sold-item-qty {
  font-family: "Oswald", Arial, sans-serif;
  font-size: 0.98rem;
  letter-spacing: 0.2px;
  color: #684723;
}

.summary-range-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.4rem;
}

.summary-range-head strong {
  text-align: center;
  text-transform: capitalize;
  font-size: 0.95rem;
  color: #2f2117;
}

.summary-range-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.18rem;
  margin-top: 0.42rem;
}

.summary-range-weekdays span {
  text-align: center;
  font-size: 0.74rem;
  font-weight: 800;
  color: #6f5a46;
}

.summary-range-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.18rem;
}

.summary-range-day {
  min-height: 34px;
  border-radius: 9px;
  padding: 0.15rem 0.1rem;
  font-size: 0.83rem;
  font-weight: 800;
}

.summary-range-day.outside {
  opacity: 0.48;
}

.summary-range-day.today {
  border-color: #b46a1f;
}

.summary-range-day.in-range {
  background: #f9e8d2;
  border-color: #d8b58a;
}

.summary-range-day.range-start,
.summary-range-day.range-end {
  background: #f1d9bb;
  border-color: #b97b43;
  color: #2a1a10;
}

.summary-range-draft-label {
  margin: 0.2rem 0 0;
  text-align: center;
  font-size: 0.83rem;
  font-weight: 800;
  color: #3b291b;
}

.modal-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

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

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

.print-area {
  display: none;
}

.print-area.active {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 140;
  background: rgba(243, 238, 229, 0.98);
  overflow: auto;
  padding: 0.8rem 0.7rem 1.3rem;
}

.print-preview-close {
  position: sticky;
  top: 0.25rem;
  z-index: 1;
  margin: 0 0 0.5rem auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0.28rem 0.82rem;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #fffaf0;
  color: var(--ink);
  font-family: "Nunito", Arial, sans-serif;
  font-weight: 800;
  letter-spacing: 0.03em;
  cursor: pointer;
}

.ticket {
  width: var(--ticket-width);
  margin: 0 auto;
  color: #000;
  font-family: "Oswald", "Arial Narrow", Arial, sans-serif;
  letter-spacing: 0.2px;
  --print-width-scale: 1;
  --print-scale-title: 1;
  --print-scale-mode: 1;
  --print-scale-room-table: 1;
  --print-scale-turn: 1;
  --print-scale-item: 1;
  --print-scale-note: 1;
  --print-scale-datetime: 1;
}

.ticket h1,
.ticket h2,
.ticket p {
  margin: 0;
}

.ticket h1 {
  font-size: calc(24px * var(--print-width-scale) * var(--print-scale-title));
  text-align: center;
  letter-spacing: 0.75px;
}

.ticket h2 {
  margin-top: 4px;
  font-size: 13px;
  text-align: center;
}

.ticket .meta {
  margin-top: 5px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.ticket .mode {
  font-size: calc(13px * var(--print-width-scale) * var(--print-scale-mode));
  letter-spacing: 0.3px;
}

.ticket .mode.attention {
  font-size: calc(32px * var(--print-width-scale) * var(--print-scale-mode));
  font-weight: 900;
  letter-spacing: 0.8px;
  line-height: 1.05;
  margin-top: 2px;
}

.ticket .meta-room-table {
  font-size: calc(18px * var(--print-width-scale) * var(--print-scale-room-table));
  font-weight: 900;
  letter-spacing: 0.35px;
  margin-top: 3px;
}

.ticket .meta-datetime {
  font-size: calc(13px * var(--print-width-scale) * var(--print-scale-datetime));
  font-weight: 800;
  margin-top: 4px;
}

.ticket .ticket-spacer.top-gap {
  height: 2.1rem;
}

.ticket .ticket-spacer.bottom-gap {
  height: 1.1rem;
}

.ticket ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ticket .turn-ticket-block + .turn-ticket-block {
  margin-top: 10px;
  border-top: 1px dashed #000;
  padding-top: 8px;
}

.ticket .turn-ticket-title {
  margin: 0 0 6px;
  font-size: calc(19px * var(--print-width-scale) * var(--print-scale-turn));
  font-weight: 900;
  letter-spacing: 0.32px;
  text-align: left;
}

.ticket li {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 7px;
  font-size: calc(18px * var(--print-width-scale) * var(--print-scale-item));
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 6px;
}

.ticket .qty {
  min-width: 32px;
  text-align: right;
}

.ticket .note {
  grid-column: 1 / -1;
  font-size: calc(13px * var(--print-width-scale) * var(--print-scale-note));
  font-weight: 700;
  font-style: italic;
}

.ticket .preconto-list li {
  grid-template-columns: 34px 1fr auto;
}

.ticket .preconto-list .amount {
  text-align: right;
  white-space: nowrap;
}

.ticket .invoice-courtesy-list li {
  grid-template-columns: 34px 1fr 44px auto;
}

.ticket .invoice-courtesy-list span:nth-child(3) {
  text-align: center;
}

.ticket .invoice-courtesy-list .amount {
  text-align: right;
  white-space: nowrap;
}

.ticket .preconto-total {
  font-size: calc(24px * var(--print-width-scale) * var(--print-scale-room-table));
  font-weight: 900;
}

.ticket .ticket-spacer.preconto-total-gap {
  height: 0.9rem;
}

.ticket .footer {
  text-align: center;
  font-size: 13px;
  margin-top: 5px;
}

.ticket.w58 {
  --print-width-scale: 0.78;
}

.ticket.w58 .ticket-spacer.top-gap {
  height: 1.6rem;
}

.ticket.w58 .ticket-spacer.bottom-gap {
  height: 0.9rem;
}

.ticket.w58 li {
  grid-template-columns: 28px 1fr;
}

.ticket.w58 .preconto-list li {
  grid-template-columns: 28px 1fr auto;
}

.ticket.w58 .invoice-courtesy-list li {
  grid-template-columns: 28px 1fr 34px auto;
}

.ticket.w58 .ticket-spacer.preconto-total-gap {
  height: 0.7rem;
}

@media (max-width: 1150px) {
  .layout.screen-table {
    grid-template-columns: 1fr;
  }

  .tables-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

@media (max-width: 760px) {
  body.table-mode-active {
    height: 100dvh;
    overflow: hidden;
  }

  .app-shell {
    padding: 0.6rem;
  }

  .app-shell.table-mode {
    height: 100dvh;
    padding: 0.45rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .app-shell.table-mode .layout.screen-table {
    flex: 1 1 auto;
    min-height: 0;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 55%) minmax(0, 45%);
    overflow: hidden;
  }

  .app-shell.table-mode .order-panel,
  .app-shell.table-mode .menu-panel {
    min-height: 0;
    overflow: hidden;
  }

  .app-shell.table-mode .order-panel {
    display: flex;
    flex-direction: column;
  }

  .app-shell.table-mode .order-workspace {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  .app-shell.table-mode .order-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-right: 0.08rem;
  }

  .app-shell.table-mode .menu-order-actions {
    flex: 0 0 auto;
    margin: 0 0 0.35rem;
  }

  .app-shell.table-mode .menu-panel {
    display: flex;
    flex-direction: column;
  }

  .app-shell.table-mode .menu-browser {
    flex: 1 1 auto;
    min-height: 0;
    align-items: stretch;
    overflow: hidden;
  }

  .app-shell.table-mode .section-tabs,
  .app-shell.table-mode .menu-items-pane {
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .topbar-actions {
    grid-column: 1 / -1;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }

  .topbar-actions .sync-status {
    justify-self: stretch;
    max-width: none;
    justify-content: center;
    text-align: center;
  }

  .table-meta-grid {
    grid-template-columns: 1fr;
  }

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

  .turn-section-btn {
    min-height: 32px;
    font-size: 0.9rem;
    padding: 0.1rem 0.6rem;
  }

  .line-controls {
    grid-template-columns: 1fr;
  }

  .dish-grid {
    grid-template-columns: 1fr;
  }

  .menu-browser {
    grid-template-columns: minmax(90px, min(var(--menu-groups-width, 178px), 48vw)) minmax(0, 1fr);
  }

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

  .tables-tools {
    grid-template-columns: 1fr;
  }

  .settings-tables-tools {
    grid-template-columns: 1fr;
  }

  .settings-fiscal-grid {
    grid-template-columns: 1fr;
  }

  .settings-fiscal-row-grid.vat,
  .settings-fiscal-row-grid.department,
  .settings-fiscal-row-grid.payment {
    grid-template-columns: 1fr;
  }

  .settings-fiscal-coverage-row {
    grid-template-columns: 1fr;
  }

  .settings-rooms-tools {
    grid-template-columns: 1fr;
  }

  .settings-room-picker {
    grid-template-columns: 1fr;
  }

  .settings-summary-pie-wrap {
    grid-template-columns: 1fr;
  }

  .fiscal-emit-mode-tabs {
    grid-template-columns: 1fr;
  }

  .fiscal-emit-payment-grid {
    grid-template-columns: 1fr;
  }

  .printer-pickers {
    grid-template-columns: 1fr;
  }

  .printer-style-grid {
    grid-template-columns: 1fr;
  }

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

  .menu-standalone {
    padding: 0.35rem;
    gap: 0.35rem;
  }

  .menu-standalone-head h3 {
    font-size: 1.08rem;
  }

  .menu-standalone-frame {
    border-radius: 8px;
  }
}

/* ============================
   BANCO SCREEN
   ============================ */

.banco-screen {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0; /* mobile: occupa tutto */
  z-index: 1200;
  background: #f5f5f5;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Desktop: lascia spazio alla sidebar sinistra */
@media (min-width: 762px) {
  .banco-screen {
    left: 88px;
  }
}

.banco-screen.hidden {
  display: none;
}

.banco-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Colonna sinistra: sezioni + prodotti */
.banco-left {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
}

.banco-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid #e8e0d6;
  background: #fff;
  flex-shrink: 0;
}

.banco-back-btn {
  width: 34px;
  height: 34px;
  border: none;
  background: none;
  font-size: 1rem;
  color: #666;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.13s;
}
.banco-back-btn:hover { background: #f0f0f0; }

.banco-title {
  font-size: 1.2rem;
  font-weight: 800;
  margin: 0;
  color: var(--ink);
  font-family: "Bebas Neue", "Oswald", sans-serif;
  letter-spacing: 0.08em;
}

/* Tab sezioni */
.banco-section-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid #e8e0d6;
  background: #fafafa;
  flex-shrink: 0;
}

.banco-section-tab {
  padding: 0.35rem 0.85rem;
  border: 1px solid #ddd;
  border-radius: 20px;
  background: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  color: #444;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}
.banco-section-tab:hover { background: #f0f0f0; }
.banco-section-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Griglia prodotti */
.banco-dish-grid {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.5rem;
  align-content: start;
}

.banco-dish-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  padding: 0.65rem 0.75rem;
  background: #fff;
  border: 1px solid #e0d8cc;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, box-shadow 0.12s;
  min-height: 64px;
}
.banco-dish-btn:hover {
  background: #fff8f0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.banco-dish-btn:active {
  background: #ffeedd;
  transform: scale(0.97);
}

.banco-dish-price {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 700;
}

/* Colonna destra: ordine */
.banco-right {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #e0d8cc;
  background: #fff;
}

.banco-order-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e8e0d6;
  flex-shrink: 0;
}

.banco-order-title {
  font-weight: 800;
  font-size: 1rem;
  color: var(--ink);
}

.banco-clear-btn {
  font-size: 0.78rem;
  color: #999;
  background: none;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
  cursor: pointer;
}
.banco-clear-btn:hover { color: var(--accent); border-color: var(--accent); }

.banco-order-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.banco-empty {
  color: #bbb;
  font-size: 0.9rem;
  text-align: center;
  padding: 2rem 0;
  margin: 0;
}

.banco-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
  background: #fafafa;
  border: 1px solid #eee;
}

.banco-line-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.banco-line-name {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.banco-line-price {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 700;
}

.banco-line-qty {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.banco-qty-btn {
  width: 26px;
  height: 26px;
  border: 1px solid #ddd;
  border-radius: 50%;
  background: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  transition: background 0.12s;
}
.banco-qty-btn:hover { background: #f0e8e0; }

.banco-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-top: 1px solid #e8e0d6;
  gap: 0.75rem;
  flex-shrink: 0;
}

.banco-total {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--ink);
  font-family: "Bebas Neue", "Oswald", sans-serif;
  letter-spacing: 0.05em;
}

.banco-print-btn {
  flex: 1;
  min-height: 44px;
  font-size: 1rem;
  font-weight: 800;
}

/* Su mobile il banco occupa tutto */
@media (max-width: 600px) {
  .banco-right {
    display: none;
  }
  .banco-left {
    width: 100%;
  }
}

@media print {
  @page {
    margin: 0;
    size: auto;
  }

  html,
  body {
    margin: 0;
    background: #fff;
  }

  .no-print {
    display: none !important;
  }

  .print-area {
    display: block;
    padding: 3mm 0;
  }

  .banco-screen {
    display: none !important;
  }
}
