:root {
/*   --color-whisky: #8b5e04;
  --color-accent4: #e790c8;
  --color-accent3: #c5962b;
  --color-accent2: #c7b683;
 */
  
  --color-whisky: #8b5e04;
  --color-accent1: #efd754;
  --color-accent2: #c7b683;
  --color-accent3: #c5962b;
  /* --color-accent4: #e790c8; */

  --color-error: #6b1d2b;
  --color-toast-succ: #9ACD32;
  --color-toast-err: #FFB6C1;

  --color-white: #ffffff;
  --bg-main: #f3f2f0;
  --bg-medium: #b4b3ac;
  --bg-dark: #31312f;
  --color-black: #000000;

  --bg-whisky: var(--color-whisky);
  --bg-white: var(--color-white);
  --bg-card: var(--bg-white);
  --bg-card2: var(--bg-medium);

  --border-light: var(--bg-medium);
  --border-medium: var(--bg-dark);

  --btn-bg: var(--bg-main);
  --btn-bg-2: var(--color-accent2);
  --btn-bg-3: var(--color-accent3);
  --btn-border: #d1d5db;
  --btn-hover: var(--bg-medium);
  --btn-selected: var(--color-whisky);
  --ui-gap: 6px;

  --text-main: var(--bg-dark);
  --text-muted: var(--bg-medium);

  --tt-text: var(--color-white);
  --tt-bg: var(--bg-dark);
}

/* =========================
 * Basis
 * ========================= */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
}

h1,
h2,
h3 {
  margin-top: 0;
}

h1 {
  font-size: 28px;
  margin-bottom: 8px;
}

h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.card-head h2,
.card-head .hint {
  margin-bottom: 0;
}

.card-head .hint {
  margin-left: auto;
  text-align: right;
  white-space: nowrap;
}

h3 {
  font-size: 18px;
  margin-bottom: 6px;
}

a {
  color: inherit;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.wrap {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 16px 24px;
}

.content {
  padding: 18px;
}

.muted,
.hint {
  color: var(--text-muted);
}

.hint {
  font-size: 14px;
  margin-bottom: 12px;
}

.nowrap {
  white-space: nowrap;
}

/* =========================
 * Topbar / Header
 * ========================= */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 18px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
}

.brandRow {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  z-index: 2;
}

.topbar.sticky {
  position: sticky;
  top: 0;
  z-index: 50;
}

/* =========================
 * Karten
 * ========================= */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.card2 {
  background: var(--bg-card2);
  border: 1px solid var(--border-medium);
  border-radius: 16px;
  padding: 16px 18px;
  margin-top: 12px;
}

.card2 + .card2 {
  margin-top: 12px;
}

/* =========================
 * Buttons
 * ========================= */

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--text-main);
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

button:hover,
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.16);
}

button:disabled,
.btn:disabled,
.btn.ghost {
  opacity: 0.5;
  cursor: not-allowed;
}

button:disabled:hover,
.btn:disabled:hover,
.btn.ghost:hover {
  transform: none;
  box-shadow: none;
}

nav.menu .btn.active,
.btn.active {
  background: var(--btn-selected);
  color: var(--bg-main);
  font-weight: 400;
}

/* Ensure ~2mm spacing between menu buttons (approx. 6px) */
.menu {
  display: flex;
  gap: var(--ui-gap);
  align-items: center;
}

.btn.small {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 8px;
}

.btn.small.active {
  background: var(--btn-selected);
  color: var(--bg-white);
  font-weight: 400;
}


/* =========================
 * Formulare
 * ========================= */

label {
  display: block;
  font-weight: bold;
  margin-bottom: 6px;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px;
  font-size: 15px;
  border: 1px solid var(--btn-border);
  border-radius: 10px;
  background: var(--bg-white);
  color: var(--text-main);
}

input:focus,
select:focus,
textarea:focus,
.inline-input:focus,
.inline-select:focus,
.inline-textarea:focus {
  outline: none;
  border-color: var(--bg-whisky);
  box-shadow: 0 0 0 1px var(--bg-whisky);
}

textarea {
  min-height: 80px;
  resize: vertical;
}

.inline-input,
.inline-textarea,
.inline-select {
  width: 100%;
  padding: 8px;
  font-size: 14px;
}

.inline-textarea {
  min-height: 60px;
}

