/* CasaDurante — Web: tema "Focolare" (mirror di Design/Theme.swift, caso .focolare). */
:root {
  --bg: #0b0d08;
  --surface: #141a0f;
  --surface2: #1b2213;
  --line: #28331a;
  --text: #f3ede6;
  --mut: #9fb08c;
  --soft: #b89b84;
  --accent: #d98a4e;
  --accent-ink: #1a120c;
  --accent2: #8fd14f;
  --card: #1c130d;
  --card-line: #3a2417;
  --danger: #e24b4b;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: radial-gradient(ellipse at top, #2f3a2233 0%, transparent 60%), var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
#app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.topbar-brand { font-size: 18px; font-weight: 800; }
.brand-c { font-weight: 800; }
.brand-d { font-weight: 800; color: var(--accent); }

.screen { flex: 1; display: flex; flex-direction: column; padding: 18px; max-width: 520px; margin: 0 auto; width: 100%; }
.screen-center { align-items: center; justify-content: center; text-align: center; gap: 14px; }

.brand { font-size: 34px; margin-top: 10px; }
.tagline { color: var(--soft); font-style: italic; margin: 0 0 10px; }
.hint { color: var(--mut); font-size: 13px; }
.hint.center { text-align: center; margin-top: 40px; }
.error { color: var(--danger); font-size: 13px; }

.btn {
  font: inherit; font-weight: 700; font-size: 15px;
  padding: 11px 22px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); cursor: pointer;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-ms { background: #2f3a7a; color: #fff; border-color: #2f3a7a; }
.btn-link { background: none; border: none; color: var(--mut); cursor: pointer; font: inherit; }
.btn-icon { background: none; border: none; color: var(--text); font-size: 18px; cursor: pointer; padding: 4px 8px; }

.pin-input {
  font: inherit; font-size: 22px; letter-spacing: 6px; text-align: center;
  width: 220px; padding: 10px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
}
/* Maschera visiva stile password SENZA usare type="password" — evita che Safari
   intercetti il campo con il suggerimento "Password sicura automatica" di iCloud
   Keychain (che su Mac/iPhone blocca di fatto la digitazione su coppie di campi
   nuovo+conferma). Fallback: su browser senza supporto resta testo in chiaro durante
   la digitazione, accettabile per un PIN locale. */
.pin-mask {
  -webkit-text-security: disc;
  text-security: disc;
}
.lock-icon { font-size: 44px; }

.vault-header { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.vault-header h2 { margin: 0; font-size: 20px; }
.spacer { flex: 1; }

.entry-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.entry-row {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 12px; border-radius: 13px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); cursor: pointer; font: inherit;
}
.entry-icon { font-size: 18px; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  background: var(--surface2); border-radius: 10px; }
.entry-texts { display: flex; flex-direction: column; gap: 1px; overflow: hidden; }
.entry-title { font-weight: 700; font-size: 15px; }
.entry-subtitle { font-size: 12px; color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.add-menu { position: fixed; bottom: 24px; right: 24px; }
.fab {
  width: 54px; height: 54px; border-radius: 50%; border: none;
  background: var(--accent); color: var(--accent-ink); font-size: 24px; font-weight: 700;
  cursor: pointer; box-shadow: 0 4px 14px #0007;
}
.add-menu-options {
  display: none; position: absolute; bottom: 64px; right: 0;
  background: var(--card); border: 1px solid var(--card-line); border-radius: 12px;
  padding: 6px; min-width: 200px; flex-direction: column; gap: 2px;
}
.add-menu.open .add-menu-options { display: flex; }
.add-menu-option {
  background: none; border: none; color: var(--text); text-align: left;
  padding: 9px 12px; border-radius: 8px; font: inherit; font-size: 14px; cursor: pointer;
}
.add-menu-option:hover { background: var(--surface2); }

.detail-card {
  background: var(--card); border: 1px solid var(--card-line); border-radius: 14px;
  padding: 16px; margin-top: 10px; display: flex; flex-direction: column; gap: 8px;
}
.detail-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; }
.detail-label { color: var(--mut); }
.masked-value { font-family: ui-monospace, monospace; }
.notes { color: var(--soft); font-size: 13px; white-space: pre-wrap; }
.code { font-family: ui-monospace, monospace; font-size: 16px; }

.actions-row { display: flex; gap: 10px; margin-top: 16px; }

.edit-form { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--mut); }
.field input, .field select {
  font: inherit; font-size: 15px; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px;
}
.field-checkbox { flex-direction: row; align-items: center; gap: 8px; }
.field-checkbox input { width: auto; }

/* ===== Shell a 5 tab (mirror di MainTabView/TabBar in RootView.swift) ===== */
.app-shell { flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.app-shell-content { flex: 1; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; width: 100%; padding-bottom: 70px; }
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex;
  background: color-mix(in srgb, var(--bg) 96%, transparent); border-top: 1px solid var(--line);
  padding: 8px 0 20px;
}
.tabbar-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none; color: var(--mut); font: inherit; cursor: pointer; padding: 4px 0;
}
.tabbar-btn .tabbar-icon { font-size: 19px; }
.tabbar-btn .tabbar-label { font-size: 10px; }
.tabbar-btn.active { color: var(--accent); }

