/* Colours. Light is the default; theme.js sets data-theme="dark" on <html> before the page is drawn when
   the person chose Dark, or chose System on a device in dark mode. Every colour in the app comes from
   these tokens, so pages, forms, tables, menus, pop-ups and the chart all switch together.
   Text colours keep at least 4.5:1 contrast on their backgrounds in both modes. */
:root {
  --page: #f6f6f3;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --border: #e1e0d9;
  --border-strong: #b9b8ad;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-3: #686661;
  --accent: #1f66bd;          /* links, active menu item */
  --accent-bg: #1f66bd;       /* filled (primary) buttons */
  --accent-bg-hover: #1a579f;
  --accent-ink: #ffffff;
  --accent-soft: #e6f0fc;
  --focus: #1f66bd;           /* keyboard focus ring */
  --series-1: #2a78d6;
  --series-2: #eb6834;         /* second chart series (owner's gross profit line) */
  --grid: #e1e0d9;
  --good: #006300;
  --good-bg: #e3f4e3;
  --warn: #7a5200;
  --warn-bg: #fdf1d6;
  --info: #1c5cab;
  --info-bg: #e6f0fc;
  --bad: #a52828;
  --bad-bg: #fbe6e6;
  --muted-bg: #ecebe6;
  --sample: #5a48cc;
  --sample-bg: #eeebfc;
  --disabled-bg: #ecebe6;
  --disabled-ink: #67655f;
  --overlay: rgba(10, 10, 10, .45);
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.05);
  --shadow-pop: 0 20px 60px rgba(0,0,0,.25);
  --radius: 10px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #242422;
  --border: #31312e;
  --border-strong: #55554f;
  --ink: #f0efec;
  --ink-2: #c9c8be;
  --ink-3: #a3a198;
  --accent: #7db1f2;
  --accent-bg: #2f6fc4;
  --accent-bg-hover: #3a7cd3;
  --accent-ink: #ffffff;
  --accent-soft: #172a42;
  --focus: #8dbcf5;
  --series-1: #3987e5;
  --series-2: #d95926;
  --grid: #2c2c2a;
  --good: #6fd46f;
  --good-bg: #143214;
  --warn: #f3c45a;
  --warn-bg: #3a2c0b;
  --info: #8fbcf2;
  --info-bg: #15263b;
  --bad: #f49a9a;
  --bad-bg: #3d1818;
  --muted-bg: #2c2c2a;
  --sample: #bab2f5;
  --sample-bg: #27224b;
  --disabled-bg: #262624;
  --disabled-ink: #9a988f;
  --overlay: rgba(0, 0, 0, .65);
  --shadow: 0 1px 2px rgba(0,0,0,.45);
  --shadow-pop: 0 20px 60px rgba(0,0,0,.6);
  color-scheme: dark;
}
/* @@colour-themes@@ (generated by packaging/make_themes.py - change the palettes there, then run it) */
[data-palette="sapphire"], :root:not([data-palette]) {
  --page: #f5f9fd;
  --page-low: #f1f5f9;
  --surface: #fcfdff;
  --surface-2: #ecf2f9;
  --surface-hover: #e5ebf3;
  --surface-active: #dde4ed;
  --border: #d7dde5;
  --border-strong: #747b83;
  --ink: #0f151d;
  --ink-2: #373e46;
  --ink-3: #525961;
  --accent: #0f4cd3;
  --accent-bg: #2563EB;
  --accent-bg-hover: #1754db;
  --accent-bg-active: #0745cc;
  --accent-ink: #ffffff;
  --accent-soft: #e6eefe;
  --accent-soft-hover: #dae7fe;
  --focus: #2563eb;
  --series-1: #285cc2;
  --series-2: #c87f04;
  --series-3: #7444b4;
  --series-4: #a88d08;
  --grid: #d7dde5;
  --muted-bg: #ecf2f9;
  --disabled-bg: #ecf2f9;
  --disabled-ink: #676d73;
  --glass-rgb: 252 253 255;
  --tint-1-rgb: 37 99 235;
  --tint-2-rgb: 6 141 182;
  --tint-1-a: 0.12;
  --tint-2-a: 0.1;
  --tint-3-a: 0.07;
  --theme-meta: #fcfdff;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23373e46' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
[data-theme="dark"][data-palette="sapphire"], [data-theme="dark"] [data-palette="sapphire"], :root:not([data-palette])[data-theme="dark"] {
  --page: #081225;
  --page-low: #02081b;
  --surface: #1a1f2a;
  --surface-2: #232934;
  --surface-hover: #2a313c;
  --surface-active: #313845;
  --border: #292f3a;
  --border-strong: #838b99;
  --ink: #ffffff;
  --ink-2: #d0d5db;
  --ink-3: #a9aeb5;
  --accent: #9cbeff;
  --accent-bg: #2b6af2;
  --accent-bg-hover: #1d5be2;
  --accent-bg-active: #0f4cd3;
  --accent-ink: #ffffff;
  --accent-soft: #182b52;
  --accent-soft-hover: #1c325f;
  --focus: #9cbeff;
  --series-1: #396ed6;
  --series-2: #cc8305;
  --series-3: #8557c8;
  --series-4: #a58a07;
  --grid: #292f3a;
  --muted-bg: #232934;
  --disabled-bg: #232934;
  --disabled-ink: #91949a;
  --glass-rgb: 28 34 44;
  --tint-1-rgb: 38 100 236;
  --tint-2-rgb: 6 125 162;
  --tint-1-a: 0.16;
  --tint-2-a: 0.12;
  --tint-3-a: 0.08;
  --theme-meta: #081225;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23d0d5db' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
[data-palette="jade"] {
  --page: #fbf9f2;
  --page-low: #f7f5ee;
  --surface: #fbfefd;
  --surface-2: #ebf3ef;
  --surface-hover: #e4ede9;
  --surface-active: #dce6e1;
  --border: #d6dfda;
  --border-strong: #747d78;
  --ink: #0f1714;
  --ink-2: #37403b;
  --ink-3: #525b56;
  --accent: #03635c;
  --accent-bg: #0F766E;
  --accent-bg-hover: #066861;
  --accent-bg-active: #055a53;
  --accent-ink: #ffffff;
  --accent-soft: #e1f2f0;
  --accent-soft-hover: #d5ece9;
  --focus: #0f766e;
  --series-1: #05a292;
  --series-2: #a24102;
  --series-3: #145ec1;
  --series-4: #8a5601;
  --grid: #d6dfda;
  --muted-bg: #ebf3ef;
  --disabled-bg: #ebf3ef;
  --disabled-ink: #666e6b;
  --glass-rgb: 251 254 253;
  --tint-1-rgb: 15 118 110;
  --tint-2-rgb: 89 143 101;
  --tint-1-a: 0.12;
  --tint-2-a: 0.1;
  --tint-3-a: 0.07;
  --theme-meta: #fbfefd;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2337403b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
[data-theme="dark"][data-palette="jade"], [data-theme="dark"] [data-palette="jade"] {
  --page: #041810;
  --page-low: #000e07;
  --surface: #19231e;
  --surface-2: #222d28;
  --surface-hover: #29352f;
  --surface-active: #303d37;
  --border: #28332e;
  --border-strong: #83908a;
  --ink: #ffffff;
  --ink-2: #e7edea;
  --ink-3: #bbc3bf;
  --accent: #8dccc4;
  --accent-bg: #7fcfc6;
  --accent-bg-hover: #8cdcd3;
  --accent-bg-active: #72c2b9;
  --accent-ink: #02140c;
  --accent-soft: #143431;
  --accent-soft-hover: #173d39;
  --focus: #8dccc4;
  --series-1: #05a291;
  --series-2: #cf5604;
  --series-3: #2a71d6;
  --series-4: #a06604;
  --grid: #28332e;
  --muted-bg: #222d28;
  --disabled-bg: #222d28;
  --disabled-ink: #909694;
  --glass-rgb: 27 38 33;
  --tint-1-rgb: 35 130 121;
  --tint-2-rgb: 74 128 86;
  --tint-1-a: 0.16;
  --tint-2-a: 0.12;
  --tint-3-a: 0.08;
  --theme-meta: #041810;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23e7edea' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
[data-palette="amethyst"] {
  --page: #f9f7fe;
  --page-low: #f5f3fa;
  --surface: #fefdff;
  --surface-2: #f3eff8;
  --surface-hover: #ece8f2;
  --surface-active: #e5e1eb;
  --border: #dedae4;
  --border-strong: #7c7881;
  --ink: #14101a;
  --ink-2: #3c3842;
  --ink-3: #57535d;
  --accent: #6c1fd8;
  --accent-bg: #7C3AED;
  --accent-bg-hover: #7026dd;
  --accent-bg-active: #6408cd;
  --accent-ink: #ffffff;
  --accent-soft: #eeebff;
  --accent-soft-hover: #e7e2ff;
  --focus: #7c3aed;
  --series-1: #8c6de2;
  --series-2: #8a5601;
  --series-3: #089bc3;
  --series-4: #a24102;
  --grid: #dedae4;
  --muted-bg: #f3eff8;
  --disabled-bg: #f3eff8;
  --disabled-ink: #6d6971;
  --glass-rgb: 254 253 255;
  --tint-1-rgb: 124 58 237;
  --tint-2-rgb: 174 94 168;
  --tint-1-a: 0.12;
  --tint-2-a: 0.1;
  --tint-3-a: 0.07;
  --theme-meta: #fefdff;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%233c3842' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
[data-theme="dark"][data-palette="amethyst"], [data-theme="dark"] [data-palette="amethyst"] {
  --page: #190f1c;
  --page-low: #0f0613;
  --surface: #241e26;
  --surface-2: #2e282f;
  --surface-hover: #352f37;
  --surface-active: #3d363f;
  --border: #342e36;
  --border-strong: #8d8790;
  --ink: #ffffff;
  --ink-2: #d2cfd6;
  --ink-3: #aca9b1;
  --accent: #c0b0fe;
  --accent-bg: #8a4dff;
  --accent-bg-hover: #7d3cef;
  --accent-bg-active: #7129df;
  --accent-ink: #ffffff;
  --accent-soft: #302550;
  --accent-soft-hover: #382b5c;
  --focus: #c0b0fe;
  --series-1: #7b5bcd;
  --series-2: #cc8305;
  --series-3: #0081a3;
  --series-4: #cf5604;
  --grid: #342e36;
  --muted-bg: #2e282f;
  --disabled-bg: #2e282f;
  --disabled-ink: #969497;
  --glass-rgb: 38 32 40;
  --tint-1-rgb: 126 61 240;
  --tint-2-rgb: 158 79 152;
  --tint-1-a: 0.16;
  --tint-2-a: 0.12;
  --tint-3-a: 0.08;
  --theme-meta: #190f1c;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23d2cfd6' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
[data-palette="copper"] {
  --page: #fdf7ee;
  --page-low: #f9f3ea;
  --surface: #fefdfc;
  --surface-2: #f7f0ea;
  --surface-hover: #f0e9e2;
  --surface-active: #e9e1da;
  --border: #e2dbd4;
  --border-strong: #807972;
  --ink: #18110a;
  --ink-2: #433c35;
  --ink-3: #5b544d;
  --accent: #9e3103;
  --accent-bg: #C2410C;
  --accent-bg-hover: #af3702;
  --accent-bg-active: #9a2f01;
  --accent-ink: #ffffff;
  --accent-soft: #ffe8e1;
  --accent-soft-hover: #feded4;
  --focus: #c2410c;
  --series-1: #d75a21;
  --series-2: #145ec1;
  --series-3: #a88d08;
  --series-4: #7444b4;
  --grid: #e2dbd4;
  --muted-bg: #f7f0ea;
  --disabled-bg: #f7f0ea;
  --disabled-ink: #706963;
  --glass-rgb: 254 253 252;
  --tint-1-rgb: 194 65 12;
  --tint-2-rgb: 168 117 4;
  --tint-1-a: 0.12;
  --tint-2-a: 0.1;
  --tint-3-a: 0.07;
  --theme-meta: #fefdfc;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23433c35' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
[data-theme="dark"][data-palette="copper"], [data-theme="dark"] [data-palette="copper"] {
  --page: #1d120b;
  --page-low: #130803;
  --surface: #26201c;
  --surface-2: #302a26;
  --surface-hover: #38312d;
  --surface-active: #403934;
  --border: #37302c;
  --border-strong: #918983;
  --ink: #ffffff;
  --ink-2: #d9d3cf;
  --ink-3: #b3aca7;
  --accent: #fea386;
  --accent-bg: #cc4b1b;
  --accent-bg-hover: #bc3c01;
  --accent-bg-active: #a83400;
  --accent-ink: #ffffff;
  --accent-soft: #4e1f10;
  --accent-soft-hover: #5a2412;
  --focus: #fea386;
  --series-1: #c14802;
  --series-2: #2a71d6;
  --series-3: #a58a07;
  --series-4: #8557c8;
  --grid: #37302c;
  --muted-bg: #302a26;
  --disabled-bg: #302a26;
  --disabled-ink: #989492;
  --glass-rgb: 41 35 31;
  --tint-1-rgb: 194 65 12;
  --tint-2-rgb: 150 104 2;
  --tint-1-a: 0.16;
  --tint-2-a: 0.12;
  --tint-3-a: 0.08;
  --theme-meta: #1d120b;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23d9d3cf' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
[data-palette="rosewood"] {
  --page: #fef7f7;
  --page-low: #faf3f3;
  --surface: #fefdfe;
  --surface-2: #f7eef2;
  --surface-hover: #f1e7eb;
  --surface-active: #eadfe4;
  --border: #e3d9dd;
  --border-strong: #7e7478;
  --ink: #10070c;
  --ink-2: #3e3539;
  --ink-3: #594f53;
  --accent: #a5004d;
  --accent-bg: #BE185D;
  --accent-bg-hover: #ac0051;
  --accent-bg-active: #970046;
  --accent-ink: #ffffff;
  --accent-soft: #fee7ec;
  --accent-soft-hover: #fedce3;
  --focus: #be185d;
  --series-1: #a82a66;
  --series-2: #089bc3;
  --series-3: #a24102;
  --series-4: #2a71d6;
  --grid: #e3d9dd;
  --muted-bg: #f7eef2;
  --disabled-bg: #f7eef2;
  --disabled-ink: #72696d;
  --glass-rgb: 254 253 254;
  --tint-1-rgb: 190 24 93;
  --tint-2-rgb: 198 88 93;
  --tint-1-a: 0.12;
  --tint-2-a: 0.1;
  --tint-3-a: 0.07;
  --theme-meta: #fefdfe;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%233e3539' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
[data-theme="dark"][data-palette="rosewood"], [data-theme="dark"] [data-palette="rosewood"] {
  --page: #210c11;
  --page-low: #170407;
  --surface: #291d1f;
  --surface-2: #332628;
  --surface-hover: #3b2e30;
  --surface-active: #443537;
  --border: #3a2c2e;
  --border-strong: #958487;
  --ink: #ffffff;
  --ink-2: #d5ced1;
  --ink-3: #b0a8ab;
  --accent: #fe9cb5;
  --accent-bg: #d3336e;
  --accent-bg-hover: #c32061;
  --accent-bg-active: #b20455;
  --accent-ink: #ffffff;
  --accent-soft: #4b1b29;
  --accent-soft-hover: #571f30;
  --focus: #fe9cb5;
  --series-1: #bc3e78;
  --series-2: #07a4cf;
  --series-3: #bd4d00;
  --series-4: #2a71d6;
  --grid: #3a2c2e;
  --muted-bg: #332628;
  --disabled-bg: #332628;
  --disabled-ink: #999294;
  --glass-rgb: 43 31 33;
  --tint-1-rgb: 199 37 100;
  --tint-2-rgb: 181 73 78;
  --tint-1-a: 0.16;
  --tint-2-a: 0.12;
  --tint-3-a: 0.08;
  --theme-meta: #210c11;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23d5ced1' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
[data-palette="graphite"] {
  --page: #f8f9fb;
  --page-low: #f4f5f7;
  --surface: #fdfdfe;
  --surface-2: #eef1f7;
  --surface-hover: #e7ebf0;
  --surface-active: #dfe3e9;
  --border: #d8dde2;
  --border-strong: #767a80;
  --ink: #0b0f14;
  --ink-2: #363b41;
  --ink-3: #51565b;
  --accent: #475569;
  --accent-bg: #475569;
  --accent-bg-hover: #3b495c;
  --accent-bg-active: #2f3d50;
  --accent-ink: #ffffff;
  --accent-soft: #eaeef3;
  --accent-soft-hover: #e2e7ed;
  --focus: #475569;
  --series-1: #3763a4;
  --series-2: #e66c2b;
  --series-3: #7444b4;
  --series-4: #c87f04;
  --grid: #d8dde2;
  --muted-bg: #eef1f7;
  --disabled-bg: #eef1f7;
  --disabled-ink: #686c71;
  --glass-rgb: 253 253 254;
  --tint-1-rgb: 71 85 105;
  --tint-2-rgb: 108 132 149;
  --tint-1-a: 0.12;
  --tint-2-a: 0.1;
  --tint-3-a: 0.07;
  --theme-meta: #fdfdfe;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23363b41' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
[data-theme="dark"][data-palette="graphite"], [data-theme="dark"] [data-palette="graphite"] {
  --page: #141619;
  --page-low: #0a0c0f;
  --surface: #222324;
  --surface-2: #2b2d2e;
  --surface-hover: #333436;
  --surface-active: #3a3c3e;
  --border: #323334;
  --border-strong: #8e8f91;
  --ink: #ffffff;
  --ink-2: #e9ecf0;
  --ink-3: #bdc1c6;
  --accent: #b6c2d3;
  --accent-bg: #a9c0e0;
  --accent-bg-hover: #b6cded;
  --accent-bg-active: #9db3d3;
  --accent-ink: #101214;
  --accent-soft: #2b3139;
  --accent-soft-hover: #323842;
  --focus: #b6c2d3;
  --series-1: #4875b7;
  --series-2: #e76c2b;
  --series-3: #8557c8;
  --series-4: #cc8305;
  --grid: #323334;
  --muted-bg: #2b2d2e;
  --disabled-bg: #2b2d2e;
  --disabled-ink: #959696;
  --glass-rgb: 36 37 39;
  --tint-1-rgb: 100 115 136;
  --tint-2-rgb: 94 117 134;
  --tint-1-a: 0.16;
  --tint-2-a: 0.12;
  --tint-3-a: 0.08;
  --theme-meta: #141619;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23e9ecf0' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
/* @@end-colour-themes@@ */

/* ---------- glass (frosted surfaces)
   Only the app's frame floats on glass: the sidebar / phone top bar, pop-up menus, the dashboard's period bar and
   the toast. Cards, tables, figures, charts, forms and dialogs stay on solid surfaces so they read clearly.
   The defaults below are SOLID. Real translucency + blur is switched on further down only when the browser can blur
   (@supports) and theme.js has set data-glass="on" - i.e. the person hasn't ticked "Reduce transparency" and the
   device isn't asking for reduced transparency. Text is never made see-through: only backgrounds are. */
:root {
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 18px;
  --page-gradient: var(--page);
  --glass-bg: var(--surface);          /* sidebar, period bar */
  --glass-bg-bar: var(--surface);      /* phone top bar (content scrolls under it: needs more body) */
  --glass-bg-pop: var(--surface);      /* menus and pop-ups (text sits right on it: the most body) */
  --glass-filter: none;
  --glass-edge: var(--border);
  --glass-sheen: none;                 /* soft light falling on the top of a glass surface */
  --glass-ring: 0 0 0 transparent;     /* hairline just outside a glass edge, so it reads on light backdrops */
  --glass-highlight: inset 0 1px 0 rgba(255,255,255,.7);
  --card-edge: var(--border);
  --card-shadow: 0 1px 2px rgba(16,24,40,.04), 0 6px 24px -6px rgba(16,24,40,.08);
  --glass-shadow: 0 1px 2px rgba(16,24,40,.05), 0 10px 32px -8px rgba(16,24,40,.14);
  --btn-highlight: inset 0 1px 0 rgba(255,255,255,.22);
}
:root[data-theme="dark"] {
  --glass-highlight: inset 0 1px 0 rgba(255,255,255,.06);
  --card-shadow: 0 1px 2px rgba(0,0,0,.5), 0 8px 28px -8px rgba(0,0,0,.55);
  --glass-shadow: 0 1px 2px rgba(0,0,0,.5), 0 14px 40px -10px rgba(0,0,0,.65);
  --btn-highlight: inset 0 1px 0 rgba(255,255,255,.14);
}
/* The quiet backdrop the glass sits on: soft washes of the brand blue, drawn once and fixed (it never moves). */
:root[data-glass="on"] {
  --page-gradient:
    radial-gradient(1100px 720px at 0% 0%, rgb(var(--tint-1-rgb) / var(--tint-1-a)), transparent 62%),
    radial-gradient(900px 640px at 100% 0%, rgb(var(--tint-2-rgb) / var(--tint-2-a)), transparent 60%),
    radial-gradient(1000px 800px at 70% 100%, rgb(var(--tint-1-rgb) / var(--tint-3-a)), transparent 62%),
    linear-gradient(180deg, var(--page), var(--page-low));
}
:root[data-theme="dark"][data-glass="on"] {
  --page-gradient:
    radial-gradient(1100px 720px at 0% 0%, rgb(var(--tint-1-rgb) / var(--tint-1-a)), transparent 62%),
    radial-gradient(900px 640px at 100% 0%, rgb(var(--tint-2-rgb) / var(--tint-2-a)), transparent 60%),
    radial-gradient(1000px 800px at 70% 100%, rgb(var(--tint-1-rgb) / var(--tint-3-a)), transparent 62%),
    linear-gradient(180deg, var(--page), var(--page-low));
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  /* Stronger glass where it helps: navigation, toolbars, menus and floating controls. Menus keep the most body
     (text sits right on them); the blur stays moderate so phones scroll smoothly. */
  :root[data-glass="on"] {
    --glass-bg: rgb(var(--glass-rgb) / .50);
    --glass-bg-bar: rgb(var(--glass-rgb) / .72);
    --glass-bg-pop: rgb(var(--glass-rgb) / .86);
    --glass-filter: blur(24px) saturate(185%);
    --glass-edge: rgba(255,255,255,.70);
    --glass-ring: 0 0 0 1px rgba(15,23,42,.07);
    --glass-sheen: linear-gradient(180deg, rgba(255,255,255,.45), rgba(255,255,255,0) 46%);
    --glass-highlight: inset 0 1px 0 rgba(255,255,255,.9), inset 0 -1px 0 rgba(255,255,255,.35);
  }
  :root[data-theme="dark"][data-glass="on"] {
    --glass-bg: rgb(var(--glass-rgb) / .46);
    --glass-bg-bar: rgb(var(--glass-rgb) / .74);
    --glass-bg-pop: rgb(var(--glass-rgb) / .88);
    --glass-edge: rgba(255,255,255,.13);
    --glass-ring: 0 0 0 1px rgba(0,0,0,.35);
    --glass-sheen: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,0) 46%);
    --glass-highlight: inset 0 1px 0 rgba(255,255,255,.12), inset 0 -1px 0 rgba(255,255,255,.04);
  }
}
/* Browsers without blur but with glass on: nearly solid, so text never sits on unblurred busy content. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root[data-glass="on"] { --glass-bg: rgb(var(--glass-rgb) / .96); --glass-bg-bar: var(--surface); --glass-bg-pop: var(--surface); }
}
.sidebar, .period-bar, .dt-toolbar {
  background-color: var(--glass-bg); background-image: var(--glass-sheen);
  -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter);
  border: 1px solid var(--glass-edge); box-shadow: var(--glass-highlight), var(--glass-ring), var(--glass-shadow);
}

* { box-sizing: border-box; }
/* Layout classes below set display:grid/flex, which would otherwise override the hidden attribute. */
[hidden] { display: none !important; }
html, body { margin: 0; }
html { background: var(--page); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  background: transparent;
  color: var(--ink);
  /* Long model names, IMEIs and serials wrap instead of pushing the page wider than the screen. */
  overflow-wrap: break-word;
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
/* The page backdrop: one fixed layer behind everything (cheaper than background-attachment: fixed on phones). */
body::before { content: ""; position: fixed; inset: 0; z-index: -1; background: var(--page-gradient); pointer-events: none; }
a { color: var(--accent); }
h1 { font-size: 22px; margin: 0; font-weight: 650; letter-spacing: -.01em; overflow-wrap: anywhere; }
h2 { font-size: 17px; margin: 0; font-weight: 650; }
h3 { font-size: 14px; margin: 0 0 10px; font-weight: 650; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }

/* ---------- layout */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.sidebar {
  border-width: 0 1px 0 0; box-shadow: var(--glass-highlight), 1px 0 0 rgba(15,23,42,.05);
  padding: 20px 14px; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 0 8px 22px; min-width: 0; }
.brand-text { min-width: 0; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; background: var(--accent); position: relative; flex: none;
  box-shadow: var(--btn-highlight), 0 2px 6px -1px color-mix(in srgb, var(--accent) 45%, transparent);
}
.brand-mark::after {
  content: ""; position: absolute; left: 10px; top: 6px; width: 12px; height: 20px;
  border: 2px solid #fff; border-radius: 3px; box-sizing: border-box;
}
.brand-name { font-weight: 700; overflow-wrap: anywhere; }
.brand-sub { color: var(--ink-3); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  color: var(--ink-2); text-decoration: none; padding: 8px 10px; border-radius: 9px; font-weight: 500;
}
/* On glass the hover / active fills are tints of the ink and accent, so they read over whatever is behind. */
.nav a:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); }
.nav a.active { background: color-mix(in srgb, var(--accent-soft) 88%, transparent); color: var(--accent); }
.sidebar-menu { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.menu-btn { display: none; align-items: center; gap: 8px; margin-left: auto; flex: none; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.menu-icon, .menu-icon::before, .menu-icon::after { display: block; width: 18px; height: 2px; border-radius: 2px; background: currentColor; }
.menu-icon { position: relative; }
.menu-icon::before, .menu-icon::after { content: ""; position: absolute; left: 0; }
.menu-icon::before { top: -6px; }
.menu-icon::after { top: 6px; }
.shell.menu-open .menu-icon { background: transparent; }
.shell.menu-open .menu-icon::before { top: 0; transform: rotate(45deg); }
.shell.menu-open .menu-icon::after { top: 0; transform: rotate(-45deg); }
.main { padding: 24px 28px 60px; min-width: 0; }

/* Phones, small tablets, and phones turned sideways (short screens): the sidebar becomes a bar across the
   top with a Menu button; the menu opens below it. The bar stays at the top while the page scrolls. */
@media (max-width: 820px), (max-height: 520px) and (orientation: landscape) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; z-index: 20; height: auto; max-height: 100vh; max-height: 100dvh; padding: 8px 12px;
    border-width: 0 0 1px 0; overflow: visible; background-color: var(--glass-bg-bar); box-shadow: var(--glass-highlight), var(--glass-shadow); }
  /* The open menu covers the page: it gets the pop-up glass (the most body) so every link reads clearly. */
  .shell.menu-open .sidebar { background-color: var(--glass-bg-pop); }
  .brand { padding: 0; }
  .brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .brand-sub { display: none; }
  .menu-btn { display: inline-flex; }
  .sidebar-menu { display: none; }
  .shell.menu-open .sidebar-menu { display: flex; max-height: calc(100dvh - 64px); overflow-y: auto; overscroll-behavior: contain; padding: 8px 0 4px; }
  .nav a { padding: 11px 12px; }
  .main { padding: 16px 16px 60px; }
  .seg { max-width: 100%; overflow-x: auto; }
  .seg button { white-space: nowrap; padding: 6px 10px; }
  h1 { font-size: 20px; }
}
@media (min-width: 821px) and (max-width: 1100px) and (min-height: 521px) {
  .shell { grid-template-columns: 196px minmax(0, 1fr); }
  .main { padding: 20px 20px 60px; }
}

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.banner {
  background: var(--sample-bg); color: var(--ink); border: 1px solid color-mix(in srgb, var(--sample) 35%, transparent);
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 18px;
}

/* ---------- cards & tiles */
.card { background: var(--surface); border: 1px solid var(--card-edge); border-radius: var(--radius); box-shadow: var(--glass-highlight), var(--card-shadow); }
.card-pad { padding: 16px 18px; }
.grid { display: grid; gap: 14px; }
.tiles { grid-template-columns: repeat(auto-fill, minmax(min(170px, 100%), 1fr)); }
.two-col { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.grid > * { min-width: 0; }
@media (max-width: 820px), (max-height: 520px) and (orientation: landscape) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 12px; }
  .tile-value { font-size: clamp(16px, 4.6vw, 20px); }
  @supports (container-type: inline-size) { .tile-value { font-size: clamp(14px, 14cqi, 20px); } }
}
.tile { padding: 14px 16px; }
.tile-label { color: var(--ink-2); font-size: 13.5px; font-weight: 500; }
.tile-value { font-size: 22px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.tile-note { color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.tile-value.neg { color: var(--bad); }
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 26px 0 10px; gap: 10px; flex-wrap: wrap; }
.section-title h2 { font-size: 15px; }

/* ---------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--ink); border-radius: 10px; padding: 7px 13px; font: inherit; font-weight: 550; cursor: pointer;
  text-decoration: none; white-space: nowrap; min-height: 36px;
}
.btn:hover { background: var(--surface-hover); }
.btn:active:not([disabled]) { background: var(--surface-active); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; border-color: var(--focus); }
.btn-primary { background: var(--accent-bg); border-color: var(--accent-bg); color: var(--accent-ink);
  box-shadow: var(--btn-highlight), 0 1px 2px color-mix(in srgb, var(--accent-bg) 40%, transparent); }
.btn-primary:hover { background: var(--accent-bg-hover); border-color: var(--accent-bg-hover); }
.btn-primary:active:not([disabled]) { background: var(--accent-bg-active); border-color: var(--accent-bg-active); }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.btn-danger:hover { background: var(--bad-bg); }
.btn-sm { padding: 4px 9px; font-size: 12.5px; min-height: 30px; }
/* Disabled: a flat grey that is clearly "off" but still readable, in both modes. */
.btn[disabled], .btn[disabled]:hover { background: var(--disabled-bg); border-color: var(--border); color: var(--disabled-ink); cursor: not-allowed; box-shadow: none; }
input:disabled, select:disabled, textarea:disabled { background: var(--disabled-bg); color: var(--disabled-ink); cursor: not-allowed; opacity: 1; -webkit-text-fill-color: var(--disabled-ink); }
.icon-btn { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--ink-2); padding: 4px 8px; border-radius: 6px;
  min-width: 36px; min-height: 36px; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--surface-hover); }
.icon-btn:active { background: var(--surface-active); }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.toolbar .search { flex: 1 1 260px; }
.toolbar > label { display: inline-flex; align-items: center; gap: 6px; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 7px 10px; min-width: 0; max-width: 100%;
}
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 1; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent-bg); }
textarea { resize: vertical; min-height: 60px; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden;
  background-color: var(--glass-bg-bar); background-image: var(--glass-sheen); box-shadow: var(--glass-highlight); }
.seg button { border: 0; background: transparent; color: var(--ink-2); padding: 6px 12px; font: inherit; cursor: pointer; min-height: 34px; }
.seg button:focus-visible { outline-offset: -3px; }
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* ---------- tables */
/* Wide tables scroll sideways inside their own box; the page itself never gets wider than the screen.
   app.js puts any table that isn't already in one of these boxes into one. */
.table-wrap { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: var(--surface-2); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-hover); }
td .sub { color: var(--ink-3); font-size: 12.5px; margin-top: 1px; }
/* Stock and sales on a phone: the first column (the item / sale) stays put while the rest scrolls. */
table.sticky-first th:first-child, table.sticky-first td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); }
table.sticky-first th:first-child { background: var(--surface-2); z-index: 2; }
table.sticky-first tbody tr.clickable:hover td:first-child { background: var(--surface-hover); }
@media (max-width: 600px) {
  th, td { padding: 8px 10px; }
  table.sticky-first td:first-child { min-width: 150px; max-width: 46vw; box-shadow: 1px 0 0 var(--border); }
  table.sticky-first th:first-child { box-shadow: 1px 0 0 var(--border); }
}
.empty { padding: 28px; text-align: center; color: var(--ink-3); }
.list-compact td, .list-compact th { padding: 7px 10px; }

/* ---------- badges */
.badge {
  display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  white-space: nowrap; line-height: 1.5;
}
.badge::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 5px; vertical-align: 1px; }
.badge-available { color: var(--good); background: var(--good-bg); }
.badge-reserved  { color: var(--warn); background: var(--warn-bg); }
.badge-sold      { color: var(--ink-2); background: var(--muted-bg); }
.badge-returned  { color: var(--bad); background: var(--bad-bg); }
.badge-owing     { color: var(--bad); background: var(--bad-bg); }
.badge-paid      { color: var(--good); background: var(--good-bg); }
.badge-credit    { color: var(--info); background: var(--info-bg); }
.badge-sample    { color: var(--sample); background: var(--sample-bg); font-size: 10.5px; letter-spacing: .03em; }
.badge-sample::before, .badge-kind::before { display: none; }
.badge-kind { color: var(--ink-2); background: var(--muted-bg); font-weight: 500; }

/* ---------- modal & forms */
.modal { border: 1px solid var(--card-edge); padding: 0; border-radius: var(--radius-lg); width: min(760px, calc(100vw - 24px)); max-width: calc(100vw - 24px);
  max-height: calc(100vh - 32px); max-height: calc(var(--app-height, 100dvh) - 32px);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); }
