:root {
  color-scheme: dark;
  --bg: #0d0d0f;
  --surface: #151518;
  --surface-2: #1c1c20;
  --surface-3: #242429;
  --line: #303036;
  --line-soft: #25252b;
  --text: #f4f0e8;
  --muted: #a7a3ac;
  --subtle: #73707a;
  --gold: #d7b56d;
  --gold-soft: #3b3120;
  --rose: #d68ba1;
  --rose-soft: #3b242d;
  --green: #8fbf9f;
  --green-soft: #20372b;
  --blue: #8faecf;
  --blue-soft: #233140;
  --red: #e28f8f;
  --red-soft: #3d2528;
  --sidebar: 246px;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 75% 0%, rgba(123, 88, 40, .09), transparent 32%), var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
a { color: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; letter-spacing: -.02em; }
h1 { font-size: clamp(2rem, 3vw, 2.8rem); margin-bottom: 8px; }
h2 { font-size: 1.55rem; margin-bottom: 6px; }
h3 { font-size: 1rem; margin-bottom: 8px; }
p { color: var(--muted); line-height: 1.65; }
small { color: var(--muted); }
.icon { display: inline-block; flex: 0 0 auto; vertical-align: middle; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); text-decoration: none; font-weight: 650; font-size: .88rem; transition: .18s ease; }
.button:hover { border-color: #4a464d; background: var(--surface-3); transform: translateY(-1px); }
.button.primary { background: var(--gold); border-color: var(--gold); color: #1b1710; }
.button.primary:hover { background: #e5c47f; border-color: #e5c47f; }
.button.ghost { background: transparent; }
.button.danger { color: var(--red); border-color: var(--red-soft); background: var(--red-soft); }
.button.small { min-height: 34px; padding: 7px 11px; font-size: .78rem; border-radius: 8px; }
.button.full { width: 100%; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.icon-button:hover { color: var(--text); background: var(--surface-3); }
.text-button { border: 0; background: none; color: var(--gold); padding: 4px 0; font-size: .84rem; font-weight: 650; }
.text-button:hover { color: #efcf8c; }

.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; background: #0c0c0e; }
.auth-story { position: relative; overflow: hidden; padding: 8vw; display: flex; flex-direction: column; justify-content: space-between; background: radial-gradient(circle at 20% 15%, rgba(215,181,109,.17), transparent 35%), linear-gradient(145deg, #1d1915, #111114 65%); border-right: 1px solid var(--line-soft); }
.auth-story::after { content: ""; position: absolute; width: 420px; height: 420px; border: 1px solid rgba(215,181,109,.16); border-radius: 50%; right: -170px; bottom: -120px; box-shadow: 0 0 0 50px rgba(215,181,109,.025), 0 0 0 110px rgba(215,181,109,.02); }
.auth-brand { display: flex; align-items: center; gap: 12px; color: var(--gold); font-family: Georgia, serif; font-size: 1.3rem; letter-spacing: .08em; text-transform: uppercase; }
.auth-story h1 { max-width: 650px; font-size: clamp(3rem, 6vw, 5.6rem); line-height: .98; margin: 70px 0 24px; }
.auth-story h1 em { color: var(--gold); font-weight: 400; }
.auth-story p { max-width: 520px; font-size: 1.05rem; }
.auth-features { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; position: relative; z-index: 1; }
.auth-features span { border: 1px solid rgba(215,181,109,.2); border-radius: 999px; padding: 9px 13px; color: #d8cdbb; font-size: .8rem; background: rgba(0,0,0,.15); }
.auth-foot { color: var(--subtle); font-size: .78rem; position: relative; z-index: 1; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth-card { width: min(430px, 100%); }
.auth-card .eyebrow { margin-bottom: 14px; }
.auth-card h2 { font-size: 2.15rem; }
.auth-card > p { margin-bottom: 30px; }
.auth-tabs { display: flex; gap: 6px; padding: 5px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 26px; }
.auth-tabs button { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 10px; border-radius: 8px; font-weight: 650; }
.auth-tabs button.active { background: var(--surface-3); color: var(--text); }
.auth-form { display: grid; gap: 17px; }
.auth-submit { margin-top: 6px; min-height: 48px; }
.auth-error { border: 1px solid var(--red-soft); background: var(--red-soft); color: #f1b6b6; border-radius: 10px; padding: 12px 14px; font-size: .86rem; }

.shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 40; background: rgba(18,18,21,.97); border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; }
.sidebar-brand { height: 88px; display: flex; align-items: center; gap: 12px; padding: 0 23px; border-bottom: 1px solid var(--line-soft); }
.brand-mark { width: 39px; height: 39px; border-radius: 12px; display: grid; place-items: center; color: var(--gold); background: linear-gradient(145deg, #332a1d, #1b1916); border: 1px solid #4b3d27; }
.sidebar-brand strong { display: block; font-family: Georgia, serif; font-size: 1.06rem; font-weight: 500; }
.sidebar-brand small { display: block; margin-top: 3px; color: var(--subtle); font-size: .66rem; letter-spacing: .09em; text-transform: uppercase; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 18px 13px 28px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.nav-section { margin-bottom: 18px; }
.nav-section-label { padding: 0 12px 8px; color: #69666f; font-size: .63rem; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 11px; padding: 10px 12px; border: 1px solid transparent; border-radius: 9px; background: none; color: #9e9aa3; text-align: left; font-size: .85rem; margin: 2px 0; }
.nav-item .icon { color: #76727d; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(215,181,109,.13), rgba(215,181,109,.04)); color: #ead7af; border-color: rgba(215,181,109,.13); }
.nav-item.active .icon { color: var(--gold); }
.nav-item .nav-count { margin-left: auto; min-width: 21px; padding: 2px 6px; border-radius: 99px; background: var(--surface-3); color: var(--muted); text-align: center; font-size: .67rem; }
.sidebar-footer { padding: 13px; border-top: 1px solid var(--line-soft); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold); font-size: .74rem; font-weight: 750; border: 1px solid #51432a; }
.user-chip strong { display: block; font-size: .79rem; max-width: 135px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip small { display: block; font-size: .68rem; margin-top: 2px; }
.user-chip .icon-button { margin-left: auto; width: 31px; height: 31px; border: 0; }

.main { margin-left: var(--sidebar); min-height: 100vh; }
.topbar { height: 76px; position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(20px, 3vw, 42px); border-bottom: 1px solid var(--line-soft); background: rgba(13,13,15,.88); backdrop-filter: blur(18px); }
.topbar-left { display: flex; align-items: center; gap: 14px; }
.mobile-menu { display: none; }
.topbar-date { color: var(--muted); font-size: .83rem; text-transform: capitalize; }
.topbar-right { display: flex; align-items: center; gap: 11px; }
.residence-select { appearance: none; max-width: 210px; padding: 9px 34px 9px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a7a3ac' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center; font-size: .8rem; }
.content { max-width: 1540px; margin: 0 auto; padding: clamp(26px, 3vw, 46px); }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.page-header p { margin: 0; max-width: 680px; font-size: .92rem; }
.eyebrow { color: var(--gold); font-size: .67rem; font-weight: 750; letter-spacing: .17em; text-transform: uppercase; }
.page-actions { display: flex; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }

.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid.sidebar-main { grid-template-columns: minmax(0,1.65fr) minmax(300px,.85fr); }
.card { background: linear-gradient(145deg, rgba(28,28,32,.92), rgba(20,20,24,.96)); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 21px; box-shadow: 0 8px 30px rgba(0,0,0,.08); min-width: 0; }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.card-header h2, .card-header h3 { margin: 0; }
.card-header p { margin: 5px 0 0; font-size: .8rem; }
.card-title { display: flex; align-items: center; gap: 10px; }
.card-title .icon { color: var(--gold); }
.stat-card { position: relative; overflow: hidden; padding: 20px; }
.stat-card::after { content: ""; position: absolute; width: 90px; height: 90px; border-radius: 50%; right: -28px; top: -30px; background: var(--gold-soft); opacity: .32; }
.stat-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: .78rem; margin-bottom: 12px; }
.stat-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-3); color: var(--gold); }
.stat-value { font-family: Georgia, serif; font-size: 2rem; line-height: 1; margin-bottom: 9px; }
.stat-foot { color: var(--subtle); font-size: .72rem; }
.stat-foot strong { color: var(--green); font-weight: 600; }
.progress-track { height: 7px; border-radius: 99px; background: #2b2b31; overflow: hidden; }
.progress-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #9b7c43, var(--gold)); transition: width .3s ease; }
.progress-row { display: grid; gap: 7px; margin: 14px 0; }
.progress-label { display: flex; justify-content: space-between; gap: 12px; font-size: .78rem; color: var(--muted); }
.progress-label strong { color: var(--text); font-weight: 600; }
.progress-ring { --value: 0; width: 106px; height: 106px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--gold) calc(var(--value) * 1%), #2c2b30 0); position: relative; flex: 0 0 auto; }
.progress-ring::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--surface); }
.progress-ring > div { position: relative; text-align: center; }
.progress-ring strong { display: block; font-family: Georgia, serif; font-size: 1.6rem; font-weight: 500; }
.progress-ring small { font-size: .63rem; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; font-size: .66rem; font-weight: 700; letter-spacing: .02em; white-space: nowrap; background: var(--surface-3); color: var(--muted); }
.badge.gold { background: var(--gold-soft); color: #e4c88d; }
.badge.green { background: var(--green-soft); color: #a9d3b8; }
.badge.red { background: var(--red-soft); color: #efaaaa; }
.badge.blue { background: var(--blue-soft); color: #aac8e5; }
.badge.rose { background: var(--rose-soft); color: #e5a7bb; }
.list { display: grid; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line-soft); min-width: 0; }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row strong { display: block; font-size: .86rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.list-row small { display: block; margin-top: 4px; font-size: .72rem; }
.list-icon { width: 35px; height: 35px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); flex: 0 0 auto; }
.list-row.done strong { text-decoration: line-through; color: var(--subtle); }
.row-actions { display: flex; gap: 5px; align-items: center; }
.check-button { width: 31px; height: 31px; border-radius: 50%; border: 1px solid #49464e; background: transparent; color: transparent; display: grid; place-items: center; }
.check-button:hover { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.check-button.checked { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.alert-list { display: grid; gap: 10px; }
.alert-item { display: flex; gap: 11px; padding: 12px; border-radius: 11px; border: 1px solid var(--line-soft); background: rgba(255,255,255,.012); }
.alert-item > .icon { color: var(--gold); margin-top: 2px; }
.alert-item strong { font-size: .8rem; display: block; margin-bottom: 3px; }
.alert-item p { margin: 0; font-size: .74rem; line-height: 1.45; }
.divider { height: 1px; background: var(--line-soft); margin: 18px 0; }
.muted { color: var(--muted); }
.subtle { color: var(--subtle); }
.gold { color: var(--gold); }
.green { color: var(--green); }
.red { color: var(--red); }
.center { text-align: center; }
.right { text-align: right; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.mt-1 { margin-top: 10px; } .mt-2 { margin-top: 20px; } .mt-3 { margin-top: 30px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 10px; } .mb-2 { margin-bottom: 20px; }

.empty { min-height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--subtle); }
.empty > .icon { color: var(--gold); margin-bottom: 14px; }
.empty h3 { color: var(--text); margin-bottom: 7px; font-family: Georgia, serif; font-size: 1.35rem; font-weight: 500; }
.empty p { max-width: 420px; font-size: .84rem; margin-bottom: 0; }
.empty .button { margin-top: 18px; }

.filter-bar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 20px; }
.filter-chip { padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: .76rem; }
.filter-chip.active { border-color: #5c4c2e; color: #ead7af; background: var(--gold-soft); }
.search-box { position: relative; min-width: 220px; flex: 1; max-width: 340px; }
.search-box .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--subtle); }
.search-box input { padding-left: 37px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.field { display: grid; gap: 7px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { color: #c8c3cc; font-size: .76rem; font-weight: 600; }
.field input, .field select, .field textarea, .search-box input { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 9px; background: #111114; color: var(--text); padding: 10px 12px; outline: none; transition: .15s ease; font-size: .85rem; }
.password-control { position: relative; }
.password-control input { padding-right: 48px; }
.password-toggle { position: absolute; right: 4px; bottom: 4px; width: 36px; height: 34px; border: 0; background: transparent; }
.password-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.field textarea { min-height: 100px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus, .search-box input:focus { border-color: #8d7446; box-shadow: 0 0 0 3px rgba(215,181,109,.08); }
.field input[type="checkbox"] { width: 17px; height: 17px; min-height: 0; accent-color: var(--gold); }
.field .hint { color: var(--subtle); font-size: .68rem; line-height: 1.45; }
.check-list { display: grid; gap: 8px; }
.check-label { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: .82rem; background: #111114; }
.check-label input { accent-color: var(--gold); }
.form-error { color: var(--red); font-size: .8rem; min-height: 18px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .8rem; }
th { color: var(--subtle); text-transform: uppercase; letter-spacing: .08em; font-size: .62rem; font-weight: 700; text-align: left; padding: 10px 9px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 9px; border-bottom: 1px solid var(--line-soft); color: #ccc7cf; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td strong { color: var(--text); font-weight: 600; }
.table-actions { display: flex; gap: 4px; justify-content: flex-end; }

.tabs { display: flex; gap: 5px; border-bottom: 1px solid var(--line-soft); margin-bottom: 24px; overflow-x: auto; }
.tab { border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); padding: 11px 14px; white-space: nowrap; font-size: .82rem; font-weight: 600; }
.tab.active { color: var(--gold); border-bottom-color: var(--gold); }
.tab-panel { animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.week-grid { display: grid; grid-template-columns: repeat(7, minmax(105px,1fr)); gap: 9px; overflow-x: auto; padding-bottom: 6px; }
.day-column { min-height: 210px; border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(255,255,255,.012); padding: 10px; }
.day-column.today { border-color: #665333; background: rgba(215,181,109,.045); }
.day-head { text-align: center; padding-bottom: 10px; margin-bottom: 9px; border-bottom: 1px solid var(--line-soft); }
.day-head small { display: block; text-transform: uppercase; font-size: .59rem; letter-spacing: .08em; }
.day-head strong { display: block; margin-top: 3px; font-family: Georgia, serif; font-size: 1.25rem; font-weight: 500; }
.mini-task { padding: 9px; border-radius: 8px; background: var(--surface-3); margin: 6px 0; font-size: .69rem; line-height: 1.35; border-left: 2px solid var(--gold); }
.mini-task.done { opacity: .55; text-decoration: line-through; border-left-color: var(--green); }
.mini-task.overdue { border-left-color: var(--red); }
.room-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.room-card { position: relative; overflow: hidden; }
.room-card .room-icon { width: 43px; height: 43px; border-radius: 12px; background: var(--gold-soft); color: var(--gold); display: grid; place-items: center; margin-bottom: 15px; }
.room-card h3 { font-family: Georgia, serif; font-size: 1.25rem; font-weight: 500; }
.room-card p { font-size: .76rem; }
.room-card .card-actions { position: absolute; right: 13px; top: 13px; display: flex; gap: 3px; }
.room-card .card-actions .icon-button { width: 29px; height: 29px; border: 0; }

.recipe-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.recipe-card { display: flex; flex-direction: column; min-height: 240px; }
.recipe-card .recipe-top { display: flex; justify-content: space-between; gap: 10px; }
.recipe-card h3 { font-family: Georgia, serif; font-size: 1.25rem; font-weight: 500; }
.recipe-card p { font-size: .78rem; }
.recipe-meta { display: flex; gap: 12px; color: var(--muted); font-size: .7rem; margin: 10px 0 14px; }
.recipe-meta span { display: inline-flex; align-items: center; gap: 5px; }
.recipe-card .grow { flex: 1; }
.match { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.match .progress-track { flex: 1; }
.meal-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.meal-day { border: 1px solid var(--line-soft); border-radius: 13px; padding: 14px; background: rgba(255,255,255,.012); }
.meal-day h3 { font-family: Georgia, serif; font-size: 1.1rem; font-weight: 500; padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); }
.meal-slot { padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.meal-slot:last-child { border-bottom: 0; }
.meal-slot small { display: block; text-transform: uppercase; letter-spacing: .08em; font-size: .58rem; margin-bottom: 5px; }
.meal-slot strong { display: block; font-size: .78rem; line-height: 1.4; }
.meal-slot .flex { margin-top: 7px; }

.kanban { display: grid; grid-template-columns: repeat(5, minmax(170px,1fr)); gap: 12px; overflow-x: auto; padding-bottom: 10px; }
.kanban-column { min-height: 270px; border: 1px solid var(--line-soft); border-radius: 13px; background: rgba(255,255,255,.012); padding: 12px; }
.kanban-column h3 { display: flex; align-items: center; justify-content: space-between; font-size: .76rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.cycle-card { padding: 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-soft); margin: 9px 0; }
.cycle-card strong { display: block; font-size: .8rem; margin-bottom: 6px; }
.cycle-card p { font-size: .68rem; margin-bottom: 9px; }
.stage-flow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 14px 0; }
.stage-step { display: flex; align-items: center; gap: 5px; color: var(--subtle); font-size: .68rem; }
.stage-step.active { color: var(--gold); }
.stage-step.done { color: var(--green); }

.plan-progress { display: flex; align-items: center; gap: 24px; padding: 24px; border-radius: var(--radius); border: 1px solid #4b3d27; background: linear-gradient(120deg, rgba(215,181,109,.11), rgba(215,181,109,.025)); margin-bottom: 22px; }
.plan-progress h2 { margin-bottom: 5px; }
.plan-progress p { margin-bottom: 0; font-size: .82rem; }
.plan-grid { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 11px; }
.plan-day { border: 1px solid var(--line-soft); border-radius: 12px; padding: 13px; background: var(--surface); min-height: 150px; display: flex; flex-direction: column; }
.plan-day.done { border-color: #35503f; background: rgba(143,191,159,.045); }
.plan-day .day-number { color: var(--gold); font-family: Georgia, serif; font-size: 1.25rem; }
.plan-day small { font-size: .64rem; }
.plan-day strong { font-size: .76rem; line-height: 1.4; margin: 8px 0; }
.plan-day .grow { flex: 1; }

.timer-panel { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 24px; padding: 28px; border-radius: var(--radius); border: 1px solid #51432a; background: radial-gradient(circle at 85% 20%, rgba(215,181,109,.13), transparent 40%), var(--surface); margin-bottom: 22px; }
.timer-display { font-family: Georgia, serif; font-size: clamp(3.5rem, 8vw, 6rem); line-height: 1; color: #ead7af; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.timer-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 18px; }
.quick-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.quick-item { display: flex; align-items: center; gap: 11px; border: 1px solid var(--line-soft); border-radius: 11px; padding: 13px; background: var(--surface); }
.quick-item input { accent-color: var(--gold); }
.quick-item strong { display: block; font-size: .82rem; }
.quick-item small { font-size: .69rem; }

.safety-banner { display: flex; gap: 13px; padding: 16px 18px; border-radius: 12px; border: 1px solid #5b4727; background: rgba(215,181,109,.07); margin-bottom: 22px; }
.safety-banner > .icon { color: var(--gold); margin-top: 2px; }
.safety-banner strong { display: block; font-size: .84rem; margin-bottom: 4px; }
.safety-banner p { margin: 0; font-size: .77rem; }
.resource-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 15px; }
.resource-card { min-height: 230px; display: flex; flex-direction: column; }
.resource-card .resource-type { color: var(--gold); font-size: .63rem; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 10px; }
.resource-card h3 { font-family: Georgia, serif; font-size: 1.22rem; font-weight: 500; }
.resource-card p { font-size: .78rem; }
.resource-card .safety { border-top: 1px solid var(--line-soft); padding-top: 10px; margin-top: 12px; color: #c8b58e; font-size: .69rem; line-height: 1.5; }
.resource-card .grow { flex: 1; }

.bar-chart { display: flex; align-items: flex-end; gap: 7px; height: 220px; padding-top: 18px; }
.bar-group { flex: 1; min-width: 10px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 7px; }
.bar-stack { width: min(26px, 75%); height: 100%; display: flex; flex-direction: column; justify-content: flex-end; background: #24242a; border-radius: 5px 5px 2px 2px; overflow: hidden; }
.bar-fill { background: linear-gradient(180deg, var(--gold), #8d6f39); min-height: 2px; }
.bar-group small { color: var(--subtle); font-size: .58rem; }
.donut-row { display: flex; align-items: center; gap: 24px; }
.donut { width: 140px; height: 140px; border-radius: 50%; background: conic-gradient(var(--gold) 0 35%, var(--green) 35% 60%, var(--blue) 60% 80%, var(--rose) 80% 100%); position: relative; flex: 0 0 auto; }
.donut::after { content: ""; position: absolute; inset: 19px; border-radius: 50%; background: var(--surface); }
.donut-center { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; text-align: center; }
.donut-center strong { display: block; font-family: Georgia, serif; font-size: 1.35rem; font-weight: 500; }
.donut-center small { font-size: .62rem; }
.legend { display: grid; gap: 10px; flex: 1; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: .75rem; color: var(--muted); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-row strong { margin-left: auto; color: var(--text); font-weight: 600; }

.settings-grid { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(300px,.75fr); gap: 18px; align-items: start; }
.settings-stack { display: grid; gap: 18px; }
.backup-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.member-row:last-child { border-bottom: 0; }
.member-row .grow { flex: 1; min-width: 0; }
.member-row strong { display: block; font-size: .8rem; }
.member-row small { display: block; font-size: .69rem; margin-top: 3px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.72); backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; padding: 24px; animation: fadeIn .15s ease; }
.modal { width: min(650px, 100%); max-height: calc(100vh - 48px); overflow: hidden; display: flex; flex-direction: column; background: #17171b; border: 1px solid #39363e; border-radius: 18px; box-shadow: var(--shadow); }
.modal.small { width: min(460px, 100%); }
.modal.wide { width: min(900px, 100%); }
.modal-header { padding: 22px 24px 18px; border-bottom: 1px solid var(--line-soft); display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.modal-header h2 { font-size: 1.6rem; margin: 0; }
.modal-header p { margin: 6px 0 0; font-size: .79rem; }
.modal-body { padding: 22px 24px; overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 9px; padding-top: 22px; margin-top: 22px; border-top: 1px solid var(--line-soft); }
.toast-root { position: fixed; z-index: 150; right: 22px; bottom: 22px; display: grid; gap: 9px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 390px; padding: 13px 15px; border-radius: 11px; border: 1px solid #3d5545; background: #1b2b22; color: #c6e4d1; box-shadow: var(--shadow); font-size: .82rem; animation: toastIn .2s ease; }
.toast.error { background: #2d1e21; border-color: #5e363c; color: #f0b8b8; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.loading { min-height: 60vh; display: grid; place-items: center; color: var(--muted); }
.loading-inner { text-align: center; }
.loading-inner .brand-mark { margin: 0 auto 16px; animation: pulse 1.4s ease infinite; }
@keyframes pulse { 50% { opacity: .45; transform: scale(.96); } }
.sidebar-overlay { display: none; }

@media (max-width: 1250px) {
  .grid.four { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid.three, .recipe-grid, .resource-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .room-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .plan-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .meal-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 1020px) {
  :root { --sidebar: 220px; }
  .sidebar-brand { padding: 0 17px; }
  .content { padding: 28px 24px; }
  .grid.sidebar-main, .settings-grid { grid-template-columns: 1fr; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-story { display: none; }
  .auth-panel { min-height: 100vh; }
}
@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; width: 250px; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.62); }
  .main { margin-left: 0; }
  .mobile-menu { display: inline-flex; }
  .topbar { height: 66px; padding: 0 16px; }
  .topbar-date { display: none; }
  .residence-select { max-width: 150px; }
  .content { padding: 24px 16px 40px; }
  .page-header { align-items: flex-start; flex-direction: column; margin-bottom: 23px; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .grid.two, .grid.three, .grid.four, .recipe-grid, .resource-grid, .room-grid { grid-template-columns: 1fr; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .plan-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .plan-progress { align-items: flex-start; flex-direction: column; }
  .timer-panel { grid-template-columns: 1fr; }
  .quick-list { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 10px; align-items: flex-end; }
  .modal { max-height: calc(100vh - 20px); border-radius: 17px 17px 10px 10px; }
  .modal-header, .modal-body { padding: 18px; }
  .modal-footer { position: sticky; bottom: -18px; background: #17171b; padding-bottom: 18px; }
  .toast-root { right: 12px; left: 12px; bottom: 12px; }
  .toast { min-width: 0; max-width: none; }
  .auth-panel { padding: 24px; }
  .filter-bar { align-items: stretch; }
  .search-box { max-width: none; min-width: 100%; }
  .donut-row { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 430px) {
  .grid.two { grid-template-columns: 1fr; }
  .stat-value { font-size: 1.75rem; }
  .topbar-right .avatar { display: none; }
  .residence-select { max-width: 128px; }
  .page-actions .button { flex: 1; }
  .meal-grid { grid-template-columns: 1fr; }
  .timer-display { font-size: 3.8rem; }
}
