/* TK Operations – Sidebar + Header polish (hamburger, role, logout) */ :root {
  --accent: #d80000;
  --bg: #f7f9fc;
  --surface: #ffffff;
  --border: #e6e9ef;
  --border-strong: #d1d6e0;
  --text: #0f172a;
  --muted: #6b7280;
  --icon: #475569;
  --icon-active: #111827;
  --radius: .75rem;
  --shadow: 0 1px 2px rgba(0, 0, 0, .03), 0 8px 20px rgba(15, 23, 42, .04);
  --fs-12: .75rem;
  --fs-13: .8125rem;
  --fs-14: .875rem;
  --fs-15: .9375rem;
  --sp-1: .25rem;
  --sp-2: .5rem;
  --sp-3: .75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sidebar-w: 17.25rem; /* 276px */
  --sidebar-w-sm: 5.25rem; /* 84px  */
  --header-h: 4rem; /* match .ams-brand */
  --alert-bg: #fff0f0; /* soft tinted red background */
  --alert-accent: #d80000; /* your existing AMS accent red */
  --status-default: #ffffff;
  --status-ok: #dcfce7; /* green-100 */
  --status-err: #fee2e2; /* red-200 (fits your accent) */
  --status-wait: #fff7ed; /* orange-100 */
  --midclean: #ff9900;
}
/* compact text input for table cells */
.ams-input {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: .375rem;
  padding: .35rem .5rem;
  font-size: var(--fs-14);
  background: #fff;
}
.ams-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(216, 0, 0, .08);
}
/* select with soft background that reflects status */
.ams-select {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: .375rem;
  padding: .35rem .5rem;
  font-size: var(--fs-14);
  appearance: none; /* cleaner look (native arrow still fine) */
  background-position: right .5rem center;
  background-repeat: no-repeat;
}
.ams-select:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(216, 0, 0, .08);
}
html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
}
/* Long-stay rows (N ≥ 21) 
.ams-row-alert td:first-child {
  box-shadow: inset 4px 0 0 var(--alert-accent); 
}
*/
/* Hidden / greyed-out rows: keep opacity from inline style + add strike-through */
.ams-row-hidden td {
  text-decoration: line-through;
  text-decoration-color: rgba(148, 163, 184, 0.9); /* slate-ish grey */
}
/* Mid-clean rows (Zwischenreinigung in note) */
.ams-row-midclean td:nth-child(1), .ams-row-midclean td:nth-child(2), .ams-row-midclean td:nth-child(3), .ams-row-midclean td:nth-child(4), /* Stadt */ .ams-row-midclean td:nth-child(5), /* Apartment */ .ams-row-midclean td:nth-child(6), /* Gast */ .ams-row-midclean td:nth-child(7), /* Telefon / Check-out in no-phone layouts */ .ams-row-midclean td:nth-child(8), /* Check-in */ .ams-row-midclean td:nth-child(9), /* Check-in */ .ams-row-midclean td:nth-child(10), /* P */ .ams-row-midclean td:nth-child(11), /* N */ .ams-row-midclean td:nth-child(12), /* Notizen */ .ams-row-midclean td:nth-child(13) /* Notizen */ {
  background: var(--midclean) !important; /* soft orange */
	color: #000 !important;
  ;
}
/* Grid - single column layout, sidebar is always off-canvas */
.ams-root {
  display: grid;
  grid-template-columns: 1fr;
  height: 100vh;
  overflow: hidden;
}
.ams-root.collapsed {
  grid-template-columns: 1fr;
}
/* Sidebar - always off-canvas */
.ams-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  max-width: 80vw;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: none;
  z-index: 1100;
  transform: translateX(-100%);
  transition: transform .2s ease, box-shadow .2s ease;
}

/* When nav is open, slide sidebar in */
.ams-root.ams-nav-open .ams-sidebar {
  transform: translateX(0);
  box-shadow: 10px 0 30px rgba(15, 23, 42, .35);
}

