:root {
  --bg: #f6f3ed;
  --panel: #ffffff;
  --panel-2: #faf8f4;
  --text: #17283c;
  --muted: #747b83;
  --border: #e6e0d6;
  --accent: #17283c;
  --accent-soft: #edf1f4;
  --brand-gold: #c89b4b;
  --shadow: 0 14px 45px rgba(23, 40, 60, .10);
  --danger: #d94f6a;
  --success: #2b9b6b;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }


body[data-theme="compass"] { --bg:#f6f3ed; --panel:#ffffff; --panel-2:#faf8f4; --text:#17283c; --muted:#747b83; --border:#e6e0d6; --accent:#17283c; --accent-soft:#edf1f4; --brand-gold:#c89b4b; --shadow:0 14px 45px rgba(23,40,60,.10); }
body[data-theme="lavender"] { --bg:#f4f4fb; --panel:#ffffff; --panel-2:#f8f8fd; --text:#20213f; --muted:#74768f; --border:#e7e7f2; --accent:#6f6bd8; --accent-soft:#ecebff; --brand-gold:#c89b4b; --shadow:0 14px 45px rgba(56,50,110,.10); }
body[data-theme="sage"] { --bg:#f2f6f2; --text:#21342c; --muted:#6f7c74; --border:#dfe9e1; --accent:#4e8d70; --accent-soft:#e3f1e8; --shadow:0 14px 45px rgba(51,92,70,.10); }
body[data-theme="rose"] { --bg:#fbf4f6; --text:#3e2630; --muted:#846c75; --border:#f0dde4; --accent:#b95f82; --accent-soft:#f7e4ec; --shadow:0 14px 45px rgba(115,56,82,.10); }
body[data-theme="midnight"] { --bg:#111424; --panel:#181c30; --panel-2:#20253d; --text:#f2f3fb; --muted:#a5abc3; --border:#2a3049; --accent:#8d88ff; --accent-soft:#29284b; --shadow:0 14px 45px rgba(0,0,0,.25); }

.app-shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--panel); border-right: 1px solid var(--border); padding: 22px 16px; display: flex; flex-direction: column; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 22px; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; display: block; object-fit: cover; box-shadow: 0 8px 22px rgba(23,40,60,.18); }
.brand-name { font-weight: 800; letter-spacing: -.02em; }
.brand-sub { color: var(--muted); font-size: 12px; margin-top: 1px; }
.nav { display: grid; gap: 7px; }
.nav-btn { border: 0; background: transparent; color: var(--muted); padding: 11px 12px; border-radius: 11px; display: flex; gap: 11px; align-items: center; text-align: left; }
.nav-btn:hover { background: var(--panel-2); color: var(--text); }
.nav-btn.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.sidebar-bottom { margin-top: auto; }
.sync-card { display: flex; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: 13px; background: var(--panel-2); }
.sync-card small { display: block; color: var(--muted); margin-top: 2px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #f3ab41; box-shadow: 0 0 0 4px rgba(243,171,65,.14); }

.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 12; height: 72px; padding: 12px 26px; display: flex; align-items: center; gap: 14px; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(16px); border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent); }
.topbar-search { max-width: 760px; flex: 1; display: flex; gap: 9px; align-items: center; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 7px 8px 7px 12px; box-shadow: 0 8px 25px rgba(62,58,116,.05); }
.topbar-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
.topbar-actions { margin-left: auto; display: flex; gap: 9px; align-items: center; }
.avatar { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--accent); color: white; font-weight: 800; }
.mobile-menu { display: none !important; }

.view { display: none; padding: 30px 30px 44px; max-width: 1500px; margin: 0 auto; }
.view.active { display: block; }
.hero-row, .section-title-row { display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; margin-bottom: 24px; }
.eyebrow { text-transform: uppercase; font-weight: 800; font-size: 11px; letter-spacing: .13em; color: var(--brand-gold, var(--accent)); margin-bottom: 6px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(29px, 4vw, 42px); margin-bottom: 6px; letter-spacing: -.04em; }
h2 { font-size: 18px; margin-bottom: 0; letter-spacing: -.02em; }
.muted { color: var(--muted); }
.small-text { font-size: 13px; }

button.primary, .primary { border: 0; background: var(--accent); color: white; font-weight: 750; border-radius: 11px; padding: 11px 15px; box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 25%, transparent); }
.primary:hover { filter: brightness(.98); transform: translateY(-1px); }
.primary.small { padding: 8px 12px; font-size: 13px; }
.secondary, button.secondary { border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 11px; padding: 10px 13px; font-weight: 700; }
.danger { border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); background: color-mix(in srgb, var(--danger) 10%, var(--panel)); color: var(--danger); border-radius: 11px; padding: 10px 13px; font-weight: 700; }
.ghost { background: transparent; }
.icon-btn { width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--border); background: var(--panel); color: var(--text); display: inline-grid; place-items: center; }

