/* =========================================================================
   OneStaff UI - v5 "Flow" dashboard overview widgets
   Projects / reminders / invoices / income vs expenses / tasks / team members / tickets, drawn in the Flow
   language and its minimal pass: figures in ink, colour only as signal - a key tick before each label, thin solid
   bars for shares, and "dial" rings (radial ticks, drawn by assets/js/onestaff-charts.js when --os-ring-style is
   ticks; the one distinctive element, asked for by the user) with a live centre readout. Semantic colours:
   green = done / paid / income, coral = late / overdue / expenses, amber = waiting / on hold, mint + peach = the
   soft steps between them, ink = neutral, slate = idle. All read the (muted) --os-viz-* tokens of onestaff-flow.css.

   Loaded right after onestaff-flow.css by includes/head.php and reads its tokens. Views: projects/widgets/
   projects_overview_widget, reminders/next_reminder_widget, invoices/invoice_overview_widget,
   expenses/income_expenses_widget, tasks/tasks_overview_widget, team_members/team_members_overview_widget,
   tickets/ticket_status_widget.
   ========================================================================= */

/* ---------- tokens: the two soft steps of the data palette + the dial ring ---------- */
:root[data-theme="light"], :root:not([data-theme]) {
    --os-viz-mint:  #9ccfb6;
    --os-viz-peach: #e8b09b;
    --os-ring-style: ticks;
    --os-ring-track: #ebebeb;
    --os-ring-dial:  rgba(17, 17, 17, 0.2);
}
:root[data-theme="dark"] {
    --os-viz-mint:  #3f9c79;
    --os-viz-peach: #c46f52;
    --os-ring-style: ticks;
    --os-ring-track: rgba(255, 255, 255, 0.1);
    --os-ring-dial:  rgba(255, 255, 255, 0.22);
}

/* ---------- shared parts ---------- */
/* key tick: the colour mark before a label (the same mark the dial rings are made of) */
.os-key { display: inline-block; flex: none; width: 3px; height: 12px; margin-right: 9px; border-radius: 2px; background: var(--c, var(--os-ink)); vertical-align: -1px; }
/* meter: a share as a thin solid bar on the hairline track (--p = share, --c = colour) */
.os-meter { position: relative; display: block; width: 100%; height: 5px; overflow: hidden; border-radius: 999px; background: var(--os-bar-track); }
.os-meter::before { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--p, 0%); border-radius: inherit; background: var(--c, var(--os-ink)); }
.os-meter.is-lg { height: 7px; }

.os-dw-label { display: flex; align-items: center; min-width: 0; font-size: 12.5px; font-weight: 500; color: var(--os-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.os-dw-num { display: block; font: 600 26px/1.1 var(--os-font-display); letter-spacing: -0.03em; color: var(--os-text); font-variant-numeric: tabular-nums; }

/* stat grid: label (with its key) on top, the figure under it - like the counter tiles above */
.os-dw-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 22px; padding: 12px 20px 4px; }
.os-dw-stats.is-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.os-dw-stat { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 4px 14px; color: var(--os-text) !important; text-decoration: none !important; }
.os-dw-stats > .os-dw-stat + .os-dw-stat { border-left: 1px solid var(--os-line); }
.os-dw-stats > .os-dw-stat:first-child, .os-dw-stats.is-2 > .os-dw-stat:nth-child(odd) { padding-left: 0; border-left: 0; }
/* a long label may take two lines; the figures of one row still line up (they sit at the bottom) */
.os-dw-stat > .os-dw-label { align-items: flex-start; white-space: normal; line-height: 1.3; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.os-dw-stat > .os-dw-label .os-key { display: inline-block; margin-top: 1px; }
.os-dw-stat > .os-dw-num { margin-top: auto; }
a.os-dw-stat:hover .os-dw-label, a.os-dw-stat:focus-visible .os-dw-label { color: var(--os-text); }
.os-dw-stat .os-meter { margin-top: 2px; max-width: 150px; }

/* key / label / figure rows (task statuses, ticket statuses) */
.os-dw-list { display: flex; flex-direction: column; gap: 2px; }
.os-dw-row { display: flex; align-items: center; gap: 0; padding: 6px 8px; margin: 0 -8px; border-radius: var(--os-r-sm, 10px); color: var(--os-text-2); }
.os-dw-row > span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.os-dw-row > b { flex: none; padding-left: 12px; font-weight: 600; color: var(--os-text); font-variant-numeric: tabular-nums; }
.os-dw-row.is-alert > b { color: var(--os-coral-ink); }
a:hover > .os-dw-row, a:focus-visible > .os-dw-row { background: var(--os-wash); }
.os-dw-sep { height: 1px; margin: 6px 0; background: var(--os-line); }

/* ---------- dial ring: the canvas + a centre readout (onestaff-charts.js swaps it to the hovered segment) ---------- */
.os-dial { position: relative; }
.os-dial-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-align: center; pointer-events: none; }
.os-dial-center::before { content: ""; width: 14px; height: 3px; margin-bottom: 5px; border-radius: 2px; background: var(--c, var(--os-line-3)); transition: background-color 160ms ease, width 160ms ease; }
.os-dial-center.is-hover::before { width: 22px; }
.os-dial-value { font: 600 24px/1 var(--os-font-display); letter-spacing: -0.03em; color: var(--os-text); font-variant-numeric: tabular-nums; }
.os-dial-label { max-width: 88px; font-size: 11.5px; font-weight: 500; color: var(--os-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* no data yet: a quiet dotted dial */
.os-dial.is-empty::before { content: ""; position: absolute; left: 50%; top: 50%; width: 126px; height: 126px; transform: translate(-50%, -50%); border-radius: 50%; border: 2px dotted var(--os-ring-dial); }

/* ---------- projects overview ---------- */
.os-dw-progress { padding: 20px 20px 22px; }
.os-dw-progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.os-dw-progress-head b { font-size: 13.5px; font-weight: 600; color: var(--os-text); font-variant-numeric: tabular-nums; }

/* ---------- reminders ---------- */
.os-dw-rem { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); align-items: center; padding: 24px 20px; }
.os-dw-rem > .os-dw-stat { padding-left: 0; border-right: 1px solid var(--os-line); }
.os-dw-next { display: flex; align-items: center; gap: 12px; min-width: 0; padding-left: 18px; }
.os-dw-chip { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 999px; background: var(--os-coral-soft); color: var(--os-coral-ink); }
.os-dw-chip.is-quiet { background: var(--os-surface-2); color: var(--os-muted); }
.os-dw-chip svg { width: 16px; height: 16px; stroke: currentColor; }
.os-dw-next-body { min-width: 0; }
.os-dw-next-body .os-dw-label { margin-bottom: 3px; }
.os-dw-next-value { font-size: 13.5px; color: var(--os-text); }
.os-dw-next-value .text-off { color: var(--os-faint) !important; }

/* ---------- invoice overview ---------- */
.os-inv-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(40px, 22%) 26px minmax(0, 0.9fr); align-items: center; gap: 12px; padding: 8px 8px; margin: 0 -8px; border-radius: var(--os-r-sm, 10px); }
.os-inv-name { display: flex; align-items: center; min-width: 0; color: var(--os-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.os-inv-count { text-align: center; color: var(--os-muted); font-variant-numeric: tabular-nums; }
.os-inv-amt { text-align: right; font-weight: 500; color: var(--os-text); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a:hover > .os-inv-row, a:focus-visible > .os-inv-row { background: var(--os-wash); }
#invoice-overview-container .widget-footer { padding-top: 14px; border-top: 1px solid var(--os-line); }
.os-inv-total + .os-inv-total { margin-top: 10px; }
.os-inv-total b, .os-ie-row b { display: block; font-weight: 600; color: var(--os-text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.os-inv-total .os-dw-label { margin-bottom: 2px; }

/* ---------- income vs expenses ---------- */
.os-ie-year { margin-bottom: 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--os-faint); }
.os-ie-year + .os-ie-row { margin-top: 2px; }
.os-ie-row + .os-ie-year { margin-top: 16px; }
.os-ie-row { display: flex; align-items: center; flex-wrap: wrap; column-gap: 8px; padding: 3px 0; font-size: 12.5px; }
.os-ie-row > span { display: flex; align-items: center; flex: 1 0 auto; color: var(--os-muted); }
.os-ie-row > b { margin-left: auto; text-align: right; } /* drops under its label when the column is narrow */
.os-ie-trend { padding: 22px 0 0; }
.os-ie-trend .os-dw-label { margin-bottom: 6px; }

/* ---------- task priorities (all tasks overview footer) ---------- */
.os-dw-prio { display: inline-flex; align-items: center; gap: 6px; height: 28px; margin-right: 8px; padding: 0 11px 0 9px; border-radius: 999px; background: var(--os-surface-2); color: var(--os-text) !important; font-weight: 600; font-variant-numeric: tabular-nums; }
.os-dw-prio svg { width: 14px !important; height: 14px !important; }
a:hover > .os-dw-prio { background: var(--os-wash-2); }

/* ---------- ticket status ---------- */
#ticket-status-widget .b-r-2 { border-right: 1px solid var(--os-line) !important; }
.os-tk-types .os-dw-row > b { color: var(--os-text); }

/* ---------- project deadline cell: the date, and under it how late / close an open project is ----------
   global (not in projects/index.php) because the client page's Projects tab renders the same cell */
.os-due { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.os-due-date { font-variant-numeric: tabular-nums; white-space: nowrap; }
.os-due.is-late .os-due-date { color: var(--os-coral-ink); font-weight: 600; }
.os-due-chip { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 500; line-height: 1; white-space: nowrap; }
.os-due.is-late .os-due-chip { background: var(--os-coral-soft); color: var(--os-coral-ink); }
.os-due.is-soon .os-due-chip { background: rgba(var(--os-warn-rgb), .13); color: var(--os-warn); }
