:root {
    color-scheme: light dark;
    --bg: #f5f7f8;
    --panel: #ffffff;
    --panel-soft: #fbfcfc;
    --surface: #f0f4f5;
    --surface-hover: #eef3f2;
    --text: #172026;
    --muted: #65737e;
    --line: #d9e0e5;
    --accent: #1b6f64;
    --accent-text: #ffffff;
    --danger: #a13636;
    --notice-bg: #fff4d8;
    --notice-border: #ead18b;
    --notice-text: #6f5312;
    --success-bg: #e8f4f1;
    --success-border: #bddbd4;
    --shadow: rgba(23, 32, 38, .14);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #101417;
    --panel: #171d21;
    --panel-soft: #1d2429;
    --surface: #20282d;
    --surface-hover: #263036;
    --text: #edf3f4;
    --muted: #9ba9b2;
    --line: #334047;
    --accent: #38b7a6;
    --accent-text: #071210;
    --danger: #ff8f8f;
    --notice-bg: #2c2414;
    --notice-border: #705b20;
    --notice-text: #f1d28b;
    --success-bg: #15302c;
    --success-border: #2a6b61;
    --shadow: rgba(0, 0, 0, .45);
}

@media (prefers-color-scheme: dark) {
    html[data-theme="system"] {
        color-scheme: dark;
        --bg: #101417;
        --panel: #171d21;
        --panel-soft: #1d2429;
        --surface: #20282d;
        --surface-hover: #263036;
        --text: #edf3f4;
        --muted: #9ba9b2;
        --line: #334047;
        --accent: #38b7a6;
        --accent-text: #071210;
        --danger: #ff8f8f;
        --notice-bg: #2c2414;
        --notice-border: #705b20;
        --notice-text: #f1d28b;
        --success-bg: #15302c;
        --success-border: #2a6b61;
        --shadow: rgba(0, 0, 0, .45);
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.page {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: calc(18px + env(safe-area-inset-top, 0px)) 0 calc(24px + env(safe-area-inset-bottom, 0px));
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
}

.appbar {
    align-items: flex-start;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    position: relative;
}

.appbar-compact {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 42px;
}

.appbar-title {
    min-width: 0;
}

.appbar-title h1 {
    line-height: 40px;
    margin-bottom: 4px;
}

.appbar-title p {
    margin: 0;
}

.appbar-title-row {
    align-items: flex-start;
    display: flex;
    gap: 4px;
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: start;
    min-width: 0;
    width: 100%;
}

.appbar-title-row .back-button {
    flex: 0 0 auto;
    margin-top: 0;
}

.back-button {
    border-radius: 999px;
    position: relative;
}

.back-button span {
    border-bottom: 3px solid currentColor;
    border-left: 3px solid currentColor;
    display: block;
    height: 14px;
    transform: translateX(2px) rotate(45deg);
    width: 14px;
}

.appbar-title h1,
.appbar-title p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topnav {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.topnav .button,
.topnav form {
    width: auto;
}

.topnav button,
.topnav .button {
    min-width: 96px;
    width: auto;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    margin: -8px 0 16px;
}

.page-actions .button {
    width: auto;
}

.top-actions {
    align-items: center;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    position: relative;
}

.appbar-compact .top-actions {
    grid-column: 2;
    justify-self: end;
}

.appbar:not(.appbar-compact) .top-actions {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-self: end;
    width: 100%;
}

.appbar:not(.appbar-compact) .home-button {
    font-size: 24px;
    margin-right: auto;
}

.icon-button {
    align-items: center;
    background: transparent;
    border-color: transparent;
    color: var(--text);
    display: inline-flex;
    height: 40px;
    justify-content: center;
    padding: 0;
    text-decoration: none;
    width: 40px;
}

.top-search {
    display: none;
    gap: 6px;
    grid-column: 1 / -1;
    margin-top: 8px;
    width: 100%;
}

.top-search.is-open,
.top-search:focus-within {
    display: flex;
}

.top-search input {
    flex: 1 1 auto;
    min-width: 0;
}

.top-search .search-submit {
    display: none;
}

.top-search.is-open .search-submit,
.top-search:focus-within .search-submit {
    display: inline-flex;
}

.avatar-menu,
.tools-menu {
    position: relative;
}

.avatar-menu summary,
.tools-menu summary {
    align-items: center;
    cursor: pointer;
    display: inline-flex;
    height: 42px;
    justify-content: center;
    list-style: none;
    width: 42px;
}

.avatar-menu summary::-webkit-details-marker,
.tools-menu summary::-webkit-details-marker {
    display: none;
}

.avatar-menu img {
    border: 1px solid var(--line);
    border-radius: 50%;
    display: block;
    height: 34px;
    width: 34px;
}

.avatar-preview {
    border: 1px solid var(--line);
    border-radius: 50%;
    height: 72px;
    object-fit: cover;
    width: 72px;
}

.avatar-cropper {
    display: grid;
    gap: 10px;
}

.avatar-cropper canvas {
    border: 1px solid var(--line);
    border-radius: 50%;
    cursor: move;
    max-width: 240px;
    touch-action: none;
    width: 100%;
}

.avatar-menu-panel,
.tools-menu-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 24px var(--shadow);
    display: grid;
    gap: 2px;
    max-width: min(320px, calc(100vw - 32px));
    min-width: 260px;
    padding: 8px;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 20;
}

.avatar-menu-panel > a,
.avatar-menu-panel > form > button,
.avatar-menu-panel > span:not(.menu-kicker) {
    align-items: center;
    background: transparent;
    border-color: transparent;
    color: var(--text);
    display: grid;
    gap: 10px;
    grid-template-columns: 24px minmax(0, 1fr);
    padding: 8px;
    text-align: left;
    text-decoration: none;
    width: 100%;
}

.tools-menu-panel > a,
.tools-menu-panel > button,
.tools-menu-panel > span {
    align-items: center;
    background: transparent;
    border-color: transparent;
    color: var(--text);
    display: flex;
    min-height: 40px;
    padding: 8px 12px;
    text-align: left;
    text-decoration: none;
    white-space: nowrap;
    width: 100%;
}

.tools-menu-panel > .has-menu-icon {
    display: grid;
    gap: 10px;
    grid-template-columns: 24px minmax(0, 1fr);
    white-space: normal;
}

.avatar-menu-panel .menu-icon,
.tools-menu-panel .menu-icon {
    display: inline-flex;
    grid-column: 1;
    justify-content: center;
    padding: 0;
    width: 24px;
}

.avatar-menu-panel > a > span:last-child,
.avatar-menu-panel > form > button > span:last-child,
.avatar-menu-panel > span:not(.menu-kicker) > span:last-child {
    grid-column: 2;
    min-width: 0;
    overflow-wrap: normal;
    word-break: normal;
}

.tools-menu-panel > .has-menu-icon > span:last-child {
    grid-column: 2;
    min-width: 0;
    overflow-wrap: normal;
    word-break: normal;
}

.avatar-menu-panel > strong,
.avatar-menu-panel > small,
.avatar-menu-panel .menu-kicker {
    padding-left: 8px;
    padding-right: 8px;
}

.avatar-menu-panel .menu-kicker {
    display: block;
    color: var(--text);
    font-weight: 600;
    padding-bottom: 2px;
}

.avatar-menu-panel > strong {
    padding-top: 4px;
}

.avatar-menu-panel > a:hover,
.avatar-menu-panel > form > button:hover,
.tools-menu-panel > a:hover,
.tools-menu-panel > button:hover {
    background: var(--surface-hover);
}

.avatar-menu-panel small {
    color: var(--muted);
    overflow-wrap: anywhere;
    padding-bottom: 8px;
}

h1, h2 {
    margin: 0 0 12px;
}

h1 {
    font-size: 28px;
}

h2 {
    font-size: 18px;
}

p {
    margin: 0 0 10px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}

.widget {
    transition: border-color .15s ease, box-shadow .15s ease, opacity .15s ease;
}

.widget-header {
    align-items: center;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) auto;
    position: relative;
}

.widget-header h2 {
    margin: 0;
    min-width: 0;
}

.widget-actions {
    align-items: center;
    display: inline-flex;
    gap: 4px;
    justify-self: end;
}

.unseen-badge {
    align-items: center;
    background: #f4b740;
    border-radius: 999px;
    color: #172026;
    display: none;
    font-size: 13px;
    font-weight: 800;
    height: 18px;
    justify-content: center;
    line-height: 1;
    width: 18px;
}

.widget.is-collapsed.has-unseen .unseen-badge {
    display: inline-flex;
}

.collapse-toggle,
.drag-handle {
    align-items: center;
    background: transparent;
    border-color: transparent;
    color: var(--text);
    display: inline-flex;
    height: 32px;
    justify-content: center;
    padding: 0;
    width: 32px;
}

.collapse-toggle {
    font-size: 16px;
}

.collapse-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.drag-handle {
    background: var(--surface-hover);
    border-color: var(--line);
    cursor: grab;
    display: none;
}

.widget-body {
    margin-top: 12px;
}

.widget.is-collapsed .widget-body {
    display: none;
}

.grid.is-editing-layout .widget {
    border-color: var(--accent);
    box-shadow: 0 2px 10px var(--shadow);
}

.grid.is-editing-layout .drag-handle {
    display: inline-flex;
}

.widget.is-dragging {
    opacity: .65;
}

.grid.is-editing-layout .drag-handle {
    touch-action: none;
}

.narrow {
    max-width: 440px;
    margin: 8vh auto;
}

.stack {
    display: grid;
    gap: 10px;
}

.compact {
    gap: 8px;
}

.row, .actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.row > *,
.actions > * {
    flex: 1 1 160px;
    min-width: 0;
}

label {
    display: grid;
    gap: 5px;
    font-weight: 600;
}

.check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    min-width: 0;
}

input, textarea, select, button, .button {
    width: 100%;
    background: var(--panel);
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 6px;
    padding: 9px 10px;
    font: inherit;
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    min-width: 16px;
}

fieldset {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px;
}

legend {
    color: var(--muted);
    font-weight: 600;
}

.order-field {
    color: var(--muted);
    font-size: 13px;
    margin: 0 0 8px 26px;
}

.order-field input {
    max-width: 90px;
}

.field-hint {
    color: var(--muted);
    font-size: 14px;
    margin: 0 0 10px;
}

.location-result {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    border-radius: 6px;
    color: var(--accent);
    font-size: 14px;
    margin: 2px 0 0;
    padding: 9px 10px;
}

.widget-option-list {
    display: grid;
    gap: 8px;
}

.recommendation-box {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) auto;
    margin-bottom: 10px;
    padding: 10px;
}

.recommendation-box p {
    color: var(--muted);
    font-size: 14px;
    margin: 0;
}

.recommendation-box button {
    white-space: nowrap;
    width: auto;
}

.widget-option {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    display: grid;
    gap: 8px;
    grid-template-columns: 36px minmax(0, 1fr);
    padding: 10px;
}

.settings-drag-handle {
    align-items: center;
    background: transparent;
    border: 0;
    color: var(--muted);
    cursor: grab;
    display: inline-flex;
    font-size: 20px;
    height: 36px;
    justify-content: center;
    line-height: 1;
    padding: 0;
    touch-action: none;
    width: 36px;
}

.settings-drag-handle:active {
    cursor: grabbing;
}

.widget-toggle {
    align-items: center;
    display: flex;
    gap: 10px;
    min-width: 0;
}

.widget-toggle span {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.widget-toggle small {
    color: var(--muted);
    font-weight: 500;
}

.widget-option .order-field {
    margin: 0;
    text-align: right;
}

.widget-option.is-dragging {
    opacity: .65;
}

.widget-page-link {
    color: var(--accent);
    display: inline-flex;
    font-size: 14px;
    font-weight: 600;
    justify-self: start;
    margin-bottom: 2px;
    text-decoration: none;
}

.full-page-tool textarea {
    min-height: 140px;
}

.integration-options {
    border-top: 1px solid var(--line);
    margin-top: 12px;
    padding-top: 12px;
}

.board-picker {
    display: grid;
    gap: 10px;
}

.board-picker section {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px;
}

.board-picker h3 {
    color: var(--muted);
    font-size: 13px;
    margin: 0 0 8px;
    text-transform: uppercase;
}

.board-picker-head {
    align-items: center;
    display: flex;
    gap: 8px;
    justify-content: space-between;
    margin-bottom: 8px;
}

.board-picker-head h3 {
    margin: 0;
}

.board-picker-head div {
    display: flex;
    gap: 6px;
}

.tiny-button {
    background: var(--panel);
    border-color: var(--line);
    color: var(--muted);
    font-size: 12px;
    padding: 5px 8px;
    width: auto;
}

.board-option {
    min-height: 34px;
}

textarea {
    min-height: 70px;
    resize: vertical;
}

button, .button {
    background: var(--accent);
    color: var(--accent-text);
    border-color: var(--accent);
    cursor: pointer;
    display: inline-block;
    text-align: center;
    text-decoration: none;
}

button.secondary, .secondary-link {
    background: var(--surface-hover);
    color: var(--text);
    border-color: var(--line);
}

button.danger {
    background: var(--danger);
    border-color: var(--danger);
}

.actions form {
    flex: 1 1 110px;
}

.item {
    border-top: 1px solid var(--line);
    padding-top: 12px;
    margin-top: 12px;
}

details.item summary {
    align-items: center;
    cursor: pointer;
    display: grid;
    gap: 3px;
    grid-template-columns: 1fr;
    list-style-position: outside;
    min-height: 44px;
    padding: 4px 0;
}

details.item summary span {
    font-weight: 700;
    overflow-wrap: anywhere;
}

details.item summary small,
.meta {
    color: var(--muted);
}

.details-body {
    display: grid;
    gap: 10px;
    padding-top: 8px;
}

.segmented {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    display: grid;
    gap: 3px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 3px;
}

.segmented button {
    background: transparent;
    border: 0;
    color: var(--muted);
    padding: 7px 6px;
}

.segmented button.is-active {
    background: var(--panel);
    color: var(--text);
    box-shadow: 0 1px 3px var(--shadow);
}

.todo-group {
    display: grid;
    gap: 8px;
}

.todo-group h3 {
    color: var(--muted);
    font-size: 13px;
    margin: 10px 0 0;
    text-transform: uppercase;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-list span {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 12px;
    padding: 3px 8px;
}

.archived-note {
    align-items: center;
    border-top: 1px solid var(--line);
    display: grid;
    gap: 4px;
    grid-template-columns: minmax(0, 1fr) auto;
    padding-top: 10px;
}

.archived-note small {
    color: var(--muted);
}

.group-title {
    color: var(--muted);
    font-size: 13px;
    margin: 16px 0 2px;
    text-transform: uppercase;
}

.done {
    opacity: .62;
}

.is-overdue summary span {
    color: var(--danger);
}

.is-due-today summary span {
    color: var(--accent);
}

.empty, .error {
    color: var(--muted);
    background: var(--surface);
    padding: 10px;
    border-radius: 6px;
}

.error, .flash.error {
    color: var(--danger);
}

.flash {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    border-radius: 6px;
    color: var(--accent);
    padding: 10px 12px;
    margin-bottom: 14px;
}

.connection-status {
    background: var(--notice-bg);
    border: 1px solid var(--notice-border);
    border-radius: 6px;
    color: var(--notice-text);
    margin: 0 0 12px;
    padding: 10px 12px;
}

.now-card {
    display: grid;
    gap: 12px;
}

.now-date-line,
.now-week {
    align-items: center;
    color: var(--muted);
    display: flex;
    gap: 7px;
    justify-content: center;
    text-align: center;
}

.now-time {
    font-size: 56px;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    letter-spacing: 0;
    line-height: 1;
    text-align: center;
}

.weather-locations {
    border-top: 1px solid var(--line);
    display: grid;
    gap: 8px;
    padding-top: 12px;
}

.weather-location-form {
    display: none;
}

.weather-secondary-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.weather-secondary-grid.is-single {
    grid-template-columns: 1fr;
}

.weather-card {
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 6px;
    display: grid;
    gap: 8px;
    padding: 10px;
}

.weather-card-current {
    padding: 12px;
}

.weather-card-head {
    align-items: center;
    color: var(--muted);
    display: flex;
    font-size: 13px;
    gap: 8px;
    justify-content: space-between;
}

.weather-card-head span {
    color: var(--text);
    font-weight: 700;
}

.weather-card-head small {
    color: var(--muted);
    font-size: 13px;
}

.weather-temp {
    font-size: 34px;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    line-height: 1;
    text-align: center;
}

.weather-card-current .weather-temp {
    font-size: 46px;
}

.weather-metrics {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    justify-content: center;
}

.weather-metrics > span {
    align-items: center;
    color: var(--muted);
    display: inline-flex;
    font-size: 13px;
    gap: 5px;
}

.weather-location-help {
    border-top: 1px solid var(--line);
    display: grid;
    gap: 8px;
    padding-top: 8px;
}

.weather-location-help[hidden] {
    display: none;
}

.weather-location-help details {
    color: var(--muted);
    font-size: 13px;
}

.weather-location-help summary {
    cursor: pointer;
}

.weather-location-help p {
    margin: 6px 0 0;
}

.weather-follow {
    align-items: center;
    border-top: 1px solid var(--line);
    color: var(--muted);
    display: flex;
    font-size: 13px;
    gap: 8px;
    justify-content: center;
    padding-top: 8px;
}

.forecast-strip {
    border-top: 1px solid var(--line);
    display: grid;
    gap: 6px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 4px;
    padding-top: 12px;
}

.forecast-strip section {
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 6px;
    display: grid;
    gap: 2px;
    min-width: 0;
    padding: 7px 4px;
    text-align: center;
}

.forecast-strip span,
.forecast-strip small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.25;
}

.icon {
    display: inline-flex;
    flex: 0 0 auto;
    height: 18px;
    width: 18px;
}

.icon svg {
    fill: none;
    height: 100%;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
    width: 100%;
}

.compact-empty {
    margin: 0;
    text-align: center;
}

.preview {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px;
    background: var(--panel-soft);
}

.preview p:last-child {
    margin-bottom: 0;
}

.import-form {
    border-top: 1px solid var(--line);
    margin-top: 12px;
    padding-top: 12px;
}

.status-row {
    align-items: center;
    border-top: 1px solid var(--line);
    display: flex;
    gap: 10px;
    justify-content: space-between;
    padding: 10px 0;
}

.status-row > div {
    min-width: 0;
}

.status-row p {
    color: var(--muted);
    margin: 2px 0 0;
    overflow-wrap: anywhere;
}

.event-meta-line {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.source-pill {
    align-items: center;
    background: var(--surface-hover);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    padding: 4px 7px;
}

.source-google {
    background: rgba(66, 133, 244, 0.12);
    border-color: rgba(66, 133, 244, 0.24);
    color: #2f66c8;
}

.source-dashboard {
    background: rgba(33, 128, 112, 0.12);
    border-color: rgba(33, 128, 112, 0.22);
    color: var(--accent);
}

.email-summary {
    align-items: baseline;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-bottom: 8px;
}

.email-summary strong {
    font-size: 30px;
    line-height: 1;
}

.email-summary span,
.email-summary p {
    color: var(--muted);
    margin: 0;
}

.email-accounts {
    display: grid;
    gap: 8px;
}

.email-account {
    border-top: 1px solid var(--line);
    display: grid;
    gap: 4px;
    padding-top: 8px;
}

.email-account-head {
    align-items: center;
    display: flex;
    gap: 8px;
    justify-content: space-between;
}

.email-account-head span {
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}

.email-message {
    color: var(--muted);
    display: block;
    font-size: 13px;
    line-height: 1.3;
    margin: 0;
    overflow: hidden;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-message:hover strong {
    color: var(--accent);
}

.email-message.is-viewed {
    color: #87939d;
}

.email-message.is-viewed strong {
    color: #65737e;
    font-weight: 500;
}

.email-message strong {
    color: var(--text);
    font-weight: 650;
}

.email-message span::before {
    content: " - ";
}

.mail-view {
    display: grid;
    gap: 14px;
}

.mail-header {
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
}

.mail-header h2 {
    font-size: 23px;
    line-height: 1.25;
    margin-bottom: 10px;
    overflow-wrap: anywhere;
}

.mail-meta-grid {
    display: grid;
    gap: 10px 14px;
    grid-template-columns: minmax(0, 1fr);
}

.mail-meta-item {
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 6px;
    min-width: 0;
    padding: 8px 10px;
}

.mail-meta-grid span,
.mail-meta-grid small {
    color: var(--muted);
    display: block;
    font-size: 12px;
    line-height: 1.25;
    text-decoration: none;
}

.mail-meta-grid strong {
    display: block;
    font-size: 14px;
    line-height: 1.25;
    overflow-wrap: anywhere;
    text-decoration: none;
}

.mail-meta-grid .mail-person {
    font-size: 17px;
    font-weight: 750;
}

.mail-meta-grid a,
.mail-meta-grid a[x-apple-data-detectors],
.mail-header a[x-apple-data-detectors],
.mail-view a[href^="mailto:"],
.mail-view [x-apple-data-detectors],
.mail-view [x-apple-data-detectors] * {
    color: inherit !important;
    font: inherit !important;
    text-decoration: none !important;
}

.mail-account,
.mail-body-title {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    margin: 0 0 4px;
}

.mail-body-title {
    margin-top: 2px;
}

.email-body {
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    font: 14px/1.5 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    margin: 0;
    max-height: 70vh;
    overflow: auto;
    padding: 12px;
    white-space: pre-wrap;
}

.email-rendered-body {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    min-height: 420px;
    width: 100%;
}

.mail-view-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mail-view-tools button {
    width: auto;
}

.mail-view-mode.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-text);
}

.mail-load-images {
    justify-self: start;
    width: auto;
}

.mail-plain-text summary {
    color: var(--accent);
    cursor: pointer;
    font-weight: 700;
    list-style: none;
}

.mail-plain-text summary::-webkit-details-marker {
    display: none;
}

.mail-action-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mail-action {
    border: 0;
    border-radius: 8px;
    padding: 0;
}

.mail-action > summary {
    align-items: center;
    background: var(--accent);
    border-radius: 6px;
    color: var(--accent-text);
    cursor: pointer;
    display: flex;
    gap: 8px;
    font-weight: 700;
    justify-content: center;
    list-style: none;
    min-height: 42px;
    padding: 10px 12px;
    text-align: center;
}

.mail-action:nth-child(2) > summary {
    background: var(--surface-hover);
    color: var(--text);
    border: 1px solid var(--line);
}

.mail-action > summary::-webkit-details-marker {
    display: none;
}

.mail-action form {
    margin-top: 10px;
}

.calendar-source-row {
    padding: 8px 0;
}

.integration-summary {
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 7px;
    margin: 10px 0;
    padding: 10px;
}

.integration-summary p {
    color: var(--muted);
    margin: 4px 0 0;
}

.trello-card {
    align-items: stretch;
    border-top: 1px solid var(--line);
    color: var(--text);
    display: grid;
    gap: 4px;
    min-height: 62px;
    padding: 10px 0 10px 12px;
    position: relative;
    text-decoration: none;
}

.trello-card::before {
    background: var(--line);
    border-radius: 999px;
    bottom: 12px;
    content: "";
    left: 0;
    position: absolute;
    top: 12px;
    width: 4px;
}

.trello-card:first-of-type {
    border-top: 0;
}

.trello-card strong {
    font-size: 15px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.trello-context,
.trello-meta {
    align-items: center;
    color: var(--muted);
    display: flex;
    font-size: 13px;
    gap: 6px;
    min-width: 0;
}

.trello-context {
    font-weight: 700;
}

.trello-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.trello-label {
    background: var(--surface);
    border-radius: 3px;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.15;
    max-width: 100%;
    min-height: 18px;
    overflow: hidden;
    padding: 3px 7px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trello-label-green { background: #4bce97; color: #092016; }
.trello-label-yellow { background: #f5cd47; color: #241a00; }
.trello-label-orange { background: #fea362; color: #271000; }
.trello-label-red { background: #f87168; color: #2b0705; }
.trello-label-purple { background: #9f8fef; color: #160f3d; }
.trello-label-blue { background: #579dff; color: #061a37; }
.trello-label-sky { background: #6cc3e0; color: #04202b; }
.trello-label-lime { background: #94c748; color: #111f00; }
.trello-label-pink { background: #e774bb; color: #2b071c; }
.trello-label-black { background: #8590a2; color: #081017; }

.trello-card-label-green::before { background: #4bce97; }
.trello-card-label-yellow::before { background: #f5cd47; }
.trello-card-label-orange::before { background: #fea362; }
.trello-card-label-red::before { background: #f87168; }
.trello-card-label-purple::before { background: #9f8fef; }
.trello-card-label-blue::before { background: #579dff; }
.trello-card-label-sky::before { background: #6cc3e0; }
.trello-card-label-lime::before { background: #94c748; }
.trello-card-label-pink::before { background: #e774bb; }
.trello-card-label-black::before { background: #8590a2; }

.trello-context em {
    border-left: 1px solid var(--line);
    font-style: normal;
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    padding-left: 6px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trello-meta {
    flex-wrap: wrap;
}

.trello-meta > * {
    background: var(--surface);
    border-radius: 999px;
    padding: 2px 7px;
}

.trello-detail .trello-labels {
    margin: 0 0 12px;
}

.trello-open-original {
    margin-top: 14px;
}

.trello-checklists {
    border-top: 1px solid var(--line);
    display: grid;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
}

.trello-checklists h3,
.trello-checklist h4 {
    margin: 0;
}

.trello-checklist {
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 8px;
    padding: 12px;
}

.trello-checklist p {
    align-items: flex-start;
    display: grid;
    gap: 8px;
    grid-template-columns: 22px minmax(0, 1fr);
    margin: 0;
}

.trello-checklist p span {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--accent);
    display: inline-flex;
    height: 20px;
    justify-content: center;
    line-height: 1;
    width: 20px;
}

.trello-checklist p.is-complete {
    color: var(--muted);
}

.confluence-page {
    align-items: center;
    border-top: 1px solid var(--line);
    color: var(--text);
    display: flex;
    gap: 10px;
    justify-content: space-between;
    min-height: 52px;
    padding: 9px 0;
    text-decoration: none;
}

.confluence-page:first-of-type {
    border-top: 0;
}

.confluence-page span {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.confluence-page strong {
    overflow-wrap: anywhere;
}

.confluence-page small,
.confluence-page time {
    color: var(--muted);
    font-size: 13px;
}

.confluence-page time {
    flex: 0 0 auto;
    white-space: nowrap;
}

.confluence-excerpt {
    border-top: 1px solid var(--line);
    margin-top: 16px;
    padding-top: 16px;
}

.confluence-excerpt h3 {
    margin-top: 0;
}

.calendar-more-list {
    border-top: 1px solid var(--line);
    margin-top: 4px;
    padding-top: 8px;
}

.calendar-more-list > summary {
    color: var(--accent);
    cursor: pointer;
    font-weight: 700;
    list-style: none;
    padding: 8px 0;
}

.calendar-more-list > summary::-webkit-details-marker {
    display: none;
}

.status-pill {
    border-radius: 999px;
    color: #fff;
    flex: 0 0 auto;
    font-size: 12px;
    padding: 4px 8px;
}

.status-ok {
    background: var(--accent);
}

.status-configured {
    background: #5b6f8a;
}

.status-error,
.status-unavailable {
    background: var(--danger);
}

.small-button {
    width: auto;
}

.today-section + .today-section {
    margin-top: 12px;
}

.forecast-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.forecast-grid.is-single {
    grid-template-columns: 1fr;
}

.forecast-card {
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px;
}

.forecast-card p {
    color: var(--muted);
    margin: 4px 0 0;
}

.calendar-panel {
    overflow-x: auto;
}

.calendar-weekdays,
.calendar-month {
    display: grid;
    gap: 6px;
    grid-template-columns: repeat(7, minmax(120px, 1fr));
    min-width: 840px;
}

.calendar-weekdays {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 6px;
    text-align: center;
}

.calendar-day {
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 6px;
    min-height: 112px;
    padding: 8px;
}

.calendar-day.is-muted {
    opacity: .55;
}

.calendar-day.is-today {
    border-color: var(--accent);
}

.calendar-day-number {
    color: var(--muted);
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 6px;
}

.calendar-event {
    background: var(--surface-hover);
    border-radius: 5px;
    margin-top: 5px;
    padding: 5px;
}

.calendar-event summary {
    cursor: pointer;
    display: grid;
    gap: 2px;
    list-style: none;
}

.calendar-event summary span {
    font-size: 13px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.calendar-event summary small,
.calendar-more {
    color: var(--muted);
    font-size: 12px;
}

.calendar-create {
    margin-top: 16px;
}

@media (max-width: 760px) {
    .page {
        width: min(100% - 20px, 1180px);
        padding: calc(6px + env(safe-area-inset-top, 0px)) 0 calc(10px + env(safe-area-inset-bottom, 0px));
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        align-items: stretch;
        flex-direction: column;
    }

    .appbar {
        align-items: flex-start;
        display: grid;
        grid-template-columns: minmax(0, 1fr);
    }

    .appbar-compact {
        align-items: flex-start;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .top-actions {
        margin-left: auto;
    }

    .page-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        justify-content: stretch;
    }

    .page-actions .button {
        width: 100%;
    }

    .topnav {
        display: grid;
        grid-template-columns: 1fr 1fr;
        justify-content: stretch;
    }

    .topnav .button,
    .topnav form,
    .topnav button {
        width: 100%;
    }

    .row,
    .actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .status-row {
        align-items: stretch;
        flex-direction: column;
    }

    .status-pill,
    .small-button {
        align-self: flex-start;
    }

    .forecast-grid {
        grid-template-columns: 1fr;
    }

    .mail-action-grid {
        grid-template-columns: 1fr;
    }

    .order-field {
        margin-left: 0;
    }

    .widget-option {
        grid-template-columns: 36px minmax(0, 1fr);
    }

    .recommendation-box {
        grid-template-columns: 1fr;
    }

    .recommendation-box button {
        width: 100%;
    }

    .now-time {
        font-size: 48px;
    }

    .weather-secondary-grid {
        grid-template-columns: 1fr;
    }

    .calendar-weekdays,
    .calendar-month {
        grid-template-columns: repeat(7, minmax(96px, 1fr));
        min-width: 672px;
    }

    .calendar-day {
        min-height: 96px;
    }
}
