/* Casework workspace styles, on top of the design system (app.css). No inline styles anywhere (strict CSP). */
.global-search { display: flex; align-items: center; gap: 8px; padding: 0 8px; }
.global-search input { margin: 0; font-size: 14px; padding: 8px 10px; }
.layout-views { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }
.views-panel { padding: 14px; position: sticky; top: 16px; }
.views-panel h3 { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 10px 0 6px; }
.views-panel h3:first-child { margin-top: 0; }
.views-panel a { display: flex; justify-content: space-between; padding: 7px 10px; border-radius: 8px; color: var(--ink-2); font-size: 14px; text-decoration: none; }
.views-panel a.on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 650; }
.views-panel a .count { color: var(--muted); font-size: 12px; }
.views-panel .save { margin-top: 10px; width: 100%; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; margin-bottom: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg a { padding: 8px 12px; font-size: 13.5px; color: var(--ink-2); text-decoration: none; border-right: 1px solid var(--line); }
.seg a:last-child { border-right: 0; }
.seg a.on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 650; }
.seg a.later { color: var(--muted); }
.toolbar select { font: inherit; font-size: 13.5px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12.5px; padding: 4px 10px; border-radius: 999px; background: var(--neutral-soft); color: var(--ink-2); }
/* Fixed field positions: every case shows the same grid, empty values show a dash */
.field-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.field-grid div { padding: 11px 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-height: 62px; }
.field-grid div:nth-child(4n) { border-right: 0; }
.field-grid .l { display: block; font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; font-weight: 650; }
.field-grid .v { font-size: 14.5px; font-weight: 560; }
.field-grid .v.empty { color: var(--muted); font-weight: 400; }
.stages { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 6px; }
.stages .grp { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.stage { font-size: 12.5px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); background: var(--surface); }
.stage.done { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.stage.now { background: var(--brand); color: #fff; border-color: transparent; font-weight: 650; }
.stage-sep { color: var(--muted); }
.card-fixed { display: grid; grid-template-columns: 90px 1fr 140px 120px 120px; gap: 4px 14px; align-items: center; padding: 12px 16px; margin-bottom: 8px; }
.card-fixed .sub { grid-column: 2 / -1; color: var(--muted); font-size: 13px; }
.board { display: grid; grid-template-columns: repeat(6, minmax(140px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.board .col { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; min-height: 260px; }
.board .col h4 { margin: 2px 4px 10px; font-size: 13px; display: flex; justify-content: space-between; }
.board .item { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; font-size: 13.5px; display: grid; gap: 3px; }
.board .item .k { font-family: var(--mono); font-size: 12.5px; color: var(--brand-ink); }
.board .item .m { color: var(--muted); font-size: 12.5px; min-height: 18px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.cal .h { padding: 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.cal .d { min-height: 92px; padding: 6px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 12px; }
.cal .d:nth-child(7n) { border-right: 0; }
.cal .d .n { color: var(--muted); font-weight: 650; }
.cal .d.today .n { color: var(--brand-ink); }
.cal .ev { display: block; margin-top: 4px; padding: 3px 6px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-ink); font-size: 12px; text-decoration: none; }
.cal .ev.crit { background: var(--bad-soft); color: var(--bad); }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 14px 14px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: -24px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--surface); }
.timeline .t { color: var(--muted); font-size: 12.5px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.toast { position: fixed; right: 22px; bottom: 22px; max-width: 420px; z-index: 50; background: #0d1620; color: #e7edf3; padding: 14px 16px; border-radius: 12px; font-size: 14px; box-shadow: 0 12px 30px rgba(0,0,0,.25); }
.later-box { padding: 22px; text-align: center; color: var(--muted); }
.list-edit { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 10px; }
.list-edit span { font-size: 13px; padding: 5px 10px; border-radius: 8px; background: var(--neutral-soft); color: var(--ink-2); }
.mention { color: var(--brand-ink); font-weight: 650; }
td.hid { color: var(--muted); text-decoration: line-through; }
@media (max-width: 900px) {
  .layout-views, .two { grid-template-columns: 1fr; }
  .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-grid div:nth-child(4n) { border-right: 1px solid var(--line); }
  .field-grid div:nth-child(2n) { border-right: 0; }
  .card-fixed { grid-template-columns: 1fr; }
}

.ns-tag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px; font-size: 10px; font-weight: 600; letter-spacing: .02em; text-transform: none; background: #e8eefc; color: #2847a8; vertical-align: 1px; }
td.key { white-space: nowrap; }

/* ---------- app additions ---------- */
.board { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); }
a.item { color: inherit; text-decoration: none; }
a.card-fixed { color: inherit; text-decoration: none; }
.filters { display: grid; gap: 8px; margin: 0 0 12px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-row select, .filter-row input, .inline select, .inline input { font: inherit; font-size: 13.5px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); margin: 0; width: auto; }
.filter-row input { min-width: 160px; }
.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.form-grid input, .form-grid select, .form-grid textarea { margin: 0; }
.form-grid .wide { grid-column: 1 / -1; }
.panel { padding: 18px 20px; margin: 0 0 18px; }
.panel h3 { margin: 0 0 12px; font-size: 16px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.checks label { flex-direction: row; align-items: center; gap: 6px; font-weight: 500; }
.map-view { height: 560px; border-radius: 12px; border: 1px solid var(--line); overflow: hidden; background: var(--surface-2); }
.map-note { margin: 8px 0 0; }
.cal-nav { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.cal-nav h2 { margin: 0; font-size: 18px; min-width: 170px; }
.cal .ev.multi { background: var(--ok-soft); color: var(--ok); }
.group-row td { background: var(--surface-2); font-weight: 700; font-size: 13px; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable.on { color: var(--brand-ink); }
.serial-row { display: flex; gap: 6px; align-items: center; margin: 3px 0; flex-wrap: wrap; }
.serial-row input[type=text] { width: 150px; margin: 0; padding: 5px 8px; font-size: 13px; }
.serial-row label { font-size: 12px; color: var(--muted); display: flex; gap: 4px; align-items: center; }
.mention-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.mention-chips .chip button { border: 0; background: none; cursor: pointer; color: inherit; padding: 0 0 0 4px; font: inherit; }
.attach { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.attach:last-child { border-bottom: 0; }
.flag { padding: 12px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-weight: 600; margin: 0 0 16px; }
.list-edit span.off { text-decoration: line-through; opacity: .6; }
.list-edit button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 0 0 6px; font: inherit; }
.empty-box { padding: 26px; text-align: center; color: var(--muted); }
.stage-btn { cursor: pointer; font: inherit; }
.stage-btn:disabled { cursor: default; }
.section-gap { margin-top: 26px; }
.right { text-align: right; }
.danger { color: var(--bad); }
.who .out { margin-left: auto; }
.search-groups h2 { margin-top: 22px; }
.result { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.result:last-child { border-bottom: 0; }
.result .muted { display: block; font-size: 13px; }
.board-training { grid-auto-columns: minmax(260px, 1fr); }
.toast.bad { background: #5b1c1c; }
.hidden { display: none !important; }
.grow { flex: 1; min-width: 220px; }
@media (max-width: 900px) { .map-view { height: 420px; } }
.layout-views > section { min-width: 0; }
.toolbar .inline { flex-wrap: wrap; justify-content: flex-end; }
.toolbar input[type=search] { width: 200px; margin: 0; padding: 7px 10px; font-size: 13.5px; }
.toolbar label.small { display: flex; align-items: center; gap: 6px; flex-direction: row; }
.views-panel h3 .muted { text-transform: none; letter-spacing: 0; font-weight: 500; }
.views-panel p.small { margin: 2px 10px 6px; }
.who .out { width: auto; padding: 6px 8px; background: none; border: 0; }
.cases-table td:nth-child(4) { min-width: 120px; }
#toasts { position: fixed; right: 22px; bottom: 22px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
#toasts .toast { position: static; }
.form-grid select, .panel select, .form-actions select { font: inherit; font-size: 14px; padding: 9px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); width: 100%; }
.form-actions select { width: auto; }
.form-grid p.wide { margin: 0; }
/* The same look for every kind of text box (email, date, number, search, and boxes without a type). */
input:not([type]), input[type=email], input[type=date], input[type=number], input[type=search], input[type=tel] {
  width: 100%; font: inherit; font-size: 15px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--ink); }
input:not([type]):focus, input[type=email]:focus, input[type=date]:focus, input[type=number]:focus, input[type=search]:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
.inline input, .filter-row input, .serial-row input, .toolbar input[type=search] { width: auto; }
.inline input[name=lat], .inline input[name=lng] { width: 110px; padding: 6px 8px; font-size: 13px; }
.inline input[name=days] { width: 80px; }
.sig-canvas { display: block; width: 100%; height: 190px; border: 1px dashed var(--line-strong); border-radius: 10px; background: #fff; touch-action: none; cursor: crosshair; }
.sign-text { white-space: pre-wrap; margin: 0; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 600; }
label.check input { width: auto; min-height: 0; margin: 0; }
