/* ===================================================
   THE TACHBROOK GUIDEBOOK — DESIGN SYSTEM
   Card-based, mobile-first guest experience
   =================================================== */

/* --- 1. DESIGN TOKENS --- */
:root {
  /* Brand */
  --color-primary: #1a1a2e;
  --color-primary-light: #2d2d4a;
  --color-accent: #e8a838;
  --color-accent-hover: #d49630;

  /* Surfaces */
  --color-bg: #f5f2ee;
  --color-surface: #ffffff;
  --color-surface-alt: #f8f6f3;

  /* Text */
  --color-text: #1a1a2e;
  --color-text-secondary: #6b6b7b;
  --color-text-muted: #9b9bab;
  --color-text-inverse: #ffffff;

  /* Borders & shadows */
  --color-border: #e8e5e0;
  --color-border-light: #f0ede8;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-card-hover: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-sheet: 0 -4px 32px rgba(0,0,0,0.12);
  --shadow-fab: 0 4px 16px rgba(0,0,0,0.16);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Layout */
  --header-height: 56px;
  --content-max-width: 600px;
  --fab-size: 56px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-sheet: 350ms cubic-bezier(0.32, 0.72, 0, 1);

  /* Status */
  --color-success: #2d8a4e;
  --color-success-bg: #e8f5ec;
  --color-error: #c53030;
  --color-error-bg: #fee;
  --color-info: #2b6cb0;
  --color-info-bg: #ebf4ff;
}

/* --- 2. RESET & BASE --- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.sheet-open {
  overflow: hidden;
}

h1, h2, h3, h4 { margin: 0 0 var(--space-sm) 0; line-height: 1.3; font-weight: 600; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.1rem; }

p { margin: 0 0 var(--space-md) 0; }
p:last-child { margin-bottom: 0; }

a { color: var(--color-accent-hover); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* Material Symbols config */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
}

/* Filled variant */
.material-symbols-outlined.filled {
  font-variation-settings: 'FILL' 1, 'wght' 300, 'GRAD' 0, 'opsz' 24;
}

/* --- 3. APP HEADER --- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-md);
}

.app-header .logo {
  height: 28px;
  width: auto;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
  border-radius: var(--radius-full);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}
.header-btn:hover {
  background: var(--color-surface-alt);
}

/* Language picker (header) */
.lang-select {
  appearance: none;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: 6px 28px 6px 12px;
  font-size: 0.8rem;
  color: var(--color-text);
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b6b7b' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

/* --- 4. MAIN CONTENT AREA --- */
.app-content {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: var(--space-md);
  padding-bottom: var(--space-2xl);
}

/* --- 5. WELCOME SECTION --- */
.welcome-section {
  text-align: center;
  padding: var(--space-xl) 0 var(--space-lg);
}

.welcome-greeting {
  font-family: 'Marcellus', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
}

.welcome-subtitle {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin: 0;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

.welcome-dates {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: var(--space-sm) var(--space-md);
  margin-top: var(--space-md);
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.welcome-dates .material-symbols-outlined {
  font-size: 18px;
  color: var(--color-text-secondary);
}

/* --- 6. QUICK ACTIONS (Priority Cards) --- */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.quick-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  cursor: pointer;
  transition: box-shadow var(--transition-normal), border-color var(--transition-normal);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.quick-card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: var(--color-border-light);
  text-decoration: none;
}

.quick-card:active {
  transform: scale(0.98);
}

.quick-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.quick-card-icon .material-symbols-outlined {
  font-size: 24px;
  color: var(--color-text);
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24;
}

.quick-card-label {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.2;
}

.quick-card-hint {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.3;
}

/* Full-width card variant */
.quick-card.full-width {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  gap: var(--space-md);
}

.quick-card.full-width .quick-card-icon .material-symbols-outlined {
  font-size: 26px;
}

.quick-card.full-width .quick-card-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* --- 7. SECTION CARDS GRID --- */
.section-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin: var(--space-lg) 0 var(--space-sm);
  padding-left: var(--space-xs);
}

.section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.section-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  cursor: pointer;
  transition: box-shadow var(--transition-normal), border-color var(--transition-normal);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-sm);
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.section-card:hover {
  box-shadow: var(--shadow-card-hover);
  text-decoration: none;
}