.type-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.type-card { border: 1px solid color-mix(in srgb, var(--type-color) 18%, var(--border)); background: color-mix(in srgb, var(--type-color) 10%, var(--panel)); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 14px; min-height: 102px; transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease, border-color .16s ease; }
.type-card-top { display:flex; justify-content:space-between; gap:8px; align-items:center; }
.type-card-controls { display:flex; align-items:center; gap:8px; }
.area-drag-grip { color: color-mix(in srgb, var(--type-color) 55%, var(--muted)); font-weight:900; letter-spacing:-2px; line-height:1; cursor:grab; user-select:none; -webkit-user-select:none; touch-action:none; padding:4px 2px; border-radius:7px; opacity:.7; }
.area-drag-grip:hover { opacity:1; background:color-mix(in srgb, var(--type-color) 10%, transparent); }
.type-card:active .area-drag-grip, .area-drag-grip:active { cursor:grabbing; }
.type-card.dragging { opacity:.48; transform:scale(.98); box-shadow:none; }
.type-card.drag-over { transform:translateY(-3px); border-color:color-mix(in srgb, var(--type-color) 58%, var(--border)); box-shadow:0 12px 28px color-mix(in srgb, var(--type-color) 18%, transparent); }
.type-icon { width: 31px; height: 31px; border-radius: 10px; display:grid; place-items:center; color: var(--type-color); background: color-mix(in srgb, var(--type-color) 14%, transparent); font-weight:900; }
.type-count { font-size: 24px; font-weight: 850; letter-spacing: -.04em; }
.type-name { font-size: 13px; color: var(--muted); margin-top: -10px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 18px; align-items:start; }
.dashboard-main-column, .dashboard-side-column { display:grid; gap:18px; align-content:start; min-width:0; }
.dashboard-side-column { position:sticky; top:90px; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 14px; }
.today-panel, .category-panel, .upcoming-panel, .quick-panel { width: 100%; }
.upcoming-panel { min-height: 280px; }
.quick-panel { min-height: 220px; }
.category-upcoming-list { display:grid; gap:14px; }
.category-date-group { border-top:1px solid var(--border); padding-top:12px; }
.category-date-group:first-child { border-top:0; padding-top:0; }
.category-date { font-size:12px; font-weight:850; color:var(--muted); margin-bottom:7px; }
.empty-state.compact { padding:22px 12px; }
.segmented { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.seg-btn { border: 1px solid var(--border); background: var(--panel-2); color: var(--muted); padding: 6px 9px; border-radius: 999px; font-size: 12px; }
.seg-btn.active { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 25%, var(--border)); font-weight: 750; }