/* Backdrop when sidebar is open */
.ams-nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
.ams-root.ams-nav-open .ams-nav-backdrop {
  opacity: 1;
  visibility: visible;
}
.ams-brand {
  height: 4rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 .875rem;
  border-bottom: 1px solid var(--border);
}
.ams-edge-toggle {
  border: none;
  background: transparent;
  color: var(--icon);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.ams-edge-toggle:hover {
  color: var(--icon-active);
  background-color: white;
}
.ams-edge-toggle:focus {
  background-color: #ffffff;
  color: var(--icon);
}
/* Nav */
.ams-nav-vertical {
  display: flex;
  flex-direction: column;
  padding: .75rem;
  gap: .625rem;
}
.ams-section-label {
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  font-size: var(--fs-12);
  padding: .625rem 1rem .375rem 1rem;
}
.ams-root.collapsed .ams-section-label {
  display: none;
}
.ams-nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  color: var(--text);
  padding: .75rem .875rem;
  border-radius: .625rem;
}
.ams-nav-item:hover {
  background: #f3f6fb;
}
.ams-nav-item[aria-current="page"] {
  background: transparent;
}
.ams-nav-icon {
  display: inline-grid;
  place-items: center;
  width: 1.125rem;
  height: 1.125rem;
  color: var(--icon);
}
.ams-nav-item[aria-current="page"] .ams-nav-icon {
  color: var(--icon-active);
}
.ams-nav-label {
  white-space: nowrap;
  font-size: var(--fs-14);
}
/**** INLINE editing Visual feedback **/
.ams-edit-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: .25rem;
}
.ams-edit-hint {
  font-size: .72rem;
  color: var(--muted);
  opacity: 0;
  transition: opacity .2s ease, color .2s ease;
}
.ams-edit-hint[data-status="editing"] {
  opacity: 1;
  color: #6b7280; /* grey */
}
.ams-edit-hint[data-status="editing"]::before {
  content: "…Bearbeitung";
}
.ams-edit-hint[data-status="saved"] {
  opacity: 1;
  color: #16a34a; /* Tailwind green-600 */
}
.ams-edit-hint[data-status="saved"]::before {
  content: "✓ gespeichert";
}
/* Collapse behaviour: icons centered, labels+submenu hidden */
.ams-root.collapsed .ams-nav-vertical {
  align-items: center;
}
.ams-root.collapsed .ams-nav-item {
  justify-content: center;
  padding: .625rem 0;
  width: 100%;
}
.ams-root.collapsed .ams-nav-label {
  display: none;
}
.ams-subnav {
  display: flex;
  flex-direction: column;
  margin: .125rem 0 .5rem 0;
  padding-left: 2.125rem;
  gap: .25rem;
}
.ams-subnav a {
  padding: .375rem .625rem;
  border-radius: .5rem;
  color: #7b8496;
  text-decoration: none;
  font-size: var(--fs-13);
}
.ams-subnav a:hover {
  background: #f3f6fb;
  color: var(--text);
}
.ams-subnav a[aria-current="page"] {
  color: var(--icon-active);
  background: #f3f6fb;
}
.ams-root.collapsed .ams-subnav {
  display: none;
}
/* Sidebar footer */
.ams-sidebar-foot {
  margin-top: auto;
  padding: .875rem .75rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center; /* horizontal center */
  align-items: center; /* vertical center */
}
.ams-lang-select label {
  display: block;
  margin-bottom: .25rem;
  color: var(--muted);
  font-size: var(--fs-12);
}
.ams-lang-select select {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: .625rem;
  padding: .5rem .625rem;
  background: var(--surface);
  font-size: var(--fs-13);
}
/* Main */
.ams-main {
  display: grid;
  grid-template-rows: var(--header-h) 1fr;
  min-width: 0;
  overflow: auto; /* header fixed, content scrolls */
}
.ams-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
}
.ams-header-left {
  display: flex;
  align-items: center;
  gap: .5rem;
}
/* Prevent stretched logo in header — max-height 2rem */
.ams-header-logo .custom-logo, .ams-header-logo .custom-logo-link img {
  max-height: 2rem; /* 32px */
  height: auto !important;
  width: auto !important;
  object-fit: contain;
  line-height: 1;
}
.ams-header-initials {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: .375rem;
  background: var(--accent);
  color: #fff;
  font-size: .875rem;
  font-weight: 700;
}
/* ===== Responsive table wrap (add-only) ===== */
/*.ams-table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: auto;
 -webkit-overflow-scrolling: touch;
  max-height: calc(100vh - 140px); 
  scrollbar-width: thin;
  scrollbar-color: #e1e1e1 transparent;
  overscroll-behavior: contain;
  
}*/
.ams-table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: calc(100vh - 140px); /* header + toolbar spacing */
  scrollbar-width: thin;
  scrollbar-color: #e1e1e1 transparent;
  /* overscroll-behavior: contain;  // leave commented for smoother mobile */
}
.ams-table th:first-child, .ams-table td:first-child {
  position: sticky;
  left: -1px;
  z-index: 3;
  background: #f9fafb;
  border-right: 1px solid #e5e7eb;
}
/* Header cell of first column should sit above body cells */
.ams-table thead th:first-child {
  z-index: 3;
}
.ams-table {
  min-width: 1400px; /* keeps columns readable; scrolls on small screens */
}
/* Compact table for cleaning/housekeeping roles (fewer columns) */
.ams-table.ams-table--compact {
  min-width: 0 !important;
  width: 100%;
}
/* Only wrap long content columns */
.ams-table--compact .col-personal,
.ams-table--compact .col-apartment {
  white-space: normal;
  word-break: break-word;
}
.ams-table--compact .col-personal { min-width: 80px; max-width: 130px; }
.ams-table--compact .col-apartment { min-width: 100px; max-width: 180px; }
/* keep headers on one line for compactness */
.ams-table th, .ams-table td {
  white-space: nowrap;
}
.ams-header-right {
  display: flex;
  align-items: center;
}
.ams-header-user {
  display: flex;
  align-items: center;
  gap: .625rem;
}
.ams-header-avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}
.ams-header-usertext {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.ams-header-name {
  font-size: var(--fs-14);
  font-weight: 600;
  color: var(--text);
}
.ams-header-role {
  font-size: var(--fs-12);
  color: var(--muted);
}
.ams-header-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.ams-header-logout svg {
  display: block;
    color: #232a38;
}
.ams-header-logout:hover {
  color: var(--icon-active);
}
.ams-content {
  padding: 0rem 1rem;
  min-width: 0;
  /*  overflow: auto;*/
}
/* --- Planner toolbar --- */
.ams-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem;
  border-bottom: 1px solid var(--border);
  gap: .75rem;
}
.ams-toolbar-toggle {
  display: none; /* shown only on mobile */
}
.ams-search {
  flex: 1 1 auto;
  max-width: none; /* let it grow full width if needed */
  display: flex;
  align-items: center;
  gap: .5rem;
}
/* instead of width:100% */
.ams-search input {
  flex: 1 1 auto; /* take all remaining space */
  min-width: 0;
  width: auto; /* important: not 100% */
  border-radius: .5rem;
  padding: .5rem .75rem;
  font-size: var(--fs-14);
  background: #fff;
}
.ams-actions {
  display: flex;
  gap: .5rem;
}
.ams-btn {
  border: 1px solid var(--border-strong);
  background: #fff;
  border-radius: .5rem;
  padding: .5rem .75rem;
  font-size: var(--fs-14);
  cursor: pointer;
  color: #000;
}
.mobile-toggle {
  padding: 10px 0px !important;
}
.ams-actions {
  gap: .5rem;
  align-items: center;
}
.ams-date-field {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  border: 1px solid var(--border-strong);
  border-radius: .5rem;
  padding: .5rem .75rem;
  background: #fff;
  font-size: var(--fs-14);
  cursor: pointer; /* whole control clickable */
  user-select: none;
}
.ams-date-ico {
  display: inline-grid;
  place-items: center;
  line-height: 0;
  color: #111827;
}
.ams-date-label {
  color: #111827;
}
/* The input is invisible and covers the whole control to receive the picker */
.ams-date-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0; /* hide it (so no second icon shows) */
  border: 0;
  background: transparent;
  cursor: pointer;
}
/* Remove native calendar icon so only the left SVG remains */
.ams-date-input::-webkit-calendar-picker-indicator {
  display: none;
}
.ams-date-input {
  appearance: none;
  -webkit-appearance: none;
}
.ams-date-input:focus {
  outline: none;
}
.ams-date-field:hover {
  background: #f5f7fb;
}
/* safe hover for white buttons */
.ams-btn:hover {
  background: #f3f4f6;
  color: #000;
}
.ams-btn:active {
  background: #e5e7eb
}
/* gentle hover for primary */
.ams-btn.primary:hover {
  filter: brightness(.95);
}
.ams-btn:hover {
  background: #f5f7fb;
}
.ams-btn.primary {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}
/* Cards + Table */
.ams-card {
  background: var(--surface);
  border: 1px solid var(--border);
  /*border-radius: var(--radius);*/
  box-shadow: var(--shadow); /*padding:1rem;*/
}
.ams-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}
.ams-table thead tr {
  background: #f5f7fb;
}
.ams-table th, .ams-table td {
  font-size: var(--fs-14);
  line-height: 1.5;
  text-align: left !important;
  padding: .75rem .875rem !important;
  border-bottom: 1px solid #edf1f7;
  color: var(--text);
}
.ams-table th {
  font-weight: 400;
  color: #334155;
} /* unbold */
.ams-table td.muted {
  text-align: center;
  color: var(--muted);
}
/* Column widths by class (works regardless of which columns are visible) */
.ams-table .col-nr,
.ams-table .col-datum,
.ams-table .col-checkout,
.ams-table .col-checkin,
.ams-table .col-actions { width: 1%; white-space: nowrap; }
.ams-table .col-personal { min-width: 140px; max-width: 200px; white-space: nowrap; }
/* Personal Name - prevent placeholder text wrapping at all screen sizes */
.ams-table .col-personal .ams-multiname-display,
.ams-table .col-personal .ams-input {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ams-table .col-apartment { min-width: 200px; }
.ams-table .col-guest { min-width: 300px; }
.ams-table .col-n,
.ams-table .col-p { width: 1%; min-width: 4rem; white-space: nowrap; }
/* Put logo and title on one line with spacing */
.ams-header-left .ams-header-logo {
  display: flex;
  align-items: center;
  gap: .5rem; /* space between logo and title */
}
/* Keep logo link from stretching & align it nicely */
.ams-header-logo .custom-logo-link {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}
/* Title look & behavior */
.ams-site-title {
  font-size: var(--fs-15);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap; /* prevent wrap next to small logos */
  text-decoration: none; /* if you made it an <a> */
}
.ams-site-title:hover {
  text-decoration: none;
}
/* Optional: hide title when sidebar is collapsed */
.ams-root.collapsed .ams-site-title {
  display: none;
}
/* Brand text container (title + last sync) */
.ams-header-brand-text {
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1.2;
}
/* Last sync indicator - subtle, muted */
.ams-last-sync {
  font-size: var(--fs-12);
  font-weight: 400;
  color: var(--muted);
  white-space: nowrap;
  opacity: 0.7;
}
/* Optional: hide on very small screens */
@media (max-width:640px) {
  .ams-site-title {
    display: none;
  }
  .ams-last-sync {
    display: none;
  }
}
/* === Off-canvas Drawer (Add to Plan) === */
.ams-drawer-wrap {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, .30);
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
}
.ams-drawer {
  width: min(520px, 95vw);
  max-width: 320px;
  background: #fff;
  height: 100%;
  box-shadow: -8px 0 24px rgba(0, 0, 0, .18);
  display: flex;
  flex-direction: column;
  animation: amsSlideIn .18s ease-out both;
}
/* Toolbar drawer (mobile filters/actions) – same behaviour as .ams-drawer */
.ams-toolbar-drawer-wrap {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.28);
  display: grid;
  place-items: stretch;
  z-index: 9998;
  transition: opacity .22s ease;
  opacity: 1;
}
.ams-toolbar-drawer {
  margin-left: auto;
  width: min(520px, 95vw);
  max-width: 320px;
  height: 100%;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform .22s ease, opacity .22s ease;
  opacity: 1;
  animation: amsSlideIn .18s ease-out both;
}
/* closing state mirrors .ams-drawer */
.ams-toolbar-drawer-wrap.closing {
  opacity: 0;
}
.ams-toolbar-drawer.closing {
  transform: translateX(100%);
  opacity: 0;
}
/* Drawer: body scrolls, page does NOT */
.ams-drawer {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden; /* prevent the whole drawer from scrolling the page */
}
/* Scroll only inside the content area */
.ams-drawer-body {
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
/* Footer always visible + lifted above iOS Safari bottom bar */
.ams-drawer-ft {
  position: sticky;
  bottom: 0;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
  background: #fff;
}
@keyframes amsSlideIn {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}
.ams-drawer-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid #edf1f7;
}
.ams-drawer-hd h3 {
  margin: 0;
  font-size: var(--fs-14);
  font-weight: 600;
  color: #0f172a;
}
.ams-drawer-x {
  background: transparent;
  border: none;
  font-size: var(--fs-14);
  line-height: 1;
  cursor: pointer;
  color: var(--icon);
}
.ams-drawer-x:hover {
  background: transparent;
  color: #000;
}
.ams-drawer-body {
  padding: 16px 18px;
  overflow: auto;
  display: grid;
  gap: 12px;
}
.ams-field {
  display: grid;
  gap: 6px;
  text-align: left;
}
.ams-field span {
  font-size: 12px;
  color: #000000;
}
.ams-list {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  max-height: 280px;
  overflow: auto;
}
.ams-list-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  align-items: flex-start;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
}
.ams-list-item:last-child {
  border-bottom: none;
}
.ams-list-item input {
  margin-top: 3px;
}
.ams-list-meta {
  display: grid;
  gap: 2px;
}
.ams-list-title {
  font-size: 14px;
  color: #0f172a;
}
.ams-list-sub {
  font-size: 12px;
  color: #6b7280;
}
.ams-list-empty {
  padding: 12px;
  color: #6b7280;
}
.ams-drawer-ft {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 14px 18px;
  border-top: 1px solid #edf1f7;
  background: #fff;
}
.ams-badge.muted {
  background: #3937371f;
  color: #000000;
  border: 1px dashed #e5e7eb;
  padding: 2px 6px;
  font-size: .72rem;
  line-height: 1.1;
}
/* Backdrop + panel default (visible) */
.ams-drawer-wrap {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.28); /* soft backdrop */
  display: grid;
  place-items: stretch;
  z-index: 9999;
  transition: opacity .22s ease;
  opacity: 1;
}
/* Opening state (optional if you set it before mount) */
.ams-drawer.is-entering {
  transform: translateX(100%);
  opacity: 0;
}
/* Mirror close: slide back to the right + fade backdrop */
.ams-drawer-wrap.closing {
  opacity: 0;
}
.ams-drawer.closing {
  transform: translateX(100%);
  opacity: 0;
}
/* === AMS Login Screen ===================================================== */
.ams-login-body {
  background: #f6f8fb;
}
.ams-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.ams-login-card {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border: 1px solid #eef1f6;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .06);
  padding: 1.75rem;
}
.ams-login-header {
  margin-bottom: 1.25rem;
}
.ams-login-brand {
  display: flex;
  align-items: center;
  gap: .875rem;
  flex-direction: column;
  justify-content: center;
}
.ams-login-header .custom-logo {
  max-height: 56px;
  width: auto;
  height: auto;
}
.ams-login-title {
  font-size: 1.125rem;
  line-height: 1.25;
  margin: 0;
  color: #0f172a;
  text-align: center;
}
.ams-login-subtitle {
  font-size: .875rem;
  color: #6b7280;
  margin: .25rem 0 0 0;
}
/* wp_login_form markup */
#ams-login {
  display: grid;
  gap: .75rem;
  padding: 2rem 0rem;
}
#ams-login p {
  margin: 0;
}
#ams-login label {
  display: block;
  font-size: .875rem;
  color: #6b7280;
  margin-bottom: .25rem;
}
#ams-login input[type="text"], #ams-login input[type="password"] {
  width: 100%;
  height: 40px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0 .75rem;
  background: #fff;
  color: #0f172a;
}
#ams-login input[type="checkbox"] {
  vertical-align: middle;
}
#ams-login .submit .button {
  width: 100%;
  height: 42px;
  border-radius: 10px;
  border: 1px solid #dc2626;
  background: #ef4444;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