.modal.modal-wide { width: min(980px, calc(100vw - 24px)); }
.modal::backdrop { background: var(--overlay); }
/* A light frost behind dialogs on computers only (one static layer; phones' dialogs fill the screen anyway). */
@media (pointer: fine) and (min-width: 601px) {
  :root[data-glass="on"] .modal::backdrop { -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
}
.modal-inner { display: flex; flex-direction: column; max-height: inherit; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { min-width: 0; overflow-wrap: anywhere; }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1 1 auto; min-height: 0; overscroll-behavior: contain; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; display: flex; gap: 8px; }
.form-error { margin: 0 20px 4px; padding: 9px 12px; border-radius: 8px; background: var(--bad-bg); color: var(--bad); font-weight: 500;
  border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 11.5px; color: var(--ink-3); }
.field-row { display: flex; gap: 8px; flex-wrap: wrap; }
.field-row > * { flex: 1 1 140px; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 14px; min-width: 0; }
legend { font-weight: 650; padding: 0 6px; }

.kv { display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr); gap: 6px 16px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }

.sale-total { display: grid; grid-template-columns: 1fr auto; gap: 4px 20px; justify-content: end; max-width: 320px; margin-left: auto; font-variant-numeric: tabular-nums; }
.sale-total .big { font-size: 17px; font-weight: 650; }
.picker-results { border: 1px solid var(--border); border-radius: 8px; max-height: 220px; overflow-y: auto; margin-top: 6px; }
.picker-results button { display: flex; justify-content: space-between; gap: 10px; width: 100%; border: 0; border-bottom: 1px solid var(--border);
  background: var(--surface); color: var(--ink); padding: 10px; text-align: left; font: inherit; cursor: pointer; min-height: 44px; }