.item-list { display: grid; gap: 9px; }
.item-row { display: grid; grid-template-columns: auto auto minmax(0,1fr) auto auto; gap: 12px; align-items: center; padding: 12px 10px; border: 1px solid transparent; border-bottom-color: var(--border); border-radius: 10px; }
.item-row:hover { background: var(--panel-2); border-color: var(--border); }
.assignment-item-row { cursor:pointer; }
.assignment-item-row:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.assignment-item-row .check,
.assignment-item-row .more-btn { cursor:pointer; }
.assignment-row-actions { display:flex; gap:6px; align-items:center; }
.assignment-action-btn { border:1px solid var(--border); background:var(--panel); color:var(--text); border-radius:9px; padding:6px 9px; font-size:11px; font-weight:750; }
.assignment-action-btn:hover { background:var(--accent-soft); color:var(--accent); border-color:color-mix(in srgb, var(--accent) 25%, var(--border)); }
.item-row.completed { opacity: .62; }
.item-row.completed .item-title { text-decoration: line-through; }
.check { width: 21px; height: 21px; border-radius: 7px; border: 1.5px solid var(--border); background: var(--panel); display:grid; place-items:center; color:white; padding:0; }
.check.done { border-color: var(--success); background: var(--success); }
.item-type-dot { width: 34px; height: 34px; border-radius: 11px; display:grid; place-items:center; font-weight:900; }
.item-title { font-weight: 760; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-meta { color: var(--muted); font-size: 12px; margin-top: 3px; display:flex; flex-wrap:wrap; gap:8px; }
.badge { border-radius: 999px; padding: 5px 8px; font-size: 11px; font-weight: 750; background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); }
.badge.high { background: #fff0f2; color:#c64762; border-color:#ffd7df; }
.more-btn { border:0; background:transparent; color:var(--muted); font-size:19px; padding:3px 7px; }
.empty-state { padding: 36px 14px; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: 14px; }

.upcoming-list { display:grid; gap:10px; }
.upcoming-day { padding: 10px 0; border-bottom:1px solid var(--border); }
.upcoming-day:last-child { border-bottom:0; }
.upcoming-date { font-size:12px; font-weight:800; color:var(--muted); margin-bottom:7px; }
.upcoming-entry { display:flex; width:100%; gap:10px; align-items:flex-start; margin:5px 0; padding:9px 8px; font-size:13px; text-align:left; border:0; border-radius:10px; background:transparent; color:var(--text); }
.upcoming-entry:hover { background:var(--panel-2); }
.upcoming-entry strong { display:block; }
.upcoming-color { width:9px; height:9px; border-radius:50%; margin-top:5px; flex:0 0 auto; }
.quick-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; }
.quick-action { border:1px solid var(--border); background:var(--panel-2); padding:12px; border-radius:12px; display:flex; align-items:center; gap:9px; text-align:left; color:var(--text); }
.quick-action:hover { border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); background:var(--accent-soft); }

.calendar-panel { padding: 0; overflow:hidden; }
.calendar-toolbar { display:flex; align-items:center; gap:10px; padding:16px 18px; border-bottom:1px solid var(--border); }
.calendar-toolbar h2 { margin-right:auto; }
.calendar-grid { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); }
.calendar-weekdays { border-bottom:1px solid var(--border); background:var(--panel-2); }
.calendar-weekdays > div { padding:10px; font-size:11px; text-transform:uppercase; letter-spacing:.08em; color:var(--muted); font-weight:800; }
.calendar-day { min-height: 132px; padding:9px; border-right:1px solid var(--border); border-bottom:1px solid var(--border); overflow:hidden; background:var(--panel); }
.calendar-day:nth-child(7n) { border-right:0; }
.calendar-day.muted-day { background:var(--panel-2); opacity:.55; }
.calendar-day.today { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.day-number { width:28px; height:28px; border-radius:8px; display:grid; place-items:center; font-weight:800; font-size:12px; margin-bottom:6px; }
.today .day-number { background:var(--accent); color:white; }
.calendar-event { display:block; width:100%; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; border:0; border-left:3px solid var(--event-color); border-radius:6px; background:color-mix(in srgb, var(--event-color) 11%, var(--panel)); color:var(--text); padding:5px 6px; margin-bottom:4px; font-size:11px; text-align:left; }

.filters-row { display:grid; grid-template-columns:minmax(0,1fr) 190px 190px; gap:10px; margin-bottom:14px; }
.search-input, select, input, textarea { border:1px solid var(--border); background:var(--panel); color:var(--text); border-radius:10px; padding:10px 11px; outline:0; }
.search-input:focus, select:focus, input:focus, textarea:focus { border-color:color-mix(in srgb, var(--accent) 55%, var(--border)); box-shadow:0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent); }

