@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&family=Playfair+Display:wght@600;700&display=swap');

:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --surface-2: #f0ede6;
  --text: #292722;
  --muted: #858078;
  --primary: #781f2a;
  --primary-dark: #5b1520;
  --gold: #c99c54;
  --border: #e9e5dc;
  --green: #39815e;
  --red: #c34c4c;
  --shadow: 0 8px 30px rgba(35, 28, 20, .045);
  --radius: 17px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
}

button, input, select, textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(201,156,84,.45);
  outline-offset: 2px;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
}

/* SIDEBAR */

.sidebar {
  width: 255px;
  position: fixed;
  inset: 0 auto 0 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 27px 17px;
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 9px 30px;
}

.brand-icon {
  background: var(--primary);
  color: white;
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  font-family: 'Playfair Display', serif;
  font-size: 24px;
}

.brand strong {
  display: block;
  font-size: 19px;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
}

.nav-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--muted);
  padding: 0 12px;
  margin: 10px 0;
}

.side-nav {
  display: grid;
  gap: 5px;
}

.nav-item {
  border: 0;
  background: transparent;
  color: #68635d;
  text-align: left;
  padding: 13px 14px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  gap: 13px;
  font-size: 14px;
  font-weight: 600;
}

.nav-item span {
  width: 20px;
  font-size: 20px;
  text-align: center;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--primary);
}

.nav-item.active {
  background: #f6e9e9;
  color: var(--primary);
}

.sidebar-bottom {
  margin-top: auto;
}

.help-card {
  background: #f6f1e8;
  padding: 17px;
  border-radius: 15px;
  margin-bottom: 20px;
}

.help-icon {
  background: #ead9b9;
  color: #765021;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  margin-bottom: 12px;
}

.help-card strong {
  font-size: 13px;
}

.help-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.help-card button {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 700;
  padding: 5px 0;
}

.sidebar-footer {
  font-size: 10px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
}

/* MAIN */

.main-content {
  margin-left: 255px;
  min-height: 100vh;
}

.topbar {
  height: 78px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.search-container {
  max-width: 540px;
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 13px;
  height: 43px;
  border-radius: 11px;
  gap: 10px;
}

.search-container > span {
  font-size: 23px;
  color: var(--muted);
}

.search-container input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 12px;
}

kbd {
  font-size: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 4px 6px;
  border-radius: 5px;
  color: var(--muted);
}

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

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  color: var(--text);
}

.icon-button:hover {
  border-color: var(--gold);
}

.user-avatar {
  width: 37px;
  height: 37px;
  display: grid;
  place-items: center;
  background: #f0e1d3;
  color: var(--primary);
  border-radius: 50%;
  font-weight: 800;
}

.page-content {
  padding: 35px 40px 55px;
  max-width: 1500px;
  margin: auto;
}

.main-footer {
  border-top: 1px solid var(--border);
  padding: 20px 40px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}

/* TYPOGRAPHY */

.eyebrow {
  color: var(--primary);
  font-size: 11px;
  letter-spacing: 1.5px;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 10px;
}

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

h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(27px, 3vw, 38px);
  margin-bottom: 9px;
}

h2 {
  font-family: 'Playfair Display', serif;
  font-size: 23px;
}

h3 {
  font-size: 15px;
}

.subtitle {
  color: var(--muted);
  line-height: 1.7;
  font-size: 13px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin: 35px 0 17px;
}

.section-heading h2 {
  margin: 0;
}

.section-heading button {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

/* BUTTONS */

.primary {
  background: var(--primary);
  color: white;
  border: 0;
  padding: 12px 19px;
  border-radius: 10px;
  font-weight: 700;
  transition: .2s;
}

.primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.secondary {
  background: var(--surface);
  color: var(--primary);
  border: 1px solid var(--border);
  padding: 11px 17px;
  border-radius: 10px;
  font-weight: 700;
}

.secondary:hover {
  border-color: var(--gold);
}

.danger {
  background: #fff0ef;
  color: var(--red);
  border: 1px solid #f0d4d2;
  padding: 10px 14px;
  border-radius: 9px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 700;
}

/* HERO */

.hero {
  background: linear-gradient(120deg, #641923, #8d3540);
  color: white;
  padding: 35px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  overflow: hidden;
  position: relative;
}

.hero h1 {
  font-size: 36px;
}

.hero p {
  color: #f2dfe0;
  max-width: 480px;
  font-size: 13px;
  line-height: 1.8;
}

.hero .eyebrow {
  color: #e7c68d;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.hero .primary {
  background: #e7c68d;
  color: #51202a;
}

.hero .secondary {
  background: transparent;
  color: white;
  border-color: rgba(255,255,255,.3);
}

.hero-art {
  font-size: 105px;
  opacity: .85;
  padding: 0 20px;
}

/* CARDS */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
}

.stat-card, .card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 19px;
  box-shadow: var(--shadow);
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 13px;
}

.stat-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: #f4e9e7;
  color: var(--primary);
  font-size: 23px;
}

.stat-card strong {
  font-size: 24px;
  display: block;
}

.stat-card small {
  color: var(--muted);
  font-size: 11px;
}

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

.machine-card {
  overflow: hidden;
  padding: 0;
}

.machine-image {
  height: 145px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  font-size: 65px;
  position: relative;
}

.machine-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.machine-content {
  padding: 17px;
}

.machine-content h3 {
  margin-bottom: 5px;
}

.machine-content p {
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 12px;
}

.machine-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.machine-bottom button {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 700;
  font-size: 11px;
}

.favorite-button {
  color: var(--gold) !important;
  font-size: 20px !important;
}

.tag {
  display: inline-block;
  background: #f2eee6;
  color: #776b58;
  padding: 5px 9px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
}

/* QUICK ACTIONS */

.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.quick-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 19px;
  border-radius: 14px;
  text-align: left;
  color: var(--text);
}

.quick-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
}

.quick-card span {
  display: block;
  font-size: 27px;
  margin-bottom: 12px;
  color: var(--primary);
}

.quick-card strong {
  display: block;
  font-size: 13px;
}

.quick-card small {
  color: var(--muted);
  display: block;
  margin-top: 5px;
  font-size: 11px;
}

/* GUIDES */

.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
}

.guide-card {
  cursor: pointer;
  transition: .2s;
}

.guide-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
}

.guide-icon {
  font-size: 32px;
  margin-bottom: 14px;
}

.guide-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

/* LISTS */

.list {
  display: grid;
  gap: 10px;
}

.list-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.list-item p {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--muted);
}

/* FORMS */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

.form-group {
  display: grid;
  gap: 7px;
}

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

.form-group label {
  font-size: 12px;
  font-weight: 700;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg);
  color: var(--text);
  outline: none;
}

.form-group textarea {
  min-height: 90px;
  resize: vertical;
}

/* MODALS */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20,15,15,.55);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 100;
}