.picker-results button > span:first-child { min-width: 0; }
.picker-results button:last-child { border-bottom: 0; }
.picker-results button:hover, .picker-results button:focus-visible { background: var(--accent-soft-hover); }

/* ---------- chart */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--border-strong); stroke-width: 1; }
.chart .axis-label { fill: var(--ink-3); font-size: 11px; }
.chart .bar { fill: var(--series-1); }
.chart .bar-hit { fill: transparent; cursor: default; }
.chart .bar-hit:hover + .bar, .chart g.active .bar { opacity: .82; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border-strong);
  color: var(--ink); border-radius: 10px; padding: 8px 10px; font-size: 12px; box-shadow: var(--glass-shadow); white-space: nowrap; z-index: 2;
  transform: translate(-50%, calc(-100% - 8px));
}
.chart-tip b { display: block; margin-bottom: 2px; }
.chart-tip .row { display: flex; justify-content: space-between; gap: 16px; font-variant-numeric: tabular-nums; }

/* ---------- toast */
.toast {
  position: fixed; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: color-mix(in srgb, var(--ink) 92%, transparent); color: var(--surface); padding: 10px 16px; border-radius: 12px; font-weight: 500;
  -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter); box-shadow: var(--glass-shadow);
  transition: opacity .18s, transform .18s; z-index: 1000; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad); }

.loading { padding: 40px; text-align: center; color: var(--ink-3); }

/* ---------- IMEI capture */
.imei-box { margin: 4px 0 0; }
.imei-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.imei-status { font-size: 12px; color: var(--ink-3); min-height: 1em; }
.imei-status.ok { color: var(--good); }
.imei-status.bad { color: var(--bad); }
.good { color: var(--good); }
.warn { color: var(--warn); }
.imei-status.warn { color: var(--warn); }
/* Serial numbers: a monospace font whose zero is slashed/dotted, so 0 and O look different. */
.mono { font-family: Consolas, "Cascadia Mono", ui-monospace, Menlo, "Roboto Mono", monospace; font-variant-numeric: slashed-zero; letter-spacing: .02em; }
.serial-spell { display: inline-flex; flex-wrap: wrap; gap: 2px; vertical-align: top; margin: 2px 0;
  font-family: Consolas, "Cascadia Mono", ui-monospace, Menlo, "Roboto Mono", monospace; font-variant-numeric: slashed-zero; color: var(--ink); }
.serial-spell > span { display: inline-flex; flex-direction: column; align-items: center; min-width: 1.35em; padding: 1px 2px;
  border: 1px solid var(--border); border-radius: 4px; background: var(--surface); font-size: 15px; line-height: 1.2; }
.serial-spell > span.flag.strong { border-color: var(--warn); background: var(--warn-bg); font-weight: 700; }
.serial-spell > span.flag.weak { border-color: var(--border-strong); background: var(--surface-2); }
.serial-spell small { font-family: system-ui, sans-serif; font-size: 9px; font-weight: 400; color: var(--ink-2); white-space: nowrap; }
textarea.scan-text { width: 100%; box-sizing: border-box; resize: vertical; border: 1px solid var(--border); color: var(--ink); }
#scanner { z-index: 2; }
/* Live camera preview. Until the camera reports its image size the box takes the screen's likely shape;
   then app.js sizes it to the camera image exactly (portrait when the phone is upright), and places the
   guide over the part that is scanned. The image is never stretched (contain) or turned. */
.scan-video { position: relative; background: #000; border-radius: 10px; overflow: hidden; margin: 0 auto;
  width: 100%; max-width: 100%; aspect-ratio: 4 / 3; max-height: 60vh; max-height: 60dvh; }
@media (orientation: portrait) and (max-width: 820px) { .scan-video { aspect-ratio: 3 / 4; max-height: 55vh; } }
.scan-video.sized { max-height: none; }       /* app.js has set the camera image's own shape and a width limit */
/* cover: on an upright phone the 3:4 box shows the picture's centre at true proportions (like a camera
   viewfinder). Elsewhere the box has the picture's own shape, so cover shows all of it. */
.scan-video video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-guide { position: absolute; box-sizing: border-box; border: 2px solid rgba(255,255,255,.9); border-radius: 8px; box-shadow: 0 0 0 9999px rgba(0,0,0,.32); pointer-events: none; }
.scan-guide::after { content: ""; position: absolute; left: 6%; right: 6%; top: 50%; border-top: 2px solid rgba(255,80,80,.75); }
.scan-progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.scan-progress > div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
/* A taken/chosen photo, shown the right way up (the browser applies the phone's orientation tag) and whole. */
.scan-preview { display: block; max-width: 100%; max-height: 32vh; width: auto; height: auto; object-fit: contain;
  margin: 6px auto; border-radius: 8px; border: 1px solid var(--border); image-orientation: from-image; }
@media (orientation: portrait) and (max-width: 820px) { .scan-preview { max-height: 45vh; } }
.scan-text { white-space: pre-wrap; word-break: break-word; max-height: 30vh; overflow: auto; background: var(--surface-2);
  padding: 8px; border-radius: 8px; font-size: 12px; }
#scan-info div { margin: 2px 0; word-break: break-word; }
label.btn { cursor: pointer; }
.nowrap-break { word-break: break-all; }
.review-table { width: 100%; table-layout: fixed; }
.review-table th:last-child, .review-table td:last-child { width: 136px; }
.review-table input { width: 100%; min-width: 0; font-variant-numeric: tabular-nums; }
.review-table select { width: 100%; }
.review-table .imei-status { display: block; margin-top: 4px; word-break: break-word; }
.review-table td { vertical-align: middle; }
.scan-controls label { display: inline-flex; align-items: center; gap: 8px; flex: 1 1 180px; }
.scan-controls input[type="range"] { flex: 1; min-width: 100px; }