.settings-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; }
.type-settings { display:grid; gap:8px; }
.type-setting-row { display:grid; grid-template-columns:auto auto minmax(0,1fr) auto auto auto; gap:9px; align-items:center; padding:10px; border:1px solid var(--border); border-radius:12px; background:var(--panel-2); }
.drag-handle { color:var(--muted); }
.visibility-toggle { width:38px; height:22px; border-radius:99px; border:0; background:#cfd1dd; padding:3px; display:flex; justify-content:flex-start; }
.visibility-toggle::after { content:""; width:16px; height:16px; background:white; border-radius:50%; box-shadow:0 2px 5px rgba(0,0,0,.2); }
.visibility-toggle.on { background:var(--accent); justify-content:flex-end; }
.mini-btn { border:1px solid var(--border); background:var(--panel); color:var(--muted); width:30px; height:30px; border-radius:9px; }
.settings-row { display:flex; justify-content:space-between; gap:16px; align-items:center; padding:13px 0; border-top:1px solid var(--border); }
.settings-row.stack { display:block; }
.button-row { display:flex; flex-wrap:wrap; gap:9px; margin-top:12px; }
.file-label { display:inline-flex; align-items:center; }
.pill { border:1px solid var(--border); border-radius:999px; padding:6px 9px; color:var(--muted); background:var(--panel-2); font-size:12px; }
.theme-options { display:flex; gap:9px; flex-wrap:wrap; }
.theme-chip { border:1px solid var(--border); background:var(--panel-2); color:var(--text); border-radius:999px; padding:8px 12px; }
.theme-chip.active { outline:2px solid var(--accent); outline-offset:2px; }

.modal {
  --drag-x: 0px;
  --drag-y: 0px;
  position:fixed;
  top:50%;
  left:50%;
  margin:0;
  width:min(980px, calc(100vw - 48px));
  max-width:calc(100vw - 48px);
  max-height:calc(100dvh - 48px);
  overflow:hidden;
  transform:translate(calc(-50% + var(--drag-x)), calc(-50% + var(--drag-y)));
  border:1px solid var(--border);
  border-radius:20px;
  background:var(--panel);
  color:var(--text);
  padding:0;
  box-shadow:0 30px 90px rgba(24,22,60,.28);
}
.modal::backdrop { background:rgba(20,20,42,.35); backdrop-filter:blur(3px); }
.modal.narrow { width:min(540px, calc(100vw - 48px)); }
.modal form {
  padding:20px;
  max-height:calc(100dvh - 48px);
  overflow-y:auto;
  overflow-x:hidden;
}
.modal-head {
  position:sticky;
  top:-20px;
  z-index:5;
  display:flex;
  justify-content:space-between;
  gap:16px;
  align-items:start;
  margin:-20px -20px 18px;
  padding:20px 20px 14px;
  background:var(--panel);
  border-bottom:1px solid color-mix(in srgb, var(--border) 70%, transparent);
  cursor:grab;
  touch-action:none;
}
.modal-head:active { cursor:grabbing; }
.modal-head button,
.modal-head input,
.modal-head select,
.modal-head textarea,
.modal-head a { cursor:pointer; }
.modal-head-actions { display:flex; align-items:center; gap:8px; }
.modal-head h2 { font-size:24px; }
.form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:13px; }
.form-grid label { display:grid; gap:6px; font-size:12px; color:var(--muted); font-weight:700; }
.form-grid > .full { grid-column:1/-1; }
.check-row { display:flex !important; grid-template-columns:auto 1fr; align-items:center; }
.check-row input { width:auto; }
.modal-actions { display:flex; gap:9px; justify-content:flex-end; align-items:center; margin-top:18px; }
.modal-actions .danger { margin-right:auto; }

.assignment-fields { display:grid; width:100%; min-width:0; gap:10px; border:1px solid var(--border); border-radius:15px; padding:16px; background:var(--panel-2); margin:2px 0 4px; }
.assignment-workspace-head { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; padding:2px 2px 4px; }
.assignment-workspace-head h3 { margin:0 0 4px; font-size:19px; color:var(--text); }