/* =========================
 * Tabellen
 * ========================= */

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-white);
  font-size: 14px;
}

th {
  text-align: left;
  padding: 10px;
  border-bottom: 2px solid var(--border-medium);
  font-weight: 700;
  color: var(--text-main);
  font-size: 16px;
}

.zahlung-summe-label {
  white-space: nowrap;
  font-weight: 700;
  font-size: 16px;
  font-family: inherit;
  color: var(--text-main);
}

td {
  padding: 10px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}

td.num,
th.num,
.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

tr:hover:not(.selected) td {
  background: transparent;
}

tr.selected td {
  background: var(--btn-selected) !important;
}

/* =========================
 * Layout-Helfer
 * ========================= */

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

/* Two-column cards: form (2/3) + utilities (1/3) */
.cards-2col {
  display: grid;
  grid-template-columns: 5fr 3fr;
  gap: 18px;
  align-items: stretch;
  margin-bottom: 20px;
}

.cards-2col > .card {
  height: 100%;
  margin-bottom: 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.cards-2col > .card h2 {
  margin-bottom: var(--ui-gap);
}

.buttons-grid {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: var(--ui-gap);
  justify-content: start;
  align-content: start;
}

.left-icon {
  display: inline-block;
  margin-right: 8px;
  vertical-align: middle;
}
.id-text { vertical-align: middle; }

/* Buttons that should look like the save button */
.btn-init {
  height: 28px;
  line-height: 28px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg-3);
  font-weight: 400;
  cursor: pointer;
  box-shadow: none;
  color: var(--text-main);
}
.btn-init:hover {
  background: var(--btn-bg-3);
}

.buttons-grid .btn-init {
  width: auto;
  justify-content: center;
}

#flaschenButtonsGrid,
#peopleButtonsGrid {
  grid-template-columns: repeat(2, 1fr);
}
#flaschenButtonsGrid .btn-init,
#peopleButtonsGrid .btn-init {
  width: 100%;
}

#flaschenExportBtn,
#flaschenImportBtn,
#flaschenUpdatePricesBtn,
#flaschenLeer4Btn,
#peopleExportBtn,
#peopleImportBtn,
#peopleSettleAllBtn,
#peopleLeer4Btn,
#journalExportBtn,
#journalSettleAllBtn {
  background: var(--color-accent3);
  color: #fff;
}

.bottles-status-segment.mode-edit-segment {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 176px;
  height: 32px;
  flex: 0 0 auto;
}

.bottles-status-segment.mode-edit-segment .bottles-status-thumb {
  width: calc((100% - 4px) / 2);
}

.bottles-status-segment.mode-edit-segment .btn.small {
  /* slightly flatter appearance than the default small buttons */
  height: 24px;
  line-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
}

.bottles-status-segment:not(.mode-edit-segment) {
  height: 32px;
}

.bottles-status-segment.mode-edit-segment[data-state="edit"] .bottles-status-thumb {
  transform: translateX(0%);
}

.bottles-status-segment.mode-edit-segment[data-state="view"] .bottles-status-thumb {
  transform: translateX(100%);
}

.grid3 {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  gap: 12px;
  justify-content: start;
  align-items: start;
}

.grid3--second {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  gap: 12px;
  justify-content: start;
  align-items: start;
}

.grid3 .card2,
.grid3--second .card2 {
  width: max-content;
}

/* Compact action icons in user list */
.actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.actions {
  flex-wrap: nowrap;
}

/* Force icons to stay on one line and make them smaller */
.actions {
  white-space: nowrap;
}
.action-icon {
  position: relative;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  color: var(--text-main);
}
.action-icon span[aria-hidden] {
  font-size: 14px;
  line-height: 1;
  display: inline-block;
  transform: translateY(-1px);
}
.action-icon:hover {
  background: transparent;
}
.action-icon.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.action-tooltip {
  display: none;
  position: absolute;
  left: 50%;
  right: auto;
  top: auto;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  background: var(--bg-dark); 
  color: var(--tt-text);
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 9999;
  max-width: 240px;
  box-sizing: border-box;
}
.action-icon:hover .action-tooltip {
  display: block;
}

/* On small screens, stack tooltip above the icon instead of sideways */
@media (max-width: 520px) {
  .action-tooltip {
    left: 50% !important;
    top: auto;
    bottom: calc(100% + 6px) !important;
    transform: translateX(-50%) !important;
    max-width: 200px;
    word-break: keep-all;
  }
}

