/*! Kolam M3 — Material Design 3 "Android app mode". Load after tokens.css and kolam.css.
 * Everything here is scoped to html.k-android (set by kolam-m3.js inside the Android app), so in a
 * normal browser the app keeps its Kolam look. Sections:
 *   1. Utilities (k-android-only / k-web-only)   2. Colour roles (defaults from Kolam Ocean Azure; JS regenerates)
 *   3. --md-sys-* tokens: type, shape, elevation, state, motion   4. Kolam tokens mapped onto M3 roles
 *   5. Base   6. md- components (opt-in)   7. Skin: existing k- components restyled to M3
 */

/* ---------- 1. Utilities ---------- */
html:not(.k-android) .k-android-only { display: none !important; }
html.k-android .k-web-only { display: none !important; }

/* ---------- 2. Colour roles (generated by KolamM3.cssFor("#0077b6"); KolamM3.init({ primary }) replaces them) ---------- */
/*@@colors-start*/
html.k-android{--md-sys-color-primary:#006399;--md-sys-color-on-primary:#ffffff;--md-sys-color-primary-container:#cfe4ff;--md-sys-color-on-primary-container:#004b74;--md-sys-color-secondary:#4e6074;--md-sys-color-on-secondary:#ffffff;--md-sys-color-secondary-container:#d2e4fc;--md-sys-color-on-secondary-container:#37485c;--md-sys-color-tertiary:#715572;--md-sys-color-on-tertiary:#ffffff;--md-sys-color-tertiary-container:#f8d9fa;--md-sys-color-on-tertiary-container:#583e5a;--md-sys-color-error:#b4271f;--md-sys-color-on-error:#ffffff;--md-sys-color-error-container:#ffdad3;--md-sys-color-on-error-container:#93000b;--md-sys-color-primary-fixed:#cfe4ff;--md-sys-color-primary-fixed-dim:#9acbff;--md-sys-color-on-primary-fixed:#001d32;--md-sys-color-on-primary-fixed-variant:#004b74;--md-sys-color-secondary-fixed:#d2e4fc;--md-sys-color-secondary-fixed-dim:#b6c8df;--md-sys-color-on-secondary-fixed:#081d2e;--md-sys-color-on-secondary-fixed-variant:#37485c;--md-sys-color-tertiary-fixed:#f8d9fa;--md-sys-color-tertiary-fixed-dim:#dcbddd;--md-sys-color-on-tertiary-fixed:#2a132c;--md-sys-color-on-tertiary-fixed-variant:#583e5a;--md-sys-color-background:#f6faff;--md-sys-color-on-background:#171c22;--md-sys-color-surface:#f6faff;--md-sys-color-on-surface:#171c22;--md-sys-color-surface-dim:#d4dbe3;--md-sys-color-surface-bright:#f6faff;--md-sys-color-surface-container-lowest:#ffffff;--md-sys-color-surface-container-low:#eef4fd;--md-sys-color-surface-container:#e8eef7;--md-sys-color-surface-container-high:#e2e9f1;--md-sys-color-surface-container-highest:#dde3ec;--md-sys-color-surface-variant:#d7e4f5;--md-sys-color-on-surface-variant:#3c4856;--md-sys-color-outline:#6c7888;--md-sys-color-outline-variant:#bbc8d9;--md-sys-color-inverse-surface:#2c3137;--md-sys-color-inverse-on-surface:#ebf1fa;--md-sys-color-inverse-primary:#9acbff;--md-sys-color-surface-tint:#006399;--md-sys-color-shadow:#000000;--md-sys-color-scrim:#000000;}
html.k-android{color-scheme:light}
@media (prefers-color-scheme: dark){html.k-android:not([data-theme="light"]):not([data-theme="contrast"]){--md-sys-color-primary:#9acbff;--md-sys-color-on-primary:#003352;--md-sys-color-primary-container:#004b74;--md-sys-color-on-primary-container:#cfe4ff;--md-sys-color-secondary:#b6c8df;--md-sys-color-on-secondary:#203244;--md-sys-color-secondary-container:#37485c;--md-sys-color-on-secondary-container:#d2e4fc;--md-sys-color-tertiary:#dcbddd;--md-sys-color-on-tertiary:#402842;--md-sys-color-tertiary-container:#583e5a;--md-sys-color-on-tertiary-container:#f8d9fa;--md-sys-color-error:#ffb4a5;--md-sys-color-on-error:#690000;--md-sys-color-error-container:#93000b;--md-sys-color-on-error-container:#ffdad3;--md-sys-color-primary-fixed:#cfe4ff;--md-sys-color-primary-fixed-dim:#9acbff;--md-sys-color-on-primary-fixed:#001d32;--md-sys-color-on-primary-fixed-variant:#004b74;--md-sys-color-secondary-fixed:#d2e4fc;--md-sys-color-secondary-fixed-dim:#b6c8df;--md-sys-color-on-secondary-fixed:#081d2e;--md-sys-color-on-secondary-fixed-variant:#37485c;--md-sys-color-tertiary-fixed:#f8d9fa;--md-sys-color-tertiary-fixed-dim:#dcbddd;--md-sys-color-on-tertiary-fixed:#2a132c;--md-sys-color-on-tertiary-fixed-variant:#583e5a;--md-sys-color-background:#0e141a;--md-sys-color-on-background:#dde3ec;--md-sys-color-surface:#0e141a;--md-sys-color-on-surface:#dde3ec;--md-sys-color-surface-dim:#0e141a;--md-sys-color-surface-bright:#343a40;--md-sys-color-surface-container-lowest:#080f16;--md-sys-color-surface-container-low:#171c22;--md-sys-color-surface-container:#1b2026;--md-sys-color-surface-container-high:#252a31;--md-sys-color-surface-container-highest:#30353c;--md-sys-color-surface-variant:#3c4856;--md-sys-color-on-surface-variant:#bbc8d9;--md-sys-color-outline:#8592a2;--md-sys-color-outline-variant:#3c4856;--md-sys-color-inverse-surface:#dde3ec;--md-sys-color-inverse-on-surface:#2c3137;--md-sys-color-inverse-primary:#006399;--md-sys-color-surface-tint:#9acbff;--md-sys-color-shadow:#000000;--md-sys-color-scrim:#000000;}
html.k-android:not([data-theme="light"]):not([data-theme="contrast"]){color-scheme:dark}
}
html.k-android[data-theme="dark"]{--md-sys-color-primary:#9acbff;--md-sys-color-on-primary:#003352;--md-sys-color-primary-container:#004b74;--md-sys-color-on-primary-container:#cfe4ff;--md-sys-color-secondary:#b6c8df;--md-sys-color-on-secondary:#203244;--md-sys-color-secondary-container:#37485c;--md-sys-color-on-secondary-container:#d2e4fc;--md-sys-color-tertiary:#dcbddd;--md-sys-color-on-tertiary:#402842;--md-sys-color-tertiary-container:#583e5a;--md-sys-color-on-tertiary-container:#f8d9fa;--md-sys-color-error:#ffb4a5;--md-sys-color-on-error:#690000;--md-sys-color-error-container:#93000b;--md-sys-color-on-error-container:#ffdad3;--md-sys-color-primary-fixed:#cfe4ff;--md-sys-color-primary-fixed-dim:#9acbff;--md-sys-color-on-primary-fixed:#001d32;--md-sys-color-on-primary-fixed-variant:#004b74;--md-sys-color-secondary-fixed:#d2e4fc;--md-sys-color-secondary-fixed-dim:#b6c8df;--md-sys-color-on-secondary-fixed:#081d2e;--md-sys-color-on-secondary-fixed-variant:#37485c;--md-sys-color-tertiary-fixed:#f8d9fa;--md-sys-color-tertiary-fixed-dim:#dcbddd;--md-sys-color-on-tertiary-fixed:#2a132c;--md-sys-color-on-tertiary-fixed-variant:#583e5a;--md-sys-color-background:#0e141a;--md-sys-color-on-background:#dde3ec;--md-sys-color-surface:#0e141a;--md-sys-color-on-surface:#dde3ec;--md-sys-color-surface-dim:#0e141a;--md-sys-color-surface-bright:#343a40;--md-sys-color-surface-container-lowest:#080f16;--md-sys-color-surface-container-low:#171c22;--md-sys-color-surface-container:#1b2026;--md-sys-color-surface-container-high:#252a31;--md-sys-color-surface-container-highest:#30353c;--md-sys-color-surface-variant:#3c4856;--md-sys-color-on-surface-variant:#bbc8d9;--md-sys-color-outline:#8592a2;--md-sys-color-outline-variant:#3c4856;--md-sys-color-inverse-surface:#dde3ec;--md-sys-color-inverse-on-surface:#2c3137;--md-sys-color-inverse-primary:#006399;--md-sys-color-surface-tint:#9acbff;--md-sys-color-shadow:#000000;--md-sys-color-scrim:#000000;}
html.k-android[data-theme="dark"]{color-scheme:dark}
html.k-android[data-theme="contrast"]{--md-sys-color-primary:#003f63;--md-sys-color-on-primary:#ffffff;--md-sys-color-primary-container:#005786;--md-sys-color-on-primary-container:#ffffff;--md-sys-color-secondary:#2b3d50;--md-sys-color-on-secondary:#ffffff;--md-sys-color-secondary-container:#425468;--md-sys-color-on-secondary-container:#ffffff;--md-sys-color-tertiary:#4c334e;--md-sys-color-on-tertiary:#ffffff;--md-sys-color-tertiary-container:#644a66;--md-sys-color-on-tertiary-container:#ffffff;--md-sys-color-error:#7e0006;--md-sys-color-on-error:#ffffff;--md-sys-color-error-container:#a41414;--md-sys-color-on-error-container:#ffffff;--md-sys-color-primary-fixed:#cfe4ff;--md-sys-color-primary-fixed-dim:#9acbff;--md-sys-color-on-primary-fixed:#001d32;--md-sys-color-on-primary-fixed-variant:#004b74;--md-sys-color-secondary-fixed:#d2e4fc;--md-sys-color-secondary-fixed-dim:#b6c8df;--md-sys-color-on-secondary-fixed:#081d2e;--md-sys-color-on-secondary-fixed-variant:#37485c;--md-sys-color-tertiary-fixed:#f8d9fa;--md-sys-color-tertiary-fixed-dim:#dcbddd;--md-sys-color-on-tertiary-fixed:#2a132c;--md-sys-color-on-tertiary-fixed-variant:#583e5a;--md-sys-color-background:#f6faff;--md-sys-color-on-background:#000000;--md-sys-color-surface:#f6faff;--md-sys-color-on-surface:#000000;--md-sys-color-surface-dim:#d4dbe3;--md-sys-color-surface-bright:#f6faff;--md-sys-color-surface-container-lowest:#ffffff;--md-sys-color-surface-container-low:#eef4fd;--md-sys-color-surface-container:#e8eef7;--md-sys-color-surface-container-high:#e2e9f1;--md-sys-color-surface-container-highest:#dde3ec;--md-sys-color-surface-variant:#d7e4f5;--md-sys-color-on-surface-variant:#1b2734;--md-sys-color-outline:#3c4856;--md-sys-color-outline-variant:#535f6e;--md-sys-color-inverse-surface:#2c3137;--md-sys-color-inverse-on-surface:#ffffff;--md-sys-color-inverse-primary:#cfe4ff;--md-sys-color-surface-tint:#003f63;--md-sys-color-shadow:#000000;--md-sys-color-scrim:#000000;}
@media (prefers-contrast: more){html.k-android:not([data-theme]){--md-sys-color-primary:#003f63;--md-sys-color-on-primary:#ffffff;--md-sys-color-primary-container:#005786;--md-sys-color-on-primary-container:#ffffff;--md-sys-color-secondary:#2b3d50;--md-sys-color-on-secondary:#ffffff;--md-sys-color-secondary-container:#425468;--md-sys-color-on-secondary-container:#ffffff;--md-sys-color-tertiary:#4c334e;--md-sys-color-on-tertiary:#ffffff;--md-sys-color-tertiary-container:#644a66;--md-sys-color-on-tertiary-container:#ffffff;--md-sys-color-error:#7e0006;--md-sys-color-on-error:#ffffff;--md-sys-color-error-container:#a41414;--md-sys-color-on-error-container:#ffffff;--md-sys-color-primary-fixed:#cfe4ff;--md-sys-color-primary-fixed-dim:#9acbff;--md-sys-color-on-primary-fixed:#001d32;--md-sys-color-on-primary-fixed-variant:#004b74;--md-sys-color-secondary-fixed:#d2e4fc;--md-sys-color-secondary-fixed-dim:#b6c8df;--md-sys-color-on-secondary-fixed:#081d2e;--md-sys-color-on-secondary-fixed-variant:#37485c;--md-sys-color-tertiary-fixed:#f8d9fa;--md-sys-color-tertiary-fixed-dim:#dcbddd;--md-sys-color-on-tertiary-fixed:#2a132c;--md-sys-color-on-tertiary-fixed-variant:#583e5a;--md-sys-color-background:#f6faff;--md-sys-color-on-background:#000000;--md-sys-color-surface:#f6faff;--md-sys-color-on-surface:#000000;--md-sys-color-surface-dim:#d4dbe3;--md-sys-color-surface-bright:#f6faff;--md-sys-color-surface-container-lowest:#ffffff;--md-sys-color-surface-container-low:#eef4fd;--md-sys-color-surface-container:#e8eef7;--md-sys-color-surface-container-high:#e2e9f1;--md-sys-color-surface-container-highest:#dde3ec;--md-sys-color-surface-variant:#d7e4f5;--md-sys-color-on-surface-variant:#1b2734;--md-sys-color-outline:#3c4856;--md-sys-color-outline-variant:#535f6e;--md-sys-color-inverse-surface:#2c3137;--md-sys-color-inverse-on-surface:#ffffff;--md-sys-color-inverse-primary:#cfe4ff;--md-sys-color-surface-tint:#003f63;--md-sys-color-shadow:#000000;--md-sys-color-scrim:#000000;}
}
@media (prefers-contrast: more) and (prefers-color-scheme: dark){html.k-android:not([data-theme="light"]):not([data-theme="contrast"]){--md-sys-color-primary:#d9eaff;--md-sys-color-on-primary:#001d32;--md-sys-color-primary-container:#7abeff;--md-sys-color-on-primary-container:#000000;--md-sys-color-secondary:#d9eaff;--md-sys-color-on-secondary:#081d2e;--md-sys-color-secondary-container:#a8bad1;--md-sys-color-on-secondary-container:#000000;--md-sys-color-tertiary:#fedeff;--md-sys-color-on-tertiary:#2a132c;--md-sys-color-tertiary-container:#ceafcf;--md-sys-color-on-tertiary-container:#000000;--md-sys-color-error:#ffe2dc;--md-sys-color-on-error:#390c00;--md-sys-color-error-container:#ffa08d;--md-sys-color-on-error-container:#000000;--md-sys-color-primary-fixed:#cfe4ff;--md-sys-color-primary-fixed-dim:#9acbff;--md-sys-color-on-primary-fixed:#001d32;--md-sys-color-on-primary-fixed-variant:#004b74;--md-sys-color-secondary-fixed:#d2e4fc;--md-sys-color-secondary-fixed-dim:#b6c8df;--md-sys-color-on-secondary-fixed:#081d2e;--md-sys-color-on-secondary-fixed-variant:#37485c;--md-sys-color-tertiary-fixed:#f8d9fa;--md-sys-color-tertiary-fixed-dim:#dcbddd;--md-sys-color-on-tertiary-fixed:#2a132c;--md-sys-color-on-tertiary-fixed-variant:#583e5a;--md-sys-color-background:#0e141a;--md-sys-color-on-background:#ffffff;--md-sys-color-surface:#0e141a;--md-sys-color-on-surface:#ffffff;--md-sys-color-surface-dim:#0e141a;--md-sys-color-surface-bright:#42474e;--md-sys-color-surface-container-lowest:#000000;--md-sys-color-surface-container-low:#1b2026;--md-sys-color-surface-container:#23282f;--md-sys-color-surface-container-high:#30353c;--md-sys-color-surface-container-highest:#3d434a;--md-sys-color-surface-variant:#3c4856;--md-sys-color-on-surface-variant:#e8f2ff;--md-sys-color-outline:#c9d6e7;--md-sys-color-outline-variant:#a0acbd;--md-sys-color-inverse-surface:#dde3ec;--md-sys-color-inverse-on-surface:#000000;--md-sys-color-inverse-primary:#004b74;--md-sys-color-surface-tint:#d9eaff;--md-sys-color-shadow:#000000;--md-sys-color-scrim:#000000;}
}
/*@@colors-end*/

/* ---------- 3. System tokens ---------- */
html.k-android {
  /* Insets: Android WebView env() plus the variables Capacitor's SystemBars (insetsHandling: "css") injects */
  --md-inset-top: max(env(safe-area-inset-top, 0px), var(--safe-area-inset-top, 0px));
  --md-inset-bottom: max(env(safe-area-inset-bottom, 0px), var(--safe-area-inset-bottom, 0px));
  --md-inset-left: max(env(safe-area-inset-left, 0px), var(--safe-area-inset-left, 0px));
  --md-inset-right: max(env(safe-area-inset-right, 0px), var(--safe-area-inset-right, 0px));

  /* Type scale. Kolam rule: Lato (400/700/900) + Noto Sans Tamil, so M3's 500 "medium" maps to Lato 700. */
  --md-ref-typeface-brand: Lato, "Noto Sans Tamil", ui-sans-serif, system-ui, sans-serif;
  --md-ref-typeface-plain: Lato, "Noto Sans Tamil", ui-sans-serif, system-ui, sans-serif;
  --md-sys-typescale-display-large: 400 57px/64px var(--md-ref-typeface-brand);    --md-sys-typescale-display-large-tracking: -0.25px;
  --md-sys-typescale-display-medium: 400 45px/52px var(--md-ref-typeface-brand);   --md-sys-typescale-display-medium-tracking: 0px;
  --md-sys-typescale-display-small: 400 36px/44px var(--md-ref-typeface-brand);    --md-sys-typescale-display-small-tracking: 0px;
  --md-sys-typescale-headline-large: 400 32px/40px var(--md-ref-typeface-brand);   --md-sys-typescale-headline-large-tracking: 0px;
  --md-sys-typescale-headline-medium: 400 28px/36px var(--md-ref-typeface-brand);  --md-sys-typescale-headline-medium-tracking: 0px;
  --md-sys-typescale-headline-small: 400 24px/32px var(--md-ref-typeface-brand);   --md-sys-typescale-headline-small-tracking: 0px;
  --md-sys-typescale-title-large: 400 22px/28px var(--md-ref-typeface-brand);      --md-sys-typescale-title-large-tracking: 0px;
  --md-sys-typescale-title-medium: 700 16px/24px var(--md-ref-typeface-plain);     --md-sys-typescale-title-medium-tracking: 0.15px;
  --md-sys-typescale-title-small: 700 14px/20px var(--md-ref-typeface-plain);      --md-sys-typescale-title-small-tracking: 0.1px;
  --md-sys-typescale-body-large: 400 16px/24px var(--md-ref-typeface-plain);       --md-sys-typescale-body-large-tracking: 0.5px;
  --md-sys-typescale-body-medium: 400 14px/20px var(--md-ref-typeface-plain);      --md-sys-typescale-body-medium-tracking: 0.25px;
  --md-sys-typescale-body-small: 400 12px/16px var(--md-ref-typeface-plain);       --md-sys-typescale-body-small-tracking: 0.4px;
  --md-sys-typescale-label-large: 700 14px/20px var(--md-ref-typeface-plain);      --md-sys-typescale-label-large-tracking: 0.1px;
  --md-sys-typescale-label-medium: 700 12px/16px var(--md-ref-typeface-plain);     --md-sys-typescale-label-medium-tracking: 0.5px;
  --md-sys-typescale-label-small: 700 11px/16px var(--md-ref-typeface-plain);      --md-sys-typescale-label-small-tracking: 0.5px;

  /* Shape scale */
  --md-sys-shape-corner-none: 0px; --md-sys-shape-corner-extra-small: 4px; --md-sys-shape-corner-small: 8px;
  --md-sys-shape-corner-medium: 12px; --md-sys-shape-corner-large: 16px; --md-sys-shape-corner-large-increased: 20px;
  --md-sys-shape-corner-extra-large: 28px; --md-sys-shape-corner-extra-large-increased: 32px;
  --md-sys-shape-corner-extra-extra-large: 48px; --md-sys-shape-corner-full: 9999px;

  /* Elevation (shadow part; tonal part comes from the surface-container roles) */
  --md-sys-elevation-level0: none;
  --md-sys-elevation-level1: 0 1px 2px rgb(0 0 0 / .3), 0 1px 3px 1px rgb(0 0 0 / .15);
  --md-sys-elevation-level2: 0 1px 2px rgb(0 0 0 / .3), 0 2px 6px 2px rgb(0 0 0 / .15);
  --md-sys-elevation-level3: 0 1px 3px rgb(0 0 0 / .3), 0 4px 8px 3px rgb(0 0 0 / .15);
  --md-sys-elevation-level4: 0 2px 3px rgb(0 0 0 / .3), 0 6px 10px 4px rgb(0 0 0 / .15);
  --md-sys-elevation-level5: 0 4px 4px rgb(0 0 0 / .3), 0 8px 12px 6px rgb(0 0 0 / .15);

  /* State layers */
  --md-sys-state-hover-state-layer-opacity: .08; --md-sys-state-focus-state-layer-opacity: .10;
  --md-sys-state-pressed-state-layer-opacity: .10; --md-sys-state-dragged-state-layer-opacity: .16;
  --md-sys-state-disabled-content-opacity: .38; --md-sys-state-disabled-container-opacity: .12;

  /* Motion */
  --md-sys-motion-easing-standard: cubic-bezier(.2, 0, 0, 1);
  --md-sys-motion-easing-standard-decelerate: cubic-bezier(0, 0, 0, 1);
  --md-sys-motion-easing-standard-accelerate: cubic-bezier(.3, 0, 1, 1);
  --md-sys-motion-easing-emphasized: cubic-bezier(.2, 0, 0, 1);
  --md-sys-motion-easing-emphasized-decelerate: cubic-bezier(.05, .7, .1, 1);
  --md-sys-motion-easing-emphasized-accelerate: cubic-bezier(.3, 0, .8, .15);
  --md-sys-motion-easing-linear: cubic-bezier(0, 0, 1, 1);
  --md-sys-motion-duration-short1: 50ms; --md-sys-motion-duration-short2: 100ms; --md-sys-motion-duration-short3: 150ms; --md-sys-motion-duration-short4: 200ms;
  --md-sys-motion-duration-medium1: 250ms; --md-sys-motion-duration-medium2: 300ms; --md-sys-motion-duration-medium3: 350ms; --md-sys-motion-duration-medium4: 400ms;
  --md-sys-motion-duration-long1: 450ms; --md-sys-motion-duration-long2: 500ms; --md-sys-motion-duration-long3: 550ms; --md-sys-motion-duration-long4: 600ms;
}

/* ---------- 4. Kolam tokens → M3 roles, so app CSS written against Kolam picks up the M3 scheme.
   :not(#k-m3) raises specificity above Kolam's own dark/contrast selectors (:root:not(..):not(..)). ---------- */
html.k-android:not(#k-m3) {
  --bg: var(--md-sys-color-surface);
  --surface: var(--md-sys-color-surface-container-low);
  --surface-sunken: var(--md-sys-color-surface-container-highest);
  --surface-raised: var(--md-sys-color-surface-container-high);
  --line: var(--md-sys-color-outline-variant);
  --line-strong: var(--md-sys-color-outline);
  --ink: var(--md-sys-color-on-surface);
  --ink-2: var(--md-sys-color-on-surface-variant);
  --ink-muted: var(--md-sys-color-on-surface-variant);
  --sidebar: var(--md-sys-color-surface-container);
  --on-sidebar: var(--md-sys-color-on-surface);
  --primary: var(--md-sys-color-primary);
  --primary-hover: color-mix(in srgb, var(--md-sys-color-primary), var(--md-sys-color-on-primary) 8%);
  --on-primary: var(--md-sys-color-on-primary);
  --primary-soft: var(--md-sys-color-primary-container);
  --primary-text: var(--md-sys-color-primary);
  --secondary: var(--md-sys-color-secondary);
  --secondary-strong: var(--md-sys-color-secondary);
  --secondary-hover: color-mix(in srgb, var(--md-sys-color-secondary), var(--md-sys-color-on-secondary) 8%);
  --on-secondary: var(--md-sys-color-on-secondary);
  --secondary-soft: var(--md-sys-color-secondary-container);
  --secondary-text: var(--md-sys-color-secondary);
  --accent: var(--md-sys-color-tertiary);
  --accent-hover: color-mix(in srgb, var(--md-sys-color-tertiary), var(--md-sys-color-on-tertiary) 8%);
  --on-accent: var(--md-sys-color-on-tertiary);
  --accent-soft: var(--md-sys-color-tertiary-container);
  --accent-text: var(--md-sys-color-tertiary);
  --danger: var(--md-sys-color-error);
  --danger-soft: var(--md-sys-color-error-container);
  --on-danger: var(--md-sys-color-on-error);
  --focus: var(--md-sys-color-secondary);
  --scrim: color-mix(in srgb, var(--md-sys-color-scrim) 32%, transparent);
  --shadow-1: var(--md-sys-elevation-level1);
  --shadow-2: var(--md-sys-elevation-level2);
  --shadow-3: var(--md-sys-elevation-level3);
}

/* ---------- 5. Base ---------- */
html.k-android { -webkit-tap-highlight-color: transparent; }
html.k-android body {
  background: var(--md-sys-color-surface); color: var(--md-sys-color-on-surface);
  font: var(--md-sys-typescale-body-large); letter-spacing: var(--md-sys-typescale-body-large-tracking);
}
html.k-android :lang(ta) { letter-spacing: 0 !important; } /* tracking breaks Tamil conjuncts */
html.k-android.k-edge:not(.k-has-appbar) body { padding-top: var(--md-inset-top); }
html.k-android.k-has-navbar body { padding-bottom: calc(80px + var(--md-inset-bottom)); }
html.k-android.k-edge body { padding-left: var(--md-inset-left); padding-right: var(--md-inset-right); }
/* M3 focus indicator: 3dp secondary outline, 2dp offset */
html.k-android :focus-visible { outline: 3px solid var(--md-sys-color-secondary); outline-offset: 2px; }
html.k-android :is(button, a, [role="button"], [role="tab"]) { -webkit-touch-callout: none; }

/* Type classes */
.md-display-large { font: var(--md-sys-typescale-display-large); letter-spacing: var(--md-sys-typescale-display-large-tracking); }
.md-display-medium { font: var(--md-sys-typescale-display-medium); letter-spacing: var(--md-sys-typescale-display-medium-tracking); }
.md-display-small { font: var(--md-sys-typescale-display-small); letter-spacing: var(--md-sys-typescale-display-small-tracking); }
.md-headline-large { font: var(--md-sys-typescale-headline-large); }
.md-headline-medium { font: var(--md-sys-typescale-headline-medium); }
.md-headline-small { font: var(--md-sys-typescale-headline-small); }
.md-title-large { font: var(--md-sys-typescale-title-large); }
.md-title-medium { font: var(--md-sys-typescale-title-medium); letter-spacing: var(--md-sys-typescale-title-medium-tracking); }
.md-title-small { font: var(--md-sys-typescale-title-small); letter-spacing: var(--md-sys-typescale-title-small-tracking); }
.md-body-large { font: var(--md-sys-typescale-body-large); letter-spacing: var(--md-sys-typescale-body-large-tracking); }
.md-body-medium { font: var(--md-sys-typescale-body-medium); letter-spacing: var(--md-sys-typescale-body-medium-tracking); }
.md-body-small { font: var(--md-sys-typescale-body-small); letter-spacing: var(--md-sys-typescale-body-small-tracking); }
.md-label-large { font: var(--md-sys-typescale-label-large); letter-spacing: var(--md-sys-typescale-label-large-tracking); }
.md-label-medium { font: var(--md-sys-typescale-label-medium); letter-spacing: var(--md-sys-typescale-label-medium-tracking); }
.md-label-small { font: var(--md-sys-typescale-label-small); letter-spacing: var(--md-sys-typescale-label-small-tracking); }

/* Icons: Material Symbols Rounded (kolam-m3.js loads the font, subset to the icons in use) */
.md-icon {
  font-family: "Material Symbols Rounded"; font-weight: normal; font-style: normal; font-size: 24px; line-height: 1;
  letter-spacing: normal; text-transform: none; display: inline-block; white-space: nowrap; word-wrap: normal; direction: ltr;
  width: 1em; height: 1em; overflow: hidden; flex: none; -webkit-font-smoothing: antialiased; font-feature-settings: "liga";
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24; user-select: none;
}
.md-icon--filled { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }

/* ---------- State layer + ripple (shared) ----------
   Hosts get ::before as the state layer (hover 8%, focus 10%, pressed 10% of the content colour). */
:where(.md-button, .md-icon-button, .md-fab, .md-chip, .md-tab, .md-segmented > button, a.md-card, button.md-card,
    .md-list-item[href], button.md-list-item, label.md-list-item, .md-snackbar__action, .md-ripple-host) { position: relative; } /* :where keeps this at 0 specificity so e.g. .md-fab--fixed wins */
:is(.md-button, .md-fab, .md-chip, .md-tab, .md-segmented > button, a.md-card, button.md-card,
    .md-list-item[href], button.md-list-item, label.md-list-item, .md-snackbar__action, .md-ripple-host)::before,
.md-icon-button::before, .md-nav-indicator::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: 0; pointer-events: none;
  transition: opacity var(--md-sys-motion-duration-short3) linear;
}
@media (hover: hover) {
  :is(.md-button, .md-icon-button, .md-fab, .md-chip, .md-tab, .md-segmented > button, a.md-card, button.md-card,
      .md-list-item[href], button.md-list-item, label.md-list-item, .md-snackbar__action, .md-ripple-host):hover::before,
  .md-nav-item:hover .md-nav-indicator::before { opacity: var(--md-sys-state-hover-state-layer-opacity); }
}
:is(.md-button, .md-icon-button, .md-fab, .md-chip, .md-tab, .md-segmented > button, a.md-card, button.md-card,
    .md-list-item[href], button.md-list-item, label.md-list-item, .md-snackbar__action, .md-ripple-host):focus-visible::before,
.md-nav-item:focus-visible .md-nav-indicator::before { opacity: var(--md-sys-state-focus-state-layer-opacity); }
html:not(.k-ripple) :is(.md-button, .md-icon-button, .md-fab, .md-chip, .md-tab, .md-segmented > button, a.md-card, button.md-card,
    .md-list-item[href], button.md-list-item, label.md-list-item, .md-ripple-host):active::before,
html:not(.k-ripple) .md-nav-item:active .md-nav-indicator::before { opacity: var(--md-sys-state-pressed-state-layer-opacity); }
.md-ripple { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; pointer-events: none; z-index: 0; }
.md-ripple__wave {
  position: absolute; border-radius: 50%; background: currentColor; opacity: var(--md-sys-state-pressed-state-layer-opacity, .1);
  transform: scale(0); animation: md-ripple var(--md-sys-motion-duration-medium4, 400ms) var(--md-sys-motion-easing-standard, ease-out) forwards;
}
.md-ripple__wave--out { opacity: 0; transition: opacity var(--md-sys-motion-duration-short4, 200ms) linear; }
@keyframes md-ripple { to { transform: scale(1); } }
:is(.md-icon-button, .k-iconbtn) > .md-ripple { inset: 4px; border-radius: 50%; }

/* ---------- 6. Components (opt-in md- classes) ---------- */

/* Top app bar — small 64dp; center-aligned; medium 112dp / large 152dp with a headline that scrolls away */
.md-top-app-bar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 4px;
  min-height: calc(64px + var(--md-inset-top)); padding: var(--md-inset-top) 4px 0;
  background: var(--md-sys-color-surface); color: var(--md-sys-color-on-surface);
  transition: background-color var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-standard);
}
.md-top-app-bar.md-scrolled { background: var(--md-sys-color-surface-container); }
.md-top-app-bar__title { flex: 1; min-width: 0; margin: 0 0 0 12px; font: var(--md-sys-typescale-title-large); color: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.md-top-app-bar__nav:not([hidden]) + .md-top-app-bar__title { margin-left: 0; }
.md-top-app-bar__nav[hidden] { display: none; }
.md-top-app-bar__actions { display: flex; align-items: center; margin-right: 0; }
.md-top-app-bar__actions .md-icon-button { color: var(--md-sys-color-on-surface-variant); }
.md-top-app-bar--center .md-top-app-bar__title { position: absolute; left: 64px; right: 64px; margin: 0; text-align: center; bottom: 18px; }
.md-top-app-bar--center .md-top-app-bar__actions { margin-left: auto; }
.md-top-app-bar--medium .md-top-app-bar__title, .md-top-app-bar--large .md-top-app-bar__title { opacity: 0; transition: opacity var(--md-sys-motion-duration-short4) linear; }
.md-top-app-bar.md-collapsed .md-top-app-bar__title { opacity: 1; }
.md-top-app-bar-headline { margin: 0; padding: 0 16px; color: var(--md-sys-color-on-surface); background: var(--md-sys-color-surface); overflow-wrap: anywhere; }
.md-top-app-bar-headline--medium { font: var(--md-sys-typescale-headline-small); padding-top: 4px; padding-bottom: 20px; min-height: 48px; }
.md-top-app-bar-headline--large { font: var(--md-sys-typescale-headline-medium); padding-top: 36px; padding-bottom: 28px; min-height: 88px; }
.md-icon-button__text { font: var(--md-sys-typescale-label-large); color: var(--md-sys-color-primary); }
.md-icon-button__text[lang="ta"] { font-size: 17px; }

/* Navigation bar — 80dp, 64×32 active indicator pill, label medium */
.md-navigation-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; gap: 8px;
  height: calc(80px + var(--md-inset-bottom)); padding: 12px calc(8px + var(--md-inset-right)) calc(16px + var(--md-inset-bottom)) calc(8px + var(--md-inset-left));
  background: var(--md-sys-color-surface-container);
}
.md-nav-item {
  flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0; margin: 0;
  border: 0; background: none; color: var(--md-sys-color-on-surface-variant); text-decoration: none; cursor: pointer;
  font: var(--md-sys-typescale-label-medium); letter-spacing: var(--md-sys-typescale-label-medium-tracking);
}
.md-nav-item:focus-visible { outline: none; }
.md-nav-item:focus-visible .md-nav-indicator { outline: 3px solid var(--md-sys-color-secondary); outline-offset: 2px; }
.md-nav-indicator { position: relative; display: grid; place-items: center; width: 64px; height: 32px; border-radius: var(--md-sys-shape-corner-full); }
.md-nav-indicator::after { /* the pill grows from the centre when a destination becomes active */
  content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--md-sys-color-secondary-container);
  transform: scaleX(.32); opacity: 0; z-index: -1;
  transition: transform var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized-decelerate), opacity var(--md-sys-motion-duration-short2) linear;
}
.md-nav-indicator { isolation: isolate; }
.md-nav-item[aria-current="page"] .md-nav-indicator { color: var(--md-sys-color-on-secondary-container); }
.md-nav-item[aria-current="page"] .md-nav-indicator::after { transform: none; opacity: 1; }
.md-nav-item[aria-current="page"] .md-nav-label { color: var(--md-sys-color-on-surface); }
.md-nav-label { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
.md-nav-indicator .md-badge { position: absolute; left: 34px; top: 2px; }

/* Buttons — 40dp, full radius, label large. Variants: filled, tonal, outlined, text, elevated */
.md-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 24px;
  border: 0; border-radius: var(--md-sys-shape-corner-full); cursor: pointer; text-decoration: none; white-space: nowrap;
  font: var(--md-sys-typescale-label-large); letter-spacing: var(--md-sys-typescale-label-large-tracking);
  background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary);
  transition: box-shadow var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}