.assignment-card { border:1px solid var(--border); border-radius:12px; background:var(--panel); overflow:hidden; }
.assignment-card > summary { list-style:none; cursor:pointer; padding:12px 13px; display:flex; align-items:center; justify-content:space-between; gap:12px; user-select:none; }
.assignment-card > summary::-webkit-details-marker { display:none; }
.assignment-card > summary::after { content:"›"; color:var(--muted); font-size:20px; line-height:1; transform:rotate(0deg); transition:.15s ease; }
.assignment-card[open] > summary::after { transform:rotate(90deg); }
.assignment-card > summary > span:first-child { min-width:0; }
.assignment-card > summary strong { display:block; color:var(--text); font-size:14px; }
.assignment-card > summary small { display:block; color:var(--muted); font-size:11px; margin-top:2px; font-weight:500; }
.assignment-summary-status { margin-left:auto; border:1px solid var(--border); border-radius:999px; padding:5px 8px; background:var(--panel-2); color:var(--muted); font-size:11px; font-weight:800; white-space:nowrap; }
.assignment-card-body { border-top:1px solid var(--border); padding:13px; }
.assignment-card-body label { display:grid; gap:6px; color:var(--muted); font-size:12px; font-weight:700; }

.assignment-details-grid,
.assignment-dates-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:11px; }
.assignment-dates-grid .full { grid-column:1/-1; }

.assignment-people-list { display:grid; gap:8px; margin-bottom:12px; }
.assignment-people-empty { padding:16px 12px; text-align:center; border:1px dashed var(--border); border-radius:10px; background:var(--panel-2); color:var(--muted); font-size:12px; }
.assignment-person-card { display:flex; justify-content:space-between; gap:12px; align-items:center; padding:10px 11px; border:1px solid var(--border); border-radius:11px; background:var(--panel-2); }
.assignment-person-main { display:flex; align-items:flex-start; gap:10px; min-width:0; }
.assignment-person-avatar { width:34px; height:34px; flex:0 0 auto; border-radius:10px; display:grid; place-items:center; background:var(--accent-soft); color:var(--accent); font-weight:850; }
.assignment-person-info { min-width:0; }
.assignment-person-name { font-weight:800; color:var(--text); }
.assignment-person-meta { display:flex; flex-wrap:wrap; gap:7px; align-items:center; color:var(--muted); font-size:11px; margin-top:3px; }
.assignment-person-role { display:inline-flex; border:1px solid var(--border); border-radius:999px; padding:3px 7px; background:var(--panel); color:var(--text); font-weight:750; }
.assignment-person-congregation { margin-top:5px; color:var(--text); font-size:11px; font-weight:700; overflow-wrap:anywhere; }
.assignment-person-notes { margin-top:5px; color:var(--muted); font-size:11px; overflow-wrap:anywhere; }
.assignment-person-card-actions { display:flex; gap:6px; flex:0 0 auto; }
.assignment-person-remove { color:var(--danger); }
.assignment-person-editor { border-top:1px solid var(--border); padding-top:12px; }
.assignment-person-editor-head { display:flex; justify-content:space-between; gap:12px; align-items:baseline; margin-bottom:9px; }
.assignment-person-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; }
.assignment-person-fields label { display:grid; gap:6px; }
.assignment-person-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:9px; }

.assignment-phase-add { display:grid; grid-template-columns:minmax(0,1fr) 150px auto; gap:8px; align-items:center; margin-bottom:10px; }
.assignment-phase-list { display:grid; gap:7px; }
.assignment-phase-row { display:grid; grid-template-columns:auto minmax(0,1fr) 145px auto; gap:8px; align-items:center; padding:8px; border:1px solid var(--border); border-radius:10px; background:var(--panel-2); }
.assignment-phase-row.done { opacity:.62; }
.assignment-phase-row.done .assignment-phase-text { text-decoration:line-through; }
.assignment-phase-check { display:flex !important; align-items:center; justify-content:center; }
.assignment-phase-check input { width:18px; height:18px; margin:0; }
.assignment-phase-text,
.assignment-phase-date { width:100%; }
.assignment-phase-remove { color:var(--danger); }
.assignment-phase-empty { padding:15px 12px; text-align:center; color:var(--muted); border:1px dashed var(--border); border-radius:10px; font-size:12px; background:var(--panel-2); }
.assignment-progress { color:var(--accent); background:var(--accent-soft); border-color:color-mix(in srgb, var(--accent) 22%, var(--border)); }