.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.form-grid-6 {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.form-grid-7 {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--ui-gap);
  align-items: end;
}

.full {
  grid-column: 1 / -1;
}

.filters {
  display: grid;
  grid-template-columns: 2fr 1fr auto auto;
  gap: 12px;
  align-items: end;
}

.filters-journal {
  grid-template-columns: 1.4fr 1fr 1.2fr 1.2fr auto auto;
}

#filterForm.filters-flaschen {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.bottles-head-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.bottles-head-left h2 {
  margin: 0;
}

.bottles-status-tabs {
  display: inline-flex;
  align-items: stretch;
  gap: 6px;
}

.bottles-status-segment {
  position: relative;
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 0;
  padding: 2px;
  border: 1px solid var(--btn-border);
  border-radius: 999px;
  background: var(--bg-main);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.03);
  overflow: hidden;
}

.bottles-status-segment .bottles-status-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc((100% - 4px) / 3);
  height: calc(100% - 4px);
  border-radius: 999px;
  background: var(--bg-medium);
  transition: transform 180ms ease;
  z-index: 0;
}

.bottles-status-segment[data-state="all"] .bottles-status-thumb {
  transform: translateX(0%);
}

.bottles-status-segment[data-state="open"] .bottles-status-thumb {
  transform: translateX(100%);
}

.bottles-status-segment[data-state="closed"] .bottles-status-thumb {
  transform: translateX(200%);
}

/* 5-button variant for journal time filter */
.bottles-status-segment.journal-time-segment {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.bottles-status-segment.journal-time-segment .bottles-status-thumb {
  width: calc((100% - 4px) / 5);
}

.bottles-status-segment.journal-time-segment[data-state="all"] .bottles-status-thumb {
  transform: translateX(0%);
}

.bottles-status-segment.journal-time-segment[data-state="open"] .bottles-status-thumb {
  transform: translateX(100%);
}

.bottles-status-segment.journal-time-segment[data-state="week"] .bottles-status-thumb {
  transform: translateX(200%);
}

.bottles-status-segment.journal-time-segment[data-state="month"] .bottles-status-thumb {
  transform: translateX(300%);
}

.bottles-status-segment.journal-time-segment[data-state="closed"] .bottles-status-thumb {
  transform: translateX(400%);
}

.bottles-status-segment .btn.small {
  height: 24px;
  line-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: transparent;
  color: var(--text-main);
  border: none;
  position: relative;
  z-index: 1;
  box-shadow: none;
  font-weight: 500;
  transition: none;
}

.bottles-status-segment .btn.small:hover {
  background: transparent;
  transform: none;
  box-shadow: none;
}

.bottles-status-segment .btn.small.active {
  background: var(--bg-white);
  color: var(--text-main);
  font-weight: 600;
}

th[data-sort] {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}



th.sort-active {
  color: var(--color-whisky);
}

.sort-indicator {
  font-size: 10px;
  opacity: 0.8;
}

#filterForm.filters-people {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

#filterForm.filters-people > div:nth-child(2) {
  justify-self: end;
}

.buchen-filters-flaschen {
  grid-template-columns: minmax(0, 1.8fr) auto;
}

.buchen-filter-actions {
  display: inline-flex;
  gap: 6px;
  justify-self: end;
}

.buchen-form {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--ui-gap);
  align-items: end;
}

.buchen-form input[type="text"] {
  padding: 0 var(--ui-gap);
  font-size: 13px;
  line-height: 1;
  height: 28px;
  margin: 0;
  border-radius: 6px;
}

.btn-save-like {
  height: 28px;
  line-height: 28px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid var(--btn-border);
  background: var(--color-accent1);
  color: var(--text-main);
  font-weight: 400;
  cursor: pointer;
  box-shadow: none;
}

.btn-save-like:hover {
  background: var(--color-accent1);
}

#createBookingBtn {
  background: var(--color-accent1);
}

#stornoBtn {
  background: var(--bg-main);
  transition: transform 140ms ease, box-shadow 140ms ease;
}

#stornoBtn:hover {
  background: var(--bg-main);
}

.cards-2col-buchen {
  display: grid;
  grid-template-columns: 1fr 3fr;
  gap: 18px;
  align-items: stretch;
  margin-top: 20px;
}