/* ---------- sign in & account */
.login-screen { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); padding: 26px 24px; display: flex; flex-direction: column; gap: 14px; }
.login-card .brand { padding: 0 0 6px; }
.login-card .form-error { margin: 0; }
.login-card { width: min(440px, 100%); }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form fieldset { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; align-self: center; }
input[readonly] { background: var(--surface-2); }
.login-btn { justify-content: center; padding: 10px; min-height: 44px; }
.sidebar { display: flex; flex-direction: column; }
.sidebar-foot { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid var(--glass-edge); font-size: 12.5px; color: var(--ink-3); }
.sidebar-foot b { color: var(--ink-2); font-weight: 600; }
.sidebar-foot .btn { margin-top: 8px; }
.banner-warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
@media (max-width: 820px), (max-height: 520px) and (orientation: landscape) {
  .sidebar-foot { margin-top: 8px; padding: 10px 4px 2px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
  .sidebar-foot .btn { margin-top: 0; }
}

/* ---------- backups (Settings) */
.dest-title { margin: 16px 0 8px; font-size: 13px; }
.dest-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.dest-list > li { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; align-items: start; }
.dest-state { display: inline-block; text-align: center; font-size: 11.5px; font-weight: 700; padding: 3px 6px; border-radius: 999px; }
.dest-state.on { color: var(--good); background: var(--good-bg); }
.dest-state.off { color: var(--ink-2); background: var(--muted-bg); }
.drive-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- appearance (Settings) */
.theme-choice { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 4px 0 8px; border: 0; padding: 0; }
.theme-choice label { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; border: 1px solid var(--border-strong);
  border-radius: 10px; cursor: pointer; font-weight: 600; text-align: center; background: var(--surface); min-height: 44px; }
.theme-choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.theme-choice label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.theme-choice legend { padding: 0; margin-bottom: 6px; font-weight: 500; }
.theme-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.theme-swatch { width: 44px; height: 30px; border-radius: 6px; border: 1px solid var(--border-strong); overflow: hidden; display: flex; }
.theme-swatch span { flex: 1; }
.sw-light span:first-child { background: #fcfcfb; } .sw-light span:last-child { background: #f0efec; }
.sw-dark span:first-child { background: #1a1a19; } .sw-dark span:last-child { background: #242422; }
.sw-system span:first-child { background: #fcfcfb; } .sw-system span:last-child { background: #1a1a19; }

/* ---------- branding */
.brand-mark.has-logo { background: #fff; overflow: hidden; }
.brand-mark.has-logo::after { display: none; }
.brand-mark.has-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.logo-row { display: flex; align-items: center; gap: 8px; margin: 6px 0 4px; flex-wrap: wrap; }
.logo-preview { width: 64px; height: 64px; border: 1px solid var(--border); border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); overflow: hidden; }
.logo-preview:has(img) { background: #fff; }      /* logos are made for a white background */
.logo-preview img { max-width: 100%; max-height: 100%; }

/* ---------- statuses added for inspection, faults, returns and orders */
.badge-inspection, .badge-in_repair, .badge-acknowledged, .badge-shipped, .badge-partially_received, .badge-sent, .badge-sent_to_supplier { color: var(--info); background: var(--info-bg); }
.badge-faulty, .badge-open, .badge-critical, .badge-rejected { color: var(--bad); background: var(--bad-bg); }
.badge-with_supplier, .badge-ordered { color: var(--warn); background: var(--warn-bg); }
.badge-resolved, .badge-repaired, .badge-replaced, .badge-received, .badge-exchanged, .badge-refunded, .badge-credited { color: var(--good); background: var(--good-bg); }
.badge-supplier_returned, .badge-cancelled, .badge-closed, .badge-wont_fix { color: var(--ink-2); background: var(--muted-bg); }
.bad { color: var(--bad); }
.ok { color: var(--good); }
.sub.bad { color: var(--bad); }

/* ---------- item details */
.item-status-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; margin-bottom: 14px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.item-status-bar .sub { display: inline; margin-left: 6px; color: var(--ink-3); font-size: 12px; }
.item-actions { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.plain[disabled] input, fieldset.plain[disabled] select, fieldset.plain[disabled] textarea { background: var(--surface-2); color: var(--ink); }
.fault-card { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.timeline { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); }
.timeline li { margin: 3px 0; }
.photos { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.photos img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); max-width: 100%; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; }
.check input { margin-top: 3px; flex: none; }
.perm-list { display: grid; gap: 8px; margin-top: 8px; }

/* ---------- bulk registration & orders */
.group-box { border: 1px solid var(--border); border-radius: 10px; margin: 12px 0; padding: 8px 12px 12px; }
.group-box > legend { font-weight: 600; padding: 0 6px; }
.scan-panel { border: 2px solid var(--accent-soft); }
.cat-find .picker-results { max-height: 260px; }
.cat-config .form-grid { margin: 0; }
.hint.warn { color: var(--warn); font-weight: 600; }
.scan-panel .field-row { flex-wrap: wrap; }
.row-badge { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; display: inline-block; }
.row-badge.registered { color: var(--good); background: var(--good-bg); }
.row-badge.draft { color: var(--warn); background: var(--warn-bg); }
.row-badge.invalid { color: var(--bad); background: var(--bad-bg); }
.row-badge.pending { color: var(--ink-2); background: var(--muted-bg); }
tr.row-invalid td { background: color-mix(in srgb, var(--bad-bg) 55%, transparent); }
tr.row-pending td { background: color-mix(in srgb, var(--muted-bg) 60%, transparent); }
#bt-rows input { padding: 4px 6px; font-size: 13px; min-width: 0; }

/* ---------- daily summaries */
.report-pages { display: grid; gap: 10px; }
.report-pages img { width: 100%; max-width: 540px; border: 1px solid var(--border); border-radius: 10px; display: block; background: #fff; }

/* ---------- touch screens & phones */
/* Bigger targets for fingers; 16px text in fields stops phones zooming in when a field is tapped. */
@media (pointer: coarse) {
  .btn { min-height: 44px; padding: 8px 14px; }
  .btn-sm { min-height: 38px; padding: 6px 12px; font-size: 13px; }
  .icon-btn { min-width: 44px; min-height: 44px; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]), select { min-height: 44px; }
  .seg button { min-height: 40px; }
  .check { font-size: 15px; }
  .check input { width: 20px; height: 20px; margin-top: 1px; }
  .link-btn { padding: 10px 4px; }
}
@media (max-width: 820px), (pointer: coarse) {
  input, select, textarea { font-size: 16px; }
}
@media (max-width: 600px) {
  .page-head { margin-bottom: 12px; }
  .page-head .actions { width: 100%; }
  .toolbar > * { flex: 1 1 140px; }
  .toolbar .search { flex: 1 1 100%; }
  .toolbar > label input { flex: 1; }
  .card-pad { padding: 14px; }
  .section-title { margin: 20px 0 8px; }
  .sale-total { max-width: none; }
  .item-actions { margin-left: 0; }
}
/* Pop-ups fill a phone's screen (and a phone held sideways): title at the top, buttons at the bottom, and
   only the middle scrolls. --app-height / --app-top are the part of the screen above the keyboard
   (app.js keeps them up to date), so the buttons stay just above the keyboard while typing. */
@media (max-width: 600px), (max-height: 520px) and (orientation: landscape) {
  .modal, .modal.modal-wide { width: 100%; max-width: 100%; height: var(--app-height, 100dvh); max-height: var(--app-height, 100dvh);
    margin: 0; inset: var(--app-top, 0px) 0 auto 0; border-radius: 0; }
  .modal-inner { height: 100%; max-height: 100%; }
  .modal-head { padding: 6px 6px 6px 16px; }
  .modal-head h2 { font-size: 16px; }
  .modal-body { padding: 14px 16px 20px; }
  .modal-foot { padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); gap: 8px; }
  .modal-foot > .btn { flex: 1 1 0; min-width: max-content; }
  .modal-foot .left { flex: 1 1 100%; margin-right: 0; }
  .modal-foot .left .btn { flex: 1 1 auto; }
  .form-error { margin: 0 12px 4px; }
}

/* ---------- dashboard */
.info { color: var(--info); }
.period-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 14px; margin-bottom: 6px; }
/* Content scrolls under the period bar, so it gets the top bar's body (like the phone top bar): text stays >= 4.5:1. */
.card.period-bar { background-color: var(--glass-bg-bar); border-color: var(--glass-edge); box-shadow: var(--glass-highlight), var(--glass-ring), var(--glass-shadow); }
/* On computers the period bar floats: it stays at the top while the figures scroll under its frosted glass. */
@media (min-width: 821px) and (min-height: 521px) { .period-bar { position: sticky; top: 12px; z-index: 5; } }
/* Table toolbars: one glass strip holding the (solid) search, filters and buttons. */
.dt-toolbar { padding: 8px; border-radius: var(--radius); }
.period-bar > * { min-width: 0; max-width: 100%; }
.period-bar .seg { overflow-x: auto; }
.period-bar .seg button { white-space: nowrap; }
.period-custom { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.period-custom label { display: inline-flex; gap: 6px; align-items: center; font-size: 13.5px; color: var(--ink-2); }
.period-caption { font-size: 14px; flex: 1 1 260px; }
.dash-section { margin-top: 18px; }
.dash-section .section-title { margin-top: 8px; }
.scope { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.scope-period { color: var(--accent); background: var(--accent-soft); }
.scope-now { color: var(--ink-2); background: var(--muted-bg); }
.owner-tag { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .02em; padding: 1px 6px; border-radius: 999px;
  color: var(--sample); background: var(--sample-bg); vertical-align: 1px; margin-left: 4px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: 12px; }
.kpi { position: relative; display: block; padding: 14px 16px; color: inherit; text-decoration: none; min-width: 0; }
.kpi-link:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.kpi-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.kpi-go { position: absolute; right: 10px; top: 12px; color: var(--ink-3); display: inline-flex; }
.kpi-go .ic { width: 16px; height: 16px; }
.kpi-link:hover .kpi-go { color: var(--accent); }
.kpi-label { color: var(--ink-2); font-size: 14px; font-weight: 550; padding-right: 14px; }
.kpi-value { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.015em; line-height: 1.15; overflow-wrap: anywhere; }
.kpi-big .kpi-value { font-size: 28px; }
/* Amounts stay on one line: the figure shrinks with its card (container units) instead of breaking mid-number.
   Browsers without container queries keep the old wrapping. */
@supports (container-type: inline-size) {
  .kpi, .tile { container-type: inline-size; }
  .kpi-value { white-space: nowrap; overflow-wrap: normal; font-size: clamp(15px, 14.5cqi, 24px); }
  .kpi-big .kpi-value { font-size: clamp(16px, 15.5cqi, 28px); }
  .tile-value { white-space: nowrap; overflow-wrap: normal; font-size: clamp(15px, 14cqi, 22px); }
}
.kpi-value.neg { color: var(--bad); }
.kpi-note { color: var(--ink-3); font-size: 13px; margin-top: 4px; }
.dash-3 { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); margin-top: 12px; align-items: start; }
.dash-3 h3, .dash-section h3 { font-size: 15px; }
table.figures td { padding: 7px 4px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: top; }
table.figures td .sub { display: block; }
table.figures tr.total td { font-weight: 700; border-bottom-width: 2px; }
table.figures tr.clickable:hover td { background: var(--surface-hover); }
table.list-compact.owing { margin-top: 8px; }
.empty-inline { padding: 10px 12px; border-radius: 8px; background: var(--surface-2); color: var(--ink-2); font-size: 14px; }
.notice { margin-top: 12px; padding: 10px 14px; border-radius: 8px; font-size: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.notice-warn { background: var(--warn-bg); color: var(--ink); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
details.why { margin-top: 10px; }
details.why summary { cursor: pointer; color: var(--accent); font-size: 14px; }
.meter { height: 6px; border-radius: 3px; background: var(--surface-2); margin-top: 4px; overflow: hidden; max-width: 220px; }
.meter span { display: block; height: 100%; border-radius: 3px; background: var(--series-1); }
.stack { display: flex; gap: 2px; height: 12px; border-radius: 6px; overflow: hidden; margin: 2px 0 8px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: 0; }
.stack-available { background: var(--good); }
.stack-reserved { background: var(--warn); }
.stack-inspection { background: var(--info); }
.stack-faulty { background: var(--bad); }
.stack-with_supplier { background: var(--border-strong); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--ink-2); margin-bottom: 4px; }
.legend .key { display: inline-block; vertical-align: middle; margin-right: 6px; }
.legend .key-bar { width: 12px; height: 12px; border-radius: 3px; background: var(--series-1); }
.legend .key-line { width: 18px; height: 2px; background: var(--series-2); }
.chart .bar-neg { fill: var(--series-1); opacity: .55; }
.chart .no-sales { fill: var(--surface); stroke: var(--ink-3); stroke-width: 1.5; }
.chart .profit-line { fill: none; stroke: var(--series-2); stroke-width: 2; stroke-linejoin: round; pointer-events: none; }
.chart .profit-dot { fill: var(--series-2); stroke: var(--surface); stroke-width: 2; pointer-events: none; }
.chart g[data-i] { cursor: pointer; outline: none; }
.chart g[data-i]:focus-visible .bar-hit { fill: var(--accent-soft); }
.chart .axis-label { font-size: 12px; }
table.recent td { font-size: 14px; }

/* ---------- server-driven tables (tables.js) */
.dt-filters { display: contents; }
.dt-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.dt-search { grid-row: 1; grid-column: 1; position: relative; min-width: 0; }
.dt-search > .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--ink-3); pointer-events: none; }
.dt-search > input { width: 100%; padding-left: 36px; }
.dt-tools { grid-row: 1; grid-column: 2; display: flex; gap: 8px; }
@media (min-width: 601px) {
  .dt-filters { display: grid; grid-row: 2; grid-column: 1 / -1; gap: 8px;
    grid-template-columns: repeat(auto-fill, minmax(min(178px, 100%), 1fr)); }
  .dt-filters > select, .dt-filters > .select-trigger, .dt-filters > .dt-date { width: 100%; }
}
.dt-filter-box > summary { list-style: none; }
.dt-filter-box > summary::-webkit-details-marker { display: none; }
@media (min-width: 601px) { .dt-filter-box { display: contents; } .dt-filter-box > summary { display: none; } }
@media (max-width: 600px) {
  .dt-toolbar { display: flex; flex-wrap: wrap; }
  .dt-search { flex: 1 1 100%; }
  .dt-filter-box { order: 1; flex: 0 0 auto; }
  .dt-filter-box[open] { flex: 1 1 100%; }
  .dt-tools { order: 2; flex: 1 1 auto; }
  .dt-tools > .btn { flex: 1 1 0; }
  .dt-filter-box[open] .dt-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
  .dt-filter-box[open] .dt-filters > * { width: 100%; }
  .dt-filter-box[open] .dt-filters > .dt-date { grid-column: 1 / -1; }
}
.dt-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 10px; }
.dt-chips:empty { display: none; }
.chip { border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: 3px 10px;
  font: inherit; font-size: 13px; cursor: pointer; }
.chip:hover { background: var(--surface-2); }
/* Headings stay visible: the table scrolls inside its own box, down and sideways - never the whole page. */
.table-scroll { overflow: auto; max-height: min(72vh, 780px); -webkit-overflow-scrolling: touch; overscroll-behavior: contain; position: relative; border-radius: var(--radius); }
/* Loading another page: a thin bar along the top of the table (the rows stay fully readable until replaced). */
.table-scroll.is-loading::before { content: ""; position: sticky; top: 0; left: 0; display: block; height: 3px; margin-bottom: -3px;
  z-index: 4; background: var(--accent); transform-origin: left; animation: dt-bar .9s var(--ease-out) infinite alternate; }
@keyframes dt-bar { from { transform: scaleX(.12); } to { transform: scaleX(1); } }
.table-scroll:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.dt-table th { z-index: 2; }
.th-sort { all: unset; cursor: pointer; display: inline-flex; gap: 5px; align-items: center; }
.th-sort:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
.th-sort .sort-ind { color: var(--ink-3); font-size: 10px; }
th[aria-sort="ascending"] .sort-ind, th[aria-sort="descending"] .sort-ind { color: var(--accent); }
.dt-table td.col-items, .dt-table td.col-name { min-width: 200px; }
.dt-table td.col-identifiers { min-width: 180px; }
.dt-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; margin-top: 10px; }
.dt-pager { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
@media (max-width: 600px) {
  .kpi-big .kpi-value { font-size: 24px; }
  .kpi-value { font-size: 21px; }
  @supports (container-type: inline-size) {
    .kpi-value { font-size: clamp(15px, 14.5cqi, 21px); }
    .kpi-big .kpi-value { font-size: clamp(16px, 15.5cqi, 24px); }
  }
  .dt-foot { flex-direction: column; align-items: stretch; }
}

/* ---------- dropdowns & pop-up menus (menus.js) */
/* Closed dropdowns: native <select>s and the searchable ones look the same - a field with a chevron. The open list
   of a native <select> is the browser's / phone's own, in the theme's colours (color-scheme on :root). */
:root { --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2352514e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
:root[data-theme="dark"] { --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23c9c8be' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
select:not([multiple]), .select-trigger {
  appearance: none; -webkit-appearance: none; background-image: var(--chevron); background-repeat: no-repeat;
  background-position: right 11px center; background-size: 12px 8px; padding-right: 32px; cursor: pointer; min-height: 38px;
}
select option { background: var(--surface); color: var(--ink); }
select option:checked { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
select option:disabled { color: var(--disabled-ink); }
select:hover:not(:disabled), .select-trigger:hover:not(:disabled) { border-color: var(--ink-3); }
select:disabled, .select-trigger:disabled { background-image: none; padding-right: 10px; }
.select-trigger {
  font: inherit; color: var(--ink); background-color: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 7px 32px 7px 10px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; max-width: 100%;
}
.select-trigger[aria-expanded="true"] { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.select-trigger:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.select-trigger:disabled { background-color: var(--disabled-bg); color: var(--disabled-ink); cursor: not-allowed; }
.field > .select-trigger, .form-grid .select-trigger { width: 100%; }
/* The real <select> under a searchable one: still in the form (its value is what gets saved), just not shown. */
.select-hidden { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important;
  margin: -1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; border: 0 !important; opacity: 0; pointer-events: none; }

/* The pop-up itself: fixed to the screen, above cards and dialogs, never clipped by a scrolling box. */
.menu-pop {
  position: fixed; z-index: 1100; display: flex; flex-direction: column; overflow: hidden; margin: 0;
  background-color: var(--glass-bg-pop); background-image: var(--glass-sheen); color: var(--ink);
  border: 1px solid var(--glass-edge); border-radius: 14px;
  -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter);
  box-shadow: var(--glass-highlight), var(--glass-ring), var(--shadow-pop);
}
.menu-search { padding: 8px; border-bottom: 1px solid var(--glass-edge); flex: none; }
.menu-search input { width: 100%; }
.menu-list { overflow-y: auto; overscroll-behavior: contain; padding: 4px; flex: 1 1 auto; min-height: 0; }
.menu-opt {
  display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer; min-height: 36px;
  line-height: 1.35; font-size: 14px; color: var(--ink);
}
.menu-opt + .menu-opt { margin-top: 1px; }
.menu-check { width: 14px; flex: none; color: var(--accent); font-weight: 700; }
.menu-text { min-width: 0; overflow-wrap: anywhere; }
.menu-hint { display: block; color: var(--ink-3); font-size: 12.5px; }
.menu-opt.is-active { background: color-mix(in srgb, var(--ink) 8%, transparent); box-shadow: inset 0 0 0 1px var(--border-strong); }
.menu-opt:hover:not(.is-disabled):not(.is-active) { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.menu-opt.is-selected { color: var(--accent); font-weight: 600; background: color-mix(in srgb, var(--accent-soft) 92%, transparent); }
.menu-opt.is-selected.is-active { box-shadow: inset 0 0 0 1px var(--accent); }
.menu-opt.is-disabled { color: var(--disabled-ink); cursor: not-allowed; background: none; box-shadow: none; }
.menu-empty { padding: 12px; color: var(--ink-3); font-size: 14px; }
.dt-cols-pop { padding: 10px 12px; display: grid; gap: 6px; overflow-y: auto; }
.dt-cols-pop .check { padding: 3px 0; }
@media (pointer: coarse) {
  .menu-opt { min-height: 44px; padding: 11px 12px; font-size: 15px; align-items: center; }
  .menu-search input { min-height: 44px; }
  .dt-cols-pop .check { padding: 8px 0; }
  .select-trigger { min-height: 44px; }
}

/* Text fields with suggestions: a small chevron says there's a list. */
input.has-suggest { background-image: var(--chevron); background-repeat: no-repeat; background-position: right 11px center;
  background-size: 10px 7px; padding-right: 30px; }

/* Search-as-you-type results (scan to sell, model finder): clear keyboard and pointer states. */
.picker-results button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.picker-results button[disabled] { color: var(--disabled-ink); cursor: not-allowed; background: none; }
@media (pointer: coarse) { .picker-results button { min-height: 48px; } }

/* Sidebar menu links and fold-out sections. */
.nav a:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.nav a.active { font-weight: 600; box-shadow: inset 3px 0 0 var(--accent), var(--glass-highlight); }
@media (pointer: coarse) { .nav a { padding: 12px 12px; } }
details > summary { cursor: pointer; border-radius: 6px; }
details > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- printed receipt */
#print-area { display: none; }
@media print {
  :root { color-scheme: light; }
  body::before { display: none !important; }
  * { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; box-shadow: none !important; }
  html, body { background: #fff !important; color: #000; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block; color: #000; background: #fff; }
  .receipt { font: 12pt/1.4 system-ui, sans-serif; max-width: 720px; margin: 0 auto; }
  .receipt table { width: 100%; border-collapse: collapse; margin: 10px 0; }
  .receipt th, .receipt td { text-align: left; padding: 4px 6px; border-bottom: 1px solid #ccc; vertical-align: top; }
  /* A receipt is always black on white, whatever display mode or colour theme the person uses on screen. */
  #print-area *, #print-area *::before, #print-area *::after { color: #000 !important; background: #fff !important; border-color: #ccc; box-shadow: none !important; }
  #print-area .sub { color: #444 !important; }
  #print-area .r-head { border-color: #000; }
  #print-area .r-warn { border-color: #000; }
  .receipt .num { text-align: right; }
  .receipt .sub { font-size: 10pt; color: #444; }
  .r-head { display: flex; gap: 14px; align-items: center; border-bottom: 2px solid #000; padding-bottom: 10px; }
  .r-logo { max-width: 90px; max-height: 90px; }
  .r-name { font-size: 18pt; font-weight: 700; }
  .r-totals { max-width: 360px; margin-left: auto !important; }
  .r-warn { border: 1px solid #000; padding: 6px; }
  .r-foot { text-align: center; margin-top: 18px; }
}

/* Telegram photo reader (tg.html) */
.tg-page { padding: 16px; }
/* The Telegram pages (photo / screenshot readers) are forms: one solid panel on the app's backdrop. */
.tg-main { max-width: 560px; margin: 0 auto; background: var(--surface); border: 1px solid var(--card-edge); border-radius: var(--radius-lg);
  box-shadow: var(--glass-highlight), var(--card-shadow); padding: 18px 18px 20px; }
@media (max-width: 420px) { .tg-page { padding: 10px; } .tg-main { padding: 14px; } }
.tg-main .form-error { margin: 8px 0; }
.tg-main h1 { font-size: 20px; margin: 4px 0; }

/* ---------- reduced motion: no slides or fades anywhere (menus already open instantly) - the device setting, or the
   person's own "Reduce motion" in Settings (data-motion, set by theme.js before the page is drawn). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; scroll-behavior: auto !important; }
}
:root[data-motion="reduced"] *, :root[data-motion="reduced"] *::before, :root[data-motion="reduced"] *::after {
  transition-duration: 0s !important; animation-duration: 0s !important; scroll-behavior: auto !important; }

/* =====================================================================================================
   Design tokens & component refinements. One scale for type, spacing, control heights, radii and motion,
   used by the components below. Colours, glass and themes are the tokens at the top of this file.
   ===================================================================================================== */
:root {
  --font-ui: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --fs-xs: 12px; --fs-sm: 13px; --fs-base: 14px; --fs-md: 15px; --fs-lg: 17px; --fs-xl: 20px; --fs-2xl: 24px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  --ctl-h: 38px; --ctl-h-sm: 32px;
  --row-y: 10px; --row-x: 12px;
  --dur-fast: 120ms; --dur: 180ms; --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ring: 0 0 0 3px color-mix(in srgb, var(--focus) 30%, transparent);
  --ring-bad: 0 0 0 3px color-mix(in srgb, var(--bad) 22%, transparent);
}
@media (pointer: coarse) { :root { --ctl-h: 44px; --ctl-h-sm: 40px; } }

body { font-family: var(--font-ui); }
h1, h2, .modal-head h2 { font-family: var(--font-display); }
h1 { font-size: var(--fs-2xl); letter-spacing: -.02em; }
.page-head { margin-bottom: var(--sp-5); }
.section-title { margin: 28px 0 12px; }
.section-title h2 { font-size: var(--fs-lg); letter-spacing: -.01em; }
.card h3, .dash-3 h3, .dash-section h3 { font-size: var(--fs-md); letter-spacing: -.005em; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- icons */
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn > .ic { width: 17px; height: 17px; margin-left: -2px; }
.btn-sm > .ic, summary.btn > .ic { width: 15px; height: 15px; margin-left: -1px; }
.btn-icon { padding: 0; width: var(--ctl-h-sm); min-width: var(--ctl-h-sm); }
.btn-icon > .ic { margin: 0; }

/* ---- buttons: one height scale, clear hover / pressed / focus / disabled states */
.btn { min-height: var(--ctl-h); gap: 7px; transition: background-color var(--dur-fast), border-color var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast); }
.btn-sm { min-height: var(--ctl-h-sm); }
.btn:hover:not([disabled]) { border-color: var(--ink-3); }
.btn-primary:hover:not([disabled]) { border-color: var(--accent-bg-hover); }
.btn:active:not([disabled]) { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---- fields: labels, required marker, hover / focus / invalid, errors under the field */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]), select, .select-trigger { min-height: var(--ctl-h); }
input, select, textarea, .select-trigger { transition: border-color var(--dur-fast), box-shadow var(--dur-fast); }
input:hover:not(:disabled):not(:focus):not([type="checkbox"]):not([type="radio"]), textarea:hover:not(:disabled):not(:focus) { border-color: var(--ink-3); }
/* Focus: the border plus a soft ring (an outline stays for Windows high-contrast mode, where shadows vanish). */
input:focus-visible, select:focus-visible, textarea:focus-visible, .select-trigger:focus-visible {
  outline: 2px solid transparent; outline-offset: 0; border-color: var(--focus); box-shadow: var(--ring); }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; box-shadow: none; }
[aria-invalid="true"], [aria-invalid="true"]:hover { border-color: var(--bad) !important; }
[aria-invalid="true"]:focus-visible { box-shadow: var(--ring-bad); }
.field { gap: 6px; }
.field label { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: var(--fs-xs); line-height: 1.4; }
.req { color: var(--bad); font-weight: 700; }
.field-error { display: flex; gap: 6px; align-items: flex-start; color: var(--bad); font-size: var(--fs-sm); font-weight: 550; line-height: 1.35; }
.field-error .ic { width: 15px; height: 15px; margin-top: 1px; }
.form-grid { gap: 16px 18px; }
fieldset { padding: 14px 16px 16px; }
legend { font-size: var(--fs-sm); color: var(--ink-2); }
.form-error { display: flex; gap: 8px; align-items: flex-start; }

/* ---- dialogs: clear title, roomy body, a footer band that always shows Cancel / Save */
.modal-head { padding: 18px 22px 14px; }
.modal-head h2 { font-size: 18px; letter-spacing: -.01em; }
.modal-body { padding: 20px 22px 22px; }
.modal-foot { padding: 14px 22px; background: color-mix(in srgb, var(--surface-2) 60%, var(--surface)); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.modal[open] { animation: dlg-in var(--dur) var(--ease-out); }
.modal[open]::backdrop { animation: dlg-fade var(--dur) ease-out; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }
@keyframes dlg-fade { from { opacity: 0; } }
@media (max-width: 600px), (max-height: 520px) and (orientation: landscape) {
  .modal-foot { border-radius: 0; }
  .modal-head { padding: 8px 6px 8px 16px; }
  .modal-body { padding: 16px 16px 22px; }
}

/* ---- notifications */
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 18px 11px 14px; box-shadow: var(--shadow-pop); }
.toast .toast-ic { width: 18px; height: 18px; flex: none; }

/* ---- loading: a small spinner with the words (pages and cards); placeholder rows in tables */
#view > .loading, .card .loading { display: flex; align-items: center; justify-content: center; gap: 10px; }
#view > .loading::before, .card .loading::before { content: ""; width: 16px; height: 16px; border-radius: 50%; flex: none;
  border: 2px solid color-mix(in srgb, var(--ink-3) 30%, transparent); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sk { display: block; height: 10px; border-radius: 5px; background: var(--muted-bg); }
.sk-h { height: 8px; width: 55%; }
.dt-skeleton td, .dt-skeleton th { padding: 15px 12px; }
@media (prefers-reduced-motion: no-preference) {
  .sk { background: linear-gradient(90deg, var(--muted-bg) 0 40%, var(--surface-2) 50%, var(--muted-bg) 60% 100%); background-size: 300% 100%;
    animation: sk-shine 1.4s ease-in-out infinite; }
}
@keyframes sk-shine { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ---- empty states */
.empty-state { display: grid; justify-items: center; gap: 8px; padding: 44px 20px; text-align: center; color: var(--ink-2); }
.empty-state > .ic { width: 38px; height: 38px; stroke-width: 1.4; color: var(--ink-3); margin-bottom: 4px; }
.empty-state p { margin: 0; max-width: 46ch; }
.empty-title { font-weight: 650; font-size: var(--fs-md); color: var(--ink); }
.empty-state .btn { margin-top: 6px; }

/* ---- tables: tidy headers, density, column widths, sort that shows on hover, date filters, pages */
.dt-table th { font-size: var(--fs-xs); letter-spacing: .01em; padding: 10px var(--row-x); vertical-align: middle; }
.dt-table td { padding: var(--row-y) var(--row-x); }
.dt-compact { --row-y: 6px; --row-x: 10px; }
.dt-compact .dt-table td { font-size: var(--fs-sm); }
.dt-compact .dt-table td .sub { font-size: var(--fs-xs); }
.dt-table td.col-supplier { min-width: 150px; }
.dt-table td.col-status, .dt-table td.col-selling_price, .dt-table td.col-sale_date { white-space: nowrap; }
.dt-table tbody tr.clickable { transition: background-color var(--dur-fast); }
.th-sort { gap: 4px; }
.th-sort .sort-ind { font-size: 12px; width: 10px; text-align: center; }
th:not([aria-sort="ascending"]):not([aria-sort="descending"]) .sort-ind { visibility: hidden; }
th:hover .sort-ind, .th-sort:focus-visible .sort-ind { visibility: visible; }
@media (hover: none) { th .sort-ind { visibility: visible; } }
th[aria-sort="ascending"] .th-sort, th[aria-sort="descending"] .th-sort { color: var(--ink); }
.dt-date { display: flex; align-items: center; gap: 6px; min-height: var(--ctl-h); padding: 0 4px 0 10px; min-width: 0;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
.dt-date > span { font-size: var(--fs-xs); font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.dt-date > input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 0 4px; min-height: calc(var(--ctl-h) - 2px); }
.dt-date > input:focus-visible { box-shadow: none; }
.dt-date:focus-within { border-color: var(--focus); box-shadow: var(--ring); }
.dt-date:hover:not(:focus-within) { border-color: var(--ink-3); }
.dt-filter-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 2px; border-radius: 999px;
  background: var(--accent-bg); color: var(--accent-ink); font-size: 11px; font-weight: 700; }
.dt-chips { margin: 0 0 10px; align-items: center; }
.chip { display: inline-flex; gap: 4px; align-items: center; min-height: 28px; background: var(--accent-soft); color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.chip:hover { background: var(--accent-soft-hover); border-color: var(--accent); }
.dt-foot { margin-top: 12px; }
.dt-per select { min-height: var(--ctl-h-sm); margin-left: 6px; padding-top: 3px; padding-bottom: 3px; }
.pager { display: flex; align-items: center; gap: 4px; }
.pager-pages { display: flex; align-items: center; gap: 4px; }
.pager-n { min-width: var(--ctl-h-sm); padding: 0 8px; font-variant-numeric: tabular-nums; }
.pager-n.on { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); font-weight: 700; }
.pager-gap { padding: 0 2px; color: var(--ink-3); }
.pager-of { display: none; padding: 0 6px; }
@media (max-width: 600px) {
  .pager { justify-content: space-between; }
  .pager-pages { display: none; }
  .pager-of { display: inline; }
}
.dt-cols-pop .pop-title { font-size: var(--fs-xs); font-weight: 650; color: var(--ink-2); margin: 2px 0 2px; }
.dt-cols-pop .pop-title:not(:first-child) { margin-top: 8px; }
.seg-sm button { min-height: 30px; font-size: var(--fs-sm); padding: 4px 10px; }

/* ---- dashboard: the headline figure first, labels on one line, notes aligned at the bottom of each card */
.kpi { display: flex; flex-direction: column; padding: 16px 18px; }
.kpi-label { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); line-height: 1.3; padding-right: 22px; }
.kpi .owner-tag { position: absolute; top: 13px; right: 12px; margin: 0; }
.kpi-link .owner-tag { right: 32px; }
.kpi-label:has(.owner-tag) { padding-right: 60px; }
.kpi-value { margin-top: 8px; }
.kpi-note { margin-top: auto; padding-top: 6px; font-size: var(--fs-xs); line-height: 1.4; }
.kpi-primary { background: linear-gradient(180deg, color-mix(in srgb, var(--accent-soft) 75%, var(--surface)), var(--surface) 75%);
  border-color: color-mix(in srgb, var(--accent) 28%, var(--card-edge)); }
.kpi-primary .kpi-label { color: var(--accent); }
.kpi-link { transition: border-color var(--dur-fast), box-shadow var(--dur-fast), background-color var(--dur-fast); }
.kpi-link:hover { box-shadow: var(--glass-highlight), var(--glass-shadow); }
.kpi-primary.kpi-link:hover { background: linear-gradient(180deg, var(--accent-soft-hover), var(--surface) 80%); }

/* ---- the rest of the app: other tables, empty messages, page tabs, settings cards - same scale as above */
.card table:not(.figures):not(.dt-table) th { font-size: var(--fs-xs); padding: 9px var(--row-x); vertical-align: middle; }
.card table:not(.figures):not(.dt-table):not(.list-compact) td { padding: var(--row-y) var(--row-x); }
/* Every "nothing here" message gets the same quiet icon above its words (an error one gets a warning sign). */
div.empty { display: grid; justify-items: center; gap: 8px; padding: 36px 20px; color: var(--ink-2); text-align: center; }
div.empty::before { content: ""; width: 32px; height: 32px; background: var(--ink-3);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 13.5 6 5.5h12l2.5 8V19a1 1 0 0 1-1 1h-15a1 1 0 0 1-1-1zM3.5 13.5H9l1 2h4l1-2h5.5'/%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' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 13.5 6 5.5h12l2.5 8V19a1 1 0 0 1-1 1h-15a1 1 0 0 1-1-1zM3.5 13.5H9l1 2h4l1-2h5.5'/%3E%3C/svg%3E") center / contain no-repeat; }
div.empty.bad { color: var(--bad); }
div.empty.bad::before { background: var(--bad); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.5 2.8 19.5h18.4zM12 9.5v4.5M12 17v.4'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.5 2.8 19.5h18.4zM12 9.5v4.5M12 17v.4'/%3E%3C/svg%3E"); }
td.empty { padding: 28px 16px; color: var(--ink-2); }
.empty-inline { border: 1px dashed var(--border-strong); background: transparent; }
/* Toolbars outside the data tables (personal finances, incoming stock, returns) line up the same way. */
.toolbar { gap: 8px; }
.card .toolbar:last-child { margin-bottom: 0; }
.card-pad > h3:first-child, .card-pad > .section-title:first-child h3 { margin-bottom: 12px; }
.notice { border-radius: var(--radius-sm); }
.banner { border-radius: var(--radius); }
.badge { font-size: var(--fs-xs); padding: 2px 9px; }
.kv dt { font-size: var(--fs-sm); }

/* ---- tabs (personal finances, returns & faults): one glass strip; the chosen tab sits on a solid chip */
.tabs { display: flex; gap: 2px; padding: 4px; margin: 2px 0 16px; overflow-x: auto; scrollbar-width: none; max-width: 100%; width: max-content;
  background-color: var(--glass-bg-bar); background-image: var(--glass-sheen); border: 1px solid var(--glass-edge); border-radius: 12px;
  box-shadow: var(--glass-highlight); }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; border: 0; background: transparent; color: var(--ink-2); font: inherit; font-weight: 550; padding: 6px 13px; border-radius: 9px;
  min-height: var(--ctl-h-sm); cursor: pointer; white-space: nowrap; transition: background-color var(--dur-fast), color var(--dur-fast); }
.tab:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
.tab.on { background: var(--surface); color: var(--accent); font-weight: 650; box-shadow: 0 1px 2px rgba(16,24,40,.08), inset 0 0 0 1px var(--card-edge); }
.tab:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

/* ---- Settings → Appearance: display mode, colour theme cards, comfort options */
.appear-legend { font-size: var(--fs-sm); font-weight: 650; color: var(--ink-2); padding: 0; margin: 10px 0 8px; }
.theme-choice legend.appear-legend { margin-top: 0; }
/* Colour theme cards: each card's preview carries data-palette, so it is drawn with that theme's own tokens in the
   current mode (light or dark) - the same tokens the app uses, not a picture. */
.palette-choice { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 10px; border: 0; padding: 0; }
.palette-card { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 8px 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); cursor: pointer; transition: border-color var(--dur-fast), box-shadow var(--dur-fast); }
.palette-card:hover { border-color: var(--border-strong); }
.palette-card input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.palette-card:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.palette-card:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.pal-head { display: flex; align-items: center; gap: 8px; padding: 0 4px; min-height: 22px; }
.pal-name { font-weight: 650; font-size: var(--fs-sm); color: var(--ink); }
.pal-blurb { display: block; font-size: var(--fs-xs); color: var(--ink-3); padding: 0 4px; margin-top: -6px; }
.palette-card .pal-check { margin-left: auto; width: 18px; height: 18px; color: var(--accent); visibility: hidden; stroke-width: 2.4; }
.palette-card:has(input:checked) .pal-check { visibility: visible; }
.pal-dots { display: flex; gap: 4px; padding: 0 4px; }
.pal-dots i { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .14); }
:root[data-theme="dark"] .pal-dots i { box-shadow: inset 0 0 0 1px rgb(255 255 255 / .16); }
/* the little app: a sidebar with the selected page, a figure card with a button, and a two-series chart */
.pal-preview { display: grid; grid-template-columns: 30% 1fr; gap: 5px; height: 96px; padding: 5px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border); color: var(--ink); pointer-events: none;
  background: radial-gradient(140% 120% at 0% 0%, rgb(var(--tint-1-rgb) / var(--tint-1-a)), transparent 60%),
    radial-gradient(120% 120% at 100% 0%, rgb(var(--tint-2-rgb) / var(--tint-2-a)), transparent 60%), linear-gradient(160deg, var(--page), var(--page-low)); }
.pal-side { display: flex; flex-direction: column; gap: 4px; padding: 6px 5px; border-radius: 7px; background: rgb(var(--glass-rgb) / .7); border: 1px solid var(--border); }
.pal-side b { display: block; height: 5px; border-radius: 3px; background: var(--ink-3); opacity: .45; }
.pal-side b.on { height: 9px; background: var(--accent-bg); opacity: 1; }
.pal-main { display: grid; grid-template-rows: auto 1fr; gap: 5px; min-width: 0; }
.pal-card { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; padding: 5px 6px; border-radius: 7px; background: var(--surface); border: 1px solid var(--border); }
.pal-card .pal-fig { font-size: 11px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; color: var(--ink); }
.pal-card .pal-lbl { display: block; height: 4px; width: 26px; border-radius: 2px; background: var(--ink-3); opacity: .5; margin-bottom: 3px; }
.pal-card .pal-btn { margin-left: auto; height: 14px; padding: 0 7px; border-radius: 5px; background: var(--accent-bg); color: var(--accent-ink);
  font-size: 8.5px; font-weight: 650; line-height: 14px; white-space: nowrap; flex: none; }
.pal-chart { position: relative; border-radius: 7px; background: var(--surface); border: 1px solid var(--border); overflow: hidden; }
.pal-chart svg { position: absolute; inset: 4px 6px; width: calc(100% - 12px); height: calc(100% - 8px); }
.pal-chart .c1 { fill: var(--series-1); }
.pal-chart .c2 { fill: none; stroke: var(--series-2); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.pal-chart .grid { stroke: var(--grid); stroke-width: 1; vector-effect: non-scaling-stroke; }
/* Settings: Appearance takes the full width, so the six theme cards sit side by side and compare fairly. */
.two-col > #appearance-card { grid-column: 1 / -1; }
#appearance-card .theme-choice { max-width: 560px; }
.appear-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 2px 0 12px; }
@media (min-width: 1400px) { .palette-choice { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 600px) { .palette-choice { grid-template-columns: repeat(2, minmax(0, 1fr)); } .pal-preview { height: 84px; } }
@media (max-width: 380px) { .palette-choice { grid-template-columns: minmax(0, 1fr); } }

/* ---- permanent deletion of mistaken stock: a quiet trash button on stock rows (red on hover / focus), and the
   confirmation's identifier summary, warning and list of what blocks it */
.dt-table .row-del { margin-left: 4px; color: var(--ink-3); vertical-align: middle; }
.dt-table .row-del:hover, .dt-table .row-del:focus-visible { color: var(--bad); background: var(--bad-bg);
  border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.del-summary { padding: 12px 14px; margin: 0 0 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.del-summary dd.mono { font-size: var(--fs-sm); letter-spacing: .02em; }
.del-why { display: flex; gap: 10px; align-items: flex-start; }
.del-why > .ic { color: var(--warn); margin-top: 1px; }
.del-blockers { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.del-blockers li { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.del-blockers li .sub { margin: 2px 0 0; }
.del-blockers li .btn { margin-top: 8px; }

/* ---- bulk registration: the note telling unsaved drafts (Remove) apart from saved stock (Delete permanently) */
.draft-vs-stock { display: flex; gap: 8px; align-items: flex-start; margin: 14px 0 8px; }
.draft-vs-stock > .ic { color: var(--accent); margin-top: 1px; }

/* =====================================================================================================
   Dashboard V2: a floating frosted sidebar with icons, a deeper backdrop washed from the colour theme's own two
   tints (royal blue and sky in the default Sapphire theme), and the dashboard's cards, charts and recent-sales table.
   Everything below uses the theme tokens, so Light / Dark / System, all six colour themes and Reduce transparency
   keep working: with glass off (Reduce transparency, or no blur support) every surface here is solid.
   ===================================================================================================== */
:root[data-glass="on"] {
  /* The washes use the theme's own strengths (--tint-*-a, from make_themes.py, which checks text contrast against
     exactly this backdrop with every wash stacked at its strongest). Change one here and there together. */
  --page-gradient:
    radial-gradient(1200px 820px at 0% 0%, rgb(var(--tint-1-rgb) / var(--tint-1-a)), transparent 64%),
    radial-gradient(1000px 760px at 100% 8%, rgb(var(--tint-2-rgb) / var(--tint-2-a)), transparent 62%),
    radial-gradient(1100px 800px at 65% 100%, rgb(var(--tint-2-rgb) / var(--tint-3-a)), transparent 64%),
    linear-gradient(160deg, var(--page), var(--page-low));
}

/* ---- sidebar: a slim panel floating on the backdrop, tinted with the theme's two colours */
.shell { grid-template-columns: 236px minmax(0, 1fr); }
.sidebar { margin: 12px 0 12px 12px; top: 12px; height: calc(100vh - 24px); height: calc(100dvh - 24px); padding: 16px 12px;
  border-width: 1px; border-radius: 20px; scrollbar-width: thin; }
:root[data-glass="on"] .sidebar {
  background-image: var(--glass-sheen), linear-gradient(180deg, rgb(var(--tint-1-rgb) / .08), rgb(var(--tint-2-rgb) / .08));
}
.brand { padding: 2px 6px 16px; }
.nav { gap: 1px; }
.nav-group { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 14px 10px 4px; }
.nav-group:first-child { margin-top: 0; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; font-size: 13.5px; min-height: 36px;
  transition: background-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out); }
.nav a .ic { width: 17px; height: 17px; color: var(--ink-3); transition: color var(--dur) var(--ease-out); }
.nav a:hover .ic { color: var(--ink-2); }
.nav-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The page you're on: a filled pill in the theme's button colour (white text keeps 4.5:1 on it in every theme). */
.nav a.active, .nav a.active:hover { background: linear-gradient(135deg, var(--accent-bg), var(--accent-bg-hover)); color: var(--accent-ink);
  box-shadow: var(--btn-highlight), 0 6px 16px -6px color-mix(in srgb, var(--accent-bg) 70%, transparent); }
.nav a.active .ic { color: var(--accent-ink); }
.nav a.active:focus-visible { outline-offset: 2px; }
.sidebar-foot { margin: auto 0 0; padding: 12px 8px 0; }
@media (pointer: coarse) { .nav a { min-height: 44px; } }
@media (min-width: 821px) and (max-width: 1100px) and (min-height: 521px) {
  .shell { grid-template-columns: 212px minmax(0, 1fr); }
}
/* Phones and small tablets: back to the full-width top bar with its Menu button (the menu folds away). */
@media (max-width: 820px), (max-height: 520px) and (orientation: landscape) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { margin: 0; top: 0; height: auto; border-radius: 0; border-width: 0 0 1px 0; padding: 8px 12px; }
  .nav-group { margin: 12px 12px 4px; }
  .nav a { font-size: 15px; padding: 10px 12px; min-height: 44px; }
}

/* ---- dashboard surfaces: rounded cards with a soft glass edge; mostly opaque so figures stay crisp */
.dash-card { border-radius: var(--radius-lg); }
:root[data-glass="on"] .dash-card {
  background-color: rgb(var(--glass-rgb) / .82); background-image: var(--glass-sheen);
  border-color: var(--glass-edge); box-shadow: var(--glass-highlight), var(--glass-ring), var(--card-shadow);
}
:root[data-glass="on"] .kpi-primary { background-image: linear-gradient(180deg, color-mix(in srgb, var(--accent-soft) 85%, transparent), transparent 80%); }
:root[data-glass="on"] .kpi-link.dash-card:hover { background-color: rgb(var(--glass-rgb) / .94); }

/* ---- top bar: title and greeting, date range, New sale / Scan to sell, the account button */
.dash-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 14px 12px 18px; border-radius: var(--radius-lg); }
.dash-title { flex: 1 1 auto; min-width: 0; }
.dash-title h1 { font-size: 22px; line-height: 1.2; }
.dash-greet { font-size: var(--fs-sm); color: var(--ink-3); margin-top: 2px; }
.dash-range { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.dash-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.period-caption { margin: 10px 4px 0; font-size: var(--fs-sm); }
.profile-menu { position: relative; }
.profile-menu > summary { list-style: none; }
.profile-menu > summary::-webkit-details-marker { display: none; }
.profile-chip { display: flex; align-items: center; gap: 9px; padding: 3px 12px 3px 3px; min-height: var(--ctl-h); border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; }
.profile-chip:hover { border-color: var(--ink-3); }
.profile-chip:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; flex: none; font-size: 12px; font-weight: 700;
  letter-spacing: .02em; color: var(--accent-ink); background: linear-gradient(135deg, var(--accent-bg), var(--accent-bg-hover)); box-shadow: var(--btn-highlight); }
.profile-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.profile-text b { font-size: var(--fs-sm); font-weight: 650; white-space: nowrap; }
.profile-text span { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.profile-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; min-width: 240px; padding: 6px; display: grid; gap: 2px;
  background-color: var(--glass-bg-pop); background-image: var(--glass-sheen); border: 1px solid var(--glass-edge); border-radius: 14px;
  -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter); box-shadow: var(--glass-highlight), var(--glass-ring), var(--shadow-pop); }
.profile-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--glass-edge); margin-bottom: 4px; }
.profile-head .sub { font-size: var(--fs-xs); color: var(--ink-3); margin-top: 2px; }
.profile-pop a, .profile-pop button { display: flex; align-items: center; gap: 10px; padding: 9px 10px; min-height: 40px; border-radius: 8px; border: 0;
  background: none; color: var(--ink); font: inherit; text-decoration: none; text-align: left; cursor: pointer; }
.profile-pop a:hover, .profile-pop button:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.profile-pop .ic { color: var(--ink-3); }
@media (max-width: 1240px) { .profile-text { display: none; } .profile-chip { padding: 3px; } }

/* ---- summary cards: four across on computers, two on tablets and phones */
.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1100px) { .kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .kpis-owner { grid-template-columns: minmax(0, 1fr); } .kpis-4 { gap: 10px; } }
@media (max-width: 359px) { .kpis-4 { grid-template-columns: minmax(0, 1fr); } }
.kpi.dash-card { padding: 16px 18px 16px; }
.kpi-top { display: flex; align-items: center; gap: 8px; min-height: 34px; margin-bottom: 12px; }
.kpi-top .scope { margin-left: auto; }
.kpi-link .kpi-top .scope { margin-right: 22px; }
.kpi-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--accent);
  background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 16%, transparent); }
.kpi-ic .ic { width: 18px; height: 18px; }
.kpi.dash-card .kpi-go { top: 23px; right: 14px; }
.kpi.dash-card .kpi-label { padding-right: 0; }
@media (max-width: 600px) {
  .kpi.dash-card { padding: 12px 13px 13px; }
  .kpi-top { margin-bottom: 8px; min-height: 30px; }
  .kpi-ic { width: 30px; height: 30px; border-radius: 9px; }
  .kpi-top .scope { font-size: 11px; padding: 1px 7px; }
}

/* ---- "needs attention" shortcuts under the cards: money owed, credit due, low stock */
.dash-attn { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.attn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 10px 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink); font: inherit; font-size: var(--fs-sm);
  text-decoration: none; cursor: pointer; box-shadow: var(--glass-highlight); transition: border-color var(--dur-fast), background-color var(--dur-fast); }
.attn:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.attn > .ic:last-child { width: 15px; height: 15px; color: var(--ink-3); }
.attn-bad > .ic:first-child { color: var(--bad); }
.attn-warn > .ic:first-child { color: var(--warn); }
.attn-info > .ic:first-child { color: var(--info); }
@media (pointer: coarse) { .attn { min-height: 44px; } }
@media (max-width: 600px) { .attn { flex: 1 1 100%; border-radius: 12px; } .attn > span { flex: 1; } }

/* ---- owner-only figures: their own band, marked with a lock */
.owner-zone .section-title { margin-top: 4px; }
.owner-zone .section-title h2 { display: inline-flex; align-items: center; gap: 8px; color: var(--sample); }
.owner-zone .section-title h2 .ic { width: 17px; height: 17px; }

/* ---- charts row: a wide sales trend beside a smaller stock status donut; stacked on tablets and phones */
.dash-charts { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 14px; align-items: stretch; }
@media (max-width: 1080px) { .dash-charts { grid-template-columns: minmax(0, 1fr); } }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h3, .dash-section .card-head h3 { margin: 0; font-size: var(--fs-md); }
.card-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-3); }
.chart-note { margin: 10px 0 0; }