.family-fields { display:grid; width:100%; min-width:0; gap:10px; border:1px solid var(--border); border-radius:15px; padding:16px; background:var(--panel-2); margin:2px 0 4px; }
.family-workspace-head { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; padding:2px 2px 4px; }
.family-workspace-head h3 { margin:0 0 4px; font-size:19px; color:var(--text); }
.family-workspace-panel { border:1px solid var(--border); border-radius:12px; background:var(--panel); padding:13px; }
.family-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:11px; }
.family-grid label { display:grid; gap:6px; color:var(--muted); font-size:12px; font-weight:700; }
.family-grid .full { grid-column:1/-1; }

.assignment-view-mode .item-structure-field { display:none !important; }
.assignment-view-mode .assignment-person-editor,
.assignment-view-mode .assignment-person-card-actions,
.assignment-view-mode .assignment-phase-add,
.assignment-view-mode .assignment-phase-remove { display:none !important; }
.assignment-view-mode #assignmentFields input:disabled:not([type="checkbox"]),
.assignment-view-mode #assignmentFields select:disabled,
.assignment-view-mode #assignmentFields textarea:disabled,
.assignment-view-mode #familyFields input:disabled,
.assignment-view-mode #familyFields select:disabled,
.assignment-view-mode #familyFields textarea:disabled {
  opacity:1;
  color:var(--text);
  -webkit-text-fill-color:var(--text);
  background:var(--panel-2);
  border-color:transparent;
  box-shadow:none;
  cursor:default;
}
.assignment-view-mode #assignmentFields textarea:disabled { resize:none; }
.assignment-view-mode .assignment-phase-row { grid-template-columns:auto minmax(0,1fr) 145px; }
.assignment-view-mode .assignment-phase-check input { cursor:pointer; }


.hidden { display:none !important; }

.toast { position:fixed; bottom:24px; left:50%; transform:translateX(-50%); background:var(--text); color:var(--panel); padding:11px 14px; border-radius:12px; box-shadow:var(--shadow); z-index:100; font-weight:700; font-size:13px; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position:fixed; left:-260px; width:240px; transition:.2s ease; box-shadow:var(--shadow); }
  .sidebar.open { left:0; }
  .mobile-menu { display:inline-grid !important; }
  .view { padding:22px 18px 36px; }
  .topbar { padding:10px 14px; }
  .dashboard-grid { grid-template-columns:1fr; }
  .dashboard-side-column { position:static; }
  .span-2 { grid-row:auto; }
  .settings-grid { grid-template-columns:1fr; }
}

@media (max-width: 700px) {
  .modal {
    width:calc(100vw - 20px);
    max-width:calc(100vw - 20px);
    max-height:calc(100dvh - 20px);
  }
  .modal.narrow { width:calc(100vw - 20px); }
  .modal form { max-height:calc(100dvh - 20px); padding:14px; }
  .modal-head { top:-14px; margin:-14px -14px 16px; padding:14px 14px 12px; cursor:default; }
  .topbar { height:auto; flex-wrap:wrap; padding-top:max(10px, env(safe-area-inset-top)); }
  .topbar-search { order:2; flex-basis:100%; }
  .hero-row, .section-title-row { align-items:flex-start; }
  .hero-row .primary, .section-title-row .primary { white-space:nowrap; }
  .type-strip { display:flex; overflow:auto; padding-bottom:4px; scroll-snap-type:x proximity; }
  .type-card { min-width:138px; scroll-snap-align:start; }
  .panel { border-radius:15px; padding:14px; }
  .item-row { grid-template-columns:auto auto minmax(0,1fr) auto; gap:9px; padding:10px 5px; }
  .item-row .badge { display:none; }
  .assignment-row-actions { gap:4px; }
  .assignment-action-btn { padding:5px 7px; font-size:10px; }
  .calendar-day { min-height:95px; padding:5px; }
  .calendar-event { padding:4px; font-size:10px; }
  .filters-row { grid-template-columns:1fr; }
  .form-grid { grid-template-columns:1fr; }
  .form-grid label.full { grid-column:auto; }
  .assignment-details-grid, .assignment-dates-grid, .assignment-person-fields, .family-grid { grid-template-columns:1fr; }
  .family-grid .full { grid-column:auto; }
  .assignment-person-card { align-items:flex-start; }
  .assignment-person-editor-head { flex-direction:column; gap:2px; }
  .assignment-dates-grid .full { grid-column:auto; }
  .assignment-phase-add { grid-template-columns:1fr; }
  .assignment-phase-row { grid-template-columns:auto minmax(0,1fr) auto; }
  .assignment-phase-date { grid-column:2 / 3; }
  .type-setting-row { grid-template-columns:auto auto minmax(0,1fr) auto; }
  .type-setting-row .order-btn { display:none; }
  h1 { font-size:31px; }
}