.cards-2col-buchen > .card {
  margin-bottom: 0;
}

.buchen-right-col > .card {
  margin-bottom: 0;
}

.buchen-right-col {
  display: grid;
  gap: 18px;
  align-content: start;
}

.buchen-card-actions {
  display: flex;
  gap: var(--ui-gap);
  margin-left: auto;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.mode-actions {
  display: flex;
  gap: var(--ui-gap);
  margin-left: auto;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.mode-panel-hidden {
  display: none;
}

.abrechnen-saldo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.abrechnen-saldo-grid .card2 {
  margin-top: 0;
}

.abrechnen-summary-pills {
  display: flex;
  gap: 8px;
  margin-left: auto;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.pill.pill-succ {
  background: var(--color-toast-succ);
  color: var(--text-main);
  font-weight: 600;
}

.pill.pill-main {
  background: var(--bg-main);
  color: var(--text-main);
  font-weight: 600;
}

.pill.pill-err {
  background: var(--color-toast-err);
  color: var(--text-main);
  font-weight: 600;
}

/* Make the journal PASS pill text white for better contrast */
.journal-summary-status.pill-succ {
  color: var(--color-white);
}

/* Right-align the mode-actions toggle in the Journal card header */
.journal-head .mode-actions {
  margin-left: auto;
}

.abrechnen-journal-table th:nth-child(1),
.abrechnen-journal-table td:nth-child(1) { width: 7%; }
.abrechnen-journal-table th:nth-child(2),
.abrechnen-journal-table td:nth-child(2) { width: 12%; }
.abrechnen-journal-table th:nth-child(3),
.abrechnen-journal-table td:nth-child(3) { width: 26%; }
.abrechnen-journal-table th:nth-child(4),
.abrechnen-journal-table td:nth-child(4) { width: 17%; }
.abrechnen-journal-table th:nth-child(5),
.abrechnen-journal-table td:nth-child(5) { width: 10%; }
.abrechnen-journal-table th:nth-child(6),
.abrechnen-journal-table td:nth-child(6) { width: 10%; }
.abrechnen-journal-table th:nth-child(7),
.abrechnen-journal-table td:nth-child(7) { width: 10%; }
.abrechnen-journal-table th:nth-child(8),
.abrechnen-journal-table td:nth-child(8) { width: 8%; }

.buchen-table tr {
  cursor: pointer;
}

.buchen-table td {
  font-size: 13px;
  padding: 0 var(--ui-gap);
  height: 28px;
  line-height: 28px;
  vertical-align: middle;
}

.buchen-table th {
  font-size: 16px;
  padding: var(--ui-gap) var(--ui-gap) 8px;
}

.buchen-table tr.selected td {
  background: var(--bg-whisky) !important;
  color: var(--bg-white);
}

.buchen-table tbody tr:nth-child(even):not(.selected) td {
  background: var(--bg-main);
}

.buchen-table tbody tr:hover:nth-child(even):not(.selected) td {
  background: var(--bg-main);
}

.buchen-table th:nth-child(1),
.buchen-table td:nth-child(1) {
  overflow: visible;
}

.journal-table td {
  font-size: 13px;
  padding: 0 var(--ui-gap);
  height: 28px;
  line-height: 28px;
  vertical-align: middle;
}

/* Match the compact row height used in Journal for other tables */
.flaschen-table td,
.people-table td,
.buchen-table td {
  height: 28px;
  line-height: 28px;
}

.journal-table th {
  font-size: 16px;
  padding: var(--ui-gap) var(--ui-gap) 8px;
}

.journal-summary-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.journal-summary-line .summary-gap {
  margin-left: 1cm;
}

.journal-summary-status {
  margin-left: auto;
  font-weight: 600;
  min-width: 56px;
  text-align: center;
}

.journal-table tbody tr:nth-child(even) td {
  background: var(--bg-main);
}

.journal-table tbody tr:hover:nth-child(even) td {
  background: var(--bg-main);
}

.buchen-people-table th:nth-child(1), .buchen-people-table td:nth-child(1) { width: 50%; }
.buchen-people-table th:nth-child(2), .buchen-people-table td:nth-child(2) { width: 50%; }

.buchen-flaschen-table th:nth-child(1), .buchen-flaschen-table td:nth-child(1) { width: 14%; }
.buchen-flaschen-table th:nth-child(2), .buchen-flaschen-table td:nth-child(2) { width: 60%; }
.buchen-flaschen-table th:nth-child(3), .buchen-flaschen-table td:nth-child(3) { width: 12%; }
.buchen-flaschen-table th:nth-child(4), .buchen-flaschen-table td:nth-child(4) { width: 14%; }

.filters input[type="text"],
.filters select {
  padding: 0 var(--ui-gap);
  font-size: 13px;
  line-height: 1;
  height: 28px;
  margin: 0;
  border-radius: 6px;
}

.filters button {
  height: 28px;
  line-height: 28px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 6px;
  margin: 0;
  background: var(--btn-bg-2);
}

.filters button:hover {
  background: var(--btn-bg-2);
}

#journalExportBtn,
#journalResetBtn {
  width: 120px;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

/* =========================
 * Status / Pills
 * ========================= */

.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-light);
  background: var(--bg-medium);
  font-size: 12px;
  color: var(--text-muted);
}

.pill.whisky {
  background: var(--btn-selected);
  color: var(--color-whisky);
  font-weight: 600;
}

.pill.zero {
  background: var(--color-black);
  color: var(--color-black);
  font-weight: 600;
}

.pill.neutral {
  background: var(--color-black) !important;
  color: var(--color-black) !important;
  font-weight: 500;
}


/* =========================
 * Spezifische Blöcke
 * ========================= */

.qrbox {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}

.qrimg {
  width: 260px;
  height: 260px;
  background: #fff;
  border: 1px solid var(--border-medium);
  border-radius: 14px;
}

.pay-last {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.pay-last .hint {
  line-height: 1;
}

.col-id {
  width: 90px;
  font-size: 12px;
  color: var(--bg-medium);
  white-space: nowrap;
}

.col-price {
  text-align: right;
  width: 90px;
  font-weight: 600;
}

#message {
  margin-top: 10px;
  font-weight: bold;
  color: var(--color-error);
}

/* =========================
 * Mobile Dashboard
 * ========================= */

.mobile-app {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 12px;
}

.mobile-app .card {
  width: 100%;
  max-width: none;
  padding: 14px 14px;
  border-radius: 14px;
}

.mobile-app .btn {
  width: 100%;
  justify-content: center;
}

.mobile-app .actions,
.mobile-app .row {
  gap: 10px;
}

.mobile-app .pill {
  white-space: nowrap;
}

.mobile-app h2 {
  font-size: 20px;
}

.mobile-app h3 {
  font-size: 16px;
}

#msVideo {
  width: 100%;
  max-height: 60vh;
  object-fit: cover;
}