.md-button::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 48px; transform: translateY(-50%); } /* 48dp touch target */
.md-button > .md-icon { font-size: 18px; margin-left: -8px; }
.md-button--tonal { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.md-button--outlined { background: transparent; color: var(--md-sys-color-primary); box-shadow: inset 0 0 0 1px var(--md-sys-color-outline); }
.md-button--text { background: transparent; color: var(--md-sys-color-primary); padding: 0 12px; }
.md-button--text > .md-icon { margin-left: -4px; }
.md-button--elevated { background: var(--md-sys-color-surface-container-low); color: var(--md-sys-color-primary); box-shadow: var(--md-sys-elevation-level1); }
.md-button--error { background: var(--md-sys-color-error); color: var(--md-sys-color-on-error); }
@media (hover: hover) { .md-button:not(.md-button--text):not(.md-button--outlined):not(.md-button--tonal):hover, .md-button--tonal:hover { box-shadow: var(--md-sys-elevation-level1); } .md-button--elevated:hover { box-shadow: var(--md-sys-elevation-level2); } }
.md-button:disabled, .md-button[aria-disabled="true"] {
  background: color-mix(in srgb, var(--md-sys-color-on-surface) 12%, transparent); color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent);
  box-shadow: none; cursor: not-allowed;
}
.md-button--text:disabled, .md-button--outlined:disabled { background: transparent; }