.section-card:active {
  transform: scale(0.98);
}

.section-card-icon .material-symbols-outlined {
  font-size: 22px;
  color: var(--color-text-secondary);
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24;
}

.section-card-label {
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--color-text-secondary);
}

/* Noticeboard slot should span full width in grid */
#noticeboard-quick-card-slot {
  grid-column: 1 / -1;
}

/* --- 8. BOTTOM SHEET --- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-sheet), visibility var(--transition-sheet);
}

.sheet-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 201;
  background: var(--color-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-sheet);
  max-height: 90vh;
  transform: translateY(100%);
  transition: transform var(--transition-sheet);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bottom-sheet.open {
  transform: translateY(0);
  min-height: 30vh;
}

.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  margin: var(--space-sm) auto;
  flex-shrink: 0;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md) var(--space-md);
  border-bottom: 1px solid var(--color-border-light);
  flex-shrink: 0;
}

.sheet-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.sheet-header-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.sheet-header-icon .material-symbols-outlined {
  font-size: 22px;
  color: var(--color-text);
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24;
}

.sheet-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.sheet-close {
  background: none;
  border: none;
  padding: var(--space-sm);
  cursor: pointer;
  border-radius: var(--radius-full);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}
.sheet-close:hover {
  background: var(--color-surface-alt);
}

.sheet-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-lg) var(--space-md) var(--space-2xl);
  flex: 1;
}

/* Content inside sheets */
.sheet-body h2 {
  font-size: 1.1rem;
  margin: var(--space-lg) 0 var(--space-sm);
}
.sheet-body h2:first-child {
  margin-top: 0;
}

.sheet-body p {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
}

.sheet-body ul, .sheet-body ol {
  padding-left: var(--space-lg);
  color: var(--color-text-secondary);
  font-size: 0.95rem;
}

.sheet-body li {
  margin-bottom: var(--space-sm);
}

.sheet-body a {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

/* Video container */
.sheet-body .video-container {
  position: relative;
  overflow: hidden;
  width: 100%;
  padding-top: 56.25%;
  margin: var(--space-md) 0;
  border-radius: var(--radius-md);
}
.sheet-body .video-container iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}

/* --- 9. WIFI CARD (Special inline) --- */
.wifi-inline {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  cursor: pointer;
  transition: box-shadow var(--transition-normal);
  -webkit-tap-highlight-color: transparent;
}

.wifi-inline:hover {
  box-shadow: var(--shadow-card-hover);
}

.wifi-inline:active {
  transform: scale(0.98);
}

.wifi-icon-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: #2b6cb0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wifi-icon-box .material-symbols-outlined {
  font-size: 24px;
  color: white;
}

.wifi-details {
  flex: 1;
  min-width: 0;
}

.wifi-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin: 0;
}

.wifi-password {
  font-size: 1.1rem;
  font-weight: 600;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--color-text);
  margin: 0;
  word-break: break-all;
}

.wifi-copy-icon {
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.wifi-copied {
  font-size: 0.8rem;
  color: var(--color-success);
  font-weight: 500;
}

/* --- 10. SMART CONTROLS (HA Dashboard inline) --- */
#ha-section {
  margin-bottom: var(--space-lg);
}

#ha-dashboard {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.ha-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin: var(--space-sm) 0;
}

/* Climate entity */
.climate-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: 0;
}

.climate-entity {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: var(--space-xs) var(--space-md);
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-border-light);
}
.climate-entity:last-child {
  border-bottom: none;
}

.climate-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  grid-column: 1 / 2;
}