.field {
  background: #fafafa;
  border: 1px solid #e4e4e4;
  border-radius: 10px;
  padding: 12px;
}

.field .label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.field .value {
  font-size: 18px;
  font-weight: bold;
  word-break: break-word;
}

.notes {
  white-space: pre-wrap;
  line-height: 1.5;
}

/* saldo/histsaldo columns — right-aligned numbers */
th.col-saldo, td.col-saldo { width: 7%; min-width: 87px; text-align: right; }
th.col-histsaldo, td.col-histsaldo { width: 7%; min-width: 87px; text-align: right; }
td.col-saldo input, td.col-histsaldo input { text-align: right; }

/* hide table columns marked as col-hidden */
th.col-hidden, td.col-hidden { display: none; }

/* compact table variant: no row lines, tighter padding */
.table-compact td {
  border-bottom: none;
  padding: 0 var(--ui-gap);
  vertical-align: middle;
}
.table-compact th {
  padding: var(--ui-gap) var(--ui-gap) 8px;
}
.table-compact .inline-input,
.table-compact .inline-select {
  padding: 0 var(--ui-gap);
  font-size: 13px;
  line-height: 1;
  height: 28px;
  margin: 0;
}

/* enforce uniform font-size inside tables */
table, table th, table td, table input, table select { font-size: 13px; }

/* Override: make table headers match h3 (16px) as requested */
table th,
.table-compact th {
  font-size: 16px;
}

/* Fixed layout and column widths for compact tables (people list) */
.table-compact {
  table-layout: fixed;
  width: 100%;
}

