/* HomeTogether design system — ported 1:1 from the shared Claude Design mockups. */

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

:root {
  --pri: #7c5cfc;
  --pri2: #9f7bff;
  --grad: linear-gradient(135deg, #9569ff 0%, #7c5cfc 100%);
  --ink: #211f36;
  --muted: #8b8aa0;
  --bg: #f4f3fb;
  --card: #ffffff;
  --line: #eeedf6;
  --pri-soft: #efeafe;
  --soft: 0 8px 24px rgba(124, 92, 252, .10);
  --soft2: 0 14px 40px rgba(33, 31, 54, .10);
  --rad: 22px;
  --danger: #ff5c8a;
  --green: #1a9d5a;
  --green-bg: #e7f7ee;
  --amber: #c47a12;
  --amber-bg: #fff2e0;
  --red: #e0396b;
  --red-bg: #fdecef;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
a { color: var(--pri); text-decoration: none; }
a:hover { color: #6a49f0; }
button { font-family: inherit; }
input::placeholder, textarea::placeholder { color: #b6b4c8; }

.hearth-scroll { scrollbar-width: thin; scrollbar-color: #d9d7ea transparent; }
.hearth-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.hearth-scroll::-webkit-scrollbar-thumb { background: #d9d7ea; border-radius: 8px; }

@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes popIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

.navitem:hover { background: #f4f3fb; }
.navitem-on:hover { filter: brightness(1.04); }
.rowh:hover { background: #faf9ff; }
.lift { transition: transform .16s ease, box-shadow .16s ease; }
.lift:hover { transform: translateY(-3px); box-shadow: 0 18px 44px rgba(33, 31, 54, .13); }

.iconbtn { border: none; background: #f4f3fb; cursor: pointer; border-radius: 12px; display: grid; place-items: center; color: var(--ink); }
.iconbtn:hover { background: #e9e7f6; }

/* ===== app shell ===== */
.shell { display: flex; height: 100vh; padding: 14px; gap: 14px; }
.aside { width: 236px; flex: none; background: #fff; border-radius: 26px; box-shadow: var(--soft); display: flex; flex-direction: column; padding: 22px 14px; }
.topbar { display: none; }
.scrim { display: none; }

.col2 { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
.col2n { display: grid; grid-template-columns: 1fr 290px; gap: 18px; align-items: start; }
.col2l { display: grid; grid-template-columns: 280px 1fr; gap: 18px; align-items: start; }
.mapbox { height: calc(100vh - 150px); min-height: 360px; }
.subgrid { display: grid; grid-template-columns: 1.7fr 1fr 1fr 1fr auto; gap: 12px; }
.menugrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }

@media (max-width: 1180px) { .col2, .col2n { grid-template-columns: 1fr; } .mapbox { height: 56vh; } }
@media (max-width: 1000px) { .subgrid { grid-template-columns: 1fr auto; } .subgrid .th, .subgrid .hide-sm { display: none; } }
@media (max-width: 860px) {
  .shell { padding: 0; gap: 0; position: relative; }
  .aside { position: fixed; top: 0; bottom: 0; left: 0; z-index: 90; width: 264px; border-radius: 0 22px 22px 0; transform: translateX(-102%); transition: transform .22s ease; box-shadow: 0 0 70px rgba(33, 31, 54, .3); }
  .aside.open { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(33, 31, 54, .42); z-index: 85; }
  .topbar { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #fff; box-shadow: 0 4px 18px rgba(124, 92, 252, .09); position: sticky; top: 0; z-index: 40; }
  .main { padding: 0 12px 12px; min-width: 0; }
  .maincol { padding: 12px 2px 40px !important; }
  .deskhead { display: none !important; }
  .col2l { grid-template-columns: 1fr; }
  .menugrid { grid-template-columns: 1fr; }
  .mapbox { height: 52vh; min-height: 300px; }
}
@media (max-width: 560px) {
  .calcell { min-height: 56px !important; }
  .hide-xs { display: none !important; }
}

/* ===== primitives ===== */
.htg-card { background: #fff; border-radius: 24px; box-shadow: var(--soft); padding: 22px; }
.htg-card-lg { background: #fff; border-radius: 26px; box-shadow: var(--soft2); }

.htg-input {
  flex: 1; min-width: 0; width: 100%; background: #f4f3fb; border: 1.5px solid transparent;
  border-radius: 13px; padding: 11px 14px; font-family: inherit; font-size: 14px; color: var(--ink); outline: none;
}
.htg-input:focus { border-color: var(--pri); background: #fff; }
.htg-label { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; display: block; }

.htg-btn {
  flex: none; display: inline-flex; align-items: center; gap: 7px; border: none; border-radius: 13px;
  padding: 11px 16px; font-family: inherit; font-weight: 700; font-size: 14px; cursor: pointer;
}
.htg-btn-primary { background: var(--grad); color: #fff; box-shadow: 0 6px 16px rgba(124, 92, 252, .30); }
.htg-btn.block { width: 100%; justify-content: center; padding: 13px; border-radius: 14px; font-size: 14.5px; }
.htg-btn-primary.block { box-shadow: 0 8px 20px rgba(124, 92, 252, .30); }
.htg-btn-ghost { background: var(--pri-soft); color: var(--pri); }
.htg-btn-flat { background: #f4f3fb; color: var(--ink); }
.htg-btn-text { background: none; border: none; font-weight: 700; font-size: 14px; color: var(--pri); cursor: pointer; padding: 6px 8px; border-radius: 9px; }
.htg-btn-text:hover { background: var(--pri-soft); }
.htg-btn-text-danger { background: none; border: none; font-weight: 700; font-size: 14px; color: var(--danger); cursor: pointer; }
.htg-btn-danger-outline { border: 1.5px solid #ffd4de; background: #fff5f7; color: var(--danger); font-weight: 700; font-size: 14px; padding: 11px 20px; border-radius: 13px; cursor: pointer; }
.htg-btn-danger-outline:hover { background: #ffe9ee; }
.htg-icon-remove { border: none; background: none; padding: 6px; cursor: pointer; color: #c9c7dc; border-radius: 8px; display: inline-flex; }
.htg-icon-remove:hover { color: var(--danger); }

.htg-avatar { border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; flex: none; background: var(--pri); }
.htg-avatar-stack { display: flex; }
.htg-avatar-stack .htg-avatar { margin-left: -9px; border: 2.5px solid var(--bg); }
.htg-avatar-stack .htg-avatar:first-child { margin-left: 0; }

.htg-chip { display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 20px; font-family: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; border: none; background: #f4f3fb; color: var(--muted); }
.htg-chip.on { color: #fff; }
.htg-seg { display: flex; gap: 7px; flex-wrap: wrap; }
.htg-seg-opt { flex: 1; padding: 9px 10px; border-radius: 12px; font-family: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; border: none; background: #f4f3fb; color: var(--muted); white-space: nowrap; }
.htg-seg-opt.on { background: var(--grad); color: #fff; }

.htg-tag { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 700; padding: 5px 12px; border-radius: 20px; white-space: nowrap; }

.htg-toggle { width: 46px; height: 26px; border-radius: 20px; border: none; cursor: pointer; padding: 3px; display: flex; flex: none; transition: .15s; background: #dcdbe8; justify-content: flex-start; }
.htg-toggle.on { background: var(--grad); justify-content: flex-end; }
.htg-toggle-knob { width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.htg-toggle:disabled { opacity: .55; cursor: not-allowed; }

.htg-dialog-backdrop { position: fixed; inset: 0; background: rgba(33, 31, 54, .42); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 24px; z-index: 60; overflow: auto; }
.htg-dialog { width: min(460px, 100%); max-height: 92vh; overflow: auto; background: #fff; border-radius: 26px; box-shadow: var(--soft2); padding: 26px; animation: popIn .18s ease; }
.htg-dialog-title { font-size: 20px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 18px; }
.htg-dialog-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; }

.htg-toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 13px 20px; border-radius: 16px; font-size: 14px; font-weight: 600; box-shadow: var(--soft2); animation: toastIn .2s ease; z-index: 80; display: flex; align-items: center; gap: 10px; }
.htg-toast-ok { width: 22px; height: 22px; border-radius: 50%; background: #22c55e; display: grid; place-items: center; flex: none; }
.htg-toast-err { width: 22px; height: 22px; border-radius: 50%; background: var(--danger); display: grid; place-items: center; flex: none; }

.htg-empty-add {
  background: transparent; border: 2px dashed #d9d7ea; border-radius: 18px; min-height: 150px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--muted);
  font-family: inherit; font-weight: 700; font-size: 14px;
}
.htg-empty-add:hover { border-color: var(--pri); color: var(--pri); }
.htg-empty-note { text-align: center; padding: 34px; border: 2px dashed #d9d7ea; border-radius: 16px; color: var(--muted); font-size: 13.5px; }

.htg-spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .7s linear infinite; display: inline-block; }
.htg-spinner-dark { border: 2px solid #e3e1f2; border-top-color: var(--pri); }

/* ===== sign-in ===== */
.htg-login-wrap { height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 50% -10%, #efeafe, transparent), var(--bg); }
.htg-login-card { width: min(410px, 100%); background: #fff; border-radius: 30px; box-shadow: var(--soft2); overflow: hidden; }
.htg-login-hero { background: var(--grad); padding: 34px 34px 30px; color: #fff; position: relative; overflow: hidden; }
.htg-google-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 11px; min-height: 52px;
  border-radius: 16px; border: 1.5px solid var(--line); background: #fff; font-family: inherit; font-size: 15px;
  font-weight: 700; color: var(--ink); cursor: pointer;
}
.htg-google-btn:hover { background: #faf9ff; border-color: #e3e1f2; }
.htg-google-btn:disabled { opacity: .6; cursor: wait; }

/* ===== nav ===== */
.htg-navitem { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 14px; font-weight: 600; font-size: 14.5px; text-decoration: none; cursor: pointer; color: var(--muted); }
.htg-navitem.active { font-weight: 700; color: #fff; background: var(--grad); box-shadow: 0 8px 20px rgba(124, 92, 252, .32); }
.htg-sync-badge { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; white-space: nowrap; flex: none; background: var(--green-bg); color: var(--green); }
.htg-sync-badge.reconnecting { background: var(--amber-bg); color: var(--amber); }
.htg-sync-badge.offline { background: #f4f3fb; color: var(--muted); }

/* ===== calendar ===== */
.calcell { min-height: 78px; border-radius: 12px; padding: 5px 6px; cursor: pointer; background: #faf9ff; }
.calcell.empty { cursor: default; }
.calcell.selected { background: var(--pri-soft); }
.calnum { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: 12.5px; font-weight: 700; color: var(--ink); }
.calnum.today { background: var(--grad); color: #fff; }
.calevt { font-size: 9.5px; font-weight: 600; line-height: 1.3; padding: 2px 5px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== misc ===== */
.htg-emergency-banner { flex: 1; min-width: 240px; border-radius: 22px; padding: 20px 24px; background: linear-gradient(135deg, #ff6b7a, #ff5c8a); color: #fff; display: flex; align-items: center; gap: 14px; box-shadow: 0 14px 34px rgba(255, 92, 138, .28); }
.htg-hero { border-radius: 26px; padding: 26px 28px; margin-bottom: 20px; background: var(--grad); color: #fff; position: relative; overflow: hidden; box-shadow: 0 16px 40px rgba(124, 92, 252, .28); }
