/*!
 * DGR Office — module components. Colours come only from dgr-theme.css tokens.
 */

/* ===== Invoice editor: GST type selector, tax advice, line items, totals ===== */
.gst-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .75rem; }
.gst-card { position: relative; border: 1px solid var(--dgr-border-strong); border-radius: var(--dgr-radius); padding: .85rem 1rem; cursor: pointer; background: var(--dgr-inset); transition: border-color .12s, box-shadow .12s; }
.gst-card input { position: absolute; opacity: 0; pointer-events: none; }
.gst-card:hover { border-color: var(--dgr-gold-line); }
.gst-card.selected { border-color: var(--dgr-gold); box-shadow: 0 0 0 1px var(--dgr-gold); background: var(--dgr-gold-soft); }
.gst-card.disabled { opacity: .45; cursor: not-allowed; }
.gst-card .gst-title { font-weight: 700; font-size: 1rem; color: var(--dgr-text); }
.gst-card .gst-sub { font-size: .78rem; color: var(--dgr-text-2); }
.gst-card .gst-calc { font-size: .8rem; margin-top: .35rem; font-variant-numeric: tabular-nums; color: var(--dgr-text); }
.tax-advice { border-left: 3px solid var(--dgr-gold); background: var(--dgr-gold-soft); padding: .65rem .85rem; border-radius: var(--dgr-radius-sm); font-size: .85rem; color: var(--dgr-text); }
.tax-advice.warn { border-left-color: var(--dgr-warning); background: var(--dgr-warning-soft); }
.tax-advice.block { border-left-color: var(--dgr-danger); background: var(--dgr-danger-soft); }
.line-items .form-control, .line-items .form-select { min-height: 36px; font-size: .86rem; }
.line-items td { vertical-align: top; }
.line-items .li-desc { min-width: 220px; }
.totals-box { background: var(--dgr-card); border: 1px solid var(--dgr-border); border-radius: var(--dgr-radius); padding: 1rem; }
.totals-box .row-t { display: flex; justify-content: space-between; padding: .2rem 0; font-variant-numeric: tabular-nums; color: var(--dgr-text-2); }
.totals-box .row-t > :last-child { color: var(--dgr-text); }
.totals-box .grand { font-size: 1.15rem; font-weight: 700; border-top: 1px solid var(--dgr-gold-line); margin-top: .4rem; padding-top: .5rem; color: var(--dgr-text); }
.totals-box .grand > :last-child { color: var(--dgr-gold-text); }

/* ===== Boards (CRM pipeline, shortlisting) ===== */
.kanban { display: flex; gap: .75rem; overflow-x: auto; padding-bottom: .75rem; }
.kanban-col { min-width: 250px; max-width: 280px; background: var(--dgr-sidebar); border: 1px solid var(--dgr-border); border-radius: var(--dgr-radius); padding: .6rem; flex-shrink: 0; }
.kanban-col h3 { font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--dgr-text-2); margin: .2rem .3rem .6rem; display: flex; justify-content: space-between; }
.kanban-card { background: var(--dgr-card); border-radius: 8px; padding: .6rem .7rem; margin-bottom: .5rem; border: 1px solid var(--dgr-border); font-size: .84rem; display: block; color: inherit; text-decoration: none; }
.kanban-card:hover { border-color: var(--dgr-gold-line); color: inherit; }

/* ===== Setup wizard, branding previews ===== */
.wizard-steps { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.wizard-step { display: flex; align-items: center; gap: .5rem; padding: .45rem .8rem; border-radius: 30px; background: var(--dgr-card); border: 1px solid var(--dgr-border); font-size: .82rem; color: var(--dgr-text-2); text-decoration: none; }
.wizard-step:hover { color: var(--dgr-text); border-color: var(--dgr-border-strong); }
.wizard-step .num { width: 22px; height: 22px; border-radius: 50%; background: var(--dgr-raised); color: var(--dgr-text); display: inline-flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700; }
.wizard-step.done { border-color: color-mix(in srgb, var(--dgr-success) 35%, transparent); color: var(--dgr-text); }
.wizard-step.done .num { background: var(--dgr-success); color: var(--dgr-on-success); }
.wizard-step.active { border-color: var(--dgr-gold); background: var(--dgr-gold-soft); color: var(--dgr-text); }
.wizard-step.active .num { background: var(--dgr-gold); color: var(--dgr-on-gold); }
/* uploaded logo/signature/stamp previewed on a neutral checkerboard, never recoloured */
.asset-preview { background: repeating-conic-gradient(var(--dgr-border) 0% 25%, var(--dgr-card) 0% 50%) 50% / 16px 16px; border: 1px dashed var(--dgr-border-strong); border-radius: 8px; min-height: 90px; display: flex; align-items: center; justify-content: center; padding: .5rem; }
.asset-preview img { max-height: 120px; max-width: 100%; }

/* ===== Role & permission controls ===== */
.perm-matrix th.rot { white-space: nowrap; }
.perm-matrix td { text-align: center; }
.perm-matrix td.pk { text-align: left; white-space: nowrap; }
.perm-matrix .bi-check-lg { color: var(--dgr-gold-text); }
.perm-danger { color: var(--dgr-danger); }

/* ===== Calendar & attendance grids ===== */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head { padding: 2px 4px; color: var(--dgr-text-2); }
.cal-cell { min-height: 104px; padding: 4px; background: var(--dgr-card); border: 1px solid var(--dgr-border); border-radius: var(--dgr-radius-sm); overflow: hidden; }
.cal-empty { background: transparent; border-color: transparent; }
.cal-off { background: var(--dgr-inset); }
.cal-today { border-color: var(--dgr-gold); box-shadow: inset 0 0 0 1px var(--dgr-gold); }
.cal-chip { line-height: 1.35; border-radius: 2px; }
a.cal-chip:hover, a.cal-chip:focus { background: var(--dgr-gold-soft); }
.att-grid { font-variant-numeric: tabular-nums; }
.cal-day { min-height: 64px; }

/* ===== Charts ===== */
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 320px; }

