/* ==========================================================================
   Seva Sankalp — the calm CRM look of the office pages (17-10-2026).
   One stylesheet for /admin/process, /admin/collection, /admin/queue, /admin/followup (+ students),
   /admin/tasks (+ my), /admin/reminders. Neutral palette, one accent (the dark blue, var(--navy)) for primary
   buttons; quiet chips with a coloured dot (green = done, amber = waiting, red = problem); a thin coloured left
   border on rows that need action; sticky light-grey table headers; 52–56 px rows.
   Classes are prefixed crm- so nothing here clashes with app.css. Layout and style only.
   ========================================================================== */

/* ---- the staff nav: one line at 1200 px and above (compact, scrolls sideways only if it must) ---- */
@media (min-width: 1200px) {
  /* one line: the page container is 1320 px at every desktop width, so the words alone (no icons) and compact items */
  /* .wrap .staff-nav: more specific than base.html's own !important rules, which come later in the document */
  .wrap .staff-nav { flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: thin; gap: 0.1rem !important; padding: 0.2rem 0.3rem !important; }
  .wrap .staff-nav a { white-space: nowrap; flex: 0 0 auto; padding: 0.22rem 0.4rem !important; font-size: 0.72rem !important; letter-spacing: 0; }
  .wrap .staff-nav a .ic { display: none; }
}

/* ---- header card ---- */
.crm-head { background: #fff; border: 1px solid var(--rule); border-radius: 12px; padding: .75rem 1.1rem; margin-bottom: .7rem;
            display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .6rem .9rem; box-shadow: var(--shadow-sm); }
.crm-head h1, .crm-head h2 { margin: 0; font-size: 1.1rem; font-weight: 800; color: var(--navy); line-height: 1.25; }
.crm-head .kicker { display: block; font-size: .7rem; font-weight: 700; letter-spacing: .06em; color: var(--slate-muted); margin-bottom: 1px; }
.crm-head p, .crm-head .sub { margin: .1rem 0 0; font-size: .78rem; color: var(--slate-muted); }
.crm-head a { color: var(--navy); }
.crm-kpis { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.crm-kpi { background: var(--paper); border: 1px solid var(--rule); padding: .28rem .65rem; border-radius: 8px; display: inline-flex;
           align-items: center; gap: 6px; font-size: .77rem; color: var(--slate-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.crm-kpi strong { font-size: .92rem; color: var(--navy); }
.crm-kpi.warn strong { color: #b45309; }                       /* the one number that asks for work */
.crm-kpi.bad strong { color: #b91c1c; }
.crm-kpi.ok strong { color: #15803d; }
.crm-link { font-size: .77rem; font-weight: 700; color: var(--navy); text-decoration: none; border: 1px solid var(--rule); border-radius: 8px;
            padding: .28rem .65rem; background: #fff; white-space: nowrap; }
.crm-link:hover { background: var(--paper); text-decoration: none; }
.crm-note { margin: 0 0 .7rem; background: #fef3c7; color: #92400e; border: 1px solid #fde68a; border-radius: 8px; padding: .5rem .8rem;
            font-weight: 700; font-size: .82rem; }

/* ---- filter bar ---- */
.crm-panel { background: #fff; border: 1px solid var(--rule); border-radius: 12px; padding: .65rem 1.1rem; box-shadow: var(--shadow-sm);
             margin-bottom: .7rem; display: flex; flex-direction: column; gap: .55rem; }
.crm-filters { display: grid; grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr)) var(--tail, 150px 92px); gap: .55rem; align-items: end; }
.crm-field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.crm-field label { font-size: .72rem; font-weight: 700; color: var(--slate-muted); letter-spacing: .03em; margin: 0; white-space: nowrap;
                   overflow: hidden; text-overflow: ellipsis; }
.crm-field select, .crm-field input { padding: .38rem .55rem; font-size: .82rem; border: 1px solid var(--rule); border-radius: 8px; background: #fff;
                                      color: var(--ink-strong); width: 100%; margin: 0; min-width: 0; }
.crm-field select:focus, .crm-field input:focus, .crm-search:focus { border-color: var(--navy); outline: none; box-shadow: 0 0 0 3px rgba(15, 23, 42, .08); }
.crm-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .55rem; }
.crm-bar.sep { padding-top: .55rem; border-top: 1px solid var(--rule-light); }
.crm-search-wrap { flex: 1 1 240px; max-width: 460px; min-width: 0; }
.crm-search { width: 100%; padding: .4rem .8rem; font-size: .84rem; border: 1px solid var(--rule); border-radius: 8px; background: #fff; margin: 0; }
.crm-exports { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.crm-pills { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ---- buttons: the one accent; «quiet» = outlined ---- */
.btn.crm-btn, .crm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 34px; padding: .32rem .8rem;
                         font-size: .8rem; font-weight: 700; border-radius: 8px; background: var(--navy) !important; background-image: none !important;
                         color: #fff !important; border: 1px solid var(--navy) !important; box-shadow: none !important; text-decoration: none !important;
                         white-space: nowrap; cursor: pointer; }
.btn.crm-btn:hover, .crm-btn:hover { background: #1e293b !important; }
.btn.crm-btn.quiet, .crm-btn.quiet { background: #fff !important; color: var(--navy) !important; border: 1px solid var(--rule) !important; }
.btn.crm-btn.quiet:hover, .crm-btn.quiet:hover { background: var(--paper) !important; border-color: var(--navy) !important; }
.btn.crm-btn:disabled, .crm-btn:disabled { color: var(--muted) !important; border-color: var(--rule-light) !important; background: #fff !important; opacity: 1; cursor: default; }
.crm-reset { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: .32rem .7rem; font-size: .8rem; font-weight: 700;
             color: #b91c1c; border: 1px solid var(--err-border); background: #fff; border-radius: 8px; text-decoration: none; white-space: nowrap; }
.crm-reset:hover { background: #fef2f2; text-decoration: none; }
.crm-open { display: inline-flex; align-items: center; justify-content: center; min-height: 30px; padding: .22rem .65rem; font-size: .78rem; font-weight: 700;
            color: var(--navy); background: #fff; border: 1px solid var(--rule); border-radius: 8px; text-decoration: none; white-space: nowrap; }
.crm-open:hover { border-color: var(--navy); background: var(--paper); text-decoration: none; }
.crm-count { background: var(--sky); color: var(--ink-strong); font-size: .78rem; padding: .3rem .6rem; border-radius: 8px; font-weight: 700; }

/* ---- the table ---- */
.crm-table-wrap { background: #fff; border: 1px solid var(--rule); border-radius: 12px; overflow: auto; box-shadow: var(--shadow-sm); max-height: 78vh; }
.crm-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .83rem; margin: 0; font-variant-numeric: tabular-nums; }
.crm-table.fixed { table-layout: fixed; }
.crm-table th { position: sticky; top: 0; z-index: 2; background: var(--paper); color: var(--slate-muted); font-weight: 700; text-align: left;
                padding: .5rem .65rem; border-bottom: 1px solid var(--rule); font-size: .71rem; letter-spacing: .05em; white-space: nowrap;
                overflow: hidden; text-overflow: ellipsis; }
.crm-table th.n, .crm-table td.n { text-align: center; }
.crm-table td { padding: .4rem .65rem; border-bottom: 1px solid var(--rule-light); vertical-align: middle; height: 54px; color: var(--ink-strong);
                line-height: 1.25; }
.crm-table tbody tr:hover td { background: #f8fafc; }
.crm-table tbody tr:target td { background: #fef9c3; }
.crm-table tbody tr:last-child td { border-bottom: none; }
.crm-table td.chk, .crm-table th.chk { text-align: center; padding-left: .35rem; padding-right: .35rem; }
.crm-table input[type="checkbox"] { width: 15px; height: 15px; margin: 0; vertical-align: middle; accent-color: var(--navy); }
.crm-table tr.need-red td:first-child { box-shadow: inset 3px 0 0 #dc2626; }
.crm-table tr.need-amber td:first-child { box-shadow: inset 3px 0 0 #f59e0b; }
.crm-table .sub { display: block; font-size: .73rem; color: var(--slate-muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-table .sub.long { white-space: normal; overflow: visible; }   /* not .wrap: that is the page container class in app.css (56 px bottom margin) */
.crm-table .name { font-weight: 700; color: var(--ink-strong); font-size: .87rem; line-height: 1.25; overflow-wrap: anywhere; }
.crm-table .name.muted { color: var(--muted); font-weight: 600; }
.crm-table .n { font-weight: 700; white-space: nowrap; }
.crm-table .num { font-family: monospace; font-weight: 700; color: var(--ink-strong); white-space: nowrap; text-decoration: none; }
.crm-table .code { background: #e2e8f0; color: #475569; padding: 0 5px; border-radius: 4px; font-weight: 700; font-family: monospace; font-size: .7rem;
                   text-decoration: none; white-space: nowrap; }
.crm-table .z { color: #cbd5e1; font-weight: 600; }
.crm-table .bad { color: #b91c1c; font-weight: 800; }
.crm-table .muted { color: var(--muted); }
.crm-app { font-family: monospace; font-weight: 800; font-size: .86rem; color: var(--navy); letter-spacing: .3px; white-space: nowrap; }
.crm-tag { background: var(--sky); color: var(--slate-muted); border: 1px solid var(--rule); font-weight: 700; font-size: .66rem; padding: 0 5px;
           border-radius: 4px; margin-left: 5px; white-space: nowrap; }
.crm-pager { display: flex; gap: .8rem; align-items: center; justify-content: center; flex-wrap: wrap; margin: .8rem 0; font-size: .84rem; color: var(--slate-muted); }
.crm-empty { padding: 2rem; text-align: center; color: var(--muted); }

/* ---- chips: light grey, a coloured dot, short text; equal height; never wrapping ---- */
.chips { display: flex; gap: 5px; align-items: center; flex-wrap: nowrap; overflow: hidden; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; background: #f1f5f9; color: #334155;
        border: 1px solid #e2e8f0; font-size: .72rem; font-weight: 700; white-space: nowrap; flex: none; text-decoration: none; }
.chip i { width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; flex: none; }
.chip.ok i { background: #16a34a; } .chip.wait i { background: #d97706; } .chip.bad i { background: #dc2626; }
.crm-table .chip.bad { color: #334155; font-weight: 700; }                 /* quiet: the dot carries the colour */
.crm-table .sub.ack { white-space: normal; overflow: visible; word-break: break-all; }   /* the receipt number in full */
.chip.icon { padding: 0 6px; font-size: .82rem; } .chip.icon:hover { border-color: var(--navy); background: #fff; }

/* ---- slim strips (a queue card with nothing in it) ---- */
.crm-strip { display: flex; align-items: center; gap: .6rem; padding: .45rem .9rem; margin: 0 0 .5rem; background: #fff; border: 1px solid var(--rule);
             border-radius: 10px; font-size: .82rem; color: var(--slate-muted); }
.crm-strip .kicker { font-size: .7rem; font-weight: 800; letter-spacing: .06em; color: var(--navy); margin: 0; }
.crm-strip strong { color: var(--ink-strong); }
.crm-section { background: #fff; border: 1px solid var(--rule); border-radius: 12px; padding: .7rem 1rem; margin: 0 0 .6rem; box-shadow: var(--shadow-sm); }
.crm-section h2 { font-size: .95rem; margin: 0 0 .4rem; color: var(--navy); }
.crm-section .kicker { font-size: .7rem; font-weight: 800; letter-spacing: .06em; color: var(--slate-muted); }
.crm-section > p { margin: .25rem 0; font-size: .84rem; }

/* ---- stage headers / pills of the Follow-up page keep their colours as text ---- */
.crm-table th.sh-1 { color: #475569; } .crm-table th.sh-2 { color: #b45309; } .crm-table th.sh-3 { color: #c2410c; }
.crm-table th.sh-4 { color: #1d4ed8; } .crm-table th.sh-5 { color: #6d28d9; } .crm-table th.sh-6 { color: #0f766e; }
.crm-table th.sh-7 { color: #15803d; }

@media (max-width: 1100px) { .crm-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 768px) {
  .crm-filters { grid-template-columns: 1fr; }
  .crm-bar { flex-direction: column; align-items: stretch; }
  .crm-search-wrap { max-width: 100%; }
  .crm-table.fixed { table-layout: auto; min-width: 960px; }
}