.donut-wrap { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 16px; align-items: center; }
.donut { width: 148px; height: 148px; display: block; }
.donut circle { fill: none; }
.donut-track { stroke: var(--muted-bg); }
.donut-total { fill: var(--ink); font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.donut-cap { fill: var(--ink-3); font-size: 10.5px; }
.seg-available { stroke: var(--good); }   .seg-bg-available { background: var(--good); }
.seg-inspection { stroke: var(--info); }  .seg-bg-inspection { background: var(--info); }
.seg-faulty { stroke: var(--bad); }       .seg-bg-faulty { background: var(--bad); }
.seg-reserved { stroke: var(--warn); }    .seg-bg-reserved { background: var(--warn); }
.donut-legend, .donut-away { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.donut-legend a { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 38px; gap: 8px; align-items: center; padding: 7px 6px;
  border-radius: 8px; color: var(--ink); text-decoration: none; font-size: var(--fs-sm); min-height: 36px; }
.donut-legend .dot { width: 10px; height: 10px; margin: 0; }
.donut-legend .lg-n { font-variant-numeric: tabular-nums; }
.donut-legend .lg-pct { color: var(--ink-3); font-size: var(--fs-xs); text-align: right; font-variant-numeric: tabular-nums; }
.donut-legend a:hover, .donut-away a:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.donut-away { margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--border-strong); }
.donut-away a { display: flex; align-items: center; gap: 10px; padding: 7px 6px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: var(--fs-sm); min-height: 36px; }
.donut-away a > .ic { color: var(--ink-3); }
.donut-away a > b { margin-left: auto; font-variant-numeric: tabular-nums; }
.donut-away .sub { display: block; font-size: var(--fs-xs); color: var(--ink-3); }
.donut-foot { margin: 8px 0 0; }
@media (pointer: coarse) { .donut-legend a, .donut-away a { min-height: 44px; } }
@media (max-width: 380px) { .donut-wrap { grid-template-columns: minmax(0, 1fr); justify-items: center; } .donut-legend { width: 100%; } }

/* ---- recent sales */
.view-all { display: inline-flex; align-items: center; gap: 2px; padding: 6px 6px 6px 10px; border-radius: 8px; font-weight: 600;
  font-size: var(--fs-sm); color: var(--accent); text-decoration: none; min-height: 34px; }
.view-all:hover { background: var(--accent-soft-hover); }
.view-all .ic { width: 16px; height: 16px; }
@media (pointer: coarse) { .view-all { min-height: 44px; } }
table.recent th { background: transparent; border-bottom: 1px solid var(--border-strong); }
table.recent td { vertical-align: middle; }
table.recent .rs-status .badge { white-space: nowrap; }
/* Phones: each sale becomes a short card - item and amount, customer and payment, then date and balance. */
@media (max-width: 600px) {
  table.recent thead { display: none; }
  table.recent tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "item amt" "cust status" "date bal";
    gap: 2px 12px; padding: 10px 2px; border-bottom: 1px solid var(--border); }
  table.recent tbody tr:last-child { border-bottom: 0; }
  table.recent td { padding: 0; border: 0; }
  table.recent .rs-item { grid-area: item; font-weight: 600; }
  table.recent .rs-amt { grid-area: amt; }
  table.recent .rs-cust { grid-area: cust; color: var(--ink-2); font-size: var(--fs-sm); }
  table.recent .rs-status { grid-area: status; text-align: right; }
  table.recent .rs-date { grid-area: date; font-size: var(--fs-xs); color: var(--ink-3); }
  table.recent .rs-date .sub { display: inline; margin-left: 4px; }
  table.recent .rs-bal { grid-area: bal; font-size: var(--fs-sm); }
}