/* Ensure overflowing cell content is truncated */
.table-compact th,
.table-compact td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Allow tooltips in ID and actions columns to overflow adjacent cells */
.table-compact th:nth-child(10),
.table-compact th:nth-child(1),
.table-compact td:nth-child(1),
.table-compact td:nth-child(10) {
  overflow: visible;
  text-overflow: clip;
}

.people-table th:nth-child(11),
.people-table td:nth-child(11) {
  overflow: visible;
  text-overflow: clip;
}


.table-compact td:nth-child(1),
.table-compact td:nth-child(1) .left-icon,
.table-compact td:nth-child(1) .action-icon,
.table-compact td:nth-child(10),
.table-compact td:nth-child(10) .actions,
.table-compact td:nth-child(10) .action-icon {
  position: relative;
  overflow: visible;
}

.people-table td:nth-child(11),
.people-table td:nth-child(11) .actions,
.people-table td:nth-child(11) .action-icon {
  position: relative;
  overflow: visible;
}

/* Ensure tooltip can layer above neighboring rows (including the row above) */
.table-compact td:nth-child(1),
.table-compact td:nth-child(10) {
  z-index: 1;
}

.people-table td:nth-child(11) {
  z-index: 1;
}

.table-compact td:nth-child(1):hover,
.table-compact td:nth-child(1):hover .left-icon,
.table-compact td:nth-child(1):hover .action-icon,
.table-compact td:nth-child(10):hover,
.table-compact td:nth-child(10):hover .actions,
.table-compact td:nth-child(10):hover .action-icon {
  z-index: 10000;
}

.people-table td:nth-child(11):hover,
.people-table td:nth-child(11):hover .actions,
.people-table td:nth-child(11):hover .action-icon {
  z-index: 10000;
}

/* People table column width plan (sums to 100%) */
.people-table th:nth-child(1), .people-table td:nth-child(1) { width: 10%; }
.people-table th:nth-child(2), .people-table td:nth-child(2) { width: 10%; }
.people-table th:nth-child(3), .people-table td:nth-child(3) { width: 6%; }
.people-table th:nth-child(4), .people-table td:nth-child(4) { width: 10%; }
.people-table th:nth-child(5), .people-table td:nth-child(5) { width: 12%; }
.people-table th:nth-child(6), .people-table td:nth-child(6) { width: 10%; }
.people-table th:nth-child(7), .people-table td:nth-child(7) { width: 10%; }
.people-table th:nth-child(8), .people-table td:nth-child(8) { width: 7%; }
.people-table th:nth-child(9), .people-table td:nth-child(9) { width: 7%; }
.people-table th:nth-child(10), .people-table td:nth-child(10) { width: 8%; }
.people-table th:nth-child(11), .people-table td:nth-child(11) { width: 12%; }

/* Edit table override: make Email wider and KNR about half of Email */
#peopleEditPanel .people-table th:nth-child(6),
#peopleEditPanel .people-table td:nth-child(6) { width: 19%; }
#peopleEditPanel .people-table th:nth-child(7),
#peopleEditPanel .people-table td:nth-child(7) { width: 8%; }
#peopleEditPanel .people-table th:nth-child(3),
#peopleEditPanel .people-table td:nth-child(3) { width: 7.2%; }
#peopleEditPanel .people-table th:nth-child(11),
#peopleEditPanel .people-table td:nth-child(11) { width: 8%; }

/* View table override: show role column and keep readable proportions */
#peopleReadonlyPanel .people-table th:nth-child(1),
#peopleReadonlyPanel .people-table td:nth-child(1) { width: 10%; }
#peopleReadonlyPanel .people-table th:nth-child(2),
#peopleReadonlyPanel .people-table td:nth-child(2) { width: 11%; }
#peopleReadonlyPanel .people-table th:nth-child(3),
#peopleReadonlyPanel .people-table td:nth-child(3) { width: 10%; }
#peopleReadonlyPanel .people-table th:nth-child(4),
#peopleReadonlyPanel .people-table td:nth-child(4) { width: 11%; }
#peopleReadonlyPanel .people-table th:nth-child(5),
#peopleReadonlyPanel .people-table td:nth-child(5) { width: 12%; }
#peopleReadonlyPanel .people-table th:nth-child(6),
#peopleReadonlyPanel .people-table td:nth-child(6) { width: 21%; }
#peopleReadonlyPanel .people-table th:nth-child(7),
#peopleReadonlyPanel .people-table td:nth-child(7) { width: 8%; }
#peopleReadonlyPanel .people-table th:nth-child(8),
#peopleReadonlyPanel .people-table td:nth-child(8) { width: 8.5%; }
#peopleReadonlyPanel .people-table th:nth-child(9),
#peopleReadonlyPanel .people-table td:nth-child(9) { width: 8.5%; }

