/* CARA styles.
   Structure and interaction patterns follow the DCP UI Style Guide
   (D:\DCP\DCP Master Prompts\DCP_UI_STYLE_GUIDE.md). The theme layer applies the CARA Brand Kit v2
   (CARA-Brand-Kit-v2/web/styles/tokens.json) and the dashboard look of the CARA brand visuals:
   violet header bar, light lavender sidebar, white tiles with coloured module icons, lavender canvas,
   pill buttons, rounded cards and pill section labels as in the CARA brand collage.
   Component rules use only these roles; dark mode swaps the role values (html[data-theme=dark]). */

/* ---------- theme: CARA (interim) ---------- */
:root {
  --color-accent: #5B38FF;            /* CARA primary violet: primary actions, active states */
  --color-accent-hover: #4A28EB;
  --color-accent-pressed: #3A1CC9;
  --color-accent-tint: #EEEAFF;
  --color-highlight: #00C2AB;         /* CARA accent teal: indicators and highlights, ink text only */
  --color-navigation: #4527D9;        /* Deep violet for selected states on light surfaces */
  --color-navigation-hover: rgba(91, 56, 255, .08);
  --color-navigation-active: #FFFFFF;
  --color-navigation-text: #171546;
  --color-nav-label: #5A5890;
  --color-sidebar: #F1EEFF;           /* Light lavender sidebar */
  --color-header-start: #5B38FF;      /* Violet header bar */
  --color-header-end: #8654FF;
  --color-page: #F5F7FF;              /* CARA background */
  --color-surface: #FFFFFF;
  --color-surface-muted: #F8F7FF;
  --color-surface-hover: #F3F0FF;     /* row and menu hover */
  --color-welcome-end: #F1EEFF;
  --color-lane: #EFEBFF;              /* kanban lanes, path steps, bar tracks */
  --color-lane-hover: #E4DEFF;
  --color-text: #171546;              /* CARA ink */
  --color-text-muted: #4B5470;
  --color-text-faint: #8F8CB8;
  --color-accent-text: #4527D9;       /* violet text on light surfaces */
  --color-link: #5B38FF;
  --color-link-hover: #3A1CC9;
  --color-on-accent: #FFFFFF;
  --color-border: #DCD6FF;            /* CARA border */
  --color-border-strong: #8A7FD0;
  --color-border-soft: #ECE8FF;       /* card edges, row dividers */
  --color-switch-off: #B8B2DE;
  --color-success: #176A45;   --color-success-bg: #E2F6EE;  --color-success-border: #B8E4D0;
  --color-warning: #825500;   --color-warning-bg: #FFF4DC;  --color-warning-border: #F2DCAE;
  --color-danger: #B83737;    --color-danger-bg: #FDECEC;   --color-danger-border: #F2C6C6;
  --color-info: #0069C2;      --color-info-bg: #E5F0FA;
  --color-neutral: #4B5470;   --color-neutral-bg: #EEF0F7;
  --color-success-solid: #176A45;     /* filled backgrounds behind white text */
  --color-danger-solid: #B83737;
  --color-danger-solid-hover: #9A2D2D;
  --color-focus: #5B38FF;
  --color-backdrop: rgba(23, 21, 70, .5);
  --wash-teal: rgba(0, 194, 171, .07);
  --wash-violet: rgba(91, 56, 255, .08);
  --shadow-panel: 0 10px 30px rgba(91, 56, 255, .08);
  --shadow-hover: 0 16px 34px rgba(91, 56, 255, .14);
  --shadow-pop: 0 18px 44px rgba(23, 21, 70, .18);
  --shadow-brand: 0 8px 20px rgba(91, 56, 255, .30);  /* glow under primary pill buttons */
  --radius-sm: 12px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-pill: 999px;
  /* Rounded geometric sans as in the brand visuals. Manrope (the kit's optional font) is used when it is
     installed locally; otherwise Segoe UI, then the kit's Arial fallback. No web fonts are downloaded. */
  --font-sans: Manrope, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;  /* code only */
  --font-num: var(--font-sans);       /* dates, amounts, counts: tabular figures, not monospace */
  --control-height: 44px;
  --rail-width: 256px;
  --gap: 24px;
  /* Module icon colours, as on the dashboard tiles. Decorative only; status colours stay separate. */
  --mod-sales: #5B38FF;      --mod-sales-bg: #EEEAFF;
  --mod-service: #00A08D;    --mod-service-bg: #E0F7F3;
  --mod-marketing: #8B3DFF;  --mod-marketing-bg: #F3EAFF;
  --mod-commerce: #E8761C;   --mod-commerce-bg: #FFF1E3;
  --mod-activity: #0B8FD6;   --mod-activity-bg: #E3F3FC;
  --mod-setup: #334155;      --mod-setup-bg: #ECEEF4;
  color-scheme: light;
}

/* ---------- theme: CARA dark ----------
   Set by /js/theme.js on <html data-theme="dark"> from the user's choice (Light, Dark or System).
   Deep navy-violet surfaces built from CARA ink #171546; violet and teal stay the brand accents. */
html[data-theme="dark"] {
  --color-accent: #7C5CFF;
  --color-accent-hover: #8C70FF;
  --color-accent-pressed: #6847F5;
  --color-accent-tint: #2B2470;
  --color-accent-text: #C3B5FF;
  --color-link: #B3A4FF;
  --color-link-hover: #D6CCFF;
  --color-on-accent: #FFFFFF;
  --color-highlight: #22D6BF;
  --color-navigation: #B3A4FF;
  --color-navigation-hover: rgba(124, 92, 255, .16);
  --color-navigation-active: #262062;
  --color-navigation-text: #DCD8FF;
  --color-nav-label: #8E89C4;
  --color-sidebar: #13112F;
  --color-header-start: #4B2BD6;
  --color-header-end: #7A45F0;
  --color-page: #0F0D2E;
  --color-surface: #1A1744;
  --color-surface-muted: #201C4E;
  --color-surface-hover: #272259;
  --color-welcome-end: #2A2266;
  --color-lane: #221E50;
  --color-lane-hover: #2C2762;
  --color-text: #EEECFF;
  --color-text-muted: #ABA8D4;
  --color-text-faint: #6F6BA3;
  --color-border: #3A3478;
  --color-border-strong: #5D55A8;
  --color-border-soft: #2A255E;
  --color-switch-off: #4A4485;
  --color-success: #4DD69E;   --color-success-bg: rgba(77, 214, 158, .14);   --color-success-border: rgba(77, 214, 158, .32);
  --color-warning: #F4BE55;   --color-warning-bg: rgba(244, 190, 85, .14);   --color-warning-border: rgba(244, 190, 85, .32);
  --color-danger: #FF8A8A;    --color-danger-bg: rgba(255, 138, 138, .14);   --color-danger-border: rgba(255, 138, 138, .32);
  --color-info: #6CB8FF;      --color-info-bg: rgba(108, 184, 255, .14);
  --color-neutral: #C2BFE6;   --color-neutral-bg: rgba(185, 182, 222, .12);
  --color-success-solid: #1E7F54;
  --color-danger-solid: #C24040;
  --color-danger-solid-hover: #A83434;
  --color-focus: #A48CFF;
  --color-backdrop: rgba(5, 4, 20, .7);
  --wash-teal: rgba(0, 194, 171, .06);
  --wash-violet: rgba(124, 92, 255, .14);
  --shadow-panel: 0 10px 30px rgba(0, 0, 0, .32);
  --shadow-hover: 0 16px 34px rgba(0, 0, 0, .45);
  --shadow-pop: 0 18px 44px rgba(0, 0, 0, .55);
  --shadow-brand: 0 8px 22px rgba(124, 92, 255, .42);
  --mod-sales: #9C86FF;      --mod-sales-bg: rgba(124, 92, 255, .18);
  --mod-service: #2ED3BE;    --mod-service-bg: rgba(0, 194, 171, .16);
  --mod-marketing: #B98AFF;  --mod-marketing-bg: rgba(139, 61, 255, .20);
  --mod-commerce: #FFA25A;   --mod-commerce-bg: rgba(232, 118, 28, .18);
  --mod-activity: #4DB5F0;   --mod-activity-bg: rgba(11, 143, 214, .20);
  --mod-setup: #A9B4CC;      --mod-setup-bg: rgba(169, 180, 204, .14);
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.55 var(--font-sans); color: var(--color-text); background: var(--color-page); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
a { color: var(--color-link); text-decoration: none; }
a:hover { color: var(--color-link-hover); text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
h2 { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0; }
code { font-family: var(--font-mono); font-size: 13px; }
.mono { font-family: var(--font-num); font-size: 13px; font-variant-numeric: tabular-nums; }
code { background: var(--color-surface-muted); padding: 1px 5px; border-radius: 5px; }
.muted { color: var(--color-text-muted); }
.small { font-size: 13px; }
.pre { white-space: pre-wrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .02em; color: var(--color-accent-text); }
.overdue { color: var(--color-danger); font-weight: 700; }
.strike { text-decoration: line-through; color: var(--color-text-muted); }
:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 3px; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 300; padding: 8px 14px; background: var(--color-surface); color: var(--color-accent); border-radius: var(--radius-sm); box-shadow: var(--shadow-pop); font-weight: 700; }
.skip-link:focus { top: 12px; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--control-height); padding: 0 20px; border: 1px solid var(--color-border); border-radius: var(--radius-pill);
  background: var(--color-surface); color: var(--color-accent-text); font: 700 14px var(--font-sans); cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .15s, box-shadow .15s, transform .15s; }