.dash-pair { margin-top: 14px; }

/* =====================================================================================================
   Dashboard V3 - "calm ledger on glass". Glass stays on the frame (sidebar, top bar, date control, menus); the
   figures sit on near-solid cards so naira amounts read crisply. Headline amounts set the ₦ sign smaller and
   lighter than the digits (.money, from dashboard.js money()). All colours are theme tokens, so Light / Dark /
   System, the six colour themes, Reduce transparency and Reduce motion keep working.
   ===================================================================================================== */
:root {
  --chart-rev: var(--series-1);        /* net revenue columns */
  --chart-profit: var(--series-2);     /* owner's gross profit line */
  --dash-gap: 16px;
}
@media (max-width: 600px) { :root { --dash-gap: 12px; } }

/* ---- money: tabular digits, a smaller lighter ₦, a true minus sign */
.money { font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.money .m-cur { font-size: .64em; font-weight: 600; color: var(--ink-3); margin-right: .1em; vertical-align: .2em; letter-spacing: 0; }
.money .m-minus { margin-right: .05em; }
.money.is-neg, .neg .money { color: var(--bad); }
.money.is-neg .m-cur, .neg .money .m-cur { color: inherit; opacity: .8; }

/* ---- cards: near-solid on glass, so figures never sit on a busy backdrop */
:root[data-glass="on"] .dash-card { background-color: rgb(var(--glass-rgb) / .9); }
.dash-section { margin-top: var(--dash-gap); }
.dash-section > .grid, .dash-charts { gap: var(--dash-gap); }

/* ---- top bar: title + actions, then the date control and the period it covers */
.dash-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "title actions" "range range";
  align-items: center; gap: 12px 16px; padding: 14px 16px 14px 20px; margin-bottom: 0; }
