/* A1CMS design tokens: the single source of truth for colour and type.
   The shared theme (a1-shared-theme.css) aliases its own token names to these,
   so a palette change happens here once.

   Palette rules:
   - Backgrounds are white or a near-white neutral. No cream, no yellow washes.
   - Pastels carry the highlighting. The palette is gold and purple, sampled from
     the A1CMS logo (mark C, Nov 6, 2026): the lavender pastel leads, the logo's
     deep violet is the ink and gold stays the accent (Nov 7, 2026).
   - Gold is a deliberate accent: the active item, the primary action and the
     bevelled edge of a pop-up. It is never a page, panel or row background,
     and never a section outline (the gold outlines went on Oct 30, 2026,
     with the redesign's first theme choice). */

:root {
  /* Ink and neutrals */
  --a1-ink: #24183a;
  --a1-ink-soft: #3a2c52;
  --a1-muted: #5d5574;
  /* Field labels and headings of small groups are brand purple, so a reader tells the name of a field
     from what is in it. The value uses the darker ink above. */
  --a1-label: var(--a1-purple-ink);
  --a1-border: #e6e0f1;
  --a1-border-strong: #cbbfec;

  /* Surfaces */
  /* The page behind every panel: a solid, very light wash of the lavender of the logo tile
     (about 7 percent of --a1-purple-ink over white), so white panels read as raised. */
  --a1-page: #f0ebfc;
  --a1-shell: #ffffff;
  --a1-surface: #ffffff;
  --a1-surface-alt: #f3effd;

  /* Pastel accents */
  /* Deep enough to read at a glance: the redesign deepened every pastel on Oct 30, 2026. */
  --a1-lavender: #e2dafa;
  --a1-lavender-deep: #b7b1f2;
  --a1-purple-ink: #551a7d;
  --a1-purple-soft: #7c5ccf;
  --a1-mint: #cdeee2;
  --a1-sky: #dcd3f8;
  --a1-peach: #ffe9d9;
  --a1-rose: #ffd9e3;

  /* Gold accent */
  --a1-gold: #d4af57;
  --a1-gold-deep: #b98919;
  --a1-gold-ink: #1b1304;
  /* The one count badge: small, gold, restrained corners (header, rail, toolbar icons). */
  /* A count on an icon is a small raised figure: 13 pixels high, 9 pixel type, 2 pixels of side padding (reduced Nov 13, 2026). */
  --a1-count-size: 13px;
  --a1-count-font: 9px;
  --a1-count-pad: 0 2px;
  --a1-count-face: var(--a1-gold-gradient);
  --a1-count-glow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 0 6px rgba(212, 175, 87, 0.55), 0 0 0 1.5px #fff;
  --a1-gold-gradient: linear-gradient(135deg, #f1c84b 0%, #d8b85a 48%, #b98919 100%);
  /* Polished metal, as a lit edge rather than a striped one. Many stops band
     visibly across a 1px border or a small glyph and read as a rendering
     fault, so each ramp here is a single sweep from highlight to shade. */
  --a1-gold-metallic: linear-gradient(180deg, #f4dc93 0%, #c9a13a 46%, #8a6510 100%);
  --a1-gold-edge: linear-gradient(160deg, #f0d78f 0%, #c9a34a 44%, #9d7616 100%);
  --a1-gold-metallic-rule: linear-gradient(90deg, #b8891c 0%, #e8cd7a 30%, #f6e6b4 50%, #e0c063 70%, #a87c11 100%);
  /* The Soft 3D icons use two colour families and no others: gold for the header and for primary actions, and the
     theme accent (purple) for every other icon. scripts/build-icons.py reads these six values, so a change here
     changes every icon after a rebuild. */
  /* The icon golds are the stops of the gold button face, so an icon beside a gold button is the same metallic gold. */
  --a1-icon-gold-light: #ecc865;
  --a1-icon-gold-mid: #e0b752;
  --a1-icon-gold-deep: var(--a1-button-gold-edge);
  /* The light stops are mid tones, never near white, so the top of an icon does not fade into a white or lavender surface. */
  --a1-icon-accent-light: #b9a3ef;
  --a1-icon-accent-mid: #9474dc;
  --a1-icon-accent-deep: #6a3fb8;
  /* One scale of icon sizes (Nov 7, 2026): every icon of a role takes one of these, and the drawing fills about 92 percent
     of the box. Row actions take --a1-icon-sm, tab and rail icons --a1-icon-md, toolbar and top bar icons --a1-icon-lg
     inside a 38 px icon card, dashboard tiles --a1-icon-tile. */
  --a1-icon-xs: 16px;
  --a1-icon-sm: 18px;
  --a1-icon-md: 20px;
  --a1-icon-lg: 22px;
  --a1-icon-xl: 24px;
  --a1-icon-tile: 32px;
  --a1-icon-hero: 40px;
  /* Two roles of icon control (Nov 23, 2026). A header icon (the site header, the page header's quick actions) is a 38 px
     card with a --a1-icon-header drawing. An icon control that sits in a row with fields or buttons is as tall as they are.
     A row control (edit, delete and the like in a table row or a dense list row) and an icon that follows bare text (the
     add icon beside a section heading) is the small control: a --a1-row-control box with a --a1-icon-row drawing, level
     with the text beside it. */
  --a1-icon-header: var(--a1-icon-lg);
  --a1-icon-row: var(--a1-icon-xs);
  --a1-row-control: var(--a1-control-height-sm);
  /* The deep edge tones: the top bar's count badge draws its thin outline in the accent edge (Nov 7, 2026). */
  --a1-icon-gold-edge: #6e4f08;
  --a1-icon-accent-edge: #3d1260;
  /* Gold for words. The ramps above drop below a readable contrast on white
     at their light end, so text uses this darker sweep, which stays above
     4.5 to 1 against white from top to bottom. */
  --a1-gold-text: #725409;
  --a1-gold-text-metallic: linear-gradient(180deg, #96700f 0%, #6b4d08 100%);

  /* The edge of a section. Sections, panels and the sidebar groups are edged
     with the neutral hairline and lifted by a soft shadow; the pastels carry
     the sections and gold stays an accent. The two names stay so every rule
     that edges a section changes here once. */
  --a1-gap-grid: 0.5rem;
  --a1-gap-row: 0.875rem;
  --a1-section-border: var(--a1-border);
  --a1-section-border-strong: var(--a1-border-strong);

  /* Scrollbars have no visible track, only the thin accent thumb. */
  --a1-scrollbar-track: transparent;
  --a1-scrollbar-thumb: rgba(124, 92, 207, 0.85);
  --a1-scrollbar-thumb-hover: var(--a1-purple-soft);

  /* Controls. Every button and every single-line field is one height, so a
     row of fields and buttons lines up. The small height is for compact rows
     only. */
  /* The face of every drop-down and floating panel: a clear tint of the theme, so a panel reads as a surface of its own
     over the page, and the white sections inside it stand out (Nov 3, 2026). */
  --a1-panel-face: linear-gradient(180deg, color-mix(in srgb, var(--a1-lavender) 55%, #ffffff) 0%, var(--a1-lavender) 100%);
  /* Navigation surfaces (side lists, rails, the tab row) are tinted and edged so they stand apart from the white
     content and from the page behind (Nov 3, 2026). */
  --a1-nav-surface: var(--a1-lavender);
  /* A section (a card, a tile, a group box) always contrasts with what it sits on (Nov 3, 2026). On a white surface it
     takes this tinted face and the firm edge; on the tinted page it stays white. */
  --a1-section-face: linear-gradient(180deg, color-mix(in srgb, var(--a1-lavender) 60%, #ffffff) 0%, var(--a1-lavender) 100%);
  --a1-section-edge: #c6b8ee;
  --a1-nav-edge: #bfaff0;
  --a1-control-height: 40px;
  --a1-control-height-sm: 32px;
  /* A field's name sits on one line of this height, with this gap under it; a field with no name keeps the same space
     empty, so every control in a row of fields starts at one top edge (a1-sitewide.css, 'Field rows'). */
  --a1-field-label-line: 20px;
  --a1-field-label-gap: 6px;
  /* An unavailable control is faded once, by this much, and its icon turns grey (a1-icon-states.css). */
  --a1-disabled-opacity: 0.6;

  /* Search fields draw their magnifier inside the field, and the text starts
     clear of it. --a1-search-icon is the drawn search icon, which
     scripts/build-icons.py writes into a1-icons.css. */
  --a1-search-indent: 38px;

  /* Buttons have edged corners: two corners round and two nearly square. */
  --a1-button-max: 22rem; /* no button is ever wider than this, and never stretched to its container */
  --a1-button-radius: 11px 4px;
  --a1-button-radius-sm: 8px 3px;

  /* A resting button is a white face that shades into the lavender pastel, with a lit
     top edge and a shaded bottom edge. */
  --a1-button-face: linear-gradient(180deg, #ffffff 0%, var(--a1-lavender) 130%);
  --a1-button-edge: var(--a1-border-strong);
  --a1-button-bevel: inset 0 1px 0 #ffffff, inset 0 -2px 0 rgba(85, 26, 125, 0.07);
  --a1-button-ring: rgba(183, 166, 236, 0.4);

  /* The primary button is the logo's polished gold with dark text: a bright top edge, a deep lower edge and a dark
     outline (Nov 7, 2026, after the tan buttons). White text on gold does not have enough contrast to read. The face
     never fades to a pale wash: gold is an accent, and the cream and pale yellow tints left the palette
     (scripts/check-reuse.mjs rule R22). */
  --a1-button-gold-face: linear-gradient(180deg, #f6d878 0%, #dcae3c 48%, #a97a12 100%);
  --a1-button-gold-face-hover: linear-gradient(180deg, #fbe28a 0%, #e4b944 48%, #b5841a 100%);
  --a1-button-gold-edge: #a8801c;
  --a1-button-gold-outline: #6e4f08;
  --a1-button-gold-bevel: inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 -2px 0 rgba(120, 84, 8, 0.18);
  --a1-button-gold-ring: rgba(222, 186, 92, 0.42);

  /* A destructive button stays recognisable, in a soft rose. */
  --a1-button-rose-face: linear-gradient(180deg, #ffffff 0%, #fbe4ea 60%, #f2c3d1 100%);
  --a1-button-rose-edge: #d99aae;
  --a1-button-rose-ink: #6f3550;
  --a1-button-rose-ring: rgba(222, 159, 178, 0.35);

  --a1-shadow: 0 16px 34px rgba(36, 24, 58, 0.10);
  --a1-shadow-soft: 0 8px 20px rgba(36, 24, 58, 0.07);

  /* Type: one UI family and one title family for the whole site */
  --a1-title-font: "Fraunces", "Georgia", serif;
  --a1-ui-font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Lists are one size everywhere, so a native Perfex table and a themed one
     do not read as two different products. */
  --a1-table-font-size: 14.5px;

  /* The three sizes a list row uses: the name, the line under it, and the
     smallest line of all (a role, a timestamp). Modules that ship their own
     10px and 11px type are raised to these instead. */
  --a1-list-primary-size: 15px;
  --a1-list-secondary-size: 13.5px;
  --a1-list-meta-size: 12.5px;

  /* One heading size for every dashboard widget, whichever module ships it. */
  --a1-widget-title-size: 16.5px;

  /* Headings of a working page (a page where people edit records, such as Prep): the page title and the section titles. */
  --a1-heading-page: 1.35rem;
  --a1-heading-section: 1.08rem;
  /* The title of every pop-up, drawer, shade and confirm: between the section and the page title, so a pop-up never
     shouts like a page (Nov 18, 2026). a1-sitewide.css applies it; layout check rule r22 fails on any other size. */
  --a1-heading-dialog: 1.2rem;
  /* The title of the shared page header when Matters is active: a record's name in the matter band. */
  --a1-heading-record: 1.6rem;

  /* Meaning keeps its colour, in this palette: money in, money out, a note and
     a warning. Core ships Bootstrap and Tailwind hues that match neither this
     palette nor each other. */
  --a1-positive: #1f7a5c;
  --a1-negative: #b3364d;
  --a1-info: #7d4ab8;
  /* Text a client wrote (the client's entries on a matter's timeline). */
  --a1-client-ink: #2f62b8;
  --a1-warning: #9a6b12;
}

/* A floating panel placed by its bottom edge takes its own height (Nov. 19, 2026). The browser gives every popover
   'height: fit-content', and Safari 26 then draws a panel with a bottom edge and no top edge from the top of the window
   down to that edge: the undo notice, the time picker opening upward and a list opening upward filled the window. Height
   auto gives the panel its content's height in every browser. The rule covers a panel placed by script (its position
   is written on the element) and the panels placed by their bottom edge in a stylesheet. :where() keeps its weight at
   zero, so a panel that sets its own height in its own rule or on the element keeps it. */
:where([popover][style*="bottom"], .a1-undo, .prep-search-panel--sheet) {
  height: auto;
}

/* The one button width rule, in this sheet because every surface loads it (admin, client area, sign-in and guest
   pages), where a1-sitewide.css is admin only. A button is as wide as its label plus its padding, never the width of
   its card, panel, form or dialog, and never wider than --a1-button-max (Nov 1, 2026; moved here Nov 7, 2026 after
   the sign-in page's Login button spanned its card). fit-content caps .btn-block, width: 100%, flex growth and stretch
   alignment in one rule and still lets a long label wrap on a narrow screen. It is !important because it is a fixed
   design rule that a theme's or a module's own width must not undo, and fit-content is never wider than the column.
   The exceptions keep their widths: a select's toggle (a field), tabs, a justified group, a navigation item and a
   menu's items, and an icon button keeps the width its own class sets (only a bare button without a class is
   covered by element name). A set of equal buttons (data-equal-width, the sign-in's Login and Register) shares one width, never
   past the cap. */
:is(.btn, .btn-accu, .a1-bulk-action, .prep-gold, .prep-tb, .accu_keys-btn, button:not([class]), input[type="submit"], input[type="button"]):not(:where(.bootstrap-select > .btn, .btn-group-justified .btn, [data-equal-width], [role="tab"], [role="tablist"] *, .nav .btn, nav *, .dropdown-menu *, .atd-view-btn)) {
  max-width: -webkit-fit-content !important;
  max-width: fit-content !important;
  flex-grow: 0 !important;
}

:is(.btn, button)[data-equal-width] {
  max-width: var(--a1-button-max) !important;
  flex-grow: 0 !important;
  /* One shared least width, so a pair such as 'Apply' and 'Delete' measures the same without a width per page. */
  min-width: 8rem;
}