/* Icon buttons — 40dp visual inside a 48dp target. Standard, filled, tonal, outlined; aria-pressed toggles */
.md-icon-button {
  display: inline-grid; place-items: center; width: 48px; height: 48px; padding: 4px; margin: 0; border: 0; border-radius: 50%;
  background: transparent; background-clip: content-box; color: var(--md-sys-color-on-surface-variant); cursor: pointer; text-decoration: none; flex: none;
}
.md-icon-button::before { inset: 4px; border-radius: 50%; }
.md-icon-button--filled { background-color: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
.md-icon-button--tonal { background-color: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.md-icon-button--outlined { box-shadow: inset 0 0 0 5px transparent; background-image: radial-gradient(circle closest-side, transparent calc(100% - 1px), var(--md-sys-color-outline) calc(100% - 1px)); }
.md-icon-button[aria-pressed="true"] { color: var(--md-sys-color-primary); }
.md-icon-button[aria-pressed="true"] .md-icon { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }
.md-icon-button--filled[aria-pressed="false"] { background-color: var(--md-sys-color-surface-container-highest); color: var(--md-sys-color-primary); }
.md-icon-button:disabled { color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent); cursor: not-allowed; }

/* FAB — 56dp r16 (small 40 r12, large 96 r28), extended 56dp; primary container by default */
.md-fab {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px; width: 56px; height: 56px; padding: 0; border: 0;
  border-radius: var(--md-sys-shape-corner-large); cursor: pointer; text-decoration: none;
  background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); box-shadow: var(--md-sys-elevation-level3);
  font: var(--md-sys-typescale-label-large); letter-spacing: var(--md-sys-typescale-label-large-tracking);
  transition: box-shadow var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard), transform var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized);
}
@media (hover: hover) { .md-fab:hover { box-shadow: var(--md-sys-elevation-level4); } }
.md-fab--small { width: 40px; height: 40px; border-radius: var(--md-sys-shape-corner-medium); }
.md-fab--large { width: 96px; height: 96px; border-radius: var(--md-sys-shape-corner-extra-large); }
.md-fab--large > .md-icon { font-size: 36px; }
.md-fab--extended { width: auto; min-width: 80px; padding: 0 20px 0 16px; }
.md-fab--secondary { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.md-fab--tertiary { background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container); }
.md-fab--surface { background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-primary); }
.md-fab--fixed { position: fixed; right: calc(16px + var(--md-inset-right)); bottom: calc(16px + var(--md-inset-bottom)); z-index: 19; }
html.k-has-navbar .md-fab--fixed { bottom: calc(96px + var(--md-inset-bottom)); }
html:has(.md-snackbar:not(.md-snackbar--out)) .md-fab--fixed { transform: translateY(-64px); } /* the FAB moves up out of the snackbar's way */

