/* NSP Workflow Cockpit — brand: green #236B53, dark green #133E33, orange #CD5C27 */
:root {
  --green: #236b53; --green-600: #1c5a46; --deep: #133e33; --light: #eaf4ef; --mint: #d4eee0;
  --orange: #cd5c27; --orange-text: #a3461b; --orange-bg: #fff1e6;
  --red: #ad3f3a; --red-bg: #fae9e8; --blue: #3f5a91; --blue-bg: #edf1fb;
  --bg: #f5f7f6; --card: #ffffff; --ink: #182a25; --muted: #5f716a; --border: #dce4df; --soft: #f8faf8;
  --shadow: 0 4px 20px rgba(20, 48, 36, .05); --radius: 12px;
  --font: "Libre Franklin", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--green); }
h1 { font-size: 26px; letter-spacing: -.6px; line-height: 1.2; margin: 4px 0 6px; }
h2 { font-size: 17px; margin: 0 0 10px; letter-spacing: -.2px; }
h3 { font-size: 14px; margin: 0 0 8px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid #9bcdb4; outline-offset: 2px; }

/* Layout */
.layout { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { background: var(--deep); color: #fff; padding: 22px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.mark { display: flex; gap: 11px; align-items: center; padding: 2px 8px; }
.logo { background: var(--mint); color: #14533d; border-radius: 11px; font-size: 19px; font-weight: 900; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; flex: none; }
.brand strong { font-size: 13.5px; display: block; line-height: 1.15; letter-spacing: .3px; }
.brand small { font-size: 10px; color: #bfd6cb; letter-spacing: 1.2px; }
.nav { display: grid; gap: 4px; }
.nav a { color: #c6ddd2; text-decoration: none; padding: 10px 12px; border-radius: 9px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.nav a[aria-current="page"], .nav a:hover { background: #2c6150; color: #fff; }
.nav .count { background: var(--orange); color: #fff; font-size: 11px; border-radius: 20px; padding: 1px 7px; font-weight: 800; }
.side-foot { margin-top: auto; font-size: 12px; color: #cbe2d5; display: grid; gap: 8px; }
.side-foot .who { padding: 10px; border: 1px solid #376c59; border-radius: 10px; }
.side-foot button { background: transparent; border: 1px solid #4b7d6b; color: #e5f1eb; border-radius: 8px; padding: 7px 10px; }
.main { min-width: 0; padding: 26px 34px 60px; max-width: 1500px; width: 100%; margin: 0 auto; }
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.eyebrow { text-transform: uppercase; letter-spacing: 1.6px; font-size: 11px; font-weight: 800; color: var(--green); }
.banner { border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 16px; }
.banner.demo { background: #fff7e9; border: 1px solid #ead7b9; color: #6d4f22; }
.banner.warn { background: var(--red-bg); border: 1px solid #efc7c3; color: #7d2c27; }
.banner.info { background: var(--light); border: 1px solid #bcdccd; color: var(--deep); }

/* Buttons & inputs */
.btn { border-radius: 9px; border: 1px solid var(--border); background: #fff; padding: 9px 14px; font-weight: 700; display: inline-flex; gap: 6px; align-items: center; justify-content: center; min-height: 40px; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: #94bdab; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-600); }
.btn.accent { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.danger { color: var(--red); border-color: #e8c3bf; }
.btn.sm { padding: 5px 10px; min-height: 32px; font-size: 13px; }
.btn.link { border: 0; background: none; color: var(--green); padding: 4px 6px; min-height: 0; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.field { flex-direction: row; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #45594f; font-weight: 700; }
.field.full { grid-column: 1 / -1; }
.field input, .field select, .field textarea, input.input, select.input, textarea.input {
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px; background: #fff; color: var(--ink); width: 100%; min-width: 0; font-weight: 500; min-height: 40px; }
.field textarea, textarea.input { resize: vertical; min-height: 80px; line-height: 1.5; }
.field small, .hint { font-weight: 500; color: var(--muted); font-size: 12px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; font-weight: 600; }
.check input { width: 18px; height: 18px; margin-top: 2px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 4px; font-size: 13px; font-weight: 700; color: #45594f; }
.task select.input { width: auto; min-width: 120px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: inline-block; padding: 7px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-weight: 700; background: #fff; cursor: pointer; }
.seg input:checked + span { background: var(--light); border-color: var(--green); color: var(--deep); }
.seg input:focus-visible + span { outline: 3px solid #9bcdb4; }
.seg input:disabled + span { opacity: .45; cursor: not-allowed; }

/* Cards & panels */
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.panel + .panel { margin-top: 14px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 14px; text-align: left; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--ink); }
.tile:hover { border-color: #a0cdb8; }
.tile small { color: var(--muted); font-size: 12px; font-weight: 700; }
.tile strong { font-size: 27px; line-height: 1.1; letter-spacing: -.8px; }
.tile .sub { font-size: 12px; color: var(--muted); }
.tile.urgent strong { color: var(--red); }
.tile.calm strong { color: var(--green); }
.tile.zero { opacity: .75; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.kpi { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--soft); }
.kpi strong { font-size: 24px; display: block; letter-spacing: -.6px; }
.kpi .def { font-size: 12px; color: var(--muted); margin-top: 4px; }
.bar { height: 8px; background: #e6ece8; border-radius: 6px; overflow: hidden; margin: 6px 0 2px; }
.bar > i { display: block; height: 100%; background: var(--green); width: 0; }

/* Chips */
.chip { display: inline-block; padding: 2px 8px; border-radius: 100px; background: #edf1ee; color: #4e6457; font-size: 11.5px; font-weight: 800; white-space: nowrap; }
.chip.green { background: #e3f3ea; color: #1f6145; }
.chip.orange { background: var(--orange-bg); color: var(--orange-text); }
.chip.red { background: var(--red-bg); color: var(--red); }
.chip.blue { background: var(--blue-bg); color: var(--blue); }
.chip.dark { background: var(--deep); color: #fff; }

/* Queue list */
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.filter { background: #fff; border: 1px solid var(--border); color: #4d6159; border-radius: 8px; padding: 6px 10px; font-size: 13px; font-weight: 700; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.filter[aria-current="true"] { background: var(--light); border-color: #9fcfb9; color: var(--deep); }
.filter .n { background: #eef2ef; border-radius: 10px; padding: 0 6px; font-size: 11.5px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .input { max-width: 300px; }
.list { display: grid; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #fff; }
.item { text-decoration: none; display: grid; grid-template-columns: 170px minmax(0, 1fr) 130px 120px 74px; gap: 12px; align-items: center; padding: 12px 14px; border-top: 1px solid #edf1ee; background: #fff; text-align: left; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; color: var(--ink); }
.item:first-child { border-top: 0; }
.item:hover { background: #fbfdfc; }
.item .who strong { display: block; }
.item .who small, .item .what small { color: var(--muted); display: block; font-size: 12.5px; }
.item .what strong { display: block; font-weight: 600; }
.item .tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.due { font-weight: 800; font-size: 13px; }
.due.overdue { color: var(--red); }
.due.today { color: var(--orange-text); }
.list-head { display: grid; grid-template-columns: 170px minmax(0, 1fr) 130px 120px 74px; gap: 12px; padding: 9px 14px; background: var(--soft); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 800; }
.empty { padding: 34px 20px; text-align: center; color: var(--muted); }

/* Drawer */
.drawer-back { position: fixed; inset: 0; background: rgba(12, 37, 29, .55); z-index: 50; display: flex; justify-content: flex-end; }
.drawer { width: min(760px, 100%); height: 100%; background: var(--bg); overflow: auto; box-shadow: -10px 0 50px #0003; }
.drawer-head { position: sticky; top: 0; z-index: 2; background: #fff; border-bottom: 1px solid var(--border); padding: 16px 20px; display: flex; justify-content: space-between; gap: 12px; }
.drawer-body { padding: 16px 20px 60px; display: grid; gap: 14px; }
.drawer .panel + .panel { margin-top: 0; }
.task { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: #fff; display: grid; gap: 6px; }
.task + .task { margin-top: 8px; }
.task.blocked { border-color: #efc7c3; background: #fffafa; }
.task .title { font-weight: 700; }
.timeline { display: grid; gap: 0; border-left: 2px solid #cce4d5; margin-left: 6px; padding-left: 14px; }
.ev { position: relative; padding: 0 0 12px; font-size: 13.5px; }
.ev::before { content: ""; position: absolute; left: -20px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--green); }
.ev.contact::before { background: var(--orange); }
.ev time { color: var(--muted); font-size: 12px; display: block; }
details.more > summary { cursor: pointer; font-weight: 700; color: var(--green); padding: 4px 0; }
.draft { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: #fff; }
.draft + .draft { margin-top: 10px; }
.draft textarea { width: 100%; min-height: 150px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; }

/* Modal & toast */
.modal-back { position: fixed; inset: 0; background: rgba(12, 37, 29, .55); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: #fff; border-radius: 14px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 20px; box-shadow: 0 20px 60px #0004; }
.toast { position: fixed; bottom: 18px; right: 18px; left: auto; max-width: 420px; background: var(--deep); color: #fff; border-radius: 10px; padding: 12px 16px; z-index: 100; box-shadow: 0 12px 30px #0003; }
.toast.error { background: var(--red); }

/* Login */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: linear-gradient(160deg, var(--deep), var(--green)); }
.auth { background: #fff; border-radius: 16px; padding: 28px; width: min(420px, 100%); box-shadow: 0 20px 60px #0004; display: grid; gap: 14px; }
.auth .mark { padding: 0; }
.auth .brand strong { color: var(--deep); }
.auth .brand small { color: var(--muted); }
.auth form { display: grid; gap: 14px; }
.auth form .row.end { margin-top: 4px; }
.pw-wrap { position: relative; margin-top: -10px; }
.pw-wrap .input { padding-right: 48px; min-height: 44px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 36px; border: 0; background: transparent; color: var(--muted); border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.pw-toggle:hover { color: var(--deep); background: var(--soft); }
.code { font-family: ui-monospace, Menlo, monospace; background: var(--soft); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; word-break: break-all; font-size: 13px; }

table.simple { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.simple th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 8px; background: var(--soft); }
table.simple td { border-top: 1px solid #edf1ee; padding: 8px; vertical-align: top; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.scroll-x { overflow-x: auto; }

@media (max-width: 1150px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .layout { display: block; }
  .sidebar { position: sticky; top: 0; z-index: 40; height: auto; padding: 10px 12px; gap: 8px; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .brand small { display: none; }
  .logo { width: 34px; height: 34px; font-size: 16px; }
  .nav { display: flex; overflow-x: auto; width: 100%; order: 3; gap: 2px; }
  .nav a { white-space: nowrap; padding: 8px 10px; }
  .side-foot { margin: 0 0 0 auto; display: flex; }
  .side-foot .who { display: none; }
  .main { padding: 16px 16px 60px; }
  h1 { font-size: 22px; }
  .list-head { display: none; }
  .item { grid-template-columns: 1fr auto; grid-template-areas: "who due" "what what" "owner open"; gap: 6px 10px; }
  .item .who { grid-area: who; } .item .what { grid-area: what; } .item .due-cell { grid-area: due; text-align: right; }
  .item .owner { grid-area: owner; font-size: 12.5px; color: var(--muted); } .item .open { grid-area: open; justify-self: end; }
  .grid2 { grid-template-columns: 1fr; }
  .drawer-head, .drawer-body { padding-left: 14px; padding-right: 14px; }
  .toast { left: 16px; right: 16px; max-width: none; }
  .toolbar .input { max-width: none; }
  .filters { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px 4px; scrollbar-width: none; }
  .filter { white-space: nowrap; }
  .banner.demo { font-size: 12px; padding: 8px 10px; }
  .top { margin-bottom: 12px; }
}
@media (prefers-reduced-motion: no-preference) { .tile, .btn { transition: border-color .15s, background .15s; } }
@media print { .sidebar, .toolbar, .filters { display: none; } }

/* V5 additions */
.bar.inline { display: inline-block; width: 90px; height: 6px; vertical-align: middle; margin: 0 0 0 6px; }
pre.code { white-space: pre-wrap; font-size: 13px; line-height: 1.5; }
.task .banner { margin: 4px 0; }
.task form.row .input { width: auto; min-width: 150px; }
nav.row { margin-bottom: 14px; }