#ams-login .submit .button:hover {
  background: #dc2626;
}
.ams-login-links {
  display: flex;
  margin-top: .75rem;
}
.ams-link {
  font-size: .875rem;
  color: #8a8787;
}
.ams-link:hover {
  text-decoration: underline;
}
/* === App layout (main area fills viewport) ================ */
.ams-main {
  overflow: auto;
}
.ams-alert {
  padding: .625rem .75rem;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: .875rem;
  margin-bottom: .75rem
}
.ams-alert-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b
}
input#wp-submit {
  background-color: #303132;
  width: 100%;
  border-radius: 11px;
}
p.login-remember {
  display: none;
}
/*** AMS logs ***/
.ams-range-label {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .875rem;
  color: #4b5563;
}
.ams-range-select {
  /* make the select look like a button with a chevron */
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2rem;
  background-position: right .65rem center;
  background-repeat: no-repeat;
  background-size: 12px 12px;
  cursor: pointer;
}
/* subtle dropdown arrow */
.ams-range-select {
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
/* Hamburger toggle always visible in header */
#ams-toggle-mobile {
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  color: var(--icon);
  cursor: pointer;
  padding: 0.5rem;
}
#ams-toggle-mobile:hover {
  color: var(--icon-active);
}

/* Hide hamburger when nav is open */
.ams-root.ams-nav-open #ams-toggle-mobile {
  visibility: hidden;
}