.tab-screen { display: flex; flex-direction: column; flex: 1; min-height: 0; padding: 8px 0 0; }
.overlay-screen { display: flex; flex-direction: column; flex: 1; min-height: 100vh; max-width: 560px; margin: 0 auto; width: 100%; }
.tab-header { display: flex; align-items: center; gap: 10px; padding: 8px 17px 4px; }
.tab-header h2 { margin: 0; font-size: 20px; font-weight: 800; }
.scroll-area { flex: 1; overflow-y: auto; scrollbar-width: none; padding: 0 16px 90px; }
.scroll-area::-webkit-scrollbar { display: none; }
.section-kicker { font-size: 11px; font-weight: 800; letter-spacing: 1px; color: var(--mut); padding: 16px 3px 8px; }
.icon-btn { background: none; border: none; color: var(--accent); font-size: 18px; font-weight: 800; cursor: pointer; padding: 4px 6px; }
.icon-btn.active { color: var(--accent2); }
.spinner-dot { display: inline-block; animation: spin 1s linear infinite; color: var(--accent); }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ===== Home ===== */
.home-appbar { display: flex; align-items: center; justify-content: space-between; padding: 8px 17px 0; }
.home-brand { font-size: 18px; font-weight: 800; }
.home-avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800;
}
.home-greeting { padding: 6px 17px 0; }
.home-greeting h1 { margin: 0; font-size: 26px; font-weight: 800; }
.notif-spine {
  margin: 12px 16px 0; padding: 13px; background: var(--card); border-radius: 20px;
  border: 1.5px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.notif-title { font-size: 11px; font-weight: 800; letter-spacing: 1px; color: var(--accent); margin-bottom: 9px; }
.home-widgets { padding: 11px 16px 0; display: flex; flex-direction: column; gap: 11px; }
.home-widgets-row { display: flex; gap: 11px; }
.widget-card {
  flex: 1; text-align: left; padding: 13px; background: var(--card); border-radius: 18px;
  border: 1px solid var(--card-line); color: var(--text); font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 4px;
}
.widget-wide { width: 100%; }
.widget-kicker { font-size: 11px; font-weight: 800; color: var(--mut); }
.widget-title { font-size: 14px; font-weight: 800; margin-top: 2px; }
.widget-sub { font-size: 12px; color: var(--mut); }
.widget-amazon { font-size: 11px; color: var(--soft); margin-top: 6px; }

/* ===== Agenda ===== */
.mini-month { margin: 10px 16px 0; padding: 13px; background: var(--card); border-radius: 18px; border: 1px solid var(--card-line); }
.mini-month-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.mini-month-title { font-size: 14px; font-weight: 700; }
.mini-month-today { font-size: 12px; color: var(--accent); }
.mini-month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.mini-month-dow { font-size: 10px; color: var(--mut); text-align: center; }
.mini-month-cell { font-size: 13px; text-align: center; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--surface); }
.mini-month-cell.empty { background: transparent; }
.mini-month-cell.today { background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.empty-state { text-align: center; padding-top: 50px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-icon { font-size: 30px; color: var(--mut); }
.empty-title { font-size: 14px; font-weight: 700; margin: 0; }

/* ===== Spesa ===== */
.spesa-header { padding: 0 17px 4px; }
.spesa-header-row { display: flex; align-items: center; gap: 8px; }
.spesa-header-row h2, .spesa-list-switch { margin: 0; font-size: 20px; font-weight: 800; }
.spesa-list-switch { display: flex; align-items: center; gap: 6px; }
.list-select { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 13px; }
.hint.accent { color: var(--accent); }
.shopping-toggle {
  font-size: 13px; font-weight: 800; color: #06220f; padding: 8px 13px; border-radius: 13px; border: none; cursor: pointer;
  background: linear-gradient(to bottom, var(--accent2), #4e9c2e);
}
.shopping-toggle.active { color: #fff; background: linear-gradient(to bottom, #e2884e, #b5541f); }
.strip-tabs { display: flex; gap: 7px; padding: 4px 16px 0; }
.strip-tab { font-size: 12.5px; font-weight: 800; color: var(--mut); background: none; border: none; cursor: pointer; padding: 6px 11px; border-radius: 999px; }
.strip-tab.active { color: #ffcf9e; background: #20170f; border: 1px solid #a05a26; }
.page-dots { display: flex; justify-content: center; gap: 6px; padding: 6px 0 2px; }
.page-dots .dot { width: 6px; height: 6px; border-radius: 999px; background: var(--line); }
.page-dots .dot.active { width: 18px; background: var(--accent); }

.scope-block { padding: 12px 0 0; }
.collapsible-header {
  width: 100%; display: flex; align-items: center; gap: 8px; background: none; border: none; cursor: pointer;
  color: var(--text); font: inherit; padding: 6px 2px;
}
.ch-title { font-size: 15px; font-weight: 800; }
.ch-count { font-size: 12px; color: var(--mut); }
.ch-chevron { color: var(--mut); }
.low-priority-label { font-size: 10px; font-weight: 800; letter-spacing: 0.5px; color: var(--mut); padding: 8px 0 0 2px; }

.consume-row, .catalog-row {
  display: flex; align-items: center; gap: 12px; padding: 11px; margin: 3px 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 13px;
}
.consume-row.dim { opacity: 0.6; }
.catalog-row.on {
  background: linear-gradient(to right, #241711, #1a1410); border-color: #a05a26; border-width: 1.5px;
  position: relative;
}
.catalog-row.on::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: #e2884e; border-radius: 2px; }
.row-checkbox {
  width: 26px; height: 26px; border-radius: 7px; border: 2px solid var(--accent2); background: none;
  color: var(--accent-ink); font-size: 14px; font-weight: 800; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.row-checkbox.on { background: var(--accent2); }
.row-checkbox.catalog-cb { border-color: var(--mut); }
.row-checkbox.catalog-cb.on { border-color: #e2884e; background: #e2884e; color: #1a120c; }
.row-checkbox.acquisti-cb { border-color: var(--accent2); }
.row-checkbox.acquisti-cb.on { background: none; color: var(--accent2); }
.row-checkbox:disabled { opacity: 0.5; cursor: not-allowed; }
.row-name { font-size: 15.5px; }
.row-name.strike { text-decoration: line-through; }
.row-note, .row-price { font-size: 12px; color: var(--mut); }
.to-buy-badge { font-size: 10.5px; font-weight: 800; color: #e2884e; background: #3a2415; padding: 3px 8px; border-radius: 999px; }
.row-delete { background: none; border: none; color: var(--mut); font-size: 15px; cursor: pointer; }

.add-box-wrap { padding: 6px 0 2px; }
.add-box-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--surface2); border-radius: 12px; border: 1px dashed color-mix(in srgb, var(--accent2) 50%, transparent);
}
.add-box-row.dashed { margin: 8px 0; }
.add-plus { color: var(--accent2); font-weight: 800; }
.add-box-input { flex: 1; background: none; border: none; color: var(--text); font: inherit; font-size: 14.5px; outline: none; }
.add-ok-btn { font-size: 13px; font-weight: 800; color: var(--accent-ink); background: var(--accent2); border: none; border-radius: 999px; padding: 5px 10px; cursor: pointer; }
.suggest-row { display: flex; gap: 8px; overflow-x: auto; padding-top: 6px; scrollbar-width: none; }
.suggest-row::-webkit-scrollbar { display: none; }
.suggest-chip { flex-shrink: 0; font-size: 13px; font-weight: 600; color: var(--text); background: var(--surface2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 11px; cursor: pointer; }

.ask-to-buy-btn {
  width: 100%; display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 12px;
  background: linear-gradient(135deg, #2a2033, #1b1424); border: 1px solid #42305a; border-radius: 14px;
  color: var(--text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.requests-box {
  margin-top: 10px; padding: 12px; background: linear-gradient(135deg, #2a2033, #1b1424);
  border: 1px solid #42305a; border-radius: 18px;
}
.requests-title { font-size: 11px; font-weight: 800; color: #c3a6e0; margin-bottom: 8px; }
.request-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.member-avatar { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #1a120c; flex-shrink: 0; }
.request-texts { display: flex; flex-direction: column; }
.request-product { font-size: 15px; font-weight: 700; }
.req-action { font-size: 11px; font-weight: 800; border: none; border-radius: 9px; padding: 5px 9px; cursor: pointer; }
.req-action.add { color: #06220f; background: var(--accent2); }
.req-action.done { color: #c3a6e0; background: var(--surface2); }
.notes-box { margin-top: 10px; padding: 10px; background: var(--surface); border: 1px dashed var(--line); border-radius: 13px; }
.notes-title { font-size: 11px; font-weight: 700; color: var(--soft); margin-bottom: 5px; }

.undo-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 0 16px 70px; padding: 12px 16px; background: #1e1e1e; border: 1px solid #ffffff1f;
  border-radius: 14px; color: #fff; font-size: 14px; font-weight: 600;
  position: sticky; bottom: 0;
}
.undo-btn { background: none; border: none; color: #7fd18a; font-weight: 800; font-size: 14px; cursor: pointer; }

.modal-backdrop {
  position: fixed; inset: 0; background: #000a; display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 50;
}
.modal-card { background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 20px; max-width: 360px; width: 100%; }
.modal-card h3 { margin-top: 0; }

/* ===== Acquisti ===== */
.acquisti-texts { display: flex; flex-direction: column; gap: 2px; }
.acquisti-meta { display: flex; gap: 6px; }
.amazon-btn { font-size: 12px; font-weight: 800; color: #1a120c; background: #ff9900; border: none; border-radius: 999px; padding: 6px 10px; cursor: pointer; }

/* ===== Caveau / Banca ===== */
.account-card { padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; margin: 7px 0; }
.account-head { display: flex; align-items: center; gap: 10px; }
.account-texts { display: flex; flex-direction: column; gap: 1px; }
.account-name { font-size: 16px; font-weight: 800; }
.owner-badge { font-size: 11px; font-weight: 800; color: var(--soft); background: var(--surface2); padding: 3px 8px; border-radius: 999px; }
.owner-badge.mine { color: var(--accent2); }
.linked-cards { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; }
.card-tile { display: flex; align-items: center; gap: 12px; padding: 10px; background: var(--surface2); border-radius: 12px; }
.mini-card { width: 54px; height: 36px; border-radius: 8px; flex-shrink: 0; display: flex; align-items: flex-end; padding: 4px; font-size: 8px; font-weight: 800; color: #ffffffe6; }
.card-tile-texts { display: flex; flex-direction: column; gap: 1px; }
.card-tile-label { font-size: 14px; font-weight: 600; }
.hint.mono { font-family: ui-monospace, monospace; }
.card-type-chip { font-size: 10px; font-weight: 800; color: var(--soft); background: var(--surface2); padding: 3px 7px; border-radius: 999px; }

/* ===== Profilo ===== */
.profile-avatar-block { text-align: center; padding-top: 14px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.profile-avatar {
  width: 88px; height: 88px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 36px; font-weight: 800; color: #fff; background: linear-gradient(135deg, #5ea9ff, #2f6ab5);
}
.theme-row { display: flex; gap: 10px; padding: 0 3px; }
.theme-card { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 13px; border: 2px solid transparent; }
.theme-card.active { border-color: var(--accent); }
.theme-swatch { height: 52px; border-radius: 10px; }
.account-row {
  display: flex; align-items: center; gap: 10px; padding: 12px; margin: 8px 3px 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 13px;
}
.connected-badge { font-size: 12px; font-weight: 800; color: var(--accent2); }
