/* Blog Approval Portal
   Palette: cool slate canvas, pine primary for approval actions,
   brick for overdue, ochre for urgent. Serif reserved for document text. */

:root {
  --ink:        #1b2430;
  --ink-2:      #43505f;
  --muted:      #6b7a8c;
  --canvas:     #eef1f4;
  --surface:    #ffffff;
  --surface-2:  #f7f9fa;
  --line:       #dae1e8;
  --line-2:     #eaeff3;

  --pine:       #1f5e56;
  --pine-dark:  #17463f;
  --pine-tint:  #e6f0ee;

  --brick:      #a8341f;
  --brick-tint: #fbeae6;
  --ochre:      #8a6100;
  --ochre-tint: #fdf3dd;
  --slate-tint: #e8edf3;

  --radius:     6px;
  --radius-lg:  10px;
  --shadow:     0 1px 2px rgba(27, 36, 48, .06), 0 8px 24px -16px rgba(27, 36, 48, .35);

  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--canvas);
  font-feature-settings: 'tnum' 1, 'cv05' 1;
}

a { color: var(--pine); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--pine);
  outline-offset: 2px;
  border-radius: 3px;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 16px;
}
.skip:focus { left: 8px; top: 8px; }

/* ---------------------------------------------------------------- shell */
.shell { display: flex; min-height: 100vh; }

.rail {
  width: 236px; flex: 0 0 236px;
  background: var(--ink);
  color: #c3cedb;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-mark {
  width: 22px; height: 22px; flex: none; border-radius: 4px;
  background: linear-gradient(150deg, #35a08f 0%, var(--pine) 70%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.brand-name { color: #fff; font-weight: 600; font-size: 14px; letter-spacing: -.01em; }

.nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; margin-bottom: 1px;
  border-radius: var(--radius);
  color: #b9c5d3; font-size: 13.5px; font-weight: 500;
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-item.is-active { background: var(--pine); color: #fff; }
.nav-item .ico { width: 17px; height: 17px; flex: none; opacity: .9; }
.nav-item .count {
  margin-left: auto; font-style: normal; font-size: 11px; font-weight: 600;
  background: var(--brick); color: #fff; border-radius: 9px; padding: 1px 6px;
}

.rail-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.08);
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: #2f3d4d; color: #dbe4ee;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
}
.who { min-width: 0; line-height: 1.3; }
.who strong { display: block; color: #fff; font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who span { font-size: 11.5px; color: #8b9aab; }
.signout { margin-left: auto; color: #8b9aab; font-size: 16px; text-decoration: none; }
.signout:hover { color: #fff; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* --------------------------------------------------------------- topbar */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 26px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}

.search { position: relative; flex: 1; max-width: 560px; }
.search > svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--muted); pointer-events: none;
}
.search input {
  width: 100%; height: 38px;
  padding: 0 44px 0 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  font: inherit; font-size: 14px; color: var(--ink);
}
.search input::placeholder { color: #93a1b1; }
.search input:focus {
  background: #fff; border-color: var(--pine);
  outline: none; box-shadow: 0 0 0 3px var(--pine-tint);
}
.search kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font: 500 11px var(--sans); color: var(--muted);
  border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 4px; padding: 1px 5px; background: #fff;
}
.search input:focus ~ kbd { display: none; }

.results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40;
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  max-height: 62vh; overflow-y: auto; padding: 5px;
}
.results[hidden] { display: none; }
.res {
  display: block; padding: 9px 11px; border-radius: var(--radius);
  color: var(--ink); text-decoration: none;
}
.res:hover, .res.is-cursor { background: var(--surface-2); text-decoration: none; }
.res-title { font-weight: 550; font-size: 13.5px; }
.res-title mark { background: #fdf0c8; color: inherit; padding: 0 1px; border-radius: 2px; }
.res-meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.res-empty, .res-head {
  padding: 10px 12px; font-size: 12.5px; color: var(--muted);
}
.res-head { border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.res-more { display: block; padding: 9px 12px; font-size: 12.5px; border-top: 1px solid var(--line-2); }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.bell { position: relative; color: var(--ink-2); display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: var(--radius); }
.bell:hover { background: var(--surface-2); }
.bell .ico { width: 19px; height: 19px; }
.bell .dot {
  position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px;
  border-radius: 8px; background: var(--brick); color: #fff;
  font-size: 10px; font-weight: 700; display: none;
  align-items: center; justify-content: center; padding: 0 4px;
}
.bell .dot.on { display: flex; }

/* -------------------------------------------------------------- content */
.content { padding: 26px; max-width: 1220px; width: 100%; }

.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 21px; font-weight: 650; letter-spacing: -.015em; }
.page-head p { margin: 3px 0 0; color: var(--muted); font-size: 13.5px; }
.page-head .spacer { margin-left: auto; display: flex; gap: 8px; align-items: center; }

h2 { font-size: 15px; font-weight: 650; margin: 0 0 12px; letter-spacing: -.01em; }
h3 { font-size: 13.5px; font-weight: 600; margin: 0 0 8px; }

/* ---------------------------------------------------------------- cards */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 18px 20px; margin-bottom: 18px;
}
.card.tight { padding: 0; overflow: hidden; }
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px; border-bottom: 1px solid var(--line-2);
}
.card-head h2 { margin: 0; }
.card-head .spacer { margin-left: auto; }
.card-body { padding: 18px 20px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-side { grid-template-columns: minmax(0, 1fr) 330px; align-items: start; }

/* stat tiles: the number leads, the label sits under it */
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 15px 17px;
}
.stat b { display: block; font-size: 27px; font-weight: 650; letter-spacing: -.02em; line-height: 1.1; }
.stat span { font-size: 12.5px; color: var(--muted); }
.stat.alert b { color: var(--brick); }
.stat.warn b { color: var(--ochre); }
.stat a { color: inherit; }

/* --------------------------------------------------------------- tables */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-weight: 600; font-size: 12px; color: var(--muted);
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .t-title { font-weight: 550; color: var(--ink); }
.table .t-sub { color: var(--muted); font-size: 12.5px; }
.table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-urgent { box-shadow: inset 3px 0 0 var(--ochre); }
.row-overdue { box-shadow: inset 3px 0 0 var(--brick); }

.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; font-weight: 600; }

/* ------------------------------------------------------ pills and tags */
.pill, .tag {
  display: inline-block; font-size: 11.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 20px; white-space: nowrap;
}
.pill { background: var(--slate-tint); color: var(--ink-2); }
.pill-high { background: var(--ochre-tint); color: var(--ochre); }
.pill-urgent { background: var(--brick); color: #fff; }

.tag { background: var(--slate-tint); color: var(--ink-2); border-radius: 4px; }
.tag-review { background: var(--pine-tint); color: var(--pine-dark); }
.tag-revision { background: var(--ochre-tint); color: var(--ochre); }
.tag-web { background: #e4edfa; color: #1d4f91; }
.tag-done { background: #e8f2e9; color: #2c6b39; }
.tag-overdue { background: var(--brick-tint); color: var(--brick); }

/* -------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; color: var(--ink);
  font: 550 13.5px var(--sans); cursor: pointer; text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--pine); border-color: var(--pine); color: #fff; }
.btn-primary:hover { background: var(--pine-dark); border-color: var(--pine-dark); }
.btn-danger { background: #fff; border-color: #e3b7ae; color: var(--brick); }
.btn-danger:hover { background: var(--brick-tint); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* --------------------------------------------------------------- forms */
.field { margin-bottom: 15px; }
.field > label, .lbl {
  display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; color: var(--ink-2);
}
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=url],
input[type=number], input[type=datetime-local], input[type=date], select, textarea {
  width: 100%; padding: 8px 11px; font: inherit; font-size: 13.5px;
  color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--pine); box-shadow: 0 0 0 3px var(--pine-tint);
}
textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
select { appearance: none; background-image:
  url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 8l3-3.5' fill='none' stroke='%236b7a8c' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.check { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 9px; font-size: 13.5px; }
.check input { margin-top: 3px; accent-color: var(--pine); }
.inline-fields { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.inline-fields .field { margin-bottom: 0; }

.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  padding: 14px 20px; border-bottom: 1px solid var(--line-2); background: var(--surface-2);
}
.filters .field { margin: 0; min-width: 150px; }

/* ---------------------------------------------------------------- flash */
.flash {
  padding: 11px 15px; border-radius: var(--radius); margin-bottom: 16px;
  font-size: 13.5px; border: 1px solid;
}
.flash-ok   { background: #e8f2e9; border-color: #bcdcc2; color: #2c6b39; }
.flash-err  { background: var(--brick-tint); border-color: #eec4bb; color: var(--brick); }
.flash-warn { background: var(--ochre-tint); border-color: #e8d5a0; color: var(--ochre); }
.flash-info { background: var(--pine-tint); border-color: #bcd8d2; color: var(--pine-dark); }

/* ------------------------------------------------------- stage pipeline */
/* The one bold element: the approval chain, read left to right. */
.pipeline {
  display: flex; gap: 0; overflow-x: auto;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); margin-bottom: 18px;
}
.stage-cell {
  flex: 1 1 0; min-width: 148px; padding: 13px 15px 14px;
  border-right: 1px solid var(--line-2); position: relative;
}
.stage-cell:last-child { border-right: 0; }
.stage-cell .seq {
  font-size: 11px; font-weight: 700; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.stage-cell .nm { font-size: 13px; font-weight: 600; margin: 1px 0 3px; }
.stage-cell .by { font-size: 12px; color: var(--muted); line-height: 1.4; }
.stage-cell::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: var(--line-2);
}
.stage-cell.done::after { background: var(--pine); }
.stage-cell.done .nm { color: var(--pine-dark); }
.stage-cell.now::after { background: repeating-linear-gradient(90deg, var(--ochre) 0 7px, transparent 7px 13px); }
.stage-cell.now { background: var(--ochre-tint); }
.stage-cell.now .nm { color: var(--ochre); }
.stage-cell.late::after { background: var(--brick); }
.stage-cell.late { background: var(--brick-tint); }
.stage-cell.late .nm { color: var(--brick); }

/* ------------------------------------------------------------- timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative; padding: 0 0 16px 26px;
  border-left: 2px solid var(--line-2); margin-left: 6px;
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: ''; position: absolute; left: -7px; top: 3px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 2px solid var(--line);
}
.timeline li.ok::before     { border-color: var(--pine); background: var(--pine); }
.timeline li.rev::before    { border-color: var(--ochre); background: var(--ochre); }
.timeline li.over::before   { border-color: var(--brick); background: var(--brick); }
.timeline li.wait::before   { border-style: dashed; }
.timeline .tl-line { font-size: 13.5px; }
.timeline .tl-line b { font-weight: 600; }
.timeline .tl-when { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline .tl-note {
  margin-top: 6px; padding: 8px 11px; background: var(--surface-2);
  border-left: 2px solid var(--line); border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 13px; color: var(--ink-2);
}

/* ------------------------------------------------------- document view */
.doc {
  font-family: var(--serif); font-size: 16.5px; line-height: 1.72;
  color: #17202b; max-width: 68ch;
}
.doc p { margin: 0 0 1em; }
.doc p:first-child { font-size: 19px; font-weight: 600; line-height: 1.35; }
.doc-scroll { max-height: 620px; overflow-y: auto; padding: 22px 24px; }
.doc-edit {
  width: 100%; min-height: 480px; font-family: var(--serif);
  font-size: 15.5px; line-height: 1.7; padding: 18px 20px;
  border: 1px solid var(--line); border-radius: var(--radius);
}

.change {
  padding: 9px 0; border-bottom: 1px solid var(--line-2); font-size: 13px;
}
.change:last-child { border-bottom: 0; }
.change .was { color: var(--brick); text-decoration: line-through; text-decoration-thickness: 1px; }
.change .now { color: var(--pine-dark); font-weight: 550; }
.change .meta { color: var(--muted); font-size: 12px; margin-top: 2px; }

.version-row { display: flex; align-items: center; gap: 10px; padding: 9px 0;
  border-bottom: 1px solid var(--line-2); font-size: 13px; }
.version-row:last-child { border-bottom: 0; }
.version-row .vno {
  width: 30px; height: 24px; flex: none; display: grid; place-items: center;
  background: var(--slate-tint); border-radius: 4px;
  font-size: 11.5px; font-weight: 700; color: var(--ink-2);
}
.version-row.is-current .vno { background: var(--pine); color: #fff; }

.comment { padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.comment:last-child { border-bottom: 0; }
.comment .c-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.comment .c-head b { font-size: 13px; font-weight: 600; }
.comment .c-head span { font-size: 12px; color: var(--muted); }
.comment .c-body { font-size: 13.5px; color: var(--ink-2); white-space: pre-wrap; }

.meta-list { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; font-size: 13px; }
.meta-list dt { color: var(--muted); }
.meta-list dd { margin: 0; font-weight: 500; }

/* ---------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a {
  padding: 9px 14px; font-size: 13.5px; font-weight: 550; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.is-active { color: var(--pine-dark); border-bottom-color: var(--pine); }

/* -------------------------------------------------------------- toasts */
.toasts {
  position: fixed; right: 20px; bottom: 20px; z-index: 90;
  display: flex; flex-direction: column-reverse; gap: 9px; max-width: 330px;
}
.toast {
  background: var(--ink); color: #fff; border-radius: var(--radius-lg);
  padding: 12px 15px; box-shadow: 0 12px 30px -10px rgba(27,36,48,.5);
  font-size: 13px; display: block; text-decoration: none;
}
.toast:hover { text-decoration: none; color: #fff; }
.toast b { display: block; font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.toast span { color: #b9c5d3; }
.toast.urgent { background: var(--brick); }
.toast.urgent span { color: #f3d3cc; }
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: slide-in .22s ease-out; }
  @keyframes slide-in { from { transform: translateY(8px); opacity: 0; } }
}

/* --------------------------------------------------------------- login */
.auth-page {
  min-height: 100vh; display: grid; place-items: center;
  background: var(--ink); padding: 24px;
}
.auth-card {
  width: 100%; max-width: 380px; background: #fff;
  border-radius: 12px; padding: 30px 30px 26px; box-shadow: 0 30px 60px -30px rgba(0,0,0,.6);
}
.auth-card .brand { border: 0; padding: 0 0 18px; }
.auth-card h1 { font-size: 19px; margin: 0 0 4px; font-weight: 650; letter-spacing: -.015em; }
.auth-card .sub { color: var(--muted); font-size: 13.5px; margin: 0 0 20px; }
.auth-card .btn { width: 100%; height: 40px; }

.pagination { display: flex; gap: 6px; padding: 14px 20px; align-items: center; font-size: 13px; }
.pagination a, .pagination span {
  padding: 5px 10px; border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink-2); text-decoration: none;
}
.pagination .is-current { background: var(--pine); border-color: var(--pine); color: #fff; }
.pagination .muted { border: 0; color: var(--muted); margin-left: auto; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.mb-0 { margin-bottom: 0; }
.mt-16 { margin-top: 16px; }
.divider { height: 1px; background: var(--line-2); margin: 16px 0; }

/* ---------------------------------------------------------- responsive */
@media (max-width: 1000px) {
  .grid-side, .grid-4, .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .rail { width: 100%; flex: none; height: auto; position: static; }
  .nav { display: flex; overflow-x: auto; padding: 8px; }
  .nav-item { flex: none; }
  .nav-item span { white-space: nowrap; }
  .rail-foot { border-top: 1px solid rgba(255,255,255,.08); }
  .content { padding: 16px; }
  .topbar { padding: 10px 16px; flex-wrap: wrap; }
  .grid-2, .grid-4 { grid-template-columns: 1fr; }
  .table th:nth-child(n+4), .table td:nth-child(n+4) { display: none; }
  .search kbd { display: none; }
}

@media print {
  .rail, .topbar, .btn, .toasts { display: none !important; }
  .content { padding: 0; }
  .card { border: 0; }
}