/* v2: nested life areas and disaster relief */
.area-settings { display:grid; gap:12px; }
.area-setting-card { border:1px solid var(--border); border-radius:14px; background:var(--panel-2); overflow:hidden; }
.area-setting-head { display:flex; justify-content:space-between; gap:12px; align-items:center; padding:12px; }
.area-setting-title { display:flex; align-items:center; gap:10px; min-width:0; }
.area-setting-title strong { display:block; }
.area-setting-title small { display:block; color:var(--muted); margin-top:2px; }
.area-setting-actions { display:flex; align-items:center; gap:7px; flex-wrap:wrap; justify-content:flex-end; }
.small-add { padding:7px 9px !important; font-size:12px; }
.section-tree { border-top:1px solid var(--border); padding:10px 12px 12px; display:grid; gap:10px; }
.section-group { display:grid; gap:5px; }
.section-group-name { text-transform:uppercase; letter-spacing:.08em; font-size:10px; font-weight:850; color:var(--muted); }
.section-row { display:flex; justify-content:space-between; align-items:center; gap:8px; padding:7px 8px; border-radius:9px; background:var(--panel); border:1px solid var(--border); font-size:13px; }
.relief-summary { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin-bottom:18px; }
.summary-card { background:var(--panel); border:1px solid var(--border); border-radius:16px; padding:15px; box-shadow:var(--shadow); }
.summary-card strong { display:block; font-size:26px; letter-spacing:-.04em; }
.summary-card span { display:block; color:var(--muted); font-size:12px; margin-top:4px; }
.relief-filters { grid-template-columns:minmax(0,1fr) 220px; }
.relief-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.relief-card { border:1px solid var(--border); border-radius:15px; padding:14px; background:var(--panel-2); }
.relief-card-head { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; }
.relief-card h3 { margin:0; font-size:17px; }
.status-pill { display:inline-flex; align-items:center; border-radius:999px; padding:6px 9px; font-size:11px; font-weight:800; border:1px solid var(--border); white-space:nowrap; }
.danger-status { color:#bd455b; background:#fff0f2; border-color:#ffd6de; }
.success-status { color:#287957; background:#ecf8f2; border-color:#cfeadc; }
.warning-status { color:#9a6821; background:#fff8e8; border-color:#f5e4bb; }
.relief-details { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; margin-top:14px; }
.relief-details div { padding:9px; border:1px solid var(--border); border-radius:10px; background:var(--panel); }
.relief-details span { display:block; color:var(--muted); font-size:10px; text-transform:uppercase; letter-spacing:.06em; }
.relief-details strong { display:block; margin-top:3px; font-size:12px; overflow-wrap:anywhere; }
.relief-note { margin-top:10px; padding:10px; border-left:3px solid #d37a3a; background:var(--panel); border-radius:9px; }
.relief-note strong { font-size:12px; }
.relief-note p { margin:4px 0 0; color:var(--muted); font-size:12px; }
.checklist-preview { margin-top:12px; }
.checklist-preview > div:first-child { display:flex; justify-content:space-between; gap:10px; font-size:12px; }
.checklist-preview span { color:var(--muted); }
.progress-track { height:7px; background:var(--border); border-radius:999px; overflow:hidden; margin-top:7px; }
.progress-track span { display:block; height:100%; background:var(--accent); border-radius:inherit; }
.relief-actions { display:flex; justify-content:flex-end; margin-top:12px; }

@media (max-width: 980px){ .relief-summary { grid-template-columns:repeat(2,minmax(0,1fr)); } .relief-list { grid-template-columns:1fr; } }
@media (max-width: 700px){ .relief-summary { grid-template-columns:repeat(2,minmax(0,1fr)); } .relief-filters { grid-template-columns:1fr; } .area-setting-head { align-items:flex-start; flex-direction:column; } .area-setting-actions { width:100%; justify-content:flex-start; } }
