/* ==========================================================================
   Trader Ledger — agri theme · glassy UI · light + dark
   Theme is switched by [data-theme="light|dark"] on <html> (see header.php).
   ========================================================================== */

/* Noto Sans Tamil, so Tamil (the default language, includes/i18n.php) looks
   the same on every device — many have no Tamil font of their own, or an old
   one. unicode-range keeps a page with no Tamil on it from downloading it, and
   every font stack below names it before the generic family, so the Tamil
   letters in a line fall through to it. SIL Open Font License. */
@font-face {
  font-family: "Noto Sans Tamil";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/noto-sans-tamil-400.woff2") format("woff2");
  unicode-range: U+0B80-0BFF, U+200C-200D, U+25CC;
}
@font-face {
  font-family: "Noto Sans Tamil";
  font-style: normal;
  font-weight: 500 600;
  font-display: swap;
  src: url("../fonts/noto-sans-tamil-600.woff2") format("woff2");
  unicode-range: U+0B80-0BFF, U+200C-200D, U+25CC;
}
@font-face {
  font-family: "Noto Sans Tamil";
  font-style: normal;
  font-weight: 700 900;
  font-display: swap;
  src: url("../fonts/noto-sans-tamil-700.woff2") format("woff2");
  unicode-range: U+0B80-0BFF, U+200C-200D, U+25CC;
}

:root {
  color-scheme: light;

  /* app canvas — fields + sunlight */
  --bg-1: #eef6e3;
  --bg-2: #e0eecf;
  --bg-glow: rgba(63, 157, 74, .16);
  --bg-sun: rgba(214, 168, 44, .12);

  /* surfaces */
  --panel: #ffffff;
  --panel-2: #f1f7ea;              /* table head, progress track */
  --border: #d6e3c8;
  --shadow: 0 1px 2px rgba(24, 49, 27, .06), 0 10px 28px rgba(24, 49, 27, .08);
  --row-hover: #f1f7ea;

  /* ink */
  --ink: #1e2a1f;
  --muted: #5f7360;

  /* brand + accents */
  --brand: #2f7d3a;
  --brand-2: #23662d;
  --brand-ink: #ffffff;
  --accent: #b7791f;              /* harvest gold */
  --credit: #1c7a41;
  --debit: #c0392b;

  /* glass */
  --glass-bg: rgba(255, 255, 255, .18);
  --glass-brd: rgba(255, 255, 255, .45);
  --glass-hi: rgba(255, 255, 255, .40);

  /* sidebar — always a deep-green field */
  --side-1: #245c2c;
  --side-2: #153e1c;
  --side-ink: #dcebda;
  --side-dim: #9cbf9f;

  --radius: 10px;

  /* faint crops + pulses tile behind everything (see body): wheat, paddy, maize,
     pea pod, gram pod, groundnut, dal grains — same art in every skin, only the ink changes */
  --field-pattern: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300' viewBox='0 0 300 300'><g fill='none' stroke='%232f7d3a' stroke-opacity='.11' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'><g transform='translate(42 170) rotate(-6)'><path d='M0 0V-76'/><path d='M0-36c-9-3-14-11-14-18 7 1 12 7 14 18zM0-46c9-3 14-11 14-18-7 1-12 7-14 18zM0-56c-9-3-14-11-14-18 7 1 12 7 14 18zM0-66c9-3 14-11 14-18-7 1-12 7-14 18zM0-76c-3-6-3-12 0-18 3 6 3 12 0 18z'/><path d='M-14-54l-6-13M14-64l6-13M-14-74l-6-13M14-84l6-13M0-94v-11'/><path d='M0-10c-7-9-17-12-27-10 6 7 16 11 27 10z'/></g><g transform='translate(118 138)'><path d='M0 0C1-38 8-68 30-82s46-8 50 12'/><path d='M30-82c0 10 4 18 10 22M48-86c2 10 0 20-4 26M64-80c4 8 4 18 0 24'/><path d='M80-70c-2-4-2-8 0-11 2 3 2 7 0 11zM78-58c-2-4-2-8 0-11 2 3 2 7 0 11zM40-60c-3-3-4-7-3-11 3 3 4 7 3 11zM44-60c1-4 3-7 6-9 0 4-2 7-6 9zM64-56c-2-4-2-8 0-11 2 3 2 7 0 11zM60-66c-3-2-5-6-5-10 3 2 5 6 5 10zM68-66c0-4 2-7 5-9 0 4-2 7-5 9zM30-70c-3-3-4-7-3-11 3 3 4 7 3 11z'/><path d='M0-20c9-10 20-14 30-12-7 8-18 13-30 12z'/></g><g transform='translate(248 84) rotate(16)'><clipPath id='cob'><path d='M0-36c9 0 13 15 13 34S8 30 0 30s-13-12-13-32S-9-36 0-36z'/></clipPath><path d='M0-36c9 0 13 15 13 34S8 30 0 30s-13-12-13-32S-9-36 0-36z'/><path clip-path='url(%23cob)' d='M-6-40V34M0-40V34M6-40V34M-16-22h32M-16-10h32M-16 2h32M-16 14h32'/><path d='M-3 30C-18 24-26 4-22-24M3 30C18 24 26 4 22-24M0 30v16'/></g><g transform='translate(96 246) rotate(-16)'><path d='M-38 0c10-14 66-14 76 0-10 11-66 11-76 0z'/><circle cx='-22' cy='-1' r='5.5'/><circle cx='-7' cy='-2' r='6'/><circle cx='8' cy='-2' r='6'/><circle cx='23' cy='-1' r='5.5'/><path d='M38 0l7-4M-38 0c-6 0-10 4-8 8s8 3 7-2'/></g><g transform='translate(236 222) rotate(-32)'><path d='M-30 0q0-8 10-7q5-5 10 0q5-5 10 0q5-5 10 0q9 0 10 7q-1 7-10 7q-5 5-10 0q-5 5-10 0q-5 5-10 0q-10 1-10-7z'/><path d='M20 0l8-3M-30 0l-8 3'/></g><g transform='translate(168 206) rotate(-28)'><path d='M-14 0c0-7 5-9 9-7 3 1 5 1 8-1 5-3 11 0 11 8s-6 11-11 8c-3-2-5-2-8-1-4 2-9 0-9-7z'/><path d='M-8-4v8M0-5v10M7-5v10'/></g><g transform='translate(196 150)'><path d='M0 16V0'/><path d='M0 2c-4-8-12-10-18-8 3 7 11 10 18 8zM0 0c4-7 11-9 17-7-3 6-10 9-17 7z'/></g></g><g fill='%23b7791f' fill-opacity='.22'><circle cx='22' cy='30' r='2.6'/><ellipse cx='30' cy='38' rx='2' ry='3' transform='rotate(30 30 38)'/><circle cx='78' cy='40' r='2.4'/><ellipse cx='270' cy='150' rx='2' ry='3' transform='rotate(-20 270 150)'/><circle cx='262' cy='158' r='2.6'/><ellipse cx='146' cy='270' rx='2' ry='3' transform='rotate(60 146 270)'/><circle cx='156' cy='278' r='3.2'/><ellipse cx='282' cy='266' rx='2' ry='3' transform='rotate(10 282 266)'/><circle cx='18' cy='270' r='2.6'/><ellipse cx='26' cy='262' rx='2' ry='3' transform='rotate(-40 26 262)'/><ellipse cx='206' cy='176' rx='2' ry='3' transform='rotate(20 206 176)'/><circle cx='112' cy='176' r='2.4'/><ellipse cx='60' cy='208' rx='2' ry='3' transform='rotate(-60 60 208)'/><circle cx='186' cy='20' r='2.6'/><ellipse cx='196' cy='26' rx='2' ry='3' transform='rotate(40 196 26)'/></g></svg>");
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg-1: #0f1712;
  --bg-2: #0a110c;
  --bg-glow: rgba(76, 175, 80, .14);
  --bg-sun: rgba(224, 169, 58, .06);

  --panel: #161f18;
  --panel-2: #1d2820;
  --border: #2b3a2e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 12px 34px rgba(0, 0, 0, .40);
  --row-hover: #1c271e;

  --ink: #e5eee2;
  --muted: #90a693;

  --brand: #49b657;
  --brand-2: #3aa247;
  --brand-ink: #07160a;
  --accent: #e0a93a;
  --credit: #55c67c;
  --debit: #e46a5f;

  --glass-bg: rgba(255, 255, 255, .06);
  --glass-brd: rgba(255, 255, 255, .16);
  --glass-hi: rgba(255, 255, 255, .18);

  --side-1: #173b1e;
  --side-2: #0b2410;
  --side-ink: #d2e6d3;
  --side-dim: #83a888;

  --field-pattern: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300' viewBox='0 0 300 300'><g fill='none' stroke='%2349b657' stroke-opacity='.13' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'><g transform='translate(42 170) rotate(-6)'><path d='M0 0V-76'/><path d='M0-36c-9-3-14-11-14-18 7 1 12 7 14 18zM0-46c9-3 14-11 14-18-7 1-12 7-14 18zM0-56c-9-3-14-11-14-18 7 1 12 7 14 18zM0-66c9-3 14-11 14-18-7 1-12 7-14 18zM0-76c-3-6-3-12 0-18 3 6 3 12 0 18z'/><path d='M-14-54l-6-13M14-64l6-13M-14-74l-6-13M14-84l6-13M0-94v-11'/><path d='M0-10c-7-9-17-12-27-10 6 7 16 11 27 10z'/></g><g transform='translate(118 138)'><path d='M0 0C1-38 8-68 30-82s46-8 50 12'/><path d='M30-82c0 10 4 18 10 22M48-86c2 10 0 20-4 26M64-80c4 8 4 18 0 24'/><path d='M80-70c-2-4-2-8 0-11 2 3 2 7 0 11zM78-58c-2-4-2-8 0-11 2 3 2 7 0 11zM40-60c-3-3-4-7-3-11 3 3 4 7 3 11zM44-60c1-4 3-7 6-9 0 4-2 7-6 9zM64-56c-2-4-2-8 0-11 2 3 2 7 0 11zM60-66c-3-2-5-6-5-10 3 2 5 6 5 10zM68-66c0-4 2-7 5-9 0 4-2 7-5 9zM30-70c-3-3-4-7-3-11 3 3 4 7 3 11z'/><path d='M0-20c9-10 20-14 30-12-7 8-18 13-30 12z'/></g><g transform='translate(248 84) rotate(16)'><clipPath id='cob'><path d='M0-36c9 0 13 15 13 34S8 30 0 30s-13-12-13-32S-9-36 0-36z'/></clipPath><path d='M0-36c9 0 13 15 13 34S8 30 0 30s-13-12-13-32S-9-36 0-36z'/><path clip-path='url(%23cob)' d='M-6-40V34M0-40V34M6-40V34M-16-22h32M-16-10h32M-16 2h32M-16 14h32'/><path d='M-3 30C-18 24-26 4-22-24M3 30C18 24 26 4 22-24M0 30v16'/></g><g transform='translate(96 246) rotate(-16)'><path d='M-38 0c10-14 66-14 76 0-10 11-66 11-76 0z'/><circle cx='-22' cy='-1' r='5.5'/><circle cx='-7' cy='-2' r='6'/><circle cx='8' cy='-2' r='6'/><circle cx='23' cy='-1' r='5.5'/><path d='M38 0l7-4M-38 0c-6 0-10 4-8 8s8 3 7-2'/></g><g transform='translate(236 222) rotate(-32)'><path d='M-30 0q0-8 10-7q5-5 10 0q5-5 10 0q5-5 10 0q9 0 10 7q-1 7-10 7q-5 5-10 0q-5 5-10 0q-5 5-10 0q-10 1-10-7z'/><path d='M20 0l8-3M-30 0l-8 3'/></g><g transform='translate(168 206) rotate(-28)'><path d='M-14 0c0-7 5-9 9-7 3 1 5 1 8-1 5-3 11 0 11 8s-6 11-11 8c-3-2-5-2-8-1-4 2-9 0-9-7z'/><path d='M-8-4v8M0-5v10M7-5v10'/></g><g transform='translate(196 150)'><path d='M0 16V0'/><path d='M0 2c-4-8-12-10-18-8 3 7 11 10 18 8zM0 0c4-7 11-9 17-7-3 6-10 9-17 7z'/></g></g><g fill='%23b7791f' fill-opacity='.22'><circle cx='22' cy='30' r='2.6'/><ellipse cx='30' cy='38' rx='2' ry='3' transform='rotate(30 30 38)'/><circle cx='78' cy='40' r='2.4'/><ellipse cx='270' cy='150' rx='2' ry='3' transform='rotate(-20 270 150)'/><circle cx='262' cy='158' r='2.6'/><ellipse cx='146' cy='270' rx='2' ry='3' transform='rotate(60 146 270)'/><circle cx='156' cy='278' r='3.2'/><ellipse cx='282' cy='266' rx='2' ry='3' transform='rotate(10 282 266)'/><circle cx='18' cy='270' r='2.6'/><ellipse cx='26' cy='262' rx='2' ry='3' transform='rotate(-40 26 262)'/><ellipse cx='206' cy='176' rx='2' ry='3' transform='rotate(20 206 176)'/><circle cx='112' cy='176' r='2.4'/><ellipse cx='60' cy='208' rx='2' ry='3' transform='rotate(-60 60 208)'/><circle cx='186' cy='20' r='2.6'/><ellipse cx='196' cy='26' rx='2' ry='3' transform='rotate(40 196 26)'/></g></svg>");
}

/* -----------------------------------------------------------------------
   Orange theme — a per-user skin (see users/edit.php), independent of the
   light/dark toggle above: [data-accent="orange"] overrides the light
   palette, and the combined selector below overrides it again for dark.
   Credit/debit colours stay green/red in every skin — they're accounting
   semantics, not brand colour.
   ----------------------------------------------------------------------- */
:root[data-accent="orange"] {
  --bg-1: #fdf1e2;
  --bg-2: #fbe3c4;
  --bg-glow: rgba(224, 101, 26, .16);
  --bg-sun: rgba(224, 169, 58, .14);

  --panel: #ffffff;
  --panel-2: #fdf0dd;
  --border: #f0d2a8;
  --row-hover: #fdf0dd;

  --ink: #2c1c0e;
  --muted: #8a6a48;

  --brand: #d9691e;
  --brand-2: #b8500f;
  --brand-ink: #ffffff;
  --accent: #b7791f;

  /* glossier than the default skin — brighter highlight, more visible frost */
  --glass-bg: rgba(255, 255, 255, .30);
  --glass-brd: rgba(255, 255, 255, .60);
  --glass-hi: rgba(255, 255, 255, .60);

  --side-1: #c05f16;
  --side-2: #6e2f08;
  --side-ink: #fbe8d3;
  --side-dim: #d9a679;

  --field-pattern: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300' viewBox='0 0 300 300'><g fill='none' stroke='%23d9691e' stroke-opacity='.13' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'><g transform='translate(42 170) rotate(-6)'><path d='M0 0V-76'/><path d='M0-36c-9-3-14-11-14-18 7 1 12 7 14 18zM0-46c9-3 14-11 14-18-7 1-12 7-14 18zM0-56c-9-3-14-11-14-18 7 1 12 7 14 18zM0-66c9-3 14-11 14-18-7 1-12 7-14 18zM0-76c-3-6-3-12 0-18 3 6 3 12 0 18z'/><path d='M-14-54l-6-13M14-64l6-13M-14-74l-6-13M14-84l6-13M0-94v-11'/><path d='M0-10c-7-9-17-12-27-10 6 7 16 11 27 10z'/></g><g transform='translate(118 138)'><path d='M0 0C1-38 8-68 30-82s46-8 50 12'/><path d='M30-82c0 10 4 18 10 22M48-86c2 10 0 20-4 26M64-80c4 8 4 18 0 24'/><path d='M80-70c-2-4-2-8 0-11 2 3 2 7 0 11zM78-58c-2-4-2-8 0-11 2 3 2 7 0 11zM40-60c-3-3-4-7-3-11 3 3 4 7 3 11zM44-60c1-4 3-7 6-9 0 4-2 7-6 9zM64-56c-2-4-2-8 0-11 2 3 2 7 0 11zM60-66c-3-2-5-6-5-10 3 2 5 6 5 10zM68-66c0-4 2-7 5-9 0 4-2 7-5 9zM30-70c-3-3-4-7-3-11 3 3 4 7 3 11z'/><path d='M0-20c9-10 20-14 30-12-7 8-18 13-30 12z'/></g><g transform='translate(248 84) rotate(16)'><clipPath id='cob'><path d='M0-36c9 0 13 15 13 34S8 30 0 30s-13-12-13-32S-9-36 0-36z'/></clipPath><path d='M0-36c9 0 13 15 13 34S8 30 0 30s-13-12-13-32S-9-36 0-36z'/><path clip-path='url(%23cob)' d='M-6-40V34M0-40V34M6-40V34M-16-22h32M-16-10h32M-16 2h32M-16 14h32'/><path d='M-3 30C-18 24-26 4-22-24M3 30C18 24 26 4 22-24M0 30v16'/></g><g transform='translate(96 246) rotate(-16)'><path d='M-38 0c10-14 66-14 76 0-10 11-66 11-76 0z'/><circle cx='-22' cy='-1' r='5.5'/><circle cx='-7' cy='-2' r='6'/><circle cx='8' cy='-2' r='6'/><circle cx='23' cy='-1' r='5.5'/><path d='M38 0l7-4M-38 0c-6 0-10 4-8 8s8 3 7-2'/></g><g transform='translate(236 222) rotate(-32)'><path d='M-30 0q0-8 10-7q5-5 10 0q5-5 10 0q5-5 10 0q9 0 10 7q-1 7-10 7q-5 5-10 0q-5 5-10 0q-5 5-10 0q-10 1-10-7z'/><path d='M20 0l8-3M-30 0l-8 3'/></g><g transform='translate(168 206) rotate(-28)'><path d='M-14 0c0-7 5-9 9-7 3 1 5 1 8-1 5-3 11 0 11 8s-6 11-11 8c-3-2-5-2-8-1-4 2-9 0-9-7z'/><path d='M-8-4v8M0-5v10M7-5v10'/></g><g transform='translate(196 150)'><path d='M0 16V0'/><path d='M0 2c-4-8-12-10-18-8 3 7 11 10 18 8zM0 0c4-7 11-9 17-7-3 6-10 9-17 7z'/></g></g><g fill='%23b7791f' fill-opacity='.28'><circle cx='22' cy='30' r='2.6'/><ellipse cx='30' cy='38' rx='2' ry='3' transform='rotate(30 30 38)'/><circle cx='78' cy='40' r='2.4'/><ellipse cx='270' cy='150' rx='2' ry='3' transform='rotate(-20 270 150)'/><circle cx='262' cy='158' r='2.6'/><ellipse cx='146' cy='270' rx='2' ry='3' transform='rotate(60 146 270)'/><circle cx='156' cy='278' r='3.2'/><ellipse cx='282' cy='266' rx='2' ry='3' transform='rotate(10 282 266)'/><circle cx='18' cy='270' r='2.6'/><ellipse cx='26' cy='262' rx='2' ry='3' transform='rotate(-40 26 262)'/><ellipse cx='206' cy='176' rx='2' ry='3' transform='rotate(20 206 176)'/><circle cx='112' cy='176' r='2.4'/><ellipse cx='60' cy='208' rx='2' ry='3' transform='rotate(-60 60 208)'/><circle cx='186' cy='20' r='2.6'/><ellipse cx='196' cy='26' rx='2' ry='3' transform='rotate(40 196 26)'/></g></svg>");
}

:root[data-theme="dark"][data-accent="orange"] {
  --bg-1: #1a120a;
  --bg-2: #120c06;
  --bg-glow: rgba(240, 136, 58, .14);
  --bg-sun: rgba(224, 169, 58, .06);

  --panel: #1f150c;
  --panel-2: #271b0f;
  --border: #3a2916;
  --row-hover: #241a0f;

  --ink: #f0e3d3;
  --muted: #b89572;

  --brand: #f0883a;
  --brand-2: #d96a1e;
  --brand-ink: #1a0f04;
  --accent: #e0a93a;

  /* glossier than the default skin — brighter highlight, more visible frost */
  --glass-bg: rgba(255, 255, 255, .11);
  --glass-brd: rgba(255, 255, 255, .30);
  --glass-hi: rgba(255, 255, 255, .32);

  --side-1: #5c2c0a;
  --side-2: #2a1404;
  --side-ink: #ecd9c2;
  --side-dim: #b98a5e;

  --field-pattern: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300' viewBox='0 0 300 300'><g fill='none' stroke='%23f0883a' stroke-opacity='.13' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'><g transform='translate(42 170) rotate(-6)'><path d='M0 0V-76'/><path d='M0-36c-9-3-14-11-14-18 7 1 12 7 14 18zM0-46c9-3 14-11 14-18-7 1-12 7-14 18zM0-56c-9-3-14-11-14-18 7 1 12 7 14 18zM0-66c9-3 14-11 14-18-7 1-12 7-14 18zM0-76c-3-6-3-12 0-18 3 6 3 12 0 18z'/><path d='M-14-54l-6-13M14-64l6-13M-14-74l-6-13M14-84l6-13M0-94v-11'/><path d='M0-10c-7-9-17-12-27-10 6 7 16 11 27 10z'/></g><g transform='translate(118 138)'><path d='M0 0C1-38 8-68 30-82s46-8 50 12'/><path d='M30-82c0 10 4 18 10 22M48-86c2 10 0 20-4 26M64-80c4 8 4 18 0 24'/><path d='M80-70c-2-4-2-8 0-11 2 3 2 7 0 11zM78-58c-2-4-2-8 0-11 2 3 2 7 0 11zM40-60c-3-3-4-7-3-11 3 3 4 7 3 11zM44-60c1-4 3-7 6-9 0 4-2 7-6 9zM64-56c-2-4-2-8 0-11 2 3 2 7 0 11zM60-66c-3-2-5-6-5-10 3 2 5 6 5 10zM68-66c0-4 2-7 5-9 0 4-2 7-5 9zM30-70c-3-3-4-7-3-11 3 3 4 7 3 11z'/><path d='M0-20c9-10 20-14 30-12-7 8-18 13-30 12z'/></g><g transform='translate(248 84) rotate(16)'><clipPath id='cob'><path d='M0-36c9 0 13 15 13 34S8 30 0 30s-13-12-13-32S-9-36 0-36z'/></clipPath><path d='M0-36c9 0 13 15 13 34S8 30 0 30s-13-12-13-32S-9-36 0-36z'/><path clip-path='url(%23cob)' d='M-6-40V34M0-40V34M6-40V34M-16-22h32M-16-10h32M-16 2h32M-16 14h32'/><path d='M-3 30C-18 24-26 4-22-24M3 30C18 24 26 4 22-24M0 30v16'/></g><g transform='translate(96 246) rotate(-16)'><path d='M-38 0c10-14 66-14 76 0-10 11-66 11-76 0z'/><circle cx='-22' cy='-1' r='5.5'/><circle cx='-7' cy='-2' r='6'/><circle cx='8' cy='-2' r='6'/><circle cx='23' cy='-1' r='5.5'/><path d='M38 0l7-4M-38 0c-6 0-10 4-8 8s8 3 7-2'/></g><g transform='translate(236 222) rotate(-32)'><path d='M-30 0q0-8 10-7q5-5 10 0q5-5 10 0q5-5 10 0q9 0 10 7q-1 7-10 7q-5 5-10 0q-5 5-10 0q-5 5-10 0q-10 1-10-7z'/><path d='M20 0l8-3M-30 0l-8 3'/></g><g transform='translate(168 206) rotate(-28)'><path d='M-14 0c0-7 5-9 9-7 3 1 5 1 8-1 5-3 11 0 11 8s-6 11-11 8c-3-2-5-2-8-1-4 2-9 0-9-7z'/><path d='M-8-4v8M0-5v10M7-5v10'/></g><g transform='translate(196 150)'><path d='M0 16V0'/><path d='M0 2c-4-8-12-10-18-8 3 7 11 10 18 8zM0 0c4-7 11-9 17-7-3 6-10 9-17 7z'/></g></g><g fill='%23b7791f' fill-opacity='.22'><circle cx='22' cy='30' r='2.6'/><ellipse cx='30' cy='38' rx='2' ry='3' transform='rotate(30 30 38)'/><circle cx='78' cy='40' r='2.4'/><ellipse cx='270' cy='150' rx='2' ry='3' transform='rotate(-20 270 150)'/><circle cx='262' cy='158' r='2.6'/><ellipse cx='146' cy='270' rx='2' ry='3' transform='rotate(60 146 270)'/><circle cx='156' cy='278' r='3.2'/><ellipse cx='282' cy='266' rx='2' ry='3' transform='rotate(10 282 266)'/><circle cx='18' cy='270' r='2.6'/><ellipse cx='26' cy='262' rx='2' ry='3' transform='rotate(-40 26 262)'/><ellipse cx='206' cy='176' rx='2' ry='3' transform='rotate(20 206 176)'/><circle cx='112' cy='176' r='2.4'/><ellipse cx='60' cy='208' rx='2' ry='3' transform='rotate(-60 60 208)'/><circle cx='186' cy='20' r='2.6'/><ellipse cx='196' cy='26' rx='2' ry='3' transform='rotate(40 196 26)'/></g></svg>");
}

/* orange only: an extra glossy sheen on top of the base rules further down.
   .panel::before and .stat::after/.sidebar::after etc. already carry other
   decorations (the harvest bar, the wheat watermark, ...) so this reuses free
   pseudo-slots (.panel::after, .target-card::before/::after) plus an inset
   highlight for the rest — a lacquered-panel look to match the brighter skin. */
[data-accent="orange"] .panel::after,
[data-accent="orange"] .target-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, var(--glass-hi), transparent 40%);
  opacity: .55;
  pointer-events: none;
}
[data-accent="orange"] .panel,
[data-accent="orange"] .target-card { position: relative; overflow: hidden; }
[data-accent="orange"] .panel,
[data-accent="orange"] .stat,
[data-accent="orange"] .target-card {
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi);
}
[data-accent="orange"] .sidebar {
  box-shadow: 4px 0 24px rgba(0, 0, 0, .12), inset -1px 0 0 var(--glass-hi);
}
[data-accent="orange"] .btn,
[data-accent="orange"] .btn-outline { filter: saturate(1.12); }

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "Noto Sans Tamil", sans-serif;
  font-size: 14px;
  color: var(--ink);
  background:
    var(--field-pattern) 0 0 / 300px 300px repeat,
    radial-gradient(1100px 520px at 82% -12%, var(--bg-sun), transparent 60%),
    radial-gradient(920px 620px at -12% 8%, var(--bg-glow), transparent 55%),
    linear-gradient(178deg, var(--bg-1), var(--bg-2));
  background-attachment: fixed;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* smooth theme change */
body, .sidebar, .panel, .stat, .target-card, .login-box,
table, th, td, input, select, textarea, .btn, .badge {
  transition: background-color .28s ease, border-color .28s ease, color .28s ease, box-shadow .28s ease;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  /* sticky, so the shell stays in place while the page area scrolls — the
     navigation script in footer.php keeps this element alive across pages */
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
  width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  color: var(--side-ink);
  background: linear-gradient(185deg, var(--side-1), var(--side-2));
  border-right: 1px solid rgba(0, 0, 0, .25);
  box-shadow: 4px 0 24px rgba(0, 0, 0, .12);
}
.sidebar::before {  /* sunlight from the top-left */
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(380px 200px at 20% 0%, rgba(255, 255, 255, .10), transparent 70%);
  pointer-events: none;
}
.sidebar > * { position: relative; }

.sidebar .brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
  margin: 0 12px 10px;
  padding: 10px 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14);
  color: #fff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .35);
}
.sidebar .brand::before {
  content: "🌿";
  font-size: 22px;
  line-height: 1;
  margin-bottom: 4px;
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, .4));
}
.sidebar .brand .brand-name {
  font-weight: 800;
  font-size: 21px;
  line-height: 1.1;
  letter-spacing: .02em;
}
.sidebar .brand .brand-sub {
  font-weight: 600;
  font-size: 11.5px;
  line-height: 1.2;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--side-dim);
}

/* the brand box naming where you are (header.php): the mandi's picture in
   place of the leaf, the district, then the mandi */
.sidebar .brand.brand-place { gap: 3px; padding-top: 12px; }
.sidebar .brand.brand-place::before { content: none; }
.sidebar .brand .brand-pic {
  width: 46px;
  height: 46px;
  margin-bottom: 6px;
  border-radius: 50%;
  background: #fff;
  padding: 3px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .35), 0 4px 12px rgba(0, 0, 0, .25);
}
.sidebar .brand .brand-pic.mandi-photo-initials { padding: 0; font-size: 15px; color: #fff; background: var(--accent); }
/* the district logo shown whole on a white tile, at its own shape (a wide one up to 140px) */
.sidebar .brand .brand-logo {
  width: auto;
  max-width: 140px;
  height: 56px;
  padding: 4px;
  border-radius: 10px;
}
.sidebar .brand .brand-district {
  font-weight: 800;
  font-size: 15px;
  line-height: 1.2;
  letter-spacing: .01em;
}
.sidebar .brand .brand-mandi {
  font-weight: 600;
  font-size: 11px;
  line-height: 1.25;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--side-dim);
}

.sidebar nav { flex: 1; display: flex; flex-direction: column; }

.sidebar nav a {
  color: var(--side-ink);
  font-weight: 600;
  padding: 9px 16px;
  display: block;
  box-shadow: inset 0 0 0 rgba(183, 121, 31, 0);
  transition: background-color .18s ease, box-shadow .18s ease, padding-left .18s ease;
}
.sidebar nav a:hover {
  background: rgba(255, 255, 255, .12);
  box-shadow: inset 3px 0 0 var(--accent);
  padding-left: 20px;
  text-decoration: none;
}
.sidebar nav a.active {
  background: rgba(255, 255, 255, .16);
  box-shadow: inset 3px 0 0 var(--accent);
  color: #fff;
  font-weight: 700;
}
/* Two levels: a section title reads like the top-level Dashboard link (full
   size, bold, bright); the links inside a section are smaller, lighter and
   indented behind a guide line. No capitals — Tamil has none, so the two
   languages look the same. */
.sidebar .nav-group {
  padding: 9px 16px;
  font-size: 14px;
  font-family: inherit;   /* the page's own font; buttons don't inherit it by default */
  font-weight: 700;
  color: var(--side-ink);
}
.sidebar .nav-sec,
.sidebar .nav-soon { border-top: 1px solid rgba(255, 255, 255, .07); }

/* a section not built yet (header.php): its heading, greyed out and inert */
.sidebar .nav-soon {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 6px;
  opacity: .5;
  cursor: not-allowed;
  user-select: none;
}
.sidebar .nav-soon-tag { font-size: 11.5px; font-weight: 500; font-style: italic; }

/* collapsible sidebar sections: the heading is a button, one section open at a
   time (app.js section 14); the open section's links slide down via 0fr -> 1fr */
.sidebar button.nav-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  border: 0;
  background: none;
  line-height: inherit;
  text-align: left;
  cursor: pointer;
  transition: color .18s ease, background-color .18s ease;
}
.sidebar button.nav-group:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.sidebar .nav-sec.open > button.nav-group { color: #fff; }
.sidebar button.nav-group:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.sidebar .nav-caret {
  width: 7px;
  height: 7px;
  flex: none;
  color: var(--side-dim);
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .22s ease, color .18s ease;
}
.sidebar .nav-sec.open .nav-caret { transform: translateY(1px) rotate(-135deg); color: var(--accent); }

/* the open section sits on a darker band, its links one step down */
.sidebar .nav-sec { transition: background-color .25s ease, padding-bottom .25s ease; }
.sidebar .nav-sec.open { background: rgba(0, 0, 0, .14); padding-bottom: 6px; }
.sidebar .nav-items > div > a {
  padding: 7px 12px 7px 14px;
  font-size: 13px;
  font-weight: 500;
  color: color-mix(in srgb, var(--side-ink) 80%, transparent);
}
.sidebar .nav-items > div > a:hover { padding-left: 18px; color: #fff; }
.sidebar .nav-items > div > a.active { color: #fff; font-weight: 700; }
.sidebar .nav-items {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  transition: grid-template-rows .25s ease, visibility 0s linear .25s;
}
.sidebar .nav-items > div {           /* no vertical margin/padding: it would show while collapsed */
  overflow: hidden;
  min-height: 0;
  margin-left: 24px;
  border-left: 1px solid rgba(255, 255, 255, .18);
}
.sidebar .nav-sec.open > .nav-items {
  grid-template-rows: 1fr;
  visibility: visible;
  transition: grid-template-rows .25s ease, visibility 0s;
}
@media (prefers-reduced-motion: reduce) {
  .sidebar .nav-items,
  .sidebar .nav-sec.open > .nav-items,
  .sidebar .nav-sec,
  .sidebar .nav-caret { transition: none; }
}

.content { flex: 1; min-width: 0; padding: 24px 32px; max-width: 1200px; }

/* highlighted credit / copyright band at the foot of every page */
.page-footer {
  position: relative;
  overflow: hidden;
  margin: 40px 0 8px;
  padding: 15px 22px 13px;
  border: 1px solid color-mix(in srgb, var(--brand) 22%, var(--border));
  border-radius: var(--radius);
  background:
    radial-gradient(120% 150% at 50% 0%, color-mix(in srgb, var(--brand) 12%, transparent), transparent 70%),
    var(--panel-2);
  text-align: center;
  line-height: 1.5;
}
.page-footer::before {                 /* the harvest stripe, as on panels + stat cards */
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-2), var(--brand) 55%, var(--accent));
}
.page-footer .pf-line {
  display: block;
  font-size: 12px;
  letter-spacing: .03em;
  color: var(--muted);
}
.page-footer .pf-line strong {
  color: color-mix(in srgb, var(--brand) 80%, var(--ink));
  font-weight: 700;
  letter-spacing: .01em;
}
.page-footer .pf-copy { margin-top: 2px; font-size: 11.5px; }

/* a panel refreshing just its own contents (app.js section 11) — the delay
   means a quick response never visibly dims */
.panel-loading > :not(.toolbar) { opacity: .55; transition: opacity .15s ease .1s; }

h1 { font-size: 22px; margin: 0 0 18px; }
h2 { font-size: 17px; margin: 24px 0 10px; }

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

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; background: var(--panel); }
table.panel-table {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
th {
  background: var(--panel-2);
  font-weight: 600;
  color: color-mix(in srgb, var(--ink) 82%, transparent);
}
tr:last-child td { border-bottom: none; }
/* every data table ruled in full: a line between the columns as well as the rows */
table.panel-table th, table.panel-table td { border: 1px solid var(--border); }
tbody tr:hover td, tr:hover td { background: var(--row-hover); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
/* A column header that sorts its table (mandies/index.php): reads as a header, not a link. */
th a.th-sort { color: inherit; text-decoration: none; }
th a.th-sort:hover { color: var(--brand); text-decoration: underline; }

/* Dashboard "Traders Pending": the other days a trader is still owed for, folded
   under one line ("+3 more days · ₹…") and opened to list each date. */
details.pending-more > summary { cursor: pointer; list-style: none; }
details.pending-more > summary::-webkit-details-marker { display: none; }
details.pending-more > summary::before { content: "▸"; margin-right: 6px; font-size: 11px; color: var(--brand); }
details.pending-more[open] > summary::before { content: "▾"; }
.pending-more-oldest { display: block; margin-left: 17px; font-size: 12px; color: var(--muted); }
details.pending-more ul { list-style: none; margin: 6px 0 0 17px; padding: 6px 0 0; border-top: 1px dashed var(--border); }
details.pending-more li {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 2px 0; font-size: 12.5px; font-variant-numeric: tabular-nums;
}

/* a group of tick boxes with a "Select all" row (report filters) */
.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 7px 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  max-height: 210px;
  overflow-y: auto;
}
.check-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13.5px;
  font-weight: normal;
  color: var(--ink);
  cursor: pointer;
}
.check-grid input[type="checkbox"] { width: auto; margin: 0; flex-shrink: 0; }
.check-grid .check-all {
  grid-column: 1 / -1;
  font-weight: 600;
  padding-bottom: 8px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--border);
}

/* a font size typed on the Reports page, beating every breakpoint's th/td size */
table.report-fs th, table.report-fs td { font-size: var(--report-fs); }

/* grouped reports: the trader header row and its subtotal */
tr.report-section td {
  background: var(--panel-2);
  font-weight: 700;
  padding-top: 12px;
  border-top: 2px solid color-mix(in srgb, var(--brand) 45%, transparent);
}
/* a heading inside a block: the trader's legal name under the commodity */
tr.report-subsection td {
  font-weight: 700;
  padding-top: 8px;
  color: var(--brand);
}
/* the date a report is for, bold at the right of its title (reports/index.php) */
.report-title-date {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
tr.report-subtotal td {
  font-weight: 600;
  background: color-mix(in srgb, var(--brand) 6%, transparent);
  border-bottom: 2px solid var(--border);
}
/* the total that closes a whole block, under the sub-blocks it holds */
tr.report-grouptotal td {
  font-weight: 700;
  background: color-mix(in srgb, var(--brand) 16%, transparent);
  border-top: 1px solid color-mix(in srgb, var(--brand) 45%, transparent);
  border-bottom: 2px solid color-mix(in srgb, var(--brand) 45%, transparent);
}
tr.report-section:hover td, tr.report-subtotal:hover td,
tr.report-grouptotal:hover td { background: var(--row-hover); }

/* Form 24(1). The return reads as a table until somebody presses Edit values;
   only then do the boxes appear. A figure typed over the register is tinted
   either way, so a hand-corrected line is obvious at a glance. */
.f24-table td { padding-top: 4px; padding-bottom: 4px; }
.f24-table .f24-cell { display: none; }
.f24-table.f24-editing .f24-view { display: none; }
.f24-table.f24-editing .f24-cell { display: inline-block; }
.f24-table.f24-editing input[type=checkbox].f24-cell { display: inline-block; width: auto; }

.f24-view.f24-edited {
  padding: 1px 5px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  font-weight: 600;
}
/* The always-open CR box: same look as an edit box, on show at all times. */
input.f24-cr {
  padding: 3px 6px;
  font-size: 12.5px;
  border: 1px dashed var(--border);
  border-radius: 4px;
  background: var(--panel);
}
input.f24-cr:focus { border-style: solid; border-color: var(--accent); }
/* a receipt number a refused save found on two traders */
input.f24-cr.f24-clash {
  border-style: solid;
  border-color: var(--danger, #b3261e);
  background: color-mix(in srgb, var(--danger, #b3261e) 10%, transparent);
}

input.f24-cell {
  padding: 3px 6px;
  font-size: 12.5px;
  text-align: right;
  border: 1px solid var(--border);
  background: var(--panel);
}
input.f24-cell[type=text] { text-align: left; }
input.f24-cell:focus { border-color: var(--accent); }
input.f24-cell.f24-edited {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  font-weight: 600;
}

/* The filter row sits under the column titles and scrolls with them. */
.f24-table tr.f24-filters td { padding: 4px 6px; background: var(--panel-2); }
input.f24-filter {
  width: 100%;
  min-width: 5ch;
  padding: 2px 6px;
  font-size: 11.5px;
  font-weight: normal;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel);
}
/* .form-actions sets display:flex, which beats the UA rule for [hidden] --
   these two are toggled by the edit button, so make the attribute stick. */
#f24SaveBar[hidden], #f24FilterNote[hidden] { display: none !important; }

.f24-toolbar .check-grid { gap: 4px 14px; }
.f24-toolbar .check-grid label { font-size: 12.5px; font-weight: normal; }

/* --------------------------------------------------------------------------
   Badges (glassy tints)
   -------------------------------------------------------------------------- */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.badge-credit,
.badge-delivered {
  background: color-mix(in srgb, var(--credit) 16%, transparent);
  border-color: color-mix(in srgb, var(--credit) 30%, transparent);
  color: var(--credit);
}
.badge-debit {
  background: color-mix(in srgb, var(--debit) 16%, transparent);
  border-color: color-mix(in srgb, var(--debit) 30%, transparent);
  color: var(--debit);
}
.badge-agent,
.badge-pending {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  border-color: color-mix(in srgb, var(--accent) 34%, transparent);
  color: color-mix(in srgb, var(--accent) 88%, var(--ink));
}
.badge-cancelled {
  background: color-mix(in srgb, var(--muted) 20%, transparent);
  border-color: color-mix(in srgb, var(--muted) 32%, transparent);
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Buttons — frosted glass with a shine sweep
   -------------------------------------------------------------------------- */
.btn {
  position: relative;
  z-index: 0;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  vertical-align: middle;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--glass-brd);
  background:
    linear-gradient(180deg, var(--glass-hi), rgba(255, 255, 255, 0) 46%),
    linear-gradient(180deg, var(--brand), var(--brand-2));
  color: var(--brand-ink);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi);
  transition: transform .16s ease, box-shadow .26s ease, filter .2s ease;
}
.btn::before {  /* diagonal glint, sits above the fill but below the label */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(115deg, transparent 22%, rgba(255, 255, 255, .38) 46%, transparent 62%);
  transform: translateX(-120%);
  transition: transform .6s ease;
}
.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.06) saturate(1.05);
  text-decoration: none;
  box-shadow:
    0 8px 24px color-mix(in srgb, var(--brand) 42%, transparent),
    inset 0 1px 0 var(--glass-hi);
}
.btn:hover::before { transform: translateX(120%); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.btn-outline {
  background: var(--glass-bg);
  color: var(--brand);
  border-color: color-mix(in srgb, var(--brand) 38%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 var(--glass-hi);
}
.btn-outline:hover {
  background: color-mix(in srgb, var(--brand) 14%, var(--glass-bg));
  filter: none;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--brand) 26%, transparent);
}

.btn-danger {
  background:
    linear-gradient(180deg, var(--glass-hi), rgba(255, 255, 255, 0) 46%),
    linear-gradient(180deg, var(--debit), color-mix(in srgb, var(--debit) 74%, #000));
  border-color: rgba(255, 255, 255, .35);
  color: #fff;
}
.btn-danger:hover {
  box-shadow: 0 8px 24px color-mix(in srgb, var(--debit) 44%, transparent), inset 0 1px 0 var(--glass-hi);
}

.btn-sm { padding: 4px 10px; font-size: 12.5px; }

form.inline { display: inline; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 20px; }
.form-grid.cols-1 { grid-template-columns: 1fr; }
/* grid items default to min-width:auto, so a wide table (e.g. the dashboard's
   "Outstanding Balances") pushes its track past the viewport. Let tracks shrink
   and long cell text wrap instead. */
.form-grid > * { min-width: 0; }
.form-grid > .panel table.panel-table td,
.form-grid > .panel table.panel-table th { overflow-wrap: anywhere; }
/* ... but the sitewide 560px floor (below) still wins over that unless it's
   lifted here too — otherwise these two-up panels scroll instead of wrapping. */
.form-grid > .panel .table-wrap > table.panel-table { min-width: 0; }
/* A table with too many columns to wrap its way out of trouble (the
   Commodities lists: name, unit, group, default bag, counts, actions) marks
   itself .table-wide and opts back out. Without this, every other column is
   nowrap so the name column is the only one that can give, and "anywhere"
   shreds it a letter at a time — "M u l t i c r o p" down the page. Normal
   word wrapping restores a sane min-content width, and the .table-wrap around
   it (added by tlWrapTables) then scrolls instead of squeezing. */
.form-grid > .panel table.panel-table.table-wide td,
.form-grid > .panel table.panel-table.table-wide th { overflow-wrap: normal; }
.form-grid > .panel .table-wrap > table.panel-table.table-wide { min-width: 620px; }
table.panel-table.table-wide th:first-child,
table.panel-table.table-wide td:first-child { min-width: 140px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field[hidden], .field .hint [hidden] { display: none; }
.field label { font-weight: 600; font-size: 12.5px; color: color-mix(in srgb, var(--ink) 82%, transparent); }
/* the Licence block on Add / Edit Trader (includes/trader_license.php) */
fieldset.license-box {
  min-width: 0;                       /* a fieldset won't shrink below its content otherwise */
  margin: 0;
  padding: 10px 14px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
fieldset.license-box > legend { padding: 0 6px; font-weight: 700; font-size: 13px; }
table.kv-table th { width: 190px; text-align: left; }
.license-box .license-sub { margin: 16px 0 8px; font-size: 13px; font-weight: 700; }
.license-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.license-row { display: grid; grid-template-columns: 1fr 1fr 1fr 130px auto; gap: 8px; align-items: center; }
.license-row.proof-row { grid-template-columns: 1fr 1.2fr auto; }
.license-row > * { min-width: 0; }
.license-proofs { margin: 0 0 8px; padding-left: 18px; }
.license-proofs li { margin: 2px 0; }
.license-remove { display: inline-flex; align-items: center; gap: 4px; margin-left: 10px; font-weight: 400; font-size: 12.5px; }
@media (max-width: 640px) {
  .license-row, .license-row.proof-row { grid-template-columns: 1fr 1fr; }
  .license-row [data-row-remove] { justify-self: start; }
}
.field .hint { font-size: 11.5px; color: var(--muted); }
input, select, textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--ink);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
input:focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--brand) 55%, transparent);
  outline-offset: 1px;
  border-color: var(--brand);
}
.form-actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   Alerts
   -------------------------------------------------------------------------- */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13.5px;
  border: 1px solid transparent;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.alert-success {
  background: color-mix(in srgb, var(--credit) 13%, var(--panel));
  border-color: color-mix(in srgb, var(--credit) 38%, transparent);
  color: color-mix(in srgb, var(--credit) 82%, var(--ink));
}
.alert-error {
  background: color-mix(in srgb, var(--debit) 13%, var(--panel));
  border-color: color-mix(in srgb, var(--debit) 38%, transparent);
  color: color-mix(in srgb, var(--debit) 82%, var(--ink));
}
.alert-info {
  background: color-mix(in srgb, var(--brand) 12%, var(--panel));
  border-color: color-mix(in srgb, var(--brand) 36%, transparent);
  color: color-mix(in srgb, var(--brand) 82%, var(--ink));
}
/* --------------------------------------------------------------------------
   Notification bell (top right, beside the user chip) — see app.js §13.
   -------------------------------------------------------------------------- */
.notif-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--glass-brd);
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
  box-shadow: var(--shadow);
  color: var(--ink);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.notif-bell:hover, .notif-bell[aria-expanded="true"] {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--brand) 45%, var(--glass-brd));
  box-shadow: var(--shadow), 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent);
}
.notif-bell:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.notif-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--debit);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 17px;
  text-align: center;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--panel) 90%, transparent);
}
.notif-badge[hidden] { display: none; }
@keyframes tl-notif-pop {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.35); }
  100% { transform: scale(1); }
}
.notif-badge.is-new { animation: tl-notif-pop .4s ease; }

.notif-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(360px, 90vw);
  max-height: min(70vh, 520px);
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  border: 1px solid var(--glass-brd);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: var(--shadow);
  color: var(--ink);
  transform-origin: top right;
}
.notif-pop[hidden] { display: none; }
.notif-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  flex-shrink: 0;
}
.notif-pop-head a { font-size: 12.5px; font-weight: 600; }
.notif-list { overflow-y: auto; padding: 6px; }
.notif-empty { padding: 20px 14px; text-align: center; color: var(--muted); font-size: 13px; }
.notif-item {
  position: relative;
  padding: 8px 28px 8px 10px;
  border-radius: 10px;
  font-size: 13px;
}
.notif-item:hover { background: var(--row-hover); }
.notif-item + .notif-item { margin-top: 2px; }
.notif-msg { line-height: 1.4; }
.notif-meta { margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.notif-dismiss {
  position: absolute;
  top: 6px;
  right: 4px;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: var(--muted);
  opacity: .7;
  padding: 2px 6px;
  border-radius: 6px;
}
.notif-dismiss:hover { opacity: 1; background: color-mix(in srgb, var(--ink) 8%, transparent); }
.notif-dismiss:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.notif-item.is-leaving { opacity: 0; transform: translateX(8px); transition: opacity .15s ease, transform .15s ease; }
.notif-pop-foot {
  flex-shrink: 0;
  display: block;
  padding: 10px 14px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  border-top: 1px solid var(--border);
}

@media (prefers-reduced-motion: no-preference) {
  .notif-pop:not([hidden]) { animation: tl-pop .16s ease-out; }
}

@media (max-width: 900px) {
  .notif-bell {
    width: 34px;
    height: 34px;
    color: #fff;
    background: rgba(255, 255, 255, .10);
    border-color: rgba(255, 255, 255, .18);
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .notif-pop { color: var(--ink); }
}
@media (max-width: 480px) {
  .notif-pop { width: min(320px, 92vw); right: -8px; }
}

/* --------------------------------------------------------------------------
   Stat cards
   -------------------------------------------------------------------------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.stat::after {  /* faint leaf-light corner */
  content: "";
  position: absolute;
  right: -30px; top: -30px;
  width: 90px; height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand) 22%, transparent), transparent 70%);
  pointer-events: none;
}
a.stat { display: block; color: inherit; transition: transform .16s ease, border-color .2s ease, box-shadow .2s ease; }
a.stat:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--brand) 50%, var(--border));
  box-shadow: 0 10px 26px color-mix(in srgb, var(--brand) 22%, transparent);
}
.stat .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 6px; }
.stat .stat-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat .stat-sub-ok { color: var(--brand); font-weight: 700; }
.stat .stat-sub + .stat-sub { margin-top: 1px; }
.stat .stat-sub-bad { color: var(--danger, #b3261e); font-weight: 700; }
.stat .stat-sub-warn { color: #b7791f; font-weight: 700; }

.muted { color: var(--muted); }
.text-right { text-align: right; }
.search-box input { width: 260px; max-width: 100%; }

/* --------------------------------------------------------------------------
   Commodity chips + checkbox pick-lists (traders <-> commodities)
   -------------------------------------------------------------------------- */
.chips { display: inline-flex; flex-wrap: wrap; gap: 4px; vertical-align: middle; }
.chip {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 99px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  background: color-mix(in srgb, var(--muted) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--muted) 24%, transparent);
  white-space: nowrap;
}
a.chip:hover { text-decoration: none; color: var(--ink); border-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.chip-major {
  font-weight: 600;
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 14%, transparent);
  border-color: color-mix(in srgb, var(--brand) 30%, transparent);
}
a.chip-major:hover { color: var(--brand-2); }

.check-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 4px 12px;
  max-height: 190px;
  overflow-y: auto;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
}
.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  font-size: 13px;
  cursor: pointer;
}
.check-item input { width: auto; margin: 0; }

/* Delete Mandi Data (mandi_data/index.php): one tick box + its note per kind */
.purge-kinds {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px 20px;
}
.purge-kinds .hint { margin: 2px 0 0 28px; font-size: 11.5px; color: var(--muted); }

/* Message preview block (Send Statements) */
.msg-preview {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Noto Sans Tamil", monospace;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 260px;
  overflow-y: auto;
}

/* Payment Book — collapsible "By Commodity" groups */
.commodity-groups { margin-bottom: 20px; }
.commodity-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  margin-bottom: 10px;
  overflow: hidden;
}
.commodity-group > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  cursor: pointer;
  list-style: none;
  background: var(--panel-2);
  font-size: 14px;
}
.commodity-group > summary::-webkit-details-marker { display: none; }
.commodity-group > summary::before {
  content: "▸";
  color: var(--muted);
  font-size: 11px;
  transition: transform .15s ease;
}
.commodity-group[open] > summary::before { transform: rotate(90deg); }
.commodity-group > summary:hover { background: var(--row-hover); }
.commodity-group .cg-name { font-weight: 600; flex: 1; min-width: 0; }
.commodity-group .cg-meta { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.commodity-group .cg-total {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 110px;
  text-align: right;
}
.commodity-group > div { padding: 0 14px 14px; }
.commodity-group table.panel-table { box-shadow: none; }

@media (max-width: 640px) {
  .commodity-group > summary { flex-wrap: wrap; gap: 6px 10px; }
  .commodity-group .cg-total { min-width: 0; }
}

/* --------------------------------------------------------------------------
   Login
   -------------------------------------------------------------------------- */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background:
    var(--field-pattern) 0 0 / 300px 300px repeat,
    radial-gradient(1000px 520px at 50% -18%, var(--bg-glow), transparent 60%),
    radial-gradient(700px 400px at 85% 110%, var(--bg-sun), transparent 60%),
    linear-gradient(178deg, var(--bg-1), var(--bg-2));
}
.login-box {
  width: 340px;
  max-width: 100%;
  padding: 32px;
  border-radius: 16px;
  border: 1px solid var(--glass-brd);
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi);
}
.login-box h1 { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; margin-bottom: 20px; }
.login-box h1::before { content: "🌿"; font-size: 28px; line-height: 1; margin-bottom: 6px; }
/* the emblem above the title (auth/login.php): replaces the leaf; the JPEG is
   white-backed, so it sits in a white disc that reads in both themes */
.login-logo {
  display: block;
  width: 96px; height: 96px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: #fff;
  object-fit: contain;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent), var(--shadow);
}
.login-logo + h1::before { content: none; }
@media (max-width: 480px) { .login-logo { width: 80px; height: 80px; } }
.login-box h1 .brand-name { font-size: 26px; font-weight: 800; line-height: 1.1; letter-spacing: .02em; }
.login-box h1 .brand-sub { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
/* a long brand (auth/login.php): the state as a ruled kicker, the rest on two balanced lines */
.login-box h1 .brand-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--brand);
}
.login-box h1 .brand-kicker::before,
.login-box h1 .brand-kicker::after {
  content: "";
  width: 28px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  opacity: .7;
}
.login-box h1 .brand-kicker::after { margin-left: -.32em; }   /* eat the last letter's trailing spacing */
.login-box h1 .brand-long { font-size: 20px; line-height: 1.25; letter-spacing: .01em; text-wrap: balance; }
/* login captcha: the image is always a light card, so it reads in both themes */
.captcha-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.captcha-img { display: block; width: 180px; max-width: calc(100% - 48px); height: auto; border-radius: 8px; border: 1px solid var(--border); background: #f6f3e9; }
.captcha-refresh { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); font-size: 20px; line-height: 1; text-decoration: none; color: inherit; }
.captcha-refresh:hover { border-color: var(--muted); }
#captcha { text-transform: uppercase; letter-spacing: .15em; }
#captcha::placeholder { text-transform: none; letter-spacing: normal; }

/* --------------------------------------------------------------------------
   Tabs
   -------------------------------------------------------------------------- */
.tabs { display: flex; gap: 2px; margin-bottom: 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tabs a {
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
.tabs a .count { color: var(--muted); font-weight: 400; }
.tabs a.active .count { color: var(--brand); }

/* --------------------------------------------------------------------------
   Progress + target cards
   -------------------------------------------------------------------------- */
.progress {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  height: 9px;
  overflow: hidden;
  margin-top: 8px;
}
.progress > span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0) 60%),
    linear-gradient(90deg, var(--brand-2), var(--brand));
  transition: width .6s cubic-bezier(.2, .7, .2, 1);
}
.progress.over > span {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0) 60%),
    linear-gradient(90deg, color-mix(in srgb, var(--credit) 80%, #000), var(--credit));
}

.target-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.target-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.target-card .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.target-card .value { font-size: 20px; font-weight: 700; margin-top: 4px; }
.target-card .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.target-card .pct { font-weight: 700; }
.pct-good { color: var(--credit); }
.pct-mid { color: var(--accent); }
.pct-low { color: var(--debit); }

/* --------------------------------------------------------------------------
   Disclosure
   -------------------------------------------------------------------------- */
details.disclosure > summary {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none;
  padding: 8px 16px;
  border: 1px solid color-mix(in srgb, var(--brand) 38%, transparent);
  border-radius: var(--radius);
  background: var(--glass-bg);
  color: var(--brand);
  font-size: 13.5px; font-weight: 600;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: "▸"; font-size: 11px; }
details.disclosure[open] > summary::before { content: "▾"; }
details.disclosure > summary:hover { background: color-mix(in srgb, var(--brand) 12%, var(--glass-bg)); }
details.disclosure[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
details.disclosure .disclosure-body {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Theme switch (sidebar + login)
   -------------------------------------------------------------------------- */
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 12px;
  color: var(--side-dim);
  cursor: pointer;
  user-select: none;
}
.theme-switch .track {
  position: relative;
  width: 42px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 999px;
  background: rgba(128, 128, 128, .28);
  border: 1px solid rgba(128, 128, 128, .4);
  transition: background-color .25s ease;
}
.theme-switch .thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .45);
  display: grid;
  place-items: center;
  font-size: 10px;
  color: #b7791f;
  transition: transform .28s cubic-bezier(.4, .1, .2, 1.5);
}
.theme-switch .thumb::after { content: "☀"; }
.theme-switch:hover .track { background: rgba(128, 128, 128, .4); }

:root[data-theme="dark"] .theme-switch .track { background: color-mix(in srgb, var(--brand) 60%, transparent); border-color: color-mix(in srgb, var(--brand) 50%, transparent); }
:root[data-theme="dark"] .theme-switch .thumb { transform: translateX(20px); color: #1f5c2a; }
:root[data-theme="dark"] .theme-switch .thumb::after { content: "☾"; }

/* login page: float it top-right */
.theme-switch.floating {
  position: fixed;
  top: 16px;
  right: 18px;
  color: var(--muted);
  z-index: 10;
}
/* the login page's language switch, opposite the theme toggle */
.lang-picker.floating {
  position: fixed;
  top: 12px;
  left: 18px;
  margin: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--panel) 85%, transparent);
}

/* --------------------------------------------------------------------------
   Mobile top bar, navigation drawer, scrolling tables
   -------------------------------------------------------------------------- */
.topbar { display: none; }
.sidebar-close { display: none; }
.sidebar-backdrop { display: none; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.table-wrap > table.panel-table { min-width: 560px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  color: #fff;
  background: linear-gradient(90deg, var(--side-1), var(--side-2));
  border-bottom: 1px solid rgba(0, 0, 0, .25);
  box-shadow: 0 4px 18px rgba(0, 0, 0, .14);
}
.topbar-brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  color: #fff;
  text-decoration: none;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .35);
}
.topbar-brand:hover { text-decoration: none; color: #fff; }
.topbar-brand::before { content: "🌿"; font-size: 18px; align-self: center; }
.topbar-brand .brand-name { font-weight: 800; font-size: 18px; letter-spacing: .02em; }
.topbar-brand .brand-sub {
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--side-dim);
  white-space: nowrap;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
/* super-admin: pick which mandi to work in (sits in the sidebar under the brand) */
.sidebar .mandi-switch { margin: 0 10px 8px; }
/* "District" / "Mandi" captions over the super_admin's two switchers */
.sidebar .mandi-switch-label {
  display: block;
  margin: 0 2px 3px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .7);
}
.sidebar .mandi-switch select {
  width: 100%;
  padding: 7px 26px 7px 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 8px;
  cursor: pointer;
}
.sidebar .mandi-switch select:hover { background: rgba(255, 255, 255, .2); }
.sidebar .mandi-switch select option { color: #1c1c1c; }
/* the active mandi shown under the brand (admin / staff — no switcher) */
.topbar-mandi {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, .16);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 42vw;
}
.nav-toggle {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 10px;
  background: rgba(255, 255, 255, .10);
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: #fff;
  transition: transform .22s ease, opacity .22s ease;
}
body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.sidebar-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 10px;
  background: rgba(255, 255, 255, .10);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

/* ---- page-load bar (in-place navigation) ---- */
.pjax-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  opacity: 0;
  z-index: 200;
  pointer-events: none;
}
.pjax-bar.run { width: 85%; opacity: 1; transition: width 8s cubic-bezier(0, .7, .2, 1), opacity .1s ease; }
.pjax-bar.done { width: 100%; opacity: 0; transition: width .2s ease, opacity .35s ease .15s; }
@media (prefers-reduced-motion: reduce) {
  .pjax-bar.run, .pjax-bar.done { transition: opacity .1s linear; }
}

/* ---- tablets and phones: drawer navigation, single-column forms ---- */
@media (max-width: 900px) {
  html { -webkit-text-size-adjust: 100%; }
  .app { flex-direction: column; }
  .topbar { display: flex; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 85vw);
    height: 100dvh;
    padding-top: 56px;
    overflow-y: auto;
    z-index: 60;
    transform: translateX(-105%);
    transition: transform .26s cubic-bezier(.4, 0, .2, 1);
    box-shadow: none;
  }
  body.nav-open .sidebar { transform: none; box-shadow: 8px 0 32px rgba(0, 0, 0, .35); }
  body.nav-open { overflow: hidden; }
  .sidebar-close { display: inline-flex; align-items: center; justify-content: center; }
  .sidebar nav a { padding: 12px 16px; font-size: 15px; }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(0, 0, 0, .45);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
  }
  .sidebar-backdrop[hidden] { display: none; }

  .content { padding: 16px; max-width: none; width: 100%; }
  h1 { font-size: 20px; margin-bottom: 14px; }
  h2 { font-size: 16px; }
  .panel { padding: 14px; }
  .panel[style*="max-width"] { max-width: none !important; }

  /* forms: one column, no zoom-on-focus on iOS */
  .form-grid, .form-grid[style*="grid-template-columns"] { grid-template-columns: 1fr !important; gap: 12px; }
  .form-grid > [style*="grid-column"] { grid-column: auto !important; }
  input, select, textarea { font-size: 16px; padding: 10px 12px; }
  input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; }
  .search-box input { width: 100%; }
  .form-actions .btn { flex: 1 1 auto; text-align: center; }

  /* touch-friendly buttons */
  .btn { min-height: 40px; }
  .btn-sm { min-height: 34px; }

  /* toolbar: stack title and actions */
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .actions { width: 100%; }
  .toolbar .actions .btn { flex: 1 1 auto; text-align: center; }
  .toolbar form.inline, .toolbar .search-box { width: 100%; }

  .stat-row { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat .value { font-size: 20px; }
  .target-row { gap: 10px; }

  .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { white-space: nowrap; }

  th, td { padding: 8px 10px; font-size: 13px; }
  .table-wrap > table.panel-table { border-radius: 0; }
  .table-wrap { margin-left: -14px; margin-right: -14px; padding: 0 14px; }
  .panel > .table-wrap { margin-left: -14px; margin-right: -14px; }
  .login-box { padding: 24px 20px; }
}

/* ---- small phones ---- */
@media (max-width: 480px) {
  .content { padding: 12px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .topbar-brand .brand-sub { display: none; }
  .table-wrap { margin-left: -12px; margin-right: -12px; padding: 0 12px; }
  .theme-switch.floating { top: 10px; right: 10px; }
  .lang-picker.floating { top: 8px; left: 10px; }
}

/* --------------------------------------------------------------------------
   Motion / print
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .btn:hover { transform: none; }
  a.stat:hover { transform: none; }
}

@media print {
  .sidebar, .topbar, .sidebar-backdrop, .no-print, .theme-switch { display: none !important; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; background-image: none; }
  .panel, .stat, table.panel-table, .target-card { box-shadow: none; }
}


/* ==========================================================================
   Agri touch — harvest accents and motion
   Everything that moves sits inside prefers-reduced-motion: no-preference,
   so the app is still calm for people who ask for that.
   ========================================================================== */

/* ---- headings: a green-to-gold "field stripe" underline ---- */
main.content > h1,
main.content > .page-head > h1 {
  position: relative;
  display: inline-block;
  padding-bottom: 8px;
}
main.content > h1::after,
main.content > .page-head > h1::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--brand) 0 55%, var(--accent) 55% 80%, transparent 80%);
}

/* a page heading with a button beside it (the dashboard's Daily Log): the
   heading keeps its stripe, the button sits at the right and drops under it
   on a narrow screen */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 0 12px; }
.page-head > .btn { flex: none; }

/* the dashboards' Daily Log button (dlog_dashboard_button): filled so it is
   seen at a glance, with today's count under the name; it pulses softly
   while nothing is written for the day */
.btn.dlog-cta { gap: 10px; padding: 9px 18px 9px 14px; text-align: left; font-size: 15px;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 38%, transparent), inset 0 1px 0 var(--glass-hi); }
.dlog-cta-icon { font-size: 24px; line-height: 1; }
.dlog-cta-text { display: flex; flex-direction: column; gap: 2px; line-height: 1.2; min-width: 0; }
.dlog-cta-title { font-weight: 800; letter-spacing: .01em; }
.dlog-cta-sub { font-size: 11.5px; font-weight: 600; opacity: .92; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlog-cta .badge { margin-left: 2px; }
@media (prefers-reduced-motion: no-preference) {
  .btn.dlog-cta.is-empty { animation: dlog-cta-pulse 2.6s ease-out infinite; }
  .btn.dlog-cta.is-empty:hover { animation: none; }
}
@keyframes dlog-cta-pulse {
  0%   { box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 38%, transparent), 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
  70%  { box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 38%, transparent), 0 0 0 12px color-mix(in srgb, var(--accent) 0%, transparent); }
  100% { box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 38%, transparent), 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); }
}
@media (max-width: 640px) {
  /* a whole row of its own under the heading, where a thumb finds it */
  .page-head > .dlog-cta, .toolbar .actions > .dlog-cta { flex: 1 1 100%; justify-content: flex-start; margin-bottom: 12px; }
  .toolbar .actions:has(> .dlog-cta) { flex: 1 1 100%; }
}
@media print { .dlog-cta { display: none !important; } }

/* ---- sidebar: wheat watermark + sprout marker on the current page ---- */
.sidebar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 190px;
  pointer-events: none;
  opacity: .55;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='190' viewBox='0 0 220 190'><g fill='none' stroke='%23ffffff' stroke-opacity='.16' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M40 190V96'/><path d='M40 106c-11-4-17-13-17-22 8 1 15 9 17 22zM40 92c11-4 17-13 17-22-8 1-15 9-17 22zM40 80c-11-4-17-13-17-22 8 1 15 9 17 22zM40 68c11-4 17-13 17-22-8 1-15 9-17 22z'/><path d='M86 190V120'/><path d='M86 128c-9-3-14-11-14-18 7 1 12 7 14 18zM86 116c9-3 14-11 14-18-7 1-12 7-14 18zM86 106c-9-3-14-11-14-18 7 1 12 7 14 18z'/><path d='M150 190c-4-40 22-66 22-66'/><path d='M158 150c18-26 46-22 46-22s-3 32-29 39c-9 2-14-1-17-17z'/><path d='M158 150l42-28'/></g></svg>") center bottom / 220px 190px no-repeat;
}
.sidebar nav a.active::before {
  content: "🌾";
  display: inline-block;
  margin-right: 8px;
  font-size: 13px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .35));
}
.sidebar .brand::before { transform-origin: 50% 90%; }

/* ---- dashboard stats: harvest bar on top, lift + glow on hover ---- */
.stat {
  position: relative;
  overflow: hidden;
  isolation: isolate;                 /* keeps the cursor spotlight layer inside the card */
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
/* cursor-tracked highlight (footer.php sets --mx / --my and toggles .is-tilting) */
.stat-spot {
  position: absolute;
  inset: 0;
  z-index: -1;                        /* on the card surface, behind the label + figure */
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity .28s ease;
  background: radial-gradient(200px circle at var(--mx, 50%) var(--my, 50%),
    color-mix(in srgb, var(--accent) 24%, transparent) 0%, transparent 60%);
}
.stat.is-tilting {
  z-index: 1;                         /* lift over neighbours while tilted so the shadow shows */
  box-shadow: 0 10px 30px rgba(24, 49, 27, .16), 0 22px 55px rgba(47, 125, 58, .20);
  border-color: color-mix(in srgb, var(--brand) 40%, var(--border));
}
.stat.is-tilting .stat-spot { opacity: 1; }
.stat::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--brand-2), var(--brand) 55%, var(--accent));
}
.stat:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(24, 49, 27, .12), 0 14px 40px rgba(47, 125, 58, .18);
  border-color: color-mix(in srgb, var(--brand) 40%, var(--border));
  text-decoration: none;
}
.stat .value { font-variant-numeric: tabular-nums; }

/* ---- panels: a whisper of the harvest bar too ---- */
.panel { position: relative; }
.panel::before {
  content: "";
  position: absolute;
  left: 0; top: 10px; bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--brand), var(--accent));
  opacity: .8;
  pointer-events: none;
}

/* ---- tables: a green edge on the row under the pointer ---- */
table.panel-table tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--brand); }

/* ---- alerts slide in, success gets a sprout ---- */
.alert-success::before { content: "🌱 "; }

/* ---- progress bars: sheen moving along the filled part ---- */
.progress > span { position: relative; overflow: hidden; }
.progress > span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .55) 50%, transparent 80%);
  transform: translateX(-100%);
}

/* ---- dashboard: an ambient canvas of drifting motes behind the heading ---- */
main.content { position: relative; isolation: isolate; }   /* anchor + contain the canvas */
.dashboard-fx {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 320px;
  z-index: -1;                       /* on the page, behind every block */
  width: 100%;
  pointer-events: none;
  opacity: .58;
  -webkit-mask-image: linear-gradient(180deg, #000 46%, transparent);
          mask-image: linear-gradient(180deg, #000 46%, transparent);
}
@media (prefers-reduced-motion: reduce) { .dashboard-fx { display: none; } }
@media print { .dashboard-fx { display: none !important; } }
@media (max-width: 720px) { .dashboard-fx { height: 240px; opacity: .5; } }

/* ---- login: drifting leaves and a warm sun ---- */
.login-wrap { position: relative; overflow: hidden; }
.leaf-field { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.leaf-field span {
  position: absolute;
  top: -8vh;
  font-size: 22px;
  opacity: 0;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .18));
}
.login-box { position: relative; }
.login-box::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 4px;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(90deg, var(--brand-2), var(--brand) 55%, var(--accent));
}

/* ---- motion (only when the visitor is fine with it) ---- */
@media (prefers-reduced-motion: no-preference) {
  @keyframes tl-rise {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
  }
  @keyframes tl-sway {
    0%, 100% { transform: rotate(-6deg); }
    50%      { transform: rotate(6deg); }
  }
  @keyframes tl-sheen {
    0%   { transform: translateX(-100%); }
    60%, 100% { transform: translateX(100%); }
  }
  @keyframes tl-fall {
    0%   { opacity: 0; transform: translate3d(0, 0, 0) rotate(0deg); }
    8%   { opacity: .9; }
    92%  { opacity: .9; }
    100% { opacity: 0; transform: translate3d(var(--drift, 40px), 112vh, 0) rotate(var(--spin, 300deg)); }
  }
  @keyframes tl-glow {
    0%, 100% { box-shadow: var(--shadow); }
    50%      { box-shadow: var(--shadow), 0 0 0 6px color-mix(in srgb, var(--accent) 22%, transparent); }
  }
  @keyframes tl-progress-lit {
    0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
    100% { box-shadow: 0 0 0 9px transparent; }
  }

  /* the page content settles in, a few pieces at a time — blocks that footer.php
     marked .reveal are left out here and fade in on scroll instead */
  main.content.page-enter > *:not(.reveal):not(.dashboard-fx):not(.page-footer) { animation: tl-rise .45s cubic-bezier(.2, .7, .2, 1) both; }
  main.content.page-enter > :nth-child(2) { animation-delay: .05s; }
  main.content.page-enter > :nth-child(3) { animation-delay: .10s; }
  main.content.page-enter > :nth-child(4) { animation-delay: .15s; }
  main.content.page-enter > :nth-child(5) { animation-delay: .20s; }
  main.content.page-enter > :nth-child(n+6) { animation-delay: .25s; }

  /* scroll reveal — footer.php adds .reveal to below-the-fold blocks, then
     .reveal-in once they scroll into view */
  .reveal { opacity: 0; transform: translateY(18px); transition: opacity .5s ease, transform .55s cubic-bezier(.2, .7, .2, 1); }
  .reveal.reveal-in { opacity: 1; transform: none; }

  /* progress bars flash their accent as they finish filling */
  .progress.lit { animation: tl-progress-lit .9s ease-out 1; }

  .sidebar .brand::before { animation: tl-sway 5s ease-in-out infinite; }
  .sidebar .brand:hover::before { animation-duration: 1.4s; }

  .progress > span::after { animation: tl-sheen 2.8s ease-in-out infinite; }

  .leaf-field span { animation: tl-fall var(--dur, 14s) linear var(--delay, 0s) infinite; }
  .login-box:focus-within { animation: tl-glow 2.4s ease-in-out infinite; }

  .stat.stat-glow { animation: tl-glow 1.2s ease-out 1; }
}

/* a small sprout burst thrown from a success alert (footer.php, motion only) */
.tl-burst-bit {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  font-size: 15px;
  line-height: 1;
  will-change: transform, opacity;
}

@media (max-width: 900px) {
  .sidebar::after { height: 120px; opacity: .35; }
}
@media print {
  .sidebar::after, .leaf-field, .panel::before, .stat::before, main.content > h1::after, main.content > .page-head > h1::after { display: none !important; }
  main.content.page-enter > *, .reveal { animation: none !important; opacity: 1 !important; transform: none !important; }
}


/* ==========================================================================
   User menu — name on the right, opens to theme + log out
   ========================================================================== */
.content { padding-top: 64px; }          /* room for the chip on desktop */

.user-menu {
  position: fixed;
  top: 14px;
  right: 22px;
  z-index: 70;
}
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 5px;
  border-radius: 99px;
  border: 1px solid var(--glass-brd);
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
  box-shadow: var(--shadow);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.user-chip:hover, .user-chip[aria-expanded="true"] {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--brand) 45%, var(--glass-brd));
  box-shadow: var(--shadow), 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent);
}
.user-chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.user-chip .avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: .04em;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35);
}
.user-chip .name { max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .caret {
  width: 8px; height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  opacity: .6;
  transition: transform .18s ease;
}
.user-chip[aria-expanded="true"] .caret { transform: translateY(2px) rotate(-135deg); }

.user-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 230px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid var(--glass-brd);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: var(--shadow);
  transform-origin: top right;
}
.user-pop[hidden] { display: none; }
.user-pop-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.user-pop-head .who { font-weight: 700; }
.user-pop-head .role { font-size: 12px; color: var(--muted); margin-top: 2px; }
.user-pop .theme-switch {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink);
}
.user-pop .theme-switch:hover { background: var(--row-hover); }
.user-pop .logout {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--debit);
  font-weight: 600;
  text-decoration: none;
}
.user-pop .profile-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.user-pop .profile-link:hover { background: var(--row-hover); text-decoration: none; }
.user-pop .logout:hover { background: color-mix(in srgb, var(--debit) 10%, transparent); text-decoration: none; }

@media (prefers-reduced-motion: no-preference) {
  @keyframes tl-pop {
    from { opacity: 0; transform: translateY(-6px) scale(.96); }
    to   { opacity: 1; transform: none; }
  }
  .user-pop:not([hidden]) { animation: tl-pop .16s ease-out; }
}

@media (max-width: 900px) {
  .content { padding-top: 16px; }        /* the chip lives in the top bar here */
  .user-menu { top: 8px; right: 10px; z-index: 45; }
  .user-chip {
    padding: 4px 10px 4px 4px;
    color: #fff;
    background: rgba(255, 255, 255, .10);
    border-color: rgba(255, 255, 255, .18);
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .user-chip .name { max-width: 120px; }
  .user-pop { color: var(--ink); }
}
@media (max-width: 480px) {
  .content { padding-top: 12px; }
  .user-chip .name { display: none; }
  .user-chip { padding-right: 8px; gap: 6px; }
}
@media print { .user-menu { display: none !important; } }


/* ==========================================================================
   Compact phone layout — tighter spacing everywhere below 900px
   (kept last so it overrides the earlier phone rules)
   ========================================================================== */
@media (max-width: 900px) {
  body { font-size: 13.5px; }

  /* top bar + drawer */
  .topbar { padding: 6px 10px; gap: 8px; }
  .nav-toggle { width: 36px; height: 36px; border-radius: 8px; gap: 4px; }
  .topbar-brand .brand-name { font-size: 16px; }
  .topbar-brand .brand-sub { font-size: 10.5px; }
  .topbar-brand::before { font-size: 16px; }
  .sidebar { padding-top: 50px; width: min(260px, 82vw); }
  .sidebar .brand { margin: 0 10px 6px; padding: 8px 10px 10px; }
  .sidebar .brand .brand-name { font-size: 18px; }
  .sidebar .brand::before { font-size: 18px; margin-bottom: 2px; }
  .sidebar nav a { padding: 9px 14px; font-size: 14px; }
  .sidebar .nav-group { padding: 9px 14px; font-size: 14px; }
  .sidebar .nav-items > div { margin-left: 22px; }
  .sidebar .nav-items > div > a { padding: 9px 12px 9px 14px; font-size: 13.5px; }
  .sidebar::after { height: 90px; opacity: .3; }

  /* user chip in the bar */
  .user-menu { top: 6px; right: 8px; }
  .user-chip { padding: 3px 8px 3px 3px; gap: 7px; }
  .user-chip .avatar { width: 28px; height: 28px; font-size: 11px; }
  .user-chip .name { max-width: 96px; font-size: 13px; }
  .user-pop { min-width: 210px; padding: 6px; }
  .user-pop-head { padding: 6px 8px 8px; }

  /* page */
  .content { padding: 12px; }
  main.content > h1, main.content > .page-head > h1 { font-size: 18px; margin: 0 0 10px; padding-bottom: 6px; }
  main.content > h1::after, main.content > .page-head > h1::after { height: 2px; }
  h2 { font-size: 15px; margin: 16px 0 8px; }
  p, .hint, .muted { line-height: 1.35; }

  .panel { padding: 12px; border-radius: 8px; }
  .panel + .panel, .panel + .form-grid, .form-grid + .panel { margin-top: 10px; }
  .panel::before { top: 8px; bottom: 8px; width: 2px; }

  .toolbar { margin-bottom: 10px; gap: 8px; }
  .toolbar .actions { gap: 6px; }
  .toolbar .actions .btn { flex: 1 1 calc(50% - 6px); }
  .toolbar h1, .toolbar h2 { margin-bottom: 0; }

  .btn { min-height: 36px; padding: 6px 12px; font-size: 13px; border-radius: 8px; }
  .btn-sm { min-height: 30px; padding: 3px 9px; font-size: 12px; }
  .badge { padding: 1px 7px; font-size: 11px; }

  /* dashboard */
  .stat-row { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
  .stat { padding: 10px 12px; border-radius: 8px; }
  .stat::before { height: 3px; }
  .stat .label { font-size: 10.5px; letter-spacing: .03em; }
  .stat .value { font-size: 17px; margin-top: 3px; }
  .target-row { gap: 8px; }
  .target-card { padding: 10px 12px; }
  .target-card .label { font-size: 10.5px; }
  .target-card .value { font-size: 16px; }
  .target-card .sub { font-size: 11.5px; }
  .progress { height: 7px; margin-top: 6px; }

  /* forms */
  .form-grid, .form-grid[style*="grid-template-columns"] { gap: 8px; }
  .field { gap: 3px; }
  .field label { font-size: 12px; }
  .field .hint { font-size: 11px; }
  input, select, textarea { padding: 8px 10px; border-radius: 7px; }   /* 16px font stays: no iOS zoom */
  .form-actions { margin-top: 12px; gap: 8px; }
  .check-grid { gap: 5px 10px; padding: 8px 10px; max-height: 170px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .check-grid label { font-size: 13px; gap: 6px; }
  .check-grid .check-all { padding-bottom: 6px; }

  /* tables */
  th, td { padding: 6px 8px; font-size: 12.5px; }
  .table-wrap { margin-left: -12px; margin-right: -12px; padding: 0 12px; }
  .panel > .table-wrap { margin-left: -12px; margin-right: -12px; }
  .table-wrap > table.panel-table { min-width: 520px; }
  tr.report-section td { padding-top: 8px; }

  /* alerts, tabs, disclosures */
  .alert { padding: 8px 10px; margin-bottom: 10px; font-size: 13px; border-radius: 8px; }
  .tabs a { padding: 8px 10px; font-size: 13px; }
  .disclosure > summary { padding: 8px 10px; }

  /* login */
  .login-box { padding: 20px 16px; border-radius: 12px; }
  .login-box h1 { margin-bottom: 14px; }
  .leaf-field span { font-size: 18px; }
}

@media (max-width: 480px) {
  body { font-size: 13px; }
  .content { padding: 10px; }
  main.content > h1, main.content > .page-head > h1 { font-size: 17px; }
  .panel { padding: 10px; }
  .stat-row { gap: 6px; }
  .stat { padding: 8px 10px; }
  .stat .value { font-size: 16px; }
  .toolbar .actions .btn { flex: 1 1 100%; }
  th, td { padding: 5px 7px; font-size: 12px; }
  .table-wrap { margin-left: -10px; margin-right: -10px; padding: 0 10px; }
  .panel > .table-wrap { margin-left: -10px; margin-right: -10px; }
  .user-chip .name { display: none; }
  .user-chip { padding-right: 6px; gap: 0; }
}


/* ==========================================================================
   Stat cards never overflow — long money values wrap, shrink, or go wide
   ========================================================================== */
.stat { min-width: 0; }                                  /* grid items may shrink below their content */
.stat .value {
  white-space: nowrap;                                   /* one line: app.js shrinks it until it fits */
  overflow-wrap: anywhere;                               /* last resort, once app.js lets it wrap again */
  line-height: 1.15;
}
@media (max-width: 900px) {
  .stat .value { font-size: clamp(13px, 4.6vw, 17px); }
  .stat.stat-wide { grid-column: 1 / -1; }               /* a long figure takes the whole row (set by footer.php) */
  .stat.stat-wide .value { font-size: clamp(15px, 5.2vw, 19px); }
}

/* Dashboard Today's Transactions: eight cards, four to a row; on narrow screens
   two to a row with the money cards (.stat-span-sm) across the whole row, and
   dense flow so a card fills any gap a full-row one leaves */
.stat-row.stat-row-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-flow: row dense; }
@media (max-width: 900px) {
  .stat-row.stat-row-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-row.stat-row-4 .stat-span-sm { grid-column: 1 / -1; }
}


/* ==========================================================================
   Combobox — a long <select> turned into a type-to-search field
   (includes/trader_picker.php builds the markup at runtime)
   ========================================================================== */
.combo { position: relative; }
.combo .combo-input { width: 100%; padding-right: 30px; }
/* a picker that shares a row with a button (the upload pages' "Assign trader") */
.combo--inline { display: inline-block; width: 200px; vertical-align: middle; }
.combo-clear {
  position: absolute;
  top: 0;
  right: 0;
  height: 34px;
  width: 28px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
}
.combo-clear:hover { color: var(--ink); }
.combo-clear:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

/* The list is appended to <body> and placed over its input by the script, so
   a picker inside a scrolling .table-wrap is never clipped by it. */
.combo-list {
  position: fixed;
  z-index: 90;
  left: 0;
  top: 0;
  min-width: 190px;
  max-height: 300px;
  overflow-y: auto;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.combo-option {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13.5px;
}
.combo-option .who { font-weight: 600; margin-right: auto; min-width: 0; }
.combo-option .note {
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  flex: none;
}
.combo-option .badge { padding: 1px 7px; font-size: 11px; }
.combo-option:hover,
.combo-option.is-active { background: var(--row-hover); }
.combo-option[aria-selected="true"] { box-shadow: inset 3px 0 0 var(--brand); }
.combo-option[hidden] { display: none; }   /* display:flex above beats the UA rule, so a filtered-out name stayed listed */
.combo-empty { padding: 10px 9px; color: var(--muted); font-size: 12.5px; }

@media (max-width: 600px) {
  .combo-list { max-height: 240px; }
  .combo-option { padding: 9px; }
  .combo-option .note { font-size: 11px; }
}


/* ==========================================================================
   Live search — a `.search-box` field wrapped by includes/footer.php's
   tlLiveSearch() so it filters as you type instead of waiting for Enter.
   ========================================================================== */
.search-wrap {
  position: relative;
  display: inline-flex;
  width: 260px;
  max-width: 100%;
  vertical-align: middle;
}
.search-wrap input { width: 100%; padding-right: 26px; }
.search-clear {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 26px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
}
.search-clear:hover { color: var(--ink); }
.search-clear:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

/* a small spinner to the left of the clear button while a search is in flight */
.search-wrap.is-searching::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 26px;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border: 2px solid color-mix(in srgb, var(--brand) 30%, transparent);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: tl-search-spin .6s linear infinite;
  pointer-events: none;
}
@keyframes tl-search-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .search-wrap.is-searching::after { animation: none; opacity: .6; }
}

@media (max-width: 900px) {
  .search-wrap { width: 100%; }
}


/* ==========================================================================
   Theme refresh — softer surfaces, tighter type, a modern control set, and
   four extra colour skins (Ocean · Violet · Teal · Slate) that join Green +
   Orange in the user menu and users/edit.php.

   Appended last on purpose: it re-tunes the design tokens and a handful of
   shared components without editing the rules above — the cascade does the
   rest, so every skin (old and new) inherits the same refreshed shell.
   ========================================================================== */

/* ---- tokens: a radius scale, softer layered shadows, tinted hairlines ---- */
:root {
  --radius: 12px;
  --radius-sm: 9px;
  --radius-lg: 18px;

  --shadow-sm: 0 1px 2px rgba(16, 32, 20, .06);
  --shadow: 0 1px 2px rgba(16, 32, 20, .04), 0 8px 20px -6px rgba(16, 32, 20, .10), 0 20px 44px -14px rgba(16, 32, 20, .10);
  --shadow-lg: 0 2px 6px rgba(16, 32, 20, .06), 0 26px 60px -14px rgba(16, 32, 20, .18);

  --ring: 0 0 0 3px color-mix(in srgb, var(--brand) 24%, transparent);
  --hairline: color-mix(in srgb, var(--brand) 12%, var(--border));
}
:root[data-theme="dark"] {
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 28px -8px rgba(0, 0, 0, .6);
  --shadow-lg: 0 2px 8px rgba(0, 0, 0, .5), 0 30px 66px -16px rgba(0, 0, 0, .72);
  --hairline: color-mix(in srgb, var(--brand) 20%, var(--border));
}

/* ---- typography ---- */
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "Noto Sans Tamil", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  letter-spacing: -0.006em;
}
h1, h2, h3 { letter-spacing: -0.021em; text-wrap: balance; }

/* ---- panels & cards: rounder, softer, faint brand-tinted edge ----
   Size/padding changes are held to >900px so the compact phone section
   further up keeps its tighter spacing untouched. */
.panel, .stat, .target-card { border-color: var(--hairline); }
.panel { box-shadow: var(--shadow); }
.panel::before { top: 14px; bottom: 14px; opacity: .5; width: 3px; }
.stat {
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 4%, var(--panel)), var(--panel));
  box-shadow: var(--shadow);
}
.stat::before { height: 3px; }
.stat .label { font-size: 11px; font-weight: 600; letter-spacing: .06em; }

@media (min-width: 901px) {
  .panel { border-radius: var(--radius-lg); padding: 22px; }
  .stat { border-radius: var(--radius-lg); padding: 18px 20px; }
  .stat .value { font-size: 26px; letter-spacing: -0.022em; margin-top: 8px; }
  .target-card { border-radius: var(--radius); }
}

/* ---- buttons: match the new radius, calmer at rest (shine stays on hover) ---- */
.btn, .btn-outline, .btn-danger { border-radius: var(--radius-sm); letter-spacing: .01em; }
.btn { box-shadow: var(--shadow-sm), inset 0 1px 0 var(--glass-hi); }
.btn-sm { border-radius: 8px; }

/* ---- form controls: a modern focus ring, matched radius, cleaner fill ---- */
input, select, textarea {
  border-radius: var(--radius-sm);
  background: var(--panel);
  border-color: color-mix(in srgb, var(--ink) 16%, transparent);
}
input:focus, select:focus, textarea:focus,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid transparent;      /* keep a hook for Windows high-contrast mode */
  outline-offset: 2px;
  border-color: var(--brand);
  box-shadow: var(--ring);
}

/* ---- tables: quiet uppercase headers, snappier row hover ---- */
table.panel-table { border-radius: var(--radius); }
th {
  text-transform: uppercase;
  letter-spacing: .05em;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
}
tbody tr { transition: background-color .12s ease; }

/* ---- alerts, tabs: pick up the new radius / a firmer active tab ---- */
.alert { border-radius: var(--radius); }
.tabs a.active { border-bottom-width: 2.5px; }


/* --------------------------------------------------------------------------
   New colour skins. Each sets the same full token set in light and in dark,
   so nothing leaks across the light/dark line. Credit/debit stay green/red in
   every skin (accounting semantics) and are left to inherit from the base.
   The faint canvas texture for all four is the same crops-and-pulses tile as
   green/orange, in a neutral grey.
   -------------------------------------------------------------------------- */
:root[data-accent="ocean"],
:root[data-accent="violet"],
:root[data-accent="teal"],
:root[data-accent="slate"] {
  --field-pattern: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300' viewBox='0 0 300 300'><g fill='none' stroke='%23808080' stroke-opacity='.16' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'><g transform='translate(42 170) rotate(-6)'><path d='M0 0V-76'/><path d='M0-36c-9-3-14-11-14-18 7 1 12 7 14 18zM0-46c9-3 14-11 14-18-7 1-12 7-14 18zM0-56c-9-3-14-11-14-18 7 1 12 7 14 18zM0-66c9-3 14-11 14-18-7 1-12 7-14 18zM0-76c-3-6-3-12 0-18 3 6 3 12 0 18z'/><path d='M-14-54l-6-13M14-64l6-13M-14-74l-6-13M14-84l6-13M0-94v-11'/><path d='M0-10c-7-9-17-12-27-10 6 7 16 11 27 10z'/></g><g transform='translate(118 138)'><path d='M0 0C1-38 8-68 30-82s46-8 50 12'/><path d='M30-82c0 10 4 18 10 22M48-86c2 10 0 20-4 26M64-80c4 8 4 18 0 24'/><path d='M80-70c-2-4-2-8 0-11 2 3 2 7 0 11zM78-58c-2-4-2-8 0-11 2 3 2 7 0 11zM40-60c-3-3-4-7-3-11 3 3 4 7 3 11zM44-60c1-4 3-7 6-9 0 4-2 7-6 9zM64-56c-2-4-2-8 0-11 2 3 2 7 0 11zM60-66c-3-2-5-6-5-10 3 2 5 6 5 10zM68-66c0-4 2-7 5-9 0 4-2 7-5 9zM30-70c-3-3-4-7-3-11 3 3 4 7 3 11z'/><path d='M0-20c9-10 20-14 30-12-7 8-18 13-30 12z'/></g><g transform='translate(248 84) rotate(16)'><clipPath id='cob'><path d='M0-36c9 0 13 15 13 34S8 30 0 30s-13-12-13-32S-9-36 0-36z'/></clipPath><path d='M0-36c9 0 13 15 13 34S8 30 0 30s-13-12-13-32S-9-36 0-36z'/><path clip-path='url(%23cob)' d='M-6-40V34M0-40V34M6-40V34M-16-22h32M-16-10h32M-16 2h32M-16 14h32'/><path d='M-3 30C-18 24-26 4-22-24M3 30C18 24 26 4 22-24M0 30v16'/></g><g transform='translate(96 246) rotate(-16)'><path d='M-38 0c10-14 66-14 76 0-10 11-66 11-76 0z'/><circle cx='-22' cy='-1' r='5.5'/><circle cx='-7' cy='-2' r='6'/><circle cx='8' cy='-2' r='6'/><circle cx='23' cy='-1' r='5.5'/><path d='M38 0l7-4M-38 0c-6 0-10 4-8 8s8 3 7-2'/></g><g transform='translate(236 222) rotate(-32)'><path d='M-30 0q0-8 10-7q5-5 10 0q5-5 10 0q5-5 10 0q9 0 10 7q-1 7-10 7q-5 5-10 0q-5 5-10 0q-5 5-10 0q-10 1-10-7z'/><path d='M20 0l8-3M-30 0l-8 3'/></g><g transform='translate(168 206) rotate(-28)'><path d='M-14 0c0-7 5-9 9-7 3 1 5 1 8-1 5-3 11 0 11 8s-6 11-11 8c-3-2-5-2-8-1-4 2-9 0-9-7z'/><path d='M-8-4v8M0-5v10M7-5v10'/></g><g transform='translate(196 150)'><path d='M0 16V0'/><path d='M0 2c-4-8-12-10-18-8 3 7 11 10 18 8zM0 0c4-7 11-9 17-7-3 6-10 9-17 7z'/></g></g><g fill='%23808080' fill-opacity='.22'><circle cx='22' cy='30' r='2.6'/><ellipse cx='30' cy='38' rx='2' ry='3' transform='rotate(30 30 38)'/><circle cx='78' cy='40' r='2.4'/><ellipse cx='270' cy='150' rx='2' ry='3' transform='rotate(-20 270 150)'/><circle cx='262' cy='158' r='2.6'/><ellipse cx='146' cy='270' rx='2' ry='3' transform='rotate(60 146 270)'/><circle cx='156' cy='278' r='3.2'/><ellipse cx='282' cy='266' rx='2' ry='3' transform='rotate(10 282 266)'/><circle cx='18' cy='270' r='2.6'/><ellipse cx='26' cy='262' rx='2' ry='3' transform='rotate(-40 26 262)'/><ellipse cx='206' cy='176' rx='2' ry='3' transform='rotate(20 206 176)'/><circle cx='112' cy='176' r='2.4'/><ellipse cx='60' cy='208' rx='2' ry='3' transform='rotate(-60 60 208)'/><circle cx='186' cy='20' r='2.6'/><ellipse cx='196' cy='26' rx='2' ry='3' transform='rotate(40 196 26)'/></g></svg>");
}

/* ---- Ocean ---- */
:root[data-accent="ocean"] {
  --bg-1: #eef4fc; --bg-2: #dde9f7;
  --bg-glow: rgba(37, 99, 235, .16); --bg-sun: rgba(14, 165, 233, .10);
  --panel: #ffffff; --panel-2: #eef3fb; --border: #d3e0f0; --row-hover: #eef3fb;
  --ink: #15263c; --muted: #59697e;
  --brand: #2563eb; --brand-2: #1d4ed8; --brand-ink: #ffffff; --accent: #0891b2;
  --glass-bg: rgba(255, 255, 255, .20); --glass-brd: rgba(255, 255, 255, .50); --glass-hi: rgba(255, 255, 255, .45);
  --side-1: #1e3a8a; --side-2: #10204f; --side-ink: #dbe6fb; --side-dim: #93a9d6;
}
:root[data-theme="dark"][data-accent="ocean"] {
  --bg-1: #0b1220; --bg-2: #060b15;
  --bg-glow: rgba(59, 130, 246, .18); --bg-sun: rgba(14, 165, 233, .07);
  --panel: #101a2b; --panel-2: #16233a; --border: #263850; --row-hover: #17243c;
  --ink: #e2e9f5; --muted: #94a5be;
  --brand: #4f8ef7; --brand-2: #3b7de0; --brand-ink: #04122b; --accent: #22b8d8;
  --glass-bg: rgba(255, 255, 255, .06); --glass-brd: rgba(255, 255, 255, .16); --glass-hi: rgba(255, 255, 255, .18);
  --side-1: #17295c; --side-2: #0a1434; --side-ink: #d6e2fa; --side-dim: #8296c2;
}

/* ---- Violet ---- */
:root[data-accent="violet"] {
  --bg-1: #f4f0fd; --bg-2: #e7ddf9;
  --bg-glow: rgba(124, 58, 237, .16); --bg-sun: rgba(192, 38, 211, .10);
  --panel: #ffffff; --panel-2: #f4eefc; --border: #e2d6f3; --row-hover: #f4eefc;
  --ink: #251a39; --muted: #6a5e80;
  --brand: #7c3aed; --brand-2: #6d28d9; --brand-ink: #ffffff; --accent: #c026d3;
  --glass-bg: rgba(255, 255, 255, .20); --glass-brd: rgba(255, 255, 255, .50); --glass-hi: rgba(255, 255, 255, .45);
  --side-1: #4c1d95; --side-2: #2c0f63; --side-ink: #e8ddfb; --side-dim: #b9a6e0;
}
:root[data-theme="dark"][data-accent="violet"] {
  --bg-1: #150f23; --bg-2: #0e0a19;
  --bg-glow: rgba(139, 92, 246, .18); --bg-sun: rgba(217, 70, 239, .07);
  --panel: #181226; --panel-2: #201934; --border: #352a4f; --row-hover: #221b38;
  --ink: #e9e2f6; --muted: #a596bf;
  --brand: #9d6bf5; --brand-2: #8b53ef; --brand-ink: #120428; --accent: #e05ae6;
  --glass-bg: rgba(255, 255, 255, .06); --glass-brd: rgba(255, 255, 255, .16); --glass-hi: rgba(255, 255, 255, .18);
  --side-1: #3b1d78; --side-2: #1f0d49; --side-ink: #e2d6f9; --side-dim: #a48fce;
}

/* ---- Teal ---- */
:root[data-accent="teal"] {
  --bg-1: #e8f6f3; --bg-2: #d3ece7;
  --bg-glow: rgba(13, 148, 136, .16); --bg-sun: rgba(45, 212, 191, .11);
  --panel: #ffffff; --panel-2: #e8f5f1; --border: #cae4de; --row-hover: #e8f5f1;
  --ink: #11302b; --muted: #4e6f68;
  --brand: #0d9488; --brand-2: #0f766e; --brand-ink: #ffffff; --accent: #d97706;
  --glass-bg: rgba(255, 255, 255, .20); --glass-brd: rgba(255, 255, 255, .50); --glass-hi: rgba(255, 255, 255, .45);
  --side-1: #115e59; --side-2: #0a3b38; --side-ink: #d3ebe7; --side-dim: #8fbdb6;
}
:root[data-theme="dark"][data-accent="teal"] {
  --bg-1: #081614; --bg-2: #04100e;
  --bg-glow: rgba(20, 184, 166, .17); --bg-sun: rgba(45, 212, 191, .07);
  --panel: #0f1e1c; --panel-2: #152826; --border: #254340; --row-hover: #162927;
  --ink: #dcefec; --muted: #8aa9a3;
  --brand: #22c3b2; --brand-2: #16a99a; --brand-ink: #03201d; --accent: #e0a93a;
  --glass-bg: rgba(255, 255, 255, .06); --glass-brd: rgba(255, 255, 255, .16); --glass-hi: rgba(255, 255, 255, .18);
  --side-1: #0e4d49; --side-2: #052b29; --side-ink: #d0ebe7; --side-dim: #7fada7;
}

/* ---- Slate (graphite surfaces, a blue accent for the live bits) ---- */
:root[data-accent="slate"] {
  --bg-1: #f1f3f7; --bg-2: #e3e8ef;
  --bg-glow: rgba(71, 85, 105, .13); --bg-sun: rgba(100, 116, 139, .09);
  --panel: #ffffff; --panel-2: #eef1f6; --border: #dae0e9; --row-hover: #eef1f6;
  --ink: #1b232e; --muted: #5b6673;
  --brand: #475569; --brand-2: #334155; --brand-ink: #ffffff; --accent: #2563eb;
  --glass-bg: rgba(255, 255, 255, .22); --glass-brd: rgba(255, 255, 255, .52); --glass-hi: rgba(255, 255, 255, .48);
  --side-1: #2b3440; --side-2: #161b23; --side-ink: #dde3ec; --side-dim: #9aa6b6;
}
:root[data-theme="dark"][data-accent="slate"] {
  --bg-1: #0c0f14; --bg-2: #07090d;
  --bg-glow: rgba(100, 116, 139, .15); --bg-sun: rgba(148, 163, 184, .06);
  --panel: #14181f; --panel-2: #1b212a; --border: #2c3542; --row-hover: #1c232d;
  --ink: #e4e8ee; --muted: #99a4b3;
  --brand: #94a3b8; --brand-2: #7c8ba1; --brand-ink: #12151b; --accent: #4f8ef7;
  --glass-bg: rgba(255, 255, 255, .05); --glass-brd: rgba(255, 255, 255, .14); --glass-hi: rgba(255, 255, 255, .16);
  --side-1: #232a34; --side-2: #12151b; --side-ink: #dde3ec; --side-dim: #8b96a6;
}


/* --------------------------------------------------------------------------
   Skin picker — the row of colour swatches in the user menu (replaces the old
   single green/orange toggle). Swatch colours are fixed, not theme-driven, so
   each one always previews its own skin.
   -------------------------------------------------------------------------- */
.user-pop-label {
  padding: 10px 10px 2px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}
.skin-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 10px 6px;
}
.skin-swatch {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.skin-swatch > span[aria-hidden] {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14);
}
/* Tamil letters are not spaced apart: the small tracked-out labels (sidebar
   sections, table heads, stat labels) read as scattered glyphs in Tamil, so
   letter-spacing is dropped everywhere on a Tamil page. */
html[lang="ta"] body,
html[lang="ta"] body * { letter-spacing: normal !important; }

/* the தமிழ் / English switch above the dark-mode toggle: two links, the
   current language marked (aria-current) — a full page load either way */
.lang-picker {
  display: flex;
  gap: 4px;
  margin: 6px 10px 4px;
  padding: 3px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.lang-picker a {
  flex: 1;
  padding: 5px 8px;
  border-radius: 7px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}
.lang-picker a:hover { color: var(--ink); text-decoration: none; }
.lang-picker a[aria-current="true"] {
  background: var(--panel);
  color: var(--brand);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}
.lang-picker a:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

.skin-swatch:hover { transform: translateY(-1px); }
.skin-swatch:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.skin-swatch[aria-pressed="true"] {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
.skin-green  > span[aria-hidden] { background: linear-gradient(135deg, #2f7d3a, #b7791f); }
.skin-orange > span[aria-hidden] { background: linear-gradient(135deg, #d9691e, #f0a13a); }
.skin-ocean  > span[aria-hidden] { background: linear-gradient(135deg, #2563eb, #0891b2); }
.skin-violet > span[aria-hidden] { background: linear-gradient(135deg, #7c3aed, #c026d3); }
.skin-teal   > span[aria-hidden] { background: linear-gradient(135deg, #0d9488, #2dd4bf); }
.skin-slate  > span[aria-hidden] { background: linear-gradient(135deg, #475569, #94a3b8); }

@media (prefers-reduced-motion: reduce) {
  .skin-swatch { transition: none; }
  .skin-swatch:hover { transform: none; }
}


/* --------------------------------------------------------------------------
   Logbook (super-admin activity log) — logbook/index.php
   -------------------------------------------------------------------------- */
.logbook-table td { vertical-align: top; }
.logbook-table .badge { white-space: nowrap; }
.logbook-table td:nth-child(5) { min-width: 220px; }   /* Details — give it room */


/* --------------------------------------------------------------------------
   Mandi picture — mandies/picture.php, the Mandies list, Edit Mandi.
   Shown whole (not cropped), as it prints on the PDF letterhead; a mandi with
   no picture gets its initials in a brand circle, like the PDF.
   -------------------------------------------------------------------------- */
.mandi-photo {
  width: 72px;
  height: 72px;
  flex: none;
  object-fit: contain;
  border-radius: 8px;
}
.mandi-photo-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: .04em;
  color: #fff;
  background: var(--brand);
}
.mandi-photo-sm { width: 34px; height: 34px; font-size: 12px; }
.mandi-photo-current { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.mandi-cell { display: flex; align-items: center; gap: 10px; }
.mandi-photo-remove { margin-top: 12px; }
/* district logo: square-cornered like the PDF; a dashed empty box until uploaded */
.district-logo-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 2px dashed var(--border);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.15;
}
.mandi-photo-sm.district-logo-empty { font-size: 0; border-width: 1px; }
.district-logo-link { display: inline-flex; align-items: center; gap: 8px; }

/* the popup asking for a missing district logo (a secretary) or mandi picture
   (an admin) right after sign-in (letterhead_ask_html(), app.js section 19) */
.logo-ask {
  width: min(500px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 22px 22px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}
.logo-ask::backdrop {
  background: rgba(10, 26, 12, .55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.logo-ask h2 { margin: 0 0 8px; font-size: 18px; }
.logo-ask p { margin: 0; font-size: 13.5px; }
.logo-ask-pick { display: flex; align-items: center; gap: 16px; margin-top: 16px; }
.logo-ask-preview { flex: none; display: flex; }
.logo-ask-pick .field { flex: 1; min-width: 0; }
.logo-ask-pick input[type="file"] { max-width: 100%; }
.logo-ask .form-actions { justify-content: flex-end; }
@media (max-width: 480px) {
  .logo-ask { padding: 18px 16px 14px; }
  .logo-ask-pick { flex-direction: column; align-items: flex-start; }
  .logo-ask-pick .field { width: 100%; }
  .logo-ask .form-actions .btn { flex: 1; }
}
@media (prefers-reduced-motion: no-preference) {
  .logo-ask[open] { animation: logo-ask-in .22s ease-out; }
}
@keyframes logo-ask-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
}

/* user profile picture (DP): a circle, initials until one is uploaded */
.user-photo {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
}
.user-photo-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .04em;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--accent));
}
.user-photo-lg { width: 96px; height: 96px; font-size: 30px; box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--border); }
.user-photo-sm { width: 30px; height: 30px; font-size: 11px; }
.user-photo-current { display: flex; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.user-photo-form { flex: 1 1 240px; min-width: 0; }
.user-cell { display: inline-flex; align-items: center; gap: 10px; }
.user-chip .avatar-img { object-fit: cover; padding: 0; }


/* --------------------------------------------------------------------------
   IST clock — top right, just left of the user chip (header.php; ticks in
   app.js section 12). Kept last: the compact phone block above resets
   .topbar's padding with a shorthand, and the phone rule here must win.
   -------------------------------------------------------------------------- */
.user-menu { display: flex; align-items: center; gap: 10px; }
.ist-clock {
  align-self: stretch;                   /* same height as the chip beside it */
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  padding: 3px 14px;
  border-radius: 14px;
  border: 1px solid var(--glass-brd);
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
  box-shadow: var(--shadow);
  color: var(--ink);
  line-height: 1.2;
  white-space: nowrap;
}
.ist-row { display: inline-flex; align-items: center; gap: 6px; }
.ist-time {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;    /* digits don't jiggle as they tick */
  letter-spacing: .01em;
}
.ist-date { font-size: 11px; font-weight: 600; color: var(--muted); }

@media (max-width: 900px) {
  /* the menu floats over the top bar: keep the bar's own items clear of it
     (--tl-menu-w is the menu's measured width, set by app.js) */
  .topbar { padding-right: calc(var(--tl-menu-w, 0px) + 18px); }
  .topbar-brand { flex-shrink: 0; }      /* only the mandi pill gives way (it ellipsizes) */
  .topbar-mandi.is-cramped { visibility: hidden; }   /* too narrow to read; it's in the drawer too */
  .user-menu { gap: 8px; }
  .ist-clock {
    padding: 2px 10px;
    color: #fff;
    background: rgba(255, 255, 255, .10);
    border-color: rgba(255, 255, 255, .18);
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .ist-time { font-size: 13px; }
  .ist-date { font-size: 10px; color: var(--side-dim); }
}
@media (max-width: 480px) {
  .ist-date, .ist-sec { display: none; }  /* phones: just "03:42 PM" */
  .ist-clock { padding: 0 8px; border-radius: 99px; }
}

/* The bell adds real width to the floating menu, which --tl-menu-w then
   reserves out of the top bar (above) -- on the narrowest phones (with an
   already-long mandi committee name) that reservation can crowd the brand,
   which never shrinks (flex-shrink: 0). Shrink the bell itself here, same
   idea as .user-chip losing its name at this width, to give the budget back. */
@media (max-width: 480px) {
  .notif-bell { width: 24px; height: 24px; }
  .notif-bell svg { width: 14px; height: 14px; }
  .notif-badge { min-width: 14px; height: 14px; font-size: 9px; line-height: 14px; top: -2px; right: -2px; }
  .user-menu { gap: 4px; }
}
/* Narrow phones: the brand + clock + bell + chip no longer fit, and the clock
   was drawn over the brand. Drop the clock on the narrowest screens -- the
   phone shows the time anyway. --tl-menu-w re-measures the smaller menu on
   its own. */
@media (max-width: 340px) {
  .ist-clock { display: none; }
}

/* ---- wide day-book tables (Daily Trade): tighter cells so all columns fit a laptop screen ---- */
table.panel-table.table-compact th,
table.panel-table.table-compact td { padding: 8px 8px; font-size: 13px; }
table.panel-table.table-compact th { font-size: 11px; letter-spacing: .03em; }
table.panel-table.table-compact th:first-child,
table.panel-table.table-compact td:first-child { padding-left: 12px; }
table.panel-table.table-compact .num,
table.panel-table.table-compact .nowrap { white-space: nowrap; }
/* Edit / Delete stack instead of widening the table */
table.panel-table.table-compact td.row-actions > .btn,
table.panel-table.table-compact td.row-actions > form { display: block; width: max-content; }
table.panel-table.table-compact td.row-actions > form { margin-top: 4px; }

/* --------------------------------------------------------------------------
   Network meter — top right, left of the IST clock (header.php; app.js §15).
   Same glass chip as the clock; the dot's colour is data-state.
   -------------------------------------------------------------------------- */
.net-meter {
  align-self: stretch;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  padding: 3px 12px;
  border-radius: 14px;
  border: 1px solid var(--glass-brd);
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
  box-shadow: var(--shadow);
  color: var(--ink);
  font: inherit;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}
.net-meter:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--glass-brd)); }
.net-meter:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.net-row { display: inline-flex; align-items: center; gap: 6px; }
.net-val { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.net-sub { font-size: 11px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.net-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.net-meter[data-state="good"] .net-dot { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); }
.net-meter[data-state="ok"]   .net-dot { background: #eab308; box-shadow: 0 0 0 3px rgba(234, 179, 8, .22); }
.net-meter[data-state="bad"]  .net-dot { background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, .22); }
.net-meter[data-state="wait"] .net-dot { animation: tl-net-pulse 1.2s ease-in-out infinite; }
@keyframes tl-net-pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .net-meter[data-state="wait"] .net-dot { animation: none; } }

@media (max-width: 900px) {   /* on the dark phone/tablet bar, like the clock */
  .net-meter {
    padding: 2px 10px;
    color: #fff;
    background: rgba(255, 255, 255, .10);
    border-color: rgba(255, 255, 255, .18);
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .net-val { font-size: 13px; }
  .net-sub { font-size: 10px; color: var(--side-dim); }
}
@media (max-width: 760px) {   /* small tablets: just the dot + speed */
  .net-sub { display: none; }
  .net-meter { padding: 0 8px; border-radius: 99px; }
  .net-val { font-size: 12px; }
}
@media (max-width: 640px) {   /* phones: the dot alone (tap for details) */
  .net-val { display: none; }
  .net-meter { padding: 0 7px; }
}
/* below 380px the brand + clock + bell + chip already fill the bar, and even
   the dot pushed into the brand; drop the meter there (as the clock drops at 340) */
@media (max-width: 380px) {
  .net-meter { display: none; }
}

/* --------------------------------------------------------------------------
   Upload review — the Errors panel and the bulk-assign bar on every upload's
   details page (includes/upload_review.php, app.js §16)
   -------------------------------------------------------------------------- */
.upload-errors { border-left: 4px solid var(--debit); }
.upload-errors-intro { margin: 0 0 10px; }
.upload-error-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.upload-error-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  align-items: baseline;
  padding: 8px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--debit) 7%, transparent);
}
.upload-error-count { font-weight: 700; color: var(--debit); white-space: nowrap; font-variant-numeric: tabular-nums; }
.upload-error-msg { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.upload-error-rows { grid-column: 2; font-size: 12px; overflow-wrap: anywhere; }

details.upload-rows { margin-bottom: 20px; }
details.upload-rows > summary { cursor: pointer; font-weight: 600; color: var(--brand); margin-bottom: 10px; }

.bulk-groups { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 12px; }
button.chip.bulk-chip { cursor: pointer; font: inherit; font-size: 12px; color: var(--ink); }
.bulk-chip b { font-weight: 700; color: var(--muted); margin-left: 2px; }
.bulk-chip:hover { border-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.bulk-chip[aria-pressed="true"] { color: var(--brand-ink); background: var(--brand); border-color: var(--brand); }
.bulk-chip[aria-pressed="true"] b { color: inherit; }
.bulk-chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.bulk-col { width: 1%; text-align: center; }
.bulk-tick { width: 18px; height: 18px; margin: 0; cursor: pointer; accent-color: var(--brand); vertical-align: middle; }
tr.is-picked > td { background: color-mix(in srgb, var(--brand) 9%, transparent); }

.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin: 12px 0 20px;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.bulk-bar.has-picks {   /* something ticked: the bar stays in view while its rows scroll past */
  position: sticky;
  bottom: 12px;
  z-index: 5;
  border-color: color-mix(in srgb, var(--brand) 55%, var(--border));
  box-shadow: 0 -2px 18px rgba(0, 0, 0, .12), var(--shadow);
}
.bulk-count { font-weight: 600; }
.bulk-bar.has-picks .bulk-count { color: var(--brand); }
.bulk-pick { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bulk-pick .combo--inline { width: 260px; }
.bulk-bar .btn:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 640px) {   /* phones: the search box and the button each get the full width */
  .bulk-bar { padding: 10px 12px; gap: 8px; }
  .bulk-pick { width: 100%; }
  .bulk-pick .combo--inline, .bulk-pick .btn { flex: 1 1 100%; width: 100%; }
}

/* ---- Payment Tally (payment_tally/, farmer_payments/, wrong_payments/) ----
   The tally sheet reads top to bottom like a statement: a narrow column for
   the + / − / = sign, the line, the amount. The form sits beside it on wide
   screens and above it on phones. */
.tally-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 20px 28px;
  align-items: start;
}
.tally-form .field { margin-bottom: 12px; }
.tally-form input[name="bank_balance"] { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tally-sheet { margin: 0; }
.table-wrap > table.panel-table.tally-sheet { min-width: 0; }   /* three columns: fits a phone, no side-scroll */
.tally-sheet td { vertical-align: top; }
.tally-sheet td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.tally-sheet .tally-op {
  width: 1%;
  padding-right: 0;
  text-align: center;
  font-weight: 800;
  color: var(--muted);
}
.tally-sheet tr.tally-total td { border-top: 2px solid var(--border); }
.tally-sheet tr.tally-due td { background: color-mix(in srgb, var(--brand) 8%, transparent); }
.tally-sheet tr.tally-result td { border-top: 2px solid var(--border); font-size: 15px; }
.tally-sheet tr.tally-result .badge { font-size: 13px; }
details.tally-why { margin-top: 16px; }
details.tally-why > summary { cursor: pointer; font-weight: 600; color: var(--brand); }
details.tally-why ul { margin: 8px 0 0; padding-left: 20px; line-height: 1.6; }
details.tally-why li + li { margin-top: 4px; }
.bulk-pick .bulk-ref { width: 230px; }
@media (max-width: 900px) {
  .tally-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .bulk-pick .bulk-ref { flex: 1 1 100%; width: 100%; }
}
@media print {
  .tally-print { max-width: none !important; box-shadow: none; border: 0; }
}

/* ---- Registers & Logs (registers/, daily_log/) ----
   The daily log reads as cards, not a wide table, so staff can read and write
   it on a phone; the 14-day strip shows at a glance which days are empty. */
.dlog-strip { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 6px; }
.dlog-day-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--credit) 10%, var(--panel));
  color: var(--ink);
  text-decoration: none;
  line-height: 1.2;
}
.dlog-day-chip:hover { border-color: var(--brand); text-decoration: none; }
.dlog-day-chip.is-empty { background: color-mix(in srgb, var(--debit) 9%, var(--panel)); border-style: dashed; }
.dlog-day-chip.is-current { outline: 2px solid var(--brand); outline-offset: 1px; }
.dlog-day-name { font-size: 11px; color: var(--muted); }
.dlog-day-num { font-size: 15px; font-weight: 700; }
.dlog-day-count { font-size: 12px; font-weight: 700; color: var(--credit); }
.dlog-day-chip.is-empty .dlog-day-count { color: var(--debit); }
.dlog-day { padding-top: 14px; }
.dlog-day-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0 0 6px; font-size: 16px; }
.dlog-day-head .muted { font-size: 13px; font-weight: 500; }
.dlog-entry { padding: 12px 0; border-top: 1px solid var(--border); }
.dlog-entry:first-of-type { border-top: 0; padding-top: 6px; }
.dlog-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 6px; font-size: 13px; }
.dlog-meta .btn { margin-left: auto; }
.dlog-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.dlog-person { font-weight: 700; margin-bottom: 2px; }
.dlog-details, .dlog-action { white-space: pre-line; line-height: 1.55; }
.dlog-action { margin-top: 6px; padding: 6px 10px; border-left: 3px solid var(--brand); background: color-mix(in srgb, var(--brand) 6%, transparent); border-radius: 0 6px 6px 0; }
.dlog-kinds { display: flex; flex-wrap: wrap; gap: 8px; }
.dlog-kind { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-weight: 500; }
.dlog-kind input { width: auto; margin: 0; accent-color: var(--brand); }
.dlog-kind:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); font-weight: 700; }
@media (max-width: 640px) {
  .dlog-strip { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .dlog-kind { flex: 1 1 100%; }
}
/* the mandi's total land area: asked once on the Infrastructure register, then a card with an Edit button */
.land-ask { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; border-left: 4px solid var(--brand); }
.land-ask-q { display: flex; flex-direction: column; gap: 3px; flex: 1 1 300px; }
.land-ask-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.land-ask-row input { width: 130px; }
.land-ask-row select { width: auto; }
.land-stat .btn { margin-top: 8px; }
@media (max-width: 640px) {
  .land-ask-row { width: 100%; }
  .land-ask-row input, .land-ask-row select { flex: 1 1 120px; }
}
@media print {
  .dlog-day, .register-table { break-inside: auto; box-shadow: none; }
  .dlog-entry { break-inside: avoid; }
}
/* reminders: work still to do, due on a day the writer picked */
.dlog-reminders h2 { display: flex; align-items: center; gap: 10px; }
.dlog-reminder {
  display: grid;
  grid-template-columns: minmax(120px, 190px) minmax(0, 1fr) auto;
  gap: 4px 14px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.dlog-reminder:first-of-type { border-top: 0; }
.dlog-reminder-when { font-weight: 700; color: var(--muted); font-size: 13px; }
.dlog-reminder.is-due .dlog-reminder-when { color: var(--debit); }
.dlog-reminder-what .muted { font-size: 12.5px; }
.dlog-reminder-done { display: flex; gap: 6px; margin: 0; }
.dlog-followup-line { margin-top: 6px; font-size: 13.5px; }
.dlog-followup-line.is-done { color: var(--muted); }
.dlog-followup-line .inline-form { display: inline; margin: 0; }
.dlog-followup-line .btn-link { border: 0; background: none; padding: 0 4px; font: inherit; color: var(--brand); text-decoration: underline; cursor: pointer; }
/* photos */
.dlog-photo { display: inline-block; margin-top: 8px; }
.dlog-photo img, .dlog-photo-current img, .dlog-photo-preview {
  display: block;
  max-width: min(260px, 100%);
  max-height: 200px;
  border-radius: 8px;
  border: 1px solid var(--border);
  object-fit: cover;
}
.dlog-photo-current { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 8px; }
.dlog-photo-preview { margin-top: 8px; }
.dlog-photo-preview[hidden], #dlogPhotoNote[hidden] { display: none; }
@media (max-width: 640px) {
  .dlog-reminder { grid-template-columns: minmax(0, 1fr); }
}
@media print {
  .dlog-photo img { max-height: 160px; }
}

/* the "File language" switch beside a page's Download Excel / Download PDF
   links (download_lang_picker() in includes/i18n.php, app.js section 17):
   the pressed language is the one the files come out in */
.dl-lang {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.dl-lang-label {
  padding: 0 6px 0 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.dl-lang button {
  padding: 5px 10px;
  border: 0;
  border-radius: 7px;
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.dl-lang button:hover { color: var(--ink); }
.dl-lang button[aria-pressed="true"] {
  background: var(--brand);
  color: var(--brand-ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}
.dl-lang button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
@media (max-width: 900px) {
  .form-actions .dl-lang { flex: 1 1 100%; }
  .dl-lang button { flex: 1; min-height: 34px; }
}

/* the note under a commodity's Tamil name box once it fills itself in from
   the name (commodity_tamil_note(), app.js section 18) */
.field .hint.ta-note { display: block; margin-top: 3px; color: var(--brand); }
.field .hint.ta-note[hidden] { display: none; }

/* --------------------------------------------------------------------------
   MI Report (market_info/index.php): the day picker, the rate column groups
   and the weather panel under the table
   -------------------------------------------------------------------------- */
.mi-day { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.mi-day .field { min-width: 180px; }
.mi-day-step { display: flex; gap: 8px; flex-wrap: wrap; }
.mi-table th { vertical-align: bottom; }
.mi-table th.mi-group {
  text-align: center;
  border-bottom: 2px solid color-mix(in srgb, var(--brand) 45%, transparent);
}
.mi-table th:nth-child(n+7), .mi-table tr:first-child th.mi-group { white-space: nowrap; }

.mi-wx { display: grid; grid-template-columns: minmax(200px, 260px) 1fr; gap: 16px; align-items: stretch; }
.mi-wx-main {
  display: flex; align-items: center; gap: 14px;
  padding: 16px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 14%, var(--panel)), var(--panel-2));
  border: 1px solid var(--border);
}
.mi-wx-icon { font-size: 52px; line-height: 1; }
.mi-wx-cond { font-weight: 700; font-size: 16px; }
.mi-wx-temp { font-size: 28px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.mi-wx-temp .muted { font-size: 16px; font-weight: 600; }
.mi-wx-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.mi-wx-item {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}
.mi-wx-item .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.mi-wx-item .value { font-size: 19px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.mi-wx-item .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.mi-wx-loc { margin-top: 12px; border-top: 1px dashed var(--border); padding-top: 10px; }
.mi-wx-loc > summary { cursor: pointer; font-weight: 600; color: var(--brand); }
.mi-wx-loc form { margin-top: 10px; max-width: 520px; }
@media (max-width: 640px) {
  .mi-wx { grid-template-columns: 1fr; }
  .mi-wx-icon { font-size: 42px; }
  .mi-wx-temp { font-size: 24px; }
}

/* --------------------------------------------------------------------------
   Posting Register (posting_register/index.php): headed in three rows like the
   paper register, the heads not posted to yet tinted and hideable
   -------------------------------------------------------------------------- */
.pr-dates { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.pr-dates .field { min-width: 170px; margin: 0; }
.pr-step { display: flex; gap: 8px; flex-wrap: wrap; }
.pr-table th, .pr-table td { padding: 7px 9px; font-size: 13px; }
.pr-table th { text-align: center; vertical-align: bottom; border-left: 1px solid var(--border); }
.pr-table td + td { border-left: 1px solid var(--border); }
.pr-table th.pr-group {
  vertical-align: middle;
  white-space: nowrap;
  border-bottom: 2px solid color-mix(in srgb, var(--brand) 45%, transparent);
}
.pr-table .nowrap { white-space: nowrap; }
.pr-table .pr-span { font-weight: normal; font-size: 12px; white-space: nowrap; }
.pr-table .pr-later { background: color-mix(in srgb, var(--muted) 7%, transparent); }
.pr-table th.pr-later { color: var(--muted); font-weight: 500; }
.pr-table.pr-hide-later .pr-later { display: none; }
.pr-later-toggle { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 4px 0 10px; font-weight: normal; cursor: pointer; }
.pr-later-toggle input { width: auto; margin: 0; }
@media print {
  .pr-table th, .pr-table td { padding: 3px 4px; font-size: 9.5px; }
  .pr-table .pr-later { background: none; }
}

/* The forms on PDL (Form 1, Form 5): a heading over its Inside and Outside columns */
.pdl-form th { vertical-align: bottom; }
.pdl-form th.pdl-group {
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
  border-bottom: 2px solid color-mix(in srgb, var(--brand) 45%, transparent);
}
.pdl-form .pdl-split { border-left: 1px solid var(--border); }
/* a column title read up the page, so a narrow column of figures needn't be as wide as the words over it */
.th-vert { display: inline-block; writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; text-align: left; }
/* Form 5: up to last month, this month and this year side by side, each set off from the one before */
.pdl-form .pdl-span { border-left: 2px solid color-mix(in srgb, var(--brand) 45%, transparent); }
/* the Reports page's day picker (the Posting Register): the days picked as
   ticked boxes, and a row for adding one day or a stretch of them */
.report-dates { max-height: 150px; }
.report-dates-add { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; }
.report-dates-add label { margin: 0; }
.report-dates-add input[type="date"] { width: auto; }

/* every date box, as dd/mm/yyyy (app.js section 20): a text box with a
   calendar button, and the browser's own date box behind it, out of sight,
   so its picker opens where the box is */
.tl-date { position: relative; display: inline-flex; vertical-align: middle; max-width: 100%; }
.tl-date-text { flex: 1 1 auto; width: 10.5em; min-width: 0; font-variant-numeric: tabular-nums; }
.tl-date .tl-date-text { padding-right: 34px; }
.tl-date .tl-date-text.is-bad { border-color: var(--debit); }
.tl-date .tl-date-native {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  margin: 0; padding: 0; border: 0; opacity: 0; pointer-events: none;
}
.tl-date-pick {
  position: absolute; top: 1px; right: 1px; bottom: 1px; width: 32px;
  display: flex; align-items: center; justify-content: center;
  padding: 0; border: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: none; color: var(--muted); cursor: pointer;
}
.tl-date-pick:hover { color: var(--brand); }
.tl-date-pick:disabled { cursor: default; opacity: .45; }
