/* ==================================================================== crm
 * Farmer & Field CRM: the Go-To-Market funnel shown on a farmer, gathering
 * meetings, dealers, products and the billing panel inside a visit.
 * Everything else these pages need comes from farmers.css and it-assets.css.
 */

/* --------------------------------------------------- funnel stage chips */
.farm-funnel-chip,
.farm-fgm-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 999px;
    font-size: 11px; font-weight: 800; letter-spacing: .03em;
    border: 1px solid transparent; white-space: nowrap;
}
.farm-card-funnel { display: flex; flex-wrap: wrap; gap: 6px; }

/* One colour per stage, in funnel order, so a glance tells you how far along. */
.farm-funnel-chip[data-funnel="Awareness"]   { background: rgba(14,165,233,.12); color: #0369a1; border-color: rgba(14,165,233,.3); }
.farm-funnel-chip[data-funnel="Boost"]       { background: rgba(34,197,94,.12);  color: #15803d; border-color: rgba(34,197,94,.3); }
.farm-funnel-chip[data-funnel="AquaMitra"]   { background: rgba(168,85,247,.12); color: #7e22ce; border-color: rgba(168,85,247,.3); }
.farm-funnel-chip[data-funnel="Partnership"] { background: rgba(245,158,11,.14); color: #b45309; border-color: rgba(245,158,11,.32); }
.farm-fgm-chip { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* ------------------------------------------------ the funnel rail panel */
.farm-funnel-rail {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    gap: 0; margin: 0 0 16px; padding: 0; list-style: none;
}
.farm-funnel-rail li {
    position: relative; display: grid; justify-items: center; gap: 6px;
    font-size: 11.5px; color: var(--text-secondary); text-align: center;
}
.farm-funnel-rail li b { font-weight: 700; font-size: 11.5px; }
/* The connecting line sits behind the dots, drawn from each step leftwards. */
.farm-funnel-rail li::before {
    content: ''; position: absolute; top: 7px; right: 50%; left: -50%;
    height: 2px; background: var(--border);
}
.farm-funnel-rail li:first-child::before { display: none; }
.farm-funnel-rail li.is-done::before { background: var(--accent); }
.farm-funnel-dot {
    position: relative; z-index: 1;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--bg-raised); border: 2px solid var(--border);
}
.farm-funnel-rail li.is-done .farm-funnel-dot { background: var(--accent); border-color: var(--accent); }
.farm-funnel-rail li.is-done b { color: var(--text-primary); }
.farm-funnel-rail li.is-current .farm-funnel-dot { box-shadow: 0 0 0 4px var(--accent-soft); }
.farm-funnel-rail li.is-current b { color: var(--accent); font-weight: 800; }

/* ----------------------------------------------------- milestone readout */
.farm-milestones { display: grid; gap: 12px; }
.farm-milestone-group h4 {
    margin: 0 0 6px; font-size: 11.5px; font-weight: 800;
    text-transform: uppercase; letter-spacing: .05em; color: var(--text-primary);
}
.farm-milestone-group h4 small {
    display: block; margin-top: 2px;
    font-size: 11px; font-weight: 500; letter-spacing: 0;
    text-transform: none; color: var(--text-secondary);
}
.farm-milestone-group ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.farm-milestone-group li {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--text-secondary);
}
.farm-milestone-group li.is-reached { color: var(--text-primary); font-weight: 600; }
.farm-milestone-group li small { margin-left: auto; font-size: 11.5px; color: var(--text-secondary); font-weight: 500; }
.farm-milestone-tick { width: 16px; text-align: center; color: var(--border); font-weight: 800; }
.farm-milestone-group li.is-reached .farm-milestone-tick { color: #16a34a; }

/* The same list as checkboxes, in the "Set stages" dialog. */
.farm-milestone-fieldset {
    margin: 0 0 12px; padding: 10px 12px;
    border: 1px solid var(--border); border-radius: 12px;
}
.farm-milestone-fieldset legend {
    padding: 0 6px; font-size: 11px; font-weight: 800;
    text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary);
}
.farm-milestone-edit {
    display: flex; align-items: center; gap: 10px; padding: 4px 0;
    flex-wrap: wrap;
}
.farm-milestone-edit label {
    display: flex; align-items: center; gap: 8px;
    flex: 1 1 200px; margin: 0; font-size: 13.5px; cursor: pointer;
}
.farm-milestone-edit input[type="date"] {
    padding: 5px 9px; border-radius: 9px; border: 1px solid var(--border);
    background: var(--bg-raised); color: var(--text-primary); font: inherit; font-size: 12.5px;
}

.farm-panel-action { float: right; font-size: 12px; font-weight: 700; }

/* ------------------------------------------------- gathering meeting list */
.farm-fgm-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.farm-fgm-list li {
    display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
    font-size: 13px; padding: 6px 0; border-bottom: 1px dashed var(--border);
}
.farm-fgm-list li:last-child { border-bottom: 0; }
.farm-fgm-list a { color: var(--accent); text-decoration: none; }
.farm-fgm-list a:hover { text-decoration: underline; }
.farm-fgm-list small { color: var(--text-secondary); }

/* ------------------------------------------------------ purchase history */
.farm-sale-list .farm-sale-total { margin-left: auto; font-weight: 800; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.farm-signed {
    padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 800;
    text-transform: uppercase; letter-spacing: .04em;
    background: rgba(34,197,94,.14); color: #15803d;
}
.farm-sale-items { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 3px; }
.farm-sale-items li {
    display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
    font-size: 12.5px; color: var(--text-secondary);
}
.farm-sale-items li small {
    padding: 1px 6px; border-radius: 6px; font-size: 10.5px; font-weight: 700;
    background: var(--accent-soft); color: var(--accent);
}
.farm-sale-items li span { margin-left: auto; font-variant-numeric: tabular-nums; }
.farm-sale-items li em { font-style: normal; font-size: 11.5px; color: var(--text-secondary); }

/* What they bought, and who sold it. */
.farm-sale-split {
    display: grid; gap: 14px; margin: 10px 0 14px;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.farm-sale-split h5 {
    margin: 0 0 5px; font-size: 11px; font-weight: 800;
    text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary);
}
.farm-sale-breakdown { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.farm-sale-breakdown li {
    display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap;
    font-size: 12.5px; color: var(--text-secondary);
}
.farm-sale-breakdown li b { margin-left: auto; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.farm-sale-breakdown li small { flex-basis: 100%; font-size: 11px; }

/* -------------------------------------------- billing inside the outcome */
.wk-bill {
    margin-top: 14px; padding: 12px; border-radius: 14px;
    border: 1px dashed var(--border); background: var(--bg-raised);
}
.wk-bill-lines { display: grid; gap: 10px; margin: 8px 0; }
.wk-bill-add { display: flex; flex-wrap: wrap; gap: 14px; }

/* One card per line. A coloured edge says which of the three trades it is,
   so a mixed bill reads at a glance. */
.wk-bill-line {
    position: relative; overflow: hidden;
    padding: 10px 12px 10px 16px;
    border: 1px solid var(--border); border-radius: 12px;
    background: var(--bg-raised);
}
.wk-bill-line::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; }
.wk-bill-line.is-ahc::before { background: var(--accent); }
.wk-bill-line.is-feed::before { background: var(--success, #16a34a); }
.wk-bill-line.is-fresh::before { background: var(--warning, #f59e0b); }

.wk-bill-head { display: flex; align-items: center; gap: 10px; }
.wk-bill-head select { width: auto; min-width: 104px; margin: 0; font-weight: 700; }

/* Grid tracks, not flex: the outcome form sets width:100% on its inputs, which
   under flex collapsed the pickers to the width of their arrow. */
.wk-bill-fields {
    display: grid; gap: 8px; margin-top: 8px;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}
.wk-bill-fields label {
    display: grid; gap: 3px; margin: 0;
    font-size: 11.5px; font-weight: 700; color: var(--text-secondary);
}
.wk-bill-fields input,
.wk-bill-fields select { width: 100%; min-width: 0; margin: 0; }
.wk-bill-amount {
    margin-left: auto; text-align: right; font-weight: 800;
    font-variant-numeric: tabular-nums; font-size: 14px;
    box-sizing: border-box; white-space: nowrap; flex: none;
}
.wk-bill-foot {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--border);
}
.wk-bill-foot strong { font-size: 15px; }
.wk-bill-sign { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wk-bill-sign label { display: grid; gap: 3px; margin: 0; font-size: 11.5px; font-weight: 700; color: var(--text-secondary); }
.wk-sign-canvas {
    width: 100%; height: 170px; margin: 10px 0;
    border: 1px dashed var(--border); border-radius: 12px;
    background: #fff; touch-action: none; cursor: crosshair;
}

.farm-plan-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.farm-plan-list li {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 13px;
}
.farm-plan-list li:last-child { border-bottom: 0; }
.farm-plan-list li b { font-variant-numeric: tabular-nums; }
.farm-plan-list li small { flex-basis: 100%; color: var(--text-secondary); font-size: 11.5px; }

/* ------------------------------------------------------------------ sales */
.sales-split {
    display: grid; gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.sales-split h4 {
    margin: 0 0 7px; font-size: 11.5px; font-weight: 800;
    text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary);
}
.sales-plan-status {
    padding: 4px 8px; border-radius: 9px; border: 1px solid var(--border);
    background: var(--bg-raised); color: var(--text-primary); font: inherit; font-size: 12px;
}

/* ------------------------------------------------------------- utilities */
/* A stat whose value is words, not a number: 28px numerals would wrap badly. */
.it-stat-value.is-text {
    font-size: 15px; font-weight: 700; line-height: 1.35;
    overflow-wrap: anywhere;
}
.crm-row-inactive { opacity: .55; }
.crm-row-inactive td { font-style: italic; }

@media (max-width: 620px) {
    .farm-funnel-rail { grid-auto-flow: row; grid-auto-columns: auto; gap: 10px; }
    .farm-funnel-rail li { grid-auto-flow: column; justify-items: start; justify-content: start; gap: 10px; }
    .farm-funnel-rail li::before { display: none; }
    .wk-bill-fields { grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); }
}

/* ===================================================== shared table search
 * One search box, used by every list: Manage Staff, attendance, IT assets,
 * payroll and the rest, so searching feels identical wherever you are.
 */
.tsearch { display: grid; gap: 4px; }
.tsearch-label {
    font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
    text-transform: uppercase; color: var(--text-secondary);
}
.tsearch-box { position: relative; display: flex; align-items: center; }
.tsearch-icon {
    position: absolute; left: 11px; width: 16px; height: 16px;
    color: var(--text-secondary); pointer-events: none;
}
.tsearch-input {
    width: 100%; padding: 9px 32px 9px 34px;
    border: 1px solid var(--border); border-radius: 12px;
    background: var(--bg-raised); color: var(--text-primary);
    font: inherit; font-size: 13.5px;
}
.tsearch-input:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
/* The browser's own clear control would sit on top of ours. */
.tsearch-input::-webkit-search-cancel-button { display: none; }
.tsearch-clear {
    position: absolute; right: 8px;
    width: 20px; height: 20px; padding: 0;
    display: grid; place-items: center;
    border: 0; border-radius: 50%;
    background: var(--bg-hover, rgba(0,0,0,.06));
    color: var(--text-secondary); font-size: 15px; line-height: 1; cursor: pointer;
}
.tsearch-clear:hover { color: var(--text-primary); }
.tsearch-count { font-size: 11.5px; color: var(--text-secondary); min-height: 14px; }

/* The attendance search sits between the view switch and the table it narrows. */
.records-search-slot { max-width: 460px; margin: 0 0 14px; }

/* A former employee in a search list: visible where history matters, but never
   mistakable for current staff. */
.suggestion-item.is-former { opacity: .72; }
.suggestion-left-tag {
    display: inline-block; margin-left: 6px; padding: 1px 7px;
    border-radius: 999px; font-size: 10.5px; font-weight: 800;
    text-transform: uppercase; letter-spacing: .04em;
    background: rgba(239, 68, 68, .14); color: #b91c1c; vertical-align: middle;
}

/* A day in the month grid that can be corrected in place. */
.records-day-badge.is-editable { cursor: pointer; }
.records-day-badge.is-editable:hover,
.records-day-badge.is-editable:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

/* Somebody who has left, on their own record. */
.profile-left-note {
    display: grid; gap: 6px; justify-items: start;
    margin-top: 14px; padding: 12px 14px;
    border: 1px solid var(--border); border-left: 4px solid var(--danger, #ef4444);
    border-radius: 12px; background: var(--bg-raised);
}
.profile-left-note span { font-size: 13px; color: var(--text-secondary); }
.profile-rejoined { margin: 8px 0 0; font-size: 13px; color: var(--text-secondary); }
.profile-rejoined a { color: var(--accent); }

/* ===================================================================== */
/* Travel Diary                                                          */
/*                                                                       */
/* A day of travel is a chain, so it is drawn as one: the route plotted   */
/* where the stops actually are, with the order on each dot. A day spent  */
/* doubling back looks different from a planned round, which is the whole */
/* point of showing it at all.                                           */
/* ===================================================================== */

.trip-controls {
    display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
    justify-content: space-between; margin: 0 0 16px;
}
.trip-views { display: flex; gap: 4px; background: var(--bg-raised); padding: 4px; border-radius: 10px; }
.trip-view {
    border: 0; background: transparent; color: var(--text-secondary);
    font: inherit; font-weight: 600; font-size: 13px;
    padding: 7px 14px; border-radius: 7px; cursor: pointer;
}
.trip-view:hover { color: var(--text-primary); }
.trip-view.is-on { background: var(--bg-card, #fff); color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.trip-when { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.trip-when input[type="date"] {
    padding: 6px 10px; border: 1px solid var(--border-color); border-radius: 8px;
    background: var(--bg-input, transparent); color: inherit; font: inherit;
}

.trip-day-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 16px; flex-wrap: wrap; margin-bottom: 12px;
}

/* Where the visits already recorded in Work Tracker are offered. */
.trip-suggest {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    margin: 12px 0; padding: 14px 16px; border-radius: 12px;
    background: var(--accent-soft); border: 1px dashed var(--accent);
}

.trip-legs .trip-seq { font-weight: 800; color: var(--text-secondary); text-align: center; }
/* The place pickers need room; the form's blanket width:100% would crush them. */
.trip-legs select { width: 100%; min-width: 170px; }
.trip-km-cell input { width: 88px; }

.trip-decide {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
    margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border-color);
}
.trip-decide input { flex: 1 1 240px; }

/* ------------------------------------------------------------ the route */

.trip-route { width: 100%; height: auto; max-height: 320px; display: block; margin: 8px 0; }
.trip-route-leg { fill: none; stroke: var(--accent); stroke-width: 2; opacity: .75; }
.trip-arrow-head { fill: var(--accent); }
.trip-dot-stop { fill: var(--bg-card, #fff); stroke: var(--accent); stroke-width: 2.5; }
.trip-dot-home { fill: var(--accent); stroke: var(--accent); stroke-width: 2.5; }
.trip-route-seq { font-size: 9px; font-weight: 800; text-anchor: middle; fill: var(--text-primary); }
.trip-dot-home + .trip-route-seq { fill: #fff; }
.trip-route-label { font-size: 10px; font-weight: 600; text-anchor: middle; fill: var(--text-secondary); }
.trip-route-km { font-size: 9px; text-anchor: middle; fill: var(--text-secondary); }

/* ------------------------------------------------------------ the week */

.trip-week { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; }
.trip-day-card {
    display: flex; flex-direction: column; gap: 5px; align-items: flex-start;
    padding: 14px; border-radius: 12px; cursor: pointer; text-align: left;
    background: var(--bg-raised); border: 1px solid var(--border-color);
    font: inherit; color: inherit;
}
.trip-day-card:hover { border-color: var(--accent); }
.trip-day-card.is-empty { opacity: .62; }
.trip-day-card.is-pending { border-left: 3px solid var(--warning); }
.trip-day-card.is-approved { border-left: 3px solid var(--success); }
.trip-day-card.is-rejected { border-left: 3px solid var(--danger); }
.trip-day-card-date { font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.trip-day-card-km { font-size: 18px; font-weight: 800; }
.trip-day-card-amount { font-size: 12px; color: var(--text-secondary); }

.trip-total-row td { border-top: 2px solid var(--border-color); background: var(--bg-raised); }

/* The four states a day of travel passes through. */
.farm-stage[data-stage="Draft"] { background: var(--bg-hover, rgba(0,0,0,.06)); color: var(--text-secondary); }
.farm-stage[data-stage="Pending"] { background: rgba(217,119,6,.14); color: #b45309; }
.farm-stage[data-stage="Approved"] { background: rgba(22,163,74,.13); color: #15803d; }
.farm-stage[data-stage="Rejected"] { background: rgba(220,38,38,.12); color: #b91c1c; }

@media (max-width: 640px) {
    .trip-controls { flex-direction: column; align-items: stretch; }
    .trip-views { overflow-x: auto; }
}

/* A changed distance, explained. Once the day is locked this is what the
   approver is actually being asked to read, so it is text, not a form field. */
.trip-reason-said {
    font-size: 12.5px; line-height: 1.45; color: var(--text-primary);
    padding: 6px 10px; border-radius: 8px;
    background: rgba(217,119,6,.10); border-left: 3px solid var(--warning);
}

/* From a day's visits to the travel they cost. */
.wkx-travel-link {
    display: inline-block; margin-top: 10px; font-size: 13px; font-weight: 600;
    color: var(--accent); text-decoration: none;
    padding: 7px 12px; border-radius: 9px;
    background: var(--accent-soft); border: 1px dashed var(--accent);
}
.wkx-travel-link:hover { text-decoration: underline; }

/* ------------------------------------------------- who works which days */

.wp-warn {
    margin: 10px 0 4px; padding: 12px 14px; border-radius: 10px;
    background: rgba(217,119,6,.10); border-left: 3px solid var(--warning);
    font-size: 13px; line-height: 1.5;
}
.wp-toggle { display: flex; align-items: center; gap: 7px; font-size: 13px; white-space: nowrap; }
.wp-toggle input { width: auto; }
.wp-bulk {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    margin: 10px 0; padding: 10px 14px; border-radius: 10px;
    background: var(--accent-soft); font-size: 13px; font-weight: 600;
}
/* A person with no type is the thing this table exists to show. */
tr.wp-unset td { background: rgba(217,119,6,.055); }

/* ===================================================================== */
/* World clock                                                           */
/*                                                                       */
/* Two moments share the page: "now", which ticks, and the moment being  */
/* asked about, which does not. They are given different weight rather   */
/* than different corners -- the one being asked about leads, and now    */
/* stays beside it so it is never lost.                                  */
/*                                                                       */
/* The hour line is shaded by part of day, so the shape of another       */
/* person's working day is readable before a single number is.           */
/* ===================================================================== */

.wc-page { display: flex; flex-direction: column; gap: 16px; }

.wc-panel {
    background: var(--bg-card, #fff); border: 1px solid var(--border-color);
    border-radius: 16px; padding: 20px 22px;
}
.wc-panel-head { margin-bottom: 16px; }
.wc-panel-head h3 { margin: 0; font-size: 16px; }
.wc-panel-head p { margin: 5px 0 0; font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

.wc-chip {
    display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .09em;
    text-transform: uppercase; color: var(--accent);
    background: var(--accent-soft); padding: 3px 9px; border-radius: 999px;
    vertical-align: middle;
}
.wc-abbr {
    font-size: 12px; font-weight: 800; letter-spacing: .04em;
    padding: 3px 8px; border-radius: 6px;
    background: var(--accent-soft); color: var(--accent);
}
.wc-gmt { font-size: 12px; font-weight: 600; color: var(--text-secondary); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- the hero */

.wc-hero {
    display: flex; align-items: center; justify-content: space-between; gap: 28px; flex-wrap: wrap;
    padding: 26px 28px; border-radius: 18px; color: #fff;
    background: linear-gradient(120deg, #0f766e 0%, #0e7490 55%, #1e3a8a 100%);
}
.wc-hero .wc-chip { background: rgba(255,255,255,.18); color: #fff; }
.wc-hero-place h2 { margin: 10px 0 2px; font-size: 32px; line-height: 1.1; color: #fff; }
.wc-hero-sub { margin: 0; font-size: 13px; opacity: .85; color: #fff; }
.wc-hero-codes { margin: 10px 0 0; display: flex; gap: 8px; align-items: center; }
.wc-hero .wc-abbr { background: rgba(255,255,255,.2); color: #fff; }
.wc-hero .wc-gmt { color: rgba(255,255,255,.82); }
.wc-hero-clock { text-align: right; }
.wc-hero-label {
    font-size: 10.5px; font-weight: 800; letter-spacing: .1em;
    text-transform: uppercase; opacity: .8;
}
.wc-hero-time {
    font-size: 52px; font-weight: 800; line-height: 1.05;
    font-variant-numeric: tabular-nums; letter-spacing: .005em;
}
.wc-hero-date { font-size: 13.5px; opacity: .9; }

/* ---------------------------------------------------- choosing a moment */

.wc-chooser.is-chosen { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.wc-chooser-head h3 { margin: 0; font-size: 16px; }
.wc-chooser-head p { margin: 5px 0 0; font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.wc-chooser-controls {
    display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin-top: 14px;
}
.wc-field { display: flex; flex-direction: column; gap: 5px; }
.wc-field span { font-size: 11.5px; font-weight: 700; color: var(--text-secondary); }
.wc-field input {
    padding: 9px 12px; border: 1px solid var(--border-color); border-radius: 9px;
    background: var(--bg-input, transparent); color: inherit; font: inherit;
    font-variant-numeric: tabular-nums;
}
.wc-ghost {
    padding: 9px 16px; border-radius: 9px; font: inherit; font-weight: 600; cursor: pointer;
    border: 1px solid var(--border-color); background: transparent; color: var(--text-primary);
}
.wc-ghost:disabled { opacity: .45; cursor: default; }
.wc-ghost:not(:disabled):hover { border-color: var(--accent); color: var(--accent); }

/* ---------------------------------------------------------- the hour line */

.wc-key { margin-left: 12px; font-size: 12px; white-space: nowrap; }
.wc-key i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }
.wc-key-now { background: var(--accent); }
.wc-key-chosen { background: #b45309; }
.wc-key-day { background: #7c3aed; }

.wc-line { overflow-x: auto; padding-bottom: 8px; }
.wc-line-row { display: flex; align-items: stretch; gap: 10px; margin-bottom: 5px; }
.wc-line-name {
    flex: 0 0 148px; position: sticky; left: 0; z-index: 2;
    display: flex; flex-direction: column; justify-content: center;
    padding: 4px 10px 4px 0; background: var(--bg-card, #fff);
}
.wc-line-name b { font-size: 13.5px; }
.wc-line-name span { font-size: 11px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.wc-line-row.is-primary .wc-line-name b { color: var(--accent); }
.wc-line-cells { display: flex; gap: 3px; }

.wc-cell {
    flex: 0 0 48px; height: 50px; border: 0; border-radius: 8px; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    font: inherit; font-variant-numeric: tabular-nums; color: inherit;
    transition: transform .08s ease;
}
.wc-cell:hover { transform: translateY(-2px); }
.wc-cell-hour { font-size: 13.5px; font-weight: 700; }
.wc-cell-hour i { font-style: normal; font-size: 9.5px; vertical-align: 3px; opacity: .75; }
.wc-cell-date { font-size: 9px; font-weight: 800; margin-top: 1px; opacity: .85; }

/* The shape of a day, before any number is read. */
.wc-cell.is-night { background: #e2e8f0; color: #475569; }
.wc-cell.is-dawn { background: #fef3c7; color: #92400e; }
.wc-cell.is-day { background: #dcfce7; color: #166534; }
.wc-cell.is-evening { background: #ffedd5; color: #9a3412; }
.wc-cell.is-daystart { box-shadow: inset 3px 0 0 #7c3aed; }

.wc-cell.is-now { outline: 2px solid var(--accent); outline-offset: -2px; font-weight: 800; }
.wc-cell.is-chosen {
    background: #b45309; color: #fff;
    box-shadow: 0 0 0 3px rgba(180,83,9,.22);
}
.wc-cell.is-chosen.is-daystart { box-shadow: 0 0 0 3px rgba(180,83,9,.22), inset 3px 0 0 #fff; }

/* -------------------------------------------------------------- the cards */

.wc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.wc-card {
    border: 1px solid var(--border-color); border-radius: 14px; padding: 16px 18px;
    display: flex; flex-direction: column; gap: 14px;
    background: var(--bg-card, #fff);
}
.wc-card.is-primary { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
/* A thin edge saying whether they are asleep, without colouring the card. */
.wc-card.is-night { border-left: 4px solid #64748b; }
.wc-card.is-dawn { border-left: 4px solid #f59e0b; }
.wc-card.is-day { border-left: 4px solid #16a34a; }
.wc-card.is-evening { border-left: 4px solid #ea580c; }

.wc-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.wc-card-head h4 { margin: 0; font-size: 16.5px; }
.wc-card-head p { margin: 3px 0 0; font-size: 11.5px; color: var(--text-secondary); line-height: 1.4; }
.wc-card-codes { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; white-space: nowrap; }

.wc-card-times { display: flex; gap: 20px; align-items: flex-end; flex-wrap: wrap; }
.wc-card-time { display: flex; flex-direction: column; gap: 1px; }
.wc-card-label {
    font-size: 10px; font-weight: 800; letter-spacing: .07em;
    text-transform: uppercase; color: var(--text-secondary);
}
.wc-card-big { font-size: 28px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.wc-card-time.is-lead .wc-card-big { color: #b45309; }
.wc-card-small { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.wc-card-sub { font-size: 11.5px; color: var(--text-secondary); }

.wc-card-foot {
    display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
    padding-top: 12px; border-top: 1px solid var(--border-color);
}
.wc-gap { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.wc-gap.is-ahead { color: var(--success); }
.wc-gap.is-behind { color: var(--warning); }
.wc-card-actions { display: flex; gap: 10px; }
.wc-link {
    border: 0; background: none; padding: 0; font: inherit; font-size: 12.5px; font-weight: 600;
    color: var(--accent); cursor: pointer;
}
.wc-link.is-danger { color: var(--danger); }
.wc-link:hover { text-decoration: underline; }

/* -------------------------------------------------------------- the picker */

.wc-found { margin: 0 0 8px; font-size: 12px; color: var(--text-secondary); }
.wc-results { max-height: 400px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.wc-result {
    display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: center;
    width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
    padding: 11px 12px; border: 0; border-radius: 10px; background: transparent;
}
.wc-result:hover { background: var(--accent-soft); }
.wc-result-place b { display: block; font-size: 14px; }
.wc-result-place span { font-size: 11.5px; color: var(--text-secondary); }
.wc-result-codes { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.wc-result-time {
    text-align: right; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums;
    min-width: 76px;
}
.wc-result-time span { display: block; font-size: 11px; font-weight: 500; color: var(--text-secondary); }

/* This app switches theme with body.dark-mode / [data-theme="dark"], not with
   the system setting -- a prefers-color-scheme block here turned the clock
   dark while every other page stayed light. */
body.dark-mode .wc-cell.is-night, [data-theme="dark"] .wc-cell.is-night { background: #334155; color: #cbd5e1; }
body.dark-mode .wc-cell.is-dawn, [data-theme="dark"] .wc-cell.is-dawn { background: #78350f; color: #fde68a; }
body.dark-mode .wc-cell.is-day, [data-theme="dark"] .wc-cell.is-day { background: #14532d; color: #bbf7d0; }
body.dark-mode .wc-cell.is-evening, [data-theme="dark"] .wc-cell.is-evening { background: #7c2d12; color: #fed7aa; }

@media (max-width: 720px) {
    .wc-hero { flex-direction: column; align-items: flex-start; gap: 18px; }
    .wc-hero-clock { text-align: left; }
    .wc-hero-time { font-size: 42px; }
    .wc-line-name { flex-basis: 104px; }
    .wc-chooser-controls { flex-direction: column; align-items: stretch; }
    .wc-result { grid-template-columns: 1fr auto; }
    .wc-result-codes { grid-column: 2; }
    .wc-result-time { grid-column: 1 / -1; text-align: left; }
}

/* Travel days somebody has been asked to decide. */
.trip-awaiting { border-left: 4px solid var(--warning); }

/* Integrations: keys, endpoints and what has actually been delivered. */
.int-off td { opacity: .55; }
.int-key {
    margin: 12px 0; padding: 14px 16px; border-radius: 10px;
    background: var(--bg-raised); border: 1px solid var(--border-color);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px;
    word-break: break-all; white-space: pre-wrap; user-select: all;
}

/* ===================================================================== */
/* Payroll settings                                                      */
/*                                                                       */
/* Money added and money taken away must never be mistaken for each      */
/* other at a glance, so they differ in colour and in sign, not only in  */
/* a word. A switched-off line is dimmed rather than hidden: knowing a   */
/* line exists but is not applying is the thing people come here to      */
/* check.                                                                */
/* ===================================================================== */

.pay-add { color: var(--success); font-weight: 700; font-variant-numeric: tabular-nums; }
.pay-take { color: var(--warning); font-weight: 700; font-variant-numeric: tabular-nums; }
.pay-amount { font-weight: 700; font-variant-numeric: tabular-nums; }

.pay-mode {
    display: inline-block; font-size: 11.5px; font-weight: 700;
    padding: 3px 10px; border-radius: 999px;
    background: var(--bg-hover, rgba(0,0,0,.06)); color: var(--text-secondary);
}
.pay-mode.is-own { background: var(--accent-soft); color: var(--accent); }

.pay-kind {
    display: inline-block; font-size: 11.5px; font-weight: 700;
    padding: 3px 10px; border-radius: 999px;
}
.pay-kind.is-add { background: rgba(22,163,74,.13); color: #15803d; }
.pay-kind.is-take { background: rgba(217,119,6,.14); color: #b45309; }

/* Still there, just not applying. */
tr.pay-off td { opacity: .55; }

/* ------------------------------------------------- the two big choices */

.pay-mode-pick, .pay-kind-pick {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px; margin: 14px 0;
}
.pay-mode-option, .pay-kind-option {
    display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
    padding: 14px 16px; border-radius: 12px;
    border: 1px solid var(--border-color); background: var(--bg-raised);
}
.pay-mode-option:hover, .pay-kind-option:hover { border-color: var(--accent); }
.pay-mode-option.is-on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.pay-mode-option input, .pay-kind-option input { width: auto; margin-top: 3px; }
.pay-mode-option b, .pay-kind-option b { display: block; font-size: 14px; }
.pay-mode-option small, .pay-kind-option small {
    display: block; margin-top: 2px; font-size: 12px; color: var(--text-secondary); line-height: 1.4;
}
.pay-mode-option input:disabled, .pay-kind-option input:disabled { cursor: default; }

/* Where a person's figure came from: the company's, their own, or gone. */
.pay-src { color: var(--text-secondary); font-size: 11.5px; }
.pay-src.is-own { color: var(--accent); font-weight: 600; }
.pay-src.is-off { color: var(--warning); font-weight: 600; }
