/* The Web client's look (design boards: clean, light, blue accent). Fluent's tokens drive its controls; these tokens
   drive the page around them. Dark values apply when Fluent marks the body data-theme="dark". */
:root {
    --app-bg: #f4f6fb;
    --app-surface: #ffffff;
    --app-surface-hover: #f1f4f9;
    --app-border: #e4e8f0;
    --app-text: #1b2230;
    --app-text-muted: #5f6b7d;
    --app-brand: #1f6feb;
    --app-brand-soft: #e8f0fe;
    /* Text that must keep 4.5:1 (M5-09): brand-coloured text, text on the brand colour, warnings. */
    --app-brand-text: #1857c4;
    --app-on-brand: #ffffff;
    --app-danger: #c4314b;
    --app-shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.06);
    --app-radius: 12px;
    --app-font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

body[data-theme="dark"] {
    --app-bg: #111418;
    --app-surface: #1b1f26;
    --app-surface-hover: #242a33;
    --app-border: #2b313b;
    --app-text: #e8ecf2;
    --app-text-muted: #9aa5b5;
    --app-brand: #6ea4ff;
    --app-brand-soft: #1d2b44;
    --app-brand-text: #8fbaff;
    --app-on-brand: #0b1220;
    --app-danger: #ff8a96;
    --app-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

html, body {
    margin: 0;
    height: 100%;
    font-family: var(--app-font);
    background-color: var(--app-bg);
    color: var(--app-text);
    -webkit-font-smoothing: antialiased;
}

/* Before the client has started (and Fluent has set data-theme): no white flash in a dark system theme. */
@media (prefers-color-scheme: dark) {
    body:not([data-theme]) { background-color: #111418; }
}

.app-loading { position: fixed; inset: 0; display: grid; place-items: center; }
.app-loading::after {
    content: "";
    width: 32px;
    height: 32px;
    border: 3px solid #1f6feb33;
    border-top-color: #1f6feb;
    border-radius: 50%;
    animation: app-spin 0.8s linear infinite;
}
@keyframes app-spin { to { transform: rotate(360deg); } }

/* Layout: sidebar on the left (on phones it opens from the hamburger), content on a soft grey page. */
.fluent-layout-item.app-mobile-bar {
    background-color: var(--app-surface) !important;
    color: var(--app-text) !important;
    border-bottom: 1px solid var(--app-border);
    gap: 8px;
}
@media (min-width: 768px) {
    .fluent-layout-item.app-mobile-bar { display: none !important; }
}

.fluent-layout-item.app-sidebar {
    background-color: var(--app-surface) !important;
    border-right: 1px solid var(--app-border);
}
.app-sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
    padding: 20px 12px 12px;
    gap: 16px;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-mark {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, #3b82f6, #1f6feb);
    box-shadow: 0 2px 6px rgba(31, 111, 235, 0.35);
}
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }

.app-nav { flex: 1; --nav-bg-color: transparent; --nav-bg-color-hover: var(--app-surface-hover); }
.app-nav .fluent-navitem { border-radius: 10px; padding-top: 9px; padding-bottom: 9px; color: var(--app-text-muted); }
.app-nav .fluent-navitem.active { background-color: var(--app-brand-soft); color: var(--app-brand-text); }
.app-nav .fluent-navitem.active svg { fill: var(--app-brand) !important; }
.app-nav .fluent-navitem.active::after { display: none; }

.account { width: 100%; }
.account-button { width: 100%; justify-content: flex-start; height: auto; padding: 8px; border-radius: 10px; }
.account-content { display: flex; align-items: center; gap: 10px; min-width: 0; text-align: left; }
.account-text { display: flex; flex-direction: column; min-width: 0; }
.account-name { font-weight: 600; font-size: 13px; color: var(--app-text); }
.account-email { font-size: 12px; color: var(--app-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.fluent-layout-item.app-content { background-color: var(--app-bg) !important; }
.app-topbar { display: flex; justify-content: flex-end; gap: 4px; padding: 12px 24px 0; }
.app-main { max-width: 1120px; margin: 0 auto; padding: 4px 32px 32px; box-sizing: border-box; }
@media (max-width: 767px) {
    .app-topbar { padding: 8px 12px 0; }
    .app-main { padding: 4px 16px 24px; }
}

/* Pages */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 8px 0 20px; flex-wrap: wrap; }
.page-title, .list-name { margin: 0; font-size: 28px; line-height: 36px; font-weight: 650; letter-spacing: -0.02em; } /* one style for every page title, the list name included */
.page-title:focus, h1:focus { outline: none; } /* Blazor focuses the heading after navigation, for screen readers */
.page-subtitle { margin: 4px 0 0; color: var(--app-text-muted); }
.page-actions { display: flex; gap: 8px; align-items: center; }

.card {
    background-color: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow);
}

.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 56px 24px; gap: 4px; }
.empty-icon {
    display: grid;
    place-items: center;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background-color: var(--app-brand-soft);
    margin-bottom: 12px;
}
.empty-icon svg { fill: var(--app-brand) !important; width: 40px !important; height: 40px; }
.empty-title { margin: 0; font-weight: 600; font-size: 16px; }
.empty-text { margin: 0; color: var(--app-text-muted); max-width: 420px; }

.status-banner { margin-bottom: 16px; border-radius: 10px; }

/* Signed out */
.sign-in {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 16px;
    box-sizing: border-box;
    background:
        radial-gradient(1200px 600px at 10% -10%, #dfe9ff 0%, transparent 60%),
        radial-gradient(900px 500px at 110% 110%, #e6f4ff 0%, transparent 55%),
        var(--app-bg);
}
body[data-theme="dark"] .sign-in {
    background:
        radial-gradient(1200px 600px at 10% -10%, #1a2742 0%, transparent 60%),
        radial-gradient(900px 500px at 110% 110%, #13263a 0%, transparent 55%),
        var(--app-bg);
}
.sign-in-card { max-width: 400px; width: 100%; padding: 32px; box-sizing: border-box; display: flex; flex-direction: column; gap: 20px; }
.sign-in-card .brand { padding: 0; }
.sign-in-title { margin: 0; font-size: 24px; font-weight: 650; letter-spacing: -0.02em; }
.sign-in-text { margin: 4px 0 0; color: var(--app-text-muted); }
.sign-in-google { width: 100%; height: 40px; }
.sign-in-foot { display: flex; justify-content: center; }

/* Small pieces */
.muted { color: var(--app-text-muted); }
.role-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    background-color: var(--app-brand-soft);
    color: var(--app-brand-text);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.group-avatar {
    display: grid;
    place-items: center;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--app-brand-soft);
}
.group-avatar svg { fill: var(--app-brand) !important; }
.section-title { margin: 0 0 8px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--app-text-muted); }

/* List header (Tasks, Shopping) */
.list-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 8px 0 20px; flex-wrap: wrap; }
.list-title { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.list-kicker { font-size: 13px; font-weight: 600; color: var(--app-brand-text); text-transform: uppercase; letter-spacing: 0.05em; }
.list-switcher { height: auto; padding: 0 4px 0 0; margin-left: -2px; }
.list-name { color: var(--app-text); } /* size, weight and spacing come from .page-title above */
.list-meta { display: flex; align-items: center; gap: 8px; color: var(--app-text-muted); font-size: 13px; }
.avatar-stack { display: inline-flex; }
.avatar-stack > * { margin-left: -6px; border-radius: 50%; box-shadow: 0 0 0 2px var(--app-bg); }
.avatar-stack > *:first-child { margin-left: 0; }

/* People lists (share dialog, groups) */
.people-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.person-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; min-height: 40px; }
.person-row + .person-row { border-top: 1px solid var(--app-border); }
.person-row.pending .person-name { color: var(--app-text-muted); }
.person-name { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.person-name > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-sub { font-size: 12px; color: var(--app-text-muted); }
.you { margin-left: 0.3em; color: var(--app-text-muted); }
.person-row > fluent-select, .row-actions { flex: none; }
.row-actions { display: flex; align-items: center; gap: 4px; }
.share-section + .share-section { margin-top: 20px; }
.invite-link { margin-top: 12px; padding: 12px; border-radius: 10px; background-color: var(--app-brand-soft); display: flex; flex-direction: column; gap: 8px; }

/* Groups */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.group-card { padding: 16px 20px; display: flex; flex-direction: column; gap: 8px; }
.group-head { display: flex; align-items: center; gap: 12px; }
.group-head .group-avatar { width: 40px; height: 40px; border-radius: 12px; }
.group-title { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.group-name { margin: 0; font-size: 16px; font-weight: 600; }
.group-foot { padding-top: 4px; }

/* Invitation */
.center-page { display: grid; place-items: center; min-height: 60vh; }
.invite-card { max-width: 440px; width: 100%; padding: 32px; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.invite-card .empty-icon { margin-bottom: 4px; }

/* The current choice in a menu (list switcher, theme). */
.menu-current { font-weight: 600; color: var(--app-brand-text); }
.inline-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-form > * { flex: none; }
/* Plain inputs where typed text gates an action: Fluent's Immediate inputs send the text 200 ms late (P11-FIX). */
.text-input { height: 32px; padding: 0 10px; border: 1px solid var(--app-border); border-radius: 6px; background-color: var(--app-surface); color: var(--app-text); font: inherit; font-size: 14px; }
.text-input:focus { outline: none; border-color: var(--app-brand); }
.text-input::placeholder { color: var(--app-text-muted); }
.name-field { font-size: 14px; color: var(--app-text); }
.name-field .text-input { width: 100%; box-sizing: border-box; }

/* Settings */
.settings { display: flex; flex-direction: column; gap: 16px; max-width: 760px; }
.settings-card { padding: 20px 24px; }
.settings-title { margin: 0 0 8px; font-size: 16px; font-weight: 600; }
.settings-hint { margin: 0 0 8px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; flex-wrap: wrap; }
.setting-row + .setting-row { border-top: 1px solid var(--app-border); }
.setting-text { display: flex; flex-direction: column; gap: 2px; }
.allowlist { margin-top: 8px; }
.person-name .role-pill { margin-left: 8px; }

/* Shopping (board 05): tabs, the list card with quick add on top, item rows, the item editor, the undo toast. */
.shop-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--app-border); margin: -8px 0 16px; overflow-x: auto; scrollbar-width: none; }
.shop-tabs::-webkit-scrollbar { display: none; }
/* Material 3 style tab: 48px high, 16px side padding, state layer, rounded 3px indicator as wide as the label. */
.shop-tab { position: relative; flex: none; display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; min-height: 48px; min-width: 72px; padding: 0 16px; border: none; background-color: transparent; white-space: nowrap; color: var(--app-text-muted); text-decoration: none; font-weight: 500; font-size: 14px; border-radius: 8px 8px 0 0; cursor: pointer; transition: background-color .15s, color .15s; }
.shop-tab::after { content: ""; position: absolute; left: 16px; right: 16px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--app-brand); transform: scaleX(0); transition: transform .2s ease; }
.shop-tab:hover { color: var(--app-text); background-color: color-mix(in srgb, var(--app-text) 8%, transparent); }
.shop-tab:focus-visible { outline: 2px solid var(--app-brand); outline-offset: -2px; background-color: color-mix(in srgb, var(--app-text) 12%, transparent); }
.shop-tab:active { background-color: color-mix(in srgb, var(--app-text) 14%, transparent); }
.shop-tab.active { color: var(--app-brand-text); font-weight: 600; }
.shop-tab.active::after { transform: scaleX(1); }
.shop-tab.active:hover, .shop-tab.active:active { color: var(--app-brand-text); background-color: color-mix(in srgb, var(--app-brand) 14%, transparent); }

.shop-card { padding: 16px; max-width: 760px; }
.shop-spinner { margin: 24px auto; display: block; }
.shop-empty { margin: 24px 8px; color: var(--app-text-muted); text-align: center; }

.quick-add { position: relative; display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 44px; border-radius: 10px; background-color: var(--app-surface-hover); border: 1px solid transparent; }
.quick-add:focus-within { border-color: var(--app-brand); background-color: var(--app-surface); }
.quick-add-icon { display: grid; place-items: center; }
.quick-add-icon svg { fill: var(--app-text-muted) !important; }
.quick-add-input { flex: 1; min-width: 0; height: 100%; border: none; outline: none; background: transparent; font: inherit; font-size: 15px; color: var(--app-text); }
.quick-add-input::placeholder { color: var(--app-text-muted); }
.quick-add-options { position: absolute; z-index: 10; top: calc(100% + 4px); left: 0; right: 0; margin: 0; padding: 4px; list-style: none; background-color: var(--app-surface); border: 1px solid var(--app-border); border-radius: 10px; box-shadow: 0 8px 24px rgba(16, 24, 40, 0.12); }
.quick-add-option { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.quick-add-option:hover, .quick-add-option.active { background-color: var(--app-brand-soft); }
.option-text { flex: 1; }
.option-hint { font-size: 12px; color: var(--app-text-muted); }
.quick-add-hint { margin: 6px 4px 0; font-size: 13px; color: var(--app-text-muted); }

.shop-items { list-style: none; margin: 8px 0 0; padding: 0; }
.shop-item { display: flex; align-items: center; gap: 12px; padding: 8px 4px; min-height: 48px; border-radius: 8px; }
.shop-item + .shop-item { border-top: 1px solid var(--app-border); }
.shop-item.drop-target { box-shadow: inset 0 2px 0 var(--app-brand); }
.shop-item.flash { animation: shop-flash 1.6s ease-out; }
@keyframes shop-flash { from { background-color: var(--app-brand-soft); } to { background-color: transparent; } }
.item-check { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--app-brand); cursor: pointer; }
.item-icon { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background-color: var(--app-brand-soft); }
.item-icon svg { fill: var(--app-brand) !important; }
.item-icon.small { width: 28px; height: 28px; }
.item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 0; border: none; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.item-main:disabled { cursor: default; }
.item-text { font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.item-sub { font-size: 12px; color: var(--app-text-muted); }
.item-handle { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; cursor: grab; }
.item-handle svg { fill: var(--app-text-muted) !important; }
.item-handle:focus-visible { outline: 2px solid var(--app-brand); }

.shop-item-editor { padding: 4px 0 12px 52px; }
.item-editor { display: flex; flex-wrap: wrap; gap: 12px; padding: 12px; border-radius: 10px; background-color: var(--app-surface-hover); }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--app-text-muted); flex: 1 1 160px; }
.field.wide { flex: 2 1 240px; }
.field.narrow { flex: 0 1 110px; }
.field input, .field select { height: 34px; padding: 0 10px; border: 1px solid var(--app-border); border-radius: 8px; background-color: var(--app-surface); color: var(--app-text); font: inherit; font-size: 14px; }
.field input:focus, .field select:focus { outline: none; border-color: var(--app-brand); }
.field-error { flex-basis: 100%; margin: 0; color: var(--app-danger); font-size: 13px; }
.editor-actions { flex-basis: 100%; display: flex; align-items: center; gap: 8px; }
.editor-actions .spacer { flex: 1; }

.toast { position: fixed; z-index: 20; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: 10px; background-color: #2b313b; color: #fff; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); max-width: calc(100vw - 32px); }
.toast svg { fill: #6fd08c !important; }
.toast-text { font-size: 14px; }
.toast .toast-undo { color: #9cc3ff; font-weight: 600; }

/* My list with the suggestions panel beside it (below it on narrow screens). */
.shop-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 1100px) {
    .shop-layout { grid-template-columns: minmax(0, 1fr) 300px; }
}
.shop-layout .shop-card { max-width: none; }
.shop-panel { padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.shop-panel .section-title { margin-top: 8px; }
.shop-panel .section-title:first-child { margin-top: 0; }
.panel-hint { margin: 0 0 8px; font-size: 13px; color: var(--app-text-muted); }
.panel-list { list-style: none; margin: 0 0 8px; padding: 0; }
.panel-row { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.panel-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14px; }
.panel-on-list { font-size: 12px; color: var(--app-text-muted); padding: 0 6px; }
.staple-remove svg { fill: #e3a008 !important; }

/* Purchased and History */
.shop-status { margin: 0 4px 8px; font-size: 13px; color: var(--app-text-muted); }
.history-day { margin: 12px 4px 0; font-size: 13px; font-weight: 600; color: var(--app-text-muted); }
.history-day + .shop-items { margin-top: 0; }
.history-entry { min-height: 44px; padding-top: 4px; padding-bottom: 4px; }
.history-day:first-of-type { margin-top: 4px; }
.shop-item.purchased .item-main, .shop-item.history-entry .item-main { cursor: default; }
.show-more { margin: 12px auto 0; display: flex; }

/* Tasks (board 05; Ivan, P11): view tabs with search and New task, the task card, and the right column (this month and
   what is coming, or the task editor). */
.task-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-bottom: 1px solid var(--app-border); margin: -8px 0 16px; }
.task-toolbar .task-tabs { border-bottom: none; margin: 0; flex-wrap: wrap; row-gap: 0; overflow-x: visible; }
.task-tabs .shop-tab { font: inherit; font-weight: 500; font-size: 14px; }
.task-tabs .shop-tab.active { font-weight: 600; }
.task-actions { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; }
.task-search { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--app-border); background-color: var(--app-surface); }
.task-search svg { fill: var(--app-text-muted) !important; }
.task-search:focus-within { border-color: var(--app-brand); }
.task-search-input { width: 200px; border: none; outline: none; background: transparent; font: inherit; font-size: 14px; color: var(--app-text); }

.task-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 1100px) {
    .task-layout { grid-template-columns: minmax(0, 1fr) 340px; }
}
.task-card { padding: 16px; }
.task-day { margin: 16px 4px 4px; font-size: 14px; font-weight: 600; }
.task-day.overdue { color: var(--app-danger); }
.task-card > .task-day:first-child { margin-top: 0; }
.task-rows { list-style: none; margin: 4px 0 0; padding: 0; }
.task-row { display: flex; align-items: center; gap: 12px; padding: 8px 4px; min-height: 48px; border-radius: 8px; }
.task-row + .task-row { border-top: 1px solid var(--app-border); }
.task-row.selected { background-color: var(--app-brand-soft); }
.task-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 0; border: none; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.task-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.task-sub { font-size: 12px; color: var(--app-text-muted); }
.task-row.overdue .task-sub { color: var(--app-danger); }
.task-icon { display: grid; place-items: center; }
.task-icon svg { fill: var(--app-text-muted) !important; }

.task-panel { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.mini-head { display: flex; align-items: center; justify-content: space-between; }
.mini-month { font-weight: 600; font-size: 14px; text-transform: capitalize; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.mini-weekday { font-size: 11px; color: var(--app-text-muted); padding: 4px 0; }
.mini-day { position: relative; display: grid; place-items: center; height: 30px; border-radius: 50%; font-size: 12px; color: var(--app-text); text-decoration: none; }
.mini-day:hover { background-color: var(--app-surface-hover); }
.mini-day.other { color: var(--app-text-muted); }
.mini-day.today { background-color: var(--app-brand); color: var(--app-on-brand); font-weight: 600; }
.mini-day.busy::after { content: ""; position: absolute; bottom: 3px; width: 4px; height: 4px; border-radius: 50%; background-color: var(--app-brand); }
.mini-day.today.busy::after { background-color: var(--app-on-brand); }
.mini-upcoming-title { margin-top: 8px; }
.mini-upcoming { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mini-upcoming-row { display: flex; gap: 12px; font-size: 13px; }
.mini-upcoming-day { flex: none; width: 52px; color: var(--app-text-muted); }
.mini-upcoming-text { display: flex; flex-direction: column; min-width: 0; }

.task-editor { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.editor-head { display: flex; align-items: center; justify-content: space-between; }
.editor-head .section-title { margin: 0; }
.editor-fields { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; border: none; min-width: 0; }
.task-editor .field { flex: none; font-size: 12px; }
.task-editor .field .text-input, .task-editor .field select { width: 100%; box-sizing: border-box; }
.task-editor textarea.text-input { height: auto; padding: 6px 10px; resize: vertical; }
.task-editor .field select, .repeat-editor select { height: 32px; padding: 0 8px; border: 1px solid var(--app-border); border-radius: 6px; background-color: var(--app-surface); color: var(--app-text); font: inherit; font-size: 14px; }
.field-row { display: flex; gap: 8px; }
.field-row .field { flex: 1 1 0; min-width: 0; }
.field-row .field:first-child { flex-grow: 1; }
.field-row .field.narrow { flex: 0 0 108px; }
.field-hint { font-size: 12px; }
.reminder-row { display: flex; align-items: center; gap: 4px; }
.task-editor .reminder-add { align-self: flex-start; }
.repeat-editor { display: flex; flex-direction: column; gap: 8px; }
.repeat-row { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--app-text); }
.repeat-row .repeat-every { width: 64px; }
.repeat-row .repeat-until { width: 160px; }
.weekday { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--app-border); background-color: var(--app-surface); color: var(--app-text); font: inherit; font-size: 12px; cursor: pointer; }
.weekday.on { background-color: var(--app-brand); border-color: var(--app-brand); color: var(--app-on-brand); }
.assignee-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.assignee-chip { display: flex; align-items: center; gap: 6px; padding: 2px 10px 2px 2px; border-radius: 16px; border: 1px solid var(--app-border); background-color: var(--app-surface); color: var(--app-text); font: inherit; font-size: 13px; cursor: pointer; }
.assignee-chip.on { border-color: var(--app-brand); background-color: var(--app-brand-soft); }
.people-filter { width: 100%; }
.task-invitation { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.task-invite { align-self: flex-start; }
.radio-row { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--app-text); }
/* A task's Place field: the chosen place with its map, or the input with its suggestions (P17). */
.place-field { display: flex; flex-direction: column; gap: 6px; }
.place-chosen { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--app-text); }
.place-name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.place-open { font-size: 13px; color: var(--app-brand); white-space: nowrap; }
.place-chosen .place-remove { margin-left: auto; flex: none; }
.place-map { display: block; width: 100%; max-width: 400px; aspect-ratio: 2 / 1; object-fit: cover; border: 1px solid var(--app-border); border-radius: 8px; background-color: var(--app-brand-soft); }
.place-options { display: flex; flex-direction: column; border: 1px solid var(--app-border); border-radius: 8px; background-color: var(--app-surface); padding: 4px; max-height: 280px; overflow-y: auto; }
.place-option { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 8px; border: 0; border-radius: 6px; background: none; color: var(--app-text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.place-option:hover, .place-option:focus-visible { background-color: var(--app-brand-soft); outline: none; }
.place-option-detail { font-size: 12px; color: var(--app-text-muted); }
.place-attribution { padding: 4px 8px 2px; font-size: 11px; color: var(--app-text-muted); text-align: right; }
.place-unavailable { margin: 0; padding: 6px 8px; font-size: 13px; color: var(--app-text-muted); }
.place-options .place-save-typed { align-self: flex-start; margin: 0 4px 4px; }
.place-actions { display: flex; justify-content: flex-end; gap: 8px; }
.place-row .place-rename-input { flex: 1 1 auto; min-width: 0; }
.place-row-label { overflow-wrap: anywhere; }
/* Location reminder (task editor), my stores and the place of a purchase (P18). */
.location-reminder { gap: 6px; }
/* A checkbox drawn as a toggle (board 03 "Location reminder"); the label sits left of it. */
.switch-row { justify-content: space-between; max-width: 300px; }
.switch-row input[role="switch"] { order: 2; appearance: none; position: relative; flex: none; width: 40px; height: 22px; margin: 0;
    border-radius: 11px; background-color: var(--app-border); cursor: pointer; transition: background-color 0.15s; }
.switch-row input[role="switch"]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
    border-radius: 50%; background-color: var(--app-surface); box-shadow: var(--app-shadow); transition: transform 0.15s; }
.switch-row input[role="switch"]:checked { background-color: var(--app-brand); }
.switch-row input[role="switch"]:checked::after { transform: translateX(18px); }
.switch-row input[role="switch"]:focus-visible { outline: 2px solid var(--app-brand); outline-offset: 2px; }
.location-radius { width: 100%; max-width: 300px; accent-color: var(--app-brand); }
.stores-hint { margin: 0 0 8px; }
.store-add { margin-top: 12px; }
.link-button { padding: 0; border: 0; background: none; color: var(--app-brand); font: inherit; cursor: pointer; text-decoration: underline; }
.link-button:hover, .link-button:focus-visible { text-decoration: none; }
.purchase-panel { align-self: stretch; display: flex; flex-direction: column; gap: 8px; margin: 6px 0 4px; padding: 10px; border: 1px solid var(--app-border); border-radius: 8px; background-color: var(--app-surface); cursor: default; }
.purchase-panel .field, .store-add, .location-reminder .field { flex: none; }
.candidate-question { margin: 0; font-size: 14px; color: var(--app-text); }
.maps-usage { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 13px; color: var(--app-text); }
.maps-usage th, .maps-usage td { padding: 4px 8px; text-align: right; border-bottom: 1px solid var(--app-border); }
.maps-usage th:first-child, .maps-usage td:first-child { text-align: left; }
.maps-usage th:first-child { width: 90px; }
.maps-usage thead th { color: var(--app-text-muted); font-weight: 600; }
.maps-usage tfoot td { font-weight: 600; }
.maps-usage-days { max-height: 320px; overflow-y: auto; margin-top: 8px; }
.task-editor .editor-actions { flex-wrap: wrap; }
.scope-options { display: flex; flex-direction: column; gap: 10px; }
.scope-option { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.scope-option.disabled { color: var(--app-text-muted); }
.scope-hint { margin: 0; font-size: 13px; }

/* Calendar (plan M5-07; Ivan, P11: our own grid): toolbar, month cells with chips, week and day columns with all-day
   chips and timed blocks (48px an hour). */
.cal-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: -8px 0 16px; }
.cal-range { margin: 0 8px; font-size: 18px; font-weight: 600; text-transform: capitalize; flex: 1; }
.cal-views { display: flex; border: 1px solid var(--app-border); border-radius: 8px; overflow: hidden; }
.cal-view { padding: 6px 14px; border: none; background: var(--app-surface); color: var(--app-text); font: inherit; font-size: 14px; cursor: pointer; }
.cal-view + .cal-view { border-left: 1px solid var(--app-border); }
.cal-view.active { background-color: var(--app-brand); color: var(--app-on-brand); font-weight: 600; }
.cal-card { padding: 0; overflow: hidden; }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-weekday { padding: 8px; font-size: 12px; color: var(--app-text-muted); text-align: center; border-bottom: 1px solid var(--app-border); }
.cal-cell { min-height: 108px; padding: 4px; display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--app-border); border-bottom: 1px solid var(--app-border); min-width: 0; }
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.other { background-color: var(--app-surface-hover); }
.cal-cell.other .cal-cell-day { color: var(--app-text-muted); }
.cal-cell-day { align-self: flex-start; width: 26px; height: 26px; border-radius: 50%; border: none; background: none; color: var(--app-text); font: inherit; font-size: 12px; cursor: pointer; }
.cal-cell.today .cal-cell-day, .cal-day-head.today .cal-day-number { background-color: var(--app-brand); color: var(--app-on-brand); font-weight: 600; }
.cal-chip { display: flex; gap: 4px; align-items: baseline; width: 100%; padding: 2px 6px; border: none; border-radius: 4px; background-color: var(--app-brand-soft); color: var(--app-text); font: inherit; font-size: 12px; text-align: left; cursor: pointer; overflow: hidden; white-space: nowrap; }
.cal-chip-title { overflow: hidden; text-overflow: ellipsis; }
.cal-chip-time { flex: none; color: var(--app-text-muted); }
.cal-more { align-self: flex-start; border: none; background: none; padding: 0 6px; color: var(--app-brand-text); font: inherit; font-size: 12px; cursor: pointer; }
.cal-chip.done, .cal-block.done { opacity: 0.55; text-decoration: line-through; }
.cal-chip.overdue, .cal-block.overdue { box-shadow: inset 3px 0 0 var(--app-danger); }
.cal-chip.missed, .cal-block.missed { opacity: 0.55; }

.cal-week { --hour: 48px; display: flex; flex-direction: column; }
.cal-week-head, .cal-allday, .cal-grid { display: grid; grid-template-columns: 56px repeat(var(--days), minmax(0, 1fr)); }
.cal-week-head { border-bottom: 1px solid var(--app-border); }
.cal-day-head { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0; border: none; background: none; color: var(--app-text); font: inherit; cursor: pointer; }
.cal-day-name { font-size: 12px; color: var(--app-text-muted); text-transform: capitalize; }
.cal-day-number { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-size: 16px; }
.cal-allday { border-bottom: 1px solid var(--app-border); min-height: 32px; }
.cal-allday-label { font-size: 11px; color: var(--app-text-muted); padding: 6px 4px; text-align: right; }
.cal-allday-cell { display: flex; flex-direction: column; gap: 2px; padding: 3px; border-left: 1px solid var(--app-border); min-width: 0; }
.cal-scroll { max-height: calc(100vh - 300px); min-height: 360px; overflow-y: auto; }
.cal-grid { position: relative; }
.cal-hours { display: flex; flex-direction: column; }
.cal-hour { height: var(--hour); box-sizing: border-box; padding-right: 6px; font-size: 11px; color: var(--app-text-muted); text-align: right; transform: translateY(-7px); }
.cal-column { position: relative; height: calc(24 * var(--hour)); border-left: 1px solid var(--app-border);
    background-image: repeating-linear-gradient(to bottom, var(--app-border) 0, var(--app-border) 1px, transparent 1px, transparent var(--hour)); }
.cal-column.today { background-color: var(--app-brand-soft); }
.cal-block { position: absolute; box-sizing: border-box; display: flex; flex-direction: column; gap: 1px; padding: 3px 6px; border: none; border-left: 3px solid var(--app-brand);
    border-radius: 6px; background-color: var(--app-brand-soft); color: var(--app-text); font: inherit; font-size: 12px; text-align: left; overflow: hidden; cursor: pointer; }
.cal-column.today .cal-block { background-color: var(--app-surface); }
.cal-block-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-block-time { color: var(--app-text-muted); }
.cal-layout:not(.editing) { grid-template-columns: minmax(0, 1fr); }
.cal-block > span { flex: none; }
.cal-block-time { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* The client could not be downloaded (start.js): a plain message instead of a blank page. */
.app-load-failed { max-width: 28rem; margin: 20vh auto 0; padding: 0 16px; font-family: system-ui, sans-serif; }
.app-load-failed[hidden] { display: none; }
.app-load-failed-title { font-size: 1.25rem; font-weight: 600; }
.app-load-failed .app-reload { padding: 8px 16px; border: 0; border-radius: 6px; background: #1f6feb; color: #fff; font: inherit; cursor: pointer; }

/* Activity bell (P19; board 04's header bell): a badge on the bell and a card under it with the rows, newest first. */
.feed { position: relative; display: inline-flex; }
.feed-badge {
    position: absolute; top: 0; right: 0; min-width: 16px; height: 16px; padding: 0 4px; box-sizing: border-box; border-radius: 8px;
    background-color: var(--app-danger); color: var(--app-on-brand); font-size: 11px; line-height: 16px; font-weight: 600; text-align: center; pointer-events: none;
}
.feed-backdrop { position: fixed; inset: 0; z-index: 30; }
.feed-panel {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 31; width: 380px; max-width: calc(100vw - 24px); max-height: min(560px, 70vh);
    overflow-y: auto; padding: 12px 8px 8px; box-sizing: border-box; box-shadow: 0 8px 24px rgba(16, 24, 40, 0.16); outline: none;
}
.feed-title { margin: 0 8px 8px; font-size: 16px; font-weight: 650; }
.feed-empty { margin: 16px 8px 12px; color: var(--app-text-muted); }
.feed-rows { list-style: none; margin: 0; padding: 0; }
.feed-row { border-radius: 8px; }
.feed-row + .feed-row { border-top: 1px solid var(--app-border); }
.feed-row.unread { background-color: var(--app-brand-soft); }
.feed-row-body {
    display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 10px 8px; box-sizing: border-box; border: 0; border-radius: 8px;
    background: none; color: inherit; font: inherit; text-align: left;
}
button.feed-row-body { cursor: pointer; }
button.feed-row-body:hover { background-color: var(--app-surface-hover); }
.feed-row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; font-size: 14px; overflow-wrap: anywhere; }
.feed-dot { flex: none; width: 8px; height: 8px; margin-top: 8px; border-radius: 50%; background-color: var(--app-brand); }
.feed-row-note { display: block; padding: 0 8px 8px 42px; font-size: 12px; color: var(--app-danger); }
@media (max-width: 767px) {
    .feed-panel { position: fixed; top: 52px; right: 12px; }
}

.task-row.done .task-name { text-decoration: line-through; }
.task-row.done .task-main { opacity: 0.55; }

/* People first (P21): who I know, then the groups. */
.people-card { margin-bottom: 28px; }
.people-empty { margin: 8px 0; }
.people-card + .section-title { margin-bottom: 12px; }

/* ---- Phone and tablet layouts (P21-GAP-C) ---- */

/* Straight, inset dividers (the rows' rounded corners bent the border into a curve). */
.task-row, .shop-item { border-radius: 0; }
.task-row + .task-row, .shop-item + .shop-item { border-top: none; background-image: linear-gradient(var(--app-border), var(--app-border)); background-size: calc(100% - 40px) 1px; background-position: right top; background-repeat: no-repeat; }
.task-row.selected { background-image: none; }

/* A task's checkbox: a rounded outline, red when overdue. */
.task-check { appearance: none; width: 22px; height: 22px; border: 2px solid #c3cad6; border-radius: 6px; background: transparent; }
.task-row.overdue .task-check { border-color: var(--app-danger); }
.task-check:checked { background-color: var(--app-brand); border-color: var(--app-brand); }
.task-check:focus-visible { outline: 2px solid var(--app-brand); outline-offset: 2px; }

.task-fab, .app-bottom-nav, .close-back { display: none; }
.date-chips { display: flex; gap: 8px; }
.date-chip { padding: 6px 14px; border-radius: 16px; border: 1px solid var(--app-border); background: var(--app-surface); color: var(--app-text); font: inherit; font-size: 13px; cursor: pointer; }
.date-chip.on { border-color: var(--app-brand); background-color: var(--app-brand-soft); color: var(--app-brand-text); }
.editor-head { gap: 8px; }
.editor-head .section-title { flex: 1; }
.cal-dots { display: none; }
.more-list { padding: 4px 16px; margin-bottom: 16px; max-width: 760px; }
.more-row { display: flex; align-items: center; gap: 12px; width: 100%; box-sizing: border-box; padding: 12px 0; border: none; background: none; color: var(--app-text); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.more-row + .more-row { border-top: 1px solid var(--app-border); }
.more-row svg { fill: var(--app-text-muted) !important; }
.more-row .group-avatar svg { fill: var(--app-brand) !important; }
.settings { margin: 0 auto; }

@media (max-width: 767px) {
    /* Bottom navigation instead of the sidebar (Android's Shopping, Tasks, Calendar, More). */
    .fluent-layout-item.app-sidebar { display: none !important; }
    .app-bottom-nav { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; display: flex; height: 64px; background-color: var(--app-surface); border-top: 1px solid var(--app-border); }
    .bottom-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--app-text-muted); text-decoration: none; font-size: 12px; font-weight: 500; }
    .bottom-pill { display: grid; place-items: center; width: 56px; height: 28px; border-radius: 14px; }
    .bottom-item svg { fill: currentColor !important; }
    .bottom-item.active { color: var(--app-brand-text); }
    .bottom-item.active .bottom-pill { background-color: var(--app-brand-soft); }
    .app-main { padding: 0 16px 88px; }
    .app-topbar { padding: 4px 8px 0; min-height: 44px; align-items: center; }
    .page-header, .list-header { margin-top: 0; }

    /* List header: kicker, then the list name on the full width, then who has access (left) and the actions (right). */
    .list-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 8px; row-gap: 2px; }
    .list-title { display: contents; }
    .list-kicker { grid-column: 1 / -1; grid-row: 1; }
    .list-title > .list-menu { grid-column: 1 / -1; grid-row: 2; min-width: 0; justify-self: start; max-width: 100%; }
    .list-switcher { max-width: 100%; }
    .list-name { overflow-wrap: anywhere; text-align: left; }
    .list-meta { grid-column: 1; grid-row: 3; flex-wrap: wrap; min-width: 0; }
    .list-header .page-actions { grid-column: 2; grid-row: 3; width: auto; flex-wrap: nowrap; gap: 4px; justify-self: end; }
    .toast { bottom: 76px; }

    /* Tasks: one scrolling row of tabs, search below, New task as a round button. */
    .task-toolbar { flex-direction: column; align-items: stretch; gap: 8px; border-bottom: none; }
    .task-toolbar .task-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--app-border); }
    .task-toolbar .task-tabs::-webkit-scrollbar { display: none; }
    .task-tabs .shop-tab { flex: none; white-space: nowrap; }
    .task-actions { padding-bottom: 0; width: 100%; box-sizing: border-box; }
    .task-search { flex: 1; min-width: 0; }
    .task-search-input { width: 100%; }
    .task-actions .task-new { display: none; }
    .task-fab { position: fixed; z-index: 35; right: 16px; bottom: 80px; display: grid; place-items: center; width: 56px; height: 56px; border: none; border-radius: 50%; background-color: var(--app-brand); box-shadow: 0 4px 12px rgba(16, 24, 40, 0.3); cursor: pointer; }
    .task-fab svg { fill: var(--app-on-brand) !important; }
    .task-card { padding: 8px 12px; }

    /* The editor is a screen: back arrow, title and Save in the header. */
    .task-editor { position: fixed; z-index: 50; inset: 0 0 64px 0; overflow-y: auto; border: none; border-radius: 0; box-shadow: none; background-color: var(--app-bg); padding: 0 16px 24px; gap: 8px; }
    .task-editor .editor-head { position: sticky; top: 0; z-index: 1; margin: 0 -16px; padding: 8px 16px; background-color: var(--app-bg); border-bottom: 1px solid var(--app-border); }
    .editor-head .editor-close { order: -1; }
    .editor-head .section-title { font-size: 20px; text-transform: none; letter-spacing: 0; color: var(--app-text); }
    .close-x { display: none; }
    .close-back { display: inline-flex; }

    /* Calendar month: dots, and the chosen day's tasks below. */
    .cal-chip, .cal-more { display: none; }
    .cal-cell { min-height: 52px; align-items: center; cursor: default; }
    .cal-dots { display: flex; gap: 3px; }
    .cal-dots i { width: 6px; height: 6px; border-radius: 50%; background-color: var(--app-brand); }
    .cal-cell.selected .cal-cell-day { box-shadow: 0 0 0 2px var(--app-brand); }
    .cal-daylist { padding: 12px 16px; margin-top: 12px; display: flex; flex-direction: column; gap: 4px; }
    .cal-dayrow { display: flex; gap: 12px; padding: 8px 0; border: none; background: none; color: var(--app-text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
    .cal-dayrow-time { flex: none; width: 64px; color: var(--app-text-muted); }
    .cal-dayrow.done { opacity: 0.55; text-decoration: line-through; }

    /* People and Settings: roomy rows, full-width controls, wrapping text. */
    .page-actions { width: 100%; flex-wrap: wrap; }
    .person-row { padding: 12px 0; }
    .setting-row { flex-direction: column; align-items: stretch; gap: 8px; }
    .setting-row fluent-select, .setting-row .text-input { width: 100% !important; box-sizing: border-box; }
    .device-row .person-name > * { white-space: normal; overflow: visible; }
    .device-row { flex-wrap: wrap; }
}