.dash-title { grid-area: title; }
.dash-actions { grid-area: actions; justify-self: end; }
.dash-range { grid-area: range; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.dash-greet { font-size: var(--fs-sm); color: var(--ink-2); }
.dash-top .period-caption { display: flex; align-items: center; gap: 6px; margin: 0; flex: 1 1 280px; min-width: 0; font-size: var(--fs-sm); color: var(--ink-2); }
.dash-top .period-caption .ic { width: 15px; height: 15px; color: var(--ink-3); flex: none; }
.dash-top .period-caption .muted { color: var(--ink-3); }
.dash-range .period-custom { flex: 1 1 100%; }
.period-meta { margin: 8px 4px 0; font-size: var(--fs-xs); color: var(--ink-3); }
.period-meta + .dash-section { margin-top: 10px; }
/* Wide screens: one row - title, date control, actions - so the floating bar stays short while figures scroll under it. */
@media (min-width: 1400px) {
  .dash-top { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "title range actions"; }
  .dash-range { justify-content: center; }
  .dash-top .period-caption { flex: 1 1 100%; justify-content: center; }
}
/* Choosing custom dates makes the bar taller: it scrolls away with the page meanwhile instead of covering figures. */
.period-bar.dash-top:has(.period-custom:not([hidden])) { position: relative; top: auto; }
/* Not quite room for the account name too: the avatar alone (the name is in its menu and the sidebar). */
@media (min-width: 1400px) and (max-width: 1599px) { .dash-top .profile-text { display: none; } .dash-top .profile-chip { padding: 3px; } }
/* Below that the bar has two rows, so it scrolls away with the page instead of covering the figures. */
@media (min-width: 821px) and (max-width: 1399px) and (min-height: 521px) { .period-bar.dash-top { position: relative; top: auto; } }

/* ---- the date control: one glass capsule; a highlight glides to the chosen range */
.seg.seg-glass { position: relative; display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; overflow: visible;
  border: 1px solid var(--glass-edge); background: color-mix(in srgb, var(--ink) 6%, transparent); box-shadow: inset 0 1px 2px rgb(0 0 0 / .06); }
.seg.seg-glass button { position: relative; z-index: 1; border: 0; border-radius: 9px; min-height: 32px; padding: 5px 12px;
  color: var(--ink-2); font-size: var(--fs-sm); font-weight: 550; background: transparent; white-space: nowrap;
  transition: color var(--dur-fast), background-color var(--dur-fast); }
.seg.seg-glass button + button { border-left: 0; }
.seg.seg-glass button:hover:not(.on) { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.seg.seg-glass button.on { color: var(--accent); font-weight: 650; background: var(--surface); box-shadow: 0 0 0 1px var(--border), 0 1px 2px rgb(16 24 40 / .1); }
.seg.seg-glass button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.seg.seg-glass.has-thumb button.on { background: transparent; box-shadow: none; }
.seg-thumb { position: absolute; left: 0; top: 3px; bottom: 3px; width: 0; border-radius: 9px; opacity: 0; pointer-events: none; z-index: 0;
  background: var(--surface); box-shadow: var(--glass-highlight), 0 1px 3px rgb(16 24 40 / .14), 0 0 0 1px color-mix(in srgb, var(--accent) 24%, var(--border)); }
.seg-thumb.glide { transition: transform 260ms var(--ease-out), width 260ms var(--ease-out); }
.l-short { display: none; }
@media (pointer: coarse) { .seg.seg-glass button { min-height: 44px; } }

/* ---- headline cards: label line, figure, note. Net revenue leads (wider on computers). */
.kpis-4 { grid-template-columns: minmax(0, 1.3fr) repeat(3, minmax(0, 1fr)); gap: var(--dash-gap); }
@media (max-width: 1100px) { .kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi.dash-card { padding: 16px 18px 16px; transition: border-color var(--dur-fast), box-shadow var(--dur), transform var(--dur) var(--ease-out), background-color var(--dur-fast); }
.kpi-top { gap: 10px; min-height: 28px; margin-bottom: 12px; }
.kpi-link .kpi-top { padding-right: 22px; }
.kpi-link .kpi-top .scope { margin-right: 0; }
.kpi-ic { width: 28px; height: 28px; border-radius: 8px; }
.kpi-ic .ic { width: 16px; height: 16px; }
.kpi-top .kpi-label { flex: 1 1 auto; min-width: 0; padding: 0; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2);
  overflow-wrap: break-word; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.25; }
.kpi.dash-card .kpi-go { top: 20px; right: 14px; }
.kpi-value { margin-top: 0; font-size: 28px; font-weight: 680; letter-spacing: -.025em; line-height: 1.1; }
.kpi-primary .kpi-value { font-size: 32px; }
@supports (container-type: inline-size) {
  .kpi-value { font-size: clamp(20px, 13cqi, 30px); }
  .kpi-primary .kpi-value { font-size: clamp(22px, 13.5cqi, 34px); }
}
.kpi-primary .kpi-label { color: var(--accent); }
.kpi-note { padding-top: 8px; color: var(--ink-3); }
.kpi-link:hover { transform: translateY(-1px); }
.kpi-link:active { transform: translateY(0); }

/* ---- "needs attention" shortcuts: tinted by what they are, each opens the records */
.dash-attn { gap: 8px; margin-top: 12px; }
.attn { border-radius: 12px; padding: 8px 12px 8px 12px; min-height: 42px; font-size: var(--fs-sm); }
.attn b { font-variant-numeric: tabular-nums; }
.attn-bad { background: color-mix(in srgb, var(--bad-bg) 65%, var(--surface)); border-color: color-mix(in srgb, var(--bad) 28%, var(--border)); }
.attn-warn { background: color-mix(in srgb, var(--warn-bg) 65%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 28%, var(--border)); }
.attn-info { background: color-mix(in srgb, var(--info-bg) 65%, var(--surface)); border-color: color-mix(in srgb, var(--info) 28%, var(--border)); }
.attn:hover { background: var(--surface); border-color: var(--border-strong); }
.attn:hover > .ic:last-child { color: var(--ink); transform: translateX(2px); }
.attn > .ic:last-child { transition: transform var(--dur) var(--ease-out), color var(--dur-fast); }
@media (pointer: coarse) { .attn, .profile-pop a, .profile-pop button { min-height: 44px; } }

/* ---- owner band: one panel, three figures side by side (stacked when narrow) - no cards inside cards */
.owner-zone { margin-top: calc(var(--dash-gap) + 4px); }
/* Neutral in every colour theme (a violet panel clashed with green, orange and pink themes); the lock and the
   "Owner only" label carry the meaning, and the small Owner tags keep the shared owner violet. */
.dash-card.owner-panel { padding: 16px 20px 18px; container: owner / inline-size; border-color: var(--border);
  background-image: linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 80%, transparent), transparent 70%); }
:root[data-glass="on"] .dash-card.owner-panel { border-color: var(--glass-edge);
  background-image: linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 70%, transparent), transparent 70%); }