/* ===== CRM stage markers and target progress ===== */
.stage-mark { border-left: 3px solid var(--dgr-border-strong); padding-left: 6px; }
.stage-mark-success { border-left-color: var(--dgr-success); }
.stage-mark-danger { border-left-color: var(--dgr-danger); }
.stage-mark-gold { border-left-color: var(--dgr-gold); }
.stage-mark-info { border-left-color: var(--dgr-info); }
.dgr-progress { display: block; width: 100%; height: 6px; border: 0; border-radius: 3px; overflow: hidden; background: var(--dgr-inset); appearance: none; }
.dgr-progress::-webkit-progress-bar { background: var(--dgr-inset); }
.dgr-progress::-webkit-progress-value { background: var(--dgr-gold); }
.dgr-progress::-moz-progress-bar { background: var(--dgr-gold); }

/* ===== Layout helpers that replace inline style attributes (CSP style-src 'self') ===== */
.pre-line { white-space: pre-line; }
.mw-820 { max-width: 820px; }
.mw-980 { max-width: 980px; }
.w-auto-inline { width: auto; }
.sticky-panel { position: sticky; top: 76px; }
/* generated column widths and spacing: see tools note in docs/09-UI-THEME.md */
.u-h-260px { height: 260px; }
.u-h-6px { height: 6px; }
.u-mnh-60px { min-height: 60px; }
.u-mnw-220px { min-width: 220px; }
.u-mnw-280px { min-width: 280px; }
.u-mxh-50px { max-height: 50px; }
.u-mxh-60vh { max-height: 60vh; }
.u-mxh-640px { max-height: 640px; }
.u-mxh-75vh { max-height: 75vh; }
.u-mxw-1040px { max-width: 1040px; }
.u-mxw-1080px { max-width: 1080px; }
.u-mxw-1100px { max-width: 1100px; }
.u-mxw-110px { max-width: 110px; }
.u-mxw-150px { max-width: 150px; }
.u-mxw-170px { max-width: 170px; }
.u-mxw-220px { max-width: 220px; }
.u-mxw-420px { max-width: 420px; }
.u-mxw-52px { max-width: 52px; }
.u-mxw-60px { max-width: 60px; }
.u-mxw-720px { max-width: 720px; }
.u-mxw-760px { max-width: 760px; }
.u-mxw-820px { max-width: 820px; }
.u-mxw-980px { max-width: 980px; }
.u-pos-sticky { position: sticky; }
.u-top-76px { top: 76px; }
.u-w-10p { width: 10%; }
.u-w-11p { width: 11%; }
.u-w-12p { width: 12%; }
.u-w-130px { width: 130px; }
.u-w-150px { width: 150px; }
.u-w-22p { width: 22%; }
.u-w-240px { width: 240px; }
.u-w-24p { width: 24%; }
.u-w-36px { width: 36px; }
.u-w-70px { width: 70px; }
.u-w-7p { width: 7%; }
.u-w-80px { width: 80px; }
.u-w-84px { width: 84px; }
.u-w-8p { width: 8%; }
.u-w-90px { width: 90px; }
.u-w-auto { width: auto; }
.u-ws-pre-line { white-space: pre-line; }

/* ---- 1.6.0 industry modules (inventory, POS, restaurant, manufacturing) ---- */
.dgr-suggest { z-index: 1060; max-height: 280px; overflow-y: auto; min-width: 280px; left: 0; top: 100%; }
[data-lines] td:first-child { position: relative; }
.pos-total { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--dgr-text); }
.pos-screen .form-control-lg { font-size: 1.25rem; }
@media (min-width: 992px) { .pos-pay { position: sticky; top: 76px; } }
.rest-floor { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.rest-table { display: flex; flex-direction: column; gap: .15rem; padding: .75rem; border-radius: var(--dgr-radius); border: 1px solid var(--dgr-border); background: var(--dgr-card); color: var(--dgr-text); text-decoration: none; min-height: 96px; }
.rest-table.is-free { border-left: 4px solid var(--dgr-success); }
.rest-table.is-busy { border-left: 4px solid var(--dgr-gold); }
.rest-table.is-busy:hover, .rest-table.is-busy:focus { border-color: var(--dgr-gold); }
.rest-table-name { font-weight: 700; font-size: 1.05rem; }
.rest-menu { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .5rem; }
.rest-dish .btn { min-height: 64px; }
.kot-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .75rem; align-items: start; }
.kot-card.kot-new { border-top: 3px solid var(--dgr-warning); }
.kot-card.kot-preparing { border-top: 3px solid var(--dgr-info); }
.kot-card.kot-ready { border-top: 3px solid var(--dgr-success); }

/* ---- 1.6.1 CRM follow-up history ---- */
.remark-text { white-space: pre-line; overflow-wrap: anywhere; color: var(--dgr-text); }
.remark-clamped { display: -webkit-box; -webkit-line-clamp: 6; line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.history-entry.is-conversation .tl-dot { border-color: var(--dgr-gold); }
.history-entry:not(.is-conversation) .tl-dot { border-color: var(--dgr-border-strong); }
.history-entry.is-void .remark-text { color: var(--dgr-text-2); }
.history-entry.is-new { background: var(--dgr-gold-soft); border-radius: var(--dgr-radius-sm); }
.lead-remark-cell { max-width: 320px; }
.lead-remark-cell .remark-text { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Company dashboard */
.dashboard-range { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .55rem; margin: -.12rem 0 1.45rem; color: var(--dgr-text-2); font-size: .85rem; }
.dashboard-range i { color: var(--dgr-gold-text); }
.dashboard-range strong { color: var(--dgr-text); }
.dashboard-period .btn, .dashboard-period .form-control, .dashboard-period .form-select { min-height: 40px; }
.dashboard-kpi { height: 100%; min-height: 7rem; box-shadow: var(--dgr-panel-shadow); }
.dashboard-kpi .kpi-label { text-transform: none; letter-spacing: 0; font-size: .83rem; }
.dashboard-kpi .kpi-value { margin-block: .4rem .25rem; font-size: clamp(1.15rem, 10cqi, 1.85rem); letter-spacing: -.045em; overflow-wrap: anywhere; }
.dashboard-kpi .kpi-sub { line-height: 1.5; }
.dashboard-kpi.accent { border-top-color: var(--dgr-gold); }
a:has(> .dashboard-kpi) { display: block; height: 100%; border-radius: var(--dgr-radius); }
a:hover > .dashboard-kpi { border-color: var(--dgr-gold-text); }
.dashboard-setup { border-inline-start: .2rem solid var(--dgr-gold); }
.dashboard-workspace-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: .75rem; }
.dashboard-workspace, .dashboard-charts .card, .dashboard-tasks { box-shadow: var(--dgr-panel-shadow); }
.dashboard-workspace h3 { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.dashboard-workspace h3 .bi { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: var(--dgr-radius-sm); color: var(--dgr-gold-text); background: var(--dgr-gold-soft); }
.dashboard-workspace li + li { border-top: 1px solid var(--dgr-border); }
.dashboard-workspace a { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .38rem 0; min-height: 2.25rem; color: var(--dgr-text-2); text-decoration: none; }
.dashboard-workspace a:hover { color: var(--dgr-gold-text); text-decoration: underline; }
.dashboard-workspace a .bi { color: var(--dgr-gold-text); font-size: .7rem; }
.dashboard-charts canvas[hidden] { display: none; }
.dashboard-chart-status { color: var(--dgr-text-2); margin-bottom: 0; }
.dashboard-chart-status:empty { display: none; }
.dashboard-chart-values { margin-top: .65rem; }
.dashboard-chart-values summary { cursor: pointer; min-height: 2rem; color: var(--dgr-gold-text); }
.dashboard-chart-values caption { caption-side: top; }
@media (max-width: 575.98px) {
    .dashboard-kpi { padding: .8rem .65rem; }
    .dashboard-period .form-control { max-width: 100%; }
    .dashboard-workspace a { min-height: 2.75rem; }
}