/* Chips — 32dp, r8. assist / filter (aria-pressed or aria-selected) / input / suggestion; --elevated */
.md-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 16px; margin: 0; border: 0; cursor: pointer;
  border-radius: var(--md-sys-shape-corner-small); background: transparent; color: var(--md-sys-color-on-surface-variant);
  box-shadow: inset 0 0 0 1px var(--md-sys-color-outline); text-decoration: none; white-space: nowrap;
  font: var(--md-sys-typescale-label-large); letter-spacing: var(--md-sys-typescale-label-large-tracking);
}
.md-chip > .md-icon { font-size: 18px; color: var(--md-sys-color-primary); margin-left: -8px; }
.md-chip--assist { color: var(--md-sys-color-on-surface); }
.md-chip--elevated { box-shadow: var(--md-sys-elevation-level1); background: var(--md-sys-color-surface-container-low); }
.md-chip:is([aria-pressed="true"], [aria-selected="true"], [aria-checked="true"]) {
  background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); box-shadow: none; padding-left: 8px;
}
.md-chip--filter:is([aria-pressed="true"], [aria-selected="true"], [aria-checked="true"])::after { /* leading check mark */
  content: ""; order: -1; width: 18px; height: 18px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.55 17.6 4.4 12.45l1.4-1.4 3.75 3.75 8.65-8.65 1.4 1.4z'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.55 17.6 4.4 12.45l1.4-1.4 3.75 3.75 8.65-8.65 1.4 1.4z'/%3E%3C/svg%3E") center/contain no-repeat;
}
.md-chip:is([aria-pressed="true"], [aria-selected="true"], [aria-checked="true"]) > .md-icon { color: inherit; margin-left: 0; }
.md-chip--input { padding: 0 8px 0 12px; }
.md-chip--input .md-chip__remove { display: inline-grid; place-items: center; width: 18px; height: 18px; border: 0; padding: 0; background: none; color: inherit; cursor: pointer; }
.md-chip--input .md-chip__remove .md-icon { font-size: 18px; color: inherit; margin: 0; }
.md-chip:disabled { color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--md-sys-color-on-surface) 12%, transparent); }
.md-chip-set { display: flex; flex-wrap: wrap; gap: 8px; }
.md-chip-set--scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.md-chip-set--scroll::-webkit-scrollbar { display: none; }

/* Cards — r12. elevated (default) / filled / outlined; a/button cards get state layers */
.md-card {
  display: block; position: relative; border-radius: var(--md-sys-shape-corner-medium); padding: 16px; color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-surface-container-low); box-shadow: var(--md-sys-elevation-level1); text-decoration: none; text-align: left; border: 0; font: inherit;
}
.md-card--filled { background: var(--md-sys-color-surface-container-highest); box-shadow: none; }
.md-card--outlined { background: var(--md-sys-color-surface); box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant); }
.md-card__media { margin: -16px -16px 16px; border-radius: var(--md-sys-shape-corner-medium) var(--md-sys-shape-corner-medium) 0 0; overflow: hidden; aspect-ratio: 16 / 9; background: var(--md-sys-color-surface-container-highest); }
.md-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.md-card__title { margin: 0; font: var(--md-sys-typescale-title-medium); letter-spacing: var(--md-sys-typescale-title-medium-tracking); }
.md-card__subtitle { margin: 4px 0 0; font: var(--md-sys-typescale-body-medium); color: var(--md-sys-color-on-surface-variant); }
.md-card__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* Dialog — native <dialog>; r28, surface container high, headline small, text-button actions */
.md-dialog {
  min-width: 280px; max-width: min(560px, calc(100vw - 48px)); padding: 24px; border: 0; border-radius: var(--md-sys-shape-corner-extra-large);
  background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface-variant); box-shadow: var(--md-sys-elevation-level3);
}
.md-dialog::backdrop { background: color-mix(in srgb, var(--md-sys-color-scrim) 32%, transparent); }
.md-dialog[open] { animation: md-dialog-in var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized-decelerate); }
@keyframes md-dialog-in { from { opacity: 0; transform: translateY(-24px) scale(.96); } }
.md-dialog__icon { display: block; margin: 0 auto 16px; color: var(--md-sys-color-secondary); }
.md-dialog__headline { margin: 0 0 16px; font: var(--md-sys-typescale-headline-small); color: var(--md-sys-color-on-surface); }
.md-dialog__icon + .md-dialog__headline { text-align: center; }
.md-dialog__content { margin: 0; font: var(--md-sys-typescale-body-medium); letter-spacing: var(--md-sys-typescale-body-medium-tracking); }
.md-dialog__actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 24px; }

/* Snackbar — inverse surface, r4, body medium, inverse-primary action; above the navigation bar */
.md-snackbar-host {
  position: fixed; left: calc(16px + var(--md-inset-left)); right: calc(16px + var(--md-inset-right)); z-index: 40;
  bottom: calc(16px + var(--md-inset-bottom)); display: grid; justify-items: center; pointer-events: none;
}
html.k-has-navbar .md-snackbar-host { bottom: calc(96px + var(--md-inset-bottom)); }
.md-snackbar {
  pointer-events: auto; display: flex; align-items: center; gap: 4px; width: 100%; max-width: 560px; min-height: 48px; padding: 4px 8px 4px 16px;
  border-radius: var(--md-sys-shape-corner-extra-small); background: var(--md-sys-color-inverse-surface); color: var(--md-sys-color-inverse-on-surface);
  box-shadow: var(--md-sys-elevation-level3); font: var(--md-sys-typescale-body-medium); letter-spacing: var(--md-sys-typescale-body-medium-tracking);
  animation: md-snack-in var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-emphasized-decelerate);
}
.md-snackbar--out { opacity: 0; transition: opacity var(--md-sys-motion-duration-short3) linear; }
@keyframes md-snack-in { from { opacity: 0; transform: translateY(8px); } }
.md-snackbar__text { flex: 1; padding: 10px 0; }
.md-snackbar__action {
  height: 40px; padding: 0 12px; border: 0; border-radius: var(--md-sys-shape-corner-full); background: none; cursor: pointer;
  color: var(--md-sys-color-inverse-primary); font: var(--md-sys-typescale-label-large); letter-spacing: var(--md-sys-typescale-label-large-tracking);
}
.md-snackbar__close { color: var(--md-sys-color-inverse-on-surface); }
.md-snackbar :focus-visible { outline-color: var(--md-sys-color-inverse-primary); }

/* Text fields — 56dp. <label class="md-text-field md-text-field--outlined|--filled"><input placeholder=" "><span class="md-text-field__label">…</span></label> */
.md-text-field { position: relative; display: block; --md-tf-bg: var(--md-sys-color-surface); }
.md-text-field :is(input, textarea, select) {
  display: block; width: 100%; min-height: 56px; margin: 0; padding: 16px; border: 0; border-radius: var(--md-sys-shape-corner-extra-small);
  background: transparent; color: var(--md-sys-color-on-surface); caret-color: var(--md-sys-color-primary); appearance: none;
  font: var(--md-sys-typescale-body-large); letter-spacing: var(--md-sys-typescale-body-large-tracking); outline: none;
}
.md-text-field textarea { min-height: 112px; resize: vertical; }
.md-text-field ::placeholder { color: transparent; }
.md-text-field :focus::placeholder { color: var(--md-sys-color-on-surface-variant); }
.md-text-field__label {
  position: absolute; left: 16px; top: 16px; max-width: calc(100% - 32px); pointer-events: none; color: var(--md-sys-color-on-surface-variant);
  font: var(--md-sys-typescale-body-large); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transform-origin: left top;
  transition: transform var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard), color var(--md-sys-motion-duration-short4) linear;
}
.md-text-field__support { display: block; padding: 4px 16px 0; font: var(--md-sys-typescale-body-small); letter-spacing: var(--md-sys-typescale-body-small-tracking); color: var(--md-sys-color-on-surface-variant); }
.md-text-field--outlined :is(input, textarea, select) { box-shadow: inset 0 0 0 1px var(--md-sys-color-outline); }
.md-text-field--outlined :is(input, textarea, select):hover { box-shadow: inset 0 0 0 1px var(--md-sys-color-on-surface); }
.md-text-field--outlined :is(input, textarea, select):focus { box-shadow: inset 0 0 0 2px var(--md-sys-color-primary); }
.md-text-field--outlined :is(:focus, :not(:placeholder-shown)) + .md-text-field__label,
.md-text-field--outlined select + .md-text-field__label { transform: translate(-4px, -24px) scale(.75); padding: 0 4px; background: var(--md-tf-bg); }
.md-text-field--filled :is(input, textarea, select) {
  padding: 24px 16px 8px; border-radius: var(--md-sys-shape-corner-extra-small) var(--md-sys-shape-corner-extra-small) 0 0;
  background: var(--md-sys-color-surface-container-highest); box-shadow: inset 0 -1px 0 var(--md-sys-color-on-surface-variant);
}
.md-text-field--filled :is(input, textarea, select):focus { box-shadow: inset 0 -2px 0 var(--md-sys-color-primary); }
.md-text-field--filled :is(:focus, :not(:placeholder-shown)) + .md-text-field__label,
.md-text-field--filled select + .md-text-field__label { transform: translateY(-8px) scale(.75); }
.md-text-field :focus + .md-text-field__label { color: var(--md-sys-color-primary); }
.md-text-field [aria-invalid="true"] + .md-text-field__label, .md-text-field:has([aria-invalid="true"]) .md-text-field__support { color: var(--md-sys-color-error); }
.md-text-field--outlined [aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--md-sys-color-error) !important; }
.md-text-field--filled [aria-invalid="true"] { box-shadow: inset 0 -2px 0 var(--md-sys-color-error) !important; }
.md-text-field :disabled { color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent); }

/* Search bar — 56dp pill */
.md-search-bar {
  display: flex; align-items: center; gap: 4px; height: 56px; padding: 0 4px; border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface-variant);
}
.md-search-bar > .md-icon:first-child { margin: 0 12px; }
.md-search-bar input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; color: var(--md-sys-color-on-surface); outline: none; font: var(--md-sys-typescale-body-large); letter-spacing: var(--md-sys-typescale-body-large-tracking); }
.md-search-bar input::placeholder { color: var(--md-sys-color-on-surface-variant); opacity: 1; }
.md-search-bar:focus-within { outline: 3px solid var(--md-sys-color-secondary); outline-offset: 2px; }