.modal {
  width: min(550px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  padding: 25px;
  border-radius: 18px;
  box-shadow: 0 20px 70px rgba(0,0,0,.2);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h2 {
  margin: 0;
}

.close-button {
  background: var(--surface-2);
  border: 0;
  width: 35px;
  height: 35px;
  border-radius: 9px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* EMPTY STATES */

.empty-state {
  background: var(--surface);
  border: 1px dashed var(--border);
  padding: 45px 20px;
  text-align: center;
  border-radius: 15px;
}

.empty-state span {
  font-size: 40px;
}

.empty-state p {
  color: var(--muted);
  font-size: 12px;
}

/* DETAIL AND GUIDE STEPS */

.detail-panel {
  background: var(--surface);
  padding: 25px;
  border: 1px solid var(--border);
  border-radius: 17px;
}

.error-code-actions {
  display: flex;
  gap: 15px;
  margin-top: 10px;
}

.error-code-item {
  align-items: flex-start;
}

.safety-note {
  background: #fff5e6;
  color: #704d20;
  border-left: 4px solid #c99c54;
  border-radius: 8px;
  padding: 12px 14px;
  line-height: 1.6;
  font-size: 13px;
  margin: 12px 0;
}

.guide-intro {
  padding: 16px;
  border-radius: 13px;
  background: var(--surface-2);
  margin-bottom: 16px;
  line-height: 1.65;
}

.guide-intro p:last-child { margin-bottom: 0; }
.guide-illustration { font-size: 42px; margin-bottom: 8px; }
.guide-tip { padding: 8px 4px; line-height: 1.6; }
.error-search-wrap { margin: 12px 0; }
.error-code-item[hidden] { display: none; }

.sidebar { overflow-y: auto; }
.care-frequency-grid, .safety-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.care-frequency-grid { margin: 22px 0; }
.care-frequency-grid .card p { margin: 10px 0 0; color: var(--muted); line-height: 1.55; }
.care-card-actions, .speech-controls, .maintenance-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.safety-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.safety-card h2 { font-size: 19px; }
.safety-card p, .trouble-result li, .care-steps li { color: var(--muted); line-height: 1.7; }
.safety-card.serious { border: 2px solid #b33b35; background: #fff4f2; }
.safety-card.serious h2, .safety-card.serious .safety-symbol { color: #a42c27; }
.safety-symbol { color: var(--gold); font-size: 23px; font-weight: 900; }
.overdue-heading, .task-overdue strong { color: var(--red); }
.trouble-result { margin-top: 20px; }
.pdf-viewer { width: 100%; min-height: 62vh; border: 1px solid var(--border); border-radius: 10px; background: white; }
.modal:has(.pdf-viewer) { width: min(920px, 100%); }
.video-frame { width: 100%; aspect-ratio: 16 / 9; background: #111; border-radius: 12px; overflow: hidden; }
.video-frame iframe { width: 100%; height: 100%; border: 0; }
.assistant-answer { margin-top: 18px; }
.speech-controls label { font-size: 12px; font-weight: 700; }
.speech-controls input[type="range"] { vertical-align: middle; }
.task-overdue p { color: var(--red); font-weight: 700; }
.error-search-wrap input { width: 100%; padding: 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg); color: var(--text); }

body.dark .safety-card.serious { background: #422624; border-color: #9d4943; }

body.dark .safety-note {
  background: #42392b;
  color: #f0d9ae;
}

.step-number {
  background: #f5e9e7;
  color: var(--primary);
  padding: 10px;
  border-radius: 10px;
  display: inline-block;
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 15px;
}

.progress {
  height: 7px;
  background: var(--surface-2);
  border-radius: 20px;
  overflow: hidden;
  margin: 15px 0;
}

.progress-bar {
  height: 100%;
  background: var(--gold);
  transition: width .2s;
}

/* TOAST */

#toast-root {
  position: fixed;
  bottom: 25px;
  right: 25px;
  z-index: 200;
}

.toast {
  background: #292722;
  color: white;
  padding: 13px 18px;
  border-radius: 10px;
  margin-top: 8px;
  font-size: 12px;
  box-shadow: var(--shadow);
}

/* MOBILE */

.mobile-menu,
.mobile-brand,
.mobile-bottom-nav {
  display: none;
}

/* DARK THEME */

body.dark {
  --bg: #1c1b1a;
  --surface: #282624;
  --surface-2: #34312e;
  --text: #f2eee8;
  --muted: #aaa29a;
  --border: #403b37;
  --shadow: 0 8px 30px rgba(0,0,0,.15);
}

body.dark .nav-item.active {
  background: #49272c;
}

body.dark .help-card {
  background: #39332b;
}

body.dark .quick-card,
body.dark .machine-card,
body.dark .stat-card,
body.dark .card {
  color: var(--text);
}

body.dark .search-container {
  background: var(--surface-2);
}

body.dark .form-group input,
body.dark .form-group select,
body.dark .form-group textarea {
  background: var(--surface-2);
}

body.dark .hero {
  background: linear-gradient(120deg, #45141c, #722b35);
}

/* RESPONSIVE */

@media(max-width: 1050px) {
  .machine-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

@media(max-width: 760px) {

  .sidebar {
    transform: translateX(-100%);
    transition: .25s;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .topbar {
    height: 65px;
    padding: 0 15px;
    gap: 10px;
  }

  .mobile-menu,
  .mobile-brand {
    display: block;
  }

  .mobile-menu {
    border: 0;
    background: transparent;
    font-size: 22px;
  }

  .mobile-brand {
    font-weight: 800;
    font-size: 14px;
    white-space: nowrap;
  }

  .search-container {
    display: flex;
    height: 37px;
    min-width: 70px;
    max-width: none;
    padding: 0 8px;
    gap: 6px;
  }

  .search-container kbd {
    display: none;
  }

  .search-container input {
    font-size: 11px;
  }

  .mobile-brand {
    display: none;
  }

  .top-actions {
    margin-left: auto;
  }

  .user-avatar {
    display: none;
  }

  .page-content {
    padding: 22px 15px 100px;
  }

  .hero {
    padding: 25px;
  }

  .hero h1 {
    font-size: 28px;
  }

  .hero-art {
    display: none;
  }

  .machine-grid,
  .guide-grid,
  .care-frequency-grid,
  .safety-grid {
    grid-template-columns: 1fr;
  }

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

  .stats-grid {
    gap: 9px;
  }

  .stat-card {
    padding: 12px;
  }

  .stat-card strong {
    font-size: 20px;
  }

  .stat-icon {
    width: 36px;
    height: 36px;
  }

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

  .form-group.full {
    grid-column: auto;
  }

  .main-footer {
    padding: 15px;
    font-size: 10px;
    gap: 10px;
  }

  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    inset-inline: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    justify-content: space-around;
    padding: 9px 3px calc(9px + env(safe-area-inset-bottom));
    z-index: 30;
  }

  .mobile-bottom-nav button {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 10px;
    display: grid;
    justify-items: center;
    gap: 4px;
  }

  .mobile-bottom-nav button span {
    font-size: 20px;
  }

  .mobile-bottom-nav button.active {
    color: var(--primary);
    font-weight: 800;
  }

  #toast-root {
    left: 15px;
    right: 15px;
    bottom: 80px;
  }
}

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

/* Firebase sign-in and household setup */
.cloud-auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 18px;
  background: radial-gradient(ellipse at 50% 15%, #fff 0, var(--bg) 70%);
}

.cloud-auth-card {
  width: min(100%, 470px);
  padding: clamp(24px, 5vw, 42px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 22px 70px rgba(35, 28, 20, .09);
}

.cloud-auth-card h1 {
  margin: 28px 0 8px;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(30px, 6vw, 40px);
  line-height: 1.15;
}

.cloud-brand { display: flex; align-items: center; gap: 12px; }
.cloud-brand .brand-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--primary); color: white; font-weight: 800; font-size: 21px; }
.cloud-brand strong, .cloud-brand small { display: block; }
.cloud-brand strong { font-size: 16px; }
.cloud-brand small { margin-top: 2px; color: var(--muted); }
.cloud-auth-card .subtitle { color: var(--muted); line-height: 1.55; }
.cloud-auth-card .form-group { margin: 18px 0; }
.cloud-auth-card label { display: block; margin-bottom: 7px; font-weight: 700; }
.cloud-auth-card input, .cloud-auth-card select { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 11px; background: #fff; color: var(--text); }
.cloud-submit { width: 100%; min-height: 48px; margin-top: 8px; }
.cloud-auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 20px; }
.cloud-auth-links .text-button, .cloud-auth-card .text-button { color: var(--primary); }
.cloud-privacy-note { margin: 26px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.cloud-notice, .cloud-error { margin: 16px 0; padding: 13px 15px; border-radius: 12px; line-height: 1.5; }
.cloud-notice { background: #f8f2e7; border: 1px solid #ead9b8; }
.cloud-error { background: #fff0ef; border: 1px solid #f1c9c5; color: #862e2e; }
.loading-cloud { display: flex; align-items: center; gap: 12px; margin-top: 34px; color: var(--muted); }
.loading-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--gold); animation: cloud-pulse 1s ease-in-out infinite alternate; }
@keyframes cloud-pulse { to { opacity: .3; transform: scale(.75); } }
.household-setup-card { width: min(100%, 850px); }
.household-setup-card > h1 { margin-top: 18px; }
.household-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 22px; }
.household-choice-grid .card { padding: 20px; border: 1px solid var(--border); border-radius: 16px; }
.household-choice-grid .card h2 { margin-top: 0; font-size: 19px; }
.household-choice-grid .card button { width: 100%; }
.account-back { margin-bottom: 18px; }
.household-select { width: 100%; display: flex; justify-content: space-between; text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: 12px; margin: 10px 0; padding: 15px; }
.household-select small { display: block; margin-top: 4px; color: var(--muted); }
.migration-card { width: min(100%, 620px); }
.migration-card h1 { margin-top: 16px; }
.migration-card > p { line-height: 1.6; }
.migration-progress { min-height: 22px; margin: 12px 0; color: var(--muted); }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.migration-card .text-button { display: block; margin-top: 18px; }
.cloud-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(31, 27, 22, .48); }
.cloud-account-panel { width: min(100%, 680px); max-height: min(90vh, 860px); overflow-y: auto; padding: 24px; border-radius: 20px; background: var(--surface); box-shadow: 0 24px 80px rgba(0,0,0,.2); }
.cloud-account-panel .modal-header { display: flex; justify-content: space-between; align-items: center; }
.cloud-account-panel .modal-header h2 { margin: 0; }
.cloud-account-panel .close-button { border: 0; background: transparent; color: var(--muted); font-size: 28px; }
.cloud-account-panel .account-section { margin: 22px 0; padding-top: 16px; border-top: 1px solid var(--border); }
.cloud-account-panel .account-inline { display: flex; gap: 10px; }
.cloud-account-panel .account-inline input { min-width: 0; flex: 1; }
.cloud-account-panel input, .cloud-account-panel select { padding: 10px; border: 1px solid var(--border); border-radius: 9px; }
.cloud-account-panel .member-actions { display: flex; gap: 7px; align-items: center; }
.cloud-account-panel .list-item { gap: 12px; }
.cloud-status { max-width: 145px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.cloud-status[data-status="online"] { color: var(--green); }
.cloud-status[data-status="error"] { color: var(--red); }
.cloud-status[data-status="offline"], .cloud-status[data-status="pending"] { color: #9b742b; }
.cloud-error-toast { max-width: min(460px, calc(100vw - 30px)); }

@media (max-width: 640px) {
  .household-choice-grid { grid-template-columns: 1fr; }
  .cloud-account-panel { padding: 18px; }
  .cloud-account-panel .list-item { align-items: flex-start; flex-wrap: wrap; }
  .cloud-account-panel .member-actions { width: 100%; }
  .cloud-account-panel .member-actions select { flex: 1; }
  .cloud-status { max-width: 90px; }
}

/* Appliance-centred workspace */
.workspace-heading { display:flex; justify-content:space-between; align-items:flex-start; gap:18px; margin:18px 0 22px; }
.workspace-heading h1 { margin-bottom:4px; }
.workspace-heading-actions { display:flex; flex-wrap:wrap; gap:8px; }
.appliance-tabs { display:flex; gap:5px; overflow-x:auto; padding:5px; margin:0 0 22px; border:1px solid var(--border); border-radius:14px; background:var(--surface); scrollbar-width:thin; }
.appliance-tabs button { flex:0 0 auto; border:0; border-radius:10px; background:transparent; color:var(--muted); padding:10px 13px; font-weight:700; white-space:nowrap; }
.appliance-tabs button.active { background:var(--primary); color:#fff; }
.appliance-tab-panel { min-height:220px; }
.workspace-overview { display:grid; grid-template-columns:minmax(0, 1.15fr) minmax(280px, .85fr); gap:16px; }
.workspace-machine-card { display:flex; align-items:center; gap:20px; padding:20px; }
.workspace-machine-card h2 { margin:10px 0 4px; }
.workspace-photo { width:150px; height:150px; flex:0 0 150px; display:grid; place-items:center; overflow:hidden; border-radius:16px; background:var(--surface-2); color:var(--primary); font-size:54px; }
.workspace-photo img { width:100%; height:100%; object-fit:cover; }
.workspace-facts { padding:20px; }
.workspace-facts h3 { margin-top:0; }
.workspace-shortcuts { margin-top:18px; }
.appliance-empty { margin:24px 0; }
.form-section { min-width:0; margin:0; padding:18px; border:1px solid var(--border); border-radius:14px; }
.form-section legend { padding:0 8px; color:var(--primary); font-weight:800; }
.maintenance-task-actions { display:flex; flex-wrap:wrap; align-items:center; gap:7px; }
.maintenance-task-copy { flex:1; min-width:180px; }
.service-record { align-items:flex-start; }
.service-attachment-preview { display:block; max-width:min(100%, 640px); max-height:70vh; object-fit:contain; margin:auto; }
.list-item-main { display:flex; align-items:center; justify-content:space-between; flex:1; border:0; background:transparent; color:inherit; text-align:left; }
.mobile-bottom-nav button.active { color:var(--primary); font-weight:800; }
body.dark .appliance-tabs, body.dark .form-section { border-color:#3b3934; }
body.dark .appliance-tabs button.active { background:#9a3947; }
body.dark .workspace-photo { background:#2b2925; }
@media(max-width: 760px) {
  .workspace-overview { grid-template-columns:1fr; }
  .workspace-heading { display:block; }
  .workspace-heading-actions { margin-top:12px; }
  .workspace-photo { width:104px; height:104px; flex-basis:104px; }
}
@media(max-width: 420px) {
  .workspace-machine-card { align-items:flex-start; flex-direction:column; }
  .workspace-photo { width:100%; height:180px; flex-basis:180px; }
  .appliance-tabs button { padding:9px 11px; }
}
/* Larger Add Machine button */
.workspace-heading-actions button[data-action="add-machine"] {
    min-height: 60px;
    min-width: 190px;
    padding: 17px 30px;
    font-size: 18px;
    font-weight: 800;
    border-radius: 13px;
    box-shadow: 0 5px 14px rgba(120, 31, 42, 0.18);
}

.workspace-heading-actions button[data-action="add-machine"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(120, 31, 42, 0.25);
}

@media (max-width: 760px) {
    .workspace-heading-actions button[data-action="add-machine"] {
        width: 100%;
        min-height: 58px;
        font-size: 17px;
    }
}