/* Components: Clover's shared look, written once (see DESIGN.md and
   ADR-0016). Every page uses these classes, directly or through the
   app/web/views/ui templ components, instead of its own copy.

   Values come from tokens.css; nothing here writes a colour of its own.
   Franken UI still does the behaviour (modals, dropdowns, icons), but none
   of its uk-btn / uk-card / uk-input classes are used for the look. */

/* ---- Page header: breadcrumb, h1, lede, actions ---- */

.cl-page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; color: var(--cl-text); }
.cl-crumb { font-size: 14px; color: var(--cl-muted); margin-bottom: 6px; }
.cl-crumb a { color: inherit; text-decoration: none; }
.cl-crumb a:hover { color: var(--cl-text); text-decoration: underline; }
.cl-crumb span { color: var(--cl-text); }
.cl-h1 { font-size: 33px; font-weight: 700; line-height: 1.1; margin: 0; }
.cl-lede { font-size: 14px; color: var(--cl-muted); margin: 4px 0 0; }
.cl-page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ---- Card ---- */

/* Inside a card the soft fill becomes the plain card colour, so inputs and
   table headers stand out from the card's tint. */
.cl-card { --cl-soft: hsl(var(--card)); background: var(--cl-card-bg); color: var(--cl-text); border: 1px solid var(--cl-border); border-radius: var(--cl-radius-card); padding: var(--cl-card-pad); box-shadow: var(--cl-shadow-card); }
.cl-card-flush { padding: 0; overflow: hidden; }
.cl-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.cl-card-flush > .cl-card-head { margin: 0; padding: 16px; }
.cl-card-heading { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cl-card-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; margin: 0; }
.cl-card-sub { font-size: 13px; color: var(--cl-muted); margin: 2px 0 0; }
.cl-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* Icon tile: the small square beside a card title. Primary-tinted unless a
   .cl-tone-* class gives it a Tone. */
.cl-tile { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--cl-radius-sm); background: var(--cl-primary-soft); color: var(--cl-primary); }
.cl-tile svg, .cl-tile uk-icon { width: 16px; height: 16px; }

/* Avatar: an Account's initials on the primary colour, with a dot when it
   has no email (CONTEXT.md "Profile"). .cl-avatar-lg is the Profile's
   header size. */
.cl-avatar { position: relative; flex: none; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 9999px; background: var(--cl-primary); color: var(--cl-primary-fg); font-size: 12.5px; font-weight: 600; }
.cl-avatar-lg { width: 72px; height: 72px; font-size: 26px; }
.cl-avatar-dot { position: absolute; top: -2px; right: -2px; width: 10px; height: 10px; border-radius: 9999px; background: hsl(var(--destructive)); border: 2px solid hsl(var(--card)); }
.cl-avatar-lg .cl-avatar-dot { top: 2px; right: 2px; width: 14px; height: 14px; }

/* Count beside a title, e.g. "Attendance records 312". */
.cl-count { padding: 1px 8px; border-radius: 9999px; background: var(--cl-primary-soft); color: var(--cl-primary); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- Button ---- */

.cl-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--cl-control-md); padding: 0 16px; border: 1px solid var(--cl-border); border-radius: var(--cl-radius-md); background: hsl(var(--card)); color: var(--cl-text); font-size: 14px; font-weight: 600; line-height: 1; white-space: nowrap; text-decoration: none; cursor: pointer; transition: border-color .15s, background .15s, filter .15s; }
.cl-btn:hover { border-color: var(--cl-primary); color: var(--cl-text); }
.cl-btn:focus-visible { outline: none; box-shadow: var(--cl-focus-ring); }
.cl-btn:disabled, .cl-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.cl-btn svg, .cl-btn uk-icon { flex: none; width: 15px; height: 15px; }

.cl-btn-primary { background: var(--cl-primary); border-color: var(--cl-primary); color: var(--cl-primary-fg); box-shadow: 0 4px 12px hsl(var(--primary) / .25); }
.cl-btn-primary:hover { border-color: var(--cl-primary); color: var(--cl-primary-fg); filter: brightness(.94); }
.cl-btn-ghost { border-color: transparent; background: transparent; color: var(--cl-primary); padding: 0 6px; }
.cl-btn-ghost:hover { border-color: transparent; color: var(--cl-primary); text-decoration: underline; }
.cl-btn-destructive { background: hsl(var(--destructive)); border-color: hsl(var(--destructive)); color: hsl(var(--destructive-foreground)); }
.cl-btn-destructive:hover { border-color: hsl(var(--destructive)); color: hsl(var(--destructive-foreground)); filter: brightness(.94); }

.cl-btn-sm { height: var(--cl-control-sm); padding: 0 12px; border-radius: var(--cl-radius-sm); font-weight: 500; }
.cl-btn-sm svg, .cl-btn-sm uk-icon { width: 14px; height: 14px; }
.cl-btn-xs { height: var(--cl-control-xs); padding: 0 10px; border-radius: var(--cl-radius-xs); font-size: 13px; }
.cl-btn-xs svg, .cl-btn-xs uk-icon { width: 13px; height: 13px; }
/* Icon-only: square at whatever size it has. */
.cl-btn-icon { padding: 0; aspect-ratio: 1; }

/* ---- Pill and Tones ---- */

.cl-pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 9999px; background: var(--tone-grey-bg); color: var(--tone-grey-fg); font-size: 13px; font-weight: 600; line-height: 1.4; white-space: nowrap; }

/* A Tone on anything: pill, tile, count, stat number. Use the meaning name
   for a status, the colour name for a category. */
.cl-tone-red { background: var(--tone-red-bg); color: var(--tone-red-fg); }
.cl-tone-amber { background: var(--tone-amber-bg); color: var(--tone-amber-fg); }
.cl-tone-green { background: var(--tone-green-bg); color: var(--tone-green-fg); }
.cl-tone-teal { background: var(--tone-teal-bg); color: var(--tone-teal-fg); }
.cl-tone-blue { background: var(--tone-blue-bg); color: var(--tone-blue-fg); }
.cl-tone-indigo { background: var(--tone-indigo-bg); color: var(--tone-indigo-fg); }
.cl-tone-violet { background: var(--tone-violet-bg); color: var(--tone-violet-fg); }
.cl-tone-pink { background: var(--tone-pink-bg); color: var(--tone-pink-fg); }
.cl-tone-grey { background: var(--tone-grey-bg); color: var(--tone-grey-fg); }
.cl-tone-success { background: var(--tone-success-bg); color: var(--tone-success-fg); }
.cl-tone-warning { background: var(--tone-warning-bg); color: var(--tone-warning-fg); }
.cl-tone-danger { background: var(--tone-danger-bg); color: var(--tone-danger-fg); }
.cl-tone-info { background: var(--tone-info-bg); color: var(--tone-info-fg); }
.cl-tone-neutral { background: var(--tone-neutral-bg); color: var(--tone-neutral-fg); }

/* ---- Form fields: label, input, select, search ---- */

.cl-label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--cl-muted); }
.cl-input, .cl-select { width: 100%; height: var(--cl-control-md); padding: 0 10px; border: 1px solid var(--cl-border); border-radius: var(--cl-radius-md); background-color: var(--cl-soft); color: var(--cl-text); font-size: 14px; }
.cl-input:focus, .cl-select:focus { border-color: var(--cl-primary); background-color: hsl(var(--card)); outline: none; box-shadow: var(--cl-focus-ring); }
.cl-input:disabled, .cl-select:disabled { opacity: .6; cursor: not-allowed; }
.cl-input-sm { height: var(--cl-control-sm); border-radius: var(--cl-radius-sm); }

/* A search box: <label class="cl-search"><svg/><input class="cl-input"/></label> */
.cl-search { position: relative; display: block; }
.cl-search > svg, .cl-search > uk-icon { position: absolute; left: 10px; top: 50%; width: 14px; height: 14px; transform: translateY(-50%); color: var(--cl-faint); pointer-events: none; }
.cl-search > .cl-input { padding-left: 30px; }

/* ---- Table ---- */

.cl-table-wrap { overflow-x: auto; background: hsl(var(--card)); border: 1px solid var(--cl-border); border-radius: var(--cl-radius-inner); }
table.cl-table { width: 100%; margin: 0; border-collapse: collapse; font-size: 14px; white-space: nowrap; color: var(--cl-text); }
.cl-table th { padding: 9px 12px; background: hsl(var(--muted) / .55); border-bottom: 1px solid var(--cl-border); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--cl-muted); text-align: left; }
.cl-table td { padding: 10px 12px; border-bottom: 1px solid var(--cl-border); vertical-align: middle; }
.cl-table tbody tr:last-child td { border-bottom: 0; }
.cl-table-hover tbody tr:hover td { background: hsl(var(--muted) / .6); }
.cl-table .cl-empty { padding: 28px; text-align: center; color: var(--cl-faint); }

/* ---- Pager ---- */

.cl-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; font-size: 13px; color: var(--cl-muted); }
.cl-pager-info { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.cl-pager-rows { display: flex; align-items: center; gap: 8px; }
.cl-pager-rows select { width: 64px; height: 30px; padding: 0 8px; border: 1px solid var(--cl-border); border-radius: var(--cl-radius-xs); background-color: hsl(var(--card)); color: var(--cl-text); font-size: 14px; }
.cl-pager-total b { color: var(--cl-text); font-variant-numeric: tabular-nums; }
.cl-pages { display: flex; gap: 6px; }
.cl-page { display: inline-flex; align-items: center; justify-content: center; min-width: var(--cl-control-sm); height: var(--cl-control-sm); padding: 0 8px; border: 1px solid var(--cl-border); border-radius: var(--cl-radius-sm); background: hsl(var(--card)); color: var(--cl-text); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; }
.cl-page:hover { border-color: var(--cl-primary); }
.cl-page:focus-visible { outline: none; box-shadow: var(--cl-focus-ring); }
.cl-page-on, .cl-page-on:hover { background: var(--cl-primary); border-color: var(--cl-primary); color: var(--cl-primary-fg); }
.cl-page:disabled { color: var(--cl-faint); cursor: not-allowed; }
.cl-page:disabled:hover { border-color: var(--cl-border); }
.cl-page svg { width: 14px; height: 14px; }

/* Franken's <uk-icon> draws a fixed 16px svg; inside a component it fills
   the size the component gives the <uk-icon> instead. */
.cl-btn uk-icon, .cl-tile uk-icon, .cl-page uk-icon, .cl-search > uk-icon { display: inline-flex; }
.cl-btn uk-icon svg, .cl-tile uk-icon svg, .cl-page uk-icon svg, .cl-search > uk-icon svg { width: 100%; height: 100%; }
.cl-page uk-icon { width: 14px; height: 14px; }

/* ---- Small text helpers ---- */

.cl-num { font-variant-numeric: tabular-nums; }
.cl-dim { color: var(--cl-faint); }
.cl-muted { color: var(--cl-muted); }