/* Flaschen table column width plan (visible columns):
  ID 8%, Flaschenname 45%, id_wb 9%, Preis 6%, UVP 6%, Status 6%, Sponsor 8%, Aktionen 12% */
.flaschen-table th:nth-child(1), .flaschen-table td:nth-child(1) { width: 11%; }
.flaschen-table th:nth-child(2), .flaschen-table td:nth-child(2) { width: 45%; }
.flaschen-table th:nth-child(3), .flaschen-table td:nth-child(3) { width: 9%; }
.flaschen-table th:nth-child(4), .flaschen-table td:nth-child(4) { width: 6%; }
.flaschen-table th:nth-child(5), .flaschen-table td:nth-child(5) { width: 6%; }
.flaschen-table th:nth-child(6), .flaschen-table td:nth-child(6) { width: 6%; }
.flaschen-table th:nth-child(7), .flaschen-table td:nth-child(7) { width: 8%; }
.flaschen-table th:nth-child(10), .flaschen-table td:nth-child(10) { width: 9%; text-align: right; }

.flaschen-table td:nth-child(4) input,
.flaschen-table td:nth-child(5) input {
  text-align: right;
}

/* Journal table column width plan (sums to 100%) */
.journal-table th:nth-child(1), .journal-table td:nth-child(1) { width: 14%; }
.journal-table th:nth-child(2), .journal-table td:nth-child(2) { width: 9%; }
.journal-table th:nth-child(3), .journal-table td:nth-child(3) { width: 8%; }
.journal-table th:nth-child(4), .journal-table td:nth-child(4) { width: 9%; }
.journal-table th:nth-child(5), .journal-table td:nth-child(5) { width: 13%; }
.journal-table th:nth-child(6), .journal-table td:nth-child(6) { width: 7%; }
.journal-table th:nth-child(7), .journal-table td:nth-child(7) { width: 7%; }
.journal-table th:nth-child(8), .journal-table td:nth-child(8) { width: 7%; }
.journal-table th:nth-child(9), .journal-table td:nth-child(9) { width: 14%; }
.journal-table th:nth-child(10), .journal-table td:nth-child(10) { width: 7%; }
.journal-table th:nth-child(11), .journal-table td:nth-child(11) { width: 5%; text-align: center; }
.journal-table td:nth-child(11) .actions {
  justify-content: center;
  margin: 0;
}

/* double-width grid item */
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }

#createFlascheForm {
  grid-template-columns: 3fr 1fr 64px 1fr 1fr;
}

/* Toast popup for transient confirmations */
.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: rgba(0,0,0,0.85);
  color: var(--tt-text);
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: 0 6px 18px var(--tt-bg);
  font-size: 13px;
  z-index: 1200;
  opacity: 0.98;
}
.toast-success {
  background: var(--color-toast-succ);
}
.toast-error {
  background: var(--color-toast-err);
}

/* close button inside toast */
.toast .toast-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: transparent;
  border: none;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.toast .toast-close:focus { outline: 2px solid var(--bg-medium); border-radius: 4px; }

/* make the first card's form inputs match filter-card appearance */
/* make form-grid-7 inputs match table-compact inputs (uniform size/spacing) */
.form-grid-7 input[type="text"],
.form-grid-7 input[type="email"],
.form-grid-7 input[type="number"],
.form-grid-7 .inline-input,
.form-grid-7 .inline-select {
  padding: 0 var(--ui-gap);
  font-size: 13px;
  line-height: 1;
  height: 28px;
  margin: 0;
  border-radius: 6px;
}
.form-grid-7 { gap: var(--ui-gap); }

/* Placeholder color for 'Neuen Geniesser anlegen' form */
#createUserForm input::placeholder,
#createUserForm textarea::placeholder,
#createUserForm select::placeholder,
#createFlascheForm input::placeholder,
#createFlascheForm textarea::placeholder,
#createFlascheForm select::placeholder,
#filterForm input::placeholder,
#filterForm textarea::placeholder,
#filterForm select::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