/* Close button in sidebar - always visible since sidebar is off-canvas */
#ams-nav-close {
  display: grid;
  place-items: center;
  padding: 0.5rem;
}
body.ams-modal-open {
  overflow: hidden;
}
/* Desktop / default stays as-is; only override on mobile */
@media (max-width: 768px) {
  .ams-toolbar.ams-toolbar--has-mobile-drawer {
    padding-inline: .75rem;
    justify-content: flex-start; /* or space-between, but NOT flex-end */
    flex-wrap: wrap;
  }
  /* Hide inline actions on mobile – they live in the drawer now */
  .ams-toolbar.ams-toolbar--has-mobile-drawer .ams-actions {
    display: none;
  }
  /* Mobile: "Weitere Optionen" on its own row below the search */
  .ams-toolbar.ams-toolbar--has-mobile-drawer .ams-toolbar-toggle {
    display: flex;
    justify-content: flex-start; /* left aligned */
  }
}
/* === Mobile-specific tweaks ================= */
@media (max-width: 768px) {
  .ams-sidebar {
    max-width: 60vw;
  }
  .ams-header {
    padding: 0 .75rem;
  }
  .ams-edit-hint {
    display: none !important;
  }
  .ams-table-wrap {
    margin-bottom: 1rem;
  }
  .ams-header-left {
    gap: .5rem;
  }
  button.ams-btn.ams-toolbar-toggle.ams-btn-mobile {
    background: none;
    border: 0;
    padding: 0;
    font-size: .8rem;
    text-decoration: underline;
    color: var(--icon);
  }
  button.ams-btn.ams-toolbar-toggle.ams-btn-mobile:hover {
    color: #000;
  }
  .ams-header-right {
    align-items: center;
  }
  .ams-header-user {
    align-items: flex-end;
  }
  .ams-header-name {
    font-size: var(--fs-14);
  }
  .ams-header-role {
    font-size: var(--fs-12);
  }
  .ams-header-logout {
    display: block;
    margin-top: .15rem;
    font-size: .7rem;
  }
  .ams-brand {
    height: auto !important;
  }
  /* Fix time cell cutoff on mobile */
  .ams-table .col-checkout,
  .ams-table .col-checkin {
    white-space: normal;
    min-width: 4rem;
  }
}