.btn:hover { background: var(--color-accent-tint); border-color: var(--color-accent); color: var(--color-accent-text); text-decoration: none; }
.btn:active { background: var(--color-border); }
.btn:disabled { opacity: .5; background: var(--color-surface); border-color: var(--color-border); cursor: not-allowed; }
.btn.brand { background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-header-end) 100%); border-color: transparent; color: var(--color-on-accent); box-shadow: var(--shadow-brand); }
.btn.brand:hover { background: var(--color-accent-hover); border-color: transparent; color: var(--color-on-accent); transform: translateY(-1px); }
.btn.brand:active { background: var(--color-accent-pressed); }
.btn.brand:disabled { background: var(--color-accent); border-color: transparent; color: var(--color-on-accent); opacity: .5; box-shadow: none; transform: none; }
.btn.danger { background: var(--color-danger-solid); border-color: var(--color-danger-solid); color: #fff; }
.btn.danger:hover { background: var(--color-danger-solid-hover); border-color: var(--color-danger-solid-hover); color: #fff; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn.block { width: 100%; margin-top: 12px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-group.wrap { margin: 10px 0 14px; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 1px solid transparent; border-radius: var(--radius-pill); background: none; color: var(--color-text-muted); cursor: pointer; }
.icon-btn:hover { background: var(--color-surface-hover); color: var(--color-text); }
.icon-btn.on { background: var(--color-accent-tint); color: var(--color-accent); border-color: var(--color-border); }
.link { font-size: 14px; font-weight: 700; }
.input { width: 100%; min-height: var(--control-height); padding: 10px 16px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface);
  font: 15px var(--font-sans); color: var(--color-text); }
textarea.input { height: auto; resize: vertical; line-height: 1.6; }
.input:focus { outline: 3px solid var(--color-focus); outline-offset: 1px; border-color: var(--color-focus); }
.input.inline { display: inline-block; width: auto; min-height: 36px; padding: 0 8px; font-size: 13px; margin-left: 8px; }
.search-box { display: flex; align-items: center; gap: 8px; min-height: var(--control-height); padding: 0 18px; border: 1px solid var(--color-border); border-radius: var(--radius-pill);
  background: var(--color-surface); color: var(--color-text-muted); }
.search-box input { border: 0; outline: 0; font: 15px var(--font-sans); width: 100%; background: transparent; color: var(--color-text); }
.search-box:focus-within { outline: 3px solid var(--color-focus); outline-offset: 1px; border-color: var(--color-focus); }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--color-switch-off); border-radius: 22px; transition: background .15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .15s; }
.switch input:checked + span { background: var(--color-accent); }
.switch input:checked + span::before { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.check { display: inline-block; width: 16px; height: 16px; border: 1.5px solid var(--color-border-strong); border-radius: 5px; vertical-align: middle; }
.check.on { background: var(--color-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12l5 5 9-10' stroke='white' stroke-width='3' fill='none'/%3E%3C/svg%3E") center/12px no-repeat; border-color: var(--color-accent); }
input[type=checkbox], input[type=radio] { accent-color: var(--color-accent); width: 18px; height: 18px; }

/* Status labels: always text, colour only reinforces it. */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px 2px 8px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 700; white-space: nowrap;
  background: var(--color-neutral-bg); color: var(--color-neutral); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.success { background: var(--color-success-bg); color: var(--color-success); }
.pill.warning { background: var(--color-warning-bg); color: var(--color-warning); }
.pill.danger { background: var(--color-danger-bg); color: var(--color-danger); }
.pill.info { background: var(--color-info-bg); color: var(--color-info); }
.pill.neutral { background: var(--color-neutral-bg); color: var(--color-neutral); }
.avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700; flex: none; }
.owner { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.tile { display: inline-grid; place-items: center; flex: none; vertical-align: middle; border-radius: var(--radius-sm);
  --tile-fg: var(--mod-sales); --tile-bg: var(--mod-sales-bg); background: var(--tile-bg); color: var(--tile-fg); }
.tile.g-service { --tile-fg: var(--mod-service); --tile-bg: var(--mod-service-bg); }
.tile.g-marketing { --tile-fg: var(--mod-marketing); --tile-bg: var(--mod-marketing-bg); }
.tile.g-commerce { --tile-fg: var(--mod-commerce); --tile-bg: var(--mod-commerce-bg); }
.tile.g-activity { --tile-fg: var(--mod-activity); --tile-bg: var(--mod-activity-bg); }
.tile.g-setup { --tile-fg: var(--mod-setup); --tile-bg: var(--mod-setup-bg); }
.tile.sm { width: 24px; height: 24px; border-radius: 8px; }
.tile.md { width: 30px; height: 30px; }
.tile.lg { width: 44px; height: 44px; border-radius: var(--radius-md); }
.tile.xl { width: 88px; height: 88px; border-radius: var(--radius-lg); }
.badge { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--color-danger-solid); color: #fff;
  font: 700 11px/18px var(--font-sans); text-align: center; }
.badge.small { position: static; display: inline-block; background: var(--color-highlight); color: #171546; }
.badge[hidden] { display: none; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--color-border); border-top-color: var(--color-accent); border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 48px; text-align: center; color: var(--color-text-muted); }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; background: radial-gradient(900px 600px at 100% 0%, rgba(0, 194, 171, .10), transparent 60%), radial-gradient(900px 700px at 0% 100%, rgba(91, 56, 255, .12), transparent 60%), var(--color-page); }
.login-split { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 520px); gap: 32px; padding: 32px; align-items: center; max-width: 1280px; margin: 0 auto; }
.login-art { position: relative; background: radial-gradient(500px 360px at 85% 15%, rgba(0, 194, 171, .28), transparent 65%), linear-gradient(140deg, #6A44FF 0%, #5B38FF 45%, #3A1CC9 100%); border-radius: var(--radius-xl); min-height: 540px; display: grid; place-items: center; padding: 40px 24px 96px; overflow: hidden; box-shadow: var(--shadow-panel); }
.login-art img { width: min(72%, 360px); height: auto; }
.login-art .eyebrow { position: absolute; left: 28px; bottom: 54px; color: var(--color-highlight); }
.login-tag { position: absolute; left: 32px; bottom: 30px; color: #fff; font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.login { padding: 40px; }
.login .logo-full { display: block; width: 190px; height: auto; }
.login h1 { margin-top: 32px; }
.login > .muted { margin-top: 6px; }
.login form { display: grid; gap: 6px; margin: 24px 0 16px; }
.login label { font-size: 14px; font-weight: 700; margin-top: 10px; }

/* Logo: CARA colour logo in the light sidebar and on the sign-in card, white logo in dark mode; app icon in the phone header. */
.logo-dark { display: none !important; }
html[data-theme="dark"] .logo-light { display: none !important; }
html[data-theme="dark"] .logo-dark { display: block !important; }
.rail-logo { display: block; padding: 2px 8px 18px; }
.rail-logo img { display: block; width: 150px; height: auto; }
.rail-logo:focus-visible { outline-color: var(--color-accent); }
.top-symbol { display: none; width: 32px; height: 32px; border-radius: 9px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--rail-width) minmax(0, 1fr); height: 100vh; }
.rail { --icon-knob: var(--color-sidebar); background: var(--color-sidebar); color: var(--color-navigation-text); border-right: 1px solid var(--color-border); padding: 22px 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 12px; font-weight: 700; letter-spacing: .02em; color: var(--color-nav-label); padding: 18px 12px 6px; }
.rail nav { display: grid; gap: 2px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 14px; border-radius: var(--radius-pill); color: var(--color-navigation-text); font-size: 15px; font-weight: 400; }
.nav-item .ico { color: var(--color-accent); }
.nav-item:hover { background: var(--color-navigation-hover); color: var(--color-text); text-decoration: none; }
.nav-item.on { --icon-knob: var(--color-navigation-active); background: var(--color-navigation-active); color: var(--color-accent-text); font-weight: 700; box-shadow: var(--shadow-hover); }
.nav-item.on::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--color-highlight); }
.nav-item .ico { flex: none; }
.rail :focus-visible { outline-color: var(--color-accent); }
.scrim { display: none; }
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; background: radial-gradient(1000px 520px at 100% 0%, var(--wash-teal), transparent 60%), radial-gradient(900px 640px at 0% 100%, var(--wash-violet), transparent 60%), var(--color-page); }
.topbar { display: flex; align-items: center; gap: 18px; height: 72px; padding: 0 28px; background: linear-gradient(100deg, var(--color-header-start) 0%, var(--color-header-end) 100%); color: #fff; flex: none; box-shadow: 0 6px 20px rgba(91, 56, 255, .22); }
.topbar .eyebrow { color: rgba(255, 255, 255, .82); }
.topbar .loc { color: #fff; }
.topbar .search-box { border-color: transparent; box-shadow: 0 2px 8px rgba(23, 21, 70, .12); }
.topbar .btn.brand { background: #fff; border-color: #fff; color: #5B38FF; box-shadow: 0 6px 16px rgba(23, 21, 70, .18); }
.topbar .btn.brand:hover { background: #EEEAFF; border-color: #EEEAFF; color: #3A1CC9; }
.topbar .icon-btn { color: #fff; }
.topbar .icon-btn:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.topbar :focus-visible { outline-color: #fff; }
.menu-btn { display: none; }
.location { display: grid; line-height: 1.25; min-width: 0; }
.location .loc { font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.global-search { position: relative; flex: 1; max-width: 520px; margin-left: auto; }
.search-menu { position: absolute; top: 42px; left: 0; right: 0; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop); padding: 8px; display: none; z-index: 30; }
.search-menu.open { display: block; }
.sm-group { padding: 4px 0; }
.sm-group .eyebrow { padding: 4px 8px; display: block; }
.sm-group a { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: var(--radius-sm); color: var(--color-text); }
.sm-group a:hover { background: var(--color-surface-hover); text-decoration: none; }
.sm-group small { color: var(--color-text-muted); margin-left: auto; }
.sm-all { display: block; padding: 9px 8px 4px; border-top: 1px solid var(--color-border); margin-top: 4px; font-weight: 700; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.dd { position: relative; }
.bell { position: relative; }
.me { border: 0; background: none; cursor: pointer; padding: 2px; border-radius: 50%; }
.me .avatar { width: 40px; height: 40px; font-size: 13px; box-shadow: 0 0 0 2px rgba(255, 255, 255, .85); }
#view { flex: 1; overflow-y: auto; padding: 28px; outline: none; }
#view > * + * { margin-top: var(--gap); }

/* menus */
.menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 210px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop); padding: 6px; margin: 0; list-style: none; display: none; z-index: 40; color: var(--color-text); }
.menu.right { left: auto; right: 0; }
.menu.open { display: block; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 12px; border: 0; border-radius: var(--radius-sm); background: none;
  color: var(--color-text); font: 400 14px var(--font-sans); text-align: left; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--color-surface-hover); text-decoration: none; }
.menu a.on { color: var(--color-accent-text); }
.menu .menu-label { padding: 8px 12px 2px; font-size: 12px; font-weight: 700; color: var(--color-text-muted); }
.menu .theme-row { display: flex; gap: 4px; padding: 4px 6px 8px; margin-bottom: 4px; border-bottom: 1px solid var(--color-border-soft); }
.menu .theme-row button { flex: 1; justify-content: center; min-height: 34px; padding: 0 8px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 700; color: var(--color-text-muted); }
.menu .theme-row button[aria-pressed="true"] { background: var(--color-accent-tint); color: var(--color-accent-text); }
.notif-menu { width: 340px; max-height: 440px; overflow-y: auto; }
.notif-menu h3 { padding: 6px 10px; }
.notif-menu ul { list-style: none; margin: 0; padding: 0; }
.notif-menu li { padding: 9px 10px; border-radius: var(--radius-sm); display: grid; gap: 2px; }
.notif-menu li.unread { background: var(--color-accent-tint); }
.notif-menu small { color: var(--color-text-muted); font: 12px var(--font-num); }
.me-card { display: flex; gap: 10px; align-items: center; padding: 8px 10px 12px; border-bottom: 1px solid var(--color-border); margin-bottom: 6px; }
.me-card .avatar { width: 36px; height: 36px; }

/* to-do footer */
.todo-bar { flex: none; background: var(--color-surface); border-top: 1px solid var(--color-border); position: relative; }
.todo-toggle { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 28px; border: 0; background: none; font: 700 14px var(--font-sans); color: var(--color-text); cursor: pointer; }
.todo-panel { position: absolute; bottom: 44px; left: 16px; width: min(400px, calc(100vw - 32px)); max-height: 60vh; overflow-y: auto; background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius-lg) var(--radius-lg) 0 0; box-shadow: var(--shadow-pop); padding: 16px; }
.todo-panel ul { list-style: none; margin: 12px 0 0; padding: 0; }
.todo-panel li { display: flex; gap: 9px; align-items: center; padding: 8px 2px; border-bottom: 1px solid var(--color-border); }
.todo-panel li small { margin-left: auto; font: 12px var(--font-num); }

/* ---------- panels ---------- */
.card { background: var(--color-surface); border: 1px solid var(--color-border-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow-panel); }
.panel header { display: flex; align-items: center; gap: 10px; padding: 18px 24px; border-bottom: 1px solid var(--color-border-soft); }
.panel header .link, .panel header .btn { margin-left: auto; }
.panel-body { padding: 16px 24px 22px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
/* Section labels are violet pills, as in the brand collage ("Core Workflow"). */
.section-title { display: table; margin-top: 36px !important; padding: 6px 16px; border-radius: var(--radius-pill); background: var(--color-accent-tint); font-size: 13px; font-weight: 700; color: var(--color-accent-text); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.grid-2.wide-left { grid-template-columns: 3fr 2fr; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.empty-state { text-align: center; padding: 48px 24px; display: grid; justify-items: center; gap: 10px; }
.empty-state img { width: 240px; max-width: 100%; height: auto; }
.empty-note { color: var(--color-text-muted); font-size: 14px; margin: 6px 0; }
.page-msg { padding: 22px; }
.notice { padding: 11px 14px; border-radius: var(--radius-sm); margin-top: 14px; font-size: 13px; border: 1px solid; }
.notice.ok { background: var(--color-success-bg); color: var(--color-success); border-color: var(--color-success-border); }
.notice.warn { background: var(--color-warning-bg); color: var(--color-warning); border-color: var(--color-warning-border); }
.notice.info { background: var(--color-info-bg); color: var(--color-text); border-color: var(--color-info); }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.welcome, .hero { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; padding: 24px 28px; background: linear-gradient(110deg, var(--color-surface) 0%, var(--color-surface) 55%, var(--color-welcome-end) 100%); }
.welcome h1 { font-size: 32px; }
.welcome .welcome-mascot { width: 104px; height: auto; margin: -12px 0 -12px auto; }
.welcome p, .hero p { color: var(--color-text-muted); margin-top: 6px; max-width: 640px; }
.hero .btn { margin-top: 16px; }

/* metrics: label, value, explanation */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.kpi { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; row-gap: 2px; align-items: center; padding: 20px 22px; background: var(--color-surface); border: 1px solid var(--color-border-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow-panel); color: var(--color-text); }
.kpi > :not(.tile) { grid-column: 2; }
.kpi > .tile { grid-row: 1 / span 3; width: 48px; height: 48px; border-radius: 16px; }
a.kpi { transition: transform .15s ease, box-shadow .15s ease; }
a.kpi:hover { text-decoration: none; color: var(--color-text); border-color: var(--color-border); transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.kpi-label { font-size: 14px; font-weight: 600; color: var(--color-text-muted); }
.kpi-value { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.kpi-sub { font-size: 13px; color: var(--color-text-muted); }
.kpis.inner { gap: 0; }
.kpis.inner .kpi { box-shadow: none; border: 0; border-right: 1px solid var(--color-border); border-radius: 0; padding: 6px 18px; }
.kpis.inner .kpi:last-child { border-right: 0; }

/* charts */
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; gap: 12px; align-items: center; font-size: 14px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 12px; background: var(--color-lane); border-radius: 6px; overflow: hidden; }
.bar { display: block; height: 100%; border-radius: 6px; }
.bar-value { font: 500 13px var(--font-num); min-width: 54px; text-align: right; }
.cols { display: flex; align-items: flex-end; gap: 10px; height: 210px; padding-top: 20px; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.col-bar { width: 64%; max-width: 44px; background: linear-gradient(180deg, var(--color-header-end), var(--color-accent)); border-radius: 8px 8px 0 0; }
.col-value { font: 500 11px var(--font-num); margin-bottom: 4px; }
.col-label { font: 11px var(--font-num); color: var(--color-text-muted); margin-top: 6px; white-space: nowrap; }

/* lists inside panels */
.task-list, .event-list, .recent-list, .quick-actions { list-style: none; margin: 0; padding: 0; }
.task-list li { display: flex; align-items: center; gap: 9px; padding: 9px 0; border-bottom: 1px solid var(--color-border-soft); flex-wrap: wrap; }
.task-list li .small:first-of-type { margin-left: auto; font-family: var(--font-num); }
.event-list li { display: flex; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--color-border-soft); }
.ev-date { display: grid; place-items: center; width: 50px; padding: 6px; border-radius: var(--radius-md); background: linear-gradient(135deg, var(--color-accent), var(--color-header-end)); color: rgba(255, 255, 255, .85); font: 600 10px/1.2 var(--font-num); text-transform: uppercase; }
.ev-date b { font: 700 19px var(--font-sans); color: #fff; }
.recent-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--color-border-soft); }
.recent-list li .muted { margin-left: auto; }
.quick-actions li { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--color-border-soft); }
.quick-actions li:last-child, .recent-list li:last-child, .task-list li:last-child, .event-list li:last-child { border-bottom: 0; }
.quick-actions li > div { flex: 1; }
.quick-actions p { margin-top: 2px; }

/* ---------- list view ---------- */
.list-header, .rec-header { padding: 20px 22px; }
.lh-top, .rh-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.lh-title { display: flex; align-items: center; gap: 14px; }
.lh-title h1 { font-size: 28px; }
.view-picker { position: relative; }
.view-btn { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 0; cursor: pointer; color: var(--color-text); }
.lh-bottom { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.lh-tools { display: flex; gap: 8px; align-items: center; }
.lh-tools .search-box { width: 260px; }
.seg { display: flex; padding: 3px; gap: 2px; border: 1px solid var(--color-border); border-radius: var(--radius-pill); background: var(--color-surface); }
.seg .icon-btn { height: 34px; width: 38px; }
.table-wrap { position: relative; overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid th { text-align: left; font-size: 13px; font-weight: 700; color: var(--color-text-muted); background: var(--color-surface-muted); border-bottom: 1px solid var(--color-border-soft); padding: 0; white-space: nowrap; }
.grid th:not(:has(button)) { padding: 12px 16px; }
.grid td { padding: 13px 16px; border-bottom: 1px solid var(--color-border-soft); vertical-align: middle; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr { transition: background .12s; }
.grid tbody tr:hover { background: var(--color-surface-hover); }
.grid.compact td { padding: 9px 10px; }
.grid.compact th { padding: 9px 10px; }
.grid td a[href^="tel:"], .grid td .mono { white-space: nowrap; }
.grid .sel { width: 40px; text-align: center; }
.grid .act { width: 76px; text-align: right; white-space: nowrap; }
.card.table-wrap { overflow: hidden; overflow-x: auto; }
.th-sort { width: 100%; min-height: 44px; padding: 0 16px; border: 0; background: none; text-align: left; font: 700 13px var(--font-sans); color: var(--color-text-muted); cursor: pointer; }
.th-sort.sorted { color: var(--color-text); }
.th-sort:hover { background: var(--color-surface-hover); color: var(--color-accent-text); }
.rec-link { font-weight: 700; }
.row-menu { position: relative; display: inline-block; }
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 16px; overflow-x: auto; padding-bottom: 8px; }
.lane { background: var(--color-lane); border-radius: var(--radius-lg); padding: 10px; min-height: 320px; display: flex; flex-direction: column; }
.lane.over { outline: 2px dashed var(--color-accent); outline-offset: -2px; }
.lane header { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 12px; }
.lane header .small { font-family: var(--font-num); }
.lane-cards { display: grid; gap: 10px; align-content: start; flex: 1; }
.kcard { background: var(--color-surface); border: 1px solid var(--color-border-soft); border-radius: var(--radius-md); box-shadow: 0 4px 12px rgba(91, 56, 255, .06); padding: 16px 18px; cursor: grab; display: grid; gap: 4px; font-size: 14px; }
.kcard > a { font-weight: 700; }
.kcard.dragging { opacity: .5; }
.kline { font-size: 13px; }

/* ---------- record page ---------- */
.highlights { display: flex; flex-wrap: wrap; gap: 10px 36px; margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--color-border-soft); }
.highlights dt { font-size: 13px; font-weight: 700; color: var(--color-text-muted); }
.highlights dd { margin: 2px 0 0; font-size: 15px; }
.path { display: flex; gap: 14px; align-items: center; padding: 12px 14px; }
.path ol { display: flex; flex: 1; list-style: none; margin: 0; padding: 0; gap: 4px; overflow-x: auto; }
.path li { flex: 1; min-width: 104px; }
.step { width: 100%; height: 44px; border: 0; background: var(--color-lane); color: var(--color-text); font: 700 13px var(--font-sans); cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: 5px; clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); padding: 0 16px; white-space: nowrap; }
.path li:first-child .step { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); border-radius: 22px 0 0 22px; }
.step:hover { background: var(--color-lane-hover); }
.step.done { background: var(--color-accent-tint); color: var(--color-accent-text); }
.step.current { background: var(--color-accent); color: #fff; }
.step.lost { background: var(--color-danger-solid); color: #fff; }
.step.chosen { background: var(--color-accent-pressed); color: #fff; }
.step:focus-visible { outline-offset: -3px; }
.rec-body { display: grid; grid-template-columns: minmax(0, 2fr) minmax(310px, 1fr); gap: var(--gap); align-items: start; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--color-border-soft); padding: 0 16px; }
.tabs button { border: 0; background: none; min-height: 48px; padding: 0 12px; font: 700 14px var(--font-sans); color: var(--color-text-muted); border-bottom: 3px solid transparent; cursor: pointer; }
.tabs button:hover { color: var(--color-text); }
.tabs button.on { color: var(--color-accent-text); border-bottom-color: var(--color-accent); }
.tab-panel { padding: 16px 22px 22px; }
.detail-sec + .detail-sec { margin-top: 20px; }
.detail-sec h3, .record-form h3 { font-size: 14px; color: var(--color-accent-text); padding-bottom: 8px; border-bottom: 1px solid var(--color-border-soft); margin-bottom: 4px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; margin: 0; column-gap: 28px; }
.detail-grid > div { padding: 10px 2px; border-bottom: 1px solid var(--color-border-soft); }
.detail-grid > div.wide { grid-column: 1 / -1; }
.detail-grid dt { font-size: 13px; font-weight: 700; color: var(--color-text-muted); }
.detail-grid dd { margin: 2px 0 0; min-height: 22px; display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.inline-edit { width: 32px; height: 32px; opacity: 0; }
.detail-grid > div:hover .inline-edit, .inline-edit:focus { opacity: 1; }
.related { border: 1px solid var(--color-border-soft); border-radius: var(--radius-md); padding: 14px 16px; }
.related + .related { margin-top: 14px; }
.related header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.related header .btn { margin-left: auto; }
.rec-side { padding: 20px 22px; position: sticky; top: 0; }
.side-title { font-size: 18px; }
.tl-head { font-size: 13px; font-weight: 700; color: var(--color-accent-text); margin: 18px 0 6px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.tl-item { display: flex; gap: 11px; padding: 10px 0; border-bottom: 1px solid var(--color-border-soft); }
.tl-body { flex: 1; min-width: 0; }
.tl-body p { margin-top: 4px; color: var(--color-text-muted); }
.tl-top { display: flex; gap: 7px; align-items: center; }
.tl-top a { font-weight: 700; flex: 1; min-width: 0; }
.tl-when { font: 12px var(--font-num); color: var(--color-text-muted); white-space: nowrap; }
.tl-when.overdue { color: var(--color-danger); }

/* ---------- calendar ---------- */
.cal { overflow: hidden; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head span { padding: 10px; font-size: 12px; font-weight: 700; color: var(--color-text-muted); background: var(--color-surface-muted); border-bottom: 1px solid var(--color-border); }
.cal-day { min-height: 110px; padding: 6px 8px; border-right: 1px solid var(--color-border-soft); border-bottom: 1px solid var(--color-border-soft); display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.out { background: var(--color-surface-muted); color: var(--color-text-faint); }
.cal-num { font: 500 12px var(--font-num); align-self: flex-end; }
.cal-day.today .cal-num { background: var(--color-accent); color: #fff; border-radius: 50%; width: 26px; height: 26px; display: grid; place-items: center; }
.cal-ev { display: block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: var(--radius-pill); background: var(--color-accent-tint); color: var(--color-accent-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- dialogs and forms ---------- */
.backdrop { position: fixed; inset: 0; background: var(--color-backdrop); display: grid; place-items: center; padding: 16px; z-index: 100; }
.modal { background: var(--color-surface); border-radius: var(--radius-lg); width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow-pop); }
.modal.lg { width: min(860px, 100%); }
.modal.sm { width: min(420px, 100%); }
.modal > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--color-border-soft); }
.modal > header h2 { font-size: 20px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-body > p + * { margin-top: 10px; }
.modal > footer { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--color-border-soft); }
.record-form section + section { margin-top: 22px; }
.record-form h3 { margin-bottom: 14px; }
.req-note { text-align: right; font-size: 13px; color: var(--color-text-muted); margin-bottom: 8px; }
abbr[title=required] { color: var(--color-danger); text-decoration: none; margin-right: 3px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; }
.form-field { display: grid; gap: 5px; align-content: start; }
.form-field.wide { grid-column: 1 / -1; }
.form-field label { font-size: 14px; color: var(--color-text); font-weight: 700; }
.form-field.invalid .input { border-color: var(--color-danger); }
.field-error { color: var(--color-danger); font-size: 13px; font-weight: 700; }
.field-error::before { content: "⚠ "; }
.form-banner { background: var(--color-danger-bg); color: var(--color-danger); border: 1px solid var(--color-danger-border); padding: 9px 12px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.form-banner[hidden] { display: none; }
.lookup { position: relative; }
.lookup-menu { position: absolute; top: 100%; left: 0; right: 0; z-index: 120; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop); list-style: none; margin: 4px 0 0; padding: 4px; display: none; max-height: 240px; overflow-y: auto; }
.lookup-menu.open { display: block; }
.lookup-menu li { padding: 9px 12px; border-radius: var(--radius-sm); cursor: pointer; display: grid; }
.lookup-menu li:hover, .lookup-menu li.active { background: var(--color-accent-tint); }
.lookup-menu small { color: var(--color-text-muted); }
.lookup-menu .empty { color: var(--color-text-muted); cursor: default; }
.any-ref { display: grid; grid-template-columns: 140px 1fr; gap: 6px; }
.code { background: var(--color-surface-muted); border: 1px solid var(--color-border); padding: 9px 11px; border-radius: var(--radius-sm); font: 12px var(--font-mono); overflow-x: auto; }
.file-drop { display: flex; align-items: center; gap: 10px; padding: 16px; border: 2px dashed var(--color-border-strong); border-radius: var(--radius-md); cursor: pointer; margin: 12px 0; color: var(--color-accent); font-weight: 700; }
.file-drop input { font-size: 12px; }
.convert section { padding: 14px 0; border-bottom: 1px solid var(--color-border); display: grid; gap: 9px; }
.convert section:last-child { border-bottom: 0; }
.convert h3 { display: flex; gap: 7px; align-items: center; }
.convert label { display: grid; gap: 5px; font-size: 14px; font-weight: 700; }
.convert .radio { display: flex; align-items: center; gap: 9px; }
.convert .radio .input { max-width: 320px; }
.check-line { display: flex !important; align-items: center; gap: 8px; }
.indent { padding-left: 25px; max-width: 420px; }
.converted { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.conv-card { display: grid; gap: 4px; justify-items: start; padding: 14px; border: 1px solid var(--color-border); border-radius: var(--radius-md); color: var(--color-text); }
.conv-card:hover { border-color: var(--color-accent); text-decoration: none; color: var(--color-text); }

/* toasts */
#toasts { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 200; width: min(520px, calc(100vw - 32px)); }
.toast { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 10px 11px 18px; border-radius: var(--radius-pill); color: #fff;
  background: var(--color-success-solid); box-shadow: var(--shadow-pop); font-weight: 700; }
.toast.error { background: var(--color-danger-solid); }
.toast .icon-btn { color: #fff; }
.toast .icon-btn:hover { background: rgba(255, 255, 255, .15); color: #fff; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .rec-body { grid-template-columns: 1fr; }
  .rec-side { position: static; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; inset: 0 auto 0 0; width: min(var(--rail-width), 84vw); z-index: 90; transform: translateX(-100%); transition: transform .2s ease; }
  .rail.open { transform: none; box-shadow: var(--shadow-pop); }
  .scrim:not([hidden]) { display: block; position: fixed; inset: 0; background: var(--color-backdrop); z-index: 80; }
  .menu-btn { display: inline-grid; }
  .topbar { gap: 10px; padding: 0 16px; height: 64px; }
  .location .eyebrow, .primary-action, .bell { display: none; }
  .top-symbol { display: block; }
  .login-split { grid-template-columns: 1fr; padding: 16px; gap: 16px; }
  .login-art { min-height: 260px; padding: 24px 16px 72px; }
  .login-art img { width: 46%; }
  .login { padding: 28px 22px; }
  .global-search { max-width: none; }
  #view { padding: 16px; }
  #view > * + * { margin-top: 16px; }
  h1, .lh-title h1 { font-size: 26px; }
  .grid-2, .grid-2.wide-left, .grid-3 { grid-template-columns: 1fr; }
  .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .lh-tools, .lh-tools .search-box { width: 100%; }
  .kpis.inner .kpi { border-right: 0; border-bottom: 1px solid var(--color-border); }
  .modal > footer { justify-content: stretch; }
  .modal > footer .btn { flex: 1; justify-content: center; }
  .todo-toggle { padding: 0 16px; }
  .rec-header .btn-group .btn, .list-header .btn-group .btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- CARA dashboard tiles (Home) ---------- */
.module-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; }
.module-tile { display: grid; justify-items: center; gap: 12px; padding: 24px 16px 20px; background: var(--color-surface); border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-panel); color: var(--color-text); font-weight: 700; font-size: 16px; text-align: center; transition: transform .15s ease, box-shadow .15s ease; }
.module-tile:hover { text-decoration: none; color: var(--color-text); transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.module-tile .tile { --icon-knob: var(--tile-fg); width: 60px; height: 60px; border-radius: 18px; color: #fff;
  background: linear-gradient(140deg, color-mix(in srgb, var(--tile-fg) 70%, #fff) 0%, var(--tile-fg) 100%); box-shadow: 0 10px 22px color-mix(in srgb, var(--tile-fg) 32%, transparent); }
.module-tile small { font-weight: 400; font-size: 13px; color: var(--color-text-muted); }
.cara-strip { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 22px; background: var(--color-surface);
  border: 1px solid var(--color-border-soft); border-radius: var(--radius-pill); box-shadow: var(--shadow-panel); }
.cara-strip a { display: inline-flex; align-items: center; gap: 10px; color: var(--color-text); font-weight: 700; }
.cara-strip a:hover { color: var(--color-accent-text); text-decoration: none; }
.cara-strip .sep { flex: 1; min-width: 20px; height: 2px; background: linear-gradient(90deg, var(--color-border), var(--color-highlight), var(--color-border)); border-radius: 2px; }
@media (max-width: 760px) {
  .module-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .module-tile { padding: 16px 10px 14px; font-size: 15px; }
  .cara-strip { border-radius: var(--radius-lg); }
  .cara-strip .sep { display: none; }
  .welcome .welcome-mascot { display: none; }
}

/* Field history and audit log */
.nowrap { white-space: nowrap; }
.inline-label { font-size: 13px; color: var(--color-text-muted); }
.grid.history td { vertical-align: top; }
.audit-more { margin: 14px 0; text-align: center; }
.fb-msg { white-space: pre-wrap; max-width: 46ch; }
.seg-choice { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 4px; }
.field-label { font-size: 14px; color: var(--color-text); font-weight: 700; }
.seg-choice label { font-weight: 400; }