/* Vendor-prefixed placeholders for broader browser support */
#createUserForm input::-webkit-input-placeholder,
#createUserForm textarea::-webkit-input-placeholder,
#createFlascheForm input::-webkit-input-placeholder,
#createFlascheForm textarea::-webkit-input-placeholder,
#filterForm input::-webkit-input-placeholder,
#filterForm textarea::-webkit-input-placeholder { color: var(--text-muted); }
#createUserForm input::-moz-placeholder,
#createUserForm textarea::-moz-placeholder,
#createFlascheForm input::-moz-placeholder,
#createFlascheForm textarea::-moz-placeholder,
#filterForm input::-moz-placeholder,
#filterForm textarea::-moz-placeholder { color: var(--text-muted); }
#createUserForm input:-ms-input-placeholder,
#createUserForm textarea:-ms-input-placeholder,
#createFlascheForm input:-ms-input-placeholder,
#createFlascheForm textarea:-ms-input-placeholder,
#filterForm input:-ms-input-placeholder,
#filterForm textarea:-ms-input-placeholder { color: var(--text-muted); }
#createUserForm input::-ms-input-placeholder,
#createUserForm textarea::-ms-input-placeholder,
#createFlascheForm input::-ms-input-placeholder,
#createFlascheForm textarea::-ms-input-placeholder,
#filterForm input::-ms-input-placeholder,
#filterForm textarea::-ms-input-placeholder { color: var(--text-muted); }

/* Style submit button in form-grid-7  */
.form-grid-7 button[type="submit"] {
  height: 28px;
  line-height: 28px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid var(--btn-border);
  background: var(--color-accent1); 
  font-weight: 400;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  box-shadow: none;
}
#createUserForm button[type="submit"] {
  background: var(--color-accent1);
}
#createFlascheForm button[type="submit"] {
  background: var(--color-accent1);
}
#createUserForm {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) minmax(0, 1.8fr) auto auto;
  column-gap: 12px;
  row-gap: var(--ui-gap);
}
#createUserForm .btn-save-like {
  height: 28px;
  line-height: 28px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 6px;
}

#createUserForm .buddy-email.col-span-2 {
  grid-column: 3;
}

#createUserForm .buddy-form-actions {
  grid-column: 4 / 6;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  justify-self: end;
}

.form-grid-7 button[type="submit"]:hover {
  background: var(--btn-hover);
}

/* remove number input spinners for cleaner table editing */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Editable data fields background for table and form inputs */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
textarea,
select,
.table-compact input,
.table-compact textarea,
.form-grid-7 input,
.form-grid-7 textarea {
  background: var(--bg-main);
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}


/* =========================
 * Responsive
 * ========================= */

@media (max-width: 1100px) {
  .filters {
    grid-template-columns: 1fr;
  }

  .cards-2col {
    grid-template-columns: 1fr;
  }

  .cards-2col-buchen {
    grid-template-columns: 1fr;
  }

  .buchen-form {
    grid-template-columns: 1fr;
  }

  .abrechnen-saldo-grid {
    grid-template-columns: 1fr;
  }

  .form-grid-7,
  .form-grid-6,
  .form-grid-4,
  .grid,
  .filters-journal {
    grid-template-columns: 1fr;
  }

  #createUserForm {
    grid-template-columns: 1fr;
  }

  #createUserForm .buddy-email.col-span-2,
  #createUserForm .buddy-form-actions {
    grid-column: auto;
  }

  #createUserForm .buddy-form-actions {
    justify-content: flex-start;
    justify-self: start;
  }

  #createFlascheForm {
    grid-template-columns: 1fr;
  }

  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
  }

  thead {
    display: none;
  }

  tr {
    margin-bottom: 14px;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 10px;
    background: var(--bg-white);
  }

  td {
    border: none;
    padding: 6px 0;
    text-align: left;
  }

  .num {
    text-align: left;
  }
}

@media (max-width: 720px) {
  .menu {
    display: flex;
    flex-wrap: wrap;
    overflow-x: visible;
    white-space: normal;
    gap: 8px;
  }

  .menu .btn {
    flex: 1 1 auto;
  }

}

@media (max-width: 700px) {
  .field .value {
    font-size: 17px;
  }
}