/* Kane Silica Tool - styles */
:root {
  --kane-ink: #1b1c1e;
  --kane-ink-soft: #3a3d42;
  /* Kane Blue brand palette (matches the other Kane apps) */
  --kane-blue: #003b73;
  --kane-blue-dark: #002b54;
  --kane-blue-light: #2e6fd6;
  --kane-blue-tint: #e6eef5;
  --paper: #ffffff;
  --bg: #eef0f3;
  --bg-soft: #f6f7f9;
  --line: #dfe3e8;
  --line-strong: #c6ccd4;
  --muted: #6b7280;
  --brand: var(--kane-blue);      /* deep navy used for section headers */
  --brand-soft: var(--kane-blue-tint);
  --danger: #b00020;
  --danger-bg: #fdecef;
  --ok: #1f7a3d;
  --ok-bg: #e9f6ee;
  --warn: #8a5a00;
  --warn-bg: #fff5df;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 14px rgba(16,24,40,.05);
  --radius: 12px;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--kane-ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0 0 .6rem; }
button { font-family: inherit; }

/* ---------- Header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--kane-blue);
  color: #fff;
  border-bottom: 3px solid var(--kane-blue-dark);
}
.app-header .bar {
  max-width: 1180px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo-img { height: 30px; display: block; }
.brand .title { display: flex; flex-direction: column; line-height: 1.15; }
.brand .title strong { font-size: 16px; }
.brand .title span { font-size: 11.5px; color: #b9bdc6; letter-spacing: .02em; }
.header-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.user-chip { font-size: 12.5px; font-weight: 600; color: #cfe0f5; padding: 4px 10px; border: 1px solid rgba(255,255,255,.3); border-radius: 999px; cursor: pointer; }
.user-chip:empty { display: none; }
.user-chip:hover { background: rgba(255,255,255,.1); }
.save-status { font-size: 12px; color: #cfe0f5; white-space: nowrap; padding: 0 4px; }
.save-status:empty { display: none; }
.save-status.err { color: #ffd9a8; font-weight: 700; }

/* ---------- Stepper ---------- */
.stepper {
  background: var(--paper); border-bottom: 1px solid var(--line);
  position: sticky; top: 58px; z-index: 30;
}
.stepper .track {
  max-width: 1180px; margin: 0 auto; padding: 10px 20px;
  display: flex; gap: 6px; overflow-x: auto;
}
.step-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg-soft); color: var(--kane-ink-soft);
  font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.step-pill .n {
  width: 20px; height: 20px; border-radius: 50%; background: var(--line-strong); color: #fff;
  display: grid; place-items: center; font-size: 12px;
}
.step-pill.active { border-color: var(--kane-blue); background: var(--kane-blue); color: #fff; }
.step-pill.active .n { background: var(--kane-blue-light); color: #fff; }
.step-pill.done .n { background: var(--ok); }
.step-pill.disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Layout ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 22px 20px 120px; }
main.step-3 { max-width: 1440px; }
main.step-4 { max-width: none; padding: 22px 30px 120px; }
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; margin-bottom: 18px;
}
.card > h2 { font-size: 19px; margin-bottom: 4px; }
.card .lead { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.section-eyebrow { color: var(--brand); font-weight: 700; font-size: 12px; letter-spacing: .09em; text-transform: uppercase; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 760px){ .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- Fields ---------- */
label.field, div.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--kane-ink-soft); }
.field input, .field select, .field textarea, .cell-input {
  font: inherit; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: #fff; color: var(--kane-ink);
}
.field input:focus, .field select:focus, .field textarea:focus, .cell-input:focus {
  outline: 2px solid var(--kane-blue-light); outline-offset: 0; border-color: var(--kane-blue-light); background:#fff;
}
.field .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
textarea { resize: vertical; min-height: 60px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  padding: 9px 15px; border-radius: 8px; border: 1px solid transparent; font-weight: 600; font-size: 14px;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--kane-blue); color: #fff; border-color: var(--kane-blue-dark);}
.btn-primary:hover:not(:disabled) { background: var(--kane-blue-dark); }
.btn-dark { background: var(--kane-blue-dark); color: #fff; }
.btn-dark:hover:not(:disabled) { background: #000; }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.btn-ghost:hover { background: rgba(255,255,255,.1); }
.btn-outline { background: #fff; color: var(--kane-ink); border-color: var(--line-strong); }
.btn-outline:hover:not(:disabled) { background: var(--bg-soft); }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-danger-ghost { background:#fff; color: var(--danger); border-color: #f1c6ce; }
.btn-danger-ghost:hover { background: var(--danger-bg); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.req { background: var(--danger-bg); color: var(--danger); }
.badge.noreq { background: var(--ok-bg); color: var(--ok); }
.badge.high { background: var(--danger-bg); color: var(--danger); }
.badge.low { background: var(--ok-bg); color: var(--ok); }
.badge.unknown { background: var(--warn-bg); color: var(--warn); }
.badge.neutral { background: var(--bg); color: var(--kane-ink-soft); }

/* ---------- Project home ---------- */
/* Full-width project rows: each project spans the whole card, a few visible at a time. */
.proj-grid { display: flex; flex-direction: column; gap: 10px; }
.proj-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px; background: var(--bg-soft); display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.proj-card .info { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 7px; }
.proj-card .name { font-weight: 700; font-size: 15.5px; }
.proj-card .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.proj-card .count { font-size: 12.5px; color: var(--muted); }
.proj-card .actions { display: flex; gap: 8px; margin-left: auto; }

/* ---------- SharePoint site picker (create-project form) ---------- */
#sp-picker input { width: 100%; box-sizing: border-box; }
#sp-picker .hint a { color: var(--kane-blue-light); font-weight: 600; text-decoration: underline; }
#sp-results { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; max-height: 420px; overflow-y: auto; }
.sp-row {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; cursor: pointer;
  width: 100%; text-align: left; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg-soft); font: inherit;
}
.sp-row:hover { border-color: var(--kane-blue-light); background: var(--kane-blue-tint); }
.sp-row .name { font-weight: 700; font-size: 13.5px; }
.sp-row .sub, .sp-chip .sub { font-size: 11.5px; color: var(--muted); word-break: break-all; }
.sp-note { font-size: 12.5px; color: var(--muted); padding: 8px 2px; }
.sp-chip {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border: 1px solid var(--kane-blue-light); border-radius: 8px; background: var(--kane-blue-tint);
}
.sp-chip .info { flex: 1; min-width: 0; }
.sp-chip .name { font-weight: 700; font-size: 13.5px; }

/* ---------- Saved-plan rows (home page: plans not connected to a project) ---------- */
.cloud-group { font-size: 12px; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .06em; margin: 14px 0 6px; }
.cloud-group:first-of-type { margin-top: 0; }
.cloud-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; }
.cloud-row .info { flex: 1; min-width: 0; }
.cloud-row .name { font-weight: 700; font-size: 14px; }
.cloud-row .sub { font-size: 12px; color: var(--muted); }

/* ---------- Work areas ---------- */
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.wa-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.wa-row input { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 12.5px; font-weight: 600; }
.chip.plan-ok { background: #dcefe3; color: #1f7a3d; }
.chip button { border: none; background: none; cursor: pointer; color: inherit; font-size: 14px; line-height: 1; padding: 0; }

/* ---------- Activity picker ---------- */
.toolbar {
  position: sticky; top: 108px; z-index: 20; background: var(--paper);
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 14px;
}
.toolbar .search { flex: 1; min-width: 200px; }
.count-tag { font-size: 13px; color: var(--muted); font-weight: 600; }
.activity-item {
  display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: start;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--bg-soft);
}
.activity-item.on { border-color: var(--kane-blue-light); background: var(--kane-blue-tint); box-shadow: inset 3px 0 0 var(--kane-blue); }
.activity-item .name { font-weight: 700; font-size: 14.5px; }
.activity-item .desc { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.activity-item .task-tag { font-size: 11px; color: var(--brand); font-weight: 700; margin-top: 4px; }
.toggle { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.toggle button { border: none; background: #fff; padding: 7px 14px; font-weight: 700; font-size: 13px; cursor: pointer; color: var(--muted); }
.toggle button.yes.sel { background: var(--danger); color: #fff; }
.toggle button.no.sel { background: var(--ok); color: #fff; }

/* ---------- Assessment cards (Step 4) ---------- */
select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%233a3d42' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 34px !important;
}
.assess-card {
  border: 1px solid var(--line); border-left: 5px solid var(--line-strong);
  border-radius: 10px; background: var(--paper); margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.assess-card.required { border-left-color: var(--danger); }
.assess-card.clear { border-left-color: var(--ok); }
.assess-card .head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--bg-soft);
  border-radius: 6px 10px 0 0;
}
.assess-card .num {
  width: 28px; height: 28px; border-radius: 8px; background: var(--kane-blue); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 13px; flex-shrink: 0;
}
.assess-card .head .name { font-weight: 700; font-size: 15px; }
.assess-card .head .tag { font-size: 12px; color: var(--muted); }
.assess-card .head .spacer { flex: 1; }
.assess-card .head .btn { padding: 6px 12px; font-size: 13px; }
.assess-card .body {
  display: grid; grid-template-columns: minmax(260px, 2fr) 1fr 1fr 1fr; gap: 14px 20px;
  padding: 16px 18px 18px;
}
.assess-card .body label.field { font-size: 12.5px; }
.assess-card .body .field select { width: 100%; font-size: 14px; padding: 10px 12px; }
.auto-tile {
  display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--kane-ink-soft);
}
.auto-tile .val {
  display: flex; align-items: center; min-height: 41px; padding: 0 4px;
}
.loc-multi { display: flex; flex-wrap: wrap; gap: 8px; }
.loc-multi label {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; cursor: pointer;
  background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 12px;
}
.loc-multi label:hover { border-color: var(--kane-blue-light); }
.loc-multi label:has(input:checked) { background: var(--kane-blue-tint); border-color: var(--kane-blue-light); box-shadow: inset 0 0 0 1px var(--kane-blue-light); }
.loc-multi input { width: 15px; height: 15px; accent-color: var(--kane-blue); }
@media (max-width: 1150px) { .assess-card .body { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px)  { .assess-card .body { grid-template-columns: 1fr; } }

/* ---------- Empty state ---------- */
.empty { text-align: center; color: var(--muted); padding: 34px 10px; }
.empty svg { opacity: .5; }

/* ---------- Sticky footer nav ---------- */
.footer-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 35;
  background: rgba(255,255,255,.96); backdrop-filter: blur(6px); border-top: 1px solid var(--line);
}
.footer-nav .inner { max-width: 1180px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 12px; }
.footer-nav .status { font-size: 13px; color: var(--muted); }
.footer-nav .spacer { flex: 1; }

/* ---------- Summary stat tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 12px; margin-bottom: 16px; }
.tile { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: var(--bg-soft); }
.tile .k { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.tile .v { font-size: 26px; font-weight: 800; margin-top: 2px; }
.tile.req .v { color: var(--danger); }
.tile.ok .v { color: var(--ok); }

/* ---------- Plan document ---------- */
.plan-doc { background: var(--paper); }
.plan-page { max-width: 900px; margin: 0 auto; }
.plan-titlebar { background: var(--kane-blue); color: #fff; border-left: 6px solid var(--kane-blue-light); padding: 18px 22px; border-radius: 10px 10px 0 0; }
.plan-titlebar h1 { font-size: 24px; letter-spacing: .02em; }
.plan-titlebar .sub { color: #c8ccd3; font-size: 13px; margin-top: 3px; }
.plan-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--line); border-top: none; }
.plan-meta div { padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.plan-meta div:nth-child(odd) { border-right: 1px solid var(--line); }
.plan-meta b { color: var(--muted); font-weight: 700; display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.plan-section { margin-top: 22px; }
.plan-section h3 { color: var(--brand); font-size: 15px; text-transform: uppercase; letter-spacing: .05em; border-bottom: 2px solid var(--kane-blue); padding-bottom: 5px; margin-bottom: 10px; }
.plan-section ul { margin: 0 0 6px; padding-left: 20px; }
.plan-section li { margin-bottom: 4px; font-size: 14px; }
.plan-summary-table { border-collapse: collapse; width: 100%; font-size: 13px; margin-top: 6px; }
.plan-summary-table th, .plan-summary-table td { border: 1px solid var(--line-strong); padding: 7px 9px; text-align: left; vertical-align: top; }
.plan-summary-table th { background: var(--brand-soft); color: var(--brand); }
.task-block { border: 1px solid var(--line-strong); border-radius: 8px; margin-bottom: 16px; overflow: hidden; break-inside: avoid; }
.task-block .head { background: var(--kane-blue); color: #fff; padding: 10px 14px; }
.task-block .head .t { font-weight: 700; font-size: 15px; }
.task-block .head .applies { font-size: 12px; color: #c8ccd3; margin-top: 2px; }
.task-block .rr { padding: 8px 14px; background: var(--danger-bg); color: var(--danger); font-weight: 700; font-size: 13px; border-bottom: 1px solid var(--line); }
.ctrl-cat { padding: 8px 14px 2px; font-weight: 700; color: var(--brand); font-size: 13px; }
.ctrl-row { padding: 5px 14px 5px; border-bottom: 1px solid var(--bg); font-size: 13px; }

.notice { padding: 12px 14px; border-radius: 8px; font-size: 13.5px; margin-bottom: 12px; }
.notice.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #ecd9a3; }
.notice.info { background: var(--brand-soft); color: var(--brand); border: 1px solid #cfe0f5; }

.hidden { display: none !important; }
.toast {
  position: fixed; bottom: 74px; left: 50%; transform: translateX(-50%);
  background: var(--kane-ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 60;
  box-shadow: var(--shadow); opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.show { opacity: 1; }

/* ---------- Print ---------- */
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; }
  .app-header, .stepper, .footer-nav, .toolbar, .no-print { display: none !important; }
  main { max-width: none; padding: 0; }
  .card { box-shadow: none; border: none; padding: 0; margin: 0; }
  .plan-page { max-width: none; }
  .plan-titlebar { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .task-block, .plan-section, .ctrl-row { break-inside: avoid; }
  .plan-titlebar, .task-block .head, .plan-summary-table th, .plan-section h3, .task-block .rr {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
}