.owner-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; margin-bottom: 14px; }
.owner-head h2 { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-md); color: var(--ink); }
.owner-lock { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--sample-bg);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--sample) 20%, transparent); }
.owner-lock .ic { width: 15px; height: 15px; color: var(--sample); }
.owner-head .small { color: var(--ink-2); }
.owner-metrics { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr); }
.om { display: flex; flex-direction: column; min-width: 0; padding: 2px 20px; border-left: 1px solid var(--border); container-type: inline-size; }
.om:first-child { padding-left: 0; border-left: 0; }
.om-label { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.om-label .scope { font-size: 11.5px; padding: 1px 8px; }
.om-value { margin-top: 8px; font-size: 26px; font-weight: 680; letter-spacing: -.025em; line-height: 1.1; white-space: nowrap; }
@supports (container-type: inline-size) { .om-value { font-size: clamp(20px, 12.5cqi, 30px); } }
.om-lead .om-value { font-size: 30px; }
@supports (container-type: inline-size) { .om-lead .om-value { font-size: clamp(22px, 13cqi, 34px); } }
.om-value.neg { color: var(--bad); }
.om-note { margin-top: auto; padding-top: 8px; font-size: var(--fs-xs); line-height: 1.45; color: var(--ink-3); }
@container owner (max-width: 620px) {
  .owner-metrics { grid-template-columns: minmax(0, 1fr); }
  .om { padding: 12px 0; border-left: 0; border-top: 1px solid var(--border); }
  .om:first-child { padding-top: 0; border-top: 0; }
  .om:last-child { padding-bottom: 0; }
}
.owner-panel .notice { margin-top: 14px; }

/* ---- sales trend: revenue columns from the ₦0 line, the owner's gross profit as a line on the same scale */
.chart .grid-line { stroke: color-mix(in srgb, var(--grid) 85%, transparent); }
.chart .axis-line { stroke: var(--border-strong); }
.chart-cols .bar-hit { fill: transparent; }
.chart-cols g.active .bar-hit, .chart-cols g[data-i]:focus-visible .bar-hit { fill: color-mix(in srgb, var(--ink) 5%, transparent); }
.chart-cols .rev-col { fill: var(--chart-rev); transition: opacity var(--dur-fast); }
.chart-cols .rev-col-neg { fill: color-mix(in srgb, var(--chart-rev) 45%, var(--surface)); stroke: var(--chart-rev); stroke-width: 1; }
.chart-cols:has(g.active) .rev-col { opacity: .5; }
.chart-cols g.active .rev-col { opacity: 1; }
.chart .profit-line { stroke: var(--chart-profit); stroke-width: 2; }
.chart-cols .profit-dot { fill: var(--chart-profit); stroke: var(--surface); stroke-width: 2; opacity: 0; pointer-events: none; }
.chart-cols .profit-dot.solo, .chart-cols g.active .profit-dot { opacity: 1; }
.chart-cols .no-sales { fill: var(--surface); stroke: var(--ink-3); }
.legend { gap: 16px; margin-bottom: 8px; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend .key { margin-right: 0; }
.legend .key-col { width: 10px; height: 12px; border-radius: 3px 3px 0 0; background: var(--chart-rev); }
.legend .key-line { width: 18px; height: 2px; border-radius: 2px; background: var(--chart-profit); }
.legend .owner-tag { margin-left: 2px; }
.chart-tip { border-radius: 12px; padding: 9px 12px; background-color: var(--glass-bg-pop); border-color: var(--glass-edge);
  -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter); box-shadow: var(--glass-highlight), var(--glass-ring), var(--shadow-pop); }

/* ---- detail ledgers: amounts line up, totals stand out */
table.figures td.num { font-variant-numeric: tabular-nums; }
table.figures tr.total td { border-bottom-color: var(--border-strong); }
table.figures tr.total td.num { font-size: var(--fs-md); }

/* ---- sidebar, menus and pop-ups: clearer states, a short settle-in when a menu opens */
.nav-group { font-size: 11px; letter-spacing: .07em; }
.nav a:active:not(.active) { background: color-mix(in srgb, var(--ink) 10%, transparent); }
.profile-chip { transition: border-color var(--dur-fast), box-shadow var(--dur-fast); }
.profile-menu[open] > .profile-chip { border-color: var(--focus); box-shadow: var(--ring); }
.profile-menu[open] .profile-pop, .menu-pop { animation: pop-in 160ms var(--ease-out); transform-origin: top right; }
.menu-pop { transform-origin: top left; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .profile-pop, .menu-pop { animation: none !important; } .kpi-link:hover { transform: none; } }
:root[data-motion="reduced"] .profile-pop, :root[data-motion="reduced"] .menu-pop { animation: none !important; }
:root[data-motion="reduced"] .kpi-link:hover { transform: none; }

/* ---- phones and small tablets: title + account, then New sale / Scan to sell, then the date control */
@media (max-width: 820px), (max-height: 520px) and (orientation: landscape) {
  .dash-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    grid-template-areas: "title title profile" "new scan scan" "range range range"; padding: 14px; gap: 12px 10px; }
  .dash-title h1 { font-size: 20px; }
  .dash-actions { display: contents; }
  .dash-actions .profile-menu { grid-area: profile; justify-self: end; }
  .dash-actions [data-newsale] { grid-area: new; }
  .dash-actions [data-scansell] { grid-area: scan; }
  .dash-actions > .btn { justify-content: center; min-height: 44px; }
  .dash-range { flex-direction: column; align-items: stretch; gap: 10px; }
  .seg.seg-glass { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); width: 100%; }
  .seg.seg-glass button { padding: 6px 4px; }
  .dash-top .period-caption { flex: none; }
}
@media (max-width: 600px) {
  .l-long { display: none; }
  .l-short { display: inline; }
  /* Money cards take the full width (long amounts stay big); the two counts share a row. */
  .kpis-4 > :nth-child(-n+2) { grid-column: 1 / -1; }
  .kpis-4 > :nth-child(n+3) .kpi-ic { display: none; }   /* half-width cards: room for the label */
  .kpi.dash-card { padding: 14px 16px; }
  .kpi-top { margin-bottom: 8px; }
  .dash-card.owner-panel { padding: 14px 16px 16px; }
}
@media (max-width: 359px) { .kpis-4 { grid-template-columns: minmax(0, 1fr); } }

/* ---- first load: the app's mark and a quiet "Loading…" on the backdrop until the sign-in screen or the app appears */
.boot { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--ink-2);
  font-size: var(--fs-sm); pointer-events: none; animation: boot-in 300ms ease-out 400ms backwards; }
#auth-screen:not([hidden]) ~ .boot, #app-shell:not([hidden]) ~ .boot { display: none; }
.boot-mark { position: relative; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-bg);
  box-shadow: var(--btn-highlight), 0 8px 24px -8px color-mix(in srgb, var(--accent-bg) 70%, transparent); animation: boot-pulse 1.4s ease-in-out infinite; }
.boot-mark::after { content: ""; position: absolute; left: 14px; top: 8px; width: 16px; height: 28px; border: 2.5px solid #fff; border-radius: 4px; box-sizing: border-box; }
@keyframes boot-in { from { opacity: 0; } }
@keyframes boot-pulse { 50% { transform: scale(.94); opacity: .8; } }
@media (prefers-reduced-motion: reduce) { .boot, .boot-mark { animation: none !important; } }
:root[data-motion="reduced"] .boot, :root[data-motion="reduced"] .boot-mark { animation: none !important; }

/* ---- updating another period: the figures stay put but dim (after a short pause, so quick loads don't flicker)
   and a thin bar runs along the bottom of the top bar. Reduced motion: the bar stands still. */
.dash-section, .period-meta { transition: opacity 160ms ease-out; }
#view.dash-busy .dash-section, #view.dash-busy .period-meta { opacity: .5; transition-delay: 150ms; pointer-events: none; }
@media (max-width: 820px), (max-height: 520px) and (orientation: landscape) { .dash-top { position: relative; } }
#view.dash-busy .dash-top::after { content: ""; position: absolute; left: 18px; right: 18px; bottom: 0; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent) no-repeat; background-size: 40% 100%;
  animation: dash-busy 1.1s linear infinite; }
@keyframes dash-busy { from { background-position: -60% 0; } to { background-position: 160% 0; } }
@media (prefers-reduced-motion: reduce) { #view.dash-busy .dash-top::after { animation: none; background: color-mix(in srgb, var(--accent) 55%, transparent); } }
:root[data-motion="reduced"] #view.dash-busy .dash-top::after { animation: none; background: color-mix(in srgb, var(--accent) 55%, transparent); }

/* ---- no sales in the period: the chart keeps its space and says why it's empty */
.chart-card { display: flex; flex-direction: column; }
.chart-card #chart-host { flex: 1 1 auto; display: flex; flex-direction: column; }
.chart-empty { flex: 1 1 auto; min-height: 210px; display: grid; place-content: center; justify-items: center; gap: 6px; padding: 24px;
  text-align: center; color: var(--ink-2); border: 1px dashed var(--border-strong); border-radius: 12px; }
.chart-empty .ic { width: 26px; height: 26px; color: var(--ink-3); margin-bottom: 2px; }
.chart-empty b { font-size: var(--fs-md); color: var(--ink); }
.chart-empty span { font-size: var(--fs-sm); color: var(--ink-3); max-width: 46ch; text-wrap: pretty; }
.stock-empty { min-height: 0; padding: 22px 16px; }
.stock-empty .btn { margin-top: 6px; }
.donut-card { display: flex; flex-direction: column; }

/* ---- polish: tidy wrapping for headings and short notes; macOS font smoothing in Firefox too */
html { -moz-osx-font-smoothing: grayscale; }
.dash-title h1, .card-head h3, .owner-head h2, .section-title h2 { text-wrap: balance; }
.kpi-note, .om-note, .card-sub, .chart-note, .period-meta, .owner-head .small { text-wrap: pretty; }

/* ---- motion: page entrance and the sidebar highlight
   Opening another screen: its header and cards rise 12px and fade in once, row by row, left to right (app.js
   enterView sets --enter-i). "backwards" holds each card hidden only during its own short delay; afterwards no
   animation value is left on it. Only opacity and transform change, so nothing moves the layout and every control
   can be used at once. Reduced motion (device setting or Settings > Appearance) switches both off. */
#view { transition: opacity 140ms ease-out; }
#view.view-leaving { opacity: 0; pointer-events: none; }
.enter-item { animation: enter-rise 460ms var(--ease-out) backwards; animation-delay: calc(var(--enter-i, 0) * 55ms); }
@keyframes enter-rise { from { opacity: 0; transform: translateY(12px); } }
.nav { position: relative; }
.nav-indicator { position: absolute; left: 0; right: 0; top: 0; height: 0; border-radius: 9px; opacity: 0; pointer-events: none; z-index: 0;
  background: linear-gradient(135deg, var(--accent-bg), var(--accent-bg-hover));
  box-shadow: var(--btn-highlight), 0 6px 16px -6px color-mix(in srgb, var(--accent-bg) 70%, transparent); }
.nav-indicator.ready { transition: transform 320ms var(--ease-out), height 320ms var(--ease-out), opacity 150ms; }
.nav a, .nav-group { position: relative; z-index: 1; }
.nav.has-indicator a.active, .nav.has-indicator a.active:hover { background: transparent; box-shadow: none; }
@media (prefers-reduced-motion: reduce) { .enter-item { animation: none !important; } .nav-indicator.ready { transition: none !important; } }
:root[data-motion="reduced"] .enter-item { animation: none !important; }
:root[data-motion="reduced"] .nav-indicator.ready { transition: none !important; }

/* ---- price batches (bulk registration + incoming stock): per-device prices vs batch totals */
.pb-entry { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.pb-entry-head { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.pb-entry-head .muted { font-weight: 400; }
.group-box > [data-twin] { margin-top: 10px; }
.pb-sum { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 10px; background: var(--surface); }
.pb-sum-title { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.pb-sum dl { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0; }
.pb-sum dl > div { min-width: 140px; }
.pb-sum dt { font-size: var(--fs-xs); color: var(--ink-3); }
.pb-sum dd { margin: 2px 0 0; font-size: 1.1em; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.pb-combined .pb-sum { border-left-color: var(--good); }
.pb-note { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 99px; font-size: 10.5px; font-weight: 600;
  letter-spacing: .02em; text-transform: uppercase; color: var(--warn); border: 1px dashed currentColor; vertical-align: 1px; }
.pb-est dd, td.pb-est, th.pb-est { font-style: italic; }
.pb-card { margin-bottom: 14px; }
.pb-head h3 { margin: 0 0 4px; }
.pb-head .hint { margin: 0 0 8px; }
.pb-table th.pb-grp { text-align: center; border-bottom: 1px solid var(--border); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.pb-table .pb-t { background: var(--accent-soft); }
.pb-table th.pb-grp-total { background: var(--accent-soft); color: var(--accent); }
.pb-table tfoot th, .pb-table tfoot td { border-top: 2px solid var(--border-strong); font-weight: 700; }
.pb-table .pb-twin { margin-top: 4px; }
.pb-table td.num, .pb-table th.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sub.warn { color: var(--warn); font-weight: 600; }
input.pb-own { border-color: var(--accent); background: var(--accent-soft); }
.pb-line-total { padding: 8px 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.label-like { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }

/* ---- WhatsApp (Relay inside Accord) ------------------------------------------------------------------------------
   One composer used by the WhatsApp page and by "Share to WhatsApp" on an item. Built from the app's own cards,
   fields, segmented control, badges and tables; the one new piece is the message bubble in the review, so people see
   what their customers will see before anything is sent. Tokens only, so every colour theme and dark mode follow. */
.wa-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.wa-layout > .card h2 { font-size: 15px; margin: 0 0 12px; }
.wa-layout > .wa-numbers:only-child { grid-column: 1 / -1; max-width: 560px; }
@media (max-width: 980px) { .wa-layout { grid-template-columns: minmax(0, 1fr); } .wa-layout.needs-number .wa-numbers { order: -1; } }
.wa-preview-note { margin: 0 0 14px; flex-wrap: nowrap; align-items: flex-start; }
.wa-preview-note svg { width: 18px; height: 18px; flex: none; }
.wa-composer .form-grid { align-items: start; }
.wa-composer .seg { align-self: flex-start; }
.wa-composer input[type="datetime-local"] { margin-top: 8px; }
.wa-groups { border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); overflow: hidden; }
.wa-groups-tools { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.wa-groups-tools input { flex: 1 1 180px; min-width: 0; }
.wa-group-list { max-height: 248px; overflow: auto; overscroll-behavior: contain; padding: 4px; }
.wa-composer.compact .wa-group-list { max-height: 200px; }
.wa-group { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; min-height: 36px; }
.wa-group:hover { background: var(--surface-hover); }
.wa-group input { flex: none; width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.wa-group span { overflow-wrap: anywhere; }
.wa-pad { padding: 12px; }
.wa-attach { display: flex; }
.wa-pick { cursor: pointer; }
.wa-file { display: flex; align-items: center; gap: 10px; padding: 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); max-width: 100%; }
.wa-file img, .wa-file-icon { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex: none; outline: 1px solid rgba(0, 0, 0, .08); outline-offset: -1px; }
.wa-file-icon { display: grid; place-items: center; background: var(--surface); color: var(--ink-2); }
.wa-file > span { min-width: 0; overflow-wrap: anywhere; }
.wa-file .sub { display: block; }
.wa-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.wa-actions .hint { margin-right: auto; }
.wa-review { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.wa-review h3 { font-size: 15px; margin: 0 0 10px; }
.wa-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; margin: 0 0 14px; font-size: 14px; }
.wa-facts dt { color: var(--ink-3); font-weight: 600; }
.wa-facts dd { margin: 0; overflow-wrap: anywhere; }
.wa-more { display: inline; }
.wa-more summary { display: inline; cursor: pointer; color: var(--accent); }
.wa-pre { white-space: pre-wrap; }
/* The review bubble: how WhatsApp will show the message. A quiet chat backdrop, a green-tinted outgoing bubble. */
.wa-phone { padding: 14px; border-radius: 12px; background: color-mix(in srgb, var(--good) 6%, var(--surface-2)); display: flex; justify-content: flex-end; }
.wa-bubble { position: relative; max-width: min(380px, 100%); padding: 6px 8px 18px; border-radius: 10px 2px 10px 10px;
  background: color-mix(in srgb, var(--good) 16%, var(--surface)); color: var(--ink); box-shadow: 0 1px 1px rgba(0, 0, 0, .08); font-size: 14.5px; line-height: 1.4; }
.wa-bubble img { display: block; width: 100%; max-height: 260px; object-fit: cover; border-radius: 7px; margin-bottom: 6px; }
.wa-bubble-video { display: flex; align-items: center; gap: 6px; padding: 26px 12px; border-radius: 7px; background: rgba(0, 0, 0, .55); color: #fff; margin-bottom: 6px; }
.wa-bubble-text { overflow-wrap: anywhere; padding: 0 2px; }
.wa-bubble-time { position: absolute; right: 8px; bottom: 3px; font-size: 11px; color: var(--ink-3); }
/* Shop numbers */
.wa-number { padding: 12px 0; border-bottom: 1px solid var(--border); }
.wa-number:first-child { padding-top: 0; }
.wa-number-head { display: flex; align-items: center; gap: 10px; }
.wa-number-head > div { flex: 1; min-width: 0; }
.wa-avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--good) 14%, var(--surface)); color: var(--good); }
.wa-avatar svg { width: 19px; height: 19px; }
.wa-number-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.wa-qr { display: flex; gap: 14px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.wa-qr img { width: 168px; height: 168px; background: #fff; padding: 8px; border-radius: 10px; border: 1px solid var(--border); image-rendering: pixelated; }
.wa-qr ol { margin: 0; padding-left: 18px; font-size: 14px; color: var(--ink-2); flex: 1 1 160px; }
.wa-qr li + li { margin-top: 4px; }
.wa-link { margin-top: 14px; display: grid; gap: 6px; }
.wa-link label { font-size: var(--fs-sm, 12.5px); font-weight: 600; color: var(--ink-2); }
.wa-link-row { display: flex; gap: 8px; }
.wa-link-row input { flex: 1; min-width: 0; }
.wa-msg { max-width: 360px; overflow-wrap: anywhere; }
.wa-share-of { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.wa-share-of svg { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
@media (pointer: coarse) { .wa-group { min-height: 44px; } }