/* === Style Popover (text formatting toolbar) === */

/* The cell needs relative positioning for the pen */
td:has(.ams-styled-input-wrap) {
  position: relative;
}

.ams-styled-input-wrap {
  position: relative;
  width: 100%;
  /* Prevent wrapper from expanding the cell */
  max-width: 100%;
  box-sizing: border-box;
}

/* Position pen relative to cell, not wrapper */
td:has(.ams-styled-input-wrap) > .ams-styled-input-wrap > .ams-style-pen {
  position: absolute !important;
  top: -8px;
  right: -4px;
}

.ams-styled-input-wrap .ams-input {
  width: 100%;
}

/* Ensure styled input text colors are applied */
.ams-table .ams-styled-input-wrap .ams-input {
  color: inherit;
}

/* Style color classes for inputs and textareas */
.ams-input.ams-text-red, .ams-textarea.ams-text-red { color: #dc2626 !important; }
.ams-input.ams-text-green, .ams-textarea.ams-text-green { color: #16a34a !important; }
.ams-input.ams-text-blue, .ams-textarea.ams-text-blue { color: #2563eb !important; }
.ams-input.ams-text-black, .ams-textarea.ams-text-black { color: #000000 !important; }
.ams-input.ams-text-bold, .ams-textarea.ams-text-bold { font-weight: 700 !important; }
.ams-input.ams-text-underline, .ams-textarea.ams-text-underline { text-decoration: underline !important; }


/* Multi-line textarea for Personal Name */
.ams-textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: .375rem;
  padding: .35rem .5rem;
  font-size: 16px; /* Prevents iOS zoom on focus */
  background: #fff;
  font-family: inherit;
  resize: none;
  overflow: hidden;
  min-height: 2rem;
  line-height: 1.4;
}

.ams-textarea:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(216, 0, 0, .08);
}

/* Multi-name display (click to edit) */
.ams-multiname-wrap {
  position: static;
}

/* Overlay approach for multiName field - display shows styled names, input captures typing */
.ams-multiname-display {
  position: relative;
  z-index: 1;
  min-height: 2rem;
  /* Use inline layout instead of flex to allow natural text wrapping */
  display: block;
  /* Style to look like an input */
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: .35rem .5rem;
  border: 1px solid var(--border-strong);
  border-radius: .375rem;
  background: #fff;
  font-size: var(--fs-14);
  line-height: 1.4;
  /* Prevent horizontal expansion - wrap text instead */
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}

.ams-multiname-input {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 2;
  background: transparent !important;
  color: transparent !important;
  caret-color: #000 !important;
  border: 1px solid transparent !important;
  border-radius: .375rem;
  padding: .35rem .5rem !important;
  font-size: var(--fs-14) !important;
  line-height: 1.4;
}

.ams-multiname-input:focus {
  outline: none !important;
  box-shadow: none !important;
  border-color: transparent !important;
}

/* Focus state for the wrapper when input is focused */
.ams-styled-input-wrap:focus-within .ams-multiname-display {
  border-color: #9ca3af;
  box-shadow: 0 0 0 2px rgba(216, 0, 0, .08);
}

.ams-names-display {
  width: 100%;
  min-height: 2rem;
  padding: .35rem .5rem;
  border: 1px solid var(--border-strong);
  border-radius: .375rem;
  background: #fff;
  font-size: 16px; /* Match textarea to prevent layout shift */
  line-height: 1.4;
  cursor: text;
  word-wrap: break-word;
}

.ams-names-display:hover {
  border-color: #9ca3af;
}

.ams-names-placeholder {
  color: #9ca3af;
}

/* Name tag styling in display mode */
.ams-name-tag {
  /* Base styling - individual colors/formatting applied via classes */
}

.ams-name-tag.ams-text-red { color: #dc2626 !important; }
.ams-name-tag.ams-text-green { color: #16a34a !important; }
.ams-name-tag.ams-text-blue { color: #2563eb !important; }
.ams-name-tag.ams-text-black { color: #000000 !important; }
.ams-name-tag.ams-text-bold { font-weight: 700 !important; }
.ams-name-tag.ams-text-underline { text-decoration: underline !important; }

/* Multi-name popover */
.ams-multiname-popover {
  min-width: 240px;
  max-width: 360px;
  padding: 12px 14px;
}

.ams-multiname-empty {
  color: #9ca3af;
  font-size: 12px;
  padding: 4px 0;
}

.ams-multiname-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid #e5e7eb;
}

.ams-multiname-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.ams-multiname-row:first-child {
  padding-top: 0;
}

.ams-multiname-label {
  font-size: 13px;
  color: #111827;
  font-weight: 600;
}

.ams-multiname-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.ams-multiname-controls-group {
  display: flex;
  gap: 4px;
  align-items: center;
}

.ams-multiname-divider {
  width: 1px;
  height: 18px;
  background: #e5e7eb;
  margin: 0 4px;
}

/* Smaller style buttons for multiname popover */
.ams-style-btn-sm {
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 3px !important;
  background: #fff !important;
  cursor: pointer;
  font-weight: 700;
  font-size: 11px;
  color: #6b7280 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  margin: 0 !important;
  transition: background .12s ease, border-color .12s ease;
  line-height: 1;
}

.ams-style-btn-sm:hover {
  background: #e5e7eb !important;
  border-color: #d1d5db !important;
}

.ams-style-btn-sm.active {
  background: #d1d5db !important;
  border-color: #9ca3af !important;
  color: #111827 !important;
}

.ams-style-btn-sm.underline {
  text-decoration: underline;
}

/* Smaller color swatches for multiname popover */
.ams-color-swatch-sm {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  max-width: 18px !important;
  border-radius: 50% !important;
  border: 2px solid transparent !important;
  cursor: pointer;
  padding: 0 !important;
  margin: 0 !important;
  transition: transform .1s ease, box-shadow .1s ease;
  flex-shrink: 0;
}

.ams-color-swatch-sm:hover {
  transform: scale(1.1);
}

.ams-color-swatch-sm.active {
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px #374151;
}

/* Legacy text color swatches removed - now using Google Sheets palette */

.ams-style-pen {
  position: absolute !important;
  top: 4px;
  right: 4px;
  z-index: 5;
  width: 14px !important;
  height: 14px !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer;
  padding: 0 !important;
  margin: 0 !important;
  color: #d1d5db !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: color .15s ease, opacity .15s ease;
  opacity: 0.5;
}

.ams-style-pen:hover,
.ams-style-pen:focus {
  color: #6b7280 !important;
  opacity: 1;
}

/* When style is active, just show pen slightly more visible (same grey) */
.ams-styled-input-wrap.has-style .ams-style-pen {
  opacity: 0.7;
}

.ams-styled-input-wrap.has-style .ams-style-pen:hover {
  opacity: 1;
}

/* Popover container */
.ams-style-popover {
  position: fixed;
  z-index: 10000;
  background: #fff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* Fade-in animation */
  animation: ams-popover-fade-in 0.15s ease-out;
}

@keyframes ams-popover-fade-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.ams-style-popover {
  min-width: 240px; /* Wider to fit 10-column color palette */
}

/* Section labels */
.ams-style-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #9ca3af;
  margin: 0;
  padding: 0;
}

.ams-style-row {
  display: flex;
  gap: 4px;
}

/* Bold / Underline buttons */
.ams-style-btn {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 4px !important;
  background: #fff !important;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  color: #6b7280 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  margin: 0 !important;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
  line-height: 1;
}

.ams-style-btn:hover {
  background: #e5e7eb !important;
  border-color: #d1d5db !important;
  color: #111827 !important;
}

.ams-style-btn.active {
  background: #d1d5db !important;
  border-color: #9ca3af !important;
  color: #111827 !important;
}

.ams-style-btn.underline {
  text-decoration: underline;
}

/* Color swatches */
.ams-style-colors {
  gap: 6px;
  justify-content: flex-start;
}

.ams-color-swatch {
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  max-width: 22px !important;
  border-radius: 50% !important;
  border: 2px solid transparent !important;
  cursor: pointer;
  padding: 0 !important;
  margin: 0 !important;
  transition: transform .1s ease, box-shadow .1s ease;
  flex-shrink: 0;
}

.ams-color-swatch:hover {
  transform: scale(1.15);
}

.ams-color-swatch.active {
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px #374151;
}

/* Legacy text color swatches (.red, .green, .blue, .black) removed - now using Google Sheets palette */

/* Google Sheets Color Palette Grid */
.ams-color-palette {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0;
}

.ams-color-palette-row {
  display: flex;
  gap: 2px;
  justify-content: flex-start;
}

.ams-palette-swatch {
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  max-width: 20px !important;
  border-radius: 50% !important;
  border: 1px solid rgba(0,0,0,0.1) !important;
  cursor: pointer;
  padding: 0 !important;
  margin: 0 !important;
  transition: transform .1s ease, box-shadow .1s ease;
  flex-shrink: 0;
}

.ams-palette-swatch:hover {
  transform: scale(1.2);
  z-index: 1;
}

.ams-palette-swatch.active {
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px #374151;
  transform: scale(1.1);
}

/* Compact palette for multiname popover */
.ams-color-palette-compact .ams-palette-swatch-sm {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  max-width: 16px !important;
}

.ams-palette-swatch-sm {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  max-width: 16px !important;
  border-radius: 50% !important;
  border: 1px solid rgba(0,0,0,0.1) !important;
  cursor: pointer;
  padding: 0 !important;
  margin: 0 !important;
  transition: transform .1s ease, box-shadow .1s ease;
  flex-shrink: 0;
}

.ams-palette-swatch-sm:hover {
  transform: scale(1.25);
  z-index: 1;
}

.ams-palette-swatch-sm.active {
  box-shadow: 0 0 0 1px #fff, 0 0 0 2px #374151;
}

/* Color picker button for multiname */
.ams-multiname-color-picker-wrapper {
  position: relative;
}

.ams-color-picker-btn {
  width: 24px !important;
  height: 24px !important;
  min-width: 24px !important;
  border-radius: 4px !important;
  border: 1px solid #d1d5db !important;
  cursor: pointer;
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .12s ease;
}

.ams-color-picker-btn:hover {
  border-color: #9ca3af !important;
}

.ams-color-picker-btn.has-color {
  border-color: rgba(0,0,0,0.2) !important;
}

.ams-color-picker-icon {
  font-weight: 700;
  font-size: 12px;
  text-shadow: 0 0 2px rgba(0,0,0,0.3);
}

/* Color palette dropdown */
.ams-color-palette-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 4px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 100;
  min-width: 200px;
}

.ams-color-palette-dropdown .ams-color-palette {
  gap: 1px;
}

.ams-color-palette-dropdown .ams-color-palette-row {
  gap: 1px;
}

.ams-clear-color-btn {
  width: 100%;
  margin-top: 8px;
  padding: 4px 8px !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 4px !important;
  background: #fff !important;
  color: #6b7280 !important;
  font-size: 10px;
  cursor: pointer;
  transition: background .12s ease;
}

.ams-clear-color-btn:hover {
  background: #f3f4f6 !important;
  color: #111827 !important;
}

/* Reset button */
.ams-style-reset {
  width: 100%;
  padding: 6px 8px !important;
  margin-top: 2px;
  border: 1px solid #e5e7eb !important;
  border-radius: 4px !important;
  background: #fff !important;
  color: #6b7280 !important;
  font-size: 11px;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}

.ams-style-reset:hover {
  background: #f3f4f6 !important;
  color: #111827 !important;
}

/* Background color toggle (Zelle/Zeile) */
.ams-bg-toggle {
  gap: 4px;
  margin-bottom: 4px;
}
.ams-toggle-btn {
  flex: 1;
  padding: 4px 8px !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 4px !important;
  background: #fff !important;
  color: #6b7280 !important;
  font-size: 11px;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.ams-toggle-btn:hover {
  background: #f3f4f6 !important;
}
.ams-toggle-btn.active {
  background: #374151 !important;
  color: #fff !important;
  border-color: #374151 !important;
}

/* Default cell background */
.ams-table td { background: #fff; }

/* Row background colors - apply to both tr and td children */
.ams-table tr.ams-row-bg-red,
.ams-table tr.ams-row-bg-red td { background: #fecaca !important; }
.ams-table tr.ams-row-bg-green,
.ams-table tr.ams-row-bg-green td { background: #bbf7d0 !important; }
.ams-table tr.ams-row-bg-blue,
.ams-table tr.ams-row-bg-blue td { background: #bfdbfe !important; }
.ams-table tr.ams-row-bg-orange,
.ams-table tr.ams-row-bg-orange td { background: #ff9900 !important; }

/* Cell background colors (override row bg) */
.ams-table td.ams-cell-bg-red { background: #fecaca !important; }
.ams-table td.ams-cell-bg-green { background: #bbf7d0 !important; }
.ams-table td.ams-cell-bg-blue { background: #bfdbfe !important; }
.ams-table td.ams-cell-bg-orange { background: #ff9900 !important; }

/* Mobile adjustments for style popover */
@media (max-width: 768px) {
  .ams-style-pen {
    opacity: 0.7;
  }

  .ams-style-popover {
    /* Center popover on mobile */
    left: 50% !important;
    transform: translateX(-50%);
    top: auto !important;
    bottom: 120px;
  }
}

/* === Cleaned checkbox styling === */
.ams-cleaned-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #16a34a; /* green-600 */
}

/* === Disabled inputs - more readable on mobile === */
.ams-input:disabled,
.ams-textarea:disabled,
.ams-select:disabled {
  opacity: 1; /* Override browser default fade */
  color: inherit; /* Preserve styled text colors (red, green, blue) */
  background: #f9fafb; /* Very light grey background */
  cursor: not-allowed;
  -webkit-text-fill-color: inherit; /* iOS Safari - preserve styled colors */
}

/* === Mobile table optimizations === */
@media (max-width: 768px) {
  /* Hide "Manual" badge on mobile */
  .ams-badge.muted {
    display: none;
  }

  /* Fix multiname overlay - ensure input text stays invisible */
  .ams-multiname-input {
    color: transparent !important;
    -webkit-text-fill-color: transparent !important;
  }

  /* Personal Name column - remove max-width so cell expands to fit names (ALL roles) */
  .ams-table .col-personal {
    max-width: none !important;
    width: auto !important;
  }

  /* Personal Name - all names inline, including placeholder (ALL roles) */
  .ams-table .col-personal .ams-multiname-display,
  .ams-table .col-personal .ams-input,
  .ams-table .col-personal .ams-multiname-input {
    white-space: nowrap;
  }

  /* Reduce row height on mobile (compact only) */
  .ams-table--compact td {
    padding: 0.5rem 0.5rem !important;
  }
}

/* === Mobile Zoom Controls === */
.ams-zoom-controls {
  display: none; /* Hidden on desktop by default */
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}

.ams-zoom-btn {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  padding: 0 !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: 6px !important;
  background: #fff !important;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation; /* Prevent double-tap zoom */
}

.ams-zoom-btn:hover {
  background: #f3f4f6 !important;
}

.ams-zoom-btn:active {
  background: #e5e7eb !important;
}

.ams-zoom-level {
  font-size: var(--fs-12);
  color: var(--muted);
  min-width: 40px;
  text-align: center;
  user-select: none;
}

/* Zoom wrapper for scaled table */
.ams-zoom-wrapper {
  transform-origin: top left;
  transition: transform 0.15s ease-out;
}

/* Mobile: show zoom controls and enable zoom functionality */
@media (max-width: 768px) {
  .ams-zoom-controls {
    display: flex;
  }

  /* Outer container clips and scrolls the scaled content */
  .ams-table-wrap.ams-table-wrap--zoomed {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Full table keeps 1400px width for zoom */
  .ams-table-wrap--zoomed .ams-table:not(.ams-table--compact) {
    min-width: 1400px;
    width: 1400px;
  }

  /* Compact table (cleaning/housekeeping) - much narrower! */
  .ams-table-wrap--zoomed .ams-table.ams-table--compact {
    min-width: 500px !important;
    width: 500px !important;
  }
}