/* ==========================================================================
   Mono — monochrome, liquid-glass calendar
   ========================================================================== */

:root {
  --hour: 52px;               /* keep in sync with HOUR_H in state.rs */
  --gutter: 58px;
  --sb-w: 276px;
  --radius: 22px;
  --ease: cubic-bezier(.32, .72, 0, 1);
  --spring: cubic-bezier(.34, 1.36, .64, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", system-ui, sans-serif;
  /* Importance: the only colour in Mono — strict, slightly muted. */
  --prio-high: #f2555a;
  --prio-med: #f2b84b;
  --prio-low: #46c38a;
}

/* ---------- Palettes ----------
   Generated from palettes.py (scratch). Each palette defines raw values for both
   appearances (suffix -d / -l): 12 calendar colour slots (bar + text tone) and UI accents.
   The blocks below pick the active set; any element with data-palette + .pal-scope
   (settings previews) gets its own palette. */

:root,
[data-palette="glass"] {
  --p-bg-d: #1A1A1C;
  --p-fg-d: 227, 227, 230;
  --p-ink-d: 255, 255, 255;
  --p-glass-d: rgba(36, 36, 38, .6);
  --p-accent-d: #E86156;
  --p-on-accent-d: #fff;
  --p-now-d: #E86156;
  --p-primary-d: #5294E6;
  --p-on-primary-d: #fff;
  --p-ev-a-d: 22%;
  --p-ev-base-d: #29292C;
  --p-grid-d: #202022;
  --p-blob1-d: rgba(255, 255, 255, .16);
  --p-blob2-d: rgba(255, 240, 225, .12);
  --p-blob3-d: rgba(255, 255, 255, .09);
  --p-0-d: #6DA7F1; --p-0-t-d: #BAD7FC;
  --p-1-d: #6EB87F; --p-1-t-d: #BCDFC2;
  --p-2-d: #999BED; --p-2-t-d: #CED0FA;
  --p-3-d: #DE8F4F; --p-3-t-d: #F3CBAE;
  --p-4-d: #E38496; --p-4-t-d: #F7C5CD;
  --p-5-d: #A2A5A9; --p-5-t-d: #D0D4DC;
  --p-6-d: #4AB2DC; --p-6-t-d: #B0DCF1;
  --p-7-d: #BEA24A; --p-7-t-d: #E1D4AC;
  --p-8-d: #BF9D81; --p-8-t-d: #E2D1C3;
  --p-9-d: #50B9A9; --p-9-t-d: #B2DFD6;
  --p-10-d: #E88479; --p-10-t-d: #FAC6BF;
  --p-11-d: #C28ED2; --p-11-t-d: #E4CAEC;
  --p-bg-l: #E4E4E6;
  --p-fg-l: 36, 36, 38;
  --p-ink-l: 0, 0, 0;
  --p-glass-l: rgba(238, 238, 240, .7);
  --p-accent-l: #D73F39;
  --p-on-accent-l: #fff;
  --p-now-l: #D73F39;
  --p-primary-l: #1570D1;
  --p-on-primary-l: #fff;
  --p-ev-a-l: 16%;
  --p-ev-base-l: #F0F0F1;
  --p-grid-l: #F0F0F1;
  --p-blob1-l: rgba(255, 255, 255, .85);
  --p-blob2-l: rgba(40, 40, 60, .11);
  --p-blob3-l: rgba(40, 40, 60, .07);
  --p-0-l: #3D84DB; --p-0-t-l: #234E82;
  --p-1-l: #3A9956; --p-1-t-l: #225A31;
  --p-2-l: #7776D5; --p-2-t-l: #46457F;
  --p-3-l: #C26900; --p-3-t-l: #743C01;
  --p-4-l: #C85973; --p-4-t-l: #773443;
  --p-5-l: #808389; --p-5-t-l: #494D54;
  --p-6-l: #0090BB; --p-6-t-l: #005570;
  --p-7-l: #9E8008; --p-7-t-l: #5E4B00;
  --p-8-l: #A17A59; --p-8-t-l: #5F4833;
  --p-9-l: #089888; --p-9-t-l: #045A50;
  --p-10-l: #CE5950; --p-10-t-l: #7A342E;
  --p-11-l: #A467B7; --p-11-t-l: #613C6D;
}

[data-palette="graphite"] {
  --p-bg-d: #19191A;
  --p-fg-d: 226, 226, 227;
  --p-ink-d: 255, 255, 255;
  --p-glass-d: rgba(34, 34, 35, .6);
  --p-accent-d: #E2E2E3;
  --p-on-accent-d: #19191A;
  --p-now-d: #CF6A60;
  --p-primary-d: #E2E2E3;
  --p-on-primary-d: #19191A;
  --p-ev-a-d: 14%;
  --p-ev-base-d: #29292A;
  --p-grid-d: #1F1F20;
  --p-blob1-d: rgba(255, 255, 255, .15);
  --p-blob2-d: rgba(255, 255, 255, .11);
  --p-blob3-d: rgba(255, 255, 255, .08);
  --p-0-d: #E2E2E3; --p-0-t-d: #EDEDEE;
  --p-1-d: #9C9CA0; --p-1-t-d: #DCDCDF;
  --p-2-d: #C2C2C6; --p-2-t-d: #E6E6E8;
  --p-3-d: #78787C; --p-3-t-d: #D3D3D6;
  --p-4-d: #5C5C60; --p-4-t-d: #C9C9CC;
  --p-5-d: #48484C; --p-5-t-d: #B9B9BD;
  --p-6-d: #D2D2D5; --p-6-t-d: #EAEAEC;
  --p-7-d: #ADADB1; --p-7-t-d: #E0E0E2;
  --p-8-d: #8A8A8E; --p-8-t-d: #D6D6D9;
  --p-9-d: #B8B8BC; --p-9-t-d: #E3E3E5;
  --p-10-d: #68686C; --p-10-t-d: #CECED1;
  --p-11-d: #535357; --p-11-t-d: #C4C4C8;
  --p-bg-l: #E3E3E3;
  --p-fg-l: 34, 34, 35;
  --p-ink-l: 0, 0, 0;
  --p-glass-l: rgba(236, 236, 236, .7);
  --p-accent-l: #2C2C2E;
  --p-on-accent-l: #EFEFEF;
  --p-now-l: #C0453D;
  --p-primary-l: #2C2C2E;
  --p-on-primary-l: #EFEFEF;
  --p-ev-a-l: 11%;
  --p-ev-base-l: #EFEFEF;
  --p-grid-l: #EFEFEF;
  --p-blob1-l: rgba(255, 255, 255, .85);
  --p-blob2-l: rgba(0, 0, 0, .10);
  --p-blob3-l: rgba(0, 0, 0, .06);
  --p-0-l: #2C2C2E; --p-0-t-l: #1F1F20;
  --p-1-l: #6B6B70; --p-1-t-l: #363639;
  --p-2-l: #48484B; --p-2-t-l: #2C2C2E;
  --p-3-l: #8A8A8F; --p-3-t-l: #424245;
  --p-4-l: #A3A3A8; --p-4-t-l: #4C4C50;
  --p-5-l: #B9B9BD; --p-5-t-l: #55555A;
  --p-6-l: #3A3A3C; --p-6-t-l: #252527;
  --p-7-l: #79797D; --p-7-t-l: #3D3D40;
  --p-8-l: #57575B; --p-8-t-l: #313134;
  --p-9-l: #98989D; --p-9-t-l: #47474B;
  --p-10-l: #626266; --p-10-t-l: #353538;
  --p-11-l: #AEAEB3; --p-11-t-l: #505054;
}

[data-palette="vivid"] {
  --p-bg-d: #1A1A1B;
  --p-fg-d: 227, 227, 227;
  --p-ink-d: 255, 255, 255;
  --p-glass-d: rgba(36, 36, 37, .6);
  --p-accent-d: #8AB4F8;
  --p-on-accent-d: #1F1F1F;
  --p-now-d: #F28B82;
  --p-primary-d: #8AB4F8;
  --p-on-primary-d: #1F1F1F;
  --p-ev-a-d: 86%;
  --p-ev-base-d: #1F1F1F;
  --p-grid-d: #1F1F1F;
  --p-blob1-d: rgba(255, 255, 255, .15);
  --p-blob2-d: rgba(255, 255, 255, .11);
  --p-blob3-d: rgba(255, 255, 255, .08);
  --p-0-d: #83BEF0; --p-0-t-d: #1F1F1F;
  --p-1-d: #7FCAA3; --p-1-t-d: #1F1F1F;
  --p-2-d: #C0AAEC; --p-2-t-d: #1F1F1F;
  --p-3-d: #EBA484; --p-3-t-d: #1F1F1F;
  --p-4-d: #EE9EA4; --p-4-t-d: #1F1F1F;
  --p-5-d: #B9BCC1; --p-5-t-d: #1F1F1F;
  --p-6-d: #68C7DD; --p-6-t-d: #1F1F1F;
  --p-7-d: #D1B46E; --p-7-t-d: #1F1F1F;
  --p-8-d: #E7A77C; --p-8-t-d: #1F1F1F;
  --p-9-d: #8BC997; --p-9-t-d: #1F1F1F;
  --p-10-d: #EEA099; --p-10-t-d: #1F1F1F;
  --p-11-d: #A5B3F4; --p-11-t-d: #1F1F1F;
  --p-bg-l: #E3E5E8;
  --p-fg-l: 31, 31, 31;
  --p-ink-l: 0, 0, 0;
  --p-glass-l: rgba(236, 238, 241, .7);
  --p-accent-l: #1A73E8;
  --p-on-accent-l: #fff;
  --p-now-l: #D93025;
  --p-primary-l: #1A73E8;
  --p-on-primary-l: #fff;
  --p-ev-a-l: 100%;
  --p-ev-base-l: #F1F2F4;
  --p-grid-l: #F1F2F4;
  --p-blob1-l: rgba(255, 255, 255, .85);
  --p-blob2-l: rgba(30, 40, 70, .10);
  --p-blob3-l: rgba(30, 40, 70, .06);
  --p-0-l: #1A73E8; --p-0-t-l: #FFFFFF;
  --p-1-l: #188038; --p-1-t-l: #FFFFFF;
  --p-2-l: #8E24AA; --p-2-t-l: #FFFFFF;
  --p-3-l: #C8500E; --p-3-t-l: #FFFFFF;
  --p-4-l: #C4405A; --p-4-t-l: #FFFFFF;
  --p-5-l: #5F6368; --p-5-t-l: #FFFFFF;
  --p-6-l: #0277BD; --p-6-t-l: #FFFFFF;
  --p-7-l: #F2B824; --p-7-t-l: #2B2200;
  --p-8-l: #795548; --p-8-t-l: #FFFFFF;
  --p-9-l: #0B8043; --p-9-t-l: #FFFFFF;
  --p-10-l: #C5221F; --p-10-t-l: #FFFFFF;
  --p-11-l: #3F51B5; --p-11-t-l: #FFFFFF;
}

[data-palette="paper"] {
  --p-bg-d: #211E1A;
  --p-fg-d: 232, 224, 210;
  --p-ink-d: 240, 228, 208;
  --p-glass-d: rgba(40, 36, 31, .96);
  --p-accent-d: #CF8B6E;
  --p-on-accent-d: #211E1A;
  --p-now-d: #D07A66;
  --p-primary-d: #E8E0D2;
  --p-on-primary-d: #211E1A;
  --p-ev-a-d: 15%;
  --p-ev-base-d: #2F2A24;
  --p-grid-d: #28241F;
  --p-blob1-d: rgba(0, 0, 0, 0);
  --p-blob2-d: rgba(0, 0, 0, 0);
  --p-blob3-d: rgba(0, 0, 0, 0);
  --p-0-d: #93A6C4; --p-0-t-d: #C3CFE0;
  --p-1-d: #9DB394; --p-1-t-d: #C8D6C1;
  --p-2-d: #ADA0C4; --p-2-t-d: #D3CBE0;
  --p-3-d: #CC977F; --p-3-t-d: #E6C3B3;
  --p-4-d: #CDB27A; --p-4-t-d: #E5D5AE;
  --p-5-d: #A79F92; --p-5-t-d: #D3CDC2;
  --p-6-d: #88B0AB; --p-6-t-d: #BCD4D0;
  --p-7-d: #C49AA8; --p-7-t-d: #E0C7CF;
  --p-8-d: #B89C82; --p-8-t-d: #DAC8B6;
  --p-9-d: #AAB283; --p-9-t-d: #D1D6B8;
  --p-10-d: #C98A7E; --p-10-t-d: #E4BCB4;
  --p-11-d: #9EA1C6; --p-11-t-d: #CACCE2;
  --p-bg-l: #E7DFD1;
  --p-fg-l: 47, 42, 36;
  --p-ink-l: 60, 48, 34;
  --p-glass-l: rgba(236, 228, 214, .96);
  --p-accent-l: #A6503A;
  --p-on-accent-l: #F7F2E8;
  --p-now-l: #A6503A;
  --p-primary-l: #3B342C;
  --p-on-primary-l: #F2ECE1;
  --p-ev-a-l: 13%;
  --p-ev-base-l: #F2ECE1;
  --p-grid-l: #F2ECE1;
  --p-blob1-l: rgba(0, 0, 0, 0);
  --p-blob2-l: rgba(0, 0, 0, 0);
  --p-blob3-l: rgba(0, 0, 0, 0);
  --p-0-l: #3F5D8C; --p-0-t-l: #2C4166;
  --p-1-l: #5D7A51; --p-1-t-l: #3D5434;
  --p-2-l: #6D5285; --p-2-t-l: #4B375E;
  --p-3-l: #A65A3C; --p-3-t-l: #783B24;
  --p-4-l: #A6822C; --p-4-t-l: #684F14;
  --p-5-l: #7A7268; --p-5-t-l: #4E4842;
  --p-6-l: #2F6F6C; --p-6-t-l: #1F4D4B;
  --p-7-l: #97546A; --p-7-t-l: #6A3647;
  --p-8-l: #7B5B40; --p-8-t-l: #553D2A;
  --p-9-l: #6E7836; --p-9-t-l: #4A5122;
  --p-10-l: #A23F33; --p-10-t-l: #742A21;
  --p-11-l: #4E5488; --p-11-t-l: #353A62;
}

[data-palette="aurora"] {
  --p-bg-d: #0E0F17;
  --p-fg-d: 232, 234, 248;
  --p-ink-d: 232, 234, 255;
  --p-glass-d: rgba(22, 24, 38, .52);
  --p-accent-d: #8B8CFF;
  --p-on-accent-d: #0E0F17;
  --p-now-d: #FB7185;
  --p-primary-d: #8B8CFF;
  --p-on-primary-d: #0E0F17;
  --p-ev-a-d: 22%;
  --p-ev-base-d: #1A1C2A;
  --p-grid-d: #13141E;
  --p-blob1-d: rgba(99, 102, 241, .22);
  --p-blob2-d: rgba(20, 184, 166, .13);
  --p-blob3-d: rgba(236, 72, 153, .12);
  --p-0-d: #818CF8; --p-0-t-d: #C7CCFF;
  --p-1-d: #2DD4BF; --p-1-t-d: #A7F3E7;
  --p-2-d: #C084FC; --p-2-t-d: #E7CCFF;
  --p-3-d: #FBBF24; --p-3-t-d: #FDE3A0;
  --p-4-d: #FB7185; --p-4-t-d: #FFC4CD;
  --p-5-d: #94A3B8; --p-5-t-d: #D3DAE4;
  --p-6-d: #38BDF8; --p-6-t-d: #B3E5FC;
  --p-7-d: #A3E635; --p-7-t-d: #DDF5A8;
  --p-8-d: #F472B6; --p-8-t-d: #FBCFE8;
  --p-9-d: #34D399; --p-9-t-d: #B4F1D9;
  --p-10-d: #F87171; --p-10-t-d: #FECACA;
  --p-11-d: #E879F9; --p-11-t-d: #F5D0FE;
  --p-bg-l: #E3E5F0;
  --p-fg-l: 22, 23, 44;
  --p-ink-l: 20, 21, 43;
  --p-glass-l: rgba(234, 236, 246, .6);
  --p-accent-l: #5B5BF0;
  --p-on-accent-l: #fff;
  --p-now-l: #E11D48;
  --p-primary-l: #5B5BF0;
  --p-on-primary-l: #fff;
  --p-ev-a-l: 16%;
  --p-ev-base-l: #EEEFF7;
  --p-grid-l: #EEEFF7;
  --p-blob1-l: rgba(99, 102, 241, .13);
  --p-blob2-l: rgba(20, 184, 166, .09);
  --p-blob3-l: rgba(236, 72, 153, .08);
  --p-0-l: #4F46E5; --p-0-t-l: #3730A3;
  --p-1-l: #0D9488; --p-1-t-l: #0B6A62;
  --p-2-l: #9333EA; --p-2-t-l: #6B21A8;
  --p-3-l: #D97706; --p-3-t-l: #8A3C0C;
  --p-4-l: #E11D48; --p-4-t-l: #9F1239;
  --p-5-l: #64748B; --p-5-t-l: #3F4A5A;
  --p-6-l: #0284C7; --p-6-t-l: #075985;
  --p-7-l: #65A30D; --p-7-t-l: #3F6212;
  --p-8-l: #DB2777; --p-8-t-l: #9D174D;
  --p-9-l: #059669; --p-9-t-l: #065F46;
  --p-10-l: #DC2626; --p-10-t-l: #991B1B;
  --p-11-l: #C026D3; --p-11-t-l: #86198F;
}

[data-palette="wood"] {
  --p-bg-d: #1F150E;
  --p-fg-d: 240, 230, 212;
  --p-ink-d: 255, 245, 226;
  --p-glass-d: rgba(52, 38, 28, .55);
  --p-accent-d: #E3B25A;
  --p-on-accent-d: #1F150E;
  --p-now-d: #EA7B4E;
  --p-primary-d: #DEA960;
  --p-on-primary-d: #1F150E;
  --p-ev-a-d: 24%;
  --p-ev-base-d: #332418;
  --p-grid-d: #241A12;
  --p-blob1-d: rgba(196, 164, 72, .27);
  --p-blob2-d: rgba(226, 128, 46, .19);
  --p-blob3-d: rgba(44, 122, 120, .16);
  --p-0-d: #72B1DF; --p-0-t-d: #BFDEF6;
  --p-1-d: #93B678; --p-1-t-d: #CEE0C1;
  --p-2-d: #B29DD9; --p-2-t-d: #DDD3F3;
  --p-3-d: #DB995D; --p-3-t-d: #F4D2B5;
  --p-4-d: #DE9197; --p-4-t-d: #F7CDD0;
  --p-5-d: #ADA8A3; --p-5-t-d: #DFD8CF;
  --p-6-d: #57BBC0; --p-6-t-d: #B6E3E5;
  --p-7-d: #C0A75D; --p-7-t-d: #E5D9B5;
  --p-8-d: #C6A08A; --p-8-t-d: #E9D5C9;
  --p-9-d: #78B9A0; --p-9-t-d: #C2E2D4;
  --p-10-d: #E68F7C; --p-10-t-d: #FBCDC2;
  --p-11-d: #CA96BE; --p-11-t-d: #EBCFE4;
  --p-bg-l: #EBDECA;
  --p-fg-l: 60, 43, 28;
  --p-ink-l: 46, 29, 14;
  --p-glass-l: rgba(244, 235, 219, .68);
  --p-accent-l: #AC6304;
  --p-on-accent-l: #fff;
  --p-now-l: #C34517;
  --p-primary-l: #8D5321;
  --p-on-primary-l: #fff;
  --p-ev-a-l: 17%;
  --p-ev-base-l: #F6EFE1;
  --p-grid-l: #F6EFE1;
  --p-blob1-l: rgba(255, 236, 198, .85);
  --p-blob2-l: rgba(206, 142, 56, .16);
  --p-blob3-l: rgba(48, 92, 84, .08);
  --p-0-l: #3187C1; --p-0-t-l: #174C6F;
  --p-1-l: #658F3F; --p-1-t-l: #37511F;
  --p-2-l: #8B70B9; --p-2-t-l: #4E3E6A;
  --p-3-l: #B96A00; --p-3-t-l: #6A3A02;
  --p-4-l: #BC606A; --p-4-t-l: #6C343A;
  --p-5-l: #857F79; --p-5-t-l: #4D4740;
  --p-6-l: #079298; --p-6-t-l: #045256;
  --p-7-l: #9A7D03; --p-7-t-l: #574601;
  --p-8-l: #A27459; --p-8-t-l: #5C4030;
  --p-9-l: #389375; --p-9-t-l: #1B5341;
  --p-10-l: #C55C46; --p-10-t-l: #723124;
  --p-11-l: #A76799; --p-11-t-l: #5F3857;
}

/* Active palette values — dark (default) */
:root,
:root .pal-scope {
  --ink: var(--p-ink-d);
  --bg: var(--p-bg-d);
  --fg-rgb: var(--p-fg-d);
  --fg: rgb(var(--p-fg-d));
  --fg-2: rgba(var(--p-fg-d), .72);
  --fg-3: rgba(var(--p-fg-d), .52);
  --fg-4: rgba(var(--p-fg-d), .30);
  --glass-tint: var(--p-glass-d);
  --accent: var(--p-accent-d);
  --on-accent: var(--p-on-accent-d);
  --now: var(--p-now-d);
  --primary: var(--p-primary-d);
  --on-primary: var(--p-on-primary-d);
  --ev-a: var(--p-ev-a-d);
  --ev-base: var(--p-ev-base-d);
  --grid-bg: var(--p-grid-d);
  --blob1: var(--p-blob1-d); --blob2: var(--p-blob2-d); --blob3: var(--p-blob3-d);
  --c-0: var(--p-0-d); --t-0: var(--p-0-t-d);
  --c-1: var(--p-1-d); --t-1: var(--p-1-t-d);
  --c-2: var(--p-2-d); --t-2: var(--p-2-t-d);
  --c-3: var(--p-3-d); --t-3: var(--p-3-t-d);
  --c-4: var(--p-4-d); --t-4: var(--p-4-t-d);
  --c-5: var(--p-5-d); --t-5: var(--p-5-t-d);
  --c-6: var(--p-6-d); --t-6: var(--p-6-t-d);
  --c-7: var(--p-7-d); --t-7: var(--p-7-t-d);
  --c-8: var(--p-8-d); --t-8: var(--p-8-t-d);
  --c-9: var(--p-9-d); --t-9: var(--p-9-t-d);
  --c-10: var(--p-10-d); --t-10: var(--p-10-t-d);
  --c-11: var(--p-11-d); --t-11: var(--p-11-t-d);
}

:root[data-theme="light"],
:root[data-theme="light"] .pal-scope {
  --ink: var(--p-ink-l);
  --bg: var(--p-bg-l);
  --fg-rgb: var(--p-fg-l);
  --fg: rgb(var(--p-fg-l));
  --fg-2: rgba(var(--p-fg-l), .70);
  --fg-3: rgba(var(--p-fg-l), .56);
  --fg-4: rgba(var(--p-fg-l), .32);
  --glass-tint: var(--p-glass-l);
  --accent: var(--p-accent-l);
  --on-accent: var(--p-on-accent-l);
  --now: var(--p-now-l);
  --primary: var(--p-primary-l);
  --on-primary: var(--p-on-primary-l);
  --ev-a: var(--p-ev-a-l);
  --ev-base: var(--p-ev-base-l);
  --grid-bg: var(--p-grid-l);
  --blob1: var(--p-blob1-l); --blob2: var(--p-blob2-l); --blob3: var(--p-blob3-l);
  --c-0: var(--p-0-l); --t-0: var(--p-0-t-l);
  --c-1: var(--p-1-l); --t-1: var(--p-1-t-l);
  --c-2: var(--p-2-l); --t-2: var(--p-2-t-l);
  --c-3: var(--p-3-l); --t-3: var(--p-3-t-l);
  --c-4: var(--p-4-l); --t-4: var(--p-4-t-l);
  --c-5: var(--p-5-l); --t-5: var(--p-5-t-l);
  --c-6: var(--p-6-l); --t-6: var(--p-6-t-l);
  --c-7: var(--p-7-l); --t-7: var(--p-7-t-l);
  --c-8: var(--p-8-l); --t-8: var(--p-8-t-l);
  --c-9: var(--p-9-l); --t-9: var(--p-9-t-l);
  --c-10: var(--p-10-l); --t-10: var(--p-10-t-l);
  --c-11: var(--p-11-l); --t-11: var(--p-11-t-l);
}

@media (prefers-color-scheme: light) {
  :root[data-theme="system"],
  :root[data-theme="system"] .pal-scope {
    --ink: var(--p-ink-l);
    --bg: var(--p-bg-l);
    --fg-rgb: var(--p-fg-l);
    --fg: rgb(var(--p-fg-l));
    --fg-2: rgba(var(--p-fg-l), .70);
    --fg-3: rgba(var(--p-fg-l), .56);
    --fg-4: rgba(var(--p-fg-l), .32);
    --glass-tint: var(--p-glass-l);
    --accent: var(--p-accent-l);
    --on-accent: var(--p-on-accent-l);
    --now: var(--p-now-l);
    --primary: var(--p-primary-l);
    --on-primary: var(--p-on-primary-l);
    --ev-a: var(--p-ev-a-l);
    --ev-base: var(--p-ev-base-l);
    --grid-bg: var(--p-grid-l);
    --blob1: var(--p-blob1-l); --blob2: var(--p-blob2-l); --blob3: var(--p-blob3-l);
    --c-0: var(--p-0-l); --t-0: var(--p-0-t-l);
    --c-1: var(--p-1-l); --t-1: var(--p-1-t-l);
    --c-2: var(--p-2-l); --t-2: var(--p-2-t-l);
    --c-3: var(--p-3-l); --t-3: var(--p-3-t-l);
    --c-4: var(--p-4-l); --t-4: var(--p-4-t-l);
    --c-5: var(--p-5-l); --t-5: var(--p-5-t-l);
    --c-6: var(--p-6-l); --t-6: var(--p-6-t-l);
    --c-7: var(--p-7-l); --t-7: var(--p-7-t-l);
    --c-8: var(--p-8-l); --t-8: var(--p-8-t-l);
    --c-9: var(--p-9-l); --t-9: var(--p-9-t-l);
    --c-10: var(--p-10-l); --t-10: var(--p-10-t-l);
    --c-11: var(--p-11-l); --t-11: var(--p-11-t-l);
  }
}

/* Calendar colour slots */
.cc-0 { --c: var(--c-0); --ct: var(--t-0); }
.cc-1 { --c: var(--c-1); --ct: var(--t-1); }
.cc-2 { --c: var(--c-2); --ct: var(--t-2); }
.cc-3 { --c: var(--c-3); --ct: var(--t-3); }
.cc-4 { --c: var(--c-4); --ct: var(--t-4); }
.cc-5 { --c: var(--c-5); --ct: var(--t-5); }
.cc-6 { --c: var(--c-6); --ct: var(--t-6); }
.cc-7 { --c: var(--c-7); --ct: var(--t-7); }
.cc-8 { --c: var(--c-8); --ct: var(--t-8); }
.cc-9 { --c: var(--c-9); --ct: var(--t-9); }
.cc-10 { --c: var(--c-10); --ct: var(--t-10); }
.cc-11 { --c: var(--c-11); --ct: var(--t-11); }

/* ---------- Dark (default) ---------- */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --line: rgba(var(--ink), .075);
  --line-half: rgba(var(--ink), .035);
  --line-2: rgba(var(--ink), .12);
  --glass-border: rgba(255, 255, 255, .10);
  --glass-hi: rgba(255, 255, 255, .16);
  --shadow: 0 18px 50px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .35);
  --scrim: rgba(0, 0, 0, .38);
  --grain-op: .05;
}

/* ---------- Light ---------- */
:root[data-theme="light"] {
  color-scheme: light;
  --line: rgba(var(--ink), .07);
  --line-half: rgba(var(--ink), .03);
  --line-2: rgba(var(--ink), .12);
  --glass-border: rgba(0, 0, 0, .08);
  --glass-hi: rgba(255, 255, 255, .95);
  --shadow: 0 18px 50px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);
  --scrim: rgba(250, 250, 250, .35);
  --grain-op: .035;
}

@media (prefers-color-scheme: light) {
  :root[data-theme="system"] .glass::before { mix-blend-mode: normal; opacity: .5; }
  :root[data-theme="system"] .seg-pill { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 0 0 .5px rgba(0,0,0,.05); }
  :root[data-theme="system"] .ev:hover { filter: brightness(.96); }
  :root[data-theme="system"] {
    color-scheme: light;
    --line: rgba(var(--ink), .07);
    --line-half: rgba(var(--ink), .03);
    --line-2: rgba(var(--ink), .12);
    --glass-border: rgba(0, 0, 0, .08);
    --glass-hi: rgba(255, 255, 255, .95);
    --shadow: 0 18px 50px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);
    --scrim: rgba(250, 250, 250, .35);
    --grain-op: .035;
  }
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: calc(14px * var(--ts, 1));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  overscroll-behavior: none;
  transition: background-color .5s var(--ease), color .5s var(--ease);
}
#main { height: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
kbd {
  font-family: var(--font);
  font-size: calc(11px * var(--ts, 1));
  color: var(--fg-3);
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--line-2);
  background: rgba(var(--ink), .04);
  line-height: 1.2;
}
::selection { background: rgba(var(--ink), .22); }
.icon { display: block; flex: none; }

/* ---------- Backdrop: slow monochrome light for the glass to refract ---------- */
.backdrop { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.blob {
  position: absolute;
  width: 62vmax; height: 62vmax;
  border-radius: 50%;
  /* A soft gradient instead of a blur filter: the same glow, far less GPU work. */
  background: radial-gradient(circle at center, var(--blob, var(--blob1)) 0%, color-mix(in srgb, var(--blob, var(--blob1)) 55%, transparent) 26%, color-mix(in srgb, var(--blob, var(--blob1)) 18%, transparent) 46%, transparent 64%);
  --bc: var(--blob, var(--blob1));
  opacity: var(--glow-a, 1);
}
/* Intensity above 100 % (Settings → Customization) multiplies the glow's own alpha by
   --glow-m. Round 19: only then (html.glow-boost, ui/backdrop.rs), and only where relative
   colours work: a var() in rgb(from …) is accepted when parsed, so an engine that can't
   resolve it would otherwise lose the glow altogether instead of keeping the line above. */
@supports (color: rgb(from red r g b / min(1, calc(alpha * 2)))) {
  html.glow-boost .blob {
    background: radial-gradient(circle at center, rgb(from var(--bc) r g b / min(1, calc(alpha * var(--glow-m, 1)))) 0%, rgb(from var(--bc) r g b / min(1, calc(alpha * var(--glow-m, 1) * .55))) 26%, rgb(from var(--bc) r g b / min(1, calc(alpha * var(--glow-m, 1) * .18))) 46%, transparent 64%);
  }
}
/* (Round 15 — perf: backdrop.js steps these same drifts — and grad-drift below — itself; keep both alike.) */
.b1 { --blob: var(--blob1); top: -26vmax; left: -18vmax; animation: drift1 38s ease-in-out infinite alternate; }
.b2 { --blob: var(--blob2); bottom: -30vmax; right: -20vmax; animation: drift2 46s ease-in-out infinite alternate; }
.b3 { --blob: var(--blob3); top: 30%; left: 40%; width: 40vmax; height: 40vmax; opacity: calc(.7 * var(--glow-a, 1)); animation: drift3 52s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(18vmax, 12vmax) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-16vmax, -10vmax) scale(1.1); } }
@keyframes drift3 { to { transform: translate(-22vmax, 8vmax) scale(.85); } }
.grain {
  position: absolute; inset: 0;
  opacity: var(--grain-op);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------- Liquid glass ---------- */
.glass {
  position: relative;
  background:
    linear-gradient(180deg, rgba(var(--ink), .075) 0%, rgba(var(--ink), .015) 38%, rgba(var(--ink), .03) 100%),
    var(--glass-tint);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow:
    inset 0 1px 0 var(--glass-hi),
    inset 0 0 0 .5px rgba(var(--ink), .04),
    inset 0 -10px 24px -18px rgba(var(--ink), .18),
    var(--shadow);
  border-radius: var(--radius);
}
/* specular sheen along the top-left rim */
.glass::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(var(--ink), .10), transparent 45%),
    radial-gradient(90% 50% at 100% 100%, rgba(var(--ink), .05), transparent 50%);
  mix-blend-mode: plus-lighter;
  opacity: .8;
}
:root[data-theme="light"] .glass::before { mix-blend-mode: normal; opacity: .5; }

/* ---------- App shell ---------- */
.app {
  position: fixed; inset: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sb-w) minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  transition: grid-template-columns .6s var(--ease), gap .6s var(--ease);
  user-select: none;
  -webkit-user-select: none;
}
.app.no-sidebar { grid-template-columns: 0px minmax(0, 1fr); gap: 0; }
.app.is-dragging, .app.is-dragging * { cursor: grabbing !important; }
.main { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; transition: margin-right .6s var(--ease); container: main / inline-size; }
.app.has-inspector .main { margin-right: 382px; }

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: var(--radius);
  background: rgba(var(--ink), .022);
  border: 1px solid var(--line);
  overflow: hidden;
}

.sb-scrim { display: none; position: fixed; inset: 0; z-index: 39; background: var(--scrim); transition: opacity .4s var(--ease); }

/* ---------- Animations ---------- */
@keyframes in-next { from { opacity: 0; transform: translateX(34px); } to { opacity: 1; transform: none; } }
@keyframes in-prev { from { opacity: 0; transform: translateX(-34px); } to { opacity: 1; transform: none; } }
@keyframes in-zoom { from { opacity: 0; transform: scale(.975); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes in-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(var(--ink), .5); } 70% { box-shadow: 0 0 0 7px rgba(var(--ink), 0); } }
.anim-next { animation: in-next .42s var(--ease) both; }
.anim-prev { animation: in-prev .42s var(--ease) both; }
.anim-zoom { animation: in-zoom .5s var(--ease) both; }
.anim-fade { animation: in-fade .4s var(--ease) both; }

/* ---------- Buttons & controls ---------- */
.icon-btn {
  width: 32px; height: 32px;
  display: inline-grid; place-items: center;
  border-radius: 10px;
  color: var(--fg-2);
  transition: background .2s var(--ease), color .2s, transform .25s var(--spring);
}
.icon-btn:hover { background: rgba(var(--ink), .08); color: var(--fg); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.sm { width: 24px; height: 24px; border-radius: 7px; }
.icon-btn.primary { background: var(--primary); color: var(--on-primary); }
.icon-btn.primary:hover { background: var(--primary); color: var(--on-primary); filter: brightness(.92); }
.pill-btn {
  height: 30px; padding: 0 13px;
  border-radius: 10px;
  font-size: calc(13px * var(--ts, 1)); font-weight: 500;
  color: var(--fg);
  background: rgba(var(--ink), .07);
  transition: background .2s, transform .25s var(--spring);
}
.pill-btn:hover { background: rgba(var(--ink), .12); }
.pill-btn:active { transform: scale(.95); }
.link-btn { display: inline-flex; align-items: center; gap: 6px; font-size: calc(12px * var(--ts, 1)); color: var(--fg-2); font-weight: 500; }
.link-btn:hover { color: var(--fg); }
.link-btn.subtle { color: var(--fg-3); }
.ghost-btn {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 13px;
  border-radius: 11px;
  font-size: calc(13px * var(--ts, 1)); font-weight: 500;
  background: rgba(var(--ink), .06);
  color: var(--fg);
  transition: background .2s, transform .25s var(--spring);
  cursor: pointer;
}
.ghost-btn:hover { background: rgba(var(--ink), .11); }
.ghost-btn:active { transform: scale(.96); }
.ghost-btn.danger { color: var(--fg-2); }
.ghost-btn.danger:hover { color: var(--fg); }
.ghost-btn.danger.armed { background: var(--fg); color: var(--bg); }
.hidden-file { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.chip {
  height: 26px; padding: 0 10px;
  border-radius: 8px;
  font-size: calc(12px * var(--ts, 1)); font-weight: 500;
  color: var(--fg-2);
  background: rgba(var(--ink), .06);
  transition: all .2s var(--ease);
}
.chip:hover { color: var(--fg); background: rgba(var(--ink), .1); }
.chip.on { background: var(--fg); color: var(--bg); }

.segmented {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--n), 1fr);
  padding: 2px;
  border-radius: 11px;
  background: rgba(var(--ink), .065);
  box-shadow: inset 0 0 0 .5px rgba(var(--ink), .05);
}
.seg-pill {
  position: absolute;
  top: 2px; bottom: 2px; left: 2px;
  width: calc((100% - 4px) / var(--n));
  transform: translateX(calc(var(--i) * 100%));
  border-radius: 9px;
  background: rgba(var(--ink), .16);
  box-shadow: inset 0 1px 0 rgba(var(--ink), .14), 0 2px 8px rgba(0, 0, 0, .25);
  transition: transform .5s var(--spring);
}
:root[data-theme="light"] .seg-pill { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 0 0 .5px rgba(0,0,0,.05); }
.seg {
  position: relative; z-index: 1;
  height: 28px; padding: 0 14px;
  font-size: calc(13px * var(--ts, 1)); font-weight: 500;
  color: var(--fg-2);
  border-radius: 9px;
  transition: color .3s var(--ease);
  white-space: nowrap;
}
.seg:hover { color: var(--fg); }
.seg.active { color: var(--fg); }
.segmented.small .seg { height: 30px; padding: 0 10px; font-size: calc(12.5px * var(--ts, 1)); }

.switch {
  position: relative;
  width: 44px; height: 26px;
  border-radius: 99px;
  background: rgba(var(--ink), .16);
  transition: background .35s var(--ease);
  flex: none;
}
.switch .knob {
  position: absolute; top: 2px; left: 2px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
  transition: transform .45s var(--spring), background .3s;
}
.switch.on { background: var(--primary); }
.switch.on .knob { transform: translateX(18px); background: var(--on-primary); }

/* checkbox circle (tasks) */
.check {
  width: 18px; height: 18px;
  flex: none;
  border-radius: 50%;
  border: 1.5px solid var(--fg-3);
  display: grid; place-items: center;
  transition: border-color .2s, background .25s var(--ease), transform .3s var(--spring);
}
.check svg { width: 12px; height: 12px; fill: none; stroke: var(--bg); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 20; stroke-dashoffset: 20; transition: stroke-dashoffset .35s var(--ease) .05s; }
.check:hover { border-color: var(--fg); }
.check.on { background: var(--fg); border-color: var(--fg); animation: pop .4s var(--spring); }
.check.on svg { stroke-dashoffset: 0; }
.check.big { width: 22px; height: 22px; }
.check.big svg { width: 14px; height: 14px; }

/* ---------- Toolbar ---------- */
.toolbar {
  z-index: 5;
  height: 58px;
  flex: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 0 12px 0 10px;
  border-radius: 20px;
}
.tb-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tb-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; animation: in-fade .45s var(--ease) both; }
.tb-title h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: calc(21px * var(--ts, 1)); font-weight: 650;
  letter-spacing: -.022em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-light { font-weight: 400; color: var(--fg-3); }
.tb-sub { color: var(--fg-3); font-size: calc(13px * var(--ts, 1)); font-weight: 500; white-space: nowrap; }
.tb-center { display: flex; justify-content: center; }
.tb-right { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.nav-group { display: flex; align-items: center; gap: 2px; margin-right: 6px; }
.search-btn {
  display: flex; align-items: center; gap: 8px;
  height: 32px; width: 200px;
  padding: 0 6px 0 11px;
  border-radius: 10px;
  background: rgba(var(--ink), .065);
  color: var(--fg-3);
  font-size: calc(13px * var(--ts, 1));
  transition: background .2s, width .5s var(--ease);
}
.search-btn:hover { background: rgba(var(--ink), .1); color: var(--fg-2); }
.search-btn .search-ph { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; }

/* ---------- Sidebar ---------- */
.sidebar {
  z-index: 4;
  min-width: 0;
  overflow: hidden;
  transition: opacity .45s var(--ease), transform .6s var(--ease), filter .45s;
}
.sidebar.closed { opacity: 0; transform: translateX(-24px) scale(.98); filter: blur(6px); pointer-events: none; }
.sb-scroll {
  position: relative;
  height: 100%;
  width: var(--sb-w);
  overflow-y: auto;
  padding: 16px 14px 18px;
  scrollbar-width: none;
}
.sb-scroll::-webkit-scrollbar { display: none; }
.brand { display: flex; align-items: center; gap: 9px; padding: 2px 6px 16px; }
.brand-mark {
  width: 17px; height: 17px;
  border-radius: 50%;
  border: 1.6px solid var(--fg);
  background: linear-gradient(90deg, var(--fg) 50%, transparent 50%);
}
.brand-name { font-family: var(--font-display); font-weight: 680; font-size: calc(17px * var(--ts, 1)); letter-spacing: -.02em; }

.mini { padding: 0 2px 14px; border-bottom: 1px solid var(--line); }
.mini-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 8px; }
.mini-title { font-weight: 600; font-size: calc(13.5px * var(--ts, 1)); }
.mini-year { color: var(--fg-3); font-weight: 500; }
.mini-nav { display: flex; gap: 2px; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; }
.mini-wd { text-align: center; font-size: calc(10.5px * var(--ts, 1)); font-weight: 600; color: var(--fg-4); padding: 2px 0 4px; }
.mini-day {
  position: relative;
  height: 30px;
  font-size: calc(12px * var(--ts, 1));
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--fg-2);
  border-radius: 9px;
  transition: background .2s, color .2s, transform .25s var(--spring);
}
.mini-day:hover { background: rgba(var(--ink), .08); color: var(--fg); }
.mini-day:active { transform: scale(.9); }
.mini-day.out { color: var(--fg-4); }
.mini-day.range { background: rgba(var(--ink), .06); color: var(--fg); border-radius: 0; }
.mini-day.anchor { box-shadow: inset 0 0 0 1.5px rgba(var(--ink), .5); color: var(--fg); border-radius: 9px; }
.mini-day.today { background: var(--accent); color: var(--on-accent); font-weight: 700; border-radius: 9px; }
.mini-day.busy::after {
  content: ""; position: absolute; left: 50%; bottom: 4px;
  width: 3px; height: 3px; margin-left: -1.5px;
  border-radius: 50%;
  background: currentColor; opacity: .6;
}

.sb-section { padding: 14px 4px 4px; }
.sb-h {
  display: flex; align-items: center; gap: 8px;
  font-size: calc(11px * var(--ts, 1)); font-weight: 650;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--fg-3);
  padding: 0 4px 8px;
}
.sb-h .count {
  font-size: calc(10.5px * var(--ts, 1)); letter-spacing: 0;
  padding: 1px 7px; border-radius: 99px;
  background: rgba(var(--ink), .09); color: var(--fg-2);
}
.sb-empty { color: var(--fg-3); font-size: calc(12.5px * var(--ts, 1)); padding: 2px 4px 8px; }
.sb-empty.calm { padding: 14px 4px; text-align: center; }
.upnext { border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.un-item { display: flex; align-items: baseline; gap: 10px; padding: 5px 4px; font-size: calc(13px * var(--ts, 1)); animation: rise .4s var(--ease) backwards; }
.un-time { color: var(--fg-3); font-variant-numeric: tabular-nums; font-size: calc(12px * var(--ts, 1)); min-width: 42px; white-space: nowrap; }
.un-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.un-item.live .un-time { color: var(--fg); position: relative; padding-left: 12px; }
.un-item.live .un-time::before {
  content: ""; position: absolute; left: 0; top: 50%; margin-top: -3px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--fg);
}

.task-add {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 8px;
  padding: 0 10px;
  height: 36px;
  border-radius: 11px;
  background: rgba(var(--ink), .055);
  color: var(--fg-3);
  transition: background .2s, box-shadow .2s;
}
.task-add:focus-within { background: rgba(var(--ink), .08); box-shadow: inset 0 0 0 1px rgba(var(--ink), .18); color: var(--fg); }
.task-add input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: calc(13px * var(--ts, 1)); color: var(--fg); }
.task-add input::placeholder { color: var(--fg-3); }
.task-group { margin-top: 6px; }
.tg-label { font-size: calc(11.5px * var(--ts, 1)); font-weight: 600; color: var(--fg-3); padding: 6px 6px 3px; }
.task {
  position: relative;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 7px 8px;
  border-radius: 11px;
  cursor: grab;
  transition: background .2s, opacity .3s, transform .35s var(--spring);
  animation: rise .35s var(--ease) backwards;
}
.task:hover { background: rgba(var(--ink), .055); }
.task:active { transform: scale(.985); }
.task.lifting { opacity: .3; }
.task .check { margin-top: 1px; }
.task-body { flex: 1; min-width: 0; }
.task-title { font-size: calc(13.5px * var(--ts, 1)); line-height: 1.35; word-break: break-word; transition: color .3s; }
.task.done .task-title { color: var(--fg-3); text-decoration: line-through; text-decoration-color: var(--fg-4); }
.task-edit { width: 100%; border: 0; outline: 0; background: rgba(var(--ink), .08); border-radius: 6px; padding: 2px 6px; font-size: calc(13.5px * var(--ts, 1)); user-select: text; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; row-gap: 1px; margin-top: 2px; font-size: calc(11.5px * var(--ts, 1)); color: var(--fg-3); }
.task-meta > span { white-space: nowrap; }
.task-meta .due { display: inline-flex; align-items: center; gap: 4px; }
.task-meta .due.scheduled { color: var(--fg-2); }
.task-meta .due.overdue { color: var(--fg); font-weight: 600; }
.task-meta .due.overdue::before { content: "!"; font-weight: 800; }
.task-meta .est::before { content: "·"; margin-right: 8px; }
.task-meta .due + .est::before { content: "·"; }
.task-meta .est:first-child::before { content: none; }
.task-x {
  opacity: 0;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 7px;
  color: var(--fg-3);
  pointer-events: none;
  transition: opacity .2s, background .2s;
}
.task:hover .task-x, .task:focus-within .task-x { opacity: 1; pointer-events: auto; }
@media (hover: none) { .task-x { opacity: .6; pointer-events: auto; } }
.task-x:hover { background: rgba(var(--ink), .1); color: var(--fg); }
.done-group { margin-top: 12px; }
.done-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px; }
.chev { display: inline-grid; transition: transform .35s var(--spring); }
.chev.open { transform: rotate(90deg); }
.sb-hint { margin: 18px 6px 0; font-size: calc(11.5px * var(--ts, 1)); line-height: 1.45; color: var(--fg-4); }

/* ---------- Time grid ---------- */
.tg-wrap { display: flex; height: 100%; }
.tg { display: flex; flex-direction: column; height: 100%; flex: 1; min-width: 0; }
.agenda {
  width: 300px; flex: none;
  border-left: 1px solid var(--line);
  padding: 22px 18px;
  overflow-y: auto;
  scrollbar-width: none;
}
.ag-date { display: flex; align-items: center; gap: 14px; }
.ag-num { font-family: var(--font-display); font-size: calc(64px * var(--ts, 1)); font-weight: 250; letter-spacing: -.05em; line-height: .9; }
.ag-wd { font-size: calc(17px * var(--ts, 1)); font-weight: 650; letter-spacing: -.01em; }
.ag-rel { font-size: calc(13px * var(--ts, 1)); color: var(--fg-3); margin-top: 2px; }
.ag-stats { display: flex; gap: 14px; margin: 18px 0 14px; font-size: calc(12.5px * var(--ts, 1)); color: var(--fg-3); }
.ag-stats b { color: var(--fg); font-weight: 650; }
.ag-empty { padding: 26px 0; color: var(--fg-3); font-size: calc(13px * var(--ts, 1)); }
.ag-list { display: flex; flex-direction: column; gap: 2px; }
.ag-item { display: flex; align-items: flex-start; gap: 11px; text-align: left; padding: 9px 10px; border-radius: 12px; transition: background .2s, transform .25s var(--spring); animation: rise .4s var(--ease) backwards; }
.ag-item:hover { background: rgba(var(--ink), .06); }
.ag-item:active { transform: scale(.98); }
.ag-item.past { opacity: .5; }
.ag-item .swatch { margin-top: 2px; }
.ag-text { display: flex; flex-direction: column; min-width: 0; }
.ag-title { font-size: calc(14px * var(--ts, 1)); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-when { font-size: calc(12px * var(--ts, 1)); color: var(--fg-3); font-variant-numeric: tabular-nums; margin-top: 1px; }
.ag-sec { margin: 18px 10px 6px; font-size: calc(11px * var(--ts, 1)); font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-3); }
.ag-task { display: flex; align-items: center; gap: 10px; padding: 7px 10px; font-size: calc(13.5px * var(--ts, 1)); }
.ag-task.done span { color: var(--fg-3); text-decoration: line-through; }
.app.has-inspector .agenda { display: none; }
@container main (max-width: 900px) { .agenda { display: none; } }
.tg-head {
  display: grid;
  grid-template-columns: var(--gutter) minmax(0, 1fr);
  border-bottom: 1px solid var(--line);
  flex: none;
}
.tg-gutter-head { display: grid; place-items: end center; padding-bottom: 10px; font-size: calc(10.5px * var(--ts, 1)); color: var(--fg-3); }
.wk-badge { font-weight: 600; letter-spacing: .02em; }
.tg-head-days { display: grid; }
.tg-hd {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  height: 54px;
  cursor: pointer;
  border-left: 1px solid transparent;
  transition: background .2s;
}
.tg-hd:hover { background: rgba(var(--ink), .03); }
.tg-hd .wd { font-size: calc(12px * var(--ts, 1)); font-weight: 600; color: var(--fg-3); text-transform: uppercase; letter-spacing: .04em; }
.tg-hd .num {
  min-width: 32px; height: 32px; padding: 0 6px;
  display: grid; place-items: center;
  border-radius: 99px;
  font-family: var(--font-display);
  font-size: calc(19px * var(--ts, 1)); font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.tg-hd.weekend .num { color: var(--fg-2); }
.tg-hd.today .wd { color: var(--accent); }
.tg-hd.today .num { background: var(--accent); color: var(--on-accent); font-weight: 650; box-shadow: 0 4px 16px color-mix(in srgb, var(--accent) 35%, transparent); }
.view-Day .tg-hd { justify-content: flex-start; padding-left: 16px; cursor: default; }
/* Day view: the header leads back to the wider view you came from. */
.view-Day .tg-hd.back { cursor: pointer; }
.hd-back {
  display: inline-flex; align-items: center; gap: 2px;
  height: 24px; padding: 0 9px 0 5px; margin-right: 4px;
  border-radius: 99px;
  font-size: calc(11.5px * var(--ts, 1)); font-weight: 600; color: var(--fg-3);
  background: rgba(var(--ink), .055);
  transition: background .2s, color .2s, transform .35s var(--spring);
}
.tg-hd.back:hover .hd-back { color: var(--fg); background: rgba(var(--ink), .1); transform: translateX(-2px); }
.tg-hd .num { flex-shrink: 0; }
/* Phones: the day header is a short column; keep the back chip on the row. */
@media (max-width: 640px) {
  .view-Day .tg-hd.back { flex-direction: row; gap: 6px; }
  .view-Day .tg-hd.back .hd-back { height: 22px; padding: 0 8px 0 4px; }
}

.tg-allday {
  display: grid;
  grid-template-columns: var(--gutter) minmax(0, 1fr);
  border-bottom: 1px solid var(--line);
  flex: none;
  max-height: 108px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.tg-allday::-webkit-scrollbar { display: none; }
.ad-label { place-items: center; padding: 0; font-size: calc(10px * var(--ts, 1)); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.tg-allday-days { display: grid; }
.ad-cell { display: flex; flex-direction: column; gap: 2px; padding: 4px 0; min-height: 30px; border-left: 1px solid var(--line); }
.ad-chip {
  margin: 0 3px;
  height: 22px; line-height: 22px;
  padding: 0 8px;
  border-radius: 7px;
  font-size: calc(12px * var(--ts, 1)); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: grab;
  animation: rise .35s var(--ease) backwards;
}
.ad-chip.cont-l { margin-left: -1px; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.ad-chip.cont-r { margin-right: -1px; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.ad-chip.selected { box-shadow: inset 3px 0 0 var(--c, var(--fg)), 0 0 0 2px var(--bg), 0 0 0 3.5px var(--c, var(--fg)); }
.ad-chip.lifting { opacity: .3; }
.ad-cell { transition: background .2s var(--ease); }
.ad-cell.drop { background: rgba(var(--ink), .09); box-shadow: inset 0 0 0 1.5px rgba(var(--ink), .4); }

.tg-scroll {
  flex: 1; min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.tg-scroll::-webkit-scrollbar { display: none; }
.tg-body { position: relative; display: grid; grid-template-columns: var(--gutter) minmax(0, 1fr); }
.tg-gutter { position: relative; }
.hour-label {
  position: absolute; right: 10px;
  transform: translateY(-50%);
  font-size: calc(10.5px * var(--ts, 1)); font-weight: 500;
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* The hour the "now" pill sits on gives way to it (it showed half under the pill). */
.hour-label { transition: opacity .3s var(--ease); }
.hour-label.near-now { opacity: 0; }
.now-label {
  position: absolute; right: 6px;
  transform: translateY(-50%);
  font-size: calc(10.5px * var(--ts, 1)); font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--now); color: var(--on-accent);
  font-variant-numeric: tabular-nums;
  z-index: 2;
}
.tg-days { position: relative; display: grid; height: 100%; }
.tg-col {
  position: relative;
  height: 100%;
  border-left: 1px solid var(--line);
  background-image:
    linear-gradient(to bottom, var(--line) 0, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, transparent calc(var(--hour) / 2), var(--line-half) calc(var(--hour) / 2), var(--line-half) calc(var(--hour) / 2 + 1px), transparent calc(var(--hour) / 2 + 1px));
  background-size: 100% var(--hour);
  cursor: crosshair;
}
.tg-col.weekend { background-color: rgba(var(--ink), .014); }
.tg-col.today { background-color: rgba(var(--ink), .028); }
.work-hours { display: none; }
.now-line {
  position: absolute; left: -1px; right: 0;
  height: 0;
  border-top: 1.5px solid var(--now);
  z-index: 4;
  pointer-events: none;
  box-shadow: 0 0 12px color-mix(in srgb, var(--now) 45%, transparent);
}
.now-dot {
  position: absolute; left: -5px; top: -5.5px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--now);
}

/* ---------- Calendars ----------
   Each calendar has a colour slot (.cc-0 … .cc-11, generated with the palettes) that
   exposes the palette colour (--c) and a legible text tone (--ct).
   Components decide how to paint them: tinted fill + solid bar for events,
   tinted tiles for swatches, dots in Month view. */
.ev, .ad-chip, .mv-chip.allday {
  background: color-mix(in oklab, var(--c, var(--fg)) var(--ev-a), var(--ev-base));
  color: var(--ct, var(--fg));
  box-shadow: inset 3px 0 0 var(--c, var(--fg));
}
.swatch, .card-cat, .w-sw {
  background: color-mix(in srgb, var(--c, var(--fg)) 22%, transparent);
  /* Not --ct: that tone is tuned for event fills (white/near-black on Signal's solid blocks). */
  color: color-mix(in srgb, var(--c, var(--fg)) 65%, var(--fg));
}
/* Multi-day chips: the category bar belongs to the first segment only. */
.ad-chip.cont-l, .mv-chip.allday.cont-l { box-shadow: none; }
.ad-chip.cont-l.selected { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--c, var(--fg)); }

/* ---------- Event blocks ---------- */
.ev {
  position: absolute;
  border-radius: 9px;
  overflow: hidden;
  cursor: grab;
  z-index: 1;
  font-size: calc(12px * var(--ts, 1));
  line-height: 1.25;
  transition: box-shadow .25s var(--ease), opacity .3s, transform .3s var(--spring), filter .2s;
  animation: rise .4s var(--ease) backwards;
}
.ev:hover { z-index: 2; filter: brightness(1.12); }
:root[data-theme="light"] .ev:hover { filter: brightness(.96); }
.ev-inner { display: flex; gap: 6px; height: 100%; padding: 5px 7px; }
.ev-text { min-width: 0; flex: 1; }
.ev-title { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.005em; }
.ev-title.placeholder { opacity: .55; font-weight: 500; }
.ev-rep { margin-left: 5px; opacity: .55; font-weight: 500; }
.ev-time, .ev-loc { opacity: .68; font-size: calc(11px * var(--ts, 1)); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.ev.short .ev-inner { padding: 3px 7px; }
.ev.short .ev-text { display: flex; gap: 6px; align-items: baseline; }
.ev.short .ev-time { margin: 0; }
.ev.tiny .ev-inner { padding: 0 7px; align-items: center; }
.ev.tiny .ev-title { font-size: calc(11px * var(--ts, 1)); }
.ev.past { opacity: .62; }
.ev.past:hover { opacity: .85; }
.ev.done .ev-title { text-decoration: line-through; }
.ev.done { opacity: .45; }
.ev.selected {
  z-index: 3;
  box-shadow: inset 3px 0 0 var(--c, var(--fg)), 0 0 0 2px var(--bg), 0 0 0 3.5px var(--c, var(--fg)), 0 10px 28px rgba(0, 0, 0, .3);
  background: color-mix(in oklab, var(--c, var(--fg)) min(100%, calc(var(--ev-a) + 14%)), var(--ev-base));
  opacity: 1;
}
.ev.lifting { opacity: .25; transform: scale(.98); }
.ev.ghost {
  z-index: 6;
  pointer-events: none;
  animation: none;
  transform: scale(1.02);
  box-shadow: inset 3px 0 0 var(--c, var(--fg)), 0 18px 44px rgba(0, 0, 0, .4), 0 0 0 1px var(--c, rgba(var(--ink), .4));
  transition: top .12s var(--ease), height .12s var(--ease), left .12s var(--ease);
}
.ev-resize { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; cursor: ns-resize; }
.ev.tiny .ev-resize, .ev.short .ev-resize { height: 4px; }
.ev-resize::after {
  content: ""; position: absolute; left: 50%; bottom: 3px;
  width: 18px; height: 3px; margin-left: -9px;
  border-radius: 2px; background: currentColor; opacity: 0;
  transition: opacity .2s;
}
.ev:hover .ev-resize::after { opacity: .35; }
.ev-check {
  width: 15px; height: 15px; flex: none; margin-top: 1px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  display: grid; place-items: center;
  opacity: .8;
}
.ev-check svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.ev-check.on { background: currentColor; }
.ev-check.on svg { opacity: 1; stroke: color-mix(in oklab, var(--c, var(--fg)) var(--ev-a), var(--ev-base)); }

/* ---------- Month ---------- */
.mv { display: flex; flex-direction: column; height: 100%; }
.mv-head { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--line); flex: none; }
.mv.with-wk .mv-head { grid-template-columns: 32px repeat(7, 1fr); }
.mv-wd { padding: 12px 12px 10px; font-size: calc(11.5px * var(--ts, 1)); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-3); }
.mv-body { flex: 1; min-height: 0; display: flex; }
.mv-wk-col { width: 32px; display: grid; grid-template-rows: repeat(6, 1fr); border-right: 1px solid var(--line); }
.mv-wk { padding: 10px 0; text-align: center; font-size: calc(10.5px * var(--ts, 1)); color: var(--fg-4); font-weight: 600; }
.mv-grid { flex: 1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: repeat(6, minmax(0, 1fr)); }
.mv-cell {
  position: relative;
  min-height: 0;
  padding: 6px 6px 4px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  display: flex; flex-direction: column; gap: 3px;
  transition: background .25s var(--ease), box-shadow .25s;
}
.mv-cell:nth-child(7n) { border-right: 0; }
.mv-cell:nth-last-child(-n + 7) { border-bottom: 0; }
.mv-cell.weekend { background: rgba(var(--ink), .014); }
.mv-cell:hover { background: rgba(var(--ink), .03); }
.mv-cell.other .mv-num, .mv-cell.other .mv-chips { opacity: .35; }
.mv-cell.drop { background: rgba(var(--ink), .09); box-shadow: inset 0 0 0 1.5px rgba(var(--ink), .45); }
.mv-num-row { display: flex; justify-content: flex-end; }
.mv-num {
  min-width: 26px; height: 26px; padding: 0 7px;
  display: grid; place-items: center;
  border-radius: 99px;
  font-size: calc(13px * var(--ts, 1)); font-weight: 550;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background .2s;
  white-space: nowrap;
}
.mv-num:hover { background: rgba(var(--ink), .1); }
.mv-cell.today .mv-num { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.mv-chips { display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.mv-chip {
  display: flex; align-items: center; gap: 6px;
  height: 21px; padding: 0 7px;
  border-radius: 6px;
  font-size: calc(12px * var(--ts, 1));
  white-space: nowrap; overflow: hidden;
  cursor: grab;
  animation: rise .35s var(--ease) backwards;
  transition: background .2s;
}
.mv-chip .n { overflow: hidden; text-overflow: ellipsis; }
.mv-chip.timed { background: transparent !important; color: var(--fg) !important; box-shadow: none !important; outline: none !important; }
.mv-chip.timed:hover { background: rgba(var(--ink), .08) !important; }
.mv-chip.timed .dot { width: 8px; height: 8px; flex: none; border-radius: 50%; }
.mv-chip.timed .dot { background: var(--c, var(--fg)); }
.mv-chip .t { color: var(--fg-3); font-size: calc(11px * var(--ts, 1)); font-variant-numeric: tabular-nums; }
.mv-chip.allday { font-weight: 600; }
.mv-chip.allday.cont-l { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -6px; padding-left: 13px; }
.mv-chip.selected { box-shadow: inset 0 0 0 1.5px var(--bg), 0 0 0 1.5px var(--c, var(--fg)) !important; }
.mv-more { font-size: calc(11px * var(--ts, 1)); font-weight: 600; color: var(--fg-3); padding: 0 7px; cursor: pointer; }
.mv-more:hover { color: var(--fg); }

/* ---------- Year ---------- */
.yv {
  height: 100%;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px 22px;
  padding: 22px 26px;
  align-content: start;
  scrollbar-width: none;
}
.ym { padding: 8px; border-radius: 16px; transition: background .3s; animation: rise .5s var(--ease) backwards; animation-delay: calc(var(--i) * 22ms); }
.ym.current { background: rgba(var(--ink), .035); }
.ym-title {
  font-family: var(--font-display);
  font-size: calc(16px * var(--ts, 1)); font-weight: 650; letter-spacing: -.01em;
  padding: 2px 4px 8px;
  transition: opacity .2s;
}
.ym-title:hover { opacity: .65; }
.ym.current .ym-title { text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1.5px; }
.ym-wds, .ym-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.ym-wds span { text-align: center; font-size: calc(10px * var(--ts, 1)); font-weight: 600; color: var(--fg-4); padding-bottom: 3px; }
.yd {
  aspect-ratio: 1;
  max-height: 30px;
  display: grid; place-items: center;
  margin: 1px;
  font-size: calc(11px * var(--ts, 1)); font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--fg-2);
  border-radius: 50%;
  transition: background .2s, transform .25s var(--spring);
}
.yd:not(.out):hover { transform: scale(1.18); background: rgba(var(--ink), .14); color: var(--fg); }
.yd.out { pointer-events: none; }
.yd.lvl1 { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--fg); }
.yd.lvl2 { background: color-mix(in srgb, var(--primary) 24%, transparent); color: var(--fg); }
.yd.lvl3 { background: color-mix(in srgb, var(--primary) 38%, transparent); color: var(--fg); }
.yd.lvl4 { background: color-mix(in srgb, var(--primary) 55%, transparent); color: var(--fg); }
.yd.today { background: var(--accent); color: var(--on-accent); font-weight: 750; }

/* ---------- Inspector ---------- */
.inspector {
  position: fixed;
  z-index: 30;
  top: 10px; right: 10px; bottom: 10px;
  width: 372px;
  transform: translateX(calc(100% + 30px)) scale(.98);
  opacity: 0;
  transition: transform .6s var(--ease), opacity .4s var(--ease);
  pointer-events: none;
  overflow: hidden;
  user-select: text;
}
.inspector.open { transform: none; opacity: 1; pointer-events: auto; }
.insp { position: relative; height: 100%; overflow-y: auto; padding: 14px 16px 18px; scrollbar-width: none; animation: in-fade .35s var(--ease) both; }
.insp::-webkit-scrollbar { display: none; }
.insp-top { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.insp-summary { flex: 1; font-size: calc(12px * var(--ts, 1)); color: var(--fg-3); font-weight: 500; }
.insp-title {
  width: 100%;
  border: 0; outline: 0; resize: none;
  background: transparent;
  font-family: var(--font-display);
  font-size: calc(24px * var(--ts, 1)); font-weight: 680;
  letter-spacing: -.022em;
  line-height: 1.2;
  padding: 6px 0 12px;
  field-sizing: content;
  min-height: 44px;
}
.insp-title::placeholder { color: var(--fg-4); }
/* A long title grows the box in every browser, also without field-sizing (WebKit before 26,
   i.e. macOS 11–13, and Firefox): an invisible copy of the title, wrapped the same way, sets
   the height of the grid cell that the textarea fills. */
.insp-title-wrap { display: grid; }
.insp-title-wrap > .insp-title, .insp-title-wrap::after { grid-area: 1 / 1; }
.insp-title-wrap > .insp-title { overflow: hidden; }
.insp-title-wrap::after {
  content: attr(data-value) " ";
  visibility: hidden; pointer-events: none;
  box-sizing: border-box;
  white-space: pre-wrap; overflow-wrap: break-word;
  font-family: var(--font-display);
  font-size: calc(24px * var(--ts, 1)); font-weight: 680;
  letter-spacing: -.022em;
  line-height: 1.2;
  padding: 6px 0 12px;
  min-height: 44px;
}
.insp-card {
  margin-top: 10px;
  padding: 2px 12px;
  border-radius: 15px;
  background: rgba(var(--ink), .045);
  box-shadow: inset 0 0 0 .5px rgba(var(--ink), .06);
}
.insp .row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 46px;
  border-bottom: 1px solid var(--line);
}
.insp .row:last-child { border-bottom: 0; }
.row-label { display: flex; align-items: center; gap: 8px; font-size: calc(13.5px * var(--ts, 1)); font-weight: 500; color: var(--fg); }
.row-label .icon { color: var(--fg-3); }
.row-label.block { padding: 12px 0 8px; }
.row-inputs { display: flex; gap: 6px; align-items: center; }
/* Date and time fields in Mono's own words and clock (ui/datetime.rs), not the system's
   native controls (those follow the system's language: "11/18/2026, 02:30 PM"). */
.date-field, .time-field {
  border: 0; outline: 0;
  height: 30px; padding: 0 9px;
  border-radius: 8px;
  background: rgba(var(--ink), .08);
  font: inherit; font-size: calc(13px * var(--ts, 1)); font-weight: 500; color: var(--fg);
  font-variant-numeric: tabular-nums;
  transition: background .2s, box-shadow .2s;
}
.date-field { white-space: nowrap; cursor: pointer; }
.date-field:hover { background: rgba(var(--ink), .12); }
.date-field.empty { color: var(--fg-3); }
.date-field.open, .time-field:focus { box-shadow: inset 0 0 0 1.5px rgba(var(--ink), .4); }
.time-field { width: 60px; text-align: center; }
.time-field.h12 { width: 86px; }
/* Mono's month, opened under a date field's row. */
.date-pick { padding: 10px 0 8px; border-bottom: 1px solid var(--line); animation: in-fade .25s var(--ease) both; }
.date-pick:last-child { border-bottom: 0; }
.date-pick .mini-head { padding: 0 2px 6px 4px; }
.date-pick .mini-day:disabled { opacity: .3; pointer-events: none; }
.date-pick .mini-day.now { color: var(--fg); font-weight: 700; box-shadow: inset 0 0 0 1.5px rgba(var(--ink), .35); }
.date-pick .mini-day.sel { background: var(--accent); color: var(--on-accent); font-weight: 700; box-shadow: none; }
.date-pick .icon-btn:disabled { opacity: .3; pointer-events: none; }
.quick-lens { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 0 12px; }
.select-wrap { position: relative; display: flex; align-items: center; color: var(--fg-2); }
.select-wrap select {
  appearance: none; -webkit-appearance: none;
  border: 0; outline: 0;
  height: 30px; padding: 0 28px 0 11px;
  border-radius: 8px;
  background: rgba(var(--ink), .08);
  font-size: calc(13px * var(--ts, 1)); font-weight: 500; color: var(--fg);
  cursor: pointer;
}
.select-wrap .icon { position: absolute; right: 9px; pointer-events: none; }
.select-wrap option { background: var(--bg); color: var(--fg); }
/* Reminders: one chip per reminder, "+ Add" for another. */
.insp .row.rem-row { align-items: flex-start; padding: 8px 0; }
.rem-row .row-label { padding-top: 6px; }
.rem-chips { flex: 1; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.rem-chip {
  display: inline-flex; align-items: center; gap: 2px;
  height: 30px; padding: 0 4px 0 11px;
  border-radius: 99px;
  font-size: calc(12.5px * var(--ts, 1)); color: var(--fg);
  background: rgba(var(--ink), .07);
  animation: menu-in .3s var(--spring) both;
}
.rem-x { width: 22px; height: 22px; border-radius: 99px; display: grid; place-items: center; color: var(--fg-3); transition: background .2s, color .2s; }
.rem-x:hover { background: rgba(var(--ink), .1); color: var(--fg); }
.rem-add select { border-radius: 99px; }
/* minmax(0, …): a long name shrinks to "…" in its column instead of pushing past the card. */
.cats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding-bottom: 12px; }
.cats.wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cat-pick {
  display: flex; align-items: center; gap: 6px;
  min-width: 0;
  height: 36px; padding: 0 7px;
  border-radius: 10px;
  font-size: calc(12.5px * var(--ts, 1)); font-weight: 500; color: var(--fg-2);
  transition: background .2s, box-shadow .25s, color .2s, transform .25s var(--spring);
}
.cat-pick:hover { background: rgba(var(--ink), .07); color: var(--fg); }
.cat-pick:active { transform: scale(.95); }
.cat-pick.on { color: var(--fg); background: rgba(var(--ink), .09); box-shadow: inset 0 0 0 1.5px rgba(var(--ink), .5); }
.cat-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.swatch { width: 16px; height: 16px; flex: none; border-radius: 5px; }
.insp .row.field { justify-content: flex-start; color: var(--fg-3); }
.insp .row.field.top { align-items: flex-start; padding-top: 13px; }
.insp .row.field input, .insp .row.field textarea {
  flex: 1; border: 0; outline: 0; background: none; resize: none;
  font-size: calc(13.5px * var(--ts, 1)); color: var(--fg);
  line-height: 1.45;
  padding: 0;
}
.insp .row.field textarea { min-height: 88px; padding-bottom: 10px; }
.insp .row.field input::placeholder, .insp .row.field textarea::placeholder { color: var(--fg-3); }
.insp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* ---------- Palette ---------- */
.palette-wrap {
  position: fixed; inset: 0;
  z-index: 50;
  background: var(--scrim);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s var(--ease);
}
.palette-wrap.open { opacity: 1; pointer-events: auto; }
.palette {
  position: absolute;
  top: 13vh; left: 50%;
  width: min(660px, calc(100vw - 24px));
  transform: translateX(-50%);
  padding: 6px;
  border-radius: 24px;
  animation: pal-in .5s var(--spring) both;
  user-select: none;
}
@keyframes pal-in { from { opacity: 0; transform: translateX(-50%) translateY(-10px) scale(.96); } to { opacity: 1; transform: translateX(-50%); } }
.pal-input { position: relative; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 14px 0 16px; color: var(--fg-3); }
.pal-input input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: calc(19px * var(--ts, 1)); font-weight: 450; letter-spacing: -.01em; color: var(--fg); user-select: text; }
.pal-input input::placeholder { color: var(--fg-3); }
.pal-hint { position: relative; display: flex; align-items: center; gap: 8px; padding: 2px 18px 10px; font-size: calc(12.5px * var(--ts, 1)); color: var(--fg-3); }
.pal-hint-text { min-width: 0; flex: 1; }
.pal-guide-toggle { flex: none; display: inline-flex; align-items: center; gap: 4px; align-self: center; padding: 3px 8px; border-radius: 999px; font-size: calc(11.5px * var(--ts, 1)); font-weight: 600; color: var(--fg-2); background: rgba(var(--ink), .05); white-space: nowrap; transition: background .2s, color .2s; }
.pal-guide-toggle:hover { background: rgba(var(--ink), .09); color: var(--fg); }
.pal-guide-toggle .icon { transition: transform .25s var(--spring); }
.pal-guide-toggle.open .icon { transform: rotate(180deg); }
.pal-guide { container-type: inline-size; margin: 0 14px 10px; padding: 10px 14px; border-radius: 12px; background: rgba(var(--ink), .04); box-shadow: inset 0 0 0 1px rgba(var(--ink), .06); animation: fade-in .25s var(--ease) both; }
.pal-guide-grid { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr); gap: 7px 10px; align-items: baseline; }
.pal-guide-v:nth-child(4n + 2) { margin-right: 12px; }
.pal-guide-k { justify-self: start; padding: 1px 6px; border-radius: 6px; font: 600 calc(11.5px * var(--ts, 1)) / 1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--fg); background: rgba(var(--ink), .07); white-space: nowrap; }
.pal-guide-v { min-width: 0; font-size: calc(12px * var(--ts, 1)); line-height: 1.4; color: var(--fg-3); }
@container (max-width: 520px) {
  .pal-guide-grid { grid-template-columns: max-content minmax(0, 1fr); }
  .pal-guide-v:nth-child(4n + 2) { margin-right: 0; }
}
.pal-list { position: relative; max-height: 52vh; overflow-y: auto; padding: 4px 0 2px; border-top: 1px solid var(--line); scrollbar-width: none; }
.pal-sec { font-size: calc(11px * var(--ts, 1)); font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-3); padding: 12px 14px 6px; }
.pal-item {
  display: flex; align-items: center; gap: 12px;
  min-height: 44px;
  padding: 6px 12px;
  margin: 1px 2px;
  border-radius: 14px;
  cursor: pointer;
  transition: background .15s;
  animation: rise .3s var(--ease) backwards;
}
.pal-item.active { background: rgba(var(--ink), .085); }
.pal-ic { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 8px; background: rgba(var(--ink), .07); color: var(--fg-2); }
.pal-ic.strong { background: var(--fg); color: var(--bg); }
.pal-main { flex: 1 1 40%; min-width: 80px; display: flex; align-items: baseline; gap: 8px; font-size: calc(14px * var(--ts, 1)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-verb { color: var(--fg-3); font-size: calc(12.5px * var(--ts, 1)); }
.pal-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.pal-side { color: var(--fg-3); font-size: calc(12.5px * var(--ts, 1)); white-space: nowrap; }
.pal-chips { display: flex; gap: 5px; flex-wrap: nowrap; min-width: 0; overflow: hidden; flex-shrink: 1; }
.pchip { font-size: calc(11.5px * var(--ts, 1)); font-weight: 600; padding: 3px 8px; border-radius: 7px; background: rgba(var(--ink), .1); white-space: nowrap; animation: pop .35s var(--spring) backwards; }
.pal-empty { padding: 20px; text-align: center; color: var(--fg-3); }

/* ---------- Modals ---------- */
.modal-wrap {
  position: fixed; inset: 0;
  z-index: 60;
  display: grid; place-items: center;
  padding: 16px;
  background: var(--scrim);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s var(--ease);
}
.modal-wrap.open { opacity: 1; pointer-events: auto; }
.sheet {
  width: min(560px, 100%);
  max-height: min(86vh, 860px);
  display: flex; flex-direction: column;
  animation: sheet-in .55s var(--spring) both;
  overflow: hidden;
}
@keyframes sheet-in { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
.sheet-head { position: relative; display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 6px 22px; }
.sheet-head h2 { margin: 0; font-family: var(--font-display); font-size: calc(22px * var(--ts, 1)); font-weight: 680; letter-spacing: -.02em; }
.sheet-body { position: relative; overflow-y: auto; padding: 6px 22px 22px; scrollbar-width: none; user-select: text; }
.set-group { padding: 12px 0; display: flex; flex-direction: column; gap: 9px; }
.set-group.inline { flex-direction: row; align-items: center; justify-content: space-between; }
.set-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.set-label { font-size: calc(12px * var(--ts, 1)); font-weight: 600; color: var(--fg-3); }
.cat-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cat-edit-row { display: flex; align-items: center; gap: 9px; padding: 0 10px; height: 38px; border-radius: 11px; background: rgba(var(--ink), .05); }
.cat-edit-row input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: calc(13px * var(--ts, 1)); }
.cat-edit-row input::placeholder { color: var(--fg-2); }
.data-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.set-foot { padding-top: 14px; font-size: calc(11.5px * var(--ts, 1)); color: var(--fg-4); text-align: center; }
.alert { width: min(340px, 100%); padding: 22px 20px 16px; text-align: center; animation: sheet-in .5s var(--spring) both; }
.alert-icon { position: relative; display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: rgba(var(--ink), .08); margin-bottom: 10px; }
.alert p { position: relative; margin: 0 0 16px; font-size: calc(14px * var(--ts, 1)); line-height: 1.45; color: var(--fg-2); }
.alert-btns { position: relative; display: flex; flex-direction: column; gap: 6px; }
.alert-btn { height: 40px; border-radius: 12px; font-weight: 600; background: rgba(var(--ink), .09); transition: background .2s, transform .25s var(--spring); }
.alert-btn:first-child { background: var(--fg); color: var(--bg); }
.alert-btn:hover { background: rgba(var(--ink), .15); }
.alert-btn:first-child:hover { background: var(--fg); filter: brightness(.9); }
.alert-btn:active { transform: scale(.97); }
.alert-btn.subtle { background: transparent; color: var(--fg-3); }
.help .keys { display: flex; flex-direction: column; }
.key-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: calc(13.5px * var(--ts, 1)); }
.key-k { display: flex; gap: 5px; }
.key-k kbd { font-size: calc(12px * var(--ts, 1)); padding: 3px 8px; color: var(--fg); }
.mouse-tips { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.tip { font-size: calc(13px * var(--ts, 1)); color: var(--fg-2); padding-left: 14px; position: relative; }
.tip::before { content: ""; position: absolute; left: 0; top: 7px; width: 5px; height: 5px; border-radius: 50%; background: var(--fg-3); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  z-index: 70;
  left: 50%; bottom: 22px;
  display: flex; align-items: center; gap: 14px;
  padding: 8px 8px 8px 18px;
  min-height: 44px;
  border-radius: 99px;
  transform: translate(-50%, 160%) scale(.9);
  opacity: 0;
  pointer-events: none;
  transition: transform .6s var(--spring), opacity .35s var(--ease);
}
.toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast-msg { position: relative; font-size: calc(13.5px * var(--ts, 1)); font-weight: 550; }
.toast-undo { position: relative; height: 30px; padding: 0 14px; border-radius: 99px; background: var(--fg); color: var(--bg); font-size: calc(12.5px * var(--ts, 1)); font-weight: 650; transition: transform .25s var(--spring); }
.toast-undo:active { transform: scale(.94); }
.toast:not(:has(.toast-undo)) { padding-right: 18px; }
/* Long messages wrap at a readable width, in a rounded card rather than a pill. */
.toast { width: max-content; max-width: min(520px, calc(100vw - 32px)); }
.toast.long { border-radius: 20px; padding-top: 11px; padding-bottom: 11px; }
.toast.long .toast-msg { line-height: 1.4; }

/* ---------- Drag ---------- */
.drag-layer { position: fixed; inset: 0; z-index: 45; cursor: grabbing; }
.drag-layer.resize, .drag-layer.resize * { cursor: ns-resize !important; }
.drag-chip {
  position: fixed; top: 0; left: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px 8px 10px;
  border-radius: 12px;
  font-size: calc(13px * var(--ts, 1)); font-weight: 600;
  background: var(--fg); color: var(--bg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
  pointer-events: none;
  white-space: nowrap;
  transition: opacity .2s, scale .3s var(--spring);
  rotate: -2deg;
}
.drag-chip.over { opacity: .0; scale: .8; }
.drag-chip .check { border-color: var(--bg); width: 14px; height: 14px; }

/* Touch: let drags start on events / tasks instead of panning the page. */
.ev, .ev-resize, .ad-chip, .mv-chip, .task { touch-action: none; }
.tg-col { touch-action: pan-y; }

/* ---------- Responsive ---------- */
@container main (max-width: 1180px) {
  /* The view title comes first ("Novembre", "Листопад" in full); the view switcher gives way
     (its segments lose their side padding) down to its labels' width (--seg-min, toolbar.rs). */
  .toolbar { grid-template-columns: auto minmax(var(--seg-min, 300px), 1fr) auto; }
  .tb-center { min-width: 0; }
  .tb-center .segmented { width: 100%; max-width: calc(var(--n) * 68px); }
  .tb-center .seg { padding: 0 3px; }
  .tb-sub { display: none; }
  /* Leave the view title room for "November 2026" next to the calendars pill. */
  .search-btn { width: 150px; }
  .search-btn kbd { display: none; }
  .seg { padding: 0 11px; }
}
@container main (max-width: 1020px) {
  .search-btn { width: 36px; padding: 0; justify-content: center; }
  .search-btn .search-ph, .search-btn kbd { display: none; }
}
@container main (max-width: 940px) {
  .seg { padding: 0 10px; }
  .tb-right { gap: 2px; }
  .nav-group { margin-right: 0; }
  .tb-light { display: none; }
}
@container main (max-width: 760px) {
  .toolbar { height: auto; padding: 8px; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "l r" "c c"; row-gap: 8px; column-gap: 8px; }
  .tb-left { grid-area: l; gap: 6px; }
  .tb-right { grid-area: r; }
  .tb-center { grid-area: c; justify-content: stretch; }
  .tb-center .segmented { width: 100%; max-width: none; }
  .tb-light { display: none; }
}
@container main (max-width: 860px) {
  .seg { padding: 0 10px; }
  .nav-group { margin-right: 0; }
  .tb-right { gap: 2px; }
  .tb-title h1 { font-size: calc(18px * var(--ts, 1)); }
}
@media (max-width: 980px) {
  .app.has-inspector .main { margin-right: 0; }
  :root { --sb-w: 264px; }
  .app, .app.no-sidebar { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .sidebar { position: fixed; z-index: 40; top: 10px; left: 10px; bottom: 10px; width: var(--sb-w); }
  .sb-scrim { display: block; }
  .app.no-sidebar .sb-scrim { opacity: 0; pointer-events: none; }
  .app.no-sidebar .sidebar, .sidebar.closed { transform: translateX(calc(-100% - 20px)); }
  .toolbar { grid-template-columns: auto 1fr auto; }
  .tb-center { justify-content: flex-end; }
}
@media (max-width: 640px) {
  .app.has-inspector .main { margin-right: 0; }
  .pal-item { flex-wrap: wrap; }
  .pal-item kbd { display: none; }
  .pal-chips { flex-basis: 100%; padding-left: 40px; flex-wrap: wrap; }
  :root { --gutter: 44px; --radius: 18px; }
  .app { padding: 6px; }
  .main { gap: 6px; }
  .toolbar { height: auto; padding: 8px; grid-template-columns: 1fr auto; grid-template-areas: "l r" "c c"; row-gap: 8px; }
  .tb-left { grid-area: l; }
  .tb-right { grid-area: r; }
  .tb-center { grid-area: c; justify-content: stretch; }
  .tb-center .segmented { width: 100%; max-width: none; }
  .tb-title h1 { font-size: calc(18px * var(--ts, 1)); }
  .tb-sub, .tb-light { display: none; }
  .search-btn, .theme-btn { display: none; }
  .nav-group { margin-right: 0; }
  .nav-group .pill-btn { padding: 0 9px; }
  .tg-hd { flex-direction: column; gap: 0; height: 52px; }
  .tg-hd .num { font-size: calc(16px * var(--ts, 1)); min-width: 26px; height: 26px; }
  .tg-hd .wd { font-size: calc(10px * var(--ts, 1)); }
  .inspector { top: auto; left: 6px; right: 6px; bottom: 6px; width: auto; height: 78vh; transform: translateY(calc(100% + 20px)); }
  .yv { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px; gap: 4px 10px; }
  .mv-wd { padding: 8px 4px; text-align: center; }
  .mv-chip .t { display: none; }
  .mv-num-row { justify-content: center; }
  .set-row2, .cat-edit { grid-template-columns: 1fr; }
  .cats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Native window (desktop build). html.mac: room for the traffic lights, which sit
   inside the page; html.windows has a normal title bar and lays out like the web. ---------- */
html.mac .brand { padding-left: 64px; padding-top: 0; min-height: 30px; }
html.mac .app.no-sidebar .toolbar { padding-left: 78px; }
html.mac .app { padding-top: 10px; }
html.desktop .tb-title, html.desktop .brand { cursor: default; }

/* ==========================================================================
   Round 2 — card, priority, settings, motion
   ========================================================================== */

/* ---------- Theme switch ---------- */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) { z-index: 2; }
/* (The colours' glide: Web Animations, THEME_JS in ui/launch.rs. Round 24.) */
.theme-btn .theme-ic { position: relative; width: 18px; height: 18px; display: block; }
.theme-ic .ic-sun, .theme-ic .ic-moon {
  position: absolute; inset: 0; display: grid; place-items: center;
  transition: transform .7s var(--spring), opacity .4s var(--ease);
}
.theme-ic.dark .ic-sun { transform: rotate(-90deg) scale(.4); opacity: 0; }
.theme-ic.dark .ic-moon { transform: none; opacity: 1; }
.theme-ic.light .ic-sun { transform: none; opacity: 1; }
.theme-ic.light .ic-moon { transform: rotate(90deg) scale(.4); opacity: 0; }

/* ---------- Priority (the only colour) ---------- */
.prio-high { --prio: var(--prio-high); }
.prio-med  { --prio: var(--prio-med); }
.prio-low  { --prio: var(--prio-low); }
.prio-none { --prio: transparent; }
.ev-prio {
  position: absolute; top: 4px; right: 5px; z-index: 2;
  display: grid; color: var(--prio);
}
.ev-prio .icon, .mprio .icon, .w-prio .icon { fill: var(--prio); stroke: var(--prio); }
/* On coloured fills (solid in Signal) outline the flag in the text tone so it never melts into the block. */
.ev .ev-prio .icon, .mv-chip.allday .mprio .icon { stroke: var(--ct, var(--fg)); stroke-width: 1.8; paint-order: stroke; }
.ev.short .ev-prio, .ev.tiny .ev-prio { top: 50%; margin-top: -5.5px; }
.ev-cat-ic { position: absolute; right: 6px; bottom: 6px; opacity: .55; pointer-events: none; }
.mprio { display: grid; flex: none; color: var(--prio); margin-right: -2px; }
.check.prio-high, .check.prio-med, .check.prio-low { border-color: var(--prio); }
.check.prio-high.on, .check.prio-med.on, .check.prio-low.on { background: var(--prio); border-color: var(--prio); }
.prio-flag { color: var(--prio); display: inline-grid; }
.prio-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding-bottom: 12px; }
.prio-opt {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; border-radius: 10px;
  font-size: calc(12.5px * var(--ts, 1)); font-weight: 550; color: var(--fg-2);
  background: rgba(var(--ink), .05);
  transition: background .2s, box-shadow .25s, color .2s, transform .3s var(--spring);
}
.prio-opt:hover { color: var(--fg); background: rgba(var(--ink), .09); }
.prio-opt:active { transform: scale(.94); }
.prio-opt .prio-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--prio); box-shadow: inset 0 0 0 1.5px rgba(var(--ink), .3); }
.prio-opt.prio-none .prio-dot { background: transparent; }
.prio-opt.on { color: var(--fg); background: rgba(var(--ink), .1); box-shadow: inset 0 0 0 1.5px var(--prio, rgba(var(--ink), .5)); }
.prio-opt.prio-none.on { box-shadow: inset 0 0 0 1.5px rgba(var(--ink), .5); }

/* ---------- Category glyphs in swatches ---------- */
.swatch { display: inline-grid; place-items: center; }
.swatch .icon { opacity: .9; }
.swatch.big { width: 26px; height: 26px; border-radius: 8px; }
.cat-pick .swatch { width: 22px; height: 22px; border-radius: 7px; }

/* ---------- Event card (read-only, like Google Calendar) ---------- */
.event-card {
  position: fixed;
  z-index: 35;
  width: 350px;
  max-height: min(70vh, 520px);
  overflow-y: auto;
  padding: 10px 12px 14px;
  border-radius: 20px;
  transform-origin: var(--ox, 0px) 60px;
  animation: card-in .5s var(--spring) both;
  user-select: text;
  scrollbar-width: none;
}
@keyframes card-in {
  from { opacity: 0; transform: scale(.9) translateY(4px); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: none; }
}
.card-actions { position: relative; display: flex; align-items: center; gap: 2px; margin-bottom: 6px; }
.card-actions .spacer { flex: 1; }
.card-head { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 4px 4px 12px; }
.card-cat { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; margin-top: 2px; }
.card-titles { min-width: 0; }
.card-titles h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: calc(20px * var(--ts, 1)); font-weight: 680; letter-spacing: -.02em; line-height: 1.2;
  word-break: break-word;
}
.card-titles h3.done { text-decoration: line-through; color: var(--fg-3); }
.card-when { font-size: calc(13px * var(--ts, 1)); color: var(--fg-2); }
.card-when.sub { color: var(--fg-3); font-variant-numeric: tabular-nums; margin-top: 2px; }
.card-rows { position: relative; display: flex; flex-direction: column; border-top: 1px solid var(--line); padding-top: 6px; }
.card-row {
  display: flex; align-items: center; gap: 11px;
  min-height: 34px; padding: 4px;
  font-size: calc(13.5px * var(--ts, 1)); color: var(--fg);
  text-align: left;
  animation: rise .4s var(--ease) backwards;
}
.card-row:nth-child(2) { animation-delay: 30ms; }
.card-row:nth-child(3) { animation-delay: 60ms; }
.card-row:nth-child(4) { animation-delay: 90ms; }
.card-row:nth-child(5) { animation-delay: 120ms; }
.card-row:nth-child(6) { animation-delay: 150ms; }
.card-row > .icon { color: var(--fg-3); }
.card-row.notes { align-items: flex-start; }
.card-row.notes p { margin: 0; white-space: pre-wrap; color: var(--fg-2); line-height: 1.5; max-height: 9em; overflow: auto; }
.card-row.task-row { border-radius: 10px; transition: background .2s; }
.card-row.task-row:hover { background: rgba(var(--ink), .06); }
.card-edit {
  position: relative;
  margin-top: 10px; width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; border-radius: 12px;
  background: var(--fg); color: var(--bg);
  font-weight: 650; font-size: calc(13.5px * var(--ts, 1));
  transition: transform .3s var(--spring), filter .2s;
}
.card-edit:hover { filter: brightness(.92); }
.card-edit:active { transform: scale(.97); }
.done-btn {
  height: 30px; padding: 0 14px; border-radius: 10px;
  background: var(--fg); color: var(--bg);
  font-size: calc(13px * var(--ts, 1)); font-weight: 650;
  transition: transform .3s var(--spring), filter .2s;
}
.done-btn:active { transform: scale(.94); }
.insp-card { animation: rise .45s var(--ease) backwards; }
.insp-card:nth-of-type(2) { animation-delay: 40ms; }
.insp-card:nth-of-type(3) { animation-delay: 80ms; }
.insp-card:nth-of-type(4) { animation-delay: 120ms; }
.insp-card:nth-of-type(5) { animation-delay: 160ms; }

/* ---------- Event motion ---------- */
/* Layers only while something moves (one GPU layer per event costs memory and power). */
.ev.lifting, .ev.born, .ev.leaving, .ev.ghost { will-change: transform, opacity; }
.ev:not(.ghost):not(.lifting):not(.selected):hover { transform: translateY(-1px); box-shadow: inset 3px 0 0 var(--c, var(--fg)), 0 8px 22px rgba(0, 0, 0, .22); }
.ev.born { animation: born .6s var(--spring) backwards; }
@keyframes born { from { opacity: 0; transform: scale(.82); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
.ev.leaving, .mv-chip.leaving, .ad-chip.leaving {
  transition: opacity .25s var(--ease), transform .28s var(--ease), filter .25s;
  opacity: 0 !important; transform: scale(.88) !important; filter: blur(3px);
  pointer-events: none;
}
.ev-check { transition: transform .35s var(--spring), background .2s; }
.ev-check.on { animation: pop .4s var(--spring); }

/* ---------- Task motion ---------- */
.task.born { animation: task-born .7s var(--spring) backwards; }
@keyframes task-born {
  0% { opacity: 0; transform: translateY(-8px) scale(.96); background: rgba(var(--ink), .12); }
  60% { opacity: 1; background: rgba(var(--ink), .1); }
  100% { transform: none; background: transparent; }
}
.task-title { background-image: linear-gradient(currentColor, currentColor); background-repeat: no-repeat; background-position: 0 55%; background-size: 0% 1.5px; transition: background-size .38s var(--ease), color .3s; }
.task.completing .task-title { background-size: 100% 1.5px; color: var(--fg-3); }
.task.completing { animation: task-out .64s var(--ease) forwards; }
@keyframes task-out {
  0%, 52% { opacity: 1; max-height: 80px; transform: none; }
  100% { opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; margin: 0; transform: translateX(12px); }
}
.task.leaving { animation: task-leave .26s var(--ease) forwards; }
@keyframes task-leave { to { opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; transform: translateX(-14px) scale(.96); } }
.task { max-height: 140px; overflow: hidden; }
.task-tools { display: flex; gap: 2px; align-items: center; }
.task-flag, .task-x {
  opacity: 0; width: 22px; height: 22px;
  display: grid; place-items: center; border-radius: 7px;
  color: var(--fg-3); pointer-events: none;
  transition: opacity .2s, background .2s, color .2s;
}
.task-flag.prio-high, .task-flag.prio-med, .task-flag.prio-low { opacity: 1; color: var(--prio); pointer-events: auto; }
.task:hover .task-flag, .task:hover .task-x, .task:focus-within .task-flag, .task:focus-within .task-x { opacity: 1; pointer-events: auto; }
.task-flag:hover, .task-x:hover { background: rgba(var(--ink), .1); color: var(--fg); }
@media (hover: none) { .task-flag, .task-x { opacity: .6; pointer-events: auto; } }

/* ---------- Sidebar: categories + footer ---------- */
.sidebar { display: flex; flex-direction: column; }
.sb-scroll { flex: 1; min-height: 0; height: auto; }
.sb-h-link { margin-left: auto; text-transform: none; letter-spacing: 0; font-size: calc(11.5px * var(--ts, 1)); }
.cat-filter { border-top: 1px solid var(--line); margin-top: 14px; }
.cf-list { display: flex; flex-direction: column; gap: 1px; }
.cf-item {
  display: flex; align-items: center; gap: 10px;
  height: 32px; padding: 0 8px;
  border-radius: 10px;
  font-size: calc(13px * var(--ts, 1)); text-align: left;
  transition: background .2s, opacity .3s var(--ease);
}
.cf-item .swatch { width: 18px; height: 18px; border-radius: 6px; transition: transform .35s var(--spring), opacity .3s; }
.cf-item:hover { background: rgba(var(--ink), .055); }
.cf-item:active .swatch { transform: scale(.85); }
.cf-name { flex: 1; }
.cf-eye { color: var(--fg-3); opacity: 0; transition: opacity .2s; }
.cf-item:hover .cf-eye, .cf-item.off .cf-eye { opacity: 1; }
.cf-item.off { opacity: .45; }
.cf-item.off .swatch { transform: scale(.85); opacity: .5; }
.sb-foot {
  position: relative;
  display: flex; align-items: center; gap: 4px;
  padding: 8px 10px 10px;
  border-top: 1px solid var(--line);
  width: var(--sb-w);
}
.sb-settings {
  flex: 1;
  display: flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 10px;
  border-radius: 11px;
  font-size: calc(13.5px * var(--ts, 1)); font-weight: 550; color: var(--fg-2);
  transition: background .2s, color .2s, transform .3s var(--spring);
}
.sb-settings span { flex: 1; text-align: left; }
.sb-settings:hover { background: rgba(var(--ink), .07); color: var(--fg); }
.sb-settings:hover .icon { transform: rotate(60deg); }
.sb-settings .icon { transition: transform .6s var(--spring); }
.sb-settings:active { transform: scale(.97); }

/* ---------- Settings sheet ---------- */
.settings {
  width: min(820px, 100%);
  height: min(640px, 88vh);
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  overflow: hidden;
  animation: sheet-in .55s var(--spring) both;
}
.set-nav {
  position: relative;
  display: flex; flex-direction: column; gap: 2px;
  padding: 18px 10px;
  border-right: 1px solid var(--line);
  background: rgba(var(--ink), .025);
}
.set-nav-title { font-family: var(--font-display); font-size: calc(13px * var(--ts, 1)); font-weight: 650; color: var(--fg-3); padding: 2px 10px 12px; }
.set-tab {
  display: flex; align-items: center; gap: 10px;
  height: 34px; padding: 0 10px;
  border-radius: 10px;
  font-size: calc(13.5px * var(--ts, 1)); font-weight: 500; color: var(--fg-2); text-align: left;
  transition: background .25s var(--ease), color .2s;
}
.set-tab:hover { background: rgba(var(--ink), .06); color: var(--fg); }
.set-tab.on { background: rgba(var(--ink), .11); color: var(--fg); }
.set-tab-ic { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: rgba(var(--ink), .08); }
.set-tab.on .set-tab-ic { background: var(--fg); color: var(--bg); }
.set-main { position: relative; display: flex; flex-direction: column; min-width: 0; }
.set-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 4px 26px; }
.set-head h2 { margin: 0; font-family: var(--font-display); font-size: calc(22px * var(--ts, 1)); font-weight: 680; letter-spacing: -.02em; }
.set-content { flex: 1; overflow-y: auto; padding: 8px 26px 26px; scrollbar-width: none; animation: in-fade .35s var(--ease); user-select: text; }
.set-label { display: flex; align-items: center; gap: 7px; }
.set-desc { font-size: calc(13px * var(--ts, 1)); color: var(--fg-3); margin: 6px 0 14px; }
.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.set-row-title { display: flex; align-items: center; gap: 8px; font-size: calc(14px * var(--ts, 1)); font-weight: 550; }
.set-row-title .icon { color: var(--fg-3); }
.set-row-desc { font-size: calc(12.5px * var(--ts, 1)); color: var(--fg-3); margin-top: 3px; }
.set-row .select-wrap select { min-width: 150px; }
.lang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.lang-opt {
  display: flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 12px;
  border-radius: 11px;
  font-size: calc(13.5px * var(--ts, 1)); text-align: left;
  background: rgba(var(--ink), .045);
  transition: background .2s, box-shadow .25s, transform .3s var(--spring);
}
.lang-opt:hover { background: rgba(var(--ink), .08); }
.lang-opt:active { transform: scale(.97); }
.lang-opt.on { background: rgba(var(--ink), .1); box-shadow: inset 0 0 0 1.5px var(--fg); }
.lang-code { font-size: calc(10.5px * var(--ts, 1)); font-weight: 700; letter-spacing: .04em; color: var(--fg-3); width: 20px; }
.lang-opt.on .lang-code { color: var(--fg); }
.theme-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding-top: 8px; }
.theme-card { display: flex; flex-direction: column; align-items: center; gap: 10px; transition: transform .35s var(--spring); }
.theme-card:active { transform: scale(.96); }
.theme-prev {
  width: 100%; aspect-ratio: 4 / 3;
  border-radius: 14px;
  display: grid; grid-template-columns: 28% 1fr;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--line-2), 0 8px 24px rgba(0, 0, 0, .25);
  transition: box-shadow .3s var(--ease), transform .4s var(--spring);
}
.theme-card:hover .theme-prev { transform: translateY(-2px); }
.theme-card.on .theme-prev { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--fg), 0 10px 28px rgba(0, 0, 0, .3); }
.theme-prev.dark { background: #000; --p: 255, 255, 255; }
.theme-prev.light { background: #fafafa; --p: 0, 0, 0; }
.theme-prev.system { background: linear-gradient(135deg, #fafafa 50%, #000 50%); --p: 128, 128, 128; }
.tp-side { margin: 6px 0 6px 6px; border-radius: 7px; background: rgba(var(--p), .1); }
.tp-main { position: relative; margin: 6px; }
.tp-bar { height: 12%; border-radius: 5px; background: rgba(var(--p), .1); margin-bottom: 8%; }
.tp-ev { position: absolute; border-radius: 4px; }
.tp-ev.a { left: 6%; top: 32%; width: 38%; height: 22%; background: rgba(var(--p), .85); }
.tp-ev.b { left: 52%; top: 48%; width: 38%; height: 30%; box-shadow: inset 0 0 0 1.5px rgba(var(--p), .7); }
.tp-ev.c { left: 6%; top: 64%; width: 38%; height: 18%; background: rgba(var(--p), .3); }
.theme-name { font-size: calc(13px * var(--ts, 1)); font-weight: 550; color: var(--fg-2); }
.theme-card.on .theme-name { color: var(--fg); }
.cat-edit { grid-template-columns: 1fr; }
.cat-edit-row { height: 46px; gap: 12px; transition: opacity .3s; }
.cat-edit-row.hidden { opacity: .5; }
.danger-zone { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.about { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 30px 0; gap: 8px; }
.about-mark {
  width: 84px; height: 84px; border-radius: 22px;
  background: radial-gradient(circle at 50% 50%, transparent 30px, #f5f5f5 31px, #f5f5f5 33px, transparent 34px), linear-gradient(90deg, #f5f5f5 50%, transparent 50%) center / 56px 56px no-repeat, #0c0c0c;
  -webkit-mask: none;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .12);
  position: relative; overflow: hidden;
  animation: born .8s var(--spring) backwards;
}
.about-mark::after { content: ""; position: absolute; inset: 14px; border-radius: 50%; border: 2.5px solid #f5f5f5; }
.about-mark { background: #0c0c0c; }
.about-mark::before { content: ""; position: absolute; left: 14px; top: 14px; width: 28px; height: 56px; border-radius: 28px 0 0 28px; background: #f5f5f5; }
.about-name { font-family: var(--font-display); font-size: calc(26px * var(--ts, 1)); font-weight: 700; letter-spacing: -.02em; margin-top: 8px; }
.about-ver { font-size: calc(12.5px * var(--ts, 1)); color: var(--fg-3); }
.about-text { max-width: 340px; color: var(--fg-2); font-size: calc(14px * var(--ts, 1)); line-height: 1.5; margin: 8px 0 14px; }
@media (max-width: 640px) {
  .settings { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); height: 88vh; }
  .set-nav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px; }
  .set-nav-title { display: none; }
  .set-tab { flex: none; }
  .theme-cards { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .event-card { left: 8px !important; right: 8px; top: auto !important; bottom: 8px; width: auto; }
}

/* ---------- Reminder banner ---------- */
/* A stack: every reminder that fires gets its own banner, newest on top, at most three and a
   "+N" pill for the rest. Only the banners themselves take clicks, not the gaps between them. */
.rem-stack {
  position: fixed; z-index: 80;
  top: 16px; right: 16px;
  width: 340px;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.rem-stack > * { pointer-events: auto; }
/* "Show all" with a long stack: it scrolls rather than running off the window. A scroller
   clips, so it reaches a little past the banners to keep most of their shadow. */
.rem-stack.all {
  max-height: calc(100vh - 88px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
  width: 368px; padding: 4px 14px 24px; margin: -4px -14px -24px;
}
.rem-stack.all::-webkit-scrollbar { display: none; }
.rem-more {
  align-self: flex-end;
  height: 30px; padding: 0 14px;
  border-radius: 99px;
  font-size: calc(12.5px * var(--ts, 1)); font-weight: 600; color: var(--fg-2);
  animation: rem-in .6s var(--spring) both;
  transition: color .2s, transform .25s var(--spring);
}
.rem-more:hover { color: var(--fg); }
.rem-more:active { transform: scale(.96); }
.reminder {
  flex: none;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 10px 12px 14px;
  border-radius: 18px;
  cursor: pointer;
  animation: rem-in .6s var(--spring) both;
}
@keyframes rem-in { from { opacity: 0; transform: translateY(-14px) scale(.96); } to { opacity: 1; transform: none; } }
.rem-ic { position: relative; width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--fg); color: var(--bg); animation: rem-ring 1.2s var(--ease) .2s 2; }
/* The bell wiggles. (Its own name: the live dots' `ring` pulse further down would otherwise
   replace it and blow each tile up over the banners next to it.) */
@keyframes rem-ring { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(14deg); } 30% { transform: rotate(-12deg); } 45% { transform: rotate(8deg); } 60% { transform: rotate(-4deg); } }
.rem-text { position: relative; flex: 1; min-width: 0; }
.rem-title { font-weight: 650; font-size: calc(14px * var(--ts, 1)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rem-when { font-size: calc(12.5px * var(--ts, 1)); color: var(--fg-3); margin-top: 2px; }

/* ---------- More micro-motion ---------- */
.mv-cell { animation: in-fade .45s var(--ease) backwards; }
.mini-day.today { animation: born .6s var(--spring) backwards; }
.pal-item:nth-child(2) { animation-delay: 20ms; }
.pal-item:nth-child(3) { animation-delay: 40ms; }
.pal-row:nth-child(n+2) .pal-item { animation-delay: calc(min(8, var(--k, 1)) * 18ms); }
.icon-btn .icon { transition: transform .4s var(--spring); }
.icon-btn:hover .icon { transform: scale(1.08); }
.toast { gap: 10px; }

.now-line.faint { border-top: 1px dashed rgba(var(--ink), .28); box-shadow: none; }

/* ---------- Review fixes (round 2) ---------- */
/* Darker, legible priority colours on light backgrounds. */
:root[data-theme="light"] { --prio-high: #d93b41; --prio-med: #b7791f; --prio-low: #1e9a62; }
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] { --prio-high: #d93b41; --prio-med: #b7791f; --prio-low: #1e9a62; }
}
/* No colour transitions inside the circular theme reveal: it should show the final colours crisply. */
html.vt-theme, html.vt-theme *, html.vt-theme *::before, html.vt-theme *::after { transition: none !important; }
/* Reminder banners sit under the toolbar, never over its buttons. */
.rem-stack { top: 80px; }
html.mac .rem-stack { top: 82px; }
/* Phone: along the bottom edge, full width, rising into place. */
@media (max-width: 640px) {
  .rem-stack, .rem-stack.all { top: auto; bottom: 16px; left: 16px; right: 16px; width: auto; }
  .rem-stack .reminder, .rem-more { animation-name: rem-in-up; }
  .rem-more { align-self: center; }
}
@keyframes rem-in-up { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
/* Equal segments that never overflow. */
.segmented { grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
.seg { overflow: hidden; text-overflow: ellipsis; }
.segmented.small .seg { padding: 0 6px; }
/* Keep text clear of the priority dot and category glyph. */
.ev:has(.ev-prio) .ev-title { padding-right: 10px; }
.ev:has(.ev-cat-ic) .ev-loc, .ev:has(.ev-cat-ic) .ev-time { padding-right: 14px; }
.set-row.inset { border-top: 0; padding-top: 0; }

/* ==========================================================================
   Palettes — picker in Settings → Appearance
   ========================================================================== */
.pal-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; padding-top: 8px; }
.pal-card { display: flex; flex-direction: column; gap: 9px; text-align: left; transition: transform .35s var(--spring); }
.pal-card:active { transform: scale(.96); }
.pal-prev {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 14px;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 0%, var(--blob1), transparent 60%),
    radial-gradient(circle at 100% 100%, var(--blob2), transparent 55%),
    var(--bg);
  box-shadow: 0 0 0 1px var(--line-2), 0 8px 24px rgba(0, 0, 0, .2);
  transition: box-shadow .3s var(--ease), transform .4s var(--spring);
}
.pal-card:hover .pal-prev { transform: translateY(-2px); }
/* The preview re-scopes --fg/--bg to its palette; the ring uses the sheet's colour via currentColor. */
.pal-card { color: var(--fg); }
.pal-prev { outline: 2px solid transparent; outline-offset: 3px; transition: box-shadow .3s var(--ease), transform .4s var(--spring), outline-color .3s var(--ease); }
.pal-card.on .pal-prev { outline-color: currentColor; }
.pp-bar {
  position: absolute; left: 5%; right: 5%; top: 7%; height: 16%;
  border-radius: 6px;
  background: var(--glass-tint);
  box-shadow: inset 0 0 0 .5px rgba(var(--ink), .1);
  display: flex; align-items: center; justify-content: space-between; padding: 0 5%;
}
.pp-today { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.pp-plus { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.pp-ev {
  position: absolute; width: 28%;
  border-radius: 4px;
  background: color-mix(in oklab, var(--c) var(--ev-a), var(--ev-base));
  box-shadow: inset 2.5px 0 0 var(--c);
}
.pp-now { position: absolute; left: 4%; width: 33%; top: 61%; border-top: 1.5px solid var(--now); }
.pp-now::before { content: ""; position: absolute; left: -3px; top: -4px; width: 6px; height: 6px; border-radius: 50%; background: var(--now); }
.pal-text { display: flex; flex-direction: column; gap: 2px; padding: 0 2px; }
.pal-name { font-size: calc(13px * var(--ts, 1)); font-weight: 600; color: var(--fg-2); }
.pal-card.on .pal-name { color: var(--fg); }
.pal-desc { font-size: calc(11.5px * var(--ts, 1)); line-height: 1.3; color: var(--fg-3); }

/* ==========================================================================
   Calendars — sidebar header actions
   ========================================================================== */
.sb-h .spacer { flex: 1; }
.sb-h-link { margin-left: 0; }
.icon-btn.tiny { width: 24px; height: 24px; border-radius: 8px; color: var(--fg-3); }
.icon-btn.tiny:hover { color: var(--fg); background: rgba(var(--ink), .08); }

/* ---------- Calendars in Settings ---------- */
.cal-edit { display: flex; flex-direction: column; gap: 6px; }
.cal-row { border-radius: 13px; background: rgba(var(--ink), .045); transition: opacity .3s, background .25s var(--ease); }
.cal-row.hidden { opacity: .55; }
.cal-row-main { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 8px 0 10px; }
.cal-row-main .swatch { flex: none; transition: transform .35s var(--spring); }
.cal-row-main .swatch:active { transform: scale(.88); }
.cal-row-main input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: calc(14px * var(--ts, 1)); font-weight: 500; }
.cal-row-main input::placeholder { color: var(--fg); opacity: .8; }
.icon-btn.chev .icon { transition: transform .35s var(--spring); }
.icon-btn.chev.open .icon { transform: rotate(180deg); }
.cal-details {
  display: flex; flex-direction: column; gap: 12px;
  padding: 4px 12px 14px 48px;
  animation: rise .35s var(--ease) backwards;
}
.cal-colors { display: flex; flex-wrap: wrap; gap: 8px; }
.cal-color {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(var(--ink), .12);
  transition: transform .3s var(--spring), box-shadow .25s var(--ease);
}
.cal-color:hover { transform: scale(1.12); }
.cal-color.on { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--c); }
.cal-icons { display: grid; grid-template-columns: repeat(8, 32px); gap: 6px; }
.cal-icon {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center;
  color: var(--fg-2);
  background: rgba(var(--ink), .05);
  transition: background .2s, color .2s, transform .3s var(--spring);
}
.cal-icon:hover { color: var(--fg); background: rgba(var(--ink), .1); }
.cal-icon:active { transform: scale(.9); }
.cal-icon.on { background: color-mix(in srgb, var(--c) 24%, transparent); color: color-mix(in srgb, var(--c) 65%, var(--fg)); box-shadow: inset 0 0 0 1.5px var(--c); }
.cal-detail-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.cal-actions { margin-top: 12px; }

/* ---------- Import sheet ---------- */
.import-sheet {
  width: min(620px, 100%);
  max-height: min(680px, 88vh);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: sheet-in .55s var(--spring) both;
}
.import-sheet .set-head { padding: 18px 18px 6px 24px; }
.import-body { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 24px 12px; display: flex; flex-direction: column; gap: 10px; }
.drop-zone {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 220px; padding: 26px;
  text-align: center;
  border-radius: 18px;
  border: 1.5px dashed rgba(var(--ink), .22);
  background: rgba(var(--ink), .03);
  cursor: pointer;
  transition: background .25s var(--ease), border-color .25s var(--ease), transform .35s var(--spring);
}
.drop-zone:hover { background: rgba(var(--ink), .06); border-color: var(--primary); }
.drop-zone:active { transform: scale(.985); }
.drop-ic { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; color: var(--on-primary); background: var(--primary); margin-bottom: 4px; }
.drop-title { font-size: calc(15px * var(--ts, 1)); font-weight: 650; }
.drop-hint { font-size: calc(12.5px * var(--ts, 1)); line-height: 1.45; color: var(--fg-3); max-width: 400px; }
.import-rows { display: flex; flex-direction: column; gap: 6px; }
.import-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 8px 10px 12px;
  border-radius: 14px;
  background: rgba(var(--ink), .045);
  animation: rise .4s var(--ease) backwards;
  transition: opacity .25s;
}
.import-row.skipped { opacity: .5; }
.import-row .swatch { flex: none; }
.import-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.import-name { font-size: calc(13.5px * var(--ts, 1)); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.import-meta { font-size: calc(11.5px * var(--ts, 1)); color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.import-target { display: flex; align-items: center; gap: 6px; flex: none; max-width: 46%; }
.import-into { font-size: calc(11.5px * var(--ts, 1)); color: var(--fg-3); }
.import-target select {
  min-width: 0; max-width: 220px;
  height: 30px; padding: 0 8px;
  border-radius: 9px; border: 0;
  background: rgba(var(--ink), .08);
  font-size: calc(12.5px * var(--ts, 1));
}
.import-more { position: relative; align-self: flex-start; }
.import-err { display: flex; align-items: flex-start; gap: 8px; font-size: calc(12px * var(--ts, 1)); color: var(--fg-2); padding: 2px 4px; }
.import-err .icon { flex: none; margin-top: 1px; color: var(--now); }
.import-foot { display: flex; align-items: center; gap: 8px; padding: 12px 18px 16px 24px; border-top: 1px solid var(--line); }
.import-sum { flex: 1; font-size: calc(12px * var(--ts, 1)); color: var(--fg-3); }
.primary-btn {
  height: 34px; padding: 0 16px;
  border-radius: 11px;
  font-weight: 600; font-size: calc(13px * var(--ts, 1));
  background: var(--primary); color: var(--on-primary);
  transition: filter .2s, transform .3s var(--spring), opacity .2s;
}
.primary-btn:hover { filter: brightness(1.08); }
.primary-btn:active { transform: scale(.96); }
.primary-btn:disabled { opacity: .4; pointer-events: none; }
@media (max-width: 560px) {
  .import-row { flex-wrap: wrap; }
  .import-target { max-width: 100%; width: 100%; padding-left: 38px; }
  .import-target select { flex: 1; max-width: none; }
}

/* ---------- Drop files anywhere ---------- */
.drop-overlay {
  position: fixed; inset: 10px; z-index: 80;
  display: grid; place-items: center;
  border-radius: var(--radius);
  border: 2px dashed var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, var(--scrim));
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
  animation: fade-in .25s var(--ease) both;
}
.drop-overlay-card { display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: calc(16px * var(--ts, 1)); font-weight: 650; }
@keyframes fade-in { from { opacity: 0; } }

/* ==========================================================================
   Round 4 — readability, hierarchy, personality
   ========================================================================== */

/* ---------- Type: a little larger and firmer where it whispered ---------- */
.hour-label { font-size: calc(11px * var(--ts, 1)); }
.tg-hd .wd { color: var(--fg-2); }
.mini-wd { color: var(--fg-3); }
.ad-label { font-size: calc(10.5px * var(--ts, 1)); color: var(--fg-3); }
.ev { font-size: calc(12.5px * var(--ts, 1)); }
.ev-time, .ev-loc { font-size: calc(11.5px * var(--ts, 1)); opacity: .8; }
.ev.tiny .ev-title { font-size: calc(11.5px * var(--ts, 1)); }
.mv-chip { font-size: calc(12.5px * var(--ts, 1)); }
.mv-num { font-size: calc(13.5px * var(--ts, 1)); }
.sb-h { font-size: calc(11.5px * var(--ts, 1)); }
.tb-sub { color: var(--fg-3); font-size: calc(12.5px * var(--ts, 1)); font-variant-numeric: tabular-nums; }

/* ---------- Today reads as today; weekends stay neutral ---------- */
.tg-col.today { background-color: color-mix(in srgb, var(--accent) 5%, transparent); }
.mv-cell.today { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.mv-cell.today:hover { background: color-mix(in srgb, var(--accent) 9%, transparent); }
/* Night hours recede so the working day is the stage. */
.work-hours {
  display: block;
  position: absolute; inset: 0;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(var(--ink), .03) 0 calc(var(--hour) * 7),
    transparent calc(var(--hour) * 7) calc(var(--hour) * 21),
    rgba(var(--ink), .03) calc(var(--hour) * 21)
  );
}
/* The part of today that is already behind. */
.past-shade { position: absolute; left: 0; right: 0; top: 0; pointer-events: none; background: rgba(var(--ink), .02); }

.brand { padding-bottom: 12px; }

/* ---------- Today hero ---------- */
.hero {
  display: flex; flex-direction: column; gap: 10px;
  margin: 0 2px 12px;
  padding: 14px 14px 12px;
  border-radius: 18px;
  background:
    linear-gradient(140deg, color-mix(in srgb, var(--primary) 15%, transparent), color-mix(in srgb, var(--accent) 8%, transparent) 75%),
    rgba(var(--ink), .035);
  box-shadow: inset 0 0 0 1px rgba(var(--ink), .07);
  animation: rise .5s var(--ease) backwards;
}
.hero-top { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; }
.hero-greet { font-size: calc(12.5px * var(--ts, 1)); font-weight: 500; color: var(--fg-2); }
.hero-date { font-family: var(--font-display); font-size: calc(19px * var(--ts, 1)); font-weight: 700; letter-spacing: -.02em; line-height: 1.18; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hero-chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 9px;
  border-radius: 99px;
  font-size: calc(12px * var(--ts, 1)); font-weight: 550;
  color: var(--fg-2);
  background: rgba(var(--ink), .08);
}
.hero-focus {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-width: 0;
  padding: 9px 11px 9px 13px;
  border-radius: 12px;
  text-align: left;
  background: color-mix(in oklab, var(--c, var(--fg)) var(--ev-a), var(--ev-base));
  color: var(--ct, var(--fg));
  box-shadow: inset 3px 0 0 var(--c, var(--fg));
  transition: transform .3s var(--spring), filter .2s;
}
.hero-focus:hover { filter: brightness(1.08); }
.hero-focus:active { transform: scale(.98); }
.hero-focus-label { display: flex; align-items: center; gap: 6px; font-size: calc(11.5px * var(--ts, 1)); font-weight: 600; opacity: .82; font-variant-numeric: tabular-nums; }
.hero-focus-title { max-width: 100%; font-size: calc(14px * var(--ts, 1)); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-dot { position: relative; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.hero-free { font-size: calc(12.5px * var(--ts, 1)); color: var(--fg-3); }

/* ---------- Up next: tappable rows with the calendar colour ---------- */
.un-item {
  width: 100%;
  align-items: center; gap: 9px;
  padding: 6px;
  border-radius: 9px;
  text-align: left;
  transition: background .2s var(--ease);
}
.un-item:hover { background: rgba(var(--ink), .06); }
.un-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--c, var(--fg-3)); }
.un-title { flex: 1; min-width: 0; }
.un-time { min-width: 0; }

/* ---------- Getting started ---------- */
.tips {
  display: flex; flex-direction: column; gap: 8px;
  margin: 0 2px 12px;
  padding: 12px 12px 10px;
  border-radius: 16px;
  background: rgba(var(--ink), .045);
  box-shadow: inset 0 0 0 1px rgba(var(--ink), .06);
  animation: rise .5s var(--ease) .1s backwards;
}
.tips-h { display: flex; align-items: center; gap: 7px; font-size: calc(12.5px * var(--ts, 1)); font-weight: 650; }
.tips-h .icon { color: var(--primary); }
.gs-tip { display: flex; gap: 9px; font-size: calc(12px * var(--ts, 1)); line-height: 1.4; color: var(--fg-2); }
.tip-ic { flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 6px; display: grid; place-items: center; background: rgba(var(--ink), .07); }
.tips-done {
  align-self: flex-end;
  height: 26px; padding: 0 12px;
  border-radius: 99px;
  font-size: calc(12px * var(--ts, 1)); font-weight: 600;
  background: var(--primary); color: var(--on-primary);
  transition: transform .3s var(--spring), filter .2s;
}
.tips-done:hover { filter: brightness(1.08); }
.tips-done:active { transform: scale(.95); }

/* ---------- "+" menu ---------- */
.plus-wrap { position: relative; display: grid; }
.icon-btn.primary .icon { transition: transform .35s var(--spring); }
.icon-btn.primary.open .icon { transform: rotate(45deg); }
/* The toolbar's backdrop-filter makes it the containing block of fixed children: overshoot. */
.menu-scrim { position: fixed; inset: -200vh -200vw; z-index: 70; }
.plus-menu {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 71;
  min-width: 230px;
  padding: 6px;
  border-radius: 16px;
  display: flex; flex-direction: column; gap: 1px;
  /* Nested backdrop filters do not blur what is behind the toolbar: use a near-solid surface. */
  background: color-mix(in srgb, var(--bg) 88%, rgb(var(--ink)) 12%);
  transform-origin: top right;
  animation: menu-in .28s var(--spring) both;
}
@keyframes menu-in { from { opacity: 0; transform: scale(.92) translateY(-6px); } }
.menu-item {
  display: flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 10px 0 8px;
  border-radius: 10px;
  font-size: calc(13.5px * var(--ts, 1)); text-align: left; white-space: nowrap;
  transition: background .15s;
}
.menu-item:hover { background: rgba(var(--ink), .08); }
.menu-item:active { background: rgba(var(--ink), .12); }
.menu-ic { width: 24px; height: 24px; flex: none; border-radius: 7px; display: grid; place-items: center; color: var(--fg-2); background: rgba(var(--ink), .07); }
.menu-label { flex: 1; }
.menu-sep { height: 1px; margin: 4px 8px; background: var(--line); }

/* ---------- Empty grid: a quiet nudge ---------- */
.tg { position: relative; }
.tg-hint {
  position: absolute; left: 50%; bottom: 26px; z-index: 5;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  max-width: 80%;
  padding: 10px 18px;
  border-radius: 14px;
  text-align: center;
  pointer-events: none;
  background: var(--glass-tint);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: inset 0 0 0 1px rgba(var(--ink), .08), 0 8px 24px rgba(0, 0, 0, .16);
  animation: hint-in .5s var(--ease) .35s backwards;
}
@keyframes hint-in { from { opacity: 0; transform: translateX(-50%) translateY(8px); } }
.tg-hint-title { font-size: calc(13.5px * var(--ts, 1)); font-weight: 650; }
.tg-hint-text { font-size: calc(12px * var(--ts, 1)); color: var(--fg-3); }

/* ---------- Settings text field ---------- */
.set-input {
  width: 190px; height: 34px; padding: 0 12px;
  border: 0; outline: 0; border-radius: 10px;
  background: rgba(var(--ink), .07);
  font-size: calc(13.5px * var(--ts, 1));
  transition: box-shadow .2s var(--ease), background .2s;
}
.set-input:focus { background: rgba(var(--ink), .09); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 55%, transparent); }

/* ==========================================================================
   Round 5 — settings redesign, import flavours, foldable sidebar
   ========================================================================== */

/* ---------- Fixed tints for setting icons (like System Settings) ---------- */
.t-grey   { --tint: #8E8E93; }
.t-blue   { --tint: #0A84FF; }
.t-red    { --tint: #FF453A; }
.t-orange { --tint: #FF9F0A; }
.t-green  { --tint: #30D158; }
.t-indigo { --tint: #5E5CE6; }
.t-pink   { --tint: #FF375F; }
.t-teal   { --tint: #30B0C7; }
.t-yellow { --tint: #E8B200; }
.t-purple { --tint: #AF52DE; }
.t-brown  { --tint: #A2845E; }

/* ---------- Settings sheet ---------- */
.set-nav { padding: 18px 10px; gap: 1px; }
.set-nav-title { padding: 2px 10px 14px; font-size: calc(15px * var(--ts, 1)); color: var(--fg); }
.set-tab { height: 36px; gap: 10px; font-size: calc(13.5px * var(--ts, 1)); }
.set-tab-ic, .set-tab.on .set-tab-ic {
  width: 24px; height: 24px; border-radius: 7px;
  color: #fff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tint) 88%, #fff), var(--tint));
  box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .12), 0 1px 2px rgba(0, 0, 0, .15);
}
.set-tab.on { background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--fg); }
.set-head { justify-content: flex-start; gap: 12px; padding: 20px 18px 8px 28px; }
.set-head h2 { flex: 1; font-size: calc(21px * var(--ts, 1)); }
.set-head-ic {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tint) 88%, #fff), var(--tint));
  box-shadow: 0 2px 6px color-mix(in srgb, var(--tint) 40%, transparent);
}
.set-content { padding: 6px 28px 28px; }
.set-desc { margin: 2px 2px 12px; }

.set-section-title { margin: 18px 4px 7px; font-size: calc(12.5px * var(--ts, 1)); font-weight: 650; color: var(--fg-2); }
.set-section-title:first-child { margin-top: 4px; }
.set-section-title.danger { color: var(--now); }
.set-card {
  margin-bottom: 12px;
  border-radius: 14px;
  background: rgba(var(--ink), .045);
  box-shadow: inset 0 0 0 1px rgba(var(--ink), .055);
  overflow: hidden;
}
.set-card.pad { padding: 12px; }
.set-card.danger { background: color-mix(in srgb, var(--now) 7%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--now) 22%, transparent); }

.srow { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 9px 14px; }
.srow + .srow { box-shadow: inset 0 1px 0 rgba(var(--ink), .06); }
.srow.inset { padding-left: 54px; min-height: 0; padding-top: 0; box-shadow: none; }
.srow-ic {
  width: 28px; height: 28px; flex: none; border-radius: 8px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tint) 88%, #fff), var(--tint));
  box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .1);
}
.srow-ic.big { width: 38px; height: 38px; border-radius: 11px; }
.srow-text { flex: 1; min-width: 0; }
.srow-title { font-size: calc(14px * var(--ts, 1)); font-weight: 550; }
.srow-desc { font-size: calc(12px * var(--ts, 1)); line-height: 1.35; color: var(--fg-3); margin-top: 2px; }
.srow-ctl { flex: none; display: flex; align-items: center; gap: 8px; }
.srow-ctl .segmented { min-width: 180px; }
.srow .select-wrap select { min-width: 160px; }
.srow .ghost-btn { white-space: nowrap; }
.set-card .lang-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.set-card .theme-cards { padding-top: 0; }
@media (max-width: 640px) {
  .srow { flex-wrap: wrap; }
  .srow-ctl { width: 100%; padding-left: 40px; }
  .srow-ctl .segmented { flex: 1; }
  /* A lone switch stays on its row, at the right (wide controls go under the title). */
  .srow-ctl:has(> .switch:only-child) { width: auto; padding-left: 0; }
}

/* ---------- Palette: Glass large, the rest behind "More palettes" ---------- */
.pal-hero {
  position: relative;
  width: 100%;
  display: grid; grid-template-columns: minmax(150px, 220px) 1fr; align-items: center; gap: 16px;
  padding: 10px; border-radius: 14px; text-align: left;
  color: var(--fg);
  transition: background .2s, transform .3s var(--spring);
}
.pal-hero:hover { background: rgba(var(--ink), .05); }
.pal-hero:active { transform: scale(.99); }
.pal-hero .pal-prev { outline-offset: 3px; }
.pal-hero.on .pal-prev { outline-color: var(--primary); }
.pal-hero-text { display: flex; flex-direction: column; gap: 4px; }
.pal-hero .pal-name { display: flex; align-items: center; gap: 8px; font-size: calc(16px * var(--ts, 1)); font-weight: 650; color: var(--fg); }
.pal-hero .pal-desc { font-size: calc(12.5px * var(--ts, 1)); }
.pal-tag { padding: 2px 8px; border-radius: 99px; font-size: calc(11px * var(--ts, 1)); font-weight: 600; color: var(--primary); background: color-mix(in srgb, var(--primary) 14%, transparent); }
.pal-check {
  position: absolute; top: 14px; right: 14px;
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--on-primary); background: var(--primary);
  opacity: 0; transform: scale(.6);
  transition: opacity .25s, transform .35s var(--spring);
}
.pal-hero.on .pal-check { opacity: 1; transform: none; }
.pal-card.on .pal-prev { outline-color: var(--primary); }
.more-btn {
  display: flex; align-items: center; gap: 6px;
  margin: 8px 4px 0; height: 30px; padding: 0 6px;
  border-radius: 8px;
  font-size: calc(13px * var(--ts, 1)); font-weight: 600; color: var(--fg-2);
  transition: color .2s, background .2s;
}
.more-btn:hover { color: var(--fg); background: rgba(var(--ink), .06); }
.more-btn .icon { transition: transform .35s var(--spring); }
.more-btn.open .icon { transform: rotate(180deg); }
.set-card .pal-cards { padding: 10px 2px 2px; }

/* ---------- Data ---------- */
.data-stats {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; margin-bottom: 4px;
  border-radius: 14px;
  background: color-mix(in srgb, #30D158 9%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #30D158 22%, transparent);
}
.data-stats-main { font-size: calc(13.5px * var(--ts, 1)); font-weight: 600; font-variant-numeric: tabular-nums; }
.data-stats-sub { font-size: calc(12px * var(--ts, 1)); color: var(--fg-3); margin-top: 1px; }
.import-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 4px; }
.import-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 14px; border-radius: 14px; text-align: left;
  background: rgba(var(--ink), .045);
  box-shadow: inset 0 0 0 1px rgba(var(--ink), .055);
  transition: background .2s, transform .3s var(--spring), box-shadow .2s;
}
.import-tile:hover { background: rgba(var(--ink), .075); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 45%, transparent); }
.import-tile:active { transform: scale(.98); }
.import-tile.off { opacity: .6; }
.tile-title { margin-top: 4px; font-size: calc(14px * var(--ts, 1)); font-weight: 650; }
.tile-desc { font-size: calc(12px * var(--ts, 1)); line-height: 1.4; color: var(--fg-3); }
@media (max-width: 640px) { .import-tiles { grid-template-columns: 1fr; } }
.ghost-btn.danger { color: var(--now); background: color-mix(in srgb, var(--now) 10%, transparent); }
.ghost-btn.danger:hover { color: var(--now); background: color-mix(in srgb, var(--now) 16%, transparent); }
.ghost-btn.danger.armed { color: #fff; background: var(--now); }

/* ---------- About ---------- */
.about-mark { background: none; }

/* ---------- Import sheet ---------- */
.imp-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 18px 10px 24px; }
.imp-head-ic {
  width: 36px; height: 36px; flex: none; border-radius: 10px;
  display: grid; place-items: center;
  color: var(--on-primary); background: var(--primary);
  box-shadow: 0 3px 10px color-mix(in srgb, var(--primary) 35%, transparent);
}
.imp-head-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.imp-head-text h2 { margin: 0; font-family: var(--font-display); font-size: calc(19px * var(--ts, 1)); font-weight: 680; letter-spacing: -.02em; }
.imp-head-text span { font-size: calc(12px * var(--ts, 1)); line-height: 1.4; color: var(--fg-3); }
.imp-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  font-size: calc(13px * var(--ts, 1)); font-weight: 550;
  background: color-mix(in srgb, #FF9F0A 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #FF9F0A 30%, transparent);
}
.imp-banner span { flex: 1; }
.imp-section { display: flex; flex-direction: column; gap: 8px; }
.imp-label { font-size: calc(12.5px * var(--ts, 1)); font-weight: 650; color: var(--fg-2); padding: 4px 2px 0; }
.imp-file-ic { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; color: var(--fg-2); background: rgba(var(--ink), .08); }
.import-row .swatch { display: none; }
.cal-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.cal-choice {
  display: flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 8px 10px;
  border-radius: 12px; text-align: left;
  background: rgba(var(--ink), .045);
  box-shadow: inset 0 0 0 1px rgba(var(--ink), .06);
  cursor: pointer;
  transition: background .2s, box-shadow .2s, transform .3s var(--spring);
}
.cal-choice:hover { background: rgba(var(--ink), .075); }
.cal-choice:active { transform: scale(.98); }
.cal-choice.on {
  background: color-mix(in srgb, var(--c, var(--primary)) 16%, transparent);
  box-shadow: inset 0 0 0 2px var(--c, var(--primary));
}
.cal-choice .swatch { flex: none; }
.cal-choice-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cal-choice-name { font-size: calc(13.5px * var(--ts, 1)); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-choice-sub { font-size: calc(11.5px * var(--ts, 1)); color: var(--fg-3); }
.cal-choice.new.on { grid-column: 1 / -1; }
.cal-choice-input {
  width: 100%; height: 28px; margin-top: 4px; padding: 0 9px;
  border: 0; outline: 0; border-radius: 8px;
  font-size: calc(13px * var(--ts, 1));
  background: rgba(var(--ink), .08);
}
.cal-choice-input:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--c, var(--primary)) 60%, transparent); }
.import-sum.wait { color: var(--now); font-weight: 550; }
.primary-btn.small { height: 28px; padding: 0 12px; font-size: calc(12.5px * var(--ts, 1)); border-radius: 9px; }
.primary-btn { display: inline-flex; align-items: center; gap: 7px; }
.import-sheet { width: min(660px, 100%); }

/* ---------- Foldable sidebar sections ---------- */
.fold { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .42s var(--ease), opacity .3s var(--ease); }
.fold.shut { grid-template-rows: 0fr; opacity: 0; }
.fold-inner { min-height: 0; overflow: hidden; }
.fold.shut .fold-inner { pointer-events: none; }
.fold-title {
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: -4px; padding: 2px 6px 2px 4px;
  border-radius: 7px;
  font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit;
  transition: color .2s, background .2s;
}
.fold-title:hover { color: var(--fg); background: rgba(var(--ink), .06); }
.fold-chev { display: grid; transition: transform .35s var(--spring); }
.fold-title.shut .fold-chev { transform: rotate(-90deg); }
.mini-title.fold-title { margin-left: 0; font-size: calc(13.5px * var(--ts, 1)); font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--fg); }
.sb-section:has(> .fold.shut) { padding-bottom: 0; }
.mini:has(.fold.shut) .mini-nav { opacity: 0; pointer-events: none; }
.mini-nav { transition: opacity .25s; }

/* ---------- Brand mark = the app icon ("Light Glass Now") in miniature ---------- */
.brand-mark {
  position: relative;
  display: block;
  width: 20px; height: 20px; padding: 0;
  border: 0; border-radius: 6px;
  background: linear-gradient(160deg, #FFFFFF 0%, #F3F4F8 60%, #E7E6F7 100%);
  box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .14), 0 1px 3px rgba(0, 0, 0, .18);
}
.brand-mark span { position: absolute; display: block; width: auto; }
.brand-mark span:nth-child(1) {
  left: 28%; top: 25%; width: 52%; height: 50%;
  border-radius: 18%;
  background: #B8DBFF;
  box-shadow: inset 2px 0 0 #0088FF;
}
.brand-mark span:nth-child(2) { left: 14%; right: 18%; top: 48%; height: 1.5px; border-radius: 1px; background: #FF383C; }
.brand-mark span:nth-child(3) { left: 8%; top: 41%; width: 4px; height: 4px; border-radius: 50%; background: #FF383C; }
.brand-mark.big {
  width: 88px; height: 88px; border-radius: 22px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08), 0 10px 30px rgba(0, 0, 0, .28);
}
.brand-mark.big span:nth-child(1) { border-radius: 16%; box-shadow: inset 8px 0 0 #0088FF, 0 4px 12px rgba(0, 136, 255, .2); }
.brand-mark.big span:nth-child(2) { height: 4px; border-radius: 2px; box-shadow: 0 0 8px rgba(255, 56, 60, .5); }
.brand-mark.big span:nth-child(3) { width: 14px; height: 14px; top: 41%; left: 7%; box-shadow: 0 0 0 2.5px #fff; }

/* ---------- Round 5 fixes ---------- */
.import-note { display: flex; align-items: flex-start; gap: 8px; padding: 2px 4px; font-size: calc(12px * var(--ts, 1)); line-height: 1.4; color: var(--fg-2); }
.import-note .icon { flex: none; margin-top: 1px; color: #FF9F0A; }
/* Settings rows: the control may shrink, the title keeps room, a wide control wraps below. */
.srow { flex-wrap: wrap; }
.srow-text { flex: 1 1 140px; }
/* A lone switch always fits beside its title (the title wraps instead). */
.srow:has(> .srow-ctl > .switch:only-child) > .srow-text { flex-basis: 0; }
.srow-ctl { flex: 0 1 auto; min-width: 0; max-width: 100%; margin-left: auto; }
.srow-ctl .segmented { min-width: 0; }
/* Folded content leaves the tab order once the fold has closed. */
.fold .fold-inner { visibility: visible; transition: visibility 0s; }
.fold.shut .fold-inner { visibility: hidden; transition: visibility 0s .42s; }
.mini:has(.fold.shut) .mini-nav { visibility: hidden; }
/* Room for the selection ring of palette previews inside the fold. */
.set-card .pal-cards { padding: 10px 6px 6px; }
/* Sidebar header: "Show all" stays on one line, the title gives way. */
.sb-h-link { white-space: nowrap; flex: none; }
.sb-h .fold-title { min-width: 0; }
.sb-h .fold-title > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.other-cals .sb-h { gap: 2px; }
.other-cals .sb-h .fold-title > span:nth-child(2) { white-space: normal; line-height: 1.25; text-align: left; }
@media (max-width: 640px) {
  .pal-hero { grid-template-columns: 1fr; }
  .pal-hero .pal-prev { max-width: 240px; }
  .pal-hero .pal-name { flex-wrap: wrap; }
  .pal-hero-text { min-width: 0; padding-right: 28px; }
}

/* ==========================================================================
   Round 6 — polish
   ========================================================================== */
/* Sidebar: one hairline between sections, whatever is shown or folded. */
.mini { border-bottom: 0; }
.upnext { border-bottom: 0; padding-bottom: 4px; }
.cat-filter { margin-top: 10px; }
.upnext, .tasks, .cat-filter { border-top: 1px solid var(--line); margin-top: 10px; }
.mini + .sb-section { margin-top: 6px; }
/* Wordmark only — no logo next to it. */
.brand { padding: 2px 8px 14px; }
.brand-name { font-size: calc(18px * var(--ts, 1)); font-weight: 720; letter-spacing: -.025em; }
/* Desktop: the traffic lights live inside the sidebar glass; "Mono" sits right after them. */
/* The wordmark shares one line with the traffic lights (centre 39pt from the window top,
   like the toolbar's centre; see TL_CENTER_Y in desktop.rs). */
html.mac .brand { padding: 5px 8px 14px 70px; min-height: 14px; }
html.mac .brand-name { font-size: calc(15px * var(--ts, 1)); line-height: 14px; color: var(--fg-2); }
html.mac .app.no-sidebar .toolbar { padding-left: 84px; }
/* Settings: the content column scrolls (the grid row must be allowed to shrink). */
.settings { grid-template-rows: minmax(0, 1fr); }
.set-main { min-height: 0; }
/* Phones: the tabs sit in their own row above the page (this must come after the rule above). */
@media (max-width: 640px) { .settings { grid-template-rows: auto minmax(0, 1fr); } }

/* ---------- Calendars list (like Google: a coloured checkbox per calendar, ⋯ menu) ---------- */
.cf-item { position: relative; display: flex; align-items: center; gap: 0; height: 32px; padding: 0; border-radius: 9px; opacity: 1; }
.cf-item:hover { background: rgba(var(--ink), .055); }
.cf-item.off { opacity: 1; }
.cf-main { flex: 1; min-width: 0; height: 100%; display: flex; align-items: center; gap: 10px; padding: 0 6px; text-align: left; font-size: calc(13px * var(--ts, 1)); }
.cf-check {
  width: 16px; height: 16px; flex: none;
  border-radius: 5px;
  display: grid; place-items: center;
  color: var(--on-primary);
  background: var(--c);
  box-shadow: inset 0 0 0 1.5px var(--c);
  transition: background .2s, transform .3s var(--spring);
}
.cf-check .icon { stroke-width: 3; color: #fff; }
.cf-item.off .cf-check { background: transparent; }
.cf-item.off .cf-check .icon { opacity: 0; }
.cf-main:active .cf-check { transform: scale(.85); }
.cf-item.off .cf-name { color: var(--fg-3); }
.cf-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cf-ro { color: var(--fg-4); display: grid; }
.cf-ic { color: color-mix(in srgb, var(--c) 60%, var(--fg)); opacity: .55; display: grid; transition: opacity .2s; }
.cf-item:hover .cf-ic { opacity: 0; }
.cf-more {
  position: absolute; right: 2px; top: 4px;
  width: 24px; height: 24px; border-radius: 7px;
  display: grid; place-items: center;
  color: var(--fg-2);
  opacity: 0;
  transition: opacity .2s, background .2s;
}
.cf-item:hover .cf-more, .cf-more:focus-visible { opacity: 1; }
/* Touch screens have no hover: keep ⋯ visible instead of the calendar icon. */
@media (hover: none) { .cf-more { opacity: .75; } .cf-ic { display: none; } }
.cf-more:hover { background: rgba(var(--ink), .1); color: var(--fg); }
.cf-item.focused { background: color-mix(in srgb, var(--c) 14%, transparent); }
.cf-item.focused .cf-name { font-weight: 650; }
.other-cals .sb-empty { padding: 2px 6px 6px; font-size: calc(12px * var(--ts, 1)); }
.cat-filter + .cat-filter { margin-top: 4px; }

/* ---------- Calendar ⋯ menu ---------- */
.cal-menu {
  position: fixed; z-index: 75;
  width: 252px; padding: 6px;
  border-radius: 16px;
  display: flex; flex-direction: column; gap: 1px;
  background: color-mix(in srgb, var(--bg) 90%, rgb(var(--ink)) 10%);
  -webkit-backdrop-filter: blur(24px) saturate(160%); backdrop-filter: blur(24px) saturate(160%);
  box-shadow: inset 0 0 0 1px rgba(var(--ink), .1), var(--shadow);
  transform-origin: top left;
  animation: menu-in .28s var(--spring) both;
}
.cal-menu-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px; }
.cal-menu-title { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cal-menu-name { font-size: calc(14px * var(--ts, 1)); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-menu-sub { font-size: calc(11.5px * var(--ts, 1)); color: var(--fg-3); }
.cal-menu-colors { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; padding: 8px 10px; justify-items: center; }
.cal-menu-colors .cal-color { width: 22px; height: 22px; }
.cal-menu > .menu-scrim { display: none; }
.menu-item.on { font-weight: 600; }
.menu-item .icon:last-child:not(.menu-ic .icon) { color: var(--primary); }

/* ---------- Scope switcher (All calendars / one calendar as a project) ---------- */
.scope-wrap { position: relative; display: grid; flex: none; }
.scope-btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; max-width: 220px; padding: 0 10px 0 8px;
  border-radius: 99px;
  font-size: calc(12.5px * var(--ts, 1)); font-weight: 600; color: var(--fg-2);
  background: rgba(var(--ink), .06);
  transition: background .2s, color .2s;
}
.scope-btn:hover { background: rgba(var(--ink), .1); color: var(--fg); }
.scope-btn.focused { color: var(--ct, var(--fg)); background: color-mix(in srgb, var(--c) 18%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 45%, transparent); }
.scope-btn .swatch { width: 18px; height: 18px; border-radius: 6px; }
.scope-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scope-stack { position: relative; width: 16px; height: 16px; flex: none; display: block; }
.scope-stack span { position: absolute; width: 10px; height: 10px; border-radius: 3.5px; box-shadow: 0 0 0 1.5px var(--bg); }
.scope-stack span:nth-child(1) { left: 0; top: 0; background: var(--c-0); }
.scope-stack span:nth-child(2) { left: 6px; top: 3px; background: var(--c-1); }
.scope-stack span:nth-child(3) { left: 3px; top: 6px; background: var(--c-3); }
.scope-menu { left: 0; right: auto; transform-origin: top left; max-height: 70vh; overflow-y: auto; }
.scope-menu .swatch { width: 22px; height: 22px; border-radius: 7px; flex: none; }
.tb-left { min-width: 0; }
@container main (max-width: 1020px) { .scope-btn .scope-name { display: none; } .scope-btn { padding: 0 8px; } }

/* ---------- Focus ("project") mode: the main panel takes the calendar's colour ---------- */
.main.focus-mode .stage {
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 55%, transparent), var(--shadow);
}
.main.focus-mode .tg-col.today { background-color: color-mix(in srgb, var(--c) 6%, transparent); }

/* Toolbar: the scope pill never shrinks (it would slide under its neighbours); the view
   title gives way instead and ends in "…". The pill shows a name only when there is room. */
.scope-wrap { flex: none; min-width: auto; }
.scope-btn { max-width: 180px; }
.scope-btn:not(.focused) { padding: 0 8px; }
.tb-title { flex: 0 1 auto; min-width: 0; overflow: hidden; }
.tb-title h1 { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scope-btn .scope-name { display: none; }
@container main (min-width: 1180px) { .scope-btn.focused .scope-name { display: inline; } }
.scope-btn { gap: 5px; }
/* ---------- Calendar settings details ---------- */
.cal-desc {
  width: 100%; resize: vertical; min-height: 44px;
  padding: 9px 11px; border: 0; outline: 0; border-radius: 10px;
  font: inherit; font-size: calc(13px * var(--ts, 1)); line-height: 1.4;
  background: rgba(var(--ink), .06);
}
.cal-desc:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 55%, transparent); }
.cal-detail-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cal-detail-label { display: flex; align-items: center; gap: 7px; font-size: calc(12.5px * var(--ts, 1)); font-weight: 600; color: var(--fg-2); }
.cal-ro-note { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; font-size: calc(12.5px * var(--ts, 1)); color: var(--fg-2); background: rgba(var(--ink), .05); }
.cal-ro-note span { flex: 1; }
.ghost-btn.small { height: 28px; padding: 0 10px; font-size: calc(12.5px * var(--ts, 1)); border-radius: 9px; }
.cal-details { padding-left: 14px; }
.cal-edit .set-section-title { margin: 14px 4px 6px; }
.card-ro { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; margin-right: 4px; border-radius: 99px; font-size: calc(11.5px * var(--ts, 1)); font-weight: 600; color: var(--fg-2); background: rgba(var(--ink), .07); }

/* ---------- Share sheets ---------- */
.share-sheet {
  width: min(560px, 100%);
  max-height: min(640px, 88vh);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: sheet-in .55s var(--spring) both;
}
.share-sheet .imp-head .swatch { width: 36px; height: 36px; border-radius: 10px; flex: none; }
.share-link { display: flex; gap: 8px; }
.share-link input {
  flex: 1; min-width: 0; height: 36px; padding: 0 12px;
  border: 0; outline: 0; border-radius: 10px;
  font-size: calc(12.5px * var(--ts, 1)); font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--fg-2);
  background: rgba(var(--ink), .07);
}
.share-link input:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 55%, transparent); color: var(--fg); }
.share-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: calc(12.5px * var(--ts, 1)); color: var(--fg-3); }
.share-check { display: inline-flex; align-items: center; gap: 7px; color: var(--fg-2); cursor: pointer; }
.share-check input { accent-color: var(--primary); width: 15px; height: 15px; }
.share-private { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 10px; font-size: calc(12.5px * var(--ts, 1)); color: var(--fg-2); background: color-mix(in srgb, #30D158 9%, transparent); }
.share-private .icon { color: #30D158; flex: none; }
.incoming-kicker { font-size: calc(11.5px * var(--ts, 1)) !important; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-3); }
.incoming-desc { margin: 0; font-size: calc(13px * var(--ts, 1)); line-height: 1.45; color: var(--fg-2); }
.incoming-list { display: flex; flex-direction: column; gap: 2px; }
.incoming-row { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 9px; font-size: calc(13px * var(--ts, 1)); background: rgba(var(--ink), .035); }
.incoming-row .un-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.incoming-row .un-time { color: var(--fg-3); font-size: calc(12px * var(--ts, 1)); white-space: nowrap; }
/* ---------- About ---------- */
.about { padding: 22px 0 12px; gap: 6px; }
.about .brand-mark.big { margin-bottom: 6px; }
.set-card.trust .srow-ctl:empty, .set-card.trust .srow-ctl > span:empty { display: none; }
.about-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin: 14px 0 10px; }
.about-links .link-btn { font-size: calc(12.5px * var(--ts, 1)); color: var(--fg-2); }
.about-links .link-btn:hover { color: var(--primary); }
.about-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }

/* ==========================================================================
   Onboarding & tour
   ========================================================================== */
.onboard {
  position: fixed; inset: 0; z-index: 120;
  display: grid; place-items: center;
  padding: 16px;
  background:
    radial-gradient(circle at 20% 15%, color-mix(in srgb, var(--primary) 26%, transparent), transparent 55%),
    radial-gradient(circle at 85% 85%, color-mix(in srgb, var(--c-2) 22%, transparent), transparent 55%),
    rgba(0, 0, 0, .55);
  -webkit-backdrop-filter: blur(22px) saturate(140%); backdrop-filter: blur(22px) saturate(140%);
  animation: fade-in .5s var(--ease) both;
}
.onboard-card {
  width: min(520px, 100%);
  max-height: min(720px, 94vh);
  overflow-y: auto;
  padding: 26px 28px 22px;
  display: flex; flex-direction: column; gap: 18px;
  animation: sheet-in .6s var(--spring) both;
}
.ob-dots { display: flex; gap: 6px; justify-content: center; }
.ob-dots span { width: 6px; height: 6px; border-radius: 99px; background: rgba(var(--ink), .2); transition: width .4s var(--spring), background .3s; }
.ob-dots span.on { width: 22px; background: var(--primary); }
.ob-dots span.done { background: color-mix(in srgb, var(--primary) 55%, transparent); }
.ob-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.ob-hero .brand-mark.big { margin-bottom: 6px; animation: born .8s var(--spring) .1s backwards; }
.ob-hero h1 { margin: 0; font-family: var(--font-display); font-size: calc(28px * var(--ts, 1)); font-weight: 720; letter-spacing: -.025em; }
.ob-hero p { margin: 0; max-width: 360px; font-size: calc(14.5px * var(--ts, 1)); line-height: 1.45; color: var(--fg-2); }
.ob-chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.ob-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px; border-radius: 99px; font-size: calc(12.5px * var(--ts, 1)); font-weight: 600; color: var(--fg-2); background: rgba(var(--ink), .08); }
.ob-chip .icon { color: var(--primary); }
.ob-langs { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.ob-q { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.ob-q h2 { margin: 6px 0 0; font-family: var(--font-display); font-size: calc(22px * var(--ts, 1)); font-weight: 700; letter-spacing: -.02em; }
.ob-q p { margin: 0; font-size: calc(13.5px * var(--ts, 1)); color: var(--fg-3); }
.ob-q-ic {
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tint) 88%, #fff), var(--tint));
  box-shadow: 0 6px 18px color-mix(in srgb, var(--tint) 40%, transparent);
}
.ob-input {
  width: min(320px, 100%); height: 44px; margin-top: 10px; padding: 0 14px;
  border: 0; outline: 0; border-radius: 12px;
  font-size: calc(16px * var(--ts, 1)); text-align: center;
  background: rgba(var(--ink), .08);
}
.ob-input:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 60%, transparent); }
.ob-foot { display: flex; align-items: center; gap: 8px; }
.ob-foot .spacer { flex: 1; }
.primary-btn.big { height: 40px; padding: 0 22px; font-size: calc(14px * var(--ts, 1)); border-radius: 12px; }

/* Time zone picker */
.tz-picker { position: relative; }
.tz-btn {
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 260px; height: 32px; padding: 0 10px;
  border-radius: 9px; font-size: calc(12.5px * var(--ts, 1));
  background: rgba(var(--ink), .08);
}
.tz-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tz-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 130;
  width: 300px; padding: 6px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg) 92%, rgb(var(--ink)) 8%);
  box-shadow: inset 0 0 0 1px rgba(var(--ink), .1), var(--shadow);
  animation: menu-in .25s var(--spring) both;
}
.tz-search { width: 100%; height: 32px; padding: 0 10px; margin-bottom: 4px; border: 0; outline: 0; border-radius: 9px; font-size: calc(13px * var(--ts, 1)); background: rgba(var(--ink), .07); }
.tz-list { max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; }
.tz-item { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 32px; padding: 0 9px; border-radius: 8px; font-size: calc(13px * var(--ts, 1)); text-align: left; }
/* An open picker must not be cut off by its card. */
.set-card:has(.tz-menu) { overflow: visible; position: relative; z-index: 3; }
/* Phones: the menu spans the whole row instead of hanging off a small button. */
@media (max-width: 640px) {
  .srow:has(.tz-menu) { position: relative; }
  .srow:has(.tz-menu) .tz-picker { position: static; }
  .srow .tz-menu { left: 8px; right: 8px; width: auto; top: calc(100% - 2px); transform: none; }
}
.tz-item:hover { background: rgba(var(--ink), .07); }
.tz-item.on { color: var(--primary); font-weight: 600; }
.tz-off { color: var(--fg-3); font-size: calc(12px * var(--ts, 1)); white-space: nowrap; font-variant-numeric: tabular-nums; }
.onboard .set-card { margin: 0; }
/* Setup: the zone list opens inside the card, under its row. */
.onboard-card { overflow-x: hidden; }
/* Parts keep their height; the card scrolls on short screens (nothing gets cut off). */
.onboard-card > * { flex-shrink: 0; }
.tz-inline { padding: 0 12px 12px; }
.tz-inline .tz-list { max-height: 216px; }
.tz-fold .fold-inner { overflow: hidden; }
.tz-btn .icon { transition: transform .3s var(--spring); }
.tz-btn.open .icon { transform: rotate(180deg); }

/* Tour: everything dims except the element being explained. One spotlight glides from
   element to element (what was lit goes dark, the next part lights up), the card follows
   and its words fade in as the light arrives. */
.tour { position: fixed; inset: 0; z-index: 115; animation: fade-in .45s var(--ease) both; transition: opacity .3s var(--ease); }
.tour.closing { opacity: 0; pointer-events: none; }
.tour-hole {
  position: absolute;
  border-radius: 16px;
  box-shadow: 0 0 0 200vmax rgba(0, 0, 0, .58), 0 0 0 2px color-mix(in srgb, var(--primary) 80%, transparent), 0 0 34px color-mix(in srgb, var(--primary) 45%, transparent);
  transition:
    left .62s cubic-bezier(.32, .72, 0, 1), top .62s cubic-bezier(.32, .72, 0, 1),
    width .62s cubic-bezier(.32, .72, 0, 1), height .62s cubic-bezier(.32, .72, 0, 1),
    box-shadow .5s var(--ease), border-radius .5s var(--ease);
  pointer-events: none;
}
.tour-hole.dark { border-radius: 50%; box-shadow: 0 0 0 200vmax rgba(0, 0, 0, .58), 0 0 0 0 transparent, 0 0 0 transparent; }
.tour-card {
  position: absolute;
  width: 320px; padding: 16px 16px 12px;
  border-radius: 18px;
  animation: menu-in .45s var(--spring) both;
  transition: left .62s cubic-bezier(.32, .72, 0, 1), top .62s cubic-bezier(.32, .72, 0, 1), translate .62s cubic-bezier(.32, .72, 0, 1);
}
.tour-text { animation: tour-text-in .5s var(--ease) .16s both; }
@keyframes tour-text-in { from { opacity: 0; transform: translateY(6px); filter: blur(3px); } to { opacity: 1; transform: none; filter: none; } }
@media (prefers-reduced-motion: reduce) {
  .tour-hole, .tour-card { transition-duration: .01s; }
  .tour-text { animation-duration: .01s; animation-delay: 0s; }
}
.tour-step { font-size: calc(11.5px * var(--ts, 1)); font-weight: 650; color: var(--primary); text-transform: uppercase; letter-spacing: .05em; }
.tour-card h3 { margin: 6px 0 4px; font-family: var(--font-display); font-size: calc(17px * var(--ts, 1)); font-weight: 700; letter-spacing: -.01em; }
.tour-card p { margin: 0; font-size: calc(13.5px * var(--ts, 1)); line-height: 1.45; color: var(--fg-2); }
.tour-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.tour-foot .spacer { flex: 1; }

/* ==========================================================================
   Customization (looks)
   ========================================================================== */
/* Glass strength: the panel tint mixed from the palette background. */
:root { --glass-pct: 55%; --bg-blur: 12px; --bg-bright: .7; --bg-sat: 1; --bg-pos: 50% 50%; --bg-photo: none; --glow-a: 1; --glow-m: 1; --grad-a: #6E6AF0; --grad-b: #E07AB8; }
.glass { --glass-tint: color-mix(in srgb, var(--bg) var(--glass-pct), transparent); }
/* Background: plain hides the glow; a photo replaces it. */
.bg-photo, .bg-anim { position: absolute; inset: -40px; opacity: 0; transition: opacity .6s var(--ease); }
.bg-photo { background: var(--bg-photo) var(--bg-pos) / cover no-repeat; }
.bg-photo, .bg-anim > * { filter: blur(var(--bg-blur)) brightness(var(--bg-bright)) saturate(var(--bg-sat)); }
/* A GIF / WebP canvas or a muted video (see backdrop.js), cropped like the photo. */
.bg-anim > * { display: block; width: 100%; height: 100%; object-fit: cover; object-position: var(--bg-pos); }
html[data-backdrop="photo"] .bg-photo, html[data-backdrop="anim"][data-anim="ready"] .bg-anim { opacity: 1; }
html[data-backdrop="photo"] .blob, html[data-backdrop="plain"] .blob, html[data-backdrop="colour"] .blob,
html[data-backdrop="anim"]:not([data-anim="failed"]) .blob { opacity: 0 !important; }
/* Colour: two colours mixed into the palette's background — deep in dark, soft in light. */
:root { --grad-k: 46%; --grad-base: 22%; }
:root[data-theme="light"] { --grad-k: 58%; --grad-base: 30%; }
@media (prefers-color-scheme: light) { :root[data-theme="system"] { --grad-k: 58%; --grad-base: 30%; } }
.backdrop { transition: background-color .6s var(--ease); }
html[data-backdrop="colour"] .backdrop {
  background:
    radial-gradient(120% 85% at 0% 0%, color-mix(in oklab, var(--grad-a) var(--grad-k), transparent), transparent 72%),
    radial-gradient(110% 95% at 100% 100%, color-mix(in oklab, var(--grad-b) var(--grad-k), transparent), transparent 74%),
    linear-gradient(155deg, color-mix(in oklab, var(--grad-a) var(--grad-base), var(--bg)), color-mix(in oklab, var(--grad-b) var(--grad-base), var(--bg)));
}
/* Glow motion: still, or a slower drift. */
html[data-motion="still"] .blob { animation: none; }
html[data-motion="slow"] .b1 { animation-duration: 84s; }
html[data-motion="slow"] .b2 { animation-duration: 101s; }
html[data-motion="slow"] .b3 { animation-duration: 114s; }
/* Font (applies to the whole app). */
html[data-font="rounded"] { --font: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif; --font-display: var(--font); }
html[data-font="serif"] { --font: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; --font-display: var(--font); }
html[data-font="mono"] { --font: ui-monospace, "SF Mono", SFMono-Regular, Menlo, "Cascadia Mono", Consolas, "Liberation Mono", monospace; --font-display: var(--font); }
html[data-font="mono"] body { letter-spacing: -.015em; }
html[data-font]:not([data-font="system"]) { --paper-head: var(--font-display); }
/* Texture: fine film grain or paper, over everything (like the Paper palette's own sheet). */
:root {
  --tex-paper:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='t'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .42  0 0 0 0 .34  0 0 0 0 .24  0 0 0 .9 -.32'/></filter><rect width='100%' height='100%' filter='url(%23t)'/></svg>"),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='600' height='600'><filter id='m'><feTurbulence type='fractalNoise' baseFrequency='.012' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .5  0 0 0 0 .42  0 0 0 0 .3  0 0 0 .28 -.1'/></filter><rect width='100%' height='100%' filter='url(%23m)'/></svg>");
  --tex-grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/><feComponentTransfer><feFuncA type='linear' slope='.9'/></feComponentTransfer></filter><rect width='100%' height='100%' filter='url(%23g)'/></svg>");
}
html[data-texture="grain"] body::before, html[data-texture="paper"] body::before {
  content: ""; position: fixed; inset: 0; z-index: 500; pointer-events: none;
}
html[data-texture="grain"] body::before { background-image: var(--tex-grain); opacity: calc(.14 * var(--tex-k, 1)); mix-blend-mode: overlay; }
html[data-texture="paper"] body::before { background-image: var(--tex-paper); opacity: calc(.5 * var(--tex-k, 1)); mix-blend-mode: multiply; }
:root[data-theme="dark"][data-texture="grain"] body::before { opacity: calc(.2 * var(--tex-k, 1)); mix-blend-mode: soft-light; }
:root[data-theme="dark"][data-texture="paper"] body::before { opacity: calc(.35 * var(--tex-k, 1)); mix-blend-mode: soft-light; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"][data-texture="grain"] body::before { opacity: calc(.2 * var(--tex-k, 1)); mix-blend-mode: soft-light; }
  :root[data-theme="system"][data-texture="paper"] body::before { opacity: calc(.35 * var(--tex-k, 1)); mix-blend-mode: soft-light; }
}
/* Paper already wears its own. */
html[data-palette="paper"][data-texture="paper"] body::before { display: none; }
@media print { body::before { display: none !important; } }
.blob { transition: opacity .6s var(--ease); }
/* Corners */
html[data-corners="square"] { --radius: 12px; }
html[data-corners="soft"] { --radius: 30px; }
html[data-corners="square"] .ev, html[data-corners="square"] .ad-chip { border-radius: 4px; }
html[data-corners="soft"] .ev, html[data-corners="soft"] .ad-chip { border-radius: 13px; }
/* Density (the hour height comes from --hour, set with the look) */
html[data-density="compact"] .ev-inner { padding: 3px 6px; }
html[data-density="compact"] .mv-chip { height: 19px; }
html[data-density="roomy"] .ev-inner { padding: 7px 9px; }
html[data-density="roomy"] .mv-chip { height: 24px; }
/* Event style */
html[data-events="solid"] .ev, html[data-events="solid"] .ad-chip, html[data-events="solid"] .mv-chip.allday {
  background: color-mix(in srgb, var(--c) 82%, #000);
  color: #fff;
  box-shadow: none;
}
html[data-events="outline"] .ev, html[data-events="outline"] .ad-chip, html[data-events="outline"] .mv-chip.allday {
  background: color-mix(in srgb, var(--c) 6%, var(--bg));
  box-shadow: inset 0 0 0 1.5px var(--c);
}

/* ---------- Customization tab ---------- */
.look-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.look-card { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px; border-radius: 14px; transition: background .2s, transform .3s var(--spring); }
.look-card:hover { background: rgba(var(--ink), .05); }
.look-card:active { transform: scale(.97); }
.look-prev {
  width: 100%; aspect-ratio: 16 / 10;
  display: grid; grid-template-columns: 28% 1fr; gap: 5px; padding: 6px;
  border-radius: 12px;
  background: radial-gradient(circle at 15% 0%, var(--blob1), transparent 60%), radial-gradient(circle at 100% 100%, var(--blob2), transparent 55%), var(--bg);
  box-shadow: inset 0 0 0 1px var(--line-2);
  outline: 2px solid transparent; outline-offset: 3px;
  transition: outline-color .25s;
}
.look-card.on .look-prev { outline-color: var(--primary); }
.look-card.bd-plain .look-prev { background: var(--bg); }
.look-card.bd-photo .look-prev { background: linear-gradient(135deg, #6b7a8f, #b6a48c 55%, #3c4a5c); }
.look-card.bd-photo.has-thumb .look-prev { background: var(--lp-photo) center / cover no-repeat, var(--bg); }
.lp-side { border-radius: 6px; background: var(--glass-tint); box-shadow: inset 0 0 0 .5px rgba(var(--ink), .1); }
.lp-main { position: relative; border-radius: 6px; background: var(--glass-tint); box-shadow: inset 0 0 0 .5px rgba(var(--ink), .1); }
.lp-ev { position: absolute; left: 10%; width: 45%; height: 18%; border-radius: 3px; }
.lp-ev.a { top: 15%; background: color-mix(in oklab, var(--c-0) var(--ev-a), var(--ev-base)); box-shadow: inset 2px 0 0 var(--c-0); }
.lp-ev.b { top: 45%; left: 48%; background: color-mix(in oklab, var(--c-1) var(--ev-a), var(--ev-base)); box-shadow: inset 2px 0 0 var(--c-1); }
.lp-ev.c { top: 70%; background: color-mix(in oklab, var(--c-3) var(--ev-a), var(--ev-base)); box-shadow: inset 2px 0 0 var(--c-3); }
.look-card.ev-solid .lp-ev.a { background: var(--c-0); } .look-card.ev-solid .lp-ev.b { background: var(--c-1); } .look-card.ev-solid .lp-ev.c { background: var(--c-3); }
.look-card.ev-outline .lp-ev { background: transparent; }
.look-card.ev-outline .lp-ev.a { box-shadow: inset 0 0 0 1.5px var(--c-0); } .look-card.ev-outline .lp-ev.b { box-shadow: inset 0 0 0 1.5px var(--c-1); } .look-card.ev-outline .lp-ev.c { box-shadow: inset 0 0 0 1.5px var(--c-3); }
.look-name { font-size: calc(12.5px * var(--ts, 1)); font-weight: 600; color: var(--fg-2); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.look-card.on .look-name { color: var(--fg); }
.set-input.grow { flex: 1; width: auto; min-width: 0; }
.set-desc.small { margin-top: -4px; font-size: calc(12px * var(--ts, 1)); }
.slider-ctl { gap: 10px; }
.slider-ctl input[type="range"] { width: 180px; accent-color: var(--primary); }
.slider-val { min-width: 44px; text-align: right; font-size: calc(12.5px * var(--ts, 1)); color: var(--fg-3); font-variant-numeric: tabular-nums; }
.ghost-btn.busy { opacity: .5; pointer-events: none; }
.srow-ctl .segmented.wide { min-width: 268px; }
.srow-title .kind-tag {
  display: inline-block; margin-left: 7px; padding: 1px 6px; vertical-align: 1px;
  border-radius: 6px; background: rgba(var(--ink), .08);
  font-size: calc(10.5px * var(--ts, 1)); font-weight: 650; letter-spacing: .03em; color: var(--fg-2);
}
.round-btn {
  display: grid; place-items: center; flex: none;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(var(--ink), .07); color: var(--fg);
  transition: background .2s, transform .25s var(--spring);
}
.round-btn:hover { background: rgba(var(--ink), .12); }
.round-btn:active { transform: scale(.92); }
.round-btn.on { background: var(--primary); color: var(--on-primary); }
.srow-note { display: flex; gap: 7px; align-items: flex-start; padding: 0 14px 12px 54px; margin-top: -4px; font-size: calc(12px * var(--ts, 1)); line-height: 1.4; color: var(--fg-3); }
.srow-note .icon { margin-top: 2px; opacity: .8; }
.srow-note .note-link { display: inline-flex; vertical-align: baseline; gap: 1px; font-size: inherit; color: var(--primary); }
.srow-note .note-link .icon { margin-top: 0; align-self: center; }
.srow-note .note-link:hover { text-decoration: underline; }
.swatches { flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: 340px; }
.swatch {
  position: relative; width: 26px; height: 26px; flex: none; border-radius: 50%;
  background: linear-gradient(135deg, var(--sw-a), var(--sw-b));
  box-shadow: inset 0 0 0 1px rgba(var(--ink), .14);
  outline: 2px solid transparent; outline-offset: 2px;
  cursor: pointer;
  transition: outline-color .2s, transform .25s var(--spring);
}
.swatch:hover { transform: scale(1.08); }
.swatch:active { transform: scale(.94); }
.swatch.on { outline-color: var(--primary); }
.swatch.own:not(.on) { background: conic-gradient(from 200deg, #ff6b6b, #ffc46b, #7be38a, #5bc0ff, #a77bff, #ff6bc8, #ff6b6b); }
.swatch.own::after { content: "+"; position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(15px * var(--ts, 1)); font-weight: 600; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.swatch.own.on::after { content: none; }
/* Font previews in the segmented control (each in its own face, whatever the app uses). */
.seg.ff-0, .look-card.lf-system .look-name { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif; letter-spacing: 0; }
.seg.ff-1 { font-family: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; }
.seg.ff-2 { font-family: ui-serif, "New York", "Iowan Old Style", Georgia, serif; }
.seg.ff-3 { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: -.02em; }
/* Look cards: live previews of each look. */
.look-prev { position: relative; overflow: hidden; }
.look-card.bd-glow .look-prev, .look-card.bd-photo.no-file .look-prev {
  background:
    radial-gradient(circle at 15% 0%, color-mix(in srgb, var(--blob1) calc(min(1, var(--lp-glow, 1)) * 100%), transparent), transparent 60%),
    radial-gradient(circle at 100% 100%, color-mix(in srgb, var(--blob2) calc(min(1, var(--lp-glow, 1)) * 100%), transparent), transparent 55%),
    var(--bg);
}
/* The same strength as the window's glow, above 100 % too (relative colours; Round 19: in
   @supports, so an engine without them keeps the color-mix line above). */
@supports (color: rgb(from red r g b / min(1, calc(alpha * 2)))) {
  .look-card.bd-glow .look-prev, .look-card.bd-photo.no-file .look-prev {
    background:
      radial-gradient(circle at 15% 0%, rgb(from var(--blob1) r g b / min(1, calc(alpha * var(--lp-glow, 1)))), transparent 60%),
      radial-gradient(circle at 100% 100%, rgb(from var(--blob2) r g b / min(1, calc(alpha * var(--lp-glow, 1)))), transparent 55%),
      var(--bg);
  }
}
.look-card.bd-colour .look-prev {
  background:
    radial-gradient(120% 85% at 0% 0%, color-mix(in oklab, var(--lg-a) var(--grad-k), transparent), transparent 72%),
    radial-gradient(110% 95% at 100% 100%, color-mix(in oklab, var(--lg-b) var(--grad-k), transparent), transparent 74%),
    linear-gradient(155deg, color-mix(in oklab, var(--lg-a) var(--grad-base), var(--bg)), color-mix(in oklab, var(--lg-b) var(--grad-base), var(--bg)));
}
.lp-badge {
  position: absolute; right: 7px; bottom: 7px;
  display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  background: rgba(0, 0, 0, .45); color: #fff;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.lp-badge .icon { width: 8px; height: 8px; margin-left: 1px; }
.look-card.lt-grain .look-prev::after, .look-card.lt-paper .look-prev::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; }
.look-card.lt-grain .look-prev::after { background-image: var(--tex-grain); opacity: .22; mix-blend-mode: overlay; }
.look-card.lt-paper .look-prev::after { background-image: var(--tex-paper); opacity: .55; mix-blend-mode: multiply; }
.look-card.lf-rounded .look-name { font-family: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; }
.look-card.lf-serif .look-name { font-family: ui-serif, "New York", "Iowan Old Style", Georgia, serif; }
.look-card.lf-mono .look-name { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.blocks .srow.block { min-height: 46px; user-select: none; transition: background .2s, transform .25s var(--spring), box-shadow .2s; }
.drag-handle { display: grid; place-items: center; width: 20px; height: 28px; color: var(--fg-3); cursor: grab; touch-action: none; }
.blocks.dragging, .blocks.dragging * { cursor: grabbing !important; }
.srow.block.lifted { background: color-mix(in srgb, var(--primary) 12%, transparent); transform: scale(1.01); box-shadow: 0 6px 16px rgba(0, 0, 0, .18); position: relative; z-index: 1; }
@media (max-width: 640px) {
  .look-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .slider-ctl input[type="range"] { width: auto; flex: 1; min-width: 0; }
  .srow-ctl .segmented.wide { min-width: 0; }
  /* Segmented choices take the whole row's width under their title, a notch smaller. */
  .srow-ctl:has(> .segmented) { padding-left: 0; }
  .srow-ctl > .segmented.small .seg { padding: 0 2px; font-size: calc(11.5px * var(--ts, 1)); letter-spacing: -.01em; }
  .swatches { max-width: none; justify-content: flex-start; }
  .srow-note { padding-left: 54px; }
}
.sb-block { display: contents; }

/* ---------- Google-style view options ---------- */
.no-dim-past .ev.past, .no-dim-past .ev.past:hover { opacity: 1; }
.app { --work-start: 7; --work-end: 21; }
.work-hours {
  background: linear-gradient(
    to bottom,
    rgba(var(--ink), .03) 0 calc(var(--hour) * var(--work-start)),
    transparent calc(var(--hour) * var(--work-start)) calc(var(--hour) * var(--work-end)),
    rgba(var(--ink), .03) calc(var(--hour) * var(--work-end))
  );
}
.hours-pick { display: flex; align-items: center; gap: 6px; color: var(--fg-3); }
.hours-pick .select-wrap select { min-width: 84px; }
/* Second time zone: a narrower second column of hour labels. */
.tg-gutter.two .hour-label { right: 8px; }
.tg-gutter.two .hour-label.second { right: auto; left: 4px; color: var(--fg-4); font-size: calc(10px * var(--ts, 1)); }
.tg:has(.tg-gutter.two) { --gutter: 82px; }
.share-option { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(var(--ink), .045); cursor: pointer; }
.share-option input { margin-top: 2px; accent-color: var(--primary); width: 16px; height: 16px; flex: none; }
.share-option-text { display: flex; flex-direction: column; gap: 2px; }
.share-option-title { font-size: calc(13.5px * var(--ts, 1)); font-weight: 600; }
.share-option-desc { font-size: calc(12px * var(--ts, 1)); color: var(--fg-3); }
/* World clock */
.hero-world { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.hero-city { display: inline-flex; align-items: baseline; gap: 5px; font-size: calc(12px * var(--ts, 1)); }
.hc-name { color: var(--fg-3); }
.hc-time { font-weight: 600; font-variant-numeric: tabular-nums; }
.wc-list { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 10px; }
.wc-chip { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 4px 0 10px; border-radius: 99px; font-size: calc(12.5px * var(--ts, 1)); background: rgba(var(--ink), .07); }
.wc-x { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: var(--fg-3); }
.wc-x:hover { background: rgba(var(--ink), .1); color: var(--fg); }
/* Recently deleted */
.count-pill { display: inline-block; margin-left: 7px; padding: 0 7px; border-radius: 99px; font-size: calc(11px * var(--ts, 1)); font-weight: 600; color: var(--fg-2); background: rgba(var(--ink), .1); vertical-align: 1px; }
.trash-row { min-height: 46px; padding-left: 22px; }
.trash-row .un-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--c); }
.trash-empty { padding: 0 14px 12px 54px; font-size: calc(12.5px * var(--ts, 1)); color: var(--fg-3); }
.ob-uses { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ob-use {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 8px 12px;
  border-radius: 14px;
  font-size: calc(13px * var(--ts, 1)); font-weight: 600;
  background: rgba(var(--ink), .05);
  box-shadow: inset 0 0 0 1px rgba(var(--ink), .06);
  transition: background .2s, box-shadow .2s, transform .3s var(--spring);
}
.ob-use:hover { background: rgba(var(--ink), .08); }
.ob-use:active { transform: scale(.96); }
.ob-use-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--fg-2); background: rgba(var(--ink), .07); transition: background .2s, color .2s; }
.ob-use.on { background: color-mix(in srgb, var(--primary) 14%, transparent); box-shadow: inset 0 0 0 2px var(--primary); }
.ob-use.on .ob-use-ic { color: var(--on-primary); background: var(--primary); }
.ob-use-check { position: absolute; top: 8px; right: 8px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; color: var(--on-primary); background: var(--primary); opacity: 0; transform: scale(.5); transition: opacity .2s, transform .3s var(--spring); }
.ob-use.on .ob-use-check { opacity: 1; transform: none; }
@media (max-width: 420px) { .ob-uses { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ==========================================================================
   Morning summary card (first open of the day)
   ========================================================================== */
.summary {
  position: fixed; z-index: 60;
  top: 78px; left: 50%; translate: -50% 0;
  width: min(420px, calc(100vw - 32px));
  padding: 16px 16px 12px;
  border-radius: 20px;
  animation: summary-in .6s var(--spring) both;
  transition: opacity .28s var(--ease), translate .28s var(--ease);
}
.summary.leaving { opacity: 0; translate: -50% -10px; }
@keyframes summary-in { from { opacity: 0; transform: translateY(-14px) scale(.97); } }
.summary-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.summary-titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.summary-greet { font-size: calc(12.5px * var(--ts, 1)); color: var(--fg-3); }
.summary-date { font-family: var(--font-display); font-size: calc(19px * var(--ts, 1)); font-weight: 700; letter-spacing: -.015em; }
.summary-kicker { display: flex; align-items: baseline; gap: 8px; margin: 10px 0 8px; font-size: calc(12px * var(--ts, 1)); }
.summary-kicker > span:first-child { font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .05em; font-size: calc(11px * var(--ts, 1)); }
.summary-line { color: var(--fg-2); }
.summary-list { display: flex; flex-direction: column; gap: 2px; }
.summary-item {
  display: flex; align-items: center; gap: 9px;
  height: 34px; padding: 0 8px; border-radius: 10px;
  text-align: left; font-size: calc(13.5px * var(--ts, 1));
  transition: background .2s;
}
.summary-item:hover { background: rgba(var(--ink), .07); }
.summary-item .un-dot { width: 8px; height: 8px; border-radius: 99px; background: var(--c); flex: none; }
.summary-time { width: 52px; flex: none; font-variant-numeric: tabular-nums; color: var(--fg-3); font-size: calc(12.5px * var(--ts, 1)); }
.summary-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary-more { padding: 4px 8px 0 25px; font-size: calc(12px * var(--ts, 1)); color: var(--fg-3); }
.summary-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
html.mac .summary { top: 80px; }
@media (max-width: 640px) { .summary { top: auto; bottom: 16px; } }
.time-input {
  height: 32px; padding: 0 10px; border: 0; outline: 0; border-radius: 9px;
  font: inherit; font-size: calc(13px * var(--ts, 1)); color: var(--fg);
  background: rgba(var(--ink), .08);
  color-scheme: inherit;
}

/* ==========================================================================
   Printing: the choice sheet, and the paper layout (only exists for the printer)
   ========================================================================== */
.print-sheet {
  width: min(560px, 100%);
  max-height: min(680px, 90vh);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: sheet-in .55s var(--spring) both;
}
.print-kinds { width: 100%; }
.print-range { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 36px; }
.print-range-title { min-width: 220px; text-align: center; font-family: var(--font-display); font-size: calc(16px * var(--ts, 1)); font-weight: 650; }
.print-cals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; }
.print-cal { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 6px; border-radius: 8px; cursor: pointer; font-size: calc(13px * var(--ts, 1)); }
.print-cal:hover { background: rgba(var(--ink), .05); }
.print-cal input { accent-color: var(--c, var(--primary)); width: 15px; height: 15px; }
.print-cal .un-dot { width: 8px; height: 8px; border-radius: 99px; background: var(--c); flex: none; }
.print-cal-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.print-opts { display: flex; flex-wrap: wrap; gap: 8px 22px; padding-top: 4px; }

.print-root { display: none; }
/* `html.print-preview` shows the paper layout on screen (for checking it). */
html.print-preview .app { display: none !important; }
html.print-preview .print-root { display: block; background: #fff; min-height: 100%; padding: 12mm; overflow: auto; height: 100%; }
@media print {
  html, body, #main { height: auto !important; overflow: visible !important; background: #fff !important; }
  .app { display: none !important; }
  .print-root { display: block !important; }
}
.print-root {
  --pr-ink: #16161a; --pr-ink-2: #55555f; --pr-line: #d9d9e0;
  /* Paper is white: always the light variants of the calendar colours. */
  --c-0: var(--p-0-l); --c-1: var(--p-1-l); --c-2: var(--p-2-l); --c-3: var(--p-3-l); --c-4: var(--p-4-l); --c-5: var(--p-5-l); --c-6: var(--p-6-l); --c-7: var(--p-7-l); --c-8: var(--p-8-l); --c-9: var(--p-9-l); --c-10: var(--p-10-l); --c-11: var(--p-11-l);
  overflow-wrap: anywhere;
  color: var(--pr-ink); background: #fff;
  font-family: var(--font); font-size: 10.5pt; line-height: 1.35;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.print-root * { color: inherit; }
.pr-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding-bottom: 8px; margin-bottom: 10px; border-bottom: 1.5px solid var(--pr-ink); }
.pr-head h1 { margin: 0; font-family: var(--font-display); font-size: 20pt; font-weight: 700; letter-spacing: -.01em; }
.pr-cals { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 12px; font-size: 8.5pt; color: var(--pr-ink-2); }
.pr-cal { display: inline-flex; align-items: center; gap: 5px; }
.pr-cal .un-dot { width: 7px; height: 7px; border-radius: 99px; background: var(--c); }
.print-root.bw .pr-cal .un-dot { background: var(--pr-ink-2); }
.pr-foot { margin-top: 12px; padding-top: 6px; border-top: 1px solid var(--pr-line); font-size: 7.5pt; color: var(--pr-ink-2); text-align: right; }

/* Day / list */
.pr-day { break-inside: avoid; padding: 6px 0 8px; border-bottom: 1px solid var(--pr-line); }
.pr-day h2 { margin: 2px 0 6px; font-size: 11.5pt; font-weight: 700; }
.pr-empty { margin: 0; color: var(--pr-ink-2); font-size: 9.5pt; }
.pr-ev { display: flex; gap: 10px; padding: 3px 0 3px 8px; border-left: 3px solid var(--pr-line); margin: 3px 0; break-inside: avoid; }
.print-root.color .pr-ev { border-left-color: var(--c); background: color-mix(in srgb, var(--c) 9%, #fff); border-radius: 0 4px 4px 0; }
.pr-time { flex: none; width: 92px; color: var(--pr-ink-2); font-variant-numeric: tabular-nums; font-size: 9.5pt; }
.pr-body { display: flex; flex-direction: column; min-width: 0; }
.pr-title { font-weight: 600; }
.pr-meta { font-size: 8.5pt; color: var(--pr-ink-2); }

/* Week: seven columns */
.pr-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--pr-line); border-radius: 6px; overflow: hidden; }
.pr-col { min-width: 0; min-height: 150mm; padding: 4px; border-left: 1px solid var(--pr-line); overflow: hidden; }
.pr-ev, .pr-body { min-width: 0; }
.pr-col:first-child { border-left: 0; }
.pr-col-head { display: flex; align-items: baseline; gap: 5px; padding: 2px 3px 5px; border-bottom: 1px solid var(--pr-line); margin-bottom: 4px; font-size: 8.5pt; color: var(--pr-ink-2); text-transform: uppercase; }
.pr-col-head b { font-size: 13pt; color: var(--pr-ink); text-transform: none; }
.pr-ev.compact { flex-direction: column; gap: 0; padding: 2px 4px 3px 5px; font-size: 8.5pt; }
.pr-ev.compact .pr-time { width: auto; font-size: 8pt; }
.pr-ev.compact .pr-meta { font-size: 7.5pt; }

/* Month: a grid of days */
.pr-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: auto; border: 1px solid var(--pr-line); border-radius: 6px; overflow: hidden; }
.pr-mhead { padding: 3px 5px; font-size: 8pt; color: var(--pr-ink-2); text-transform: uppercase; border-bottom: 1px solid var(--pr-line); }
.pr-cell { min-height: calc(150mm / var(--weeks, 5)); padding: 3px 4px; border-top: 1px solid var(--pr-line); border-left: 1px solid var(--pr-line); overflow: hidden; }
.pr-cell:nth-child(7n + 8) { border-left: 0; }
.pr-cell.out { color: #a6a6ae; background: #fafafa; }
.pr-num { display: block; font-weight: 700; font-size: 10pt; margin-bottom: 2px; }
.pr-chip { display: flex; gap: 4px; font-size: 7.5pt; line-height: 1.3; white-space: nowrap; overflow: hidden; padding-left: 4px; border-left: 2px solid var(--pr-line); margin: 1px 0; }
.print-root.color .pr-chip { border-left-color: var(--c); }
.pr-chip .pr-time { width: auto; font-size: 7.5pt; }
.pr-chip .pr-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.pr-more { font-size: 7.5pt; color: var(--pr-ink-2); }

/* Moon phases: a small monochrome moon next to the day number. */
.moon-ic { display: block; }
.hd-moon, .mv-moon { display: inline-grid; place-items: center; color: var(--fg-3); opacity: .85; }
.hd-moon { margin-left: -2px; }
.mv-moon { margin-left: 4px; }
.mv-num-row:has(.mv-moon) { display: flex; align-items: center; }

/* ==========================================================================
   Energy: nothing animates forever. The background drifts only while the window is in
   front and in use; "live" dots ring three times (on the compositor) instead of repainting.
   ========================================================================== */
/* Paused (not removed, so they don't jump) when the window is hidden or not focused. */
html.idle .blob { animation-play-state: paused; }
/* Not drawn → not animated. */
html[data-backdrop="photo"] .blob, html[data-backdrop="plain"] .blob, html[data-backdrop="colour"] .blob,
html[data-backdrop="anim"]:not([data-anim="failed"]) .blob { animation-play-state: paused; visibility: hidden; transition: opacity .6s var(--ease), visibility 0s .6s; }
/* The "now" and "live" dots: a composited ring, three beats (restarted once a minute). */
.now-dot::after, .live-dot::after, .un-item.live .un-time::after {
  content: ""; position: absolute; border-radius: 50%;
  background: inherit;
  animation: ring 2.4s cubic-bezier(.2, .6, .4, 1) 3;
  pointer-events: none;
}
.now-dot::after, .live-dot::after { inset: 0; }
.un-item.live .un-time::after { left: 0; top: 50%; margin-top: -3px; width: 6px; height: 6px; background: var(--fg); }
@keyframes ring { from { transform: scale(1); opacity: .45; } 70%, to { transform: scale(2.4); opacity: 0; } }
html.idle .now-dot::after, html.idle .live-dot::after, html.idle .un-item.live .un-time::after { animation-play-state: paused; }
/* Hidden panels keep no live blur. */
.inspector:not(.open), .toast:not(.show) { visibility: hidden; }
.inspector:not(.open) { transition: transform .6s var(--ease), opacity .4s var(--ease), visibility 0s linear .6s; }
.toast:not(.show) { transition: transform .6s var(--spring), opacity .35s var(--ease), visibility 0s linear .6s; }
/* "Reduce transparency" (macOS / iOS accessibility setting): solid panels, no blur at all. */
@media (prefers-reduced-transparency: reduce) {
  .glass, .cal-menu, .tg-hint, .onboard, .drop-overlay { -webkit-backdrop-filter: none; backdrop-filter: none; }
  .glass { --glass-tint: color-mix(in srgb, var(--bg) 94%, transparent); }
  .glass::before { display: none; }
  .blob { animation: none; }
}

/* Start-up placeholder (index.html): the calendar's outline until the app has loaded. */
#boot {
  position: fixed; inset: 0; z-index: 300;
  display: grid; grid-template-columns: var(--sb-w, 300px) minmax(0, 1fr); gap: 10px;
  padding: 10px;
  background: var(--bg);
  transition: opacity .4s var(--ease);
}
#boot.gone { opacity: 0; pointer-events: none; }
#boot > div, #boot .boot-main > div { border-radius: var(--radius, 20px); background: rgba(var(--ink), .045); box-shadow: inset 0 0 0 1px rgba(var(--ink), .06); }
#boot .boot-main { display: grid; grid-template-rows: 58px minmax(0, 1fr); gap: 10px; background: none; box-shadow: none; }
html.widget-mode #boot { display: none; }
@media (max-width: 980px) { #boot { grid-template-columns: minmax(0, 1fr); } #boot .boot-sb { display: none; } }

/* macOS full screen: no traffic lights, so no room kept for them. */
html.mac.fullscreen .brand { padding-left: 10px; }
html.mac.fullscreen .app.no-sidebar .toolbar { padding-left: 10px; }

/* The calendar's colour bar: a straight, rounded pill inside the block. (An inset shadow
   bends along the rounded corners and looked shifted in every palette with tinted events.) */
.ev, .ad-chip, .mv-chip.allday { box-shadow: none; }
.ad-chip, .mv-chip.allday { position: relative; padding-left: 11px; }
.ev::before, .ad-chip::before, .mv-chip.allday::before {
  content: ""; position: absolute; z-index: 1;
  left: 3px; top: 3px; bottom: 3px; width: 3px;
  border-radius: 3px;
  background: var(--c, var(--fg));
  pointer-events: none;
}
.ev .ev-inner { padding-left: 10px; }
.ev.tiny::before, .ad-chip::before, .mv-chip.allday::before { top: 2px; bottom: 2px; }
.ev.selected { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--c, var(--fg)), 0 10px 28px rgba(0, 0, 0, .3); }
.ev.ghost { box-shadow: 0 18px 44px rgba(0, 0, 0, .4), 0 0 0 1px var(--c, rgba(var(--ink), .4)); }
.ev:not(.ghost):not(.lifting):not(.selected):hover { box-shadow: 0 8px 22px rgba(0, 0, 0, .22); }
.ad-chip.selected { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--c, var(--fg)); }
/* Solid and outline event styles carry the colour themselves. */
html[data-events="solid"] .ev::before, html[data-events="solid"] .ad-chip::before, html[data-events="solid"] .mv-chip.allday::before,
html[data-events="outline"] .ev::before, html[data-events="outline"] .ad-chip::before, html[data-events="outline"] .mv-chip.allday::before { display: none; }
html[data-events="outline"] .ev, html[data-events="outline"] .ad-chip, html[data-events="outline"] .mv-chip.allday { box-shadow: inset 0 0 0 1.5px var(--c); }

/* Mac app, narrow window: the sidebar is a drawer, so the toolbar always keeps room for the
   traffic lights (they stay at the window's corner, over whatever is there). */
@media (max-width: 980px) {
  html.mac .toolbar { padding-left: 84px; }
  html.mac .sidebar .brand { padding-left: 70px; }
  html.mac .sidebar { top: 10px; }
}
html.mac.fullscreen .toolbar { padding-left: 10px; }

/* ==========================================================================
   Calm surfaces (colour rework, Nov 2026). Real Mac apps don't glow: no coloured halos,
   no tinted "today" columns, no gradient cards. Hierarchy comes from quiet greys and
   hairlines; colour is kept for the events themselves.
   ========================================================================== */
.tg-hd.today .num { box-shadow: none; }
.now-line { box-shadow: none; }
.imp-head-ic { box-shadow: none; }
.tg-col.today { background-color: rgba(var(--ink), .022); }
.main.focus-mode .tg-col.today { background-color: color-mix(in srgb, var(--c) 4%, transparent); }
.hero {
  background: rgba(var(--ink), .04);
  box-shadow: inset 0 0 0 1px rgba(var(--ink), .06);
}
/* Light: matte paper rather than shiny white glass. */
:root[data-theme="light"] { --glass-hi: rgba(255, 255, 255, .55); --shadow: 0 10px 30px rgba(0, 0, 0, .07), 0 1px 3px rgba(0, 0, 0, .05); }
:root[data-theme="light"] .glass::before { opacity: .22; }
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] { --glass-hi: rgba(255, 255, 255, .55); --shadow: 0 10px 30px rgba(0, 0, 0, .07), 0 1px 3px rgba(0, 0, 0, .05); }
  :root[data-theme="system"] .glass::before { opacity: .22; }
}
/* Dark: a softer sheen and shadow (no "neon glass"). */
:root[data-theme="dark"] .glass::before, :root:not([data-theme]) .glass::before { opacity: .45; }
/* Two steps of surface: the calendar sheet (grid) is a notch lighter than the frame around
   it (sidebar, toolbar). With a background photo it stays see-through. */
.stage { background: var(--grid-bg); }
html[data-backdrop="photo"] .stage, html[data-backdrop="anim"] .stage { background: color-mix(in srgb, var(--grid-bg) var(--glass-pct), transparent); }
/* Over the glow or a colour the sheet lets a little through (more as Glass goes down: 68–98 %),
   so Intensity and Motion show beyond the frame. Paper stays matte. */
html:not([data-palette="paper"]):is([data-backdrop="glow"], [data-backdrop="colour"]) .stage { background: color-mix(in srgb, var(--grid-bg) calc(60% + var(--glass-pct) * .4), transparent); }
@media (prefers-reduced-transparency: reduce) {
  html:not([data-palette="paper"]):is([data-backdrop="glow"], [data-backdrop="colour"]) .stage { background: var(--grid-bg); }
}

/* The same straight colour pill on every rounded card that carries a calendar colour
   (the "next up" card in the sidebar, setup and settings previews). */
.hero-focus, .pp-ev, .lp-ev { box-shadow: none; }
.hero-focus { position: relative; padding-left: 15px; }
.hero-focus::before, .pp-ev::before, .lp-ev::before {
  content: ""; position: absolute; z-index: 1;
  left: 3px; top: 3px; bottom: 3px; width: 3px;
  border-radius: 3px;
  background: var(--c, var(--fg));
  pointer-events: none;
}
.hero-focus::before { left: 4px; top: 5px; bottom: 5px; }
.pp-ev::before, .lp-ev::before { left: 2px; top: 2px; bottom: 2px; width: 2px; }
.lp-ev.a::before { background: var(--c-0); }
.lp-ev.b::before { background: var(--c-1); }
.lp-ev.c::before { background: var(--c-3); }

/* ==========================================================================
   Paper: a printed planner. Matte sheets (no glass, no blur, no glow), a faint paper grain
   over everything, ink colours, serif headings.
   ========================================================================== */
html[data-palette="paper"] .blob { display: none; }
html[data-palette="paper"] .glass {
  background: var(--bg);
  -webkit-backdrop-filter: none; backdrop-filter: none;
  border-color: rgba(var(--ink), .11);
  box-shadow: inset 0 1px 0 rgba(255, 252, 244, .45), 0 1px 2px rgba(70, 50, 25, .07), 0 8px 22px rgba(70, 50, 25, .07);
}
html[data-palette="paper"][data-theme="dark"] .glass { box-shadow: inset 0 1px 0 rgba(255, 240, 215, .05), 0 1px 2px rgba(0, 0, 0, .3), 0 10px 26px rgba(0, 0, 0, .28); }
html[data-palette="paper"] .glass::before { display: none; }
html[data-palette="paper"] .stage { border-color: rgba(var(--ink), .12); }
/* A colour in Paper tints the sheets themselves, like coloured paper. */
html[data-palette="paper"][data-backdrop="colour"] .glass {
  background: linear-gradient(155deg, color-mix(in oklab, var(--grad-a) 10%, var(--bg)), color-mix(in oklab, var(--grad-b) 10%, var(--bg)));
}
html[data-palette="paper"][data-backdrop="colour"] .stage {
  background: linear-gradient(155deg, color-mix(in oklab, var(--grad-a) 7%, var(--grid-bg)), color-mix(in oklab, var(--grad-b) 7%, var(--grid-bg)));
}
/* The paper itself: fine tooth + soft mottling, multiplied into the sheet. */
html[data-palette="paper"] body::after {
  content: ""; position: fixed; inset: 0; z-index: 500; pointer-events: none;
  background-image: var(--tex-paper);
  opacity: .5;
  mix-blend-mode: multiply;
}
html[data-palette="paper"][data-theme="dark"] body::after { opacity: .35; mix-blend-mode: soft-light; }
@media (prefers-color-scheme: dark) { html[data-palette="paper"][data-theme="system"] body::after { opacity: .35; mix-blend-mode: soft-light; } }
@media print { html[data-palette="paper"] body::after { display: none; } }
/* Printed-planner type: serif headings and numbers, sans for the small print. */
html[data-palette="paper"] :is(.tb-title h1, .hero-date, .brand-name, .summary-date, .set-head h2, .imp-head h2,
  .tg-hd .num, .mv-num, .mini-title, .ob-q h2, .tour-card h3, .pal-title, .print-range-title) {
  font-family: var(--paper-head, ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif);
  letter-spacing: 0;
}
html[data-palette="paper"] .tb-title h1, html[data-palette="paper"] .hero-date { font-weight: 600; }
/* Events: like a highlighter wash with an ink edge. */
html[data-palette="paper"] .ev, html[data-palette="paper"] .ad-chip, html[data-palette="paper"] .mv-chip.allday, html[data-palette="paper"] .hero-focus {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 22%, transparent);
}

/* Battery saver (Settings → General): nothing moves, no live blur — solid panels instead. */
html.low-power *, html.low-power *::before, html.low-power *::after { animation: none !important; transition: none !important; }
/* The glow stays, still (Intensity still applies): a plain gradient, no blur filter. */
html.low-power .glass, html.low-power .cal-menu, html.low-power .tg-hint, html.low-power .onboard, html.low-power .drop-overlay {
  -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
}
html.low-power .glass { --glass-tint: var(--bg); }
html.low-power .glass::before { display: none; }

/* ==========================================================================
   Subscribed calendars ("Subscribe by link"): the sheet, the sidebar mark, the calendar
   menu's status lines and the link box in Settings → Calendars.
   ========================================================================== */
.sub-field { display: flex; flex-direction: column; gap: 6px; }
.sub-label { padding-left: 2px; font-size: calc(12px * var(--ts, 1)); font-weight: 600; color: var(--fg-2); }
.sub-field input {
  height: 36px; padding: 0 12px;
  border: 0; outline: 0; border-radius: 10px;
  font-size: calc(13.5px * var(--ts, 1)); color: var(--fg);
  background: rgba(var(--ink), .07);
}
.sub-field input.sub-url { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: calc(12.5px * var(--ts, 1)); }
.sub-field input:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 55%, transparent); }
.sub-field input:disabled, .sub-field .cal-color:disabled { opacity: .55; }
.sub-field .cal-colors { gap: 7px; padding: 2px 2px 0; }
.sub-field .cal-color { width: 22px; height: 22px; }
.sub-progress { display: flex; align-items: center; gap: 9px; padding: 2px 4px; font-size: calc(12.5px * var(--ts, 1)); color: var(--fg-2); }
.sub-spinner {
  width: 14px; height: 14px; flex: none; border-radius: 50%;
  border: 2px solid rgba(var(--ink), .16); border-top-color: var(--primary);
  animation: sub-spin .8s linear infinite;
}
@keyframes sub-spin { to { transform: rotate(360deg); } }
.sub-note .icon { color: var(--fg-3); }
.primary-btn.busy { opacity: .6; }
/* Settings → Data: the third tile spans the row. */
.import-tile.wide { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 12px; }
.import-tile.wide .tile-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.import-tile.wide .tile-title { margin-top: 0; }
/* Sidebar: a link mark, amber when the last refresh failed. */
.cf-feed.failed { color: #FF9F0A; }
/* Calendar ⋯ menu */
.cal-menu-feed {
  display: flex; flex-direction: column; gap: 3px;
  margin: -4px 6px 4px; padding: 7px 10px; border-radius: 10px;
  font-size: calc(11.5px * var(--ts, 1)); line-height: 1.35; color: var(--fg-3);
  background: rgba(var(--ink), .05);
}
.cal-menu-feed.failed { background: color-mix(in srgb, #FF9F0A 11%, transparent); }
.cal-menu-feed-err { color: var(--fg-2); }
.menu-item:disabled { opacity: .6; cursor: default; }
.spin-ic { display: grid; place-items: center; }
.spin-ic.on .icon { animation: sub-spin .9s linear infinite; }
/* Settings → Calendars: the link, its status and "Refresh now". */
.cal-feed { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 12px; background: rgba(var(--ink), .045); }
.cal-feed .share-link input { height: 32px; }
.cal-feed .share-link .ghost-btn { height: 32px; padding: 0 10px; }
.cal-feed-status { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.cal-feed-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: calc(12px * var(--ts, 1)); line-height: 1.4; color: var(--fg-3); }
.cal-feed-updated { font-weight: 600; color: var(--fg-2); }
.cal-feed-error { display: flex; align-items: flex-start; gap: 6px; color: var(--fg-2); }
.cal-feed-error .icon { flex: none; margin-top: 1px; color: #FF9F0A; }
.cal-feed-status .ghost-btn { flex: none; }

/* ==========================================================================
   Sync between devices — Settings → Data, and the "Join sync?" sheet
   ========================================================================== */
.sync-hero { display: flex; align-items: flex-start; gap: 12px; padding: 14px 14px 12px; }
.sync-hero .srow-desc { max-width: 52ch; }
.sync-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sync-card .sync-hero + .srow { box-shadow: inset 0 1px 0 rgba(var(--ink), .06); }
.sync-relay { width: 230px; max-width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: calc(12.5px * var(--ts, 1)); }
.sync-note { display: flex; align-items: flex-start; gap: 8px; margin: -2px 14px 12px 54px; font-size: calc(12px * var(--ts, 1)); line-height: 1.4; color: var(--fg-2); }
.sync-note .icon { flex: none; margin-top: 1px; color: #FF9F0A; }
/* A calm fact, not a warning: "not in this version yet", "works once the site is up". */
.sync-soon { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; padding: 9px 12px; border-radius: 10px; font-size: calc(12px * var(--ts, 1)); line-height: 1.4; color: var(--fg-2); background: rgba(var(--ink), .05); }
.sync-soon .icon { flex: none; margin-top: 1px; color: #0A84FF; }
.sync-pair-side .sync-soon { margin-top: 0; }
/* "Have your own sync server?": the advanced case, folded away under the hero. */
.sync-own {
  display: flex; align-items: center; gap: 6px; width: 100%;
  padding: 11px 14px; text-align: left;
  font-size: calc(12.5px * var(--ts, 1)); font-weight: 550; color: var(--fg-2);
  box-shadow: inset 0 1px 0 rgba(var(--ink), .06);
  transition: color .2s, background .2s;
}
.sync-own:hover { color: var(--fg); background: rgba(var(--ink), .03); }
.sync-own > .icon { flex: none; color: var(--fg-3); }
.sync-own-chev { display: grid; color: var(--fg-3); transition: transform .35s var(--spring); }
.sync-own.open .sync-own-chev { transform: rotate(180deg); }
.sync-own-fold .srow { padding-top: 2px; }
/* The pairing code: the QR code beside the link and the warning. */
.sync-pair { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; padding: 2px 14px 14px 54px; }
/* Always dark modules on a light tile (in the dark theme too): what phone cameras read best.
   The SVG brings its own 4-module quiet zone; 200px keeps a usual link (~57 modules) at
   3+ px a module, a long one (.dense, ~85 modules) gets more room. */
.sync-qr { flex: none; width: 200px; height: 200px; padding: 6px; border-radius: 14px; background: #fff; color: #111; box-shadow: 0 0 0 1px rgba(0, 0, 0, .08); }
.sync-qr.dense { width: 264px; height: 264px; }
.sync-qr svg { display: block; width: 100%; height: 100%; }
.sync-pair-side { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.sync-pair-side .share-link input { height: 32px; }
.sync-pair-side .share-link .ghost-btn { height: 32px; padding: 0 10px; }
.sync-warn { display: flex; align-items: flex-start; gap: 8px; padding: 9px 12px; border-radius: 10px; font-size: calc(12px * var(--ts, 1)); line-height: 1.4; color: var(--fg-2); background: color-mix(in srgb, #FF9F0A 10%, transparent); }
.sync-warn .icon { flex: none; margin-top: 1px; color: #FF9F0A; }
/* Plain facts in the Join sheet (where the calendar goes, how it is protected). */
.sync-plain { display: flex; align-items: flex-start; gap: 8px; padding: 2px 4px; font-size: calc(12px * var(--ts, 1)); line-height: 1.4; color: var(--fg-2); overflow-wrap: anywhere; }
.sync-plain .icon { flex: none; margin-top: 1px; color: var(--fg-3); }
.ghost-btn.busy { opacity: .7; }
/* Over the first-run setup (z-index 120): a phone opening a pairing link joins first. */
.modal-wrap.sync-join-wrap { z-index: 125; }
.share-sheet.sync-join { width: min(460px, calc(100vw - 32px)); }
@media (max-width: 640px) {
  .sync-hero { padding-bottom: 10px; }
  /* The notice and the buttons take the card's full width (under the icon too), so
     "Включить синхронизацию" stays on one line on a phone. */
  .sync-hero .sync-soon, .sync-actions { margin-left: -50px; }
  .sync-actions > button { flex: 1 1 auto; justify-content: center; height: auto; min-height: 34px; padding: 7px 10px; line-height: 1.3; text-align: center; }
  .sync-pair { padding-left: 14px; }
  .sync-qr { width: min(240px, 100%); height: auto; aspect-ratio: 1; }
  .sync-qr.dense { width: min(300px, 100%); }
  .sync-note { margin-left: 14px; }
  .sync-relay { width: 100%; }
}

/* ---------- Modals: glass is blurred from the first frame ----------
   An ancestor with opacity < 1 becomes a "backdrop root": the glass inside it can only blur
   what is inside that ancestor, so WebKit showed the sheets unblurred (the background shining
   through) until the wrapper's fade had finished, then the blur popped in. Fade the scrim's
   colour instead of the wrapper's opacity; the sheets keep their own rise-in animation. */
.modal-wrap {
  opacity: 1;
  background: transparent;
  visibility: hidden;
  transition: background-color .3s var(--ease), visibility 0s linear .3s;
}
.modal-wrap.open {
  opacity: 1;
  background: var(--scrim);
  visibility: visible;
  transition: background-color .3s var(--ease), visibility 0s;
}
/* Same for the ⌘K palette and the tour (their glass cards sit inside a fading wrapper). */
.palette-wrap {
  opacity: 1;
  background: transparent;
  visibility: hidden;
  transition: background-color .3s var(--ease), visibility 0s linear .3s;
}
.palette-wrap.open {
  opacity: 1;
  background: var(--scrim);
  visibility: visible;
  transition: background-color .3s var(--ease), visibility 0s;
}
.tour { animation: none; transition: none; }
.tour-hole { animation: fade-in .45s var(--ease) both; }
.tour.closing { opacity: 1; }
.tour.closing .tour-hole, .tour.closing .tour-card { opacity: 0; transition: opacity .3s var(--ease); }

/* ---------- Customization → Sounds ----------
   Three pack cards (tap = choose and hear, ▶ = listen), the master switch and volume, then
   every sound folded away: a row says what it plays, tapping it opens its choices below. */
.snd-packs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.snd-pack { position: relative; min-width: 0; }
.snd-pack-main {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: flex-start; gap: 5px;
  padding: 12px; border-radius: 14px; text-align: left;
  background: rgba(var(--ink), .045);
  box-shadow: inset 0 0 0 1px rgba(var(--ink), .055);
  outline: 2px solid transparent; outline-offset: 2px;
  transition: background .2s, outline-color .25s, transform .3s var(--spring);
}
.snd-pack-main:hover { background: rgba(var(--ink), .07); }
.snd-pack-main:active { transform: scale(.98); }
.snd-pack.on .snd-pack-main { outline-color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, rgba(var(--ink), .045)); }
.snd-pack-main .srow-ic.big { margin-bottom: 3px; }
.snd-pack-name { font-size: calc(13.5px * var(--ts, 1)); font-weight: 650; color: var(--fg); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snd-pack-desc { font-size: calc(11.5px * var(--ts, 1)); line-height: 1.35; color: var(--fg-3); overflow-wrap: anywhere; hyphens: auto; }
.snd-pack-play { position: absolute; top: 12px; right: 10px; width: 28px; height: 28px; }
.snd-pack-play .icon { width: 10px; height: 10px; margin-left: 1px; }
.more-btn .snd-count { font-size: calc(12px * var(--ts, 1)); font-weight: 500; color: var(--fg-3); }
.snd-list { margin-top: 8px; }
.snd-item + .snd-item { box-shadow: inset 0 1px 0 rgba(var(--ink), .06); }
.snd-row { display: flex; align-items: center; gap: 6px; padding-right: 12px; }
.snd-head {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 12px;
  min-height: 52px; padding: 8px 4px 8px 14px; text-align: left;
  transition: background .2s;
}
.snd-head:hover { background: rgba(var(--ink), .03); }
.snd-head .srow-text { display: flex; flex-direction: column; min-width: 0; }
.snd-head .srow-title { overflow-wrap: anywhere; line-height: 1.25; }
.snd-what { display: flex; min-width: 0; }
.snd-src { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snd-vol { flex: none; white-space: pre; }
.snd-chev { display: grid; flex: none; color: var(--fg-3); transition: transform .35s var(--spring); }
.snd-item.open .snd-chev { transform: rotate(180deg); }
.snd-play .icon { width: 11px; height: 11px; }
.snd-play:not(.on) .icon { margin-left: 1px; }
.snd-play:disabled { opacity: .35; pointer-events: none; }
/* The sound's file input: out of sight (its "Choose…" label opens it). */
.snd-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip-path: inset(50%); pointer-events: none; }
.snd-edit { position: relative; padding-bottom: 4px; background: rgba(var(--ink), .025); box-shadow: inset 0 1px 0 rgba(var(--ink), .05); }
/* The choices of one sound line up under its name (their icons would only repeat it). */
.snd-sub { min-height: 46px; padding-left: 54px; }
.snd-sub .srow-ic { display: none; }
.snd-file { display: flex; align-items: center; min-width: 0; }
.snd-file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snd-file .kind-tag { flex: none; }
.snd-note { margin-top: 0; }
.snd-note + .snd-note { margin-top: -6px; }
@media (max-width: 640px) {
  .snd-packs { gap: 8px; }
  .snd-pack-main { padding: 10px; }
  .snd-pack-play { top: 10px; right: 8px; }
  .snd-sub { padding-left: 14px; }
  .snd-sub .srow-ctl { padding-left: 0; }
  .snd-sub .slider-ctl input[type="range"] { flex: 1; width: auto; min-width: 0; }
  .snd-note { padding-left: 14px; }
}
@media (max-width: 400px) {
  .snd-pack-desc { display: none; }
}

/* ==========================================================================
   Calendar polish (QA round 12)
   ========================================================================== */
/* A multi-day all-day event: one colour bar at its start, not one per day. A piece that only
   continues it has none; the first piece on screen of an event that began earlier keeps it. */
.ad-chip.cont-l:not(.head)::before, .mv-chip.allday.cont-l:not(.head)::before { display: none; }
.ad-chip.cont-l:not(.head) { padding-left: 8px; }
.mv-chip.allday.cont-l.head { margin-left: 0; padding-left: 11px; }
/* Week header: in a narrow column the moon would run into the next day's label. */
.tg-hd { container-type: inline-size; }
@container (max-width: 92px) { .tg-hd .hd-moon { display: none; } }
/* Second time zone: which zone each column of hours shows. */
.tg-gutter-head:has(.tz-heads) { place-items: end stretch; gap: 3px; }
.tg-gutter-head:has(.tz-heads) .wk-badge { justify-self: center; }
.tz-heads { display: flex; justify-content: space-between; gap: 2px; padding: 0 8px 0 4px; font-size: calc(9.5px * var(--ts, 1)); font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
.tz-h { color: var(--fg-3); cursor: default; }
.tz-h.second { color: var(--fg-4); }
/* Month, 1st of a month ("1 Nov"): the number never shrinks under the moon. */
.mv-num { flex-shrink: 0; }
.mv-moon { min-width: 0; overflow: hidden; }
@media (max-width: 640px) {
  /* A phone's day cell is ~40px wide: the number and its moon must both fit. */
  .mv-num { min-width: 24px; height: 24px; padding: 0 3px; }
  .mv-moon { margin-left: 2px; }
  .mv-num.with-month { padding: 0 2px; font-size: calc(11.5px * var(--ts, 1)); letter-spacing: -.01em; }
  .mv-num-row:has(.with-month) .mv-moon { display: none; }
}
@media (max-width: 359px) { .mv-moon { display: none; } }
/* Editor of a repeating event: what applies to the whole series. */
.insp-note { display: flex; align-items: flex-start; gap: 7px; padding: 9px 0 11px; font-size: calc(12px * var(--ts, 1)); line-height: 1.35; color: var(--fg-3); }
.insp-note .icon { flex: none; margin-top: 1px; }
/* "Other calendars": its "+" menu opens up and to the left of the button. */
.others-menu { width: 248px; transform-origin: bottom right; }
/* Calendars pill: a calendar shared with you (read-only) is marked, apart from your own copy. */
.menu-item .menu-ro { display: grid; place-items: center; color: var(--fg-3); }
.menu-item .menu-ro > .icon:last-child:not(.menu-ic .icon) { color: var(--fg-3); }
/* Phones: the view title comes first. Settings is in the sidebar, the calendars pill shows
   only while one calendar is in focus. */
@media (max-width: 640px) {
  .tb-right > .icon-btn:last-child { display: none; }
  .scope-wrap:not(:has(.scope-btn.focused)) { display: none; }
}
/* Week header in a narrow day column (the editor or the sidebar narrows the week): the
   weekday goes over the number, as on a phone, instead of running into the next day. */
.tg-hd { flex-wrap: wrap; align-content: center; row-gap: 1px; }
@container (max-width: 96px) {
  .tg-hd .wd { width: 100%; text-align: center; font-size: calc(10.5px * var(--ts, 1)); }
  .tg-hd .num { font-size: calc(16px * var(--ts, 1)); min-width: 26px; height: 26px; }
}
/* Settings → General: the morning summary waits for Mono to be opened (no notifications). */
.summary-quiet { flex: 1 1 200px; margin: 0; }

/* ===== Round 13 — theme Auto, toolbar search, text size ===== */
/* Text size: every font size above is `calc(Npx * var(--ts, 1))`; --ts is set on <html>
   (index.html's start-up script, then the app: Settings → Appearance → Text size). */
:root { --ts: 1; }

/* ---------- Toolbar search: a glass field, as calm as the view switcher ---------- */
.search-btn {
  position: relative;
  height: 32px; width: 200px; min-width: 0;
  padding: 0 5px 0 10px; gap: 7px;
  border-radius: 11px;
  background: rgba(var(--ink), .065);
  box-shadow: inset 0 0 0 .5px rgba(var(--ink), .06);
  color: var(--fg-3);
  transition: background .25s var(--ease), box-shadow .25s var(--ease), color .2s, width .5s var(--ease), transform .3s var(--spring);
}
.search-btn:hover { background: rgba(var(--ink), .1); color: var(--fg-2); box-shadow: inset 0 0 0 .5px rgba(var(--ink), .1); }
.search-btn:active { transform: scale(.985); }
.search-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 32%, transparent), inset 0 0 0 .5px rgba(var(--ink), .14);
}
.search-btn .search-ic { flex: none; display: grid; place-items: center; transition: transform .35s var(--spring); }
.search-btn:hover .search-ic { transform: scale(1.08); color: var(--fg-2); }
.search-btn .search-ph { flex: 1; min-width: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.005em; }
.search-btn .search-kbd {
  flex: none;
  height: 22px; min-width: 24px; padding: 0 6px;
  display: inline-grid; place-items: center;
  border: 0; border-radius: 7px;
  background: rgba(var(--ink), .075);
  box-shadow: inset 0 0 0 .5px rgba(var(--ink), .08), 0 1px 0 rgba(var(--ink), .05);
  font-size: calc(11px * var(--ts, 1)); font-weight: 600; letter-spacing: .01em;
  color: var(--fg-3);
  line-height: 1;
}
:root[data-theme="light"] .search-btn .search-kbd { background: rgba(255, 255, 255, .75); box-shadow: 0 0 0 .5px rgba(0, 0, 0, .08), 0 1px 1.5px rgba(0, 0, 0, .08); }
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] .search-btn .search-kbd { background: rgba(255, 255, 255, .75); box-shadow: 0 0 0 .5px rgba(0, 0, 0, .08), 0 1px 1.5px rgba(0, 0, 0, .08); }
}
/* Auto theme: no light / dark switch in the toolbar, so the search takes its room. */
.toolbar.theme-auto .search-btn { width: 272px; }
@container main (max-width: 1180px) {
  .search-btn { width: 150px; }
  .toolbar.theme-auto .search-btn { width: 192px; }
  .search-btn .search-kbd { display: none; }
}
@container main (max-width: 1020px) {
  .search-btn { width: 32px; padding: 0; justify-content: center; }
  .search-btn .search-ph, .search-btn .search-kbd { display: none; }
  .toolbar.theme-auto .search-btn { width: 140px; padding: 0 10px; justify-content: flex-start; }
  .toolbar.theme-auto .search-btn .search-ph { display: block; }
}
@container main (max-width: 900px) {
  .toolbar.theme-auto .search-btn { width: 32px; padding: 0; justify-content: center; }
  .toolbar.theme-auto .search-btn .search-ph { display: none; }
}
@container main (max-width: 760px) {
  /* The view switcher has its own row: the field can open up again. */
  .toolbar.theme-auto .search-btn { width: 150px; padding: 0 10px; justify-content: flex-start; }
  .toolbar.theme-auto .search-btn .search-ph { display: block; }
}
@container main (max-width: 520px) {
  .toolbar.theme-auto .search-btn { width: 32px; padding: 0; justify-content: center; }
  .toolbar.theme-auto .search-btn .search-ph { display: none; }
}

/* ---------- Theme cards: Light · Dark · Auto (split across the diagonal) ---------- */
.theme-prev { position: relative; display: block; isolation: isolate; }
.tp-layer { position: absolute; inset: 0; display: grid; grid-template-columns: 28% 1fr; }
.tp-layer.light { background: #fafafa; --p: 0, 0, 0; }
.tp-layer.dark { background: #000; --p: 255, 255, 255; }
.theme-prev.system .tp-layer.dark { clip-path: polygon(100% 0, 100% 100%, 0 100%); }
.tp-seam {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom right, transparent calc(50% - .75px), rgba(128, 128, 128, .55) 50%, transparent calc(50% + .75px));
}
.theme-card .theme-prev .tp-ev { transition: transform .5s var(--spring); }
.theme-card:hover .theme-prev .tp-ev.a { transform: translateY(-2px); }
.theme-card:hover .theme-prev .tp-ev.b { transform: translateY(2px); }
.theme-hint {
  margin: 14px auto 0; max-width: 46ch;
  text-align: center;
  font-size: calc(12.5px * var(--ts, 1)); line-height: 1.45;
  color: var(--fg-3);
}

/* ---------- Text size ---------- */
.ts-preview {
  display: flex; align-items: center; gap: 16px;
  min-height: 78px; padding: 12px 18px; margin-bottom: 14px;
  border-radius: 14px;
  background: rgba(var(--ink), .045);
  box-shadow: inset 0 0 0 .5px rgba(var(--ink), .06);
  overflow: hidden;
}
.ts-aa {
  flex: none;
  font-family: var(--font-display);
  font-size: calc(36px * var(--ts, 1)); font-weight: 650; letter-spacing: -.03em; line-height: 1;
  color: var(--fg);
  transition: font-size .4s var(--ease);
}
.ts-lines { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ts-sample { font-size: calc(14px * var(--ts, 1)); font-weight: 500; color: var(--fg); line-height: 1.3; transition: font-size .4s var(--ease); }
.ts-now { font-size: calc(12px * var(--ts, 1)); color: var(--fg-3); font-variant-numeric: tabular-nums; }
.ts-row { display: flex; align-items: center; gap: 8px; }
.ts-row .segmented { flex: 1; min-width: 0; }
.ts-row .segmented .seg { padding: 0 4px; font-variant-numeric: tabular-nums; }
/* The two "A"s keep their own size: they show the range, not the setting. */
.ts-a {
  flex: none; width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 9px;
  font-family: var(--font-display); font-weight: 600; line-height: 1;
  color: var(--fg-2);
  transition: background .2s var(--ease), color .2s, transform .25s var(--spring);
}
.ts-a.small { font-size: calc(11px * var(--ts, 1)); }
.ts-a.big { font-size: calc(18px * var(--ts, 1)); }
.ts-a:hover { background: rgba(var(--ink), .08); color: var(--fg); }
.ts-a:active { transform: scale(.9); }
.ts-keys { margin-top: 10px; text-align: center; font-size: calc(12px * var(--ts, 1)); color: var(--fg-3); }

/* ---------- Larger text: room for it ---------- */
html.ts-big .toolbar { height: auto; min-height: calc(58px + (var(--ts) - 1) * 30px); }
html.ts-big .seg { height: calc(28px * var(--ts)); }
html.ts-big .search-btn, html.ts-big .tb-right .pill-btn { height: calc(32px * min(var(--ts), 1.15)); }
html.ts-big .mv-chip { height: auto; min-height: 21px; padding-top: 2px; padding-bottom: 2px; }
html.ts-big .ad-chip { height: auto; min-height: 22px; line-height: 1.45; }

/* ===== Round 13 — Customization: textures, accent, depth, grid, today, now line, drift ===== */
/* Wood and Stone: procedural (SVG noise), painted once into a tile, never animated.
   Each is one colour with a noise-shaped alpha, so the blend (per theme, below) decides how it
   sits on the palette: multiply in light, a soft glow in dark. */
:root {
  --tex-wood: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='1200' height='400'><filter id='w' x='0' y='0' width='100%' height='100%'><feTurbulence type='fractalNoise' baseFrequency='.0016 .011' numOctaves='3' seed='11' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  2.2 0 0 0 -.6'/><feComponentTransfer result='r'><feFuncA type='table' tableValues='0 .05 .5 .05 0 .04 .45 .06 0 .05 .5 .04 0 .06 .45 .05 0 .04 .5 .05 0'/></feComponentTransfer><feTurbulence type='fractalNoise' baseFrequency='.004 .32' numOctaves='2' seed='4' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  1.8 0 0 0 -.62' result='f'/><feTurbulence type='fractalNoise' baseFrequency='.0012 .006' numOctaves='2' seed='19' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  1.2 0 0 0 -.4' result='b'/><feComposite in='r' in2='f' operator='arithmetic' k2='.8' k3='.55' result='m1'/><feComposite in='m1' in2='b' operator='arithmetic' k2='1' k3='.45' result='m'/><feFlood flood-color='%237a4c27'/><feComposite in2='m' operator='in'/></filter><rect width='100%' height='100%' filter='url(%23w)'/></svg>");
  --tex-stone: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='700' height='700'><filter id='s' x='0' y='0' width='100%' height='100%'><feTurbulence type='fractalNoise' baseFrequency='.0045' numOctaves='4' seed='5' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  1.6 0 0 0 -.55' result='cl'/><feTurbulence type='fractalNoise' baseFrequency='.0032 .0055' numOctaves='4' seed='23' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  1 0 0 0 0'/><feComponentTransfer><feFuncA type='table' tableValues='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .42 0 0 0 0 0 0 0 0 0 0 .26 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0'/></feComponentTransfer><feGaussianBlur stdDeviation='.45' result='v'/><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='1' seed='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  6 0 0 0 -3.95' result='sp'/><feComposite in='cl' in2='v' operator='arithmetic' k2='.6' k3='.75' result='m1'/><feComposite in='m1' in2='sp' operator='arithmetic' k2='1' k3='.45' result='m'/><feFlood flood-color='%2359544f'/><feComposite in2='m' operator='in'/></filter><rect width='100%' height='100%' filter='url(%23s)'/></svg>");
  /* Dark (the default): a soft glow / soft light. */
  --wood-o: .2; --wood-b: screen;
  --stone-o: .4; --stone-b: screen;
  --tex-k: 1;
  --pal-accent: var(--p-accent-d); --pal-primary: var(--p-primary-d);
}
:root[data-theme="light"] {
  --wood-o: .22; --wood-b: multiply;
  --stone-o: .26; --stone-b: multiply;
  --pal-accent: var(--p-accent-l); --pal-primary: var(--p-primary-l);
}
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] {
    --wood-o: .22; --wood-b: multiply;
    --stone-o: .26; --stone-b: multiply;
    --pal-accent: var(--p-accent-l); --pal-primary: var(--p-primary-l);
  }
}
html[data-texture="wood"] body::before, html[data-texture="stone"] body::before {
  content: ""; position: fixed; inset: 0; z-index: 500; pointer-events: none;
}
html[data-texture="wood"] body::before { background-image: var(--tex-wood); opacity: calc(var(--wood-o) * var(--tex-k, 1)); mix-blend-mode: var(--wood-b); }
html[data-texture="stone"] body::before { background-image: var(--tex-stone); opacity: calc(var(--stone-o) * var(--tex-k, 1)); mix-blend-mode: var(--stone-b); }

/* Texture picker: a small tile per texture, over a bit of the palette's glow. */
.tex-head { min-height: 40px; padding-bottom: 4px; }
.tex-pick { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; padding: 0 14px 14px 54px; }
.tex-opt { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0; border-radius: 12px; }
.tex-sw {
  position: relative; width: 100%; aspect-ratio: 1; max-width: 76px; border-radius: 13px; overflow: hidden;
  background:
    radial-gradient(130% 90% at 12% 0%, var(--blob1), transparent 70%),
    radial-gradient(110% 80% at 100% 100%, var(--blob2), transparent 70%),
    var(--bg);
  box-shadow: inset 0 0 0 1px var(--line-2), 0 1px 2px rgba(0, 0, 0, .08);
  outline: 2px solid transparent; outline-offset: 2px;
  transition: outline-color .2s, transform .3s var(--spring), box-shadow .2s;
}
.tex-opt:hover .tex-sw { transform: translateY(-1.5px); box-shadow: inset 0 0 0 1px var(--line-2), 0 6px 14px rgba(0, 0, 0, .12); }
.tex-opt:active .tex-sw { transform: scale(.95); }
.tex-opt.on .tex-sw { outline-color: var(--primary); }
.tex-opt:focus-visible { outline: none; }
.tex-opt:focus-visible .tex-sw { outline-color: color-mix(in srgb, var(--primary) 60%, transparent); }
.tex-sw::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.tex-sw.tx-off::after {
  inset: 28%;
  background: linear-gradient(135deg, transparent calc(50% - .8px), var(--fg-4) calc(50% - .8px), var(--fg-4) calc(50% + .8px), transparent calc(50% + .8px));
}
.tex-sw.tx-grain::after { background-image: var(--tex-grain); opacity: .55; mix-blend-mode: overlay; }
.tex-sw.tx-paper::after { background-image: var(--tex-paper); opacity: .8; mix-blend-mode: multiply; }
.tex-sw.tx-wood::after { background-image: var(--tex-wood); background-position: -300px -120px; opacity: calc(var(--wood-o) * 2.6); mix-blend-mode: var(--wood-b); }
.tex-sw.tx-stone::after { background-image: var(--tex-stone); background-position: -330px -420px; opacity: calc(var(--stone-o) * 2.2); mix-blend-mode: var(--stone-b); }
.tex-name { max-width: 100%; font-size: calc(11.5px * var(--ts, 1)); font-weight: 600; color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .2s; }
.tex-opt.on .tex-name { color: var(--fg); }
@media (max-width: 640px) {
  .tex-pick { grid-template-columns: repeat(3, minmax(0, 1fr)); padding-left: 14px; }
  .tex-sw { max-width: none; aspect-ratio: 1.6; }
}
/* The look cards wear their texture too. */
.look-card.lt-wood .look-prev::after, .look-card.lt-stone .look-prev::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; }
.look-card.lt-wood .look-prev::after { background-image: var(--tex-wood); opacity: calc(var(--wood-o) * 2); mix-blend-mode: var(--wood-b); }
.look-card.lt-stone .look-prev::after { background-image: var(--tex-stone); opacity: calc(var(--stone-o) * 1.4); mix-blend-mode: var(--stone-b); }

/* Accent: the user's colour (set on <html> with the look) everywhere the palette's accent was. */
html[data-accent="own"] ::selection { background: color-mix(in srgb, var(--accent) 32%, transparent); }
.swatch.acc-pal { background: conic-gradient(from 225deg, var(--pal-accent) 0 50%, var(--pal-primary) 0 100%); }
.swatch.acc-pal::after {
  content: ""; position: absolute; inset: 8px; border-radius: 50%;
  background: var(--bg); box-shadow: 0 0 0 .5px rgba(var(--ink), .2);
}
.acc-row .swatches { max-width: 360px; }

/* Depth: how far the glass floats above the background. */
html[data-depth="flat"] body { --shadow: 0 1px 2px rgba(0, 0, 0, .07); }
html[data-depth="flat"] .glass { box-shadow: inset 0 1px 0 var(--glass-hi), inset 0 0 0 .5px rgba(var(--ink), .05), var(--shadow); }
html[data-depth="deep"] body { --shadow: 0 34px 90px rgba(0, 0, 0, .62), 0 10px 28px rgba(0, 0, 0, .36), 0 1px 3px rgba(0, 0, 0, .3); }
html[data-theme="light"][data-depth="deep"] body { --shadow: 0 30px 70px rgba(0, 0, 0, .15), 0 9px 24px rgba(0, 0, 0, .08), 0 1px 3px rgba(0, 0, 0, .06); }
@media (prefers-color-scheme: light) {
  html[data-theme="system"][data-depth="deep"] body { --shadow: 0 30px 70px rgba(0, 0, 0, .15), 0 9px 24px rgba(0, 0, 0, .08), 0 1px 3px rgba(0, 0, 0, .06); }
}
html[data-depth="deep"] .tg-hd.today .num, html[data-depth="deep"] .mv-cell.today .mv-num { box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 45%, transparent); }

/* Grid lines of the calendar (only the calendar: the sidebar and sheets keep theirs). */
html[data-grid="none"] .stage { --line: transparent; --line-half: transparent; }
html[data-grid="strong"] .stage { --line: rgba(var(--ink), .15); --line-half: rgba(var(--ink), .075); }

/* Today marker: circle (default), rounded square, or a short accent bar under the date. */
html[data-today="square"] .tg-hd.today .num, html[data-today="square"] .mv-cell.today .mv-num { border-radius: 9px; }
html[data-today="square"] .yd.today, html[data-today="square"] .mini-day.today { border-radius: 7px; }
html[data-today="underline"] .tg-hd.today .num, html[data-today="underline"] .mv-cell.today .mv-num,
html[data-today="underline"] .mini-day.today, html[data-today="underline"] .yd.today {
  background: linear-gradient(var(--accent), var(--accent)) 50% calc(100% - 1px) / 14px 2.5px no-repeat;
  color: var(--accent); box-shadow: none; font-weight: 750;
}
html[data-today="underline"] .mini-day.today, html[data-today="underline"] .yd.today { background-size: 10px 2px; background-position: 50% calc(100% - 2px); }

/* The "now" line: thin line, line + dot (default), or a soft glow. */
html[data-nowc="accent"] body { --now: var(--accent); }
html[data-now="line"] .now-dot { display: none; }
html[data-now="line"] .now-line { border-top-width: 1px; }
html[data-now="glow"] .now-line:not(.faint) {
  border-top-width: 2px;
  box-shadow: 0 0 6px color-mix(in srgb, var(--now) 70%, transparent), 0 0 18px 1px color-mix(in srgb, var(--now) 38%, transparent);
}
html[data-now="glow"] .now-dot {
  width: 12px; height: 12px; left: -6px; top: -7px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--now) 22%, transparent), 0 0 16px 2px color-mix(in srgb, var(--now) 60%, transparent);
}

/* Colour backdrop, slow drift: the two lights move on their own layer (a transform only, on
   the compositor), paused while the window is in the background, still in Battery saver
   and with reduced motion. */
html[data-backdrop="colour"][data-drift="on"] .backdrop {
  background: linear-gradient(155deg, color-mix(in oklab, var(--grad-a) var(--grad-base), var(--bg)), color-mix(in oklab, var(--grad-b) var(--grad-base), var(--bg)));
}
html[data-backdrop="colour"][data-drift="on"] .backdrop::before {
  content: ""; position: absolute; inset: -30%;
  background:
    radial-gradient(75% 53% at 19% 19%, color-mix(in oklab, var(--grad-a) var(--grad-k), transparent), transparent 72%),
    radial-gradient(69% 59% at 81% 81%, color-mix(in oklab, var(--grad-b) var(--grad-k), transparent), transparent 74%);
  animation: grad-drift 64s ease-in-out infinite alternate;
  will-change: transform;
}
@keyframes grad-drift {
  0% { transform: none; }
  35% { transform: translate3d(6%, 3%, 0) rotate(9deg) scale(1.06); }
  70% { transform: translate3d(-3%, 6%, 0) rotate(-6deg) scale(1.1); }
  100% { transform: translate3d(-6%, -2%, 0) rotate(4deg) scale(1.03); }
}
html.idle .backdrop::before { animation-play-state: paused; }
html.low-power .backdrop::before { animation: none; }
@media (prefers-reduced-motion: reduce) { .backdrop::before { animation: none !important; } }

/* ===== Round 13 — glass through switches, launch animation =====
   WebKit blurs only up to a glass panel's nearest "backdrop root" (an ancestor with opacity
   < 1, a filter, a mask, a clip-path …) and paints view-transition snapshots without any
   backdrop-filter. So these never fade, filter or mask an ancestor of the glass: the launch
   blur is a layer above the app, the theme's veil a layer below the panels (ui/launch.rs). */

/* Theme / palette switch: the old background on a veil at the top of .backdrop, opened by a
   widening soft circle (its mask, set by THEME_JS). Under it the new one is there at once
   (no colour fade under the veil, so the circle reads clean); the panels glide over.
   Round 24 — the glide is THEME_JS's own (Web Animations, colours only): the switch sets no
   `transition` here any more, so the elements' own (a sliding sidebar's, a turning icon's)
   carry on through it, and inherited text colour no longer lags level by level. */
.theme-veil { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }

/* Day / week view switch: the "free day" hint is glass inside the sliding stage (which fades):
   it comes in once the stage has settled. */
.tg-hint { animation-delay: .52s; }

/* Launch: Mono comes out of a soft blur. html.launching is set before the first paint
   (index.html / the desktop head), html.launch-out once the app's first frame is on screen. */
#launch { display: none; }
html.launching #launch {
  display: block;
  position: fixed; inset: 0; z-index: 2000;
  pointer-events: none;
  background-color: color-mix(in srgb, var(--bg) 34%, transparent);
  -webkit-backdrop-filter: blur(30px) saturate(150%);
  backdrop-filter: blur(30px) saturate(150%);
}
html.launch-out #launch {
  background-color: color-mix(in srgb, var(--bg) 0%, transparent);
  -webkit-backdrop-filter: blur(0px) saturate(100%);
  backdrop-filter: blur(0px) saturate(100%);
  opacity: 0;
  transition:
    -webkit-backdrop-filter .68s cubic-bezier(.25, .8, .25, 1),
    backdrop-filter .68s cubic-bezier(.25, .8, .25, 1),
    background-color .55s var(--ease),
    opacity .28s linear .5s;
}
/* The app settles from 98.5 % (the background stays put: scaled back up the same amount). */
html.launching .app { transform: scale(.985); }
html.launching .app > .backdrop { transform: scale(1.0153); }
html.launch-out .app, html.launch-out .app > .backdrop { transform: none; transition: transform .8s cubic-bezier(.2, .8, .2, 1); }
html.widget-mode #launch, html.widget-window #launch, html.low-power #launch { display: none !important; }
html.low-power .app, html.low-power .app > .backdrop { transform: none !important; }
@media (prefers-reduced-motion: reduce) {
  html.launching #launch { display: none; }
  html.launching .app, html.launching .app > .backdrop { transform: none; }
}
/* Reduce transparency: a plain fade from the background colour instead of the blur. */
@media (prefers-reduced-transparency: reduce) {
  html.launching #launch { -webkit-backdrop-filter: none; backdrop-filter: none; background-color: var(--bg); }
  html.launch-out #launch { background-color: var(--bg); opacity: 0; transition: opacity .5s var(--ease); }
}

/* ===== Round 13 — Sidebar widgets & sizes ===== */
/* The sidebar is a column: large blocks (or the last of one or two) take its free height. */
.sb-scroll { display: flex; flex-direction: column; }
.sb-scroll > * { flex-shrink: 0; }
.sbw { display: flex; flex-direction: column; min-width: 0; }
.sbw:empty { display: none; }
.sbw.grow { flex-grow: 1; }
.sbw.b-month + .sbw > .sb-section:first-child { margin-top: 6px; }

/* A widget: a soft card inside the sidebar glass (no blur of its own — the glass is behind). */
.wg {
  position: relative;
  display: flex; flex-direction: column; gap: 10px;
  min-width: 0;
  margin: 0 2px 12px;
  padding: 12px 14px 14px;
  border-radius: 18px;
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(255, 255, 255, .07), transparent 60%),
    linear-gradient(160deg, rgba(var(--ink), .06), rgba(var(--ink), .025));
  box-shadow: inset 0 0 0 1px rgba(var(--ink), .07), inset 0 1px 0 rgba(255, 255, 255, .07);
  animation: rise .5s var(--ease) backwards;
}
.sbw.grow > .wg { flex: 1; }
.wg-h {
  display: flex; align-items: center; gap: 7px;
  min-height: 22px; padding-right: 24px;
  font-size: calc(11px * var(--ts, 1)); font-weight: 650; letter-spacing: .06em; text-transform: uppercase;
  color: var(--fg-3);
}
.wg-h .spacer { flex: 1; }
.wg-ic { display: inline-flex; opacity: .85; }
.wg-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wg-tool {
  display: inline-grid; place-items: center; flex: none;
  width: 22px; height: 22px; border-radius: 7px;
  color: var(--fg-3);
  transition: background .2s, color .2s;
}
.wg-tool:hover, .wg-tool.on { background: rgba(var(--ink), .09); color: var(--fg); }
.wg-size {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 22px; height: 22px; border-radius: 7px;
  font-size: calc(10px * var(--ts, 1)); font-weight: 750; letter-spacing: .02em;
  color: var(--fg-3); background: rgba(var(--ink), .08);
  opacity: 0; transform: scale(.8);
  transition: opacity .2s var(--ease), transform .35s var(--spring), background .2s, color .2s;
}
.wg:hover .wg-size, .wg-size:focus-visible { opacity: 1; transform: none; }
.wg-size:hover { background: rgba(var(--ink), .15); color: var(--fg); }
.wg-size:active { transform: scale(.9); }
@media (hover: none) { .wg-size { opacity: .55; transform: none; } }
/* Compact cards have no title row: the size button floats on the corner instead. */
.sz-s .wg-size {
  top: -6px; right: -4px; width: 20px; height: 20px; border-radius: 99px;
  font-size: calc(9.5px * var(--ts, 1));
  background: color-mix(in srgb, var(--bg) 80%, var(--fg) 20%);
  box-shadow: 0 2px 8px -2px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(var(--ink), .1);
}
.wg-empty { font-size: calc(12.5px * var(--ts, 1)); color: var(--fg-3); }

/* Shared rings */
.ring-track { fill: none; stroke: rgba(var(--ink), .09); stroke-width: 6; }
.ring-fill { fill: none; stroke: var(--fg); stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset 1s linear; }

/* ---- Clock ---- */
.wg-clock { align-items: flex-start; gap: 2px; padding: 14px 16px; }
.wg-time {
  font-family: var(--font-display); font-weight: 700; font-size: calc(46px * var(--ts, 1));
  letter-spacing: -.045em; line-height: 1; font-variant-numeric: tabular-nums;
}
.wg-ampm { margin-left: 4px; font-size: .34em; font-weight: 650; letter-spacing: 0; text-transform: uppercase; color: var(--fg-3); }
.wg-date { margin-top: 6px; font-size: calc(13px * var(--ts, 1)); font-weight: 550; color: var(--fg-2); }
.wg-world { display: flex; flex-direction: column; gap: 1px; width: 100%; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); text-align: left; }
.wg-city { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 2px 0; font-size: calc(12.5px * var(--ts, 1)); }
.wc-name { min-width: 0; color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wc-time { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wc-day { margin-left: 3px; font-size: calc(9.5px * var(--ts, 1)); color: var(--fg-3); vertical-align: super; }
.sz-s .wg-clock { flex-direction: row; align-items: baseline; gap: 10px; padding: 11px 14px; }
.sz-s .wg-time { font-size: calc(24px * var(--ts, 1)); letter-spacing: -.03em; }
.sz-s .wg-date { margin: 0; min-width: 0; font-size: calc(12px * var(--ts, 1)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sz-l .wg-clock { align-items: center; justify-content: center; gap: 4px; padding: 20px 16px 18px; text-align: center; }
.sz-l .wg-time { font-size: calc(62px * var(--ts, 1)); }
.sz-l .wg-date { font-size: calc(14px * var(--ts, 1)); }
.sz-l .wg-world { margin-top: 16px; }
.wg-dial { width: 148px; height: 148px; margin-bottom: 16px; overflow: visible; }
.dial-face { fill: rgba(var(--ink), .04); stroke: rgba(var(--ink), .13); stroke-width: 1; }
.dial-tick { stroke: var(--fg-4); stroke-width: 1.4; stroke-linecap: round; }
.dial-tick.major { stroke: var(--fg-2); stroke-width: 2.2; }
.dial-h { stroke: var(--fg); stroke-width: 4.2; stroke-linecap: round; }
.dial-m { stroke: var(--fg); stroke-width: 2.4; stroke-linecap: round; }
.dial-pin { fill: var(--accent); stroke: var(--bg); stroke-width: 1.2; }

/* ---- Focus timer ---- */
.wf-body { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.sbw.grow > .wg .wf-body { flex: 1; justify-content: center; }
.wf-ring { position: relative; width: 136px; height: 136px; }
.wf-ring svg { display: block; width: 100%; height: 100%; }
.wg-focus .ring-fill { stroke: var(--accent); }
.wg-focus.break .ring-fill { stroke: color-mix(in srgb, var(--fg) 60%, transparent); }
.wf-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.wf-phase { font-size: calc(10.5px * var(--ts, 1)); font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-3); }
.wf-time { font-family: var(--font-display); font-size: calc(31px * var(--ts, 1)); font-weight: 700; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.wf-rounds { font-size: calc(11px * var(--ts, 1)); color: var(--fg-3); font-variant-numeric: tabular-nums; }
.wf-ctl { display: flex; align-items: center; gap: 8px; }
.wf-btn { display: inline-grid; place-items: center; flex: none; border-radius: 99px; transition: transform .35s var(--spring), background .2s, filter .2s, color .2s; }
.wf-btn:active { transform: scale(.9); }
.wf-btn.main { width: 44px; height: 44px; background: var(--accent); color: var(--on-accent); box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .45); }
.wf-btn.main:hover { filter: brightness(1.08); }
.wf-btn.ghost { width: 34px; height: 34px; color: var(--fg-2); background: rgba(var(--ink), .08); animation: pop .35s var(--spring) backwards; }
.wf-btn.ghost:hover { background: rgba(var(--ink), .14); color: var(--fg); }
/* Running: the ring breathes softly (only while you look, never in Battery saver). */
.wg-focus.running .wf-ring svg { animation: wf-breathe 4s ease-in-out infinite; }
@keyframes wf-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.025); } }
html.idle .wg-focus.running .wf-ring svg { animation-play-state: paused; }
html.low-power .ring-fill, html.low-power .wp-fill, html.low-power .ww-fill { transition: none; }
@media (prefers-reduced-motion: reduce) { .wg-focus.running .wf-ring svg { animation: none; } .ring-fill { transition: none; } }
.sz-s .wf-body { flex-direction: row; gap: 11px; }
.sz-s .wf-ring { width: 34px; height: 34px; }
.sz-s .wf-ring .ring-track, .sz-s .wf-ring .ring-fill { stroke-width: 12; }
.wf-inline { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.wf-inline .wf-time { font-size: calc(21px * var(--ts, 1)); }
.wf-inline .wf-phase { font-size: calc(10px * var(--ts, 1)); }
.sz-s .wf-btn.main { width: 34px; height: 34px; }
.sz-s .wf-btn.ghost { width: 28px; height: 28px; }
.sz-s .wg-focus .wg-h { display: none; }
.sz-l .wf-ring { width: 188px; height: 188px; }
.sz-l .wf-time { font-size: calc(44px * var(--ts, 1)); }
.sz-l .wf-phase { font-size: calc(11.5px * var(--ts, 1)); }
.sz-l .wf-ring .ring-track, .sz-l .wf-ring .ring-fill { stroke-width: 4.5; }
.sz-l .wf-btn.main { width: 52px; height: 52px; }
.wf-tune { display: flex; flex-direction: column; gap: 5px; padding-top: 10px; border-top: 1px solid var(--line); animation: rise .3s var(--ease) backwards; }
.wg-step { display: flex; align-items: center; gap: 6px; font-size: calc(12.5px * var(--ts, 1)); }
.ws-label { flex: 1; min-width: 0; color: var(--fg-2); }
.ws-btn { width: 24px; height: 24px; border-radius: 8px; font-size: calc(15px * var(--ts, 1)); line-height: 1; color: var(--fg-2); background: rgba(var(--ink), .07); transition: background .2s, color .2s, transform .3s var(--spring); }
.ws-btn:hover:not(:disabled) { background: rgba(var(--ink), .14); color: var(--fg); }
.ws-btn:active:not(:disabled) { transform: scale(.88); }
.ws-btn:disabled { opacity: .35; }
.ws-val { min-width: 56px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- Countdown ---- */
.wc-target { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; text-align: left; font-size: calc(14px * var(--ts, 1)); font-weight: 650; }
.wc-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wc-target:hover .wc-title { text-decoration: underline; text-decoration-color: rgba(var(--ink), .3); text-underline-offset: 3px; }
.wc-short { font-size: calc(12.5px * var(--ts, 1)); font-weight: 600; color: var(--fg-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.wc-digits { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.wc-cell {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 0 8px; border-radius: 12px;
  background: rgba(var(--ink), .06);
  box-shadow: inset 0 0 0 1px rgba(var(--ink), .05), inset 0 1px 0 rgba(255, 255, 255, .05);
}
.wc-num { font-family: var(--font-display); font-size: calc(26px * var(--ts, 1)); font-weight: 700; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.wc-unit { font-size: calc(9.5px * var(--ts, 1)); font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-3); }
.wc-when { font-size: calc(12px * var(--ts, 1)); color: var(--fg-3); }
.wc-reached { display: flex; align-items: center; gap: 7px; font-size: calc(15px * var(--ts, 1)); font-weight: 650; animation: pop .5s var(--spring) backwards; }
.sz-s .wg-countdown { gap: 6px; padding: 10px 14px 11px; }
.sz-l .wg-countdown .wc-target { font-size: calc(16px * var(--ts, 1)); }
.sz-l .wc-num { font-size: calc(40px * var(--ts, 1)); }
.sz-l .wc-cell { padding: 16px 0 13px; border-radius: 15px; }
.sbw.grow > .wg-countdown { justify-content: center; }
.sbw.grow > .wg-countdown > .wg-h { position: absolute; top: 12px; left: 14px; right: 14px; }
.wc-form { display: flex; flex-direction: column; gap: 6px; animation: rise .3s var(--ease) backwards; }
.wc-row { display: flex; gap: 6px; }
.wc-row.end { justify-content: flex-end; align-items: center; gap: 12px; margin-top: 2px; }
.wc-in {
  flex: 1; min-width: 0; height: 30px; padding: 0 9px;
  border: 0; outline: 0; border-radius: 9px;
  font: inherit; font-size: calc(12.5px * var(--ts, 1)); color: var(--fg);
  background: rgba(var(--ink), .07);
  box-shadow: inset 0 0 0 1px rgba(var(--ink), .06);
  transition: box-shadow .2s;
}
.wc-in::placeholder { color: var(--fg-4); }
.wc-in:focus { box-shadow: inset 0 0 0 1.5px rgba(var(--ink), .32); }
.wc-save { height: 28px; padding: 0 14px; border-radius: 99px; font-size: calc(12.5px * var(--ts, 1)); font-weight: 650; background: var(--accent); color: var(--on-accent); transition: transform .3s var(--spring), filter .2s; }
.wc-save:hover { filter: brightness(1.08); }
.wc-save:active { transform: scale(.94); }

/* ---- Progress ---- */
.wg-progress .r0 { --rc: var(--accent); }
.wg-progress .r1 { --rc: var(--fg); }
.wg-progress .r2 { --rc: color-mix(in srgb, var(--fg) 62%, transparent); }
.wg-progress .r3 { --rc: color-mix(in srgb, var(--fg) 38%, transparent); }
.wg-progress .ring-fill { stroke: var(--rc); transition: stroke-dashoffset .9s var(--ease); }
.wp-bars { display: flex; flex-direction: column; gap: 7px; }
.wp-bar { display: grid; grid-template-columns: minmax(0, 62px) 1fr 36px; align-items: center; gap: 8px; font-size: calc(11.5px * var(--ts, 1)); }
.wp-label { min-width: 0; color: var(--fg-2); font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wp-track { height: 6px; border-radius: 99px; background: rgba(var(--ink), .09); overflow: hidden; }
.wp-fill { display: block; height: 100%; border-radius: inherit; background: var(--rc); transition: width .9s var(--ease); }
.wp-pct { text-align: right; font-weight: 600; color: var(--fg-3); font-variant-numeric: tabular-nums; }
.wp-rings { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.wp-one { display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.wp-dial { position: relative; width: 52px; height: 52px; }
.wp-dial svg { display: block; width: 100%; height: 100%; }
.wp-one .ring-track, .wp-one .ring-fill { stroke-width: 9; }
.wp-in { position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(10.5px * var(--ts, 1)); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.wp-one .wp-label { max-width: 100%; font-size: calc(11px * var(--ts, 1)); color: var(--fg-3); }
.wp-big { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.sbw.grow > .wg .wp-big { flex: 1; justify-content: center; }
.wp-nest { width: 180px; height: 180px; }
.wp-nest .ring-track, .wp-nest .ring-fill { stroke-width: 13; }
.wp-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; width: 100%; }
.wp-key { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: calc(12.5px * var(--ts, 1)); }
.wp-key .wp-label { flex: 1; }
.wp-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--rc); box-shadow: inset 0 0 0 1px rgba(var(--ink), .1); }

/* ---- Moon ---- */
.wm-body { display: flex; align-items: center; gap: 14px; min-width: 0; }
.sbw.grow > .wg .wm-body { flex: 1; justify-content: center; }
.wm-disc { width: 66px; height: 66px; flex: none; overflow: visible; filter: drop-shadow(0 0 16px rgba(var(--ink), .14)); }
.wm-dark { fill: rgba(var(--ink), .1); }
.wm-lit { fill: var(--fg); opacity: .92; }
.wm-rim { fill: none; stroke: rgba(var(--ink), .18); stroke-width: 1; }
.wm-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wm-name { font-size: calc(14.5px * var(--ts, 1)); font-weight: 650; line-height: 1.25; }
.wm-lit-pct { margin-bottom: 4px; font-size: calc(12px * var(--ts, 1)); color: var(--fg-3); }
.wm-next { display: flex; align-items: center; gap: 6px; font-size: calc(12px * var(--ts, 1)); color: var(--fg-2); }
.sz-s .wg-moon { padding: 10px 14px; }
.sz-s .wm-disc { width: 32px; height: 32px; }
.sz-s .wm-body { gap: 11px; }
.sz-s .wm-name { font-size: calc(13px * var(--ts, 1)); }
.sz-s .wm-lit-pct { margin: 0; font-size: calc(11.5px * var(--ts, 1)); }
.sz-l .wm-body { flex-direction: column; gap: 14px; text-align: center; }
.sz-l .wm-disc { width: 136px; height: 136px; filter: drop-shadow(0 0 30px rgba(var(--ink), .18)); }
.sz-l .wm-text { align-items: center; }
.sz-l .wm-name { font-size: calc(18px * var(--ts, 1)); }
.wm-list { display: flex; flex-direction: column; gap: 1px; padding-top: 10px; border-top: 1px solid var(--line); }
.wm-list-h { padding-bottom: 4px; font-size: calc(10.5px * var(--ts, 1)); font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-3); }
.wm-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: calc(12.5px * var(--ts, 1)); }
.wm-row-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wm-row-when { color: var(--fg-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- Quick note: faintly ruled paper ---- */
.wn-text {
  display: block; width: 100%; min-height: 0; padding: 0;
  border: 0; outline: 0; resize: none;
  font: inherit; font-size: calc(13px * var(--ts, 1)); line-height: 21px; color: var(--fg);
  background: repeating-linear-gradient(to bottom, transparent 0 20px, rgba(var(--ink), .08) 20px 21px);
  background-attachment: local;
}
.wn-text::placeholder { color: var(--fg-4); }
.sbw.grow > .wg-note .wn-text { flex: 1; }

/* ---- Week at a glance ---- */
.ww-total { font-size: calc(10.5px * var(--ts, 1)); font-weight: 600; letter-spacing: .01em; text-transform: none; color: var(--fg-3); white-space: nowrap; }
.ww-cols { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.ww-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 5px; min-width: 0; padding: 4px 0 5px; border-radius: 10px; transition: background .2s, transform .3s var(--spring); }
.ww-col:hover { background: rgba(var(--ink), .06); }
.ww-col:active { transform: scale(.94); }
.ww-bar { position: relative; display: flex; align-items: flex-end; width: 100%; max-width: 20px; height: 56px; border-radius: 7px; background: rgba(var(--ink), .07); overflow: hidden; }
.ww-fill { display: block; width: 100%; border-radius: 7px; background: color-mix(in srgb, var(--fg) 55%, transparent); transition: height .7s var(--ease); }
.ww-col.today .ww-fill { background: var(--accent); }
.ww-col.past { opacity: .55; }
.ww-wd { font-size: calc(10.5px * var(--ts, 1)); font-weight: 650; color: var(--fg-3); }
.ww-day { font-size: calc(12px * var(--ts, 1)); font-weight: 600; font-variant-numeric: tabular-nums; color: var(--fg-2); }
.ww-col.today .ww-wd, .ww-col.today .ww-day { color: var(--fg); }
.ww-n { min-height: 13px; font-size: calc(10.5px * var(--ts, 1)); font-weight: 600; color: var(--fg-3); font-variant-numeric: tabular-nums; }
.sz-s .ww-bar { height: 26px; max-width: 16px; }
.sz-s .ww-col { gap: 4px; padding: 2px 0 3px; }
.sz-l .ww-bar { height: 120px; max-width: 24px; border-radius: 9px; }
.sz-l .ww-fill { border-radius: 9px; }
.sbw.grow > .wg-week .ww-cols { flex: 1; }
.sbw.grow > .wg-week .ww-bar { flex: 1; max-height: 280px; }

/* ---- The classic blocks in S / M / L ---- */
.sz-s .hero { gap: 7px; padding: 10px 12px; }
.sz-s .hero-greet, .sz-s .hero-world, .sz-s .hero-chips { display: none; }
.sz-s .hero-date { font-size: calc(16px * var(--ts, 1)); }
.sz-s .hero-focus { padding: 7px 10px 7px 12px; }
.sz-l .hero { gap: 14px; padding: 18px 16px 16px; }
.sz-l .hero-greet { font-size: calc(14px * var(--ts, 1)); }
.sz-l .hero-date { font-size: calc(25px * var(--ts, 1)); }
.sz-l .hero-focus { padding: 12px 14px 12px 16px; }
.sz-l .hero-focus-title { font-size: calc(16px * var(--ts, 1)); }
.sbw.grow .hero { flex: 1; }
.sbw.grow .hero > .hero-focus, .sbw.grow .hero > .hero-free { margin-top: auto; }
.sz-s .mini-day { height: 24px; font-size: calc(11px * var(--ts, 1)); border-radius: 7px; }
.sz-s .mini-wd { padding-bottom: 2px; font-size: calc(9.5px * var(--ts, 1)); }
.sz-s .mini-day.busy::after { bottom: 2px; }
.sz-l .mini-title { font-size: calc(15px * var(--ts, 1)); }
.sz-l .mini-day { height: 38px; font-size: calc(13.5px * var(--ts, 1)); border-radius: 11px; }
.sz-l .mini-day.today, .sz-l .mini-day.anchor { border-radius: 11px; }
.sz-l .mini-day.busy::after { bottom: 5px; width: 4px; height: 4px; margin-left: -2px; }
/* A month that fills the sidebar: its rows share the height. */
.sbw.grow > .mini { flex: 1; display: flex; flex-direction: column; }
.sbw.grow > .mini > .fold:not(.shut) { flex: 1; grid-template-rows: 1fr; }
.sbw.grow > .mini > .fold:not(.shut) > .fold-inner { display: flex; flex-direction: column; }
.sbw.grow > .mini .mini-grid { flex: 1; grid-template-rows: auto; grid-auto-rows: minmax(30px, 46px); align-content: space-evenly; }
.sbw.grow > .mini .mini-day { height: 100%; }
.sz-s .un-item { padding: 4px 6px; font-size: calc(12.5px * var(--ts, 1)); }
.sz-l .un-item { padding: 8px 6px; font-size: calc(13.5px * var(--ts, 1)); }
.sz-s .sb-hint { display: none; }
.sz-s .task-meta .est { display: none; }
.sz-s .cf-item { min-height: 0; }
.sz-s .cat-filter .cf-main { padding-top: 3px; padding-bottom: 3px; }
.sz-l .cat-filter .cf-main { padding-top: 7px; padding-bottom: 7px; font-size: calc(13.5px * var(--ts, 1)); }

/* Settings → Customization → Sidebar: S / M / L next to each switch. */
.srow.block .srow-ctl { display: flex; align-items: center; gap: 10px; }
.sz-segs .segmented.small { width: 96px; min-width: 0; }
.sz-segs .segmented.small .seg { padding: 0; font-size: calc(11px * var(--ts, 1)); font-weight: 650; letter-spacing: .02em; }
.srow.block.is-off .srow-title, .srow.block.is-off .srow-ic { opacity: .5; }
.sz-desc { margin-top: 8px; }

/* ===== Round 13 — palettes (Wood, your own palettes) ===== */
/* "Your palettes": the user's own cards, an edit button on each, a "Create palette" card. */
.pal-sub {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  margin: 20px 4px 0;
  font-size: calc(11px * var(--ts, 1)); font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-3);
}
.pal-sub-note { font-size: calc(11px * var(--ts, 1)); font-weight: 500; letter-spacing: 0; text-transform: none; }
.pal-card.own { position: relative; }
.pal-pick { display: flex; flex-direction: column; gap: 9px; width: 100%; text-align: left; color: inherit; }
.pal-pick:active { transform: scale(.97); transition: transform .3s var(--spring); }
.pal-card.own:hover .pal-prev { transform: translateY(-2px); }
.pal-card.own.editing .pal-prev { outline-color: var(--primary); box-shadow: 0 0 0 1px var(--line-2), 0 10px 30px color-mix(in srgb, var(--primary) 30%, transparent); }
.pal-edit {
  position: absolute; top: 7px; right: 7px;
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--fg);
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  -webkit-backdrop-filter: blur(12px) saturate(1.5); backdrop-filter: blur(12px) saturate(1.5);
  box-shadow: inset 0 0 0 .5px rgba(var(--ink), .2), 0 3px 10px rgba(0, 0, 0, .2);
  opacity: 0; transform: scale(.8);
  transition: opacity .2s var(--ease), transform .35s var(--spring), background .2s;
}
.pal-card.own:hover .pal-edit, .pal-card.own.on .pal-edit, .pal-card.own.editing .pal-edit, .pal-edit:focus-visible { opacity: 1; transform: none; }
.pal-card.own.editing .pal-edit { color: var(--on-primary); background: var(--primary); }
@media (hover: none) { .pal-edit { opacity: 1; transform: none; } }
.pal-dots { display: flex; gap: 4px; padding-top: 2px; }
.pal-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--d); box-shadow: inset 0 0 0 .5px rgba(var(--ink), .3); }

.pal-new { color: var(--fg); }
.pal-prev.pal-new-prev {
  display: grid; place-items: center;
  background: rgba(var(--ink), .025);
  box-shadow: inset 0 0 0 1.5px rgba(var(--ink), .14);
}
.pal-new-prev::before {
  content: ""; position: absolute; inset: -40%;
  background: conic-gradient(from 210deg, #6366F1, #14B8A6, #B49A3C, #F59E0B, #EC4899, #A855F7, #6366F1);
  filter: blur(26px); opacity: .2;
  transition: opacity .35s var(--ease), transform 1.2s var(--ease);
}
.pal-new:hover .pal-new-prev::before { opacity: .36; transform: rotate(40deg); }
.pal-new-plus {
  position: relative;
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--on-primary); background: var(--primary);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 42%, transparent), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: transform .45s var(--spring);
}
.pal-new:hover .pal-new-plus { transform: scale(1.08) rotate(90deg); }
.pal-new:active .pal-new-plus { transform: scale(.92); }

/* The editor: a live preview, the name, the colours, surface and contrast. */
.pe {
  margin-top: 16px; padding: 16px;
  border-radius: 18px;
  background: rgba(var(--ink), .04);
  box-shadow: inset 0 0 0 .5px rgba(var(--ink), .12);
  animation: pe-in .5s var(--spring) both;
}
@keyframes pe-in { from { opacity: 0; transform: translateY(-8px) scale(.985); } }
.pe-top { display: grid; grid-template-columns: minmax(150px, 220px) 1fr; align-items: center; gap: 18px; }
.pe-stage .pal-prev { box-shadow: 0 0 0 1px var(--line-2), 0 16px 36px rgba(0, 0, 0, .3); }
.pe-top-main { min-width: 0; }
.pe-name {
  width: 100%; padding: 2px 0 7px;
  border: 0; border-bottom: 1px solid rgba(var(--ink), .14); border-radius: 0;
  background: none; outline: 0;
  font: inherit; font-size: calc(19px * var(--ts, 1)); font-weight: 650; letter-spacing: -.012em; color: var(--fg);
  user-select: text;
  transition: border-color .2s var(--ease);
}
.pe-name::placeholder { color: var(--fg-4); }
.pe-name:focus { border-bottom-color: var(--primary); }
.pe-note { margin: 8px 0 12px; font-size: calc(12px * var(--ts, 1)); line-height: 1.38; color: var(--fg-3); }
.pe-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pe-btn {
  height: 30px; padding: 0 12px; border-radius: 99px;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: calc(12.5px * var(--ts, 1)); font-weight: 600; color: var(--fg-2);
  background: rgba(var(--ink), .07);
  transition: background .2s, color .2s, transform .3s var(--spring);
}
.pe-btn:hover { background: rgba(var(--ink), .12); color: var(--fg); }
.pe-btn:active { transform: scale(.95); }
.pe-btn:disabled { opacity: .4; pointer-events: none; }
.pe-btn.danger:hover { color: var(--now); background: color-mix(in srgb, var(--now) 13%, transparent); }
.pe-btn.primary { margin-left: auto; padding: 0 16px; color: var(--on-primary); background: var(--primary); box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 32%, transparent); }
.pe-btn.primary:hover { filter: brightness(1.06); }
.pe-rows { margin-top: 14px; }
.pe-row {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 10px 18px; padding: 12px 2px;
  border-top: 1px solid var(--line);
}
.pe-row-text { min-width: 120px; }
.pe-row-title { font-size: calc(13.5px * var(--ts, 1)); font-weight: 600; color: var(--fg); }
.pe-row-desc { margin-top: 2px; font-size: calc(11.5px * var(--ts, 1)); color: var(--fg-3); }
.pe-sws { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pe-sw {
  position: relative; flex: none;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--sw);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14), inset 0 1px 0 rgba(255, 255, 255, .25);
  outline: 2px solid transparent; outline-offset: 2px;
  transition: transform .35s var(--spring), outline-color .2s var(--ease);
  cursor: pointer;
}
.pe-sw:hover { transform: scale(1.14); }
.pe-sw:active { transform: scale(.92); }
.pe-sw.on { outline-color: var(--fg-2); }
/* The system picker: a rainbow ring; once chosen, the colour sits in its middle. */
.pe-sw.own { background: conic-gradient(#FF6B6B, #FFC56B, #E9F06B, #6BE3A8, #6BC8FF, #8B7BFF, #F06BD0, #FF6B6B); }
.pe-sw.own::after {
  content: ""; position: absolute; inset: 5px; border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .08);
  pointer-events: none;
}
.pe-sw.own.on::after { background: var(--sw); box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .9); }
.pe-seg { min-width: 200px; }

/* "Palette deleted · Undo" */
.pal-undo {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 14px; padding: 7px 7px 7px 14px;
  border-radius: 14px;
  font-size: calc(12.5px * var(--ts, 1)); color: var(--fg-2);
  background: rgba(var(--ink), .06);
  animation: pe-in .4s var(--spring) both;
}
.pal-undo button {
  height: 28px; padding: 0 14px; border-radius: 99px;
  font-size: calc(12.5px * var(--ts, 1)); font-weight: 650; color: var(--primary);
  background: color-mix(in srgb, var(--primary) 14%, transparent);
}
@media (max-width: 560px) {
  .pe-top { grid-template-columns: 1fr; }
  .pe-stage { max-width: 260px; }
  .pe-seg { min-width: 0; flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .pe, .pal-undo { animation: none; }
  .pal-new-prev::before { transition: none; }
}

/* ===== Round 13 — Effects (Settings → Effects; drawn by src/ui/effects.js) ===== */
/* The field lies inside .backdrop, under the glass; the top layer lies over the app. Neither
   takes clicks, and each fades by its own opacity (never on an ancestor of the glass). */
.fx-field { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0; transition: opacity 1.2s var(--ease); }
.fx-field.on { opacity: 1; }
.fx-top { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 400; pointer-events: none; opacity: 0; transition: opacity .8s var(--ease); }
.fx-top.on { opacity: 1; }
html.low-power .fx-field, html.low-power .fx-top { display: none; }
@media (prefers-reduced-motion: reduce) { .fx-field, .fx-top { display: none; } }
@media print { .fx-field, .fx-top { display: none !important; } }

/* The four effects as cards, each a small picture of itself. */
.fx-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
@media (max-width: 640px) { .fx-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fx-card { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 7px; border-radius: 15px; transition: background .2s, transform .3s var(--spring); }
.fx-card:hover { background: rgba(var(--ink), .05); }
.fx-card:active { transform: scale(.97); }
.fx-art {
  position: relative; width: 100%; aspect-ratio: 4 / 3; overflow: hidden;
  display: grid; grid-template-columns: 30% 1fr; gap: 5px; padding: 7px;
  border-radius: 12px;
  background: radial-gradient(circle at 15% 0%, var(--blob1), transparent 60%), radial-gradient(circle at 100% 100%, var(--blob2), transparent 55%), var(--bg);
  box-shadow: inset 0 0 0 1px var(--line-2);
  outline: 2px solid transparent; outline-offset: 3px;
  transition: outline-color .25s;
}
.fx-card.on .fx-art { outline-color: var(--primary); }
.fx-art-p { position: relative; border-radius: 6px; background: var(--glass-tint); box-shadow: inset 0 0 0 .5px rgba(var(--ink), .12); transition: transform .45s var(--spring); }
.fx-card:hover .fx-art-p.main { transform: translateY(-1.5px); }
.fx-art-glint { position: absolute; inset: 0; pointer-events: none; transition: transform .6s var(--ease), opacity .4s; }
.fx-name { font-size: calc(12.5px * var(--ts, 1)); font-weight: 600; color: var(--fg-2); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fx-card.on .fx-name { color: var(--fg); }
.fx-card.fx-off .fx-art-p { opacity: .8; }

.fx-card.fx-water .fx-art {
  background:
    radial-gradient(120% 80% at 20% 0%, rgba(160, 215, 228, .32), transparent 60%),
    repeating-radial-gradient(circle at 70% 30%, transparent 0 9px, rgba(220, 245, 250, .1) 10px 11px, transparent 12px 20px),
    linear-gradient(165deg, #1d3a44, #0c1a20);
}
.fx-card.fx-water .fx-art-p { background: rgba(255, 255, 255, .07); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 -2px 0 rgba(200, 235, 245, .22), inset 0 0 0 .5px rgba(200, 235, 245, .3); }
/* Drops on the glass: clear bodies, a dark rim, a sharp highlight. */
.fx-card.fx-water .fx-art-glint {
  background:
    radial-gradient(1.2px 1.2px at 26.5% 77.5%, #fff 60%, transparent),
    radial-gradient(4px 4px at 27% 79%, rgba(255, 255, 255, .06) 55%, rgba(0, 15, 25, .55) 80%, transparent 95%),
    radial-gradient(1px 1px at 92.6% 40.4%, #fff 60%, transparent),
    radial-gradient(3.2px 3.2px at 93% 42%, rgba(255, 255, 255, .06) 55%, rgba(0, 15, 25, .55) 80%, transparent 95%),
    radial-gradient(2.2px 2.2px at 71% 90%, rgba(255, 255, 255, .08) 50%, rgba(0, 15, 25, .5) 80%, transparent 95%),
    linear-gradient(transparent 0 90%, rgba(200, 235, 245, .18) 90% 93%, transparent 93%);
}
.fx-card.fx-magic .fx-art {
  background:
    radial-gradient(60% 50% at 72% 30%, rgba(139, 131, 166, .34), transparent 60%),
    radial-gradient(80% 70% at 15% 85%, rgba(80, 72, 104, .4), transparent 60%),
    radial-gradient(120% 100% at 50% 50%, transparent 45%, rgba(0, 0, 0, .85) 100%),
    #0b0a0e;
}
.fx-card.fx-magic .fx-art-p { background: rgba(255, 255, 255, .05); box-shadow: inset 0 0 0 .5px rgba(200, 195, 220, .25), inset 0 0 8px rgba(0, 0, 0, .7), 0 0 14px 3px rgba(0, 0, 0, .9); }
/* Ink curling off the panels, a faint violet spark and an ember. */
.fx-card.fx-magic .fx-art-glint {
  background:
    radial-gradient(1.2px 1.2px at 88% 14%, rgba(196, 170, 255, .95), transparent),
    radial-gradient(1px 1px at 12% 70%, rgba(255, 150, 90, .9), transparent),
    radial-gradient(40% 26% at 30% 100%, rgba(165, 160, 185, .3), transparent 70%),
    radial-gradient(32% 20% at 86% 0%, rgba(165, 160, 185, .24), transparent 70%),
    radial-gradient(18% 14% at 8% 30%, rgba(165, 160, 185, .2), transparent 70%);
}
.fx-card.fx-storm .fx-art {
  background:
    radial-gradient(60% 50% at 62% 40%, rgba(139, 92, 246, .55), transparent 65%),
    conic-gradient(from 210deg at 60% 45%, #12061f, #3b1a6b, #0c0416, #4c1d95, #170a2a, #12061f);
}
.fx-card.fx-storm .fx-art-p { background: rgba(255, 255, 255, .05); box-shadow: inset 0 0 0 1px rgba(196, 160, 255, .6), 0 0 10px rgba(139, 92, 246, .6); }
.fx-card.fx-storm .fx-art-glint {
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 75' preserveAspectRatio='none'><path d='M44 9.5 L50 6 L54 10 L61 6.5 L66 9.5 L73 6' fill='none' stroke='%23b794ff' stroke-opacity='.5' stroke-width='4' stroke-linejoin='round' stroke-linecap='round'/><path d='M44 9.5 L50 6 L54 10 L61 6.5 L66 9.5 L73 6' fill='none' stroke='%23f3ecff' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round'/><circle cx='86' cy='14' r='1.2' fill='%23e9dcff'/><circle cx='80' cy='3.5' r='.9' fill='%23e9dcff'/></svg>") center / 100% 100% no-repeat;
}
.fx-card:hover .fx-art-glint { transform: translateY(-1px) scale(1.02); }

/* The live preview: a tiny app (two glass panels) the effect plays on; press it to try. */
.fx-preview {
  position: relative; height: 172px; overflow: hidden;
  display: grid; grid-template-columns: 30% 1fr; gap: 10px; padding: 14px 14px 32px;
  margin: 2px 0 10px; border-radius: 16px;
  background:
    radial-gradient(circle at 12% 0%, var(--blob1), transparent 62%),
    radial-gradient(circle at 100% 100%, var(--blob2), transparent 58%),
    radial-gradient(circle at 60% 40%, var(--blob3), transparent 60%),
    var(--bg);
  box-shadow: inset 0 0 0 1px var(--line-2);
  cursor: pointer;
}
.fx-prev-bg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.fx-mini {
  position: relative; min-width: 0;
  display: flex; flex-direction: column; gap: 8px; padding: 12px 10px;
  border-radius: 12px;
  background: var(--glass-tint);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 var(--glass-hi);
}
.fx-mini-line { height: 6px; border-radius: 3px; background: rgba(var(--ink), .14); }
.fx-mini-line.w70 { width: 70%; } .fx-mini-line.w60 { width: 60%; } .fx-mini-line.w45 { width: 45%; } .fx-mini-line.w35 { width: 35%; }
.fx-mini-ev { position: absolute; left: 12px; height: 18px; border-radius: 6px; background: color-mix(in srgb, var(--fx-c) 28%, transparent); box-shadow: inset 2px 0 0 var(--fx-c); }
.fx-mini-ev.a { top: 14px; width: 42%; }
.fx-mini-ev.b { top: 42px; left: 38%; width: 34%; }
.fx-mini-ev.c { top: 72px; width: 26%; }
.fx-mini-btn {
  position: absolute; right: 12px; bottom: 12px;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary); color: var(--on-primary);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--fx-c) 50%, transparent);
  transition: transform .25s var(--spring);
}
.fx-mini-btn:hover { transform: scale(1.06); }
.fx-mini-btn:active { transform: scale(.9); }
.fx-try { position: absolute; left: 0; right: 0; bottom: 9px; text-align: center; font-size: calc(11.5px * var(--ts, 1)); color: var(--fg-3); pointer-events: none; }
.fx-about { margin: 0 4px 4px; font-size: calc(12.5px * var(--ts, 1)); line-height: 1.45; color: var(--fg-2); }
.fx-foot { display: flex; justify-content: flex-end; margin: -2px 0 10px; }
.fx-foot .ghost-btn { display: inline-flex; align-items: center; gap: 6px; }
.fx-notes { display: flex; flex-direction: column; gap: 6px; margin: 4px 4px 8px; }
.fx-note { display: flex; gap: 7px; align-items: flex-start; font-size: calc(12px * var(--ts, 1)); line-height: 1.4; color: var(--fg-3); }
.fx-note .icon { margin-top: 2px; opacity: .8; }
.fx-reduced { display: none; }
@media (prefers-reduced-motion: reduce) { .fx-reduced { display: flex; } }

/* ===== Round 13 — Settings: structure, search, action cards ===== */
/* The tabs: search on top, then three groups (how Mono looks · the calendar · your data). */
.set-nav { min-height: 0; }
.set-tabs { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 1px; overflow-y: auto; scrollbar-width: none; }
.set-tabs::-webkit-scrollbar { display: none; }
.set-tab { flex: none; }
/* A little wider for "Reminders & sounds"; a long name (or large text) wraps rather than being cut. */
@media (min-width: 641px) {
  .settings { grid-template-columns: 228px minmax(0, 1fr); }
  .set-tab { height: auto; min-height: 36px; padding-top: 5px; padding-bottom: 5px; }
  .set-tab-name { min-width: 0; line-height: 1.2; overflow-wrap: anywhere; }
}
.set-tab-gap { flex: none; height: 1px; margin: 7px 12px; background: rgba(var(--ink), .075); }

.set-search {
  position: relative; flex: none;
  display: flex; align-items: center; gap: 7px;
  height: 32px; margin: 0 2px 12px; padding: 0 6px 0 10px;
  border-radius: 10px;
  background: rgba(var(--ink), .065);
  box-shadow: inset 0 0 0 .5px rgba(var(--ink), .07);
  color: var(--fg-3);
  transition: background .25s var(--ease), box-shadow .25s var(--ease), color .2s;
}
.set-search:hover { background: rgba(var(--ink), .09); }
.set-search:focus-within {
  background: rgba(var(--ink), .045); color: var(--fg-2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 28%, transparent), inset 0 0 0 1px color-mix(in srgb, var(--primary) 55%, transparent);
}
.set-search > .icon { flex: none; transition: transform .35s var(--spring); }
.set-search:focus-within > .icon, .set-search.on > .icon { transform: scale(1.08); color: var(--fg-2); }
.set-search input {
  flex: 1; min-width: 0; height: 100%; padding: 0;
  border: 0; outline: 0; background: transparent; color: var(--fg);
  font: inherit; font-size: calc(13px * var(--ts, 1)); letter-spacing: -.005em;
  -webkit-appearance: none; appearance: none;
}
.set-search input::placeholder { color: var(--fg-3); opacity: 1; }
.set-search input::-webkit-search-cancel-button, .set-search input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.set-search-x {
  flex: none; width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(var(--ink), .2); color: var(--bg);
  transition: background .2s, transform .25s var(--spring);
  animation: sr-pop .3s var(--spring) both;
}
.set-search-x:hover { background: rgba(var(--ink), .34); }
.set-search-x:active { transform: scale(.88); }
.set-head-q { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Results (in place of the tab's page) ---- */
.sr-content { padding-top: 4px; }
.sr-list { display: flex; flex-direction: column; animation: sr-in .28s var(--ease) both; }
.sr-group-head {
  display: flex; align-items: center; gap: 8px;
  margin: 14px 4px 7px;
  font-size: calc(12.5px * var(--ts, 1)); font-weight: 650; color: var(--fg-2);
}
.sr-group:first-child .sr-group-head { margin-top: 2px; }
.sr-group-head .set-tab-ic { width: 18px; height: 18px; border-radius: 5px; }
.sr-card { padding: 4px; margin-bottom: 4px; }
.sr-row {
  width: 100%; min-height: 48px;
  display: flex; align-items: center; gap: 12px;
  padding: 7px 8px 7px 10px; border-radius: 10px;
  text-align: left; color: var(--fg); cursor: pointer;
  transition: background .18s var(--ease);
}
.sr-row + .sr-row { margin-top: 1px; }
.sr-row.on { background: color-mix(in srgb, var(--primary) 14%, transparent); }
.sr-row:active { background: color-mix(in srgb, var(--primary) 20%, transparent); }
.sr-row:focus-visible { outline: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 50%, transparent); }
.sr-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sr-title { font-size: calc(14px * var(--ts, 1)); font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-title mark {
  color: inherit; border-radius: 4px; padding: 0 1px; margin: 0 -1px;
  background: color-mix(in srgb, var(--primary) 26%, transparent);
}
.sr-sub { font-size: calc(12px * var(--ts, 1)); color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-go {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; color: var(--fg-3);
  opacity: 0; transform: translateX(-4px);
  transition: opacity .2s, transform .35s var(--spring), background .2s, color .2s;
}
.sr-row.on .sr-go { opacity: 1; transform: none; background: var(--primary); color: var(--on-primary, var(--bg)); }
.sr-keys { margin: 12px 0 2px; text-align: center; font-size: calc(11.5px * var(--ts, 1)); color: var(--fg-3); letter-spacing: .01em; }
@media (hover: none) { .sr-keys { display: none; } .sr-go { opacity: .6; transform: none; } }

/* Nothing found: a calm, centred note. */
.sr-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 64px 24px 24px; animation: sr-in .35s var(--ease) both; }
.sr-empty-ic {
  position: relative; width: 76px; height: 76px; border-radius: 50%;
  display: grid; place-items: center; color: var(--fg-3);
  background: radial-gradient(circle at 34% 28%, rgba(var(--ink), .12), rgba(var(--ink), .035) 72%);
  box-shadow: inset 0 0 0 1px rgba(var(--ink), .08), inset 0 1px 0 rgba(255, 255, 255, .12),
    0 14px 34px -14px color-mix(in srgb, var(--primary) 50%, transparent);
}
.sr-empty-ic::before, .sr-empty-ic::after { content: ""; position: absolute; border-radius: 50%; border: 1px solid rgba(var(--ink), .06); }
.sr-empty-ic::before { inset: -9px; }
.sr-empty-ic::after { inset: -19px; border-color: rgba(var(--ink), .035); }
.sr-empty-title { margin-top: 22px; font-family: var(--font-display); font-size: calc(17px * var(--ts, 1)); font-weight: 650; letter-spacing: -.01em; }
.sr-empty-hint { margin-top: 6px; max-width: 300px; font-size: calc(13px * var(--ts, 1)); line-height: 1.45; color: var(--fg-3); }
@keyframes sr-in { from { opacity: 0; transform: translateY(4px); } }
@keyframes sr-pop { from { opacity: 0; transform: scale(.6); } }

/* A row found by search (or reached by a link from another tab) lights up for a moment. */
@keyframes sid-flash {
  0%, 38% {
    border-radius: 12px;
    background-color: color-mix(in srgb, var(--primary) 18%, transparent);
    box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--primary) 55%, transparent);
  }
}
.sid-flash { animation: sid-flash 1.9s var(--ease); }
html.low-power .sid-flash { animation: none; border-radius: 12px; background-color: color-mix(in srgb, var(--primary) 14%, transparent); }
@media (prefers-reduced-motion: reduce) {
  .sid-flash { animation: none; border-radius: 12px; background-color: color-mix(in srgb, var(--primary) 14%, transparent); }
  .sr-list, .sr-empty, .set-search-x { animation: none; }
}

/* ---- Action cards: they look like the import tiles, and now clearly are buttons ---- */
.act-card { cursor: pointer; transition: transform .4s var(--spring), box-shadow .25s var(--ease), background .25s var(--ease); }
.act-card:hover {
  transform: translateY(-2px);
  background: rgba(var(--ink), .075);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 50%, transparent),
    0 10px 24px -12px color-mix(in srgb, var(--primary) 60%, transparent), 0 2px 6px rgba(0, 0, 0, .07);
}
.act-card:active {
  transform: translateY(0) scale(.985); transition-duration: .12s;
  background: rgba(var(--ink), .09);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 65%, transparent), 0 3px 10px -6px color-mix(in srgb, var(--primary) 50%, transparent);
}
.act-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 36%, transparent), inset 0 0 0 1px color-mix(in srgb, var(--primary) 65%, transparent);
}
.act-card .srow-ic.big { transition: transform .45s var(--spring), box-shadow .3s; }
.act-card:hover .srow-ic.big { transform: scale(1.06) rotate(-3deg); box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .1), 0 6px 14px -6px var(--tint); }
.import-tile.act-card .tile-desc { margin-bottom: 4px; }
/* The visible "what happens": a small pill with an arrow. */
.tile-cta {
  flex: none; margin-top: auto; align-self: flex-start;
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 11px 0 9px; border-radius: 999px;
  font-size: calc(12px * var(--ts, 1)); font-weight: 600; white-space: nowrap;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  box-shadow: inset 0 0 0 .5px color-mix(in srgb, var(--primary) 26%, transparent);
  transition: background .25s var(--ease), color .2s, box-shadow .25s;
}
.tile-cta::after {
  content: ""; width: 5px; height: 5px; margin-left: 1px;
  border-top: 1.6px solid currentColor; border-right: 1.6px solid currentColor;
  transform: rotate(45deg); transition: transform .35s var(--spring);
}
.act-card:hover .tile-cta { background: var(--primary); color: var(--on-primary, var(--bg)); box-shadow: 0 4px 12px -5px var(--primary); }
.act-card:hover .tile-cta::after { transform: translateX(2px) rotate(45deg); }
.import-tile.wide .tile-text { flex: 1; }
.import-tile.wide .tile-cta { margin: 0 0 0 auto; align-self: center; }
@media (max-width: 640px) {
  .import-tile.wide { flex-wrap: wrap; }
  .import-tile.wide .tile-cta { margin-left: 50px; }
}
/* A card that leads to another tab (Customization → the sounds). */
.jump-card {
  width: 100%; margin-bottom: 12px;
  display: flex; align-items: center; gap: 12px;
  padding: 14px; border-radius: 14px; text-align: left; color: var(--fg);
  background: rgba(var(--ink), .045);
  box-shadow: inset 0 0 0 1px rgba(var(--ink), .055);
}
.jump-card .tile-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.jump-card .tile-title { margin-top: 0; }
.tile-go {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; color: var(--fg-2);
  background: rgba(var(--ink), .07);
  transition: background .25s, color .2s, transform .35s var(--spring);
}
.act-card:hover .tile-go { background: var(--primary); color: var(--on-primary, var(--bg)); transform: translateX(2px); }
/* The same keyboard ring on the other card-like actions. */
.pal-new:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 36%, transparent); }
.drop-zone:focus-within { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent); }
html.low-power .act-card, html.low-power .act-card .srow-ic.big, html.low-power .tile-cta::after { transition: none; }
html.low-power .act-card:hover, html.low-power .act-card:hover .srow-ic.big { transform: none; }
@media (prefers-reduced-motion: reduce) {
  .act-card:hover, .act-card:hover .srow-ic.big, .act-card:hover .tile-go { transform: none; }
}

/* Phones: the search on its own line, the tabs in a row under it that scrolls sideways. */
@media (max-width: 640px) {
  .set-nav { flex-direction: column; overflow: visible; min-width: 0; gap: 8px; padding: 10px 10px 8px; }
  .set-search { margin: 0; }
  .set-tabs { flex: none; min-width: 0; flex-direction: row; overflow-x: auto; overflow-y: hidden; gap: 2px; margin: 0 -10px; padding: 0 10px; }
  .set-tab-gap { width: 1px; height: 20px; margin: auto 4px; }
}

/* ===== Round 13 — integration pass ===== */
/* Toolbar search: wide enough for the whole placeholder («Поиск или новое») at middle widths. */
@container main (max-width: 1180px) {
  .search-btn { width: 160px; }
}
@container main (max-width: 1020px) {
  .search-btn { width: 32px; }
  .toolbar.theme-auto .search-btn { width: 160px; }
}
@container main (max-width: 900px) {
  .toolbar.theme-auto .search-btn { width: 32px; }
}
@container main (max-width: 760px) {
  .toolbar.theme-auto .search-btn { width: 160px; }
}
@container main (max-width: 520px) {
  .toolbar.theme-auto .search-btn { width: 32px; }
}
/* Palette editor: every colour row keeps its swatches on the right (the hint wraps instead). */
.pe-row-text { flex: 1 1 140px; min-width: 0; }
.pe-row-desc { line-height: 1.35; }
.pe-sws { flex: 0 1 auto; justify-content: flex-end; }

/* ===== Round 14 — sidebar: Next event, Week at a glance header ===== */
/* Next event: the sidebar's hero. The calendar's colour glows softly from the corner. */
.wg-next { gap: 9px; }
.wg-next:not(.free) {
  background:
    radial-gradient(130% 110% at 0% 0%, color-mix(in oklab, var(--c, var(--fg)) 20%, transparent), transparent 64%),
    radial-gradient(120% 90% at 0% 0%, rgba(255, 255, 255, .07), transparent 60%),
    linear-gradient(160deg, rgba(var(--ink), .06), rgba(var(--ink), .025));
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--c, var(--fg)) 16%, rgba(var(--ink), .07)), inset 0 1px 0 rgba(255, 255, 255, .07);
}
.ne-card {
  position: relative;
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  width: 100%; min-width: 0;
  padding: 1px 0 1px 13px;
  text-align: left;
  transition: transform .3s var(--spring);
}
.ne-card::before {
  content: ""; position: absolute; left: 0; top: 2px; bottom: 2px;
  width: 3.5px; border-radius: 99px;
  background: var(--c, var(--fg));
}
.ne-card:active { transform: scale(.985); }
.ne-when {
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 100%; margin-bottom: 4px; padding: 3px 9px;
  border-radius: 99px;
  font-size: calc(11.5px * var(--ts, 1)); font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap;
  color: var(--fg);
  background: color-mix(in oklab, var(--c, var(--fg)) 24%, rgba(var(--ink), .06));
}
.ne-when .live-dot { flex: none; width: 6px; height: 6px; background: var(--c, var(--fg)); }
.ne-title {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  max-width: 100%;
  font-size: calc(17px * var(--ts, 1)); font-weight: 680; line-height: 1.25; letter-spacing: -.012em;
  overflow-wrap: anywhere;
  color: var(--fg);
}
.ne-card:hover .ne-title { text-decoration: underline; text-decoration-color: rgba(var(--ink), .25); text-underline-offset: 3px; }
.ne-time { font-size: calc(12.5px * var(--ts, 1)); font-weight: 550; font-variant-numeric: tabular-nums; color: var(--fg-2); }
.ne-dur { color: var(--fg-3); }
.ne-loc { display: flex; align-items: center; gap: 5px; max-width: 100%; font-size: calc(12px * var(--ts, 1)); color: var(--fg-3); }
.ne-loc .icon { flex: none; }
.ne-loc-t { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ne-bar { display: block; width: 100%; height: 3px; margin-top: 8px; border-radius: 99px; background: rgba(var(--ink), .1); overflow: hidden; }
.ne-fill { display: block; height: 100%; border-radius: inherit; background: var(--c, var(--accent)); transition: width .9s var(--ease); }
/* "Then …", tomorrow's first event, the events after it (large). */
.ne-foot { display: flex; flex-direction: column; gap: 1px; margin: 0 -7px; padding-top: 6px; border-top: 1px solid var(--line); }
.sbw.grow > .wg-next .ne-foot { margin-top: auto; }
.ne-list-h { padding: 2px 7px 3px; font-size: calc(10.5px * var(--ts, 1)); font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-3); }
.ne-row {
  display: flex; align-items: center; gap: 8px;
  width: 100%; min-width: 0;
  padding: 6px 7px;
  border-radius: 9px;
  text-align: left;
  font-size: calc(12.5px * var(--ts, 1));
  transition: background .2s var(--ease);
}
.ne-row:hover { background: rgba(var(--ink), .06); }
.ne-row-lead { flex: none; font-size: calc(10.5px * var(--ts, 1)); font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--fg-3); }
.ne-row-title { flex: 1; min-width: 0; font-weight: 560; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ne-row-time { flex: none; font-size: calc(12px * var(--ts, 1)); font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--fg-3); }
/* Nothing more today. */
.ne-free { display: flex; align-items: center; gap: 10px; padding: 2px 0 1px; font-size: calc(14px * var(--ts, 1)); font-weight: 600; color: var(--fg-2); }
.ne-free-ic { display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 99px; color: var(--fg-3); background: rgba(var(--ink), .07); }
.sbw.grow > .wg-next.free .ne-free { flex: 1; flex-direction: column; justify-content: center; text-align: center; }
/* S: one line. */
.sz-s .wg-next { padding: 10px 12px; }
.ne-s { display: flex; align-items: center; gap: 9px; width: 100%; min-width: 0; text-align: left; }
.ne-s-dot { flex: none; width: 8px; height: 8px; border-radius: 99px; background: var(--c, var(--fg-3)); }
.ne-s-title { flex: 1; min-width: 0; font-size: calc(13.5px * var(--ts, 1)); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ne-s.free .ne-s-title { font-weight: 550; color: var(--fg-3); }
.ne-s-when {
  flex: none; padding: 2px 8px; border-radius: 99px;
  font-size: calc(11px * var(--ts, 1)); font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap;
  color: var(--fg-2);
  background: color-mix(in oklab, var(--c, var(--fg)) 22%, rgba(var(--ink), .06));
}
.ne-s:hover .ne-s-title { text-decoration: underline; text-decoration-color: rgba(var(--ink), .25); text-underline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .ne-fill { transition: none; } }

/* Week at a glance: the title keeps its room; the count gives way first. */
.wg-week .wg-name { flex: none; }
.wg-week .ww-total { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ===== Round 14 — Customization: video sound, what a video costs ===== */
/* The facts of the video on show, then why they matter (calm), or an amber line when it is
   heavier than a background needs. */
.vid-note .vid-facts { font-weight: 600; color: var(--fg-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Amber: bright on the dark theme (the default), deeper on light. */
.srow-note.vid-warn, .srow-note.vid-warn .icon { color: #f2b14a; opacity: 1; }
:root[data-theme="light"] .srow-note.vid-warn, :root[data-theme="light"] .srow-note.vid-warn .icon { color: #a8650a; }
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] .srow-note.vid-warn, :root[data-theme="system"] .srow-note.vid-warn .icon { color: #a8650a; }
}
/* The file button while a chosen background is kept ("Saving… 42 %"). */
.ghost-btn .saving { display: inline-flex; align-items: baseline; gap: 2px; font-variant-numeric: tabular-nums; }
.ghost-btn .saving-pct { font-size: calc(11.5px * var(--ts, 1)); color: var(--fg-3); }

/* ==========================================================================
   Round 14 — battery
   ========================================================================== */
/* The running focus timer's ring moves a fraction of a pixel a second. Its 1 s transition
   kept the ring repainting without a break (it never finished before the next second); now
   it steps once a second, and a reset or a new phase still glides. */
.wg-focus.running .ring-fill { transition: none; }

/* ==========================================================================
   Round 15 — send to phone
   ========================================================================== */
.share-sheet.phone-sheet { width: min(440px, 100%); max-height: min(780px, 92vh); }
.phone-body { align-items: center; gap: 12px; padding-top: 6px; }
.phone-mode { width: min(260px, 100%); flex: none; }
.phone-stage { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; }
/* Dark modules on a white tile in both themes (what phone cameras read best); the SVG brings
   its own 4-module quiet zone. Finer codes get a bigger tile, so a module stays 3+ px. */
.phone-qr {
  flex: none; width: 264px; aspect-ratio: 1; padding: 8px; border-radius: 18px;
  background: #fff; color: #000;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .08), 0 10px 28px rgba(0, 0, 0, .16);
  animation: phone-qr-in .3s var(--ease) both;
}
.phone-qr.dense { width: 296px; }
.phone-qr.xdense { width: 336px; }
.phone-qr svg { display: block; width: 100%; height: 100%; }
@keyframes phone-qr-in { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
.phone-nav { flex: none; width: 36px; height: 36px; border-radius: 99px; background: rgba(var(--ink), .06); }
.phone-nav:hover:not(:disabled) { color: var(--fg); background: rgba(var(--ink), .11); }
.phone-nav:disabled { opacity: .35; cursor: default; }
.phone-caption { display: flex; flex-direction: column; align-items: center; gap: 2px; max-width: 100%; text-align: center; }
.phone-count { font-size: calc(11px * var(--ts, 1)); font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--fg-3); font-variant-numeric: tabular-nums; }
.phone-ev-title { max-width: 100%; font-size: calc(14px * var(--ts, 1)); font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phone-ev-when { font-size: calc(12.5px * var(--ts, 1)); color: var(--fg-3); }
.phone-hint { margin: 0; max-width: 340px; text-align: center; font-size: calc(13px * var(--ts, 1)); line-height: 1.45; color: var(--fg-2); }
.phone-body .import-note { align-self: stretch; }
.phone-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 12px; text-align: center; font-size: calc(13.5px * var(--ts, 1)); color: var(--fg-3); }
@media (prefers-reduced-motion: reduce) { .phone-qr { animation: none; } }
/* A narrow window: the code takes the row, the arrows go under it. */
@media (max-width: 520px) {
  .phone-stage { flex-wrap: wrap; }
  .phone-qr, .phone-qr.dense, .phone-qr.xdense { order: -1; width: min(300px, 100%); }
  .phone-foot { flex-wrap: wrap; padding-left: 18px; }
  .phone-foot .import-sum { display: none; }
  .phone-foot > button { flex: 1 1 auto; justify-content: center; }
}
.phone-foot > button { white-space: nowrap; }
.phone-day-link { margin-top: -2px; }

/* ==========================================================================
   Round 15 — Effects options (Settings → Effects: click size, more options, quality)
   ========================================================================== */
/* Quality: the four levels take the row's width under the title and what the level means. */
.srow.fx-quality { flex-wrap: wrap; row-gap: 10px; }
.srow.fx-quality .srow-ctl { width: 100%; padding-left: 40px; }
.srow.fx-quality .srow-ctl .segmented { flex: 1; min-width: 0; }
.srow.fx-quality .srow-ctl .segmented.small .seg { padding: 0 4px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .srow.fx-quality .srow-ctl { padding-left: 0; } }

/* ==========================================================================
   Round 15 — event templates (Save as template, Settings → Calendar → Templates,
   the "+" menu's "From template", ⌘K)
   ========================================================================== */
/* ---- The save sheet ---- */
.tpl-sheet { width: min(460px, 100%); }
.tpl-keep {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(var(--ink), .045);
  box-shadow: inset 0 0 0 1px rgba(var(--ink), .055);
}
.tpl-keep-text { flex: 1; min-width: 0; }
.tpl-keep-title { display: flex; align-items: center; gap: 7px; font-size: calc(13.5px * var(--ts, 1)); font-weight: 550; }
.tpl-keep-title .icon { color: var(--fg-3); }
.tpl-keep-desc { margin-top: 2px; padding-left: 21px; font-size: calc(12px * var(--ts, 1)); color: var(--fg-3); }
.tpl-preview {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  border: 1px dashed rgba(var(--ink), .16);
}
.tpl-preview .swatch { width: 28px; height: 28px; border-radius: 8px; }
.tpl-preview-text { min-width: 0; }
.tpl-preview-title { font-size: calc(13.5px * var(--ts, 1)); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpl-preview-sub { margin-top: 1px; font-size: calc(12px * var(--ts, 1)); color: var(--fg-3); }

/* ---- Settings → Calendar → Templates ---- */
.tpl-intro { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.tpl-intro-text { flex: 1; font-size: calc(12.5px * var(--ts, 1)); line-height: 1.4; color: var(--fg-2); }
.tpl-empty { padding: 4px 14px 12px 54px; }
.tpl-empty-title { font-size: calc(13.5px * var(--ts, 1)); font-weight: 600; }
.tpl-empty-desc { margin-top: 2px; font-size: calc(12px * var(--ts, 1)); line-height: 1.4; color: var(--fg-3); }
.tpl-row { box-shadow: inset 0 1px 0 rgba(var(--ink), .06); }
.tpl-line { display: flex; align-items: center; gap: 6px; padding: 6px 10px 6px 8px; }
.tpl-main {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 6px; border-radius: 10px; text-align: left;
  transition: background .2s var(--ease);
}
.tpl-main:hover { background: rgba(var(--ink), .05); }
.tpl-main .tpl-ic { width: 28px; height: 28px; border-radius: 8px; }
.tpl-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tpl-name { font-size: calc(14px * var(--ts, 1)); font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpl-sub { font-size: calc(12px * var(--ts, 1)); color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn.tpl-mini.on { color: var(--fg); background: rgba(var(--ink), .1); }
.tpl-ctl { flex: none; display: flex; gap: 2px; }
.icon-btn.tpl-mini { width: 28px; height: 28px; border-radius: 8px; color: var(--fg-3); }
.icon-btn.tpl-mini:hover { color: var(--fg); }
.icon-btn.tpl-mini:disabled { opacity: .3; pointer-events: none; }
.tpl-edit {
  display: flex; flex-direction: column; gap: 8px;
  margin: 0 12px 12px; padding: 12px;
  border-radius: 12px;
  background: rgba(var(--ink), .035);
  box-shadow: inset 0 0 0 1px rgba(var(--ink), .05);
  animation: tpl-open .32s var(--spring) both;
}
@keyframes tpl-open { from { opacity: 0; transform: translateY(-4px); } }
.tpl-field { display: flex; align-items: center; gap: 12px; min-height: 32px; }
.tpl-field.top { align-items: flex-start; }
.tpl-field.top .tpl-label { padding-top: 7px; }
.tpl-label { flex: 0 0 132px; font-size: calc(13px * var(--ts, 1)); color: var(--fg-2); }
.tpl-field .set-input.tpl-input { flex: 1; min-width: 0; width: auto; }
.tpl-field .select-wrap select { min-width: 170px; }
.tpl-notes { height: auto; min-height: 56px; padding: 8px 12px; resize: vertical; font-family: inherit; line-height: 1.4; }
.tpl-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tpl-inline .time-field { width: 84px; }
.tpl-rems { justify-content: flex-start; }
.tpl-edit-foot { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.tpl-edit-foot .spacer { flex: 1; }
.tpl-foot { display: flex; align-items: center; gap: 12px; padding: 10px 14px 12px; box-shadow: inset 0 1px 0 rgba(var(--ink), .06); }
.tpl-foot .ghost-btn:disabled { opacity: .45; pointer-events: none; }
.tpl-limit { font-size: calc(12px * var(--ts, 1)); color: var(--fg-3); }
@media (max-width: 640px) {
  .tpl-field { flex-wrap: wrap; gap: 6px; }
  .tpl-label { flex-basis: 100%; }
  .tpl-field.top .tpl-label { padding-top: 0; }
  .tpl-field .select-wrap, .tpl-field .select-wrap select { flex: 1; }
  .tpl-empty { padding-left: 14px; }
}

/* ---- The "+" menu: "From template ›" opens to the left ---- */
.tpl-sub-wrap { position: relative; display: flex; flex-direction: column; }
.tpl-sub-wrap > .menu-item { width: 100%; }
.tpl-sub-wrap.open > .menu-item { background: rgba(var(--ink), .08); }
.tpl-sub-chev { display: grid; place-items: center; color: var(--fg-3); }
/* The transparent padding bridges the gap, so the pointer can travel into the submenu. */
.tpl-sub-pos { position: absolute; right: 100%; top: -6px; z-index: 72; padding-right: 10px; }
.tpl-submenu {
  min-width: 220px; max-width: 300px; max-height: min(420px, 70vh); overflow-y: auto;
  padding: 6px; border-radius: 16px;
  display: flex; flex-direction: column; gap: 1px;
  /* Like the "+" menu: near-solid (no blur inside the toolbar's backdrop filter). */
  background: color-mix(in srgb, var(--bg) 88%, rgb(var(--ink)) 12%);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .18), inset 0 0 0 1px rgba(var(--ink), .06);
  transform-origin: top right;
  animation: menu-in .28s var(--spring) both;
}
.menu-ic.tpl-mic {
  background: color-mix(in srgb, var(--c, var(--fg)) 22%, transparent);
  color: color-mix(in srgb, var(--c, var(--fg)) 65%, var(--fg));
}
.tpl-mlabel { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tpl-side { flex: none; margin-left: 8px; font-size: calc(12px * var(--ts, 1)); color: var(--fg-3); font-variant-numeric: tabular-nums; }
/* A narrow window: no room on the left, the templates open in place. */
@media (max-width: 640px) {
  .tpl-sub-pos { position: static; padding: 0; }
  .tpl-submenu { min-width: 0; max-width: none; padding: 2px 0 2px 14px; background: none; box-shadow: none; animation: none; }
  .tpl-sub-chev { transform: rotate(90deg); }
}

/* ---- ⌘K ---- */
.pal-token {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 8px 0 10px; border-radius: 9px;
  font-size: calc(13px * var(--ts, 1)); font-weight: 600; color: var(--fg);
  background: rgba(var(--ink), .09);
  transition: background .2s var(--ease);
}
.pal-token:hover { background: rgba(var(--ink), .14); }
.pal-token .icon:last-child { color: var(--fg-3); }
.pal-ic.tpl-pal-ic {
  background: color-mix(in srgb, var(--c, var(--fg)) 22%, transparent);
  color: color-mix(in srgb, var(--c, var(--fg)) 65%, var(--fg));
}

/* Calm: no motion with reduced motion or Battery saver. */
html.low-power .tpl-edit, html.low-power .tpl-submenu { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .tpl-edit, .tpl-submenu { animation: none; }
}

/* ==========================================================================
   Round 15 — Find free time (ui/freetime_sheet.rs)
   ========================================================================== */
.ft-sheet {
  width: min(640px, 100%);
  max-height: min(720px, 90vh);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: sheet-in .55s var(--spring) both;
}
.ft-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.ft-ctl { display: flex; flex-direction: column; gap: 8px; padding: 4px 24px 12px; border-bottom: 1px solid var(--line); }
.ft-row { display: flex; align-items: center; gap: 12px; min-height: 30px; }
.ft-label { flex: none; width: 104px; font-size: calc(12.5px * var(--ts, 1)); font-weight: 550; color: var(--fg-3); }
.ft-chips { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ft-chips .chip { height: 28px; padding: 0 11px; font-size: calc(12.5px * var(--ts, 1)); white-space: nowrap; }
.ft-stepper {
  display: inline-flex; align-items: center; gap: 2px;
  height: 28px; padding: 0 2px;
  border-radius: 9px;
  background: rgba(var(--ink), .06);
  animation: in-fade .25s var(--ease) both;
}
.ft-step-val { min-width: 76px; text-align: center; font-size: calc(12.5px * var(--ts, 1)); font-weight: 620; font-variant-numeric: tabular-nums; }
.ft-dash { color: var(--fg-3); }
.ft-pick { margin-left: 116px; max-width: 300px; }
.ft-pick .date-pick { border-bottom: 0; padding-top: 2px; }
.ft-opts-toggle {
  display: flex; align-items: center; gap: 8px;
  height: 30px; margin: 0 -8px; padding: 0 8px;
  border-radius: 9px;
  text-align: left;
  font-size: calc(12.5px * var(--ts, 1)); color: var(--fg-2);
  transition: background .2s, color .2s;
}
.ft-opts-toggle:hover { background: rgba(var(--ink), .05); color: var(--fg); }
.ft-chev { display: grid; place-items: center; color: var(--fg-3); transition: transform .35s var(--spring); }
.ft-opts-toggle.open .ft-chev { transform: rotate(90deg); }
.ft-opts-title { flex: none; font-weight: 620; }
.ft-opts-sum { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-3); font-variant-numeric: tabular-nums; }
/* Options: an inset card of rows, the title on the left and its control on the right. */
.ft-opts {
  display: flex; flex-direction: column;
  padding: 2px 14px;
  border-radius: 13px;
  background: rgba(var(--ink), .035);
  box-shadow: inset 0 0 0 .5px rgba(var(--ink), .06);
  animation: in-fade .25s var(--ease) both;
}
.ft-opts .ft-row { justify-content: space-between; min-height: 44px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.ft-opts .ft-row:last-child { border-bottom: 0; }
.ft-opts .ft-label { flex: 1 1 auto; width: auto; min-width: 0; font-size: calc(13px * var(--ts, 1)); font-weight: 500; color: var(--fg); }
.ft-opts .ft-chips { flex: 0 1 auto; justify-content: flex-end; }
.ft-opts .ft-cals-row { flex-direction: column; align-items: stretch; gap: 6px; padding: 10px 0 8px; }
.ft-cals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 10px; margin: 0 -6px; }

.ft-results { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px 14px; }
.ft-day {
  padding: 10px 10px 12px;
  border-radius: 14px;
  transition: background .25s var(--ease);
  animation: rise .4s var(--ease) backwards;
  animation-delay: calc(var(--d, 0) * 35ms);
}
.ft-day.hot { background: rgba(var(--ink), .045); }
.ft-day-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; padding: 0 2px; }
.ft-day-name { font-family: var(--font-display); font-size: calc(14.5px * var(--ts, 1)); font-weight: 650; letter-spacing: -.01em; white-space: nowrap; }
.ft-day-date { font-size: calc(12.5px * var(--ts, 1)); color: var(--fg-3); white-space: nowrap; }
/* The day's working hours as a bar: free windows tinted, the one under the pointer solid. */
.ft-line {
  position: relative; align-self: center;
  flex: 1 1 auto; min-width: 72px; max-width: 220px; height: 6px;
  margin-left: auto;
  border-radius: 99px;
  background: rgba(var(--ink), .09);
  overflow: hidden;
}
.ft-past { position: absolute; left: 0; top: 0; bottom: 0; background: repeating-linear-gradient(135deg, rgba(var(--ink), .18) 0 2px, transparent 2px 4px); }
.ft-seg { position: absolute; top: 0; bottom: 0; border-radius: 99px; background: color-mix(in srgb, var(--primary) 50%, transparent); transition: opacity .2s var(--ease); }
.ft-seg.pick { background: var(--primary); }
.ft-day.hot .ft-seg:not(.pick) { opacity: .45; }
.ft-slots { display: flex; flex-wrap: wrap; gap: 6px; }
.ft-slot {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border-radius: 10px;
  background: rgba(var(--ink), .06);
  box-shadow: inset 0 0 0 .5px rgba(var(--ink), .07);
  font-size: calc(13px * var(--ts, 1)); color: var(--fg);
  white-space: nowrap;
  cursor: pointer;
  transition: background .2s, box-shadow .2s, transform .3s var(--spring);
}
.ft-slot:hover, .ft-slot:focus-visible {
  outline: 0;
  background: color-mix(in srgb, var(--primary) 15%, rgba(var(--ink), .05));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 50%, transparent);
}
.ft-slot:active { transform: scale(.96); }
.ft-slot-time { font-weight: 620; font-variant-numeric: tabular-nums; }
.ft-slot-free { font-size: calc(11.5px * var(--ts, 1)); color: var(--fg-3); }
.ft-slot-free::before { content: "·"; margin-right: 6px; }

.ft-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 34px 16px 28px; text-align: center; animation: in-fade .3s var(--ease) both; }
.ft-empty-ic { width: 46px; height: 46px; margin-bottom: 6px; border-radius: 14px; display: grid; place-items: center; color: var(--fg-2); background: rgba(var(--ink), .06); }
.ft-empty-title { font-size: calc(15px * var(--ts, 1)); font-weight: 650; }
.ft-empty-hint { max-width: 360px; font-size: calc(12.5px * var(--ts, 1)); line-height: 1.45; color: var(--fg-3); }
.ft-empty-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }
.ft-empty-acts .ghost-btn { height: 30px; font-size: calc(12.5px * var(--ts, 1)); }

@media (prefers-reduced-motion: reduce) { .ft-day, .ft-stepper, .ft-opts, .ft-empty { animation: none; } }
@media (max-width: 540px) {
  .ft-ctl { padding: 4px 16px 12px; }
  .ft-row { flex-wrap: wrap; gap: 6px; }
  .ft-label { width: 100%; }
  .ft-opts .ft-row { flex-wrap: nowrap; }
  .ft-opts .ft-cals-row { flex-wrap: wrap; }
  .ft-opts .ft-label { width: auto; }
  .ft-pick { margin-left: 0; }
  .ft-cals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ft-results { padding: 8px 6px 10px; }
  .ft-day-head { flex-wrap: wrap; }
  .ft-line { flex-basis: 100%; max-width: none; margin: 4px 0 0; }
}

/* ==========================================================================
   Round 15 — focus suite: focus sounds (Focus timer widget, Now mode) and Now mode
   (ui/now_mode.rs, ui/widgets.rs `FocusSounds` / `FocusNow`).
   ========================================================================== */
/* Focus sounds: a pill with the chosen sound and ▶ / ■; it opens the choices below. */
.fs { display: flex; flex-direction: column; gap: 9px; margin-top: 12px; }
.fs-row { display: flex; align-items: center; gap: 6px; }
.fs-pill {
  flex: 1; min-width: 0; height: 30px;
  display: flex; align-items: center; gap: 7px;
  padding: 0 9px 0 10px;
  border-radius: 10px;
  background: rgba(var(--ink), .065);
  box-shadow: inset 0 0 0 .5px rgba(var(--ink), .06);
  color: var(--fg-2);
  font-size: calc(12.5px * var(--ts, 1)); font-weight: 550;
  transition: background .2s var(--ease), color .2s, transform .3s var(--spring);
}
.fs-pill:hover, .fs-pill.open { background: rgba(var(--ink), .1); color: var(--fg); }
.fs-pill:active { transform: scale(.98); }
.fs-pill-ic, .fs-chip-ic { display: grid; place-items: center; flex: none; color: var(--fg-3); }
.fs-pill-name, .fs-chip-name { flex: 1; min-width: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fs-chev { display: grid; place-items: center; flex: none; color: var(--fg-3); transition: transform .4s var(--spring); }
.fs-pill.open .fs-chev { transform: rotate(180deg); }
.fs-play {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  background: rgba(var(--ink), .065);
  color: var(--fg-2);
  transition: background .2s var(--ease), color .2s, transform .3s var(--spring);
}
.fs-play:hover { background: rgba(var(--ink), .12); color: var(--fg); }
.fs-play.on { background: var(--accent); color: var(--on-accent); }
.fs-play:active { transform: scale(.9); }
.fs-panel { display: flex; flex-direction: column; gap: 10px; animation: rise .3s var(--ease) backwards; }
.fs-chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
/* Five sounds in two columns: the last one has the whole row ("Brown noise" in full). */
.fs-chip:last-child:nth-child(odd) { grid-column: 1 / -1; }
.fs-chip {
  display: flex; align-items: center; gap: 7px;
  min-height: 34px; padding: 6px 9px;
  border-radius: 11px;
  background: rgba(var(--ink), .05);
  color: var(--fg-2);
  font-size: calc(12px * var(--ts, 1)); font-weight: 550;
  transition: background .2s var(--ease), color .2s, box-shadow .25s var(--ease), transform .3s var(--spring);
}
.fs-chip:hover { background: rgba(var(--ink), .09); color: var(--fg); }
.fs-chip:active { transform: scale(.96); }
.fs-chip.chosen { color: var(--fg); box-shadow: inset 0 0 0 1px rgba(var(--ink), .14); }
.fs-chip.playing { background: color-mix(in srgb, var(--accent) 15%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 42%, transparent); }
.fs-chip.playing .fs-chip-ic { color: var(--accent); }
/* "Playing": three still bars (no animation to keep the screen busy). */
.fs-eq { display: inline-flex; align-items: flex-end; gap: 1.5px; width: 9px; height: 10px; flex: none; color: var(--accent); }
.fs-eq span { flex: 1; border-radius: 1px; background: currentColor; }
.fs-eq span:nth-child(1) { height: 55%; }
.fs-eq span:nth-child(2) { height: 100%; }
.fs-eq span:nth-child(3) { height: 72%; }
.fs-vol { display: flex; align-items: center; gap: 9px; color: var(--fg-3); }
.fs-vol-ic { display: grid; place-items: center; flex: none; }
.fs-vol input[type="range"] { flex: 1; min-width: 0; accent-color: var(--primary); }
.fs-auto { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: calc(12px * var(--ts, 1)); color: var(--fg-2); }
.fs-auto-t { min-width: 0; }
.fs-auto .switch { transform: scale(.82); transform-origin: right center; }

/* Toolbar: Now mode, beside the search (only where the toolbar has room). */
.now-btn { flex: none; }
@container main (max-width: 1020px) { .now-btn { display: none; } }
@media (max-width: 640px) { .now-btn { display: none; } }
/* Round 43 — the playing focus sound: its icon and three small bars; hover shows ✕ (stop). */
.amb-btn { flex: none; position: relative; color: var(--primary); animation: fade-in .3s var(--ease) both; }
.amb-btn-ic, .amb-btn-stop { display: grid; place-items: center; transition: opacity .18s var(--ease), transform .25s var(--spring); }
.amb-btn-stop { position: absolute; inset: 0; opacity: 0; transform: scale(.7); color: var(--fg); }
.amb-btn:hover .amb-btn-ic, .amb-btn:focus-visible .amb-btn-ic { opacity: 0; transform: scale(.7); }
.amb-btn:hover .amb-btn-stop, .amb-btn:focus-visible .amb-btn-stop { opacity: 1; transform: none; }
.amb-eq { position: absolute; right: 4px; bottom: 5px; display: flex; align-items: flex-end; gap: 1.5px; height: 7px; pointer-events: none; transition: opacity .18s var(--ease); }
.amb-eq > span { width: 2px; height: 100%; border-radius: 1px; background: currentColor; transform-origin: bottom; animation: amb-eq 1.1s ease-in-out infinite alternate; }
.amb-eq > span:nth-child(2) { animation-delay: -.45s; animation-duration: .9s; }
.amb-eq > span:nth-child(3) { animation-delay: -.8s; animation-duration: 1.3s; }
.amb-btn:hover .amb-eq { opacity: 0; }
@keyframes amb-eq { from { transform: scaleY(.3); } to { transform: scaleY(1); } }
html.low-power .amb-eq > span, html.idle .amb-eq > span { animation: none; transform: scaleY(.6); }
@media (prefers-reduced-motion: reduce) { .amb-eq > span { animation: none; transform: scaleY(.6); } }

/* Now mode: the calendar fades back under a dimmed blur (a layer beside the card, never an
   ancestor: the card's own glass blur keeps working in WebKit). */
.now-wrap { position: fixed; inset: 0; z-index: 46; display: grid; place-items: center; padding: 24px 16px; }
.now-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(rgba(0, 0, 0, .08), rgba(0, 0, 0, .08)), var(--scrim);
  -webkit-backdrop-filter: blur(18px) saturate(112%);
  backdrop-filter: blur(18px) saturate(112%);
  animation: now-dim .5s var(--ease) both;
}
@keyframes now-dim { from { opacity: 0; } }
.now-card {
  width: min(600px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto; scrollbar-width: none;
  display: flex; flex-direction: column; gap: 14px;
  padding: 12px 20px 20px;
  border-radius: 30px;
  animation: now-in .6s var(--spring) both;
  user-select: none;
}
.now-card::-webkit-scrollbar { display: none; }
.now-card > * { position: relative; }
@keyframes now-in { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
.now-head { display: flex; align-items: center; gap: 8px; min-height: 34px; }
.now-head .spacer { flex: 1; }
.now-ic { display: grid; place-items: center; color: var(--fg-3); }
.now-name, .now-sec, .now-allday-l, .nh-kicker, .nf-label {
  font-size: calc(11px * var(--ts, 1)); font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-3);
}
.now-clock { padding-left: 9px; border-left: 1px solid var(--line); font-size: calc(12px * var(--ts, 1)); font-weight: 600; color: var(--fg-3); font-variant-numeric: tabular-nums; }
.now-close { margin-right: -6px; }
.now-allday { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.now-allday-l { margin-right: 2px; }
.now-chip {
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 220px; height: 24px; padding: 0 10px 0 8px;
  border-radius: 99px;
  background: rgba(var(--ink), .06);
  font-size: calc(12px * var(--ts, 1)); font-weight: 550;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* The event on now / next: a ring (minutes left in it), what, how long, where, the notes. */
.now-hero { display: flex; align-items: center; gap: 22px; padding: 4px 2px 0; }
.nh-ring { position: relative; flex: none; width: 128px; height: 128px; }
.nh-ring svg { display: block; width: 100%; height: 100%; }
.nh-track { fill: none; stroke: rgba(var(--ink), .09); stroke-width: 7; }
.nh-fill { fill: none; stroke: var(--c, var(--accent)); stroke-width: 7; stroke-linecap: round; transition: stroke-dashoffset 1s var(--ease); }
.now-hero:not(.live) .nh-fill { stroke: color-mix(in srgb, var(--c, var(--fg)) 50%, transparent); }
.nh-num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.nh-big { font-family: var(--font-display); font-size: calc(34px * var(--ts, 1)); font-weight: 700; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.nh-unit { margin-top: 3px; font-size: calc(11px * var(--ts, 1)); font-weight: 600; color: var(--fg-3); }
.nh-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.nh-kicker { display: flex; align-items: center; gap: 7px; min-width: 0; }
.nh-kicker .live-dot { color: var(--c, var(--accent)); flex: none; }
.nh-cal { min-width: 0; text-transform: none; letter-spacing: 0; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nh-title {
  align-self: flex-start; max-width: 100%;
  text-align: left; overflow-wrap: anywhere;
  font-family: var(--font-display); font-size: calc(24px * var(--ts, 1)); font-weight: 700; letter-spacing: -.02em; line-height: 1.15;
  color: var(--fg);
  transition: opacity .2s;
}
.nh-title:hover { opacity: .78; }
.nh-status { font-size: calc(17px * var(--ts, 1)); font-weight: 600; letter-spacing: -.01em; color: var(--fg); }
.nh-time { font-size: calc(13px * var(--ts, 1)); color: var(--fg-2); font-variant-numeric: tabular-nums; }
.nh-dur { color: var(--fg-3); }
.nh-loc { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: calc(13px * var(--ts, 1)); color: var(--fg-2); }
.nh-loc .icon { flex: none; color: var(--fg-3); }
.nh-loc span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nh-notes {
  margin-top: 4px;
  font-size: calc(12.5px * var(--ts, 1)); line-height: 1.45; color: var(--fg-2);
  white-space: pre-line; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  user-select: text;
}
.now-free { display: flex; align-items: center; gap: 14px; padding: 12px 2px 4px; }
.now-free-ic { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 50%; background: rgba(var(--ink), .07); color: var(--fg-2); }
.now-free-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.now-free-title { font-family: var(--font-display); font-size: calc(20px * var(--ts, 1)); font-weight: 680; letter-spacing: -.015em; }
.now-free-sub { font-size: calc(13px * var(--ts, 1)); color: var(--fg-3); }
.now-next { display: flex; flex-direction: column; gap: 1px; }
.now-sec { padding: 0 2px 4px; }
.now-row { display: flex; align-items: center; gap: 10px; min-height: 36px; margin: 0 -10px; padding: 0 10px; border-radius: 11px; text-align: left; transition: background .2s var(--ease); }
.now-row:hover { background: rgba(var(--ink), .06); }
.now-row-time { flex: none; min-width: 52px; font-size: calc(12.5px * var(--ts, 1)); font-weight: 600; color: var(--fg-2); font-variant-numeric: tabular-nums; }
.now-row-title { flex: 1; min-width: 0; font-size: calc(13.5px * var(--ts, 1)); font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-sep { height: 1px; background: var(--line); }
/* The focus timer and its sounds. */
.now-focus { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: start; }
.nf-timer { display: flex; align-items: center; gap: 14px; }
.wf-ring.nf-ring { width: 96px; height: 96px; }
.nf-ring .wf-time { font-size: calc(21px * var(--ts, 1)); }
.now-focus .ring-fill { stroke: var(--accent); }
.now-focus.break .ring-fill { stroke: color-mix(in srgb, var(--fg) 60%, transparent); }
.now-focus.running .ring-fill { transition: none; }
.nf-side { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.nf-label { display: flex; align-items: center; gap: 6px; }
.nf-phase { font-size: calc(13px * var(--ts, 1)); font-weight: 600; color: var(--fg-2); white-space: nowrap; }
.nf-rounds { font-weight: 500; color: var(--fg-3); }
.now-focus .fs { margin-top: 2px; }
@media (max-width: 560px) {
  .now-focus { grid-template-columns: minmax(0, 1fr); }
  .now-hero { flex-direction: column; align-items: flex-start; gap: 14px; }
  .nh-ring { width: 104px; height: 104px; }
  .nh-big { font-size: calc(28px * var(--ts, 1)); }
}
/* Battery saver and "Reduce transparency": no live blur behind it, a calmer solid veil. */
html.low-power .now-scrim { -webkit-backdrop-filter: none; backdrop-filter: none; background: color-mix(in srgb, var(--bg) 84%, transparent); }
@media (prefers-reduced-transparency: reduce) {
  .now-scrim { -webkit-backdrop-filter: none; backdrop-filter: none; background: color-mix(in srgb, var(--bg) 92%, transparent); }
}
@media (prefers-reduced-motion: reduce) { .now-card, .now-scrim, .fs-panel { animation: none; } }

/* ===== Round 15 — perf =====
   The glow's and the colour backdrop's slow drift are stepped from backdrop.js (the same
   paths, six or seven steps a second): as CSS animations they kept macOS redrawing the whole
   window, glass blur and all, at the screen's full rate. The lights stay layers of their own
   while they move, so a step is only a move, not a repaint. */
html.drift-js .blob { animation: none; }
html.drift-glow .blob { will-change: transform; }
html.drift-js[data-backdrop="colour"][data-drift="on"] .backdrop::before { animation: none; transform: var(--gd, none); }

/* ===== Round 15 — integration =====
   Send to phone: three footer buttons with icons ("Скопировать текстом", "Сохранить .ics",
   "Готово") did not fit the 440 px sheet in Russian and Ukrainian, and Done was clipped. A
   little more room, and a second row instead of clipping at larger text sizes. */
.share-sheet.phone-sheet { width: min(480px, 100%); }
.phone-foot { flex-wrap: wrap; row-gap: 8px; }

/* Round 15 — recorded focus sounds: the recordists' credit in About. */
.about-credits { margin: 2px auto 14px; max-width: 46ch; text-align: center; font-size: calc(11.5px * var(--ts, 1)); line-height: 1.45; color: var(--fg-3); }

/* Round 16 — updates: Settings → About → Updates. A downloaded update shows its notes and
   "Restart to update" under the two rows, in the card's own glass; nothing moves by itself. */
.upd-card .srow-desc { font-variant-numeric: tabular-nums; }
.upd-card.ready .srow:first-child .srow-desc { color: var(--fg-2); font-weight: 550; }
.upd-ready { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px 14px 14px 54px; box-shadow: inset 0 1px 0 rgba(var(--ink), .06); }
.upd-notes-title { font-size: calc(12px * var(--ts, 1)); font-weight: 650; color: var(--fg-2); }
.upd-notes { margin: 0; max-width: 60ch; font-size: calc(12.5px * var(--ts, 1)); line-height: 1.45; color: var(--fg-2); white-space: pre-line; overflow-wrap: anywhere; }
.upd-ready .primary-btn { margin-top: 2px; }
@media (max-width: 560px) { .upd-ready { padding-left: 14px; } }

/* Round 17 — smooth page switching
   A swipe, ← / →, Today or a day picked in the mini calendar slides the new week, month or day
   in as one piece (.anim-next / .anim-prev on its containers). What it carried used to fade in
   a second time inside that slide (the grid came first, the events a beat later), and a faded
   item (a past or done event, a past agenda row) rose to full strength and only then dropped
   to its own opacity: "the past lights up, then goes grey".
   1. Rising in ends at the item's own look (no `to` frame), wherever items still rise in. */
@keyframes rise-own { from { opacity: 0; transform: translateY(6px) scale(.985); } }
.ev, .ad-chip, .mv-chip, .ag-item { animation-name: rise-own; }
/* A new event drawn over the past part of the day pops in to its faded look as well. Its rise
   stays in the list (hidden under the pop): when "born" is taken off 0.9 s later, the name that
   remains is one that already ran, so the event doesn't fade out and rise a second time. */
@keyframes born-own { from { opacity: 0; transform: scale(.82); filter: blur(4px); } }
.ev.born { animation: rise-own .4s var(--ease) backwards, born-own .6s var(--spring) backwards; }
/* 2. On a page switch they arrive with the page, already as they look: from the first frame,
   and with one animation per page instead of one per event and month cell. (On that page, what
   shows up later — a calendar shown again, an undo — appears without the rise; a new event
   keeps its "born" pop, and the delete animations their own.) */
:where(.anim-next, .anim-prev) :is(.ev, .ad-chip, .mv-chip, .mv-cell, .ag-item) { animation-name: none; }

/* Round 17 — magnetic sliders
   A slider let go on a round value (src/ui/magnet.js): its number settles into place — a touch
   larger and brighter for a moment, easing back (the animation itself is in the Round 18 block
   at the end). magnet.js gives the wrapper snap-a and snap-b in turn, so each landing starts it
   again. (Battery saver stops it with every other animation.) */
.slider-ctl .slider-val { transform-origin: right center; }
@media (prefers-reduced-motion: reduce) {
  .slider-ctl .slider-val, .fs-vol .fs-vol-ic { animation: none !important; }
}

/* Round 17 — Sidebar tab, more sidebar widgets, the shortcuts button
   Settings → General: "Show all" opens the shortcut list over Settings. Settings → Sidebar: the
   block list (moved from Customization) and a note on which look it belongs to. The widgets
   Free time, Templates, Focus sounds and Next holiday reuse the cards, rows and pills of Next
   event; nothing here moves by itself. */
.keys-all { gap: 6px; }
.keys-all .icon { color: var(--fg-3); }
@media (max-width: 640px) {
  /* The button and the switch stay together at the right (they wrap under the title only
     when the row is too narrow for both). */
  .srow-ctl:has(> .keys-all) { width: auto; padding-left: 0; }
}
.set-desc.small.sb-look-note { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.sb-look-note .icon { flex: none; color: var(--fg-3); }

/* ---- Free time ---- */
.wg-free { gap: 8px; }
.wfr-len-chip {
  flex: none; padding: 1px 7px; border-radius: 99px;
  font-size: calc(10.5px * var(--ts, 1)); font-weight: 650; letter-spacing: .02em; text-transform: none;
  font-variant-numeric: tabular-nums; white-space: nowrap;
  color: var(--fg-2); background: rgba(var(--ink), .07);
}
.wfr-day { display: flex; flex-direction: column; gap: 1px; margin: 0 -7px; }
.wfr-day + .wfr-day { padding-top: 6px; border-top: 1px solid var(--line); }
.wfr-day-h {
  display: flex; flex-direction: column; gap: 7px; padding: 2px 7px 5px;
  font-size: calc(10.5px * var(--ts, 1)); font-weight: 650; letter-spacing: .06em; text-transform: uppercase;
  color: var(--fg-3);
}
.wfr-row {
  display: flex; align-items: center; gap: 8px;
  width: 100%; min-width: 0; padding: 6px 7px;
  border-radius: 10px; text-align: left;
  font-size: calc(12.5px * var(--ts, 1)); font-variant-numeric: tabular-nums;
  transition: background .2s var(--ease), transform .3s var(--spring);
}
.wfr-row::before { content: ""; flex: none; width: 3px; height: 15px; border-radius: 99px; background: color-mix(in srgb, var(--accent) 75%, transparent); }
.wfr-row:hover { background: rgba(var(--ink), .06); }
.wfr-row:active { transform: scale(.98); }
.wfr-range { flex: 1; min-width: 0; font-weight: 600; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wfr-len { flex: none; font-size: calc(12px * var(--ts, 1)); white-space: nowrap; color: var(--fg-3); }
/* The "+" that books it: shows on hover (always a little on touch screens). */
.wfr-add {
  display: grid; place-items: center; flex: none;
  width: 20px; height: 20px; border-radius: 99px;
  color: var(--fg-3); background: rgba(var(--ink), .07);
  opacity: 0; transform: scale(.8);
  transition: opacity .2s var(--ease), transform .35s var(--spring), background .2s, color .2s;
}
:is(.wfr-row, .wt-row):is(:hover, :focus-visible) .wfr-add { opacity: 1; transform: none; background: var(--accent); color: var(--on-accent); }
@media (hover: none) { .wfr-add { opacity: .7; transform: none; } }
.wfr-none { padding: 3px 7px 6px; font-size: calc(12.5px * var(--ts, 1)); color: var(--fg-3); }
/* L: the working day as a thin bar, its free windows lit, a tick for now. */
.wfr-line { position: relative; height: 5px; border-radius: 99px; background: rgba(var(--ink), .08); }
.wfr-seg { position: absolute; top: 0; bottom: 0; border-radius: 99px; background: color-mix(in srgb, var(--accent) 72%, transparent); }
.wfr-now { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; border-radius: 2px; background: var(--fg); }
/* S: one line. */
.sz-s .wg-free, .sz-s .wg-templates, .sz-s .wg-sounds, .sz-s .wg-holiday { padding: 10px 12px; }
.wfr-s, .wh-s { display: flex; align-items: center; gap: 9px; width: 100%; min-width: 0; text-align: left; }
.wfr-s-ic, .wh-s-ic { display: grid; place-items: center; flex: none; color: var(--fg-3); }
.wh-s-ic { color: var(--c, var(--fg-3)); }
.wfr-s-t, .wh-s-t { flex: 1; min-width: 0; font-size: calc(13.5px * var(--ts, 1)); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wfr-s.none .wfr-s-t { font-weight: 550; color: var(--fg-3); }
.wfr-s-when, .wh-s-when {
  flex: none; padding: 2px 8px; border-radius: 99px;
  font-size: calc(11px * var(--ts, 1)); font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap;
  color: var(--fg-2);
  background: color-mix(in oklab, var(--accent) 20%, rgba(var(--ink), .06));
}
.wh-s-when { background: color-mix(in oklab, var(--c, var(--fg)) 22%, rgba(var(--ink), .06)); }
:is(.wfr-s, .wh-s):hover :is(.wfr-s-t, .wh-s-t) { text-decoration: underline; text-decoration-color: rgba(var(--ink), .25); text-underline-offset: 3px; }

/* ---- Templates ---- */
.wt-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.wt-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wt-chip {
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 100%; min-width: 0; height: 30px; padding: 0 11px 0 9px;
  border-radius: 99px;
  font-size: calc(12.5px * var(--ts, 1)); font-weight: 600;
  color: var(--fg);
  background: color-mix(in oklab, var(--c, var(--fg)) 14%, rgba(var(--ink), .05));
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--c, var(--fg)) 22%, transparent);
  transition: background .2s var(--ease), transform .3s var(--spring);
}
.wt-chip:hover { background: color-mix(in oklab, var(--c, var(--fg)) 24%, rgba(var(--ink), .06)); }
.wt-chip:active { transform: scale(.95); }
.wt-ic { display: grid; place-items: center; flex: none; color: var(--c, var(--fg-3)); }
.wt-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* S: one row that scrolls sideways, fading out at the edge. */
.sz-s .wt-chips {
  flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
  margin: 0 -12px; padding: 1px 12px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 18px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 18px), transparent);
}
.sz-s .wt-chips::-webkit-scrollbar { display: none; }
.sz-s .wt-chip { flex: none; max-width: 70%; }
.sz-s .wt-empty .wg-empty { font-size: calc(12px * var(--ts, 1)); }
/* L: a row per template, with when, how long and where. */
.wt-list { display: flex; flex-direction: column; gap: 2px; margin: 0 -7px; }
.wt-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-width: 0; padding: 7px;
  border-radius: 11px; text-align: left;
  transition: background .2s var(--ease), transform .3s var(--spring);
}
.wt-row:hover { background: rgba(var(--ink), .06); }
.wt-row:active { transform: scale(.98); }
.wt-tile {
  display: grid; place-items: center; flex: none;
  width: 30px; height: 30px; border-radius: 9px;
  color: var(--c, var(--fg));
  background: color-mix(in oklab, var(--c, var(--fg)) 18%, transparent);
}
.wt-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.wt-row .wt-name { font-size: calc(13px * var(--ts, 1)); font-weight: 600; color: var(--fg); }
.wt-sum { font-size: calc(11.5px * var(--ts, 1)); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--fg-3); }

/* ---- Focus sounds ---- */
.wg-sounds .fs { margin-top: 0; }
.wg-sounds.playing { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 26%, rgba(var(--ink), .07)), inset 0 1px 0 rgba(255, 255, 255, .07); }
/* M: the choices and the volume; "Play during focus sessions" belongs to the timer (L shows it). */
.sz-m .wg-sounds .fs-auto { display: none; }
.sz-l .wg-sounds .fs-chip { min-height: 40px; padding: 8px 10px; font-size: calc(12.5px * var(--ts, 1)); }
.sbw.grow > .wg-sounds .fs-panel { flex: 1; justify-content: center; }

/* ---- Next holiday ---- */
.wg-holiday { gap: 9px; }
.wg-holiday[class*="cc-"] {
  background:
    radial-gradient(130% 110% at 0% 0%, color-mix(in oklab, var(--c, var(--fg)) 16%, transparent), transparent 64%),
    radial-gradient(120% 90% at 0% 0%, rgba(255, 255, 255, .07), transparent 60%),
    linear-gradient(160deg, rgba(var(--ink), .06), rgba(var(--ink), .025));
}
.wh-card {
  position: relative;
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  width: 100%; min-width: 0; padding: 1px 0 1px 13px;
  text-align: left;
  transition: transform .3s var(--spring);
}
.wh-card::before { content: ""; position: absolute; left: 0; top: 2px; bottom: 2px; width: 3.5px; border-radius: 99px; background: var(--c, var(--fg)); }
.wh-card:active { transform: scale(.985); }
.wh-when {
  max-width: 100%; margin-bottom: 4px; padding: 3px 9px; border-radius: 99px;
  font-size: calc(11.5px * var(--ts, 1)); font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap;
  color: var(--fg);
  background: color-mix(in oklab, var(--c, var(--fg)) 24%, rgba(var(--ink), .06));
}
.wh-card.today .wh-when { background: color-mix(in oklab, var(--c, var(--fg)) 42%, rgba(var(--ink), .06)); }
.wh-name {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  max-width: 100%;
  font-size: calc(17px * var(--ts, 1)); font-weight: 680; line-height: 1.25; letter-spacing: -.012em;
  overflow-wrap: anywhere; color: var(--fg);
}
.wh-card:hover .wh-name { text-decoration: underline; text-decoration-color: rgba(var(--ink), .25); text-underline-offset: 3px; }
.wh-date { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: calc(12.5px * var(--ts, 1)); font-weight: 550; color: var(--fg-2); }
.wh-off { padding: 1px 7px; border-radius: 99px; font-size: calc(10.5px * var(--ts, 1)); font-weight: 650; color: var(--fg-2); background: rgba(var(--ink), .08); }
.sbw.grow > .wg-holiday .ne-foot { margin-top: auto; }
.sz-l .wh-name { font-size: calc(20px * var(--ts, 1)); }

/* Round 17 — delete animations (src/ui/delete_fx.rs + .js)
   Copies of what was deleted play in this layer above everything, then it goes away.
   Nothing here repeats; the motion itself is driven from the script (one short burst). */
.dust-layer { position: fixed; inset: 0; z-index: 2147483000; pointer-events: none; overflow: hidden; }
.dust-layer, .dust-layer * { pointer-events: none !important; }
/* A copy must not replay its entrance animation (nor be read halfway through one). */
.dust-layer *, .dust-freeze, .dust-freeze * { animation: none !important; transition: none !important; }
.dust-canvas { position: fixed; display: block; }
.dust-gap { pointer-events: none; overflow: hidden; }
.dust-bin {
  position: fixed; width: 30px; height: 30px;
  color: var(--now);
  --bin-fill: color-mix(in srgb, var(--now) 14%, var(--bg));
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .22));
  transform-origin: 50% 100%;
  will-change: transform, opacity;
}
.dust-bin svg { display: block; overflow: visible; }
.dust-bin path { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dust-bin .bin-body { fill: var(--bin-fill); }
/* The lid hinges on its right end. */
.dust-bin .bin-lid { transform-box: view-box; transform-origin: 19.6px 6.7px; }
/* A sheet of paper, for a deletion with nothing on screen to throw away. */
.dust-paper {
  position: fixed; width: 14px; height: 18px; border-radius: 2.5px;
  background:
    linear-gradient(currentColor, currentColor) 3px 5px / 8px 1.5px no-repeat,
    linear-gradient(currentColor, currentColor) 3px 9px / 8px 1.5px no-repeat,
    linear-gradient(currentColor, currentColor) 3px 13px / 5px 1.5px no-repeat,
    var(--bg);
  color: var(--fg-4, rgba(var(--ink), .3));
  box-shadow: inset 0 0 0 1.2px rgba(var(--ink), .28), 0 3px 8px rgba(0, 0, 0, .18);
  transform-origin: 50% 50%;
}

/* Round 17 — AI assistants (MCP): Settings → Data → AI assistants. Still: a dot, no motion. */
.mcp-card .mcp-status,
.mcp-card .mcp-how,
.mcp-card .mcp-note { display: flex; align-items: center; gap: 8px; padding-bottom: 11px; font-size: calc(12px * var(--ts, 1)); line-height: 1.4; color: var(--fg-3); }
.mcp-card .mcp-how { flex-wrap: wrap; align-items: baseline; column-gap: 10px; row-gap: 4px; padding-top: 9px; box-shadow: inset 0 1px 0 rgba(var(--ink), .06); }
.mcp-card .mcp-how .link-btn { font-size: calc(12px * var(--ts, 1)); }
.mcp-card .mcp-note { color: var(--fg-2); }
.mcp-card .mcp-status-text { min-width: 0; }
.mcp-card .mcp-last { color: var(--fg-3); }
.mcp-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: rgba(var(--ink), .22); transition: background-color .3s ease, box-shadow .3s ease; }
.mcp-dot.on { background: #34c759; box-shadow: 0 0 0 3px rgba(52, 199, 89, .18); }
html.low-power .mcp-dot, html.idle .mcp-dot { transition: none; }
@media (prefers-reduced-motion: reduce) { .mcp-dot { transition: none; } }

/* Round 18 — magnetic sliders
   The number settles once now: when the slider is let go on a round value (magnet.js), not each
   time a drag passes one. So it rises a touch and lights up, then eases back, instead of popping
   in at full size. Only transform and colour on one short label: no layout, no glow (a dark
   halo reads as a smudge on a light theme). (The reduced-motion rule above and Battery saver
   still stop it.) */
@keyframes mono-snap-c { 35% { transform: translateY(-1px) scale(1.14); color: var(--fg); } }
@keyframes mono-snap-d { 35% { transform: translateY(-1px) scale(1.14); color: var(--fg); } }
.slider-ctl.snap-a .slider-val, .fs-vol.snap-a .fs-vol-ic { animation: mono-snap-c .34s cubic-bezier(.3, .7, .3, 1); }
.slider-ctl.snap-b .slider-val, .fs-vol.snap-b .fs-vol-ic { animation: mono-snap-d .34s cubic-bezier(.3, .7, .3, 1); }

/* Round 18 — Settings and About
   AI assistants (Settings → Data): folded to one row — the switch, who is connected, a
   chevron. The rest unfolds under it: the height through a one-row grid (0fr → 1fr) with a
   short fade, then it leaves the paint and the tab order (visibility; inert in the markup). */
.mcp-card .mcp-head { cursor: pointer; transition: background-color .2s ease; }
.mcp-card .mcp-head:hover { background: rgba(var(--ink), .025); }
.mcp-card .mcp-state { display: flex; align-items: center; gap: 7px; }
.mcp-card .mcp-switch { display: inline-flex; }
.mcp-chev {
  display: inline-grid; place-items: center; flex: none;
  width: 26px; height: 26px; margin-right: -4px; border-radius: 8px;
  color: var(--fg-3);
  transition: transform .38s var(--ease), background-color .2s ease, color .2s ease;
}
.mcp-head:hover .mcp-chev, .mcp-chev:focus-visible { color: var(--fg); background: rgba(var(--ink), .07); }
.mcp-card.open .mcp-chev { transform: rotate(180deg); }
.mcp-fold { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .38s var(--ease); }
.mcp-card.open .mcp-fold { grid-template-rows: 1fr; }
.mcp-fold-in { min-height: 0; overflow: hidden; opacity: 0; visibility: hidden; transition: opacity .18s ease, visibility 0s .38s; }
.mcp-card.open .mcp-fold-in { opacity: 1; visibility: visible; transition: opacity .3s ease .06s, visibility 0s; }
.mcp-card .mcp-about { margin-top: -3px; padding-bottom: 11px; font-size: calc(12px * var(--ts, 1)); line-height: 1.4; color: var(--fg-3); }
html.low-power .mcp-fold, html.low-power .mcp-fold-in, html.low-power .mcp-chev,
html.idle .mcp-fold, html.idle .mcp-fold-in, html.idle .mcp-chev { transition: none; }
@media (prefers-reduced-motion: reduce) { .mcp-fold, .mcp-fold-in, .mcp-chev { transition: none; } }

/* About: who made Mono — a small card under the text; the plane leans forward on hover. */
.about-author {
  display: inline-flex; align-items: center; gap: 10px;
  max-width: 100%; margin: 0 0 4px; padding: 6px 10px 6px 6px;
  border-radius: 14px;
  text-align: left; color: var(--fg);
  background: rgba(var(--ink), .05);
  box-shadow: inset 0 0 0 1px rgba(var(--ink), .07);
  transition: background-color .2s ease, transform .25s var(--spring);
}
.about-author:hover { background: rgba(var(--ink), .09); }
.about-author:active { transform: scale(.97); }
.about-author .aa-ic .icon { transition: transform .35s var(--spring); }
.about-author:hover .aa-ic .icon { transform: translate(1px, -1px); }
.aa-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.aa-label { font-size: calc(11px * var(--ts, 1)); font-weight: 550; color: var(--fg-3); }
.aa-handle { font-size: calc(13.5px * var(--ts, 1)); font-weight: 600; overflow-wrap: anywhere; }
.aa-go { display: inline-flex; margin-left: 2px; color: var(--fg-3); transition: transform .25s var(--ease), color .2s ease; }
.about-author:hover .aa-go { color: var(--fg-2); transform: translateX(2px); }
html.low-power .about-author, html.low-power .about-author *, html.idle .about-author, html.idle .about-author * { transition: none; }
@media (prefers-reduced-motion: reduce) { .about-author, .about-author * { transition: none !important; } }

/* Settings → Sidebar: "Restore default sidebar" under the notes. */
.sb-reset { display: flex; margin: 14px 0 2px; }
.sb-reset .ghost-btn:disabled { opacity: .45; cursor: default; }
.sb-reset .ghost-btn:disabled:active { transform: none; }

/* Round 18 — Settings and About: phone fixes
   A time zone picker shrinks to its row (the zone's name ends in "…") instead of running out
   of its card: as a flex item it could not get narrower than its whole label. */
.srow-ctl > .tz-picker { min-width: 0; max-width: 100%; }
.tz-picker > .tz-btn { max-width: min(260px, 100%); }
/* Sidebar widget titles: an empty spacer at the end of the title row only cost a gap. On touch
   screens the size button is always there: a little less room kept for it and a little less
   letter spacing, so "Ближайший праздник" fits on a phone. */
.wg-h > .spacer:last-child { display: none; }
@media (hover: none) { .wg-h { padding-right: 22px; letter-spacing: .045em; } }

/* Round 18 — delete dust (src/ui/delete_fx.js)
   Each copy that crumbles is its own small compositing layer, so the front sweeping across it
   repaints only the copy, not the page beneath. The copies go with the effect. */
.dust-layer > .dust-copy { will-change: transform; }

/* Round 18 — menu bar countdown + quick add from anywhere (Settings → General → Features)
   The shortcut choices sit under their switch like the morning summary's time; the warning
   when another app holds the shortcut reads like the AI assistants' notes. */
.srow.inset.qa-keys { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding-bottom: 11px; }
.qa-keys-label { font-size: calc(12px * var(--ts, 1)); color: var(--fg-3); }
.srow.inset.qa-taken { display: flex; align-items: center; gap: 8px; padding-bottom: 11px; font-size: calc(12px * var(--ts, 1)); line-height: 1.4; color: #c2410c; }
html[data-theme="dark"] .srow.inset.qa-taken { color: #fdba74; }
@media (prefers-color-scheme: dark) { html[data-theme="system"] .srow.inset.qa-taken { color: #fdba74; } }

/* Round 18 — page switching: no torn frame at the end of a swipe
   1. The time grid's scroller is never scrolled sideways. While a new week slides in from the
   right (.anim-next) it sticks out of the scroller by 34 px, and the rest of the swipe — the
   trackpad's momentum — scrolled the scroller into that strip: the hours and events slid
   left of the day names above them, and stayed there or jumped back once the slide ended
   (measured in WKWebView: scrolled 34 px, the grid 34 px off its header). `hidden` still clips
   and still lets it scroll up and down. */
.tg-scroll { overflow-x: hidden; }
/* 2. Switching views (week → month …) zooms in without a blur: the text no longer turns from
   soft to sharp in one step as it ends. It ends at the page's own look (no `to` frame). */
@keyframes in-zoom-r18 { from { opacity: 0; transform: scale(.975); } }
.anim-zoom { animation-name: in-zoom-r18; }

/* Round 18 — launch animation (Settings → Appearance; off unless chosen)
   Mono no longer comes out of a full-window blur, whose radius, tint and backdrop were redrawn
   over the whole window on every frame right while the app was starting. Only what the
   compositor animates by itself moves now: the app fades in from the background (a veil over
   everything, its opacity only) and settles from 98 % (a transform; the background stays put,
   scaled back up the same amount) — the settle eases out over the moments the app appears.
   The veil lies above the app, never an ancestor of the glass; until the app is there the
   calendar's outline shows faintly through it. Battery saver and reduced motion skip it all
   (the Round 13 rules). */
html.launching #launch {
  background-color: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
html.launch-out #launch {
  background-color: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: none; backdrop-filter: none;
  opacity: 0;
  transition: opacity .5s cubic-bezier(.25, .46, .45, .94);
}
html.launching .app { transform: scale(.98); }
html.launching .app > .backdrop { transform: scale(1.0204); }
html.launch-out .app, html.launch-out .app > .backdrop { transform: none; transition: transform .9s cubic-bezier(.33, 1, .68, 1); }

/* Round 18 — integration: the quick-add shortcut choices never cut their names
   Four shortcuts in one segmented control of equal parts got cut ("Ctrl+Shift+Пр…") on
   Windows at the default window size, and on a Mac in a narrow window. Here each choice is as
   wide as its name and they wrap to a second line when the card is narrow; the chosen one
   carries the pill's look itself (the sliding pill assumes equal parts in one line). */
.qa-keys .segmented { display: flex; flex-wrap: wrap; gap: 2px; max-width: 100%; }
.qa-keys .segmented .seg-pill { display: none; }
.qa-keys .segmented .seg { flex: 1 0 auto; padding: 0 10px; transition: color .3s var(--ease), background-color .25s ease, box-shadow .25s ease; }
.qa-keys .segmented .seg.active { background: rgba(var(--ink), .16); box-shadow: inset 0 1px 0 rgba(var(--ink), .14), 0 2px 8px rgba(0, 0, 0, .25); }
:root[data-theme="light"] .qa-keys .segmented .seg.active { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 0 0 .5px rgba(0,0,0,.05); }
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] .qa-keys .segmented .seg.active { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 0 0 .5px rgba(0,0,0,.05); }
}

/* Round 19 — Recently deleted (Settings → Data): folded to its header
   The list of deleted events stays folded under one row (the title with the count, Empty, a
   chevron); the header row unfolds it, Settings search too. The height goes through a
   one-row grid (0fr → 1fr) with a short fade, then the list leaves the paint and the tab
   order (visibility; inert in the markup) — as the AI assistants card does. */
.trash-card.has .trash-head { cursor: pointer; transition: background-color .2s ease; }
.trash-card.has .trash-head:hover { background: rgba(var(--ink), .025); }
.trash-chev {
  display: inline-grid; place-items: center; flex: none;
  width: 26px; height: 26px; margin-right: -4px; border-radius: 8px;
  color: var(--fg-3);
  transition: transform .38s var(--ease), background-color .2s ease, color .2s ease;
}
.trash-head:hover .trash-chev, .trash-chev:focus-visible { color: var(--fg); background: rgba(var(--ink), .07); }
.trash-card.open .trash-chev { transform: rotate(180deg); }
.trash-fold { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .38s var(--ease); }
.trash-card.open .trash-fold { grid-template-rows: 1fr; }
.trash-fold-in { min-height: 0; overflow: hidden; opacity: 0; visibility: hidden; transition: opacity .18s ease, visibility 0s .38s; }
.trash-card.open .trash-fold-in { opacity: 1; visibility: visible; transition: opacity .3s ease .06s, visibility 0s; }
.trash-fold-in > .srow:first-child { box-shadow: inset 0 1px 0 rgba(var(--ink), .06); }
html.low-power .trash-fold, html.low-power .trash-fold-in, html.low-power .trash-chev,
html.idle .trash-fold, html.idle .trash-fold-in, html.idle .trash-chev { transition: none; }
@media (prefers-reduced-motion: reduce) { .trash-fold, .trash-fold-in, .trash-chev { transition: none; } }

/* Round 19 — onboarding: Continue needs an answer
   Continue on a question with no answer (the name, at least one use) shakes the question
   once — a short sideways shake (onboarding.rs, `nudge`) — and shows a hint under it; Skip
   goes on without one. Reduced motion and battery saver keep only the red outline and the
   hint. The hint's line keeps its height while empty, so the card does not jump. */
.ob-input.need, .ob-input.need:focus { box-shadow: 0 0 0 2px color-mix(in srgb, #FF453A 70%, transparent); }
.ob-uses.need .ob-use { box-shadow: inset 0 0 0 1px color-mix(in srgb, #FF453A 45%, transparent); }
.ob-need-hint {
  display: block; text-align: center; text-wrap: balance;
  min-height: calc(18px * var(--ts, 1)); margin-top: -2px;
  font-size: calc(12.5px * var(--ts, 1)); line-height: 1.35; color: #FF6961;
}
:root[data-theme="light"] .ob-need-hint { color: #D70015; }
@media (prefers-color-scheme: light) { :root[data-theme="system"] .ob-need-hint { color: #D70015; } }
.ob-need-hint.on { animation: fade-in .25s ease both; }
.ob-need-hint .icon { display: inline-block; margin-right: 5px; vertical-align: -2px; }
@media (prefers-reduced-motion: reduce) { .ob-need-hint.on { animation: none; } }

/* Round 19 — About: the app icon follows the theme
   The icon in About (and on the first-run welcome) was always the light artwork, so in a dark
   Mono it stood out as a white tile, unlike the dark icon macOS shows in the Dock. Now it is
   the "Graphite glass" artwork of assets/icon/icon-dark.svg in dark (and Auto at night) and
   the light one in light. */
.brand-mark {
  --bm-base: linear-gradient(180deg, #3D3D43 0%, #2A2A2F 50%, #18181B 100%);
  --bm-edge: rgba(255, 255, 255, .14);
  --bm-pill: linear-gradient(180deg, #2C62A4, #1B4479);
  --bm-bar: #1A90FF;
  --bm-red: #FF453A;
  --bm-ring: #27272C;
  --bm-drop: rgba(0, 0, 0, .45);
  --bm-drop-big: rgba(0, 0, 0, .5);
  --bm-pill-glow: rgba(0, 0, 0, .35);
  background: var(--bm-base);
  box-shadow: inset 0 0 0 .5px var(--bm-edge), 0 1px 3px var(--bm-drop);
}
.brand-mark span:nth-child(1) { background: var(--bm-pill); box-shadow: inset 2px 0 0 var(--bm-bar); }
.brand-mark span:nth-child(2), .brand-mark span:nth-child(3) { background: var(--bm-red); }
.brand-mark.big { box-shadow: inset 0 0 0 1px var(--bm-edge), 0 10px 30px var(--bm-drop-big); }
.brand-mark.big span:nth-child(1) { box-shadow: inset 8px 0 0 var(--bm-bar), 0 4px 12px var(--bm-pill-glow); }
.brand-mark.big span:nth-child(2) { box-shadow: 0 0 8px color-mix(in srgb, var(--bm-red) 50%, transparent); }
.brand-mark.big span:nth-child(3) { box-shadow: 0 0 0 2.5px var(--bm-ring); }
:root[data-theme="light"] .brand-mark {
  --bm-base: linear-gradient(160deg, #FFFFFF 0%, #F3F4F8 60%, #E7E6F7 100%);
  --bm-edge: rgba(0, 0, 0, .1);
  --bm-pill: #B8DBFF;
  --bm-bar: #0088FF;
  --bm-red: #FF383C;
  --bm-ring: #fff;
  --bm-drop: rgba(0, 0, 0, .18);
  --bm-drop-big: rgba(0, 0, 0, .28);
  --bm-pill-glow: rgba(0, 136, 255, .2);
}
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] .brand-mark {
    --bm-base: linear-gradient(160deg, #FFFFFF 0%, #F3F4F8 60%, #E7E6F7 100%);
    --bm-edge: rgba(0, 0, 0, .1);
    --bm-pill: #B8DBFF;
    --bm-bar: #0088FF;
    --bm-red: #FF383C;
    --bm-ring: #fff;
    --bm-drop: rgba(0, 0, 0, .18);
  --bm-drop-big: rgba(0, 0, 0, .28);
    --bm-pill-glow: rgba(0, 136, 255, .2);
  }
}

/* Round 19 — What's new
   The card after an update: a small share-sheet (the modal-wrap fades only its scrim's colour,
   so the glass is blurred from the first frame — no opacity/filter ancestor). The lines rise
   in one after another once; nothing moves afterwards. */
.modal-wrap.wn-wrap { z-index: 118; }
.share-sheet.wn-sheet { width: min(420px, 100%); max-height: min(560px, 86vh); }
.wn-head { display: flex; align-items: center; gap: 12px; padding: 20px 16px 6px 22px; }
.wn-head .icon-btn { align-self: flex-start; margin-left: auto; }
.brand-mark.wn-mark { width: 40px; height: 40px; border-radius: 11px; flex: none; }
.brand-mark.wn-mark span:nth-child(2) { height: 2px; }
.brand-mark.wn-mark span:nth-child(3) { width: 7px; height: 7px; }
.wn-titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wn-kicker { font-size: calc(11px * var(--ts, 1)); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--primary); }
.wn-titles h2 { margin: 0; font-family: var(--font-display); font-size: calc(20px * var(--ts, 1)); font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.wn-body { display: flex; flex-direction: column; gap: 8px; padding: 10px 24px 4px; overflow-y: auto; scrollbar-width: none; }
.wn-body::-webkit-scrollbar { display: none; }
.wn-text, .wn-item { margin: 0; font-size: calc(13.5px * var(--ts, 1)); line-height: 1.45; color: var(--fg-2); overflow-wrap: anywhere; animation: wn-line .45s var(--spring) both; animation-delay: calc(.12s + var(--i, 0) * .05s); }
.wn-item { display: flex; align-items: baseline; gap: 10px; color: var(--fg); }
.wn-dot { flex: none; width: 6px; height: 6px; border-radius: 99px; background: var(--primary); translate: 0 -1px; }
@keyframes wn-line { from { opacity: 0; transform: translateY(6px); } }
.wn-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px 18px; }
@media (prefers-reduced-motion: reduce) { .wn-text, .wn-item { animation: none; } }

/* Round 19 — open at login: the note under the row while macOS waits for the user's OK in
   System Settings → Login Items (with its button), or when the system said no. */
.srow.inset.login-hint { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; padding-bottom: 11px; font-size: calc(12px * var(--ts, 1)); line-height: 1.4; color: #c2410c; }
.srow.inset.login-hint > span { flex: 1 1 180px; }
html[data-theme="dark"] .srow.inset.login-hint { color: #fdba74; }
@media (prefers-color-scheme: dark) { html[data-theme="system"] .srow.inset.login-hint { color: #fdba74; } }

/* Round 19 — sidebar toggle
   Folding the sidebar animated the grid's columns: every frame WebKit restyled the main column
   (a size container, `container: main`) and laid out the whole week, hundreds of events, again
   (some 24 ms a frame: about 40 frames a second here, fewer on a big window). Now the layout
   switches once, as the toggle happens, and the panels move on the compositor (transform,
   opacity) at the display's own rate, 60 or 120 Hz: the sidebar slides out (or in) whole, and
   the calendar column glides from where it stood to its new place beside it. The column's new
   width shows at once; its left edge moves on with the sidebar's. `sb-moved` (ui/mod.rs) is
   set once the sidebar has been toggled, so nothing slides on the first frame. Below 981 px the
   sidebar is a drawer over the calendar (its own slide, above): there the keyframes stay put.
   Battery saver and reduced motion take every animation away (above): the switch is instant.
   Effects (effects.js) rest along the edges during the slide, from "sb-main-*".
   Both ways, the calendar column slides at its narrower width (the one it has beside the
   sidebar): opening, it takes it at once; closing, the grid keeps the sidebar's track until
   the slide ends (sb-main-hold), and the column moves left. Its two panels reach on past the
   window's right edge for the slide (sb-main-wide, sb-main-tb), so no strip of background
   opens there: the schedule keeps the wider width it has without the sidebar, unseen beyond
   the edge (one layout as the slide starts, none as it ends, closing; opening, the reverse),
   and the toolbar's own row stays laid out at the narrower width (its padding takes the rest),
   so its controls all fit in what shows of it at every frame. The toolbar's groups (the title,
   the view switcher, ← Today → … +) glide from where they stood to where they end, the right
   ones staying at the window's edge (POINTER_JS in ui/mod.rs: the same duration and easing,
   on the compositor). The names stay set at every width, so crossing 981 px is no new slide;
   only the keyframes change. (Round 21: the toolbar no longer reaches past the edge, and what
   shows of both panels ends at the gutter, rounded; see "the panels' right ends", below.) */
.app { transition: none; }
/* (Round 39, verifier: the calendar column only, `> .main`. As `.main` it also caught Settings →
   Effects' little stage and cards (.fx-mini.main, .fx-art-p.main) once the sidebar had moved:
   they slid in from the left as the tab opened, and the effects, taking it for the sidebar's
   slide, rested meanwhile — the field's vignette showed uncut over Settings, a blink.) */
.app.sb-moved.no-sidebar > .main { animation: sb-main-close .6s var(--ease); }
.app.sb-moved:not(.no-sidebar) > .main { animation: sb-main-open .6s var(--ease); }
.app.sb-moved.no-sidebar { animation: sb-main-hold .6s linear; }
.app.sb-moved.no-sidebar .main > .stage { animation: sb-main-wide-c .6s linear; }
.app.sb-moved:not(.no-sidebar) .main > .stage { animation: sb-main-wide-o .6s linear; }
.app.sb-moved.no-sidebar .main > .toolbar { animation: sb-main-tb-c .6s linear; }
.app.sb-moved:not(.no-sidebar) .main > .toolbar { animation: sb-main-tb-o .6s linear; }
/* The toolbar's padding (above), for its keyframes. */
.toolbar { --tb-pl: 10px; --tb-pr: 12px; }
@container main (max-width: 760px) { .toolbar { --tb-pl: 8px; --tb-pr: 8px; } }
@keyframes sb-main-close { from { transform: none; } }
@keyframes sb-main-open { from { transform: none; } }
@keyframes sb-main-hold { }
@keyframes sb-main-wide-c { }
@keyframes sb-main-wide-o { }
@keyframes sb-main-tb-c { }
@keyframes sb-main-tb-o { }
@media (min-width: 981px) {
  .sidebar { width: var(--sb-w); transition: opacity .4s var(--ease), transform .6s var(--ease); }
  .sidebar.closed { opacity: 0; transform: translateX(calc(-100% - 10px)); filter: none; }
  @keyframes sb-main-close { to { transform: translateX(calc(-10px - var(--sb-w))); } }
  @keyframes sb-main-open { from { transform: translateX(calc(-10px - var(--sb-w))); } }
  @keyframes sb-main-hold { from, to { grid-template-columns: var(--sb-w) minmax(0, 1fr); gap: 10px; } }
  @keyframes sb-main-wide-c { from, to { margin-right: calc(-10px - var(--sb-w)); } }
  @keyframes sb-main-wide-o { from, to { margin-right: calc(-10px - var(--sb-w)); } }
  /* Closing, the left padding stays as it is beside the sidebar (the Mac's room for the
     traffic lights comes back as the slide ends; the title glides over to it). Round 21: the
     toolbar no longer reaches past the window's edge; it goes with the column at its narrower
     width, and its glass is drawn for the slide with its right end standing still (sbGhost,
     ui/mod.rs: "Round 21 — sidebar: the panels' right ends", below). sb-main-tb-o stays empty:
     its end is the toolbar's (tbGlide). */
  @keyframes sb-main-tb-c { from, to { padding-left: var(--tb-pl); } }
  /* Round 22 — the stage keeps the top the sheet shows as the slide starts when the toolbar
     changes rows (the editor open; sbGlide in ui/mod.rs: --sb-mt), until the slide's last frame. */
  @keyframes sb-main-mt { from, to { margin-top: var(--sb-mt, 0px); } }
  html.sbf-mt .app.sb-moved.no-sidebar .main > .stage { animation: sb-main-wide-c .6s linear, sb-main-mt .6s linear; }
  html.sbf-mt .app.sb-moved:not(.no-sidebar) .main > .stage { animation: sb-main-wide-o .6s linear, sb-main-mt .6s linear; }
}
/* Round 23 — reduced motion: no slide at all, the switch instant (as with battery saver), not one
   of a hundredth of a millisecond (the general reduced-motion rule), whose first frame could show
   its first keyframe: the schedule's sheet reaching past the window's edge, its corners square. */
@media (prefers-reduced-motion: reduce) {
  .app.sb-moved, .app.sb-moved .main, .app.sb-moved .main > .stage, .app.sb-moved .main > .toolbar { animation-name: none !important; }
}
/* The hidden copy of the toolbar the glide measures (POINTER_JS) stands still. */
.tb-probe, .tb-probe * { animation: none !important; transition: none !important; }

/* Round 21 — sidebar: the panels' right ends
   Reaching past the window's edge, the toolbar's glass and the schedule's sheet lost their
   rounded right corners and covered the gutter for the slide (the glass a square strip running
   off the window). Now, for the slide, each one's own look is drawn by two empty copies of it
   (sbGhost in POINTER_JS, ui/mod.rs): one goes with the calendar column, the other stands at the
   panel's right end, rounded, with the gutter beside it; they meet at a line that stands still
   just before the right corners. Everything that moves there moves on the compositor with the
   column's own keyframes and timing, so the right ends stand still in every frame. The panels'
   own background, border, shadow, blur and sheen are off meanwhile. */
.sb-ghost { background: none !important; border-color: transparent !important; box-shadow: none !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
.sb-ghost::before, .sb-ghost::after { visibility: hidden !important; }
/* Round 22 — the copies' sheen (.glass::before): the panel's own width, from its left edge (the
   copy that goes with the column) or its right end (the one standing there), eased from the
   width it had (sbGhost: --sbg-w and a scaleX), so it is the panel's own in every frame instead of
   the copies' wider boxes'. */
.sb-ghost-layer .glass::before { right: auto; width: var(--sbg-w, 100%); transform-origin: 0 50%; }
.sb-ghost-layer .glass.sbg-r::before { left: auto; right: 0; transform-origin: 100% 50%; }
/* Round 24 — a frosted panel's glass (the toolbar's) is one copy for the slide, standing still with
   its right end, in a rounded clip that goes with the column (sbGhost): two copies side by side
   each blurred the other's tint into its own near their line, and the right end went darker. */

/* Round 20 — sidebar: smooth grid
   The schedule glides with the sidebar toggle (POINTER_JS in ui/mod.rs, sbGlide): the final
   layout once, then every box from its old rect to its new one (FLIP). */
/* The scale of its box a part of the schedule undoes during the slide (sbGlide animates it
   on each part; not inherited, so a change restyles that part alone). */
@property --sbk { syntax: '<number>'; inherits: false; initial-value: 1; }
/* The all-day chip's title in its own span (ui/timegrid.rs), ellipsised as before. */
.ad-chip > .ad-t { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html.sbf .main > .stage :is(.tg-head-days, .tg-allday-days, .tg-days, .mv-head, .mv-grid, .ym) { transform-origin: 0 0; }
/* While it glides: the text and the round parts take the inverse of their box's scale, about
   the point they hang from — their own left (text that starts at a box's left), their own
   centre (centred text, dots), or the point sbGlide puts in --sbo (their cell's or chip's
   left, centre or right: what stands at a fixed distance from an edge keeps that distance). They keep their size; their box's background, lines and edges scale. */
html.sbf .main > .stage :is(.ev-inner, .mv-wd) { scale: calc(1 / var(--sbk)) 1; transform-origin: 0 0; }
html.sbf .main > .stage :is(.now-dot, .ym-wds > *, .yd) { scale: calc(1 / var(--sbk)) 1; transform-origin: 50% 50%; }
html.sbf .main > .stage :is(.tg-hd > *, .ev-cat-ic, .mv-num-row > *, .ad-chip > .ad-t, .mv-chip > *, .mv-more, .ym-title) { scale: calc(1 / var(--sbk)) 1; transform-origin: var(--sbo, 0px) 50%; }
/* Every counter (own left, own centre or a --sbo point): the difference between where it stood and where the
   box's scale would put it, gone by the end with the scale (sbGlide: --sbc, --sbcy, in px per
   unit of scale; the x part inside the scaled box, hence the 1 / --sbk). */
html.sbf .main > .stage :is(.ev-inner, .mv-wd, .now-dot, .ym-wds > *, .yd, .tg-hd > *, .ev-cat-ic, .mv-num-row > *, .ad-chip > .ad-t, .mv-chip > *, .mv-more, .ym-title) { translate: calc(var(--sbc, 0px) * (1 - 1 / var(--sbk))) calc(var(--sbcy, 0px) * (var(--sbk) - 1)); }
/* Round 22 — a text line cut short at either width (sbGlide: .sbx): not cut at its room's end for
   the slide, but clipped there as the room eases from the one width to the other (its size in the
   row stays as it is: min-width). */
html.sbf .main > .stage :is(.ev-title, .ev-time, .ev-loc, .mv-chip > .n, .ad-chip > .ad-t).sbx { overflow: visible; min-width: 0; text-overflow: clip; }
/* …and one that stands elsewhere in its part at the new width (a short event's time, after its
   title) moves from where it stood, with its own --sbk (sbGlide: --sbd, px per unit of scale). */
html.sbf .main > .stage :is(.ev-title, .ev-time, .ev-loc).sbd { translate: calc(var(--sbd, 0px) * (1 - var(--sbk))) 0; }
/* Opening: the schedule takes its final (narrow) width at once, inside the stage that still
   reaches past the window's edge (sb-main-wide-o); the clipping boxes (the scroller, the
   all-day row, the year's scroller) keep the stage's width so the scaled grid shows whole. */
@media (min-width: 981px) {
  html.sbf-narrow .app:not(.no-sidebar) .main > .stage :is(.tg-head, .tg-allday, .tg-body) { padding-right: calc(10px + var(--sb-w)); }
  html.sbf-narrow .app:not(.no-sidebar) .main > .stage .mv { padding-right: calc(10px + var(--sb-w)); }
  html.sbf-narrow .app:not(.no-sidebar) .main > .stage .yv { padding-right: calc(26px + 10px + var(--sb-w)); }
  /* Day's agenda, shown at one of the two widths only, shows for the whole slide (sbGlide):
     closing, in its place at the width the slide ends at; opening, out of the row at the
     stage's right end, which leaves past the window's edge. It fades in or out meanwhile. */
  html.sbf-ag .app:not(.has-inspector) .main > .stage .tg-wrap > .agenda { display: block; }
  html.sbf-ag-o .app:not(.has-inspector) .main > .stage .tg-wrap { position: relative; }
  html.sbf-ag-o .app:not(.has-inspector) .main > .stage .tg-wrap > .agenda { position: absolute; top: 0; right: 0; bottom: 0; }
}
/* The toolbar during the slide (tbGlide, ui/mod.rs: .tb-glide): the search field's width eases
   with the slide, not after it (its own width transition held off), and what is inside it shows
   only as far as the field reaches. */
.toolbar.tb-glide .search-btn { transition: background .25s var(--ease), box-shadow .25s var(--ease), color .2s, transform .3s var(--spring); overflow: hidden; }

/* Round 19 — phones: the toast and the event card
   On a narrow screen the event card is a sheet along the bottom edge, where the toast sits too
   ("Created · Undo" covered the card's Edit button for its few seconds). While a card is open
   the toast comes in from the top instead. A touch screen has no keys: the sidebar's ⌘,
   keycap goes. */
@media (max-width: 640px) {
  html:has(.event-card) .toast { top: calc(10px + env(safe-area-inset-top, 0px)); bottom: auto; }
  html:has(.event-card) .toast:not(.show) { transform: translate(-50%, -160%) scale(.9); }
}
@media (hover: none) and (pointer: coarse) { .sb-settings kbd { display: none; } }

/* Round 19 — screens: viewport units, touch basics
   --vvh is the window's height as it is now: 100dvh where it exists (iOS Safari's 100vh is the
   tall viewport, taller than what shows while its toolbars are out), 100vh elsewhere. Sheets
   and popovers below use it; the inline styles of the card and the calendar menus too
   (ui/card.rs, ui/calendars.rs). --kb: how much of the window the on-screen keyboard covers
   (index.html; 0 elsewhere). --tb-bottom: where the toolbar ends (ui/mod.rs, POINTER_JS). */
:root { --vvh: 100vh; }
@supports (height: 100dvh) {
  :root { --vvh: 100dvh; }
  .sheet { max-height: min(86dvh, 860px); }
  .settings { height: min(640px, 88dvh); }
  .import-sheet { max-height: min(680px, 88dvh); }
  .share-sheet { max-height: min(640px, 88dvh); }
  .share-sheet.phone-sheet { max-height: min(780px, 92dvh); }
  .share-sheet.wn-sheet { max-height: min(560px, 86dvh); }
  .print-sheet { max-height: min(680px, 90dvh); }
  .ft-sheet { max-height: min(720px, 90dvh); }
  .onboard-card { max-height: min(720px, 94dvh); }
  .event-card { max-height: min(70dvh, 520px); }
  .now-card { max-height: calc(100dvh - 48px); }
  .rem-stack.all { max-height: calc(100dvh - 88px); }
  @media (max-width: 640px) {
    .settings { height: 88dvh; }
    .inspector { height: 78dvh; }
  }
}
/* Taps draw Mono's own press, not iOS's grey box; a long press on the calendar opens no
   system callout (links in notes keep theirs). */
html { -webkit-tap-highlight-color: transparent; }
.app { -webkit-touch-callout: none; }
.app a[href] { -webkit-touch-callout: default; }
/* Safari only reads the prefixed user-select: on a touch screen the card, the editor and the
   sheets meant to be selectable now are (and fields always take a caret inside .app). The Mac
   app keeps what it had. */
@media (hover: none) {
  .inspector, .event-card, .sheet-body, .set-content, .task-edit, .pal-input input, .pe-name, .nh-notes { -webkit-user-select: text; }
  input, textarea, [contenteditable="true"], [contenteditable=""] { -webkit-user-select: text; user-select: text; }
}

/* Round 19 — screens: safe areas
   With viewport-fit=cover (index.html) an iPhone draws the page under its status bar, Dynamic
   Island, rounded corners and home indicator; env(safe-area-inset-*) are those sizes (0 on a
   computer and in the desktop apps, where nothing below changes). Every layer pinned to an
   edge keeps clear of them. */
.app {
  padding: max(10px, env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px))
           max(10px, env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
}
#boot {
  padding: max(10px, env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px))
           max(10px, env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
}
.inspector { top: max(10px, env(safe-area-inset-top, 0px)); right: max(10px, env(safe-area-inset-right, 0px)); bottom: max(10px, env(safe-area-inset-bottom, 0px)); }
.toast { bottom: calc(22px + env(safe-area-inset-bottom, 0px)); }
.modal-wrap, .onboard {
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px))
           max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
@media (max-width: 980px) {
  .sidebar { top: max(10px, env(safe-area-inset-top, 0px)); left: max(10px, env(safe-area-inset-left, 0px)); bottom: max(10px, env(safe-area-inset-bottom, 0px)); }
  .app.no-sidebar .sidebar, .sidebar.closed { transform: translateX(calc(-100% - 20px - env(safe-area-inset-left, 0px))); }
  /* A tablet, or a phone on its side: the editor panel starts under the toolbar instead of
     covering its buttons (Today, ← →, +, Settings). */
  .inspector { top: calc(var(--tb-bottom, 68px) + 8px); }
}
@media (max-width: 640px) {
  .app {
    padding: max(6px, env(safe-area-inset-top, 0px)) max(6px, env(safe-area-inset-right, 0px))
             max(6px, env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px));
  }
  #boot { padding: max(6px, env(safe-area-inset-top, 0px)) max(6px, env(safe-area-inset-right, 0px)) max(6px, env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px)); }
  .event-card {
    left: max(8px, env(safe-area-inset-left, 0px)) !important; right: max(8px, env(safe-area-inset-right, 0px));
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }
  /* The editor sheet: above the home indicator, and above the keyboard while typing. */
  .inspector {
    top: auto;
    left: max(6px, env(safe-area-inset-left, 0px)); right: max(6px, env(safe-area-inset-right, 0px));
    bottom: calc(6px + max(var(--kb, 0px), env(safe-area-inset-bottom, 0px)));
    max-height: calc(var(--vvh) - var(--kb, 0px) - env(safe-area-inset-top, 0px) - 16px);
    transform: translateY(calc(100% + 26px + max(var(--kb, 0px), env(safe-area-inset-bottom, 0px))));
  }
  .inspector.open { transform: none; }
  .rem-stack, .rem-stack.all {
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px));
  }
  .summary { top: calc(var(--tb-bottom, 102px) + 8px); }
  /* While a card is open the toast comes in at the top: under the toolbar, not over it. */
  html:has(.event-card) .toast { top: calc(var(--tb-bottom, calc(env(safe-area-inset-top, 0px) + 102px)) + 8px); }
}
/* A sheet never runs past the screen between the notch and the home indicator. */
@media (max-width: 640px), (max-height: 500px) {
  .modal-wrap > * { max-height: 100%; }
}
/* The palette's list stays above the keyboard on a touch screen. */
@media (hover: none) and (pointer: coarse) {
  .pal-list { max-height: min(52vh, max(160px, calc(var(--vvh) - var(--kb, 0px) - 13vh - 140px))); }
}

/* Round 19 — screens: touch gestures (ui/mod.rs, POINTER_JS)
   A finger that lands on an event, a task or a chip scrolls the page like anywhere else; the
   drag starts after a long press. The resize grip is fatter under a finger. */
.ev, .ev-resize, .ad-chip, .mv-chip, .task { touch-action: pan-y pinch-zoom; }
.stage { touch-action: pan-y pinch-zoom; }
@media (pointer: coarse) {
  .ev:not(.tiny):not(.short) .ev-resize { height: 14px; }
  .ev.selected .ev-resize::after { opacity: .45; }
}

/* Round 19 — screens: phones
   The search moves into "+" (the toolbar has no room for its field); a phone hides what
   belongs to a computer: Send to phone, the widget page, the key list and keycaps. */
.plus-menu .pm-search { display: none; }
@media (max-width: 640px) { .plus-menu .pm-search { display: flex; } }
@media (hover: none) and (pointer: coarse) {
  .sb-keys, .palette kbd, .plus-menu kbd { display: none; }
}
@media (hover: none) and (pointer: coarse) and (max-width: 640px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
  .phone-send, .sb-widget { display: none; }
}
/* The tour's card is never wider than the screen (onboarding.rs places it the same). */
.tour-card { width: min(320px, calc(100vw - 32px)); }
/* Settings → Appearance → Text size: the six sizes get the whole row. */
@media (max-width: 640px) {
  .ts-row .ts-a { display: none; }
  .ts-row .segmented .seg { padding: 0 1px; font-size: calc(11.5px * var(--ts, 1)); letter-spacing: -.01em; }
  /* "ALL-DAY" on one line in the narrow gutter. */
  .tg-gutter-head.ad-label { font-size: calc(9px * var(--ts, 1)); letter-spacing: .01em; line-height: 1.1; text-align: center; padding: 0 2px; }
}

/* Round 19 — screens: month
   Chips keep their height (18 px at the least) and the cell shows as many as fit
   (ui/month.rs, ChipFit). Small cells — a phone, a phone on its side — show a thin bar in the
   event's colour for each, and a bare "+N". */
.mv-chip { min-height: 18px; }
.mv-more { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; }
.mv-grid.compact .mv-cell { padding: 3px 3px 2px; gap: 2px; }
.mv-grid.compact .mv-num { min-width: 22px; height: 22px; padding: 0 5px; font-size: calc(12px * var(--ts, 1)); }
.mv-grid.compact .mv-chips { gap: 2px; }
.mv-grid.compact .mv-chip { flex: none; min-height: 0; height: 5px; padding: 0; gap: 0; border-radius: 3px; }
.mv-grid.compact .mv-chip > *, .mv-grid.compact .mv-chip::before { display: none; }
.mv-grid.compact .mv-chip.allday.cont-l:not(.head) { margin-left: -3px; }
.mv-grid.compact .mv-chip.allday { padding: 0; }
.mv-grid.compact .mv-chip.timed { background: var(--c, var(--fg)) !important; opacity: .7; }
.mv-grid.compact .mv-chip.selected { opacity: 1; }
.mv-grid.compact .mv-more { padding: 0 2px; font-size: calc(10px * var(--ts, 1)); line-height: 11px; text-align: center; }

/* Round 19 — screens: year
   A 320 px phone: one month a row (two cramped the numbers together). A tablet standing up:
   three, with bigger days, so the months fill the height. */
@media (max-width: 360px) {
  .yv { grid-template-columns: minmax(0, 1fr); padding: 12px 18px; }
  .ym { width: 100%; max-width: 320px; justify-self: center; }
  .yd { max-height: 40px; font-size: calc(13px * var(--ts, 1)); }
}
@media (min-width: 641px) and (max-width: 900px) and (orientation: portrait) and (hover: none) and (pointer: coarse) {
  .yv { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 22px; }
  .yd { max-height: 36px; font-size: calc(12.5px * var(--ts, 1)); }
}

/* Round 19 — screens: onboarding
   On a short screen (a small iPhone, any phone on its side) the setup card scrolls: its
   buttons stay in sight at its foot, over a band of the card's own colour. */
@media (max-height: 760px), (max-width: 640px) {
  .ob-foot {
    position: sticky; bottom: 0; z-index: 2;
    margin: -12px -28px -22px; padding: 12px 28px 22px;
    background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 0%, transparent), color-mix(in srgb, var(--bg) 88%, transparent) 12px);
  }
  .onboard-card { max-height: min(720px, 100%); }
}
@media (max-height: 500px) {
  .onboard-card { padding: 16px 22px 14px; gap: 12px; }
  .ob-foot { margin: -10px -22px -14px; padding: 10px 22px 14px; }
  .ob-hero .brand-mark.big { width: 56px; height: 56px; border-radius: 15px; margin-bottom: 0; }
  .ob-hero h1 { font-size: calc(22px * var(--ts, 1)); }
  .ob-langs { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
}

/* Round 19 — screens: tablets
   An iPad on its side with the sidebar docked: the editor panel goes over the sidebar side of
   the calendar instead of squeezing it to a strip. And a calendar column too narrow for the
   toolbar's one row gives the title a row of its own (it shrank to nothing). */
@media (min-width: 981px) and (max-width: 1280px) and (hover: none) and (pointer: coarse) {
  .app.has-inspector .main { margin-right: 0; }
  .inspector { top: calc(var(--tb-bottom, 68px) + 8px); }
}
@media (min-width: 641px) {
  @container main (max-width: 520px) {
    .toolbar { grid-template-columns: minmax(0, 1fr); grid-template-areas: "l" "r" "c"; }
    .tb-right { justify-self: end; }
  }
}

/* Round 19 — screens: touch targets
   Under a finger the small controls answer in a box of about 40 px — mostly an invisible
   margin around them, so nothing moves; the toolbar's view switcher and the card's buttons
   grow a little. */
@media (hover: none) and (pointer: coarse) {
  :where(.toolbar .icon-btn, .toolbar .pill-btn, .sheet-head .icon-btn, .icon-btn.sm, .icon-btn.tiny, .rem-x, .task-x, .task-flag, .check, .ev-check, .link-btn) { position: relative; }
  .toolbar .icon-btn::after, .toolbar .pill-btn::after { content: ""; position: absolute; inset: -5px -2px; }
  .sheet-head .icon-btn::after, .icon-btn.sm::after, .icon-btn.tiny::after, .cf-more::after, .wg-size::after,
  .rem-x::after, .task-x::after, .task-flag::after { content: ""; position: absolute; inset: -7px; }
  .check::after, .ev-check::after { content: ""; position: absolute; inset: -8px; }
  .link-btn::after { content: ""; position: absolute; inset: -11px -8px; }
  .tb-center .seg { height: 34px; }
  .card-actions .icon-btn { width: 38px; height: 38px; }
  .chip { height: 32px; }
  .done-btn { height: 36px; }
}

/* Round 19 — screens: no sticky hover on touch
   iOS keeps :hover on what was tapped until something else is: a tapped event stayed lit and
   raised, a toolbar button looked pressed, a year day stayed enlarged. */
@media (hover: none) {
  .ev:hover, :root[data-theme] .ev:hover { filter: none; }
  .ev:not(.ghost):not(.lifting):not(.selected):hover { transform: none; }
  .yd:not(.out):hover { transform: none; }
  .toolbar .icon-btn:not(.primary):hover, .card-actions .icon-btn:hover, .sheet-head .icon-btn:hover { background: none; }
  .icon-btn.primary:hover { filter: none; }
  .icon-btn:hover .icon { transform: none; }
  .tg-hd.back:hover .hd-back { transform: none; }
  .act-card:hover { transform: none; }
}

/* Round 19 — Settings trash can: background / own sound
   (delete_fx.js `keep`.) The can stands in the pressed button's own place, inside a clip the
   size of the sheet that scrolls (so nothing draws over the sheet's edges or header); a
   small chip of what was removed drops in. The clip's transform makes it the frame for the
   fixed copies and the can inside it. */
.dust-clip { position: fixed; overflow: hidden; transform: translateZ(0); }
.dust-chip {
  position: absolute; box-sizing: border-box;
  transform-origin: 50% 50%; will-change: transform, opacity;
  box-shadow: 0 0 0 1px rgba(var(--ink), .16), 0 3px 8px rgba(0, 0, 0, .22);
}
/* A small picture of the background, like a print: a light rim. */
.dust-chip.pic {
  width: 26px; height: 19px; border-radius: 4.5px;
  background: var(--bg) center / cover no-repeat;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .92), 0 3px 9px rgba(0, 0, 0, .3);
}
.dust-chip.label {
  display: grid; place-items: center; height: 17px; padding: 0 6px; border-radius: 6px;
  background: color-mix(in srgb, var(--fg) 9%, var(--bg)); color: var(--fg-2);
  font-size: 10.5px; font-weight: 650; line-height: 1; letter-spacing: .03em; white-space: nowrap;
}
.dust-chip.glyph {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px;
  background: color-mix(in srgb, var(--fg) 7%, var(--bg)); color: var(--fg-2);
}
.dust-chip.glyph svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Round 19 — final: phones, tablets, sidebar open
   Month, small cells (ui/month.rs, ChipFit): a busy day shows as many bars as a quieter one;
   its "+N" sits at the end of the last bar's line instead of a line of its own (a phone on its
   side had room for the line or for bars, not both, so the busiest days looked emptiest). */
.mv-grid.compact .mv-chips.with-more { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 3px; row-gap: 2px; align-items: center; }
.mv-grid.compact .mv-chips.with-more > .mv-chip { grid-column: 1; }
.mv-grid.compact .mv-chips.with-more > .mv-more {
  grid-column: 2; height: 5px; padding: 0 1px 0 0; overflow: visible;
  font-size: calc(9.5px * var(--ts, 1)); line-height: 5px; letter-spacing: -.01em; text-align: right;
}
/* Touch: the controls the screen check found under 36 px. Invisible hit areas where the layout
   must stay (ending at the right edge: the boxes' own width is all their text has), a little
   more room where it may. ← and → take the 2 px gaps beside "Today" into their own width (the
   chevrons move out 2 px), so each answers in 36 px or more without taking a neighbour's. */
@media (hover: none) and (pointer: coarse) {
  .toolbar .nav-group { gap: 0; }
  .toolbar .nav-group > .icon-btn { width: 36px; }
  .toolbar .nav-group > .icon-btn::after, .toolbar .nav-group > .pill-btn::after { inset: -5px 0; }
  .toolbar .nav-group > .icon-btn:first-child::after { left: -4px; }
  .set-head .icon-btn { position: relative; }
  .set-head .icon-btn::after { content: ""; position: absolute; inset: -6px; }
  .plus-menu .menu-item { min-height: 40px; }
  .wg-size::after { inset: -8px 0 -8px -16px; }
  .sidebar .mini-day { height: 34px; }
  .sidebar .mini-day::before { content: ""; position: absolute; inset: -1px 0; }
  .mini-title.fold-title { position: relative; }
  .mini-title.fold-title::after { content: ""; position: absolute; inset: -8px -4px; }
}

/* Round 24 — editor: smooth open and close
   The calendar column made room for the editor with a margin transition, laid out again in every
   frame (45-50 frames a second with a busy week), its container queries switching the toolbar's
   layout in single frames on the way. Now the column takes its new width once, as the editor opens
   or closes, and everything glides from where it stood to where it ends with the editor's own slide
   (POINTER_JS in ui/mod.rs: inspGlide): the panels' looks drawn by copies whose ends move (the
   panels' own look off meanwhile: .sb-ghost, "the panels' right ends"), the toolbar's parts and the
   schedule's boxes from their old places to their new ones. */
html.ig-on .main { transition: none; }
/* The scale of its box a part of the schedule undoes during the glide (as --sbk for the sidebar's). */
@property --igk { syntax: '<number>'; inherits: false; initial-value: 1; }
@property --igky { syntax: '<number>'; inherits: false; initial-value: 1; }
html.igf .main > .stage :is(.tg-head-days, .tg-allday-days, .tg-days, .mv-head, .mv-grid, .ym) { transform-origin: 0 0; }
html.igf .main > .stage :is(.ev-inner, .mv-wd) { scale: calc(1 / var(--igk)) calc(1 / var(--igky)); transform-origin: 0 0; }
html.igf .main > .stage :is(.now-dot, .ym-wds > *, .yd) { scale: calc(1 / var(--igk)) calc(1 / var(--igky)); transform-origin: 50% 50%; }
html.igf .main > .stage :is(.tg-hd > *, .ev-cat-ic, .mv-num-row > *, .ad-chip > .ad-t, .mv-chip > *, .mv-more, .ym-title) { scale: calc(1 / var(--igk)) calc(1 / var(--igky)); transform-origin: var(--igo, 0px) 50%; }
html.igf .main > .stage :is(.ev-inner, .mv-wd, .now-dot, .ym-wds > *, .yd, .tg-hd > *, .ev-cat-ic, .mv-num-row > *, .ad-chip > .ad-t, .mv-chip > *, .mv-more, .ym-title) { translate: calc(var(--igc, 0px) * (1 - 1 / var(--igk))) calc(var(--igcy, 0px) * (var(--igk) - 1)); }
html.igf .main > .stage :is(.ev-title, .ev-time, .ev-loc, .mv-chip > .n).ig-cut { overflow: visible; min-width: 0; text-overflow: clip; }
html.igf .main > .stage :is(.ev-title, .ev-time, .ev-loc).ig-mv { translate: calc(var(--igd, 0px) * (1 - var(--igk))) 0; }
@media (min-width: 981px) {
  /* Day's agenda, gone with the editor open: shown until the glide ends, out of the row where it
     stood, fading. */
  html.igf-ag .app.has-inspector .main > .stage .tg-wrap { position: relative; }
  html.igf-ag .app.has-inspector .main > .stage .tg-wrap > .agenda { display: block; position: absolute; top: 0; right: 0; bottom: 0; }
}
/* The search field's width eases with the glide (its own width transition held off), and what is
   inside it shows only as far as it reaches. */
.toolbar.ig-glide .search-btn { transition: background .25s var(--ease), box-shadow .25s var(--ease), color .2s, transform .3s var(--spring); overflow: hidden; }

/* Round 27 — a text line cut short (its "…") in the sidebar's slide and the editor's glide
   (POINTER_JS in ui/mod.rs: ellPlan). The line is not cut at its room for the glide (.sbx /
   .ig-cut) but clipped where its text shows, and a stand-in "…" (.sbe, with its classes, put
   where the line is: in its event's part, or in its chip, a box for it meanwhile: .sbe-h) rides
   that edge: from where the real ellipsis stands at the old width to where it stands at the new
   one, a "…" shown at one width only fading in or out on the way, the stand-in itself cut at the
   line's room as the real one is in a very narrow event (keyframed variables, with the glide's
   own timing). */
html.igf .main > .stage .ad-chip > .ad-t.ig-cut { overflow: visible; min-width: 0; text-overflow: clip; }
@property --sbe-x { syntax: '<length>'; inherits: false; initial-value: 0px; }
@property --sbe-o { syntax: '<number>'; inherits: false; initial-value: 1; }
@property --sbe-c { syntax: '<length>'; inherits: false; initial-value: 0px; }
html:is(.sbf, .igf) .main > .stage .sbe-h { position: relative; }
html:is(.sbf, .igf) .main > .stage .sbe {
  position: absolute; margin: 0; padding: 0; border: 0; width: auto; min-width: 0; max-width: none; flex: none;
  overflow: visible; text-overflow: clip; pointer-events: none; -webkit-user-select: none; user-select: none; animation: none; transition: none;
  /* (WebKit strikes a done task's title, not its ellipsis.) */
  text-decoration: none;
  transform: translateX(var(--sbe-x));
}
html:is(.sbf, .igf) .main > .stage .sbe.sbe-o { opacity: var(--sbe-o); }
html:is(.sbf, .igf) .main > .stage .sbe.sbe-c { clip-path: inset(-40px var(--sbe-c) -40px -40px); }

/* Round 29 — phones and tablets
   Onboarding on a short screen (a phone, a phone on its side, a short window): the question
   scrolls in a box of its own between the dots and the buttons (onboarding.rs, .ob-body), its
   edges fading as it scrolls under them. Before, the whole card scrolled under a sticky band of
   the page's colour: a light slab over the glass that covered the last row of languages, the
   name hint and the time format at rest, and stopped 22 px short of the card's foot. Elsewhere
   the box is not drawn (display: contents) and the card is as it was. The languages take two
   columns on a 375 px phone, here and in Settings → General (one, at 140 px each, made the
   first step scroll and the list seven rows long). */
.ob-body { display: contents; }
.ob-body > * { flex-shrink: 0; }
@media (max-height: 760px), (max-width: 640px) {
  .onboard-card { overflow: hidden; }
  .onboard-card > .ob-body {
    display: flex; flex-direction: column; gap: inherit;
    flex: 0 1 auto; min-height: 0;
    overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
    margin: -10px -28px; padding: 10px 28px;
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 10px, #000 calc(100% - 10px), transparent);
    mask-image: linear-gradient(to bottom, transparent, #000 10px, #000 calc(100% - 10px), transparent);
  }
  .ob-foot { position: static; margin: 0; padding: 0; background: none; }
}
@media (max-height: 500px) {
  .onboard-card > .ob-body { margin: -8px -22px; padding: 8px 22px; }
  .ob-foot { margin: 0; padding: 0; }
}
@media (max-width: 420px) {
  .ob-langs, .set-card .lang-grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
}
/* The safe area as variables for inline styles (ui/card.rs: the event card next to a click keeps
   clear of a phone's notch or Dynamic Island when it is on its side); 0 on a computer. */
:root { --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px); --safe-b: env(safe-area-inset-bottom, 0px); }
/* The year after the toolbar's title, where it shows at one of the slide's two widths only (an
   iPad on its side, a window about as wide): lifted out of the row for the sidebar's slide or the
   editor's glide (tbGlide / inspGlide, ui/mod.rs), its leading space was dropped at the start of
   its line, so "2026" stood a space to the left and stepped over by 4 px as the slide ended. */
.toolbar:is(.tb-glide, .ig-glide) .tb-light { white-space: pre; }
/* Settings → Data, "Subscribe by link…" on a phone: its button goes under the words, as meant
   (flex-wrap), instead of squeezing them into a column a word wide (the words' box could shrink
   to nothing, so nothing wrapped). */
@media (max-width: 640px) {
  .import-tile.wide .tile-text { flex: 1 1 calc(100% - 62px); }
}

/* Round 30 — iOS Safari (real simulator)
   The keyboard (index.html, Round 30). While it is up, the layers that hold fields sit between
   the top of the screen and the keyboard: Mono moves them itself (--kb: how much of the page
   the keyboard covers; --kbt: how far iOS scrolled the page, when a tap on a low field made it),
   in step with the keyboard. The phone editor sheet counts the scroll too (its title ended above
   the screen); the setup card and the sheets are centred in what is left, never taller (their
   own boxes scroll); a tablet's editor panel ends above the keyboard, and on a phone turned on
   its side it rises to the top of the screen. Nothing changes where no keyboard comes up (--kb
   and --kbt are never set, html.kb-open never there). Reduced motion / battery saver: no glide
   (their global rules). */
:root { --kb-ease: cubic-bezier(.25, .8, .25, 1); }
@media (max-width: 640px) {
  /* (Round 32: what shows above the keyboard, --kbv, measured as it is, index.html; the same as
     --vvh less --kb and --kbt in a Safari tab, not in the installed app. No keyboard: --vvh.) */
  .inspector { max-height: calc(var(--kbv, var(--vvh)) - env(safe-area-inset-top, 0px) - 16px); }
}
@media (min-width: 641px) {
  html.kb-open .inspector { bottom: calc(var(--kb, 0px) + 8px); }
}
@media (min-width: 641px) and (max-height: 500px) {
  html.kb-open .inspector { top: calc(var(--kbt, 0px) + max(8px, env(safe-area-inset-top, 0px))); }
}
html.kb-open .onboard, html.kb-open .modal-wrap {
  padding-top: calc(var(--kbt, 0px) + max(12px, env(safe-area-inset-top, 0px)));
  padding-bottom: calc(var(--kb, 0px) + 10px);
}
/* The effects' top layer draws where the panels are on screen: when iOS has scrolled the page
   for the keyboard, it stays on the screen with them (else the water's edges were drawn a
   keyboard's height off, a stray rim across the sidebar). */
html.kb-open .fx-top { top: var(--kbt, 0px); }
/* (One row of the box's own height: a sheet of a set height, as Settings, filled its row.) */
html.kb-open :is(.onboard, .modal-wrap) { grid-template-rows: minmax(0, 1fr); }
html.kb-open .onboard-card, html.kb-open .modal-wrap > * { max-height: 100%; }
@media (hover: none) and (pointer: coarse) {
  .inspector.open { transition: transform .6s var(--ease), opacity .4s var(--ease), top .35s var(--kb-ease), bottom .35s var(--kb-ease), max-height .35s var(--kb-ease); }
  .onboard { transition: padding .35s var(--kb-ease); }
  .modal-wrap { transition: background-color .3s var(--ease), visibility 0s linear .3s, padding .35s var(--kb-ease); }
  .modal-wrap.open { transition: background-color .3s var(--ease), visibility 0s, padding .35s var(--kb-ease); }
}
/* The event card opened without a click to place it by (a new event from the search, a key) is
   a sheet along a phone's foot like any other: its own place's right edge (22 px, inline, from
   ui/card.rs) made its margins uneven, 8 px left and 22 px right. */
@media (max-width: 640px) {
  .event-card { right: max(8px, env(safe-area-inset-right, 0px)) !important; }
  /* Settings → Calendar → Default event length: "1 h 30 min" (in German "1 Std. 30 Min.") was
     cut to "1 h 30 …" in its fifth of a phone's row; there a label may take two lines. */
  .srow[data-sid="default_len"] .seg { padding: 0 3px; white-space: normal; text-overflow: clip; line-height: 1.1; font-size: calc(12px * var(--ts, 1)); }
}

/* Round 31 — iPhone interaction polish
   Under a finger (no mouse or trackpad: hover none, pointer coarse; nothing here reaches a
   computer). Measured in Mobile Safari (iOS 27 simulator) by hit-testing every control.
   1. Two quick taps are two taps: on → (two pages on), on a switch or a stepper iOS took them
      as a double-tap zoom. Pinch zoom stays (manipulation = pan + pinch). */
@media (pointer: coarse) {
  html { touch-action: manipulation; }
}
/* 2. Tap targets: about 44 pt each way (Apple's guideline), as an invisible margin around the
   control, so nothing moves or changes size, never reaching into a neighbour's. Measured before:
   switches 44 × 26, every segmented control 30-34 tall, the toolbar's buttons 36 × 42, the
   to-do flags 24 × 36, sliders 16 tall, the small text buttons 28-32. */
@media (hover: none) and (pointer: coarse) {
  .switch::after { content: ""; position: absolute; inset: -9px -8px; }
  /* A segment's box grows into its own padding above and below (content-box, margins giving
     the room back): its text, the pill and the row stay where they were. (Its overflow clips a
     margin drawn outside it, so not an ::after.) */
  .segmented .seg { box-sizing: content-box; padding-top: 7px !important; padding-bottom: 7px !important; margin-top: -7px !important; margin-bottom: -7px !important; }
  .tb-center .segmented .seg { padding-top: 5px !important; padding-bottom: 5px !important; margin-top: -5px !important; margin-bottom: -5px !important; }
  .qa-keys .segmented .seg { box-sizing: border-box; padding-top: 0 !important; padding-bottom: 0 !important; margin-top: 0 !important; margin-bottom: 0 !important; }
  /* The toolbar's first row: up to the toolbar's edge and down to the view switcher. */
  .toolbar .icon-btn::after, .toolbar .pill-btn::after, .toolbar .nav-group > .icon-btn::after { top: -6px; bottom: -5px; }
  .toolbar .pill-btn::after, .toolbar .nav-group > .pill-btn::after { top: -7px; bottom: -6px; }
  .toolbar .tb-left > .icon-btn:first-child::after { left: -9px; }
  /* (A tablet's toolbar: the calendar picker and the search field.) */
  .toolbar :is(.scope-btn, .search-btn) { position: relative; }
  .toolbar :is(.scope-btn, .search-btn)::after { content: ""; position: absolute; inset: -7px -2px; }
  /* To-do rows (sidebar): the circle, the flag and × the row's whole height. */
  .task .check::after { inset: -13px -6px -13px -13px; }
  .task-flag::after { inset: -11px -1px -11px -6px; }
  .task-x::after { inset: -11px -8px -11px -1px; }
  .icon-btn.sm::after, .icon-btn.tiny::after { top: -10px; bottom: -10px; }
  .fold-title { position: relative; }
  .fold-title::after, .mini-title.fold-title::after { content: ""; position: absolute; inset: -11px -4px; }
  /* The event card's buttons and its Edit bar. */
  .card-actions .icon-btn { position: relative; }
  .card-actions .icon-btn::after { content: ""; position: absolute; inset: -3px -1px; }
  .card-edit::after { content: ""; position: absolute; inset: -3px 0; }
  /* Settings and sheets: the text buttons, the round play buttons, the colour dots. */
  :is(.round-btn, .more-btn, .tz-btn) { position: relative; }
  .round-btn::after { content: ""; position: absolute; inset: -8px; }
  :is(.more-btn, .tz-btn)::after { content: ""; position: absolute; inset: -7px 0; }
  .ghost-btn.small::after { content: ""; position: absolute; inset: -8px 0; }
  :is(.ghost-btn:not(.small), .primary-btn)::after { content: ""; position: absolute; inset: -5px 0; }
  .primary-btn { position: relative; }
  .swatches .swatch::before { content: ""; position: absolute; inset: -9px -4px; }
  /* Sliders: the track and its knob as they are, the box that takes the finger 40 tall. */
  :is(.slider-ctl, .fs-vol) input[type="range"] { height: 40px; margin-top: -12px; margin-bottom: -12px; }
}
/* 3. Pressed: what had no answer under a finger shows one while it is held (iOS shows :active
   once a touch listener exists: index.html). A switch's knob stretches toward the middle, as
   iOS's own does. Reduced motion / battery saver: their global rules end the transitions. */
@media (hover: none) and (pointer: coarse) {
  .seg:active:not(.active) { color: var(--fg); opacity: .7; }
  .switch .knob { transition: transform .45s var(--spring), background .3s, width .25s var(--ease); }
  .switch:active .knob { width: 28px; }
  .switch.on:active .knob { transform: translateX(12px); }
  :is(.chip, .tz-btn, .more-btn, .set-tab, .hd-back, .link-btn):active { opacity: .6; transition: opacity 0s; }
  .check:active { transform: scale(.88); }
}
/* 4. Text you can select stays selectable (notes, titles, fields: Round 19), but a long press
   on a button, a switch or a label in a sheet no longer starts a selection with its loupe. */
@media (hover: none) {
  :is(.inspector, .event-card, .sheet-body, .set-content) :is(button, [role="button"], [role="switch"], label, .seg, .srow-ic, .srow-t, .set-h) {
    -webkit-user-select: none; user-select: none;
  }
}
/* 5. The drawer (a phone's sidebar, a tablet's standing up) closes with a swipe to the left
   (POINTER_JS, ui/mod.rs: drawer): a sideways finger on it is the page's to follow, up and down
   still scroll it; the dimmed calendar beside it has nothing to scroll. */
@media (max-width: 980px) and (hover: none) and (pointer: coarse) {
  .sidebar { touch-action: pan-y pinch-zoom; }
  .sb-scrim { touch-action: none; }
}
/* 6. The installed app (Home Screen) on an iPhone: iOS 27 (simulator) lays the page out in a
   viewport the status bar's height short (874 pt screen: innerHeight, 100dvh and position: fixed's
   frame 812, 100vh 874) while drawing it from the top of the screen, so everything stopped 62 pt
   above the bottom: an empty band under the calendar, the editor and the card floating over it.
   A page as tall as the screen (100vh, the large viewport there) makes iOS lay it out at the full
   height, fixed layers included; where the viewport is right it is the same height and nothing
   changes. (The page's clientHeight still reads the short height: the keyboard's --kb is
   measured from where the fixed layers end instead, index.html, Round 32.) */
@media (display-mode: standalone) and (hover: none) and (pointer: coarse) {
  html, body { height: 100vh; }
}

/* Round 32 — phones: the "now" time pill stays inside the narrow hour gutter (44px). It is
   anchored at the gutter's left edge instead of its right one, so a long time ("8:58 PM", a
   larger text size) runs out to the right along the red line instead of past the panel's
   left edge, where the panel cut it off. */
@media (max-width: 640px) {
  .now-label { right: auto; left: 3px; padding: 2px 4px; border-radius: 5px; font-size: calc(10px * var(--ts, 1)); letter-spacing: -.01em; }
}

/* Round 32 — iPhone final
   1. The installed app (Home Screen) on an iPhone: the window's height as it is (--vvh) is the
      page's, 100vh (Round 31, 6.), not 100dvh, which there reads a status bar short (812 pt of
      874): the editor sheet's height, the event card's and a calendar menu's room came out
      62 pt short. A Safari tab is as before. */
@media (display-mode: standalone) and (hover: none) and (pointer: coarse) {
  :root { --vvh: 100vh; }
}
/* 2. The phone's editor sheet: its top row (the summary and Done) stays at the top of the sheet
   while what is under it scrolls. Writing notes with the keyboard up, the sheet scrolls to the
   field at its foot and its top went out of sight: there was no way to finish but scrolling back
   up. Once something has scrolled under the row, it takes a frosted band of its own, gliding in
   over the first 24 px of the scroll (a scroll-driven animation; where there is none, the row
   still stays, with no band). Nothing moves at rest: the row keeps its place and size. (Its
   top, -14 px: WebKit holds a sticky box inside the scroller's padding, 14 px here.) */
@media (max-width: 640px) and (hover: none) and (pointer: coarse) {
  .inspector .insp-top {
    position: sticky; top: -14px; z-index: 3;
    margin: -14px -16px -2px; padding: 14px 16px 6px;
    border-radius: 0 0 12px 12px;
  }
  @supports (animation-timeline: scroll()) {
    .inspector .insp-top { animation: insp-top-band linear both; animation-timeline: scroll(nearest block); animation-range: 0 24px; }
  }
}
@keyframes insp-top-band {
  from { background-color: color-mix(in srgb, var(--bg) 0%, transparent); box-shadow: 0 .5px 0 rgba(var(--ink), 0); -webkit-backdrop-filter: blur(0px) saturate(100%); backdrop-filter: blur(0px) saturate(100%); }
  to { background-color: color-mix(in srgb, var(--bg) 93%, transparent); box-shadow: 0 .5px 0 rgba(var(--ink), .1); -webkit-backdrop-filter: blur(24px) saturate(160%); backdrop-filter: blur(24px) saturate(160%); }
}
/* 3. The palette's list above the keyboard, measured the same way as the editor sheet (--kbv,
   Round 30 / 32): in the installed app, once iOS had scrolled the page, it ran under the keys. */
@media (hover: none) and (pointer: coarse) {
  html.kb-open .pal-list { max-height: min(52vh, max(160px, calc(var(--kbv, var(--vvh)) - 13vh - 140px))); }
}

/* Round 34 — iPhone bug fixes
   1. The all-day row's stand-in while it goes (POINTER_JS, ui/mod.rs: its height eases to
      nothing where the row stood; the hours under it follow). */
.tg-allday.ad-ghost { pointer-events: none; overflow: hidden; }
/* 2. A phone's event card scrolls its event above itself (POINTER_JS): room below the last hour
   while it is open, so a late event can go up as far (0 otherwise; nothing changes elsewhere). */
@media (max-width: 640px) {
  .tg-scroll::after { content: ""; display: block; height: var(--card-room, 0px); }
}
/* 3. A long press on the card's words no longer selects them with iOS's handles (its notes
   still can be, to copy). */
@media (hover: none) and (pointer: coarse) {
  .event-card { -webkit-user-select: none; user-select: none; }
  .event-card .card-row.notes p { -webkit-user-select: text; user-select: text; }
}
/* 4. The setup card's height eases within a step under a finger (OB_GLIDE_JS, ui/onboarding.rs):
   its buttons stay at its foot meanwhile, the question's box giving or taking the room (at rest
   the card is as tall as what it holds, and nothing moves). */
@media (max-height: 760px) and (hover: none) and (pointer: coarse), (max-width: 640px) and (hover: none) and (pointer: coarse) {
  .onboard-card > .ob-foot { margin-top: auto; }
}
/* 5. A phone on its side: the event card next to the tap may take the screen's height (it stood
   below the toolbar, 217 px tall for 271 px of card: Edit was cut in half), and its Edit bar stays
   at its foot when what is above it scrolls. */
@media (min-width: 641px) and (max-height: 500px) and (hover: none) and (pointer: coarse) {
  .event-card {
    top: max(8px, env(safe-area-inset-top, 0px)) !important;
    max-height: calc(var(--vvh, 100vh) - max(8px, env(safe-area-inset-top, 0px)) - max(8px, env(safe-area-inset-bottom, 0px)));
  }
  .event-card .card-edit { position: sticky; bottom: 0; z-index: 2; }
}
/* 6. Under a finger, an event's time in a narrow column shows when it starts only (ui/timegrid.rs:
   the end in a part of its own): "07:00 – 07:45" needed 78 px and had 61-74 in 4 Days on a phone,
   so it showed as "07:00 – 07:…". Where the whole range fits it shows, as before. */
@media (hover: none) and (pointer: coarse) {
  .tg-days .ev { container-type: inline-size; }
  @container (max-width: 95px) { .ev-time .ev-te { display: none; } }
  @container (max-width: 132px) { .ev-time.h12 .ev-te { display: none; } }
  /* (An event with its calendar's small icon keeps 14 px of the time's line for it: an iPad's
     week cut "13:00 – 14…" there.) */
  @container (max-width: 109px) { .ev:has(> .ev-cat-ic) .ev-time .ev-te { display: none; } }
  @container (max-width: 146px) { .ev:has(> .ev-cat-ic) .ev-time.h12 .ev-te { display: none; } }
  /* (A short event has its time on the title's line: "Cal… 19:00 – 19…" became "Call mom 19:00",
     and where even that does not fit, its title alone, as iPhone Calendar has it: its place in
     the hours says when.) */
  @container (max-width: 190px) { .ev.short .ev-time .ev-te { display: none; } }
  @container (max-width: 120px) { .ev.short .ev-time { display: none; } }
  /* (A week on a phone, 47 px a column: "07:00" needed 33 px and had 30, "07:…". The right
     padding gives 4 px back there, the digits a little of their spacing; the calendar's small
     icon, which kept 14 px of the time's line for itself ("1…"), steps aside: its colour says it.) */
  @container (max-width: 56px) {
    .ev-inner { padding-right: 3px !important; }
    .ev-time { letter-spacing: -.02em; padding-right: 0 !important; }
    .ev-cat-ic { display: none; }
  }
}
/* 7. Tap targets that were still small: a text button (Skip, Skip tour, the legal links in About)
   answers in about 44 pt, as an invisible margin around it; the legal links' rows part further. */
@media (hover: none) and (pointer: coarse) {
  .link-btn::after { inset: -14px -10px; }
  .about-links { row-gap: 14px; }
}
/* 8. What a phone has no use for: the keyboard shortcuts' row (Settings → General) and its button
   in About, and "drop files" in Import (there is nothing to drop them from). */
@media (hover: none) and (pointer: coarse) and (max-width: 640px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
  .srow[data-sid="shortcuts"], [data-sid="key_list"] { display: none; }
  .drop-zone .drop-hint { display: none; }
}
/* 9. A wide phone's room: the drawer takes up to 82 % of the screen (264 px on a 440 px phone cut a
   task's title after about twelve letters), the tour's card the screen's width less 16 px each
   side, up to 400 px (ui/onboarding.rs: tour_card_place), and the editor's six lengths stand in
   two even rows of three instead of five and a lone "2 h". */
@media (max-width: 640px) {
  :root { --sb-w: min(332px, 82vw); }
  .tour-card { width: min(400px, calc(100vw - 32px)); }
  .quick-lens { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .quick-lens .chip { padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
/* 10. Small things.
   A time zone's button in a phone's narrow row ends its name in "…" (Settings → General, Russian
   on a 375 pt phone: «Автоматически · Europe/Brussels» ran 6 px past its card): its words could
   not get narrower than they are, as a flex item. And while a sheet is open on a phone (Settings
   over a card), the event card behind it fades out: its Edit bar showed below the sheet. */
@media (max-width: 640px) {
  .tz-btn > span { min-width: 0; }
  .tz-btn > .icon { flex: none; }
  .event-card { transition: opacity .25s var(--ease), visibility 0s; }
  html:has(.modal-wrap.open) .event-card { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .25s var(--ease), visibility 0s linear .25s; }
}
/* 11. A swipe's page, let go and turning: its copy carrying on out (POINTER_JS, pageFollow) plays
   nothing of its own. */
.pf-ghost, .pf-ghost * { animation: none !important; transition: none !important; }
/* 12. ⌘K's task mode (+ → New task, ui/palette.rs) before a word is typed lists nothing: no
   empty band under the field. */
.pal-list:not(:has(> *)) { display: none; }

/* Round 35 — iPhone verify fixes
   1. The event card behind a sheet (Round 34, 10) fades out and back in for real: its entrance
      (card-in, "both") held opacity 1 after it ended, over the opacity 0 asked for, so the card
      stood whole for 0.25 s under Settings and then went (visibility) in one frame, and came
      back in one. Ended, the entrance now holds nothing (its end is the card's own look). */
@media (max-width: 640px) {
  .event-card { animation-fill-mode: backwards; }
}
/* 2. A week on a 402 pt phone (iPhone 17, 18 Pro): its columns are 44 px, not the Air's 47, and
   "07:00" (31.4 px) still had 31 and showed as "07:…" (Round 34, 6 tuned it for 47 px). The digits
   close up a little more there, and get a size smaller in narrower columns still (a 390 or
   375 pt phone: 42 and 40 px). */
@media (hover: none) and (pointer: coarse) {
  @container (max-width: 45px) { .ev-time { letter-spacing: -.04em; } }
  @container (max-width: 43px) { .ev-time { font-size: calc(11px * var(--ts, 1)); } }
  @container (max-width: 41px) { .ev-time { font-size: calc(10px * var(--ts, 1)); } }
}
/* Round 37 — energy
   The two spinners (a calendar link being read, a refresh) were the only endless animations
   that went on while the window was hidden or in the background; they hold where they are
   then (html.idle), as everything else does, and turn on from there when it comes back.
   (Left untouched for three minutes, the "now" and "live" dots ring no more either: ui::Root
   stops a ring that starts then on its first frame. The effects ease to a stop: effects.js.) */
html.idle .sub-spinner, html.idle .spin-ic.on .icon { animation-play-state: paused; }


/* Round 37 — Settings UI
   Measured with a layout scanner over every tab and sub-view (phones 375-440 standing up, 874
   on its side, iPad 820 / 1180, computers 1100-1728; English, Russian, German) and by tapping in
   the iOS simulator.
   1. Reminders & sounds → the sound packs: "Listen ▶" stays in its card's corner under a finger.
      Round 31's `:is(.round-btn, …) { position: relative }` (a box for its larger hit area) had
      taken it out of the corner: 10 px under the card and 8 px left, over the next row's title. */
.snd-pack > .snd-pack-play { position: absolute; }

/* 2. The tabs show that they scroll (settings.rs: TABS_JS). Where they do not fit (a phone's row,
      a short screen's column) the edge fades where more wait, and a small glass chevron there
      takes them most of a page on; the open tab comes to the middle. A phone's row settles on a
      tab after a swipe (proximity: it never pulls). Nothing shows where every tab fits. */
@property --tf-a { syntax: '<length>'; inherits: false; initial-value: 0px; }
@property --tf-b { syntax: '<length>'; inherits: false; initial-value: 0px; }
.set-tabs-box { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.set-tabs { position: relative; }
.set-tabs-box.ovf > .set-tabs {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--tf-a), #000 calc(100% - var(--tf-b)), transparent);
  mask-image: linear-gradient(to right, transparent, #000 var(--tf-a), #000 calc(100% - var(--tf-b)), transparent);
  transition: --tf-a .35s var(--ease), --tf-b .35s var(--ease);
}
.set-tabs-box.ovf-col > .set-tabs {
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 var(--tf-a), #000 calc(100% - var(--tf-b)), transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 var(--tf-a), #000 calc(100% - var(--tf-b)), transparent);
}
.set-tabs-box.more-a > .set-tabs { --tf-a: 56px; }
.set-tabs-box.more-b > .set-tabs { --tf-b: 56px; }
.set-tabs-box.ovf-col.more-a > .set-tabs { --tf-a: 44px; }
.set-tabs-box.ovf-col.more-b > .set-tabs { --tf-b: 44px; }
.tabs-chev {
  position: absolute; z-index: 2; top: 50%; width: 30px; height: 30px; margin-top: -15px;
  display: grid; place-items: center; border-radius: 50%;
  color: var(--fg);
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  -webkit-backdrop-filter: blur(12px) saturate(1.5); backdrop-filter: blur(12px) saturate(1.5);
  box-shadow: inset 0 0 0 .5px rgba(var(--ink), .2), 0 3px 10px rgba(0, 0, 0, .16);
  opacity: 0; visibility: hidden; pointer-events: none; transform: scale(.7);
  transition: opacity .25s var(--ease), transform .35s var(--spring), visibility 0s linear .35s, background-color .2s;
}
/* (About 44 pt to the finger: a margin it reaches into, the faded edge.) */
.tabs-chev::after { content: ""; position: absolute; inset: -7px; }
.tabs-chev.a { left: -4px; }
.tabs-chev.b { right: -4px; }
.tabs-chev .icon { transition: transform .3s var(--ease); }
.tabs-chev.a .icon { transform: rotate(180deg); }
.set-tabs-box.more-a > .tabs-chev.a, .set-tabs-box.more-b > .tabs-chev.b {
  opacity: 1; visibility: visible; pointer-events: auto; transform: none;
  transition: opacity .25s var(--ease), transform .35s var(--spring), visibility 0s, background-color .2s;
}
.set-tabs-box.ovf > .tabs-chev:hover { background: color-mix(in srgb, var(--bg) 78%, transparent); }
.set-tabs-box.ovf > .tabs-chev:active { transform: scale(.88); transition-duration: .1s; }
/* (A column: the chevrons at its top and foot, pointing up and down.) */
.set-tabs-box.ovf-col > .tabs-chev { top: auto; right: auto; left: 50%; margin: 0 0 0 -15px; }
.set-tabs-box.ovf-col > .tabs-chev.a { top: 2px; }
.set-tabs-box.ovf-col > .tabs-chev.b { bottom: 2px; }
.set-tabs-box.ovf-col > .tabs-chev.a .icon { transform: rotate(-90deg); }
.set-tabs-box.ovf-col > .tabs-chev.b .icon { transform: rotate(90deg); }
@media (max-width: 640px) {
  .set-tabs-box { flex: none; min-width: 0; }
  .set-tabs { scroll-snap-type: x proximity; }
  .set-tab { scroll-snap-align: center; }
}
/* Under a finger a tab answers in 44 pt: on a phone's row, an invisible margin above and below it
   (the row gives it room inside its own clip; nothing moves); in a column (a tablet, a phone on its
   side) a row of that height, as iOS's own lists. */
@media (max-width: 640px) and (hover: none) and (pointer: coarse) {
  .set-tabs { padding-top: 4px; padding-bottom: 4px; margin-top: -4px; margin-bottom: -4px; }
  .set-tab { position: relative; }
  .set-tab::after { content: ""; position: absolute; inset: -4px 0; }
}
@media (min-width: 641px) and (hover: none) and (pointer: coarse) {
  .set-tab { min-height: 44px; }
}

/* 3. Appearance → Palette: the chosen palette's check keeps a lane of its own beside Glass's
      preview on a narrow phone (it sat on the preview's corner and hid its accent dot: 22 × 22 px at
      375, 15 × 22 at 390, 3 × 22 at 402). */
@media (max-width: 640px) {
  .pal-hero .pal-prev { max-width: min(240px, calc(100% - 40px)); }
}

/* 4. Customization → Texture: the tiles start 8 px under the row's icon (on a phone they stand
      under it, and the chosen one's ring touched it). */
@media (max-width: 640px) {
  .tex-pick { padding-top: 8px; }
}

/* 5. Calendars → a calendar's icons: eight to a row that share the row's width on a phone (a fixed
      298 px ran 27 px past the card at 375, cutting two off). */
@media (max-width: 640px) {
  .cal-icons { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px 4px; }
  .cal-icon { width: 100%; max-width: 40px; height: auto; aspect-ratio: 1; justify-self: center; }
}

/* 6. Customization → the look's name: on a phone the field takes the row beside its icon and "Reset
      this look" goes under it (it squeezed the field to 28-99 px, "L…" in German at 375). */
@media (max-width: 640px) {
  .srow > .set-input.grow { flex: 1 1 calc(100% - 40px); }
  .srow > .set-input.grow ~ .ghost-btn { margin-left: 40px; }
}

/* 7. Calendar → Templates on a phone: a closed template shows Edit and Delete (its name had
      93-158 px beside four buttons); open, ↑ and ↓ join them, easing in. The name may take two
      lines. */
@media (max-width: 640px) {
  .tpl-ctl > .tpl-mini { transition: width .3s var(--ease), opacity .25s var(--ease), color .2s, background .2s; }
  .tpl-row:not(.open) .tpl-ctl > .tpl-mini:nth-child(2), .tpl-row:not(.open) .tpl-ctl > .tpl-mini:nth-child(3) { width: 0; opacity: 0; overflow: hidden; pointer-events: none; }
  .tpl-ctl { gap: 0; }
  .tpl-ctl > .tpl-mini:not(:first-child) { margin-left: 2px; }
  .tpl-row:not(.open) .tpl-ctl > .tpl-mini:nth-child(2), .tpl-row:not(.open) .tpl-ctl > .tpl-mini:nth-child(3) { margin-left: 0; }
  .tpl-name { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; line-height: 1.25; }
}

/* 8. Text fields: a long value ends in "…" while the field is not being typed in (it was cut
      mid-letter: a calendar's name, a palette's, yours, a template's). On a phone your name's
      field takes its row's width, and a calendar's name answers anywhere in its row's height. */
:is(.cal-row-main input, .pe-name, .set-input, .sub-field input, .set-content .select-wrap select) { text-overflow: ellipsis; }
.cal-row-main input { align-self: stretch; }
/* Calendars: an open calendar's chevron points up (the sidebar's `.chev.open` turned its button a
   quarter on top of its own half turn: it pointed right). */
.cal-row-main .icon-btn.chev.open { transform: none; }
@media (max-width: 640px) {
  .srow-ctl > .set-input { flex: 1; width: auto; min-width: 0; }
}

/* 9. Segmented choices on a phone: a word that does not fit its segment takes a second line (the
      segment grows, its neighbours and the pill with it), hyphenated where the language allows,
      instead of being cut ("Ausgew…", "Тонирова…", at a larger text size "Свече…"). Shorter words
      where there are some (settings.rs: Seg's `narrow`, "1½ h"). */
.seg-n { display: none; }
@media (max-width: 640px), (max-height: 500px) {
  /* (A phone on its side too: "1 Std. 30 Min." was 2 px too wide there.) */
  .seg:has(> .seg-n) > .seg-w { display: none; }
  .seg:has(> .seg-n) > .seg-n { display: inline; }
}
@media (max-width: 640px) {
  .srow-ctl > .segmented .seg {
    height: auto; min-height: 30px; padding-top: 3px; padding-bottom: 3px;
    white-space: normal; line-height: 1.15; -webkit-hyphens: auto; hyphens: auto;
  }
}
@media (max-width: 400px) {
  .srow-ctl > .segmented.small .seg { padding-left: 1px; padding-right: 1px; letter-spacing: -.02em; font-size: calc(11px * var(--ts, 1)); }
}

/* 10. Calendar → a template's editor on a phone: the calendar's menu keeps inside the card (at a
       larger text size it ran 12 px out), and its foot wraps: "Done" goes to the next line
       (in Russian "+ Добавить на сегодня" took two lines in a 34 px button). */
@media (max-width: 640px) {
  .tpl-field > .select-wrap { min-width: 0; }
  .tpl-field > .select-wrap select { min-width: 0; width: 100%; }
  /* (A field's label over it: room for the menu's larger reach under a finger, Round 37, 14.) */
  .tpl-field { row-gap: 9px; }
  .tpl-edit-foot { flex-wrap: wrap; row-gap: 8px; }
  .tpl-edit-foot > .ghost-btn { white-space: nowrap; }
  .tpl-edit-foot > .primary-btn { margin-left: auto; }
}

/* 11. The city / time-zone list opened in Settings glides into view (settings.rs: TZ_REVEAL_JS);
       on a phone on its side, where it was taller than what shows of the sheet, its list is
       shorter (it scrolls). */
@media (max-height: 500px) {
  .set-content .tz-list { max-height: 176px; }
}

/* 12. Search: the results' title may take two lines on a phone, a size smaller («Результаты по
       запро…» in Russian and German). */
@media (max-width: 640px) {
  .set-head-q { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: calc(18px * var(--ts, 1)); line-height: 1.2; text-wrap: balance; }
}

/* 13. Smaller things.
   Your own palette's pencil sits at its preview's foot (top right it hid the preview's accent dot,
   at every size). (A margin's percentage is of the card's width: the preview's height is 62.5 %
   of it.) */
.pal-card.own > .pal-edit { top: 0; margin-top: calc(62.5% - 35px); }
@media (max-width: 640px) {
  /* The palette editor's colours start at the row's left when they wrap (they were pushed to the
     right, a ragged second line). */
  .pe-sws { justify-content: flex-start; }
  /* A subscribed calendar: its status over "Refresh now", not squeezed beside it into a column
     four or five lines tall. */
  .cal-feed-status { flex-direction: column; align-items: stretch; }
  .cal-feed-status .ghost-btn { align-self: flex-start; }
  /* A slider under a row's title takes the row's width, as the segmented choices do (it stood
     40 px in under them: two left edges in one card). Menus and buttons keep to the title's edge. */
  .srow-ctl.slider-ctl, .srow-ctl:has(> .slider-ctl) { padding-left: 0; }
  /* The empty templates' words line up with the words above them. */
  .tpl-empty { padding-left: 54px; }
  /* Sidebar: a block's switch stays at the end of its row whether it is on or off, its sizes
     (S M L, when on) on a line of their own under its name (on, both had gone to an indented
     second line; off, the switch stayed: rows that did not line up). */
  .srow.block { row-gap: 6px; }
  .srow.block > .srow-ctl { display: contents; }
  .srow.block > .srow-ctl > .switch { order: 4; }
  .srow.block > .srow-ctl > .sz-segs { order: 5; flex-basis: 100%; padding-left: 72px; }
}
/* Reminders → the morning summary's time keeps its digits at a larger text size ("08:00" was cut
   to "08:0" at 130 %: the field's width did not grow with its text). */
.set-content .srow > .time-field { width: calc(60px * var(--ts, 1)); }
.set-content .srow > .time-field.h12 { width: calc(86px * var(--ts, 1)); }
@media (max-width: 640px), (max-height: 500px) {
  /* A sound pack's name and an effect's take a second line rather than an ellipsis when they do
     not fit their third / quarter of the row (a larger text size, a phone on its side). */
  .snd-pack-name, .fx-name { white-space: normal; overflow-wrap: anywhere; -webkit-hyphens: auto; hyphens: auto; line-height: 1.2; }
  .fx-name { text-align: center; text-wrap: balance; }
}
@media (max-width: 640px) {
  /* (The chosen colour's ring stays inside its row: it ran 2 px past the row's start.) */
  .pe-sws { padding-left: 2px; }
}
/* "Have your own sync server?" in two even lines where it takes two (German: "Sync-" alone at the
   end of the first). */
.sync-own > span:not([class]) { text-wrap: balance; }
/* Light: a danger button's red reads (red on its own pale red was faint on the glass). */
:root[data-theme="light"] .ghost-btn.danger:not(.armed) { color: color-mix(in srgb, var(--now) 78%, #000); }
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] .ghost-btn.danger:not(.armed) { color: color-mix(in srgb, var(--now) 78%, #000); }
}
/* An iPad standing up: the sheet takes more of its height (640 of 1180 pt). */
@media (min-width: 641px) and (min-height: 1000px) and (hover: none) and (pointer: coarse) {
  .settings { height: min(860px, 76vh); }
}

/* 14. Under a finger, the small controls in Settings answer in about 44 pt (an invisible margin,
       never into a neighbour's; nothing moves), or are as tall where they stand in a list. */
@media (hover: none) and (pointer: coarse) {
  .tz-item { height: 44px; }
  .lang-opt { height: 44px; }
  .icon-btn.tpl-mini { position: relative; }
  .icon-btn.tpl-mini::after { content: ""; position: absolute; inset: -8px -1px; }
  .pal-edit::after { content: ""; position: absolute; inset: -8px; }
  .cal-icon { position: relative; }
  .cal-icon::after { content: ""; position: absolute; inset: -3px -2px; }
  .cal-details .cal-color { position: relative; width: 28px; height: 28px; }
  .cal-details .cal-color::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; }
  .pe-sw::before { content: ""; position: absolute; inset: -4px; border-radius: 50%; }
  .cal-row-main .swatch.big { position: relative; }
  .cal-row-main .swatch.big::after { content: ""; position: absolute; inset: -9px -5px; }
  .trash-chev { position: relative; }
  .trash-chev::after { content: ""; position: absolute; inset: -9px; }
  .wc-x { position: relative; }
  .wc-x::after { content: ""; position: absolute; inset: -12px -8px; }
  .set-search-x { position: relative; }
  .set-search-x::after { content: ""; position: absolute; inset: -13px; }
  /* (The search field: its clear box reaches past the painted pill above and below. A city
     list's own field reaches up to the list's edge: 40 tall to the finger, 32 painted.) */
  .set-search input { height: 44px; margin: -6px 0; }
  .set-content .tz-search {
    height: 40px; border-top: 6px solid transparent; border-bottom: 2px solid transparent;
    margin-top: -6px; margin-bottom: 2px; background-clip: padding-box;
    border-radius: 9px 9px 9px 9px / 15px 15px 11px 11px;
  }
  /* (A menu: 44 tall to the finger, its painted box as before: clear top and bottom borders
     outside it, the margins giving the room back. Its corners keep their round.) */
  .set-content .select-wrap select {
    height: 44px; border-top: 7px solid transparent; border-bottom: 7px solid transparent;
    margin-top: -7px; margin-bottom: -7px; background-clip: padding-box; border-radius: 8px / 15px;
  }
  /* (A text field the same way; its focus ring drawn just inside its painted edge.) */
  .set-content input.set-input {
    height: 44px; border-top: 5px solid transparent; border-bottom: 5px solid transparent;
    margin-top: -5px; margin-bottom: -5px; background-clip: padding-box; border-radius: 10px / 15px;
  }
  .set-content input.set-input:focus { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--primary) 55%, transparent); }
  .sz-segs .segmented.small { width: 120px; }
}

/* Round 38 — final verify (the real simulator: iPhone 18 Pro Max, iPhone Air, iPhone 17, iPad Air)
   1. A phone's month (thin bars for the events, the day's number 22 pt across): a tap anywhere on
      a day opens it, as its number does. Elsewhere in the cell a tap did nothing, so the small
      number was the only way into a day. The number answers over the whole cell; a bar or "+N"
      still takes its own press (above it), a sideways swipe still turns the month, and while an
      event's card is open a tap on a day only closes the card, as before. */
@media (hover: none) and (pointer: coarse) {
  html:not(:has(.event-card)) .mv-grid.compact .mv-num::after { content: ""; position: absolute; inset: 0; }
  .mv-grid.compact :is(.mv-chip, .mv-more) { position: relative; z-index: 1; }
}

/* Round 39 — final requests
   1. Settings: what lies under it (the calendar, the toolbar, the sidebar, the effects' field)
      is blurred more strongly, with a slight dim, so it doesn't distract. One layer under the
      sheet (the wrap's ::before: never an ancestor of the sheet's glass, which still blurs what
      lies under it) fades in and out with the sheet's scrim, both on one gentle curve over about
      a third of a second (the shared --ease did most of its change in the first two frames: the
      dim came in, and went, almost at once, which read as a blink of everything under it).
      Battery saver and "Reduce transparency": no live blur, a plain tint of the background. */
.modal-wrap.set-wrap {
  --set-ease: cubic-bezier(.4, 0, .2, 1);
  transition: background-color .32s var(--set-ease), visibility 0s linear .32s;
}
.modal-wrap.set-wrap.open {
  background: var(--set-scrim, rgba(0, 0, 0, .3));
  transition: background-color .32s var(--set-ease), visibility 0s;
}
:root[data-theme="light"] .modal-wrap.set-wrap.open { --set-scrim: rgba(250, 250, 250, .26); }
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] .modal-wrap.set-wrap.open { --set-scrim: rgba(250, 250, 250, .26); }
}
.modal-wrap.set-wrap::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  -webkit-backdrop-filter: blur(18px) saturate(112%);
  backdrop-filter: blur(18px) saturate(112%);
  opacity: 0;
  transition: opacity .32s var(--set-ease);
}
.modal-wrap.set-wrap.open::before { opacity: 1; }
@media (hover: none) and (pointer: coarse) {
  .modal-wrap.set-wrap { transition: background-color .32s var(--set-ease), visibility 0s linear .32s, padding .35s var(--kb-ease); }
  .modal-wrap.set-wrap.open { transition: background-color .32s var(--set-ease), visibility 0s, padding .35s var(--kb-ease); }
}
html.low-power .modal-wrap.set-wrap::before { -webkit-backdrop-filter: none; backdrop-filter: none; background: color-mix(in srgb, var(--bg) 46%, transparent); }
@media (prefers-reduced-transparency: reduce) {
  .modal-wrap.set-wrap::before { -webkit-backdrop-filter: none; backdrop-filter: none; background: color-mix(in srgb, var(--bg) 46%, transparent); }
}
/* 2. Settings → Effects: the little stage's picture fades in once it has one (effects.js), never
      empty and then filled in one frame. */
.fx-prev-bg { opacity: 0; transition: opacity .35s var(--ease); }
.fx-prev-bg.on { opacity: 1; }
/* 3. Settings' tabs under a finger (a phone, a tablet): no arrows. The row (a phone standing up)
      or the column (on its side, a tablet) scrolls with the finger, with its momentum, settling on
      a tab nearby (proximity: it never pulls); the faded edge where more tabs wait, and the next
      tab peeking in by about a third (settings.rs, TABS_JS: the tabs' padding is tuned for it at
      each width and language), are the only hint; the open tab comes to the middle. A mouse or
      trackpad keeps the small chevron and the wheel (Round 37 / 38). */
@media (hover: none) and (pointer: coarse) {
  .tabs-chev { display: none !important; }
  .set-tabs { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  .set-tabs-box.more-a > .set-tabs { --tf-a: 30px; }
  .set-tabs-box.more-b > .set-tabs { --tf-b: 30px; }
  .set-tabs-box.ovf-col.more-a > .set-tabs { --tf-a: 34px; }
  .set-tabs-box.ovf-col.more-b > .set-tabs { --tf-b: 34px; }
  .set-tabs-box.ovf-col > .set-tabs { scroll-snap-type: y proximity; }
  .set-tabs-box.ovf-col .set-tab { scroll-snap-align: center; }
}
@media (max-width: 640px) and (hover: none) and (pointer: coarse) {
  .set-tab { padding-left: var(--tab-px, 10px); padding-right: var(--tab-px, 10px); }
}
/* (Presses make no burst unless chosen, Round 39: the stage takes no press then.) */
.fx-preview.quiet { cursor: default; }
.fx-preview.quiet .fx-mini-btn { pointer-events: none; }
/* 4. Settings closing fades out (settings.rs keeps it a moment longer), with what is under it
      coming back, instead of going in one frame. Its entrance holds nothing once it has ended (as
      the event card's, Round 35), so its own look, and this fade, apply after it. */
.modal-wrap.set-wrap > .settings {
  animation-fill-mode: backwards;
  transition: opacity .24s var(--set-ease), transform .24s var(--set-ease);
}
.modal-wrap.set-wrap:not(.open) > .settings { opacity: 0; transform: translateY(6px) scale(.985); pointer-events: none; }

/* Round 40 — keep your data */
/* 1. "Add Mono to your Home Screen" (iPhone / iPad Safari, not installed; keep_data.rs): a glass
      card where the morning summary sits, under the toolbar, clear of the notch and the rounded
      corners on its side. A phone with Mono's tile on it, the why, the two steps with Safari's
      own glyphs, "Not now" / "Got it". */
.keep-hint {
  position: fixed; z-index: 60;
  top: 78px; left: 50%; translate: -50% 0;
  width: min(400px, calc(100vw - 32px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  padding: 16px 16px 12px;
  border-radius: 20px;
  animation: summary-in .6s var(--spring) both;
  transition: opacity .28s var(--ease), translate .28s var(--ease);
}
.keep-hint.leaving { opacity: 0; translate: -50% -10px; pointer-events: none; }
.kh-head { position: relative; display: flex; align-items: flex-start; gap: 14px; }
.kh-art { flex: none; display: grid; place-items: center; width: 44px; height: 52px; color: var(--fg-2); }
.kh-art svg { display: block; overflow: visible; }
.kh-phone { fill: rgba(var(--ink), .05); stroke: currentColor; stroke-width: 1.6; }
.kh-app { fill: rgba(var(--ink), .16); }
.kh-mono { fill: var(--fg); transform-box: fill-box; transform-origin: center; animation: kh-pop 2.6s var(--ease) .7s 2; }
@keyframes kh-pop { 0%, 30%, 100% { transform: none; } 12% { transform: scale(1.22); } }
.kh-titles { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kh-title { font-family: var(--font-display); font-size: calc(16.5px * var(--ts, 1)); font-weight: 700; letter-spacing: -.01em; }
.kh-text { font-size: calc(13px * var(--ts, 1)); line-height: 1.42; color: var(--fg-2); }
.kh-steps { position: relative; list-style: none; margin: 12px 0 0; padding: 10px 0 0; display: flex; flex-direction: column; gap: 7px; box-shadow: inset 0 1px 0 rgba(var(--ink), .07); }
.kh-steps li { display: flex; align-items: center; gap: 10px; font-size: calc(13px * var(--ts, 1)); font-weight: 550; }
.kh-glyph { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: rgba(var(--ink), .07); color: var(--primary); }
.kh-foot { position: relative; display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
@media (max-width: 640px) {
  .keep-hint { top: calc(var(--tb-bottom, 102px) + 8px); }
}
@media (prefers-reduced-motion: reduce) {
  .keep-hint { animation: none; transition: opacity .2s linear; }
  .keep-hint.leaving { translate: -50% 0; }
  .kh-mono { animation: none; }
}
/* 2. Settings → Data: one quiet line under Backup while the browser may clear the calendar,
      lined up with the rows' text. */
.keep-note {
  display: flex; align-items: flex-start; gap: 6px;
  margin-top: -5px; padding: 0 14px 10px 54px;
  font-size: calc(11.5px * var(--ts, 1)); line-height: 1.38; color: var(--fg-3);
}
.keep-note .icon { flex: none; margin-top: calc(2px * var(--ts, 1)); opacity: .85; }
.keep-note + .srow { box-shadow: inset 0 1px 0 rgba(var(--ink), .06); }
/* (3. Round 41: the edge-to-edge layout under Safari's floating toolbar is gone. It made the app
      and the backdrop absolute boxes 120 px taller than the viewport, so the page itself could
      scroll: on an iPhone Safari scrolled it (a swipe, a focus, the toolbar settling) and the whole
      app slid up under the status bar. The app is a fixed layer again, as tall as the viewport,
      and Safari draws its own band under its bar. The page never scrolls: Round 41 below.) */

/* Round 41 — the page never scrolls; the installed app reaches the foot of the screen
   1. A Safari tab (any iOS browser): everything is a fixed layer as tall as the viewport and html
      and body hide their overflow (above), so the document has nothing to scroll; index.html puts
      it back at the top should iOS scroll it all the same (only a focused field may lift it).
   2. The installed app (Home Screen) on a phone: the app and the backdrop are as tall as the
      screen even where iOS lays the page out a status bar short (Round 31: 812 pt of 874), with
      --screen-h from index.html (only when the app has the whole screen). Standing up, the
      calendar's panel runs on to the foot of the screen, its lower corners following the
      screen's; what scrolls in it (the hours, the year, the month's last week) gets the home
      indicator's height of room at its end, so nothing ends under the indicator. */
@media (display-mode: standalone) and (hover: none) and (pointer: coarse) {
  .app, .backdrop { bottom: auto; height: max(100%, var(--screen-h, 0px)); }
}
@media (display-mode: standalone) and (hover: none) and (pointer: coarse) and (max-width: 640px) and (orientation: portrait) {
  :root { --foot: env(safe-area-inset-bottom, 0px); }
  .app { padding-bottom: 0; }
  .stage { border-bottom-left-radius: var(--foot-r, 44px); border-bottom-right-radius: var(--foot-r, 44px); }
  .tg-scroll { padding-bottom: var(--foot); }
  .yv { padding-bottom: calc(12px + var(--foot)); }
  .mv-body { padding-bottom: max(0px, calc(var(--foot) - 6px)); }
}

/* Round 42 — a Safari tab: the backdrop's colour behind the status bar and under the toolbar
   An iPhone's (or iPad's) Safari tab draws nothing of the page behind the status bar and under
   its floating toolbar while the page is not scrolled, and the page never scrolls (Round 41):
   only one flat colour per band, taken from a fixed element touching that edge. Two such strips
   (index.html adds them, html.ios-tab: never the installed app, never a computer) carry the
   backdrop's colour at that edge and draw nothing (fully masked; Safari still reads their
   colour); the backdrop fades into the same colour over its outer 36 px, so the band reads as
   the background going on. The strips are 24 px tall (Safari ignores a strip much under 12 px)
   and above everything, as Safari only looks at the topmost fixed element there. */
.bar-tint {
  position: fixed; left: 0; right: 0; height: 24px; z-index: 2147483000;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(transparent, transparent);
  mask-image: linear-gradient(transparent, transparent);
}
.bar-tint.t { top: 0; background-color: var(--bar-t); }
.bar-tint.b { bottom: 0; background-color: var(--bar-b); }
/* The colour at each edge: the palette's background (glow, plain, a moving background not
   shown yet); the colour backdrop's top-left / bottom-right colour over its base (its two
   lights reach those edges); the photo's or moving background's edges, measured in
   index.html (--bar-pt / --bar-pb). */
html.ios-tab { --bar-t: var(--bg); --bar-b: var(--bg); }
html.ios-tab[data-backdrop="colour"] {
  --bar-t: color-mix(in oklab, var(--grad-a) calc(var(--grad-k) * .45), color-mix(in oklab, var(--grad-a) var(--grad-base), var(--bg)));
  --bar-b: color-mix(in oklab, var(--grad-b) calc(var(--grad-k) * .45), color-mix(in oklab, var(--grad-b) var(--grad-base), var(--bg)));
}
html.ios-tab[data-backdrop="photo"], html.ios-tab[data-backdrop="anim"][data-anim="ready"] {
  --bar-t: var(--bar-pt, var(--bg)); --bar-b: var(--bar-pb, var(--bg));
}
html.ios-tab .backdrop::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to bottom, var(--bar-t), transparent 36px),
    linear-gradient(to top, var(--bar-b), transparent 36px);
}

/* Round 42 — phone quick create (ui/quick_create.rs, quick_create.js; state.rs quick_create)
   A tap on an empty slot of a phone's time grid (or + → New event) makes a new event that is not
   kept until Save: a box on the grid with a round handle at its start (top-left) and its end
   (bottom-right), and a compact sheet along the foot of the screen, above the keyboard (×, Save,
   the title, when it is, its calendar). The sheet's grabber pulls it up into the whole editor,
   following the finger (its height eases to where it is let go). A computer, a tablet and a
   phone on its side never get the class (.qc); there the editor is as it was. Reduced motion /
   battery saver: their global rules end the easing. */
/* 1. The box: the event's colour, a ring as a selected event's, the handles coming in after it.
      Under a finger it moves at once (no scroll under it); its steps ease. Its own block waits
      under it, hidden. */
.ev.qc, .ev.qc-ghost {
  z-index: 5; overflow: visible; cursor: grab;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  background: color-mix(in oklab, var(--c, var(--fg)) min(100%, calc(var(--ev-a) + 14%)), var(--ev-base));
  box-shadow: inset 3px 0 0 var(--c, var(--fg)), 0 0 0 2px var(--bg), 0 0 0 4px var(--c, var(--fg)), 0 10px 28px rgba(0, 0, 0, .28);
  transition: top .16s var(--ease), height .16s var(--ease), left .22s var(--ease), width .22s var(--ease), box-shadow .25s var(--ease), transform .35s var(--spring);
  animation: qc-in .45s var(--spring) backwards;
}
.ev.qc-ghost { pointer-events: none; animation: none; }
.ev.qc > .ev-inner, .ev.qc-ghost > .ev-inner { overflow: hidden; border-radius: inherit; }
html[data-qc-drag] .ev.qc { cursor: grabbing; }
html[data-qc-drag="m"] .ev.qc { transform: scale(1.02); box-shadow: inset 3px 0 0 var(--c, var(--fg)), 0 0 0 2px var(--bg), 0 0 0 4px var(--c, var(--fg)), 0 18px 40px rgba(0, 0, 0, .36); }
.ev.qc-src { visibility: hidden; animation: none; }
.qc-h {
  position: absolute; z-index: 2; width: 14px; height: 14px; border-radius: 50%;
  background: var(--c, var(--accent)); box-shadow: 0 0 0 2.5px var(--bg), 0 1px 5px rgba(0, 0, 0, .3);
  touch-action: none;
  transition: transform .3s var(--spring);
  animation: qc-h-in .5s var(--spring) .14s backwards;
}
.qc-h.s { left: -9px; top: -9px; }
.qc-h.e { right: -9px; bottom: -9px; }
/* (About 44 pt under a finger, the box's middle left to the box.) */
.qc-h::after { content: ""; position: absolute; inset: -15px; border-radius: 50%; }
html[data-qc-drag="s"] .qc-h.s, html[data-qc-drag="e"] .qc-h.e { transform: scale(1.4); }
@keyframes qc-in { from { opacity: 0; transform: scale(.94); } }
@keyframes qc-h-in { from { transform: scale(0); } }
/* 2. The sheet: as tall as its compact part (--qc-ch, measured: down to the calendars' row), or
      pulled up, the whole editor's room (Round 30's max-height); what it holds below scrolls only
      then. */
@media (max-width: 640px) {
  .inspector.qc { display: flex; flex-direction: column; height: auto; }
  .inspector.qc:not(.qc-full) { max-height: var(--qc-ch, 220px); }
  .inspector.qc > .insp { flex: 1 1 auto; min-height: 0; height: auto; overflow: hidden; padding-top: 0; }
  .inspector.qc.qc-full > .insp:not(.qc-ghost-body) { overflow-y: auto; overscroll-behavior: contain; }
  .inspector.qc > .qc-ghost-body { pointer-events: none; animation: none; }
  .inspector.qc.open { transition: transform .5s var(--ease), opacity .4s var(--ease), bottom .35s var(--kb-ease), max-height .5s var(--ease); }
  /* Its top (the grabber, × and Save) stays at the top as the whole editor scrolls, taking a
     frosted band once something is under it (as the editor's own top row, Round 32). */
  .inspector.qc .qc-top {
    position: sticky; top: 0; z-index: 3;
    margin: 0 -16px; padding: 6px 16px 4px;
    touch-action: none;
  }
  @supports (animation-timeline: scroll()) {
    .inspector.qc.qc-full .qc-top { animation: insp-top-band linear both; animation-timeline: scroll(nearest block); animation-range: 0 24px; }
  }
  .qc-grab { display: flex; justify-content: center; padding: 2px 0 8px; cursor: grab; }
  .qc-grab > span { width: 38px; height: 5px; border-radius: 3px; background: rgba(var(--ink), .24); transition: background .2s; }
  .qc-grab:active > span { background: rgba(var(--ink), .4); }
  .qc-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .qc-x {
    position: relative; display: grid; place-items: center;
    width: 38px; height: 38px; border-radius: 50%;
    background: rgba(var(--ink), .07); color: var(--fg-2);
    transition: transform .3s var(--spring), background .2s;
  }
  .qc-x::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; }
  .qc-x:active { transform: scale(.9); background: rgba(var(--ink), .12); }
  .qc-save {
    position: relative; height: 38px; padding: 0 20px; border-radius: 19px;
    background: var(--fg); color: var(--bg);
    font-size: calc(15px * var(--ts, 1)); font-weight: 650; letter-spacing: -.005em;
    transition: transform .3s var(--spring), filter .2s;
  }
  .qc-save::after { content: ""; position: absolute; inset: -4px -2px; }
  .qc-save:active { transform: scale(.94); }
  .inspector.qc .insp-title-wrap { margin-top: 8px; }
  .inspector.qc .insp-title { font-size: calc(25px * var(--ts, 1)); }
  .qc-when {
    margin: 2px 0 12px; touch-action: none;
    color: var(--fg-2); font-size: calc(15px * var(--ts, 1)); font-weight: 500; font-variant-numeric: tabular-nums;
    transition: color .25s var(--ease);
  }
  .qc-when.said { color: var(--accent); }
  /* The calendars: a row that scrolls sideways, its ends fading under the sheet's edges. */
  .qc-cals {
    display: flex; gap: 6px; margin: 0 -16px; padding: 2px 16px;
    overflow-x: auto; overflow-y: hidden; scrollbar-width: none; overscroll-behavior-x: contain;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 14px, #000 calc(100% - 14px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 14px, #000 calc(100% - 14px), transparent);
  }
  .qc-cals::-webkit-scrollbar { display: none; }
  .qc-cal {
    flex: none; display: flex; align-items: center; gap: 7px;
    height: 34px; padding: 0 13px 0 6px; border-radius: 17px;
    background: rgba(var(--ink), .055); color: var(--fg-2);
    font-size: calc(13.5px * var(--ts, 1)); font-weight: 560; white-space: nowrap;
    transition: background .25s var(--ease), color .2s, box-shadow .25s var(--ease), transform .3s var(--spring);
  }
  .qc-cal .swatch { width: 23px; height: 23px; border-radius: 50%; display: grid; place-items: center; flex: none; }
  .qc-cal.on { color: var(--fg); background: color-mix(in srgb, var(--c, var(--fg)) 16%, transparent); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c, var(--fg)) 70%, transparent); }
  .qc-cal:active { transform: scale(.95); }
  /* The whole editor's cards under it, a little apart from the row. */
  .inspector.qc .qc-cals + .insp-card { margin-top: 16px; }
}
/* A phone turned on its side with a new event open: the editor's panel as on a tablet, with ×
   and Save on top (no grabber: nothing to pull up). */
@media (min-width: 641px) {
  .inspector.qc .qc-grab { display: none; }
  .inspector.qc .qc-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
  .inspector.qc .qc-x { position: relative; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(var(--ink), .07); color: var(--fg-2); }
  .inspector.qc .qc-save { height: 32px; padding: 0 16px; border-radius: 16px; background: var(--fg); color: var(--bg); font-size: calc(14px * var(--ts, 1)); font-weight: 650; }
  .inspector.qc .qc-when { margin: 0 0 10px; color: var(--fg-2); font-size: calc(14px * var(--ts, 1)); }
  .inspector.qc .qc-when.said { color: var(--accent); }
  .inspector.qc .qc-cals { display: flex; flex-wrap: wrap; gap: 6px; }
  .inspector.qc .qc-cal { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px 0 5px; border-radius: 15px; background: rgba(var(--ink), .055); color: var(--fg-2); font-size: calc(13px * var(--ts, 1)); }
  .inspector.qc .qc-cal .swatch { width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center; }
  .inspector.qc .qc-cal.on { color: var(--fg); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c, var(--fg)) 70%, transparent); }
}
/* (While the keyboard is up the compact sheet ends under its "when" line: the calendars' row
   fades away below it, the sheet's height easing, so the box keeps room above it on a smaller
   phone. quick_create.js measures it.) */
@media (max-width: 640px) {
  .inspector.qc .qc-cals { transition: opacity .3s var(--ease); }
  html.kb-open .inspector.qc:not(.qc-full) .qc-cals { opacity: 0; pointer-events: none; }
}