.climate-current-temp {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  grid-column: 1 / 2;
}

.climate-set-temp-display {
  grid-row: 1 / 3;
  grid-column: 2 / 3;
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.climate-slider-container {
  grid-column: 1 / 3;
  width: 100%;
  padding-top: var(--space-xs);
}

/* Light control */
.light-control-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.light-control-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.light-control-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.light-header-controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.light-refresh-btn {
  background: none;
  border: none;
  padding: var(--space-xs);
  cursor: pointer;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  color: var(--color-text-muted);
}
.light-refresh-btn:hover {
  background: var(--color-border-light);
  color: var(--color-text-secondary);
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.light-control-card.is-refreshing .light-refresh-btn .material-symbols-outlined {
  animation: spin 1s linear infinite;
}
.light-control-card.is-refreshing .light-refresh-btn {
  pointer-events: none;
}

/* Toggle switch */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--color-border);
  transition: background var(--transition-normal);
  border-radius: var(--radius-full);
}
.slider::before {
  content: "";
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: transform var(--transition-normal);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
input:checked + .slider {
  background-color: var(--color-accent);
}
input:checked + .slider::before {
  transform: translateX(20px);
}
input:disabled + .slider {
  cursor: not-allowed;
  opacity: 0.4;
}

/* Light slider group */
.light-slider-group {
  display: none;
  flex-direction: column;
  gap: var(--space-sm);
}

.light-slider-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.light-slider-row .material-symbols-outlined {
  color: var(--color-text-muted);
  font-size: 20px;
}
.light-slider-value {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  min-width: 36px;
  text-align: right;
}

.light-unavailable-notice {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-sm);
  padding: var(--space-md) 0;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}
.light-unavailable-notice .material-symbols-outlined {
  font-size: 28px;
}
.light-control-card.is-unavailable .light-controls-wrapper { display: none; }
.light-control-card.is-unavailable .light-unavailable-notice { display: flex; }

/* Status card (presence) */
.ha-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.ha-card-title {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-weight: 600;
  margin: 0 0 var(--space-sm);
}
.ha-card-status {
  font-size: 1.5rem;
  font-weight: 700;
  transition: color var(--transition-normal);
}

/* Range inputs */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  outline: none;
  opacity: 0.8;
  transition: opacity var(--transition-fast);
}
input[type="range"]:hover { opacity: 1; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  background: var(--color-accent);
  cursor: pointer;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--color-accent);
  cursor: pointer;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

/* --- 11. COMMUNICATION CARDS --- */
.comm-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.comm-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  cursor: pointer;
  transition: box-shadow var(--transition-normal), border-color var(--transition-normal);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-sm);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.comm-card:hover {
  box-shadow: var(--shadow-card-hover);
}
.comm-card:active {
  transform: scale(0.98);
}
.comm-card .material-symbols-outlined {
  font-size: 22px;
  color: var(--color-text-secondary);
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24;
}
.comm-card-label {
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--color-text-secondary);
}
.comm-card-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  line-height: 1.3;
}

/* Noticeboard slot should not break grid */
#noticeboard-quick-card-slot {
  display: contents;
}

/* Chat sheet specific */
.chat-sheet {
  max-height: 85vh;
}

.chat-sheet .sheet-body {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
}

.ai-chat-feed {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding-bottom: var(--space-md);
  min-height: 200px;
}

.ai-chat-feed p { margin: 0; line-height: 1.5; }

.message-bubble {
  padding: var(--space-sm) var(--space-md);
  max-width: 85%;
  width: fit-content;
  font-size: 0.9rem;
  line-height: 1.5;
  word-break: break-word;
}

.bot-message {
  background: var(--color-surface-alt);
  color: var(--color-text);
  align-self: flex-start;
  border-radius: var(--radius-md) var(--radius-md) var(--radius-md) var(--space-xs);
}

.user-message {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  align-self: flex-end;
  border-radius: var(--radius-md) var(--radius-md) var(--space-xs) var(--radius-md);
}

.timestamp {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin: 0;
}
.user-message + .timestamp { align-self: flex-end; }
.bot-message + .timestamp { align-self: flex-start; }

.ai-chat-input-area {
  border-top: 1px solid var(--color-border-light);
  padding-top: var(--space-md);
  display: flex;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.ai-chat-input-area #user-input {
  flex-grow: 1;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: 10px 16px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  background: var(--color-surface-alt);
  color: var(--color-text);
  transition: border-color var(--transition-fast);
}
.ai-chat-input-area #user-input:focus {
  border-color: var(--color-accent);
}
.ai-chat-input-area #user-input::placeholder {
  color: var(--color-text-muted);
}

.ai-chat-input-area #send-btn {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border: none;
  border-radius: var(--radius-full);
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}
.ai-chat-input-area #send-btn:hover {
  background: var(--color-primary-light);
}

#chat-input-container.loading #user-input,
#chat-input-container.loading #send-btn {
  opacity: 0.5;
  cursor: wait;
  pointer-events: none;
}

/* Suggestion chips */
.suggestions-container {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding: var(--space-xs) 0 var(--space-sm);
}

.suggestion-chip {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--color-text);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.suggestion-chip:hover {
  background: var(--color-surface-alt);
  border-color: var(--color-accent);
}

/* --- 12. NOTICEBOARD (in sheet) --- */
.noticeboard-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.noticeboard-description {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-sm);
}

.noticeboard-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.noticeboard-since {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.noticeboard-translate-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.noticeboard-translate-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
.noticeboard-switch {
  transform: scale(0.75);
  transform-origin: right center;
}

.noticeboard-feed {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  max-height: 400px;
  overflow-y: auto;
}

.noticeboard-empty {
  text-align: center;
  color: var(--color-text-muted);
  padding: var(--space-xl) 0;
  margin: 0;
}

.noticeboard-post {
  padding: var(--space-sm) var(--space-md);
  max-width: 85%;
  border-radius: var(--radius-md);
}

.noticeboard-post-own {
  align-self: flex-end;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-radius: var(--radius-md) var(--radius-md) var(--space-xs) var(--radius-md);
}

.noticeboard-post-other {
  align-self: flex-start;
  background: var(--color-surface-alt);
  border-radius: var(--radius-md) var(--radius-md) var(--radius-md) var(--space-xs);
}

.noticeboard-post-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-sm);
}

.noticeboard-delete-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 1rem;
  cursor: pointer;
  padding: 0 var(--space-xs);
  line-height: 1;
}
.noticeboard-delete-btn:hover { color: var(--color-error); }

.noticeboard-post-message {
  margin: 0 0 var(--space-xs);
  font-size: 0.9rem;
  line-height: 1.5;
}