/* Lists — 56 / 72 / 88dp items, 16dp leading, 24dp trailing */
.md-list { list-style: none; margin: 0; padding: 8px 0; background: var(--md-sys-color-surface); }
.md-list-item {
  display: flex; align-items: center; gap: 16px; width: 100%; min-height: 56px; padding: 8px 24px 8px 16px; margin: 0; border: 0;
  background: none; color: var(--md-sys-color-on-surface); text-decoration: none; text-align: left; font: inherit; cursor: default; box-sizing: border-box;
}
:is(a, button, label).md-list-item { cursor: pointer; }
.md-list-item > .md-icon { color: var(--md-sys-color-on-surface-variant); }
.md-list-item__avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); font: var(--md-sys-typescale-title-medium); overflow: hidden; }
.md-list-item__text { flex: 1; min-width: 0; display: grid; }
.md-list-item__headline { font: var(--md-sys-typescale-body-large); letter-spacing: var(--md-sys-typescale-body-large-tracking); color: var(--md-sys-color-on-surface); }
.md-list-item__supporting { font: var(--md-sys-typescale-body-medium); letter-spacing: var(--md-sys-typescale-body-medium-tracking); color: var(--md-sys-color-on-surface-variant); }
.md-list-item__overline { font: var(--md-sys-typescale-label-small); letter-spacing: var(--md-sys-typescale-label-small-tracking); color: var(--md-sys-color-on-surface-variant); }
.md-list-item__trailing { font: var(--md-sys-typescale-label-small); letter-spacing: var(--md-sys-typescale-label-small-tracking); color: var(--md-sys-color-on-surface-variant); flex: none; }
.md-list-item:has(.md-list-item__supporting) { min-height: 72px; }
.md-list-subheader { margin: 0; padding: 16px 16px 8px; font: var(--md-sys-typescale-title-small); letter-spacing: var(--md-sys-typescale-title-small-tracking); color: var(--md-sys-color-primary); }
.md-divider { height: 1px; margin: 0; border: 0; background: var(--md-sys-color-outline-variant); }
.md-divider--inset { margin-left: 16px; }

/* Switch — 52×32 track; handle 16 → 24 selected → 28 pressed. <input type="checkbox" role="switch" class="md-switch"> */
input.md-switch {
  appearance: none; position: relative; flex: none; width: 52px; height: 32px; margin: 0; cursor: pointer; border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-surface-container-highest); box-shadow: inset 0 0 0 2px var(--md-sys-color-outline);
  transition: background-color var(--md-sys-motion-duration-short4) linear;
}
input.md-switch::before {
  content: ""; position: absolute; top: 50%; left: 16px; width: 16px; height: 16px; border-radius: 50%; background: var(--md-sys-color-outline);
  transform: translate(-50%, -50%); box-shadow: 0 0 0 0 transparent;
  transition: left var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized), width var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard),
              height var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard), background-color var(--md-sys-motion-duration-short4) linear, box-shadow var(--md-sys-motion-duration-short3) linear;
}
input.md-switch:checked { background: var(--md-sys-color-primary); box-shadow: none; }
input.md-switch:checked::before { left: 36px; width: 24px; height: 24px; background: var(--md-sys-color-on-primary); }
input.md-switch:active::before { width: 28px; height: 28px; }
@media (hover: hover) { input.md-switch:hover::before { box-shadow: 0 0 0 12px color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent); } input.md-switch:checked:hover::before { box-shadow: 0 0 0 8px color-mix(in srgb, var(--md-sys-color-primary) 8%, transparent); } }
input.md-switch:focus-visible { outline: 3px solid var(--md-sys-color-secondary); outline-offset: 2px; }
input.md-switch:disabled { opacity: .38; cursor: not-allowed; }

/* Checkbox 18dp r2 / radio 20dp, 40dp state layer */
input:is(.md-checkbox, .md-radio) {
  appearance: none; position: relative; flex: none; width: 18px; height: 18px; margin: 11px; cursor: pointer;
  border-radius: 2px; box-shadow: inset 0 0 0 2px var(--md-sys-color-on-surface-variant);
  transition: background-color var(--md-sys-motion-duration-short2) linear;
}
input.md-radio { width: 20px; height: 20px; margin: 10px; border-radius: 50%; }
input.md-checkbox:is(:checked, :indeterminate) { background: var(--md-sys-color-primary); box-shadow: none; }
input.md-checkbox:checked::after, input.md-checkbox:indeterminate::after {
  content: ""; position: absolute; inset: 0; background: var(--md-sys-color-on-primary);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M6.8 12.6 3 8.8l1.3-1.3 2.5 2.5 6.9-6.9L15 4.4z'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M6.8 12.6 3 8.8l1.3-1.3 2.5 2.5 6.9-6.9L15 4.4z'/%3E%3C/svg%3E") center/contain no-repeat;
}
input.md-checkbox:indeterminate::after { -webkit-mask: none; mask: none; inset: 8px 4px; }
input.md-radio:checked { box-shadow: inset 0 0 0 2px var(--md-sys-color-primary), inset 0 0 0 5px var(--md-sys-color-surface), inset 0 0 0 10px var(--md-sys-color-primary); }
@media (hover: hover) { input:is(.md-checkbox, .md-radio):hover { outline: 11px solid color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent); outline-offset: 0; } input.md-radio:hover { outline-width: 10px; } }
input:is(.md-checkbox, .md-radio):focus-visible { outline: 3px solid var(--md-sys-color-secondary); outline-offset: 4px; }
input:is(.md-checkbox, .md-radio)[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--md-sys-color-error); }
input:is(.md-checkbox, .md-radio):disabled { opacity: .38; cursor: not-allowed; }

/* Progress — linear 4dp with a 4dp gap and stop indicator (2024 spec); circular 48dp, 4dp track.
   Determinate: style="--md-progress: .4" (0–1) plus role="progressbar" aria-valuenow. Indeterminate: --indeterminate. */
.md-linear-progress { position: relative; height: 4px; border-radius: 2px; overflow: hidden; --md-progress: 0; }
.md-linear-progress::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--md-progress) * 100%); border-radius: 2px; background: var(--md-sys-color-primary); transition: width var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-standard); }
.md-linear-progress::after {
  content: ""; position: absolute; top: 0; bottom: 0; right: 0; left: calc(var(--md-progress) * 100% + 4px); border-radius: 2px;
  background: radial-gradient(circle at calc(100% - 2px) 50%, var(--md-sys-color-primary) 2px, transparent 2.5px), var(--md-sys-color-secondary-container);
}
.md-linear-progress--indeterminate::before { width: 40%; animation: md-lp 1.6s var(--md-sys-motion-easing-standard) infinite; }
.md-linear-progress--indeterminate::after { left: 0; background: var(--md-sys-color-secondary-container); z-index: -1; }
.md-linear-progress--indeterminate { isolation: isolate; }
@keyframes md-lp { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.md-circular-progress {
  width: 48px; height: 48px; border-radius: 50%; --md-progress: 0;
  background: conic-gradient(var(--md-sys-color-primary) calc(var(--md-progress) * 1turn), var(--md-sys-color-secondary-container) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 4px)); mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 4px));
}
.md-circular-progress--indeterminate { background: conic-gradient(var(--md-sys-color-primary) 0 .3turn, transparent .3turn); animation: md-spin 1s linear infinite; }
@keyframes md-spin { to { transform: rotate(1turn); } }

