/* Fiber1Solutions Review Portal. Palette carried over from fiber1solutions.com:
   dark navy shell, off-white surfaces, brand red accent, Roboto. */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&family=Roboto+Mono:wght@400;500&display=swap');

:root {
  --red: #ff0000; --red-700: #c40000;
  --navy-900: #191c22; --navy-800: #22262e; --navy-700: #242b36; --navy-600: #2d3542; --navy-500: #3a4352;
  --white: #fff; --off-white: #f9f9fa; --gray-100: #f0f1f3; --gray-200: #e3e5e9; --gray-300: #d2d2d8; --gray-500: #697079; --gray-700: #4a525c;
  --ink: #22262e; --green: #1f7a4d; --green-bg: #e7f4ec; --amber: #8a5a00; --amber-bg: #fff4dc; --blue: #1a56db;
  --font: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--off-white); font-size: 15px; line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--red-700); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--navy-500); outline-offset: 2px; }

/* ---------- Gate (sign in, link, terms) ---------- */
.gate-body { background: var(--navy-800); min-height: 100vh; }
.gate { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 16px; }
.gate__logo { height: 40px; width: auto; margin-bottom: 28px; }
.card { background: #fff; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.35); width: 100%; max-width: 440px; padding: 32px; }
.card--wide { max-width: 720px; }
.gate__foot { color: #aab1bc; font-size: 12px; margin-top: 22px; text-align: center; max-width: 440px; }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--gray-500); margin: 0 0 6px; }
h1 { font-size: 24px; line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.muted { color: var(--gray-700); }
.small { font-size: 13px; }
.field { display: block; margin: 16px 0 0; }
.field > span { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.field input, .field select, .field textarea, .input { width: 100%; padding: 10px 12px; border: 1px solid var(--gray-300); border-radius: 8px; background: #fff; }
.field input:focus, .field textarea:focus, .input:focus { outline: 2px solid var(--navy-500); outline-offset: 1px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 8px; padding: 11px 18px; font-weight: 500; cursor: pointer; text-decoration: none; }
.btn--primary { background: var(--navy-800); color: #fff; }
.btn--primary:hover { background: var(--navy-600); }
.btn--red { background: var(--red-700); color: #fff; }
.btn--red:hover { background: #a80000; }
.btn--ghost { background: #fff; border: 1px solid var(--gray-300); color: var(--ink); }
.btn--ghost:hover { background: var(--gray-100); }
.btn--block { width: 100%; margin-top: 22px; }
.btn--sm { padding: 6px 12px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.alert { margin-top: 14px; padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.alert--ok { background: var(--green-bg); color: var(--green); }
.alert--err { background: #fdecec; color: var(--red-700); }
.turnstile-box { margin-top: 18px; min-height: 65px; }

.terms-box { margin-top: 16px; max-height: 320px; overflow: auto; border: 1px solid var(--gray-200); border-radius: 8px; padding: 18px 20px; background: var(--off-white); font-size: 14px; }
.terms-box h3 { font-size: 14px; margin: 16px 0 4px; }
.terms-box h3:first-child { margin-top: 0; }
.terms-box p { margin: 0 0 8px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; font-size: 14px; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--navy-800); flex: none; }
.sign-row { display: grid; grid-template-columns: 1fr 180px; gap: 12px; }
.signature { font-family: 'Brush Script MT', 'Segoe Script', cursive; font-size: 22px !important; }
.record { margin-top: 14px; padding: 10px 12px; border-radius: 8px; background: var(--gray-100); font-size: 12px; color: var(--gray-700); font-family: var(--mono); }
.draft-tag, .sample { display: inline-block; font-family: var(--mono); font-size: 11px; padding: 2px 8px; border-radius: 4px; background: var(--amber-bg); color: var(--amber); vertical-align: middle; }

/* ---------- App shell ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { background: var(--navy-800); color: #fff; display: flex; align-items: center; gap: 20px; padding: 0 20px; height: 60px; flex: none; }
.topbar img { height: 26px; width: auto; }
.topbar__project { border-left: 1px solid var(--navy-500); padding-left: 18px; line-height: 1.2; min-width: 0; }
.topbar__project b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__project span { font-size: 12px; color: #aab1bc; }
.tabs { display: flex; gap: 4px; margin-left: 12px; height: 100%; }
.tab { background: none; border: 0; color: #c9ced6; padding: 0 14px; cursor: pointer; border-bottom: 3px solid transparent; font-weight: 500; font-size: 14px; text-decoration: none; display: inline-flex; align-items: center; }
.tab:hover { color: #fff; }
.tab.is-on { color: #fff; border-bottom-color: var(--red); }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--red-700); color: #fff; font-size: 11px; line-height: 18px; margin-left: 6px; text-align: center; }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: #c9ced6; }
.who button { background: none; border: 1px solid var(--navy-500); color: #c9ced6; border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: 12px; }
.who button:hover { color: #fff; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--navy-500); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.notice { background: var(--gray-100); border-bottom: 1px solid var(--gray-200); font-size: 12px; color: var(--gray-700); padding: 7px 20px; }
.notice b { color: var(--ink); }

/* ---------- Quote ---------- */
.quote-wrap { max-width: 1000px; width: 100%; margin: 32px auto 64px; padding: 0 20px; display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: start; }
.paper { background: #fff; border: 1px solid var(--gray-200); border-radius: 12px; padding: 36px 40px; }
.paper__head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--gray-200); padding-bottom: 20px; margin-bottom: 20px; }
.paper__head img { height: 34px; width: auto; }
.meta { font-size: 13px; color: var(--gray-700); text-align: right; }
.meta b { color: var(--ink); }
.parties { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; font-size: 14px; margin-bottom: 24px; }
.parties p { margin: 0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-500); font-weight: 500; padding: 8px 0; border-bottom: 1px solid var(--gray-200); }
td { padding: 12px 0; border-bottom: 1px solid var(--gray-100); vertical-align: top; }
td.num, th.num { text-align: right; white-space: nowrap; padding-left: 12px; }
td small { display: block; color: var(--gray-500); font-size: 12.5px; margin-top: 2px; }
.totals { margin-left: auto; width: 280px; max-width: 100%; margin-top: 16px; font-size: 14px; }
.totals div { display: flex; justify-content: space-between; padding: 5px 0; }
.totals .grand { border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 10px; font-weight: 700; font-size: 17px; }
.side { position: sticky; top: 20px; display: grid; gap: 16px; }
.panel { background: #fff; border: 1px solid var(--gray-200); border-radius: 12px; padding: 20px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 20px; }
.status--open { background: var(--amber-bg); color: var(--amber); }
.status--ok { background: var(--green-bg); color: var(--green); }
.status--gray { background: var(--gray-100); color: var(--gray-700); }
.status--err { background: #fdecec; color: var(--red-700); }
.schedule { font-size: 14px; margin: 12px 0 0; padding: 0; list-style: none; }
.schedule li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--gray-100); }
.empty { max-width: 560px; margin: 80px auto; text-align: center; padding: 0 20px; }

/* ---------- Site review ---------- */
.review { flex: 1 1 auto; display: grid; grid-template-columns: 1fr 390px; grid-template-rows: minmax(0, 1fr); min-height: 0; height: calc(100vh - 93px); }
.stage { display: flex; flex-direction: column; min-width: 0; background: var(--gray-100); }
.toolbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--gray-200); flex-wrap: wrap; }
.toolbar select { padding: 7px 10px; border: 1px solid var(--gray-300); border-radius: 8px; background: #fff; max-width: 260px; }
.onpage { font-size: 13px; color: var(--gray-700); }
.seg { display: inline-flex; border: 1px solid var(--gray-300); border-radius: 8px; overflow: hidden; }
.seg button { background: #fff; border: 0; padding: 7px 12px; cursor: pointer; font-size: 13px; }
.seg button + button { border-left: 1px solid var(--gray-300); }
.seg button.is-on { background: var(--navy-800); color: #fff; }
.toggle { margin-left: auto; display: inline-flex; align-items: center; gap: 10px; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--gray-300); background: #fff; cursor: pointer; font-weight: 500; font-size: 14px; }
.toggle .dot { width: 34px; height: 20px; border-radius: 10px; background: var(--gray-300); position: relative; transition: background .15s; }
.toggle .dot::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle.is-on { border-color: var(--red-700); color: var(--red-700); }
.toggle.is-on .dot { background: var(--red-700); }
.toggle.is-on .dot::after { transform: translateX(14px); }
.viewport { flex: 1; overflow: auto; padding: 20px; display: flex; justify-content: center; }
.device { position: relative; width: 100%; height: 100%; min-height: 520px; background: #fff; box-shadow: 0 6px 24px rgba(25,28,34,.12); border-radius: 8px; overflow: hidden; transition: width .2s; }
.device iframe { width: 100%; height: 100%; border: 0; display: block; }
.device.is-commenting { outline: 2px dashed rgba(196,0,0,.55); outline-offset: 3px; }
.hint { position: absolute; z-index: 5; left: 50%; top: 14px; transform: translateX(-50%); background: var(--navy-800); color: #fff; font-size: 13px; padding: 7px 14px; border-radius: 20px; pointer-events: none; display: none; white-space: nowrap; }
.device.is-commenting .hint { display: block; }
.frame-msg { position: absolute; inset: 0; display: grid; place-items: center; background: #fff; color: var(--gray-700); font-size: 14px; z-index: 3; }
.composer { position: absolute; z-index: 6; width: 290px; background: #fff; border-radius: 10px; box-shadow: 0 12px 36px rgba(0,0,0,.25); padding: 14px; }
.composer p { margin: 0 0 8px; font-size: 12px; color: var(--gray-500); }
.composer textarea { width: 100%; height: 90px; resize: none; border: 1px solid var(--gray-300); border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.composer .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; align-items: center; }
.composer .row span { margin-right: auto; font-size: 11.5px; color: var(--gray-500); }

/* Comments panel */
.comments { background: #fff; border-left: 1px solid var(--gray-200); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.comments__head { padding: 14px 16px; border-bottom: 1px solid var(--gray-200); }
.comments__head h2 { margin: 0 0 10px; font-size: 16px; }
.filters { display: flex; gap: 6px; }
.filters button { border: 1px solid var(--gray-300); background: #fff; border-radius: 20px; padding: 3px 12px; font-size: 12.5px; cursor: pointer; }
.filters button.is-on { background: var(--ink); color: #fff; border-color: var(--ink); }
.clist { overflow: auto; flex: 1; }
.comments__foot { padding: 12px 16px; border-top: 1px solid var(--gray-200); font-size: 12px; color: var(--gray-500); }
.cview { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.ico { width: 14px; height: 14px; flex: none; vertical-align: -2px; }
.cc { display: grid; grid-template-columns: 26px 1fr; gap: 0 10px; padding: 14px 16px; border-bottom: 1px solid var(--gray-100); cursor: pointer; }
.cc:hover, .cc.is-hl { background: var(--off-white); }
.cc.is-hl { box-shadow: inset 3px 0 0 var(--red-700); }
.cc__num { width: 26px; height: 26px; border-radius: 50% 50% 50% 3px; background: var(--red-700); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.cc.is-resolved .cc__num, .cc__num.is-resolved { background: var(--green); }
.cc__meta { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--gray-500); min-height: 26px; }
.cc__meta b { color: var(--ink); font-weight: 500; }
.cc__new { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500; color: var(--blue); }
.cc__new::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); }
.cc__text { grid-column: 2; margin: 2px 0 0; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cc__last { grid-column: 2; margin: 8px 0 0; padding: 7px 10px; background: var(--gray-100); border-radius: 8px; font-size: 12.5px; color: var(--gray-700); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc__last b { color: var(--ink); font-weight: 500; }
.cc__chips { grid-column: 2; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--gray-700); background: #fff; border: 1px solid var(--gray-200); border-radius: 20px; padding: 2px 9px; }
.chip--go { color: var(--red-700); border-color: #f1c4c4; }
.chip--ok { color: var(--green); border-color: #bfe0cc; background: var(--green-bg); }
.thead { padding: 12px 16px 14px; border-bottom: 1px solid var(--gray-200); }
.back { background: none; border: 0; padding: 4px 0; color: var(--gray-700); font-size: 13px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.back:hover { color: var(--ink); }
.thead__row { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; margin-top: 8px; }
.thead__row b { display: block; font-size: 15px; }
.tpage { background: none; border: 0; padding: 0; font-size: 12.5px; color: var(--red-700); cursor: pointer; display: inline-flex; gap: 4px; align-items: center; text-align: left; }
.tbody { flex: 1; min-height: 0; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; background: var(--off-white); }
.msg { display: grid; grid-template-columns: 32px 1fr; gap: 10px; }
.msg.is-new { animation: msgIn .25s ease-out; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.av { width: 32px; height: 32px; border-radius: 50%; background: var(--navy-500); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.msg.is-staff .av { background: var(--red-700); }
.msg__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; color: var(--gray-500); margin-bottom: 5px; }
.msg__meta b { color: var(--ink); font-weight: 500; font-size: 13.5px; }
.tag { font-size: 11px; font-weight: 500; padding: 1px 7px; border-radius: 4px; background: var(--gray-100); color: var(--gray-700); }
.msg.is-staff .tag { background: #fde8e8; color: var(--red-700); }
.via { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--gray-500); }
.msg__bubble { background: #fff; border: 1px solid var(--gray-200); border-radius: 4px 12px 12px 12px; padding: 10px 13px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.is-staff .msg__bubble { border-color: #f1d0d0; }
.sys { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 11.5px; color: var(--gray-500); text-align: center; }
.sys::before, .sys::after { content: ""; flex: 1; height: 1px; background: var(--gray-200); }
.treply { border-top: 1px solid var(--gray-200); padding: 12px 16px 14px; background: #fff; }
.treply__box { border: 1px solid var(--gray-300); border-radius: 10px; padding: 8px 10px; transition: border-color .15s, box-shadow .15s; }
.treply__box:focus-within { border-color: var(--navy-500); box-shadow: 0 0 0 3px rgba(58,67,82,.12); }
.treply textarea { width: 100%; border: 0; resize: none; outline: none; font-size: 14px; line-height: 1.45; min-height: 42px; max-height: 160px; padding: 2px 0; background: transparent; }
.treply__row { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.treply__note { font-size: 12px; color: var(--gray-500); display: inline-flex; gap: 5px; align-items: center; margin-right: auto; }
.kbd { font-size: 11.5px; color: var(--gray-500); }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 60; background: var(--navy-800); color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 13.5px; box-shadow: 0 10px 30px rgba(0,0,0,.25); display: flex; gap: 8px; align-items: center; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; pointer-events: none; max-width: calc(100vw - 32px); }
.toast.is-on { opacity: 1; transform: none; }
.toast.is-err { background: var(--red-700); }

/* Terms tab */
.doc { max-width: 760px; margin: 32px auto 64px; padding: 0 20px; }
.doc .panel + .panel { margin-top: 16px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--gray-500); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

@media (max-width: 900px) {
  .quote-wrap, .review, .parties { grid-template-columns: 1fr; }
  .review { height: auto; }
  .viewport { min-height: 75vh; padding: 10px; }
  .comments { border-left: 0; border-top: 1px solid var(--gray-200); max-height: 80vh; }
  .paper { padding: 24px 18px; }
  .topbar { gap: 10px; padding: 0 12px; }
  .topbar__project { display: none; }
  .tabs { margin-left: 0; }
  .tab { padding: 0 8px; font-size: 13px; }
  .who span:not(.avatar) { display: none; }
  .sign-row { grid-template-columns: 1fr; }
  .toggle { margin-left: 0; }
}
@media (max-width: 600px) {
  .topbar img { height: 22px; }
  .tab { white-space: nowrap; padding: 0 6px; }
  .who .avatar { display: none; }
  .who button { padding: 3px 8px; white-space: nowrap; }
  #device { display: none; }
  .notice { font-size: 11.5px; padding: 6px 12px; }
}