.noticeboard-post-message.noticeboard-translating {
  opacity: 0.5;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

.noticeboard-post-meta {
  margin: 0;
  font-size: 0.75rem;
  opacity: 0.6;
}
.noticeboard-post-own .noticeboard-post-meta {
  text-align: right;
}

.noticeboard-input-area {
  border-top: 1px solid var(--color-border-light);
  padding-top: var(--space-md);
  flex-shrink: 0;
}

.noticeboard-input-row {
  display: flex;
  gap: var(--space-sm);
}

.noticeboard-input {
  flex-grow: 1;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: 10px 16px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  background: var(--color-surface-alt);
  color: var(--color-text);
}
.noticeboard-input:focus {
  border-color: var(--color-accent);
}

.noticeboard-post-btn {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border: none;
  border-radius: var(--radius-full);
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.noticeboard-post-btn:hover { background: var(--color-primary-light); }
.noticeboard-post-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.noticeboard-input-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
}

/* Badge on noticeboard quick card */
.quick-card-badge {
  background: var(--color-error);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.quick-card-badge.visible {
  display: flex;
}

/* --- 13. TOAST NOTIFICATION --- */
.toast {
  position: fixed;
  bottom: calc(var(--fab-size) + var(--space-xl));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-fab);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
  z-index: 300;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* --- 14. ERROR PAGE --- */
.error-page {
  text-align: center;
  padding: var(--space-2xl) var(--space-md);
}

.error-page .material-symbols-outlined {
  font-size: 48px;
  color: var(--color-error);
  margin-bottom: var(--space-md);
}

.error-page p {
  color: var(--color-text-secondary);
  max-width: 400px;
  margin: var(--space-sm) auto;
}

/* --- 15. DESKTOP OVERRIDES --- */
@media (min-width: 768px) {
  .app-content {
    padding: var(--space-xl) var(--space-md);
  }

  .bottom-sheet {
    left: 50%;
    right: auto;
    width: 480px;
    margin-left: -240px;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }

  .section-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .quick-actions {
    grid-template-columns: repeat(4, 1fr);
  }

  .quick-card.full-width {
    grid-column: span 2;
  }
}

@media (min-width: 1024px) {
  .bottom-sheet {
    width: 560px;
    margin-left: -280px;
  }
}

/* --- 16. PRINT --- */
@media print {
  .app-header, .chat-fab, .sheet-backdrop, .bottom-sheet, .toast { display: none !important; }
  body { background: white; color: black; }
}

/* --- 17. UTILITY --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: var(--space-sm) var(--space-md);
  align-self: flex-start;
}
.typing-indicator span {
  width: 6px;
  height: 6px;
  background: var(--color-text-muted);
  border-radius: 50%;
  animation: typing-bounce 1.4s ease-in-out infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Loading skeleton shimmer */
.skeleton {
  background: linear-gradient(90deg, var(--color-surface-alt) 25%, var(--color-border-light) 50%, var(--color-surface-alt) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Noticeboard badge in header */
.noticeboard-badge {
  background: var(--color-accent);
  color: var(--color-text-inverse);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

/* --- 18. ROOM TABS (multi-room bookings) --- */

.room-tabs {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0 0 var(--space-md) 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.room-tab {
  flex-shrink: 0;
  padding: 6px var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  font-size: 0.8rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

/* --- 19. TV REMOTE --- */

.tv-remote-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-md) var(--space-sm);
}

.tv-remote-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-align: center;
  margin-bottom: var(--space-md);
}

/* App launcher — subtle text buttons */
.tv-app-grid {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.tv-app-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--color-text-muted);
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  flex: 1;
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}
.tv-app-btn:active {
  background: var(--color-border-light);
  color: var(--color-text);
}
.tv-app-btn svg {
  display: block;
}

/* D-pad navigation — borderless arrows, gold OK */
.tv-dpad {
  display: grid;
  grid-template-columns: 44px 48px 44px;
  grid-template-rows: 44px 48px 44px;
  gap: 2px;
  align-items: center;
  justify-items: center;
  justify-content: center;
  margin-bottom: var(--space-md);
}

.tv-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-full);
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  font-family: inherit;
  transition: background 0.1s ease;
}

.tv-btn:active, .tv-btn-pressed {
  background: var(--color-border-light);
}

.tv-btn .material-symbols-outlined {
  font-size: 24px;
  color: var(--color-text-muted);
}

.tv-dpad-btn {
  width: 44px;
  height: 44px;
}

.tv-btn-ok {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  color: var(--color-text-inverse);
  font-size: 0.8rem;
  font-weight: 700;
  border: none;
}
.tv-btn-ok:active {
  background: var(--color-accent-hover);
}

/* Volume + utility — centered, borderless */
.tv-controls-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  padding-top: var(--space-sm);
}

.tv-controls-row .tv-btn {
  width: 40px;
  height: 40px;
}
.tv-controls-row .tv-btn .material-symbols-outlined {
  font-size: 20px;
}