/* Tabs (primary) — 48dp, 3dp indicator; segmented buttons — 40dp outlined pill with check on the selected one */
.md-tabs { display: flex; overflow-x: auto; scrollbar-width: none; background: var(--md-sys-color-surface); box-shadow: inset 0 -1px 0 var(--md-sys-color-surface-variant); }
.md-tab {
  flex: 1 0 auto; min-width: 90px; height: 48px; padding: 0 16px; border: 0; background: none; cursor: pointer; color: var(--md-sys-color-on-surface-variant);
  font: var(--md-sys-typescale-title-small); letter-spacing: var(--md-sys-typescale-title-small-tracking);
}
.md-tab[aria-selected="true"] { color: var(--md-sys-color-primary); }
.md-tab[aria-selected="true"]::after { content: ""; position: absolute; left: 16px; right: 16px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--md-sys-color-primary); }
.md-segmented { display: inline-flex; border-radius: var(--md-sys-shape-corner-full); box-shadow: inset 0 0 0 1px var(--md-sys-color-outline); }
.md-segmented > button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 48px; height: 40px; padding: 0 12px; border: 0; margin: 0;
  background: none; color: var(--md-sys-color-on-surface); cursor: pointer; font: var(--md-sys-typescale-label-large); letter-spacing: var(--md-sys-typescale-label-large-tracking);
}
.md-segmented > button + button { box-shadow: -1px 0 0 var(--md-sys-color-outline); }
.md-segmented > button:first-child { border-radius: var(--md-sys-shape-corner-full) 0 0 var(--md-sys-shape-corner-full); padding-left: 16px; }
.md-segmented > button:last-child { border-radius: 0 var(--md-sys-shape-corner-full) var(--md-sys-shape-corner-full) 0; padding-right: 16px; }
.md-segmented > button:is([aria-pressed="true"], [aria-selected="true"], [aria-checked="true"]) { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.md-segmented > button:is([aria-pressed="true"], [aria-selected="true"], [aria-checked="true"])::after {
  content: ""; order: -1; width: 18px; height: 18px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.55 17.6 4.4 12.45l1.4-1.4 3.75 3.75 8.65-8.65 1.4 1.4z'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.55 17.6 4.4 12.45l1.4-1.4 3.75 3.75 8.65-8.65 1.4 1.4z'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* Badges — small 6dp dot, large 16dp */
.md-badge { display: inline-block; width: 6px; height: 6px; border-radius: 3px; background: var(--md-sys-color-error); }
.md-badge--large {
  width: auto; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; color: var(--md-sys-color-on-error); text-align: center; box-sizing: border-box;
  font: var(--md-sys-typescale-label-small); letter-spacing: var(--md-sys-typescale-label-small-tracking); line-height: 16px;
}

/* ---------- 7. Skin: existing Kolam k- components become M3 inside the Android app ---------- */
/* Type classes */
html.k-android .display-xl { font: var(--md-sys-typescale-display-medium); letter-spacing: 0; }
html.k-android .display-lg { font: var(--md-sys-typescale-display-small); letter-spacing: 0; }
html.k-android .heading-1 { font: var(--md-sys-typescale-headline-medium); letter-spacing: 0; }
html.k-android .heading-2 { font: var(--md-sys-typescale-title-large); }
html.k-android .heading-3 { font: var(--md-sys-typescale-title-medium); letter-spacing: var(--md-sys-typescale-title-medium-tracking); }
html.k-android .body-lg, html.k-android .body { font: var(--md-sys-typescale-body-large); letter-spacing: var(--md-sys-typescale-body-large-tracking); }
html.k-android .body-sm { font: var(--md-sys-typescale-body-medium); letter-spacing: var(--md-sys-typescale-body-medium-tracking); }
html.k-android .label { font: var(--md-sys-typescale-label-large); letter-spacing: var(--md-sys-typescale-label-large-tracking); }
html.k-android .caption { font: var(--md-sys-typescale-label-medium); letter-spacing: var(--md-sys-typescale-label-medium-tracking); }

/* State layers on Kolam hosts */
html.k-android :is(.k-btn, .k-tab, a.k-list-item, button.k-list-item, a.k-card) { position: relative; }
html.k-android :is(.k-btn, .k-tab, a.k-list-item, button.k-list-item, a.k-card, .k-iconbtn)::before,
html.k-android .k-bottomnav a .k-pip::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: 0; pointer-events: none;
  transition: opacity var(--md-sys-motion-duration-short3) linear;
}
html.k-android .k-iconbtn::before { inset: 4px; border-radius: 50%; }
@media (hover: hover) {
  html.k-android :is(.k-btn, .k-tab, a.k-list-item, button.k-list-item, a.k-card, .k-iconbtn):hover::before,
  html.k-android .k-bottomnav a:hover .k-pip::before { opacity: var(--md-sys-state-hover-state-layer-opacity); }
}
html.k-android :is(.k-btn, .k-tab, a.k-list-item, button.k-list-item, a.k-card, .k-iconbtn):focus-visible::before { opacity: var(--md-sys-state-focus-state-layer-opacity); }
html.k-android:not(.k-ripple) :is(.k-btn, .k-tab, a.k-list-item, button.k-list-item, a.k-card, .k-iconbtn):active::before { opacity: var(--md-sys-state-pressed-state-layer-opacity); }

/* Buttons → M3 common buttons (primary = filled, secondary = tonal, outline = outlined, ghost = text) */
html.k-android .k-btn {
  min-height: 40px; height: 40px; padding: 0 24px; border: 0; border-radius: var(--md-sys-shape-corner-full);
  font: var(--md-sys-typescale-label-large); letter-spacing: var(--md-sys-typescale-label-large-tracking); transition: box-shadow var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}
html.k-android .k-btn::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 48px; transform: translateY(-50%); }
html.k-android .k-btn > .k-icon, html.k-android .k-btn > .md-icon { width: 18px; height: 18px; font-size: 18px; margin-left: -8px; }
html.k-android .k-btn-primary, html.k-android .k-btn-primary:hover { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
html.k-android .k-btn-secondary, html.k-android .k-btn-secondary:hover { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
html.k-android .k-btn-secondary-solid, html.k-android .k-btn-secondary-solid:hover { background: var(--md-sys-color-secondary); color: var(--md-sys-color-on-secondary); }
html.k-android .k-btn-accent, html.k-android .k-btn-accent:hover { background: var(--md-sys-color-tertiary); color: var(--md-sys-color-on-tertiary); }
html.k-android .k-btn-outline, html.k-android .k-btn-outline:hover { background: transparent; color: var(--md-sys-color-primary); box-shadow: inset 0 0 0 1px var(--md-sys-color-outline); }
html.k-android .k-btn-ghost, html.k-android .k-btn-ghost:hover { background: transparent; color: var(--md-sys-color-primary); padding: 0 12px; }
html.k-android .k-btn-danger, html.k-android .k-btn-danger:hover { background: var(--md-sys-color-error); color: var(--md-sys-color-on-error); }
@media (hover: hover) { html.k-android :is(.k-btn-primary, .k-btn-secondary, .k-btn-secondary-solid, .k-btn-accent, .k-btn-danger):hover { box-shadow: var(--md-sys-elevation-level1); } }
html.k-android .k-btn-sm { min-height: 32px; height: 32px; padding: 0 12px; border-radius: var(--md-sys-shape-corner-full); }
html.k-android .k-btn-lg { min-height: 56px; height: 56px; padding: 0 24px; border-radius: var(--md-sys-shape-corner-large); font: var(--md-sys-typescale-title-medium); }
html.k-android .k-btn[disabled], html.k-android .k-btn[aria-disabled="true"] {
  background: color-mix(in srgb, var(--md-sys-color-on-surface) 12%, transparent); color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent); box-shadow: none;
}
html.k-android :is(.k-btn-ghost, .k-btn-outline)[disabled] { background: transparent; }

/* Icon buttons */
html.k-android .k-iconbtn { position: relative; width: 48px; height: 48px; padding: 4px; background: transparent; background-clip: content-box; color: var(--md-sys-color-on-surface-variant); }
html.k-android .k-iconbtn:hover { background-color: transparent; color: var(--md-sys-color-on-surface-variant); }
html.k-android .k-iconbtn-filled, html.k-android .k-iconbtn-filled:hover { background-color: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
html.k-android .k-iconbtn-send, html.k-android .k-iconbtn-send:hover { background-color: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
html.k-android .k-iconbtn-send[disabled] { background-color: color-mix(in srgb, var(--md-sys-color-on-surface) 12%, transparent); color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent); }

/* Text fields → M3 outlined text field (label stays above; no markup change) */
html.k-android .k-label { font: var(--md-sys-typescale-body-small); letter-spacing: var(--md-sys-typescale-body-small-tracking); color: var(--md-sys-color-on-surface-variant); padding-left: 16px; }
html.k-android .k-field:focus-within .k-label { color: var(--md-sys-color-primary); }
html.k-android .k-field { gap: 4px; }
html.k-android .k-help, html.k-android .k-error { font: var(--md-sys-typescale-body-small); letter-spacing: var(--md-sys-typescale-body-small-tracking); padding-left: 16px; }
html.k-android .k-error { color: var(--md-sys-color-error); }
html.k-android :is(.k-input, .k-select) {
  min-height: 56px; border: 0; border-radius: var(--md-sys-shape-corner-extra-small); background-color: transparent; color: var(--md-sys-color-on-surface);
  box-shadow: inset 0 0 0 1px var(--md-sys-color-outline); caret-color: var(--md-sys-color-primary);
  font: var(--md-sys-typescale-body-large); letter-spacing: var(--md-sys-typescale-body-large-tracking);
}
html.k-android textarea.k-input { padding-top: 16px; padding-bottom: 16px; }
html.k-android :is(.k-input, .k-select):hover { box-shadow: inset 0 0 0 1px var(--md-sys-color-on-surface); }
html.k-android :is(.k-input, .k-select):is(:focus, :focus-visible) { outline: none; box-shadow: inset 0 0 0 2px var(--md-sys-color-primary); }
html.k-android .k-input[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--md-sys-color-error); border: 0; }
html.k-android :is(.k-input, .k-select):disabled { background-color: transparent; color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--md-sys-color-on-surface) 12%, transparent); }
html.k-android .k-input-group > .k-icon { color: var(--md-sys-color-on-surface-variant); }

/* Checkbox / radio → 18dp / 20dp M3 controls */
html.k-android .k-check { gap: 16px; align-items: center; }
html.k-android .k-check-box { width: 18px; height: 18px; margin: 3px; border-radius: 2px; border-color: var(--md-sys-color-on-surface-variant); background: transparent; color: var(--md-sys-color-on-primary); }
html.k-android .k-check-box svg { width: 14px; height: 14px; stroke-width: 3.2; }
html.k-android .k-check input[type="radio"] + .k-check-box { width: 20px; height: 20px; margin: 2px; }
html.k-android .k-check input:checked + .k-check-box { background: var(--md-sys-color-primary); border-color: var(--md-sys-color-primary); }
html.k-android .k-check input[type="radio"]:checked + .k-check-box { background: transparent; border-color: var(--md-sys-color-primary); box-shadow: inset 0 0 0 3px var(--md-sys-color-surface), inset 0 0 0 8px var(--md-sys-color-primary); }
html.k-android .k-check input:focus-visible + .k-check-box { outline: 3px solid var(--md-sys-color-secondary); outline-offset: 6px; }
html.k-android .k-check-text small { font: var(--md-sys-typescale-body-medium); color: var(--md-sys-color-on-surface-variant); }

/* Switch → 52×32 M3 switch */
html.k-android .k-switch-track { width: 52px; height: 32px; border: 0; background: var(--md-sys-color-surface-container-highest); box-shadow: inset 0 0 0 2px var(--md-sys-color-outline); }
html.k-android .k-switch-track::after { top: 8px; left: 8px; width: 16px; height: 16px; background: var(--md-sys-color-outline);
  transition: transform var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized), width var(--md-sys-motion-duration-short4), height var(--md-sys-motion-duration-short4), top var(--md-sys-motion-duration-short4), left var(--md-sys-motion-duration-short4), background-color var(--md-sys-motion-duration-short4); }
html.k-android .k-switch input:checked + .k-switch-track { background: var(--md-sys-color-primary); box-shadow: none; }
html.k-android .k-switch input:checked + .k-switch-track::after { top: 4px; left: 4px; width: 24px; height: 24px; transform: translateX(20px); background: var(--md-sys-color-on-primary); }
html.k-android .k-switch:active .k-switch-track::after { top: 2px; left: 2px; width: 28px; height: 28px; }
html.k-android .k-switch:active input:not(:checked) + .k-switch-track::after { left: 2px; }
html.k-android .k-switch input:focus-visible + .k-switch-track { outline: 3px solid var(--md-sys-color-secondary); outline-offset: 2px; }

/* Badges → M3-style labels; count → large badge */
html.k-android .k-badge { border-radius: var(--md-sys-shape-corner-small); padding: 4px 8px; font: var(--md-sys-typescale-label-medium); letter-spacing: var(--md-sys-typescale-label-medium-tracking); }
html.k-android .k-badge:not([class*="k-badge-"]) { background: var(--md-sys-color-surface-container-highest); color: var(--md-sys-color-on-surface-variant); }
html.k-android .k-badge-primary { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
html.k-android .k-badge-secondary { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
html.k-android .k-badge-accent { background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container); }
html.k-android .k-badge-danger { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }
html.k-android .k-badge-pill { border-radius: var(--md-sys-shape-corner-full); }
html.k-android .k-count { min-width: 16px; height: 16px; padding: 0 4px; background: var(--md-sys-color-error); color: var(--md-sys-color-on-error); font: var(--md-sys-typescale-label-small); line-height: 16px; }

/* Alerts → tonal containers, 12dp corners */
html.k-android .k-alert { border-radius: var(--md-sys-shape-corner-medium); border: 0; }
html.k-android .k-alert:not([class*="k-alert-"]) { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
html.k-android .k-alert:not([class*="k-alert-"]) > .k-icon { color: var(--md-sys-color-on-secondary-container); }
html.k-android .k-alert-danger { background: var(--md-sys-color-error-container); }
html.k-android .k-alert-danger, html.k-android .k-alert-danger .k-alert-body { color: var(--md-sys-color-on-error-container); }
html.k-android .k-alert-danger > .k-icon { color: var(--md-sys-color-error); }
html.k-android .k-alert-title { font: var(--md-sys-typescale-title-small); letter-spacing: var(--md-sys-typescale-title-small-tracking); }
html.k-android .k-alert-body { font: var(--md-sys-typescale-body-medium); letter-spacing: var(--md-sys-typescale-body-medium-tracking); color: inherit; }

/* Cards → M3 elevated card; featured → filled tertiary container */
html.k-android .k-card { border: 0; border-radius: var(--md-sys-shape-corner-medium); background: var(--md-sys-color-surface-container-low); box-shadow: var(--md-sys-elevation-level1); color: var(--md-sys-color-on-surface); }
html.k-android .k-card-media { border-radius: var(--md-sys-shape-corner-medium) var(--md-sys-shape-corner-medium) 0 0; background: var(--md-sys-color-surface-container-highest); }
html.k-android .k-card-title { font: var(--md-sys-typescale-title-medium); letter-spacing: var(--md-sys-typescale-title-medium-tracking); }
html.k-android .k-card-meta { font: var(--md-sys-typescale-body-medium); letter-spacing: var(--md-sys-typescale-body-medium-tracking); color: var(--md-sys-color-on-surface-variant); }
html.k-android .k-card-featured { background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container); box-shadow: none; }
html.k-android .k-card-featured .k-card-meta { color: var(--md-sys-color-on-tertiary-container); }
html.k-android a.k-card:hover { border: 0; }
html.k-android .k-stat-value { font: var(--md-sys-typescale-display-small); letter-spacing: 0; }
html.k-android .k-stat-label { font: var(--md-sys-typescale-label-large); color: var(--md-sys-color-on-surface-variant); }

/* Lists → M3 lists: flush, no card border, 56 / 72dp items */
html.k-android .k-list { border: 0; border-radius: 0; background: transparent; padding: 8px 0; }
html.k-android .k-list-item { min-height: 56px; padding: 8px 24px 8px 16px; gap: 16px; }
html.k-android .k-list-item + .k-list-item { border-top: 0; }
html.k-android .k-list-item:has(small) { min-height: 72px; }
html.k-android .k-list-item > .k-icon { color: var(--md-sys-color-on-surface-variant); }
html.k-android .k-list-text { font: var(--md-sys-typescale-body-large); letter-spacing: var(--md-sys-typescale-body-large-tracking); }
html.k-android .k-list-text small { font: var(--md-sys-typescale-body-medium); letter-spacing: var(--md-sys-typescale-body-medium-tracking); color: var(--md-sys-color-on-surface-variant); }
html.k-android :is(a, button).k-list-item:hover { background: transparent; }

/* Tabs (Kolam segmented) → M3 segmented buttons */
html.k-android .k-tabs { gap: 0; padding: 0; border: 0; border-radius: var(--md-sys-shape-corner-full); background: transparent; box-shadow: inset 0 0 0 1px var(--md-sys-color-outline); }
html.k-android .k-tab { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; height: 40px; padding: 0 12px; border-radius: 0; color: var(--md-sys-color-on-surface); font: var(--md-sys-typescale-label-large); letter-spacing: var(--md-sys-typescale-label-large-tracking); }
html.k-android .k-tab + .k-tab { box-shadow: -1px 0 0 var(--md-sys-color-outline); }
html.k-android .k-tab:first-child { border-radius: var(--md-sys-shape-corner-full) 0 0 var(--md-sys-shape-corner-full); padding-left: 16px; }
html.k-android .k-tab:last-child { border-radius: 0 var(--md-sys-shape-corner-full) var(--md-sys-shape-corner-full) 0; padding-right: 16px; }
html.k-android .k-tab[aria-selected="true"] { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
html.k-android .k-tab[aria-selected="true"] + .k-tab, html.k-android .k-tab + .k-tab[aria-selected="true"] { box-shadow: -1px 0 0 var(--md-sys-color-outline); }
html.k-android .k-tab[aria-selected="true"]::after {
  content: ""; order: -1; width: 18px; height: 18px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.55 17.6 4.4 12.45l1.4-1.4 3.75 3.75 8.65-8.65 1.4 1.4z'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.55 17.6 4.4 12.45l1.4-1.4 3.75 3.75 8.65-8.65 1.4 1.4z'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* Bottom nav → M3 navigation bar */
html.k-android .k-bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; gap: 8px; border: 0; height: calc(80px + var(--md-inset-bottom));
  padding: 12px 8px calc(16px + var(--md-inset-bottom)); background: var(--md-sys-color-surface-container);
}
html.k-android .k-bottomnav a { min-height: 0; padding: 0; gap: 4px; align-content: start; border-radius: 0; color: var(--md-sys-color-on-surface-variant); font: var(--md-sys-typescale-label-medium); letter-spacing: var(--md-sys-typescale-label-medium-tracking); }
html.k-android .k-bottomnav a .k-pip { position: relative; width: 64px; height: 32px; border-radius: var(--md-sys-shape-corner-full); }
html.k-android .k-bottomnav .k-icon { width: 24px; height: 24px; }
html.k-android .k-bottomnav a[aria-current="page"] { color: var(--md-sys-color-on-surface); }
html.k-android .k-bottomnav a[aria-current="page"] .k-pip { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
html.k-android .k-bottomnav a:focus-visible { outline: none; }
html.k-android .k-bottomnav a:focus-visible .k-pip { outline: 3px solid var(--md-sys-color-secondary); outline-offset: 2px; }
html.k-android body:has(> .k-bottomnav, > * > .k-bottomnav) { padding-bottom: calc(80px + var(--md-inset-bottom)); }

/* Progress → 4dp linear indicator */
html.k-android .k-progress-head { font: var(--md-sys-typescale-body-medium); }
html.k-android .k-progress-track { height: 4px; background: var(--md-sys-color-secondary-container); box-shadow: none; }
html.k-android .k-progress-fill { background: var(--md-sys-color-primary); }

/* Toast → snackbar */
html.k-android .k-toast {
  min-height: 48px; padding: 4px 8px 4px 16px; border-radius: var(--md-sys-shape-corner-extra-small); background: var(--md-sys-color-inverse-surface); color: var(--md-sys-color-inverse-on-surface);
  box-shadow: var(--md-sys-elevation-level3); font: var(--md-sys-typescale-body-medium); letter-spacing: var(--md-sys-typescale-body-medium-tracking);
}
html.k-android .k-toast > .k-icon { color: var(--md-sys-color-inverse-on-surface); }
html.k-android .k-toast .k-btn-ghost { color: var(--md-sys-color-inverse-primary); text-decoration: none; min-height: 40px; height: 40px; padding: 0 12px; }
html.k-android .k-toast :focus-visible { outline-color: var(--md-sys-color-inverse-primary); }

/* Dialog → M3 basic dialog; actions become text buttons */
html.k-android .k-dialog { min-width: 280px; max-width: min(560px, calc(100vw - 48px)); border: 0; border-radius: var(--md-sys-shape-corner-extra-large); background: var(--md-sys-color-surface-container-high); box-shadow: var(--md-sys-elevation-level3); color: var(--md-sys-color-on-surface-variant); }
html.k-android .k-dialog[open] { animation: md-dialog-in var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized-decelerate); }
html.k-android .k-dialog::backdrop { background: color-mix(in srgb, var(--md-sys-color-scrim) 32%, transparent); }
html.k-android .k-dialog-title { font: var(--md-sys-typescale-headline-small); color: var(--md-sys-color-on-surface); margin-bottom: 16px; }
html.k-android .k-dialog-body { font: var(--md-sys-typescale-body-medium); letter-spacing: var(--md-sys-typescale-body-medium-tracking); color: var(--md-sys-color-on-surface-variant); margin-bottom: 24px; }
html.k-android .k-dialog-actions .k-btn { background: transparent; color: var(--md-sys-color-primary); box-shadow: none; padding: 0 12px; }
html.k-android .k-dialog-actions .k-btn-danger { color: var(--md-sys-color-error); }

/* Avatar */
html.k-android .k-avatar { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); font: var(--md-sys-typescale-title-medium); }
html.k-android .k-avatar-accent { background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container); }

/* ChatThread */
html.k-android .k-chat { border: 0; border-radius: var(--md-sys-shape-corner-large); background: var(--md-sys-color-surface-container-low); }
html.k-android .k-msg-body { border-radius: var(--md-sys-shape-corner-large-increased); }
html.k-android .k-msg-user .k-msg-body { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); border-bottom-right-radius: var(--md-sys-shape-corner-extra-small); }
html.k-android .k-msg-ai .k-msg-body { background: var(--md-sys-color-surface-container-highest); border-bottom-left-radius: var(--md-sys-shape-corner-extra-small); }
html.k-android .k-composer { margin: 8px; padding: 4px 4px 4px 16px; border: 0; border-radius: var(--md-sys-shape-corner-extra-large); background: var(--md-sys-color-surface-container-high); }
html.k-android .k-composer:focus-within { outline: 3px solid var(--md-sys-color-secondary); outline-offset: 0; }
html.k-android .k-ai-note { background: transparent; }

/* Reduced motion: no ripples, no slides */
@media (prefers-reduced-motion: reduce) {
  html.k-android *, html.k-android *::before, html.k-android *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
  .md-ripple { display: none; }
}
