:root {
  --ink: #171717;
  --muted: #6d6d6d;
  --line: #dedbd4;
  --soft: #f4f2ed;
  --paper: #fbfaf7;
  --white: #fff;
  --red: #e2231a;
  --red-dark: #b51d17;
  --yellow: #fff200;
  --green: #4aa72e;
  --blue-row: #ccecf7;
  --purple-row: #dfb9ea;
  --green-row: #def2d4;
  --peach-row: #f7e1d6;
  --shadow: 0 18px 50px rgba(20, 18, 14, .14);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.45 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(420px, .85fr);
  background: #171717;
}
.auth-visual {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  padding: 46px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(226,35,26,.9), rgba(226,35,26,.25) 47%, transparent 48%),
    radial-gradient(circle at 80% 15%, #494949, #171717 46%);
}
.auth-brand { display: flex; align-items: center; gap: 14px; font-weight: 800; letter-spacing: .03em; }
.brand-mark { display: grid; place-items: center; width: 50px; height: 42px; color: #fff; background: var(--red); font-size: 11px; font-weight: 900; letter-spacing: .13em; }
.auth-copy { max-width: 720px; }
.hero-kicker { margin: 0 0 10px; color: #ffd5d2; font-size: 12px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.auth-copy h1 { margin: 0; max-width: 650px; font-size: clamp(40px, 6vw, 78px); line-height: .98; letter-spacing: -.055em; }
.auth-copy p { max-width: 580px; margin: 24px 0 0; color: #d4d4d4; font-size: 17px; }
.auth-features { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.auth-features span { padding: 7px 10px; border: 1px solid #656565; border-radius: 999px; color: #e8e8e8; font-size: 12px; }
.auth-panel { display: grid; place-items: center; min-height: 100vh; padding: 34px; background: var(--paper); }
.auth-card { width: min(430px, 100%); padding: 34px; border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); }
.auth-card h2 { margin: 0; font-size: 28px; letter-spacing: -.035em; }
.auth-card > p { margin: 8px 0 24px; color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field + .field { margin-top: 13px; }
.field label { color: #525252; font-size: 11px; font-weight: 800; }
.field label.required:after { content: " *"; color: var(--red); }
.input, .field input, .field select, .field textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  color: var(--ink);
  border: 1px solid #c8c4bc;
  border-radius: 3px;
  background: #fff;
}
.field textarea { min-height: 112px; resize: vertical; }
.field small { color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.field.full { grid-column: 1 / -1; }

.btn {
  min-height: 39px;
  padding: 9px 13px;
  border: 1px solid #bbb7af;
  border-radius: 3px;
  color: var(--ink);
  background: #fff;
  font-weight: 800;
  text-decoration: none;
}
.btn:hover { border-color: #777; }
.btn-primary { color: #fff; border-color: var(--red); background: var(--red); }
.btn-primary:hover { border-color: var(--red-dark); background: var(--red-dark); }
.btn-dark { color: #fff; border-color: #222; background: #222; }
.btn-quiet { color: var(--muted); }
.btn-danger { color: #a31e18; border-color: #e5aaa7; }
.btn-block { width: 100%; margin-top: 20px; }
.btn-small { min-height: 32px; padding: 6px 9px; font-size: 12px; }
.btn:disabled { cursor: not-allowed; opacity: .48; }
.icon-btn { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid #d1cdc5; border-radius: 3px; background: #fff; }

.app-shell { min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 68px;
  padding: 10px 20px;
  color: #fff;
  border-bottom: 4px solid var(--red);
  background: #171717;
}
.topbar-left, .topbar-right, .brand-lockup, .user-chip { display: flex; align-items: center; }
.brand-lockup { gap: 13px; }
.brand-title strong { display: block; font-size: 15px; }
.brand-title span { display: block; margin-top: 2px; color: #bdbdbd; font-size: 11px; }
.topbar-right { gap: 10px; }
.user-chip { gap: 8px; padding: 6px 9px; border: 1px solid #4e4e4e; border-radius: 999px; color: #ddd; background: #232323; font-size: 12px; }
.avatar { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; background: var(--red); color: #fff; font-weight: 900; }
.top-action { color: #ddd; border-color: #505050; background: transparent; }

.layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: calc(100vh - 68px); }
.sidebar { position: sticky; top: 68px; height: calc(100vh - 68px); padding: 18px 14px; overflow-y: auto; border-right: 1px solid var(--line); background: #f2f0eb; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; padding: 0 4px; }
.sidebar-head strong { font-size: 12px; letter-spacing: .07em; text-transform: uppercase; }
.project-list { display: grid; gap: 6px; }
.project-item { width: 100%; padding: 11px; text-align: left; border: 1px solid transparent; border-radius: 3px; background: transparent; }
.project-item:hover { background: #fff; }
.project-item.active { border-color: #cfcbc3; background: #fff; box-shadow: 0 2px 7px rgba(0,0,0,.04); }
.project-item strong { display: block; font-size: 13px; line-height: 1.25; }
.project-item span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.sidebar-actions { display: grid; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.sidebar-note { margin: 18px 4px 0; color: #898989; font-size: 10px; line-height: 1.4; }

.content { min-width: 0; padding: 24px 22px 48px; }
.empty-projects { min-height: calc(100vh - 140px); display: grid; place-items: center; }
.empty-card { width: min(680px, 100%); padding: 46px; text-align: center; border: 1px solid var(--line); background: #fff; box-shadow: 0 4px 20px rgba(0,0,0,.04); }
.empty-icon { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 50%; color: var(--red); background: #fff0ee; font-size: 26px; }
.empty-card h2 { margin: 0; font-size: 29px; letter-spacing: -.03em; }
.empty-card p { max-width: 510px; margin: 10px auto 22px; color: var(--muted); }
.empty-actions { display: flex; justify-content: center; gap: 9px; flex-wrap: wrap; }

.project-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.eyebrow { margin: 0 0 6px; color: var(--red); font-size: 10px; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.project-head h1 { margin: 0; font-size: clamp(26px, 3vw, 38px); line-height: 1.08; letter-spacing: -.04em; }
.project-meta { margin: 8px 0 0; color: var(--muted); }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.workflow-badge { display: inline-flex; align-items: center; min-height: 39px; padding: 8px 11px; border: 1px solid #c9c4bc; border-radius: 999px; font-size: 11px; font-weight: 900; }
.workflow-draft { color: #8c291f; background: #fff0ee; }
.workflow-saved { color: #614a00; background: #fff6cf; }
.workflow-published { color: #155c3a; background: #e4f5eb; }
.export-group { position: relative; }
.export-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 20; width: 190px; padding: 6px; border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); }
.export-menu button { width: 100%; padding: 9px; text-align: left; border: 0; background: transparent; }
.export-menu button:hover { background: var(--soft); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 9px; margin-bottom: 15px; }
.stat { min-height: 84px; padding: 14px; border: 1px solid var(--line); background: #fff; }
.stat-label { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.stat-value { margin-top: 6px; font-size: 25px; font-weight: 900; letter-spacing: -.03em; }
.stat-note { color: var(--muted); font-size: 10px; }

.panel { border: 1px solid var(--line); background: #fff; }
.matrix-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 14px 12px; border-bottom: 1px solid var(--line); }
.matrix-heading h2 { margin: 0; font-size: 20px; letter-spacing: -.025em; }
.matrix-heading p:last-child { max-width: 440px; margin: 0; color: var(--muted); font-size: 12px; text-align: right; }
.view-tabs { display: flex; align-items: center; gap: 4px; padding: 14px 14px 0; border-bottom: 1px solid var(--line); }
.view-tab { margin-bottom: -1px; padding: 10px 12px; color: var(--muted); border: 1px solid transparent; border-bottom-color: var(--line); background: transparent; font-weight: 800; }
.view-tab.active { color: var(--ink); border-color: var(--line); border-bottom-color: #fff; background: #fff; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 13px 14px; border-bottom: 1px solid var(--line); }
.search-wrap { flex: 1 1 300px; min-width: 220px; }
.control { height: 38px; padding: 0 32px 0 10px; color: var(--ink); border: 1px solid #c8c4bc; border-radius: 3px; background: #fff; }
.search { width: 100%; padding-left: 12px; }
.sort-direction { min-width: 66px; }
.table-wrap { width: 100%; max-height: calc(100vh - 330px); min-height: 390px; overflow: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { padding: 10px; text-align: left; vertical-align: top; border-right: 1px solid #e8e5df; border-bottom: 1px solid #e8e5df; }
th { position: sticky; top: 0; z-index: 8; color: #565656; background: #f3f1ed; font-size: 10px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
tbody tr:hover { filter: brightness(.985); }
.product-group-row td { background: var(--product-color); }
.product-group-row .sticky-col { background: var(--product-color); }
.sticky-col { position: sticky; left: 0; z-index: 5; background: inherit; box-shadow: 1px 0 0 #ddd9d2; }
th.sticky-col { z-index: 10; background: #f3f1ed; }
.product-cell { min-width: 220px; max-width: 270px; }
.story-cell { min-width: 330px; max-width: 450px; line-height: 1.45; }
.product-name { font-weight: 850; line-height: 1.3; }
.cell-note { margin-top: 4px; color: var(--muted); font-size: 10px; }
.empty-text { color: #9a5f00; font-style: italic; }
.tag { display: inline-flex; padding: 4px 7px; border-radius: 999px; background: #eee; font-size: 10px; font-weight: 800; }
.tag-intel { color: #173d7b; background: #e8f0ff; }
.tag-non-intel { color: #693c78; background: #f1e8f7; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.status:before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #888; }
.status-draft:before { background: #3156a4; }
.status-ready:before { background: #a66100; }
.status-approved:before { background: #1b7548; }
.status-needs-input:before { background: var(--red); }
.row-actions { display: flex; gap: 5px; }
.references-cell { min-width: 190px; max-width: 230px; }
.table-reference-thumbs { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.table-reference-thumb, .table-reference-pdf { width: 50px; height: 38px; border: 1px solid rgba(0,0,0,.18); border-radius: 2px; background: #fff; }
.table-reference-thumb { object-fit: cover; cursor: zoom-in; }
.table-reference-pdf { display: grid; place-items: center; color: var(--red); font-size: 9px; font-weight: 900; }
.reference-names { color: #585858; font-size: 9px; line-height: 1.3; overflow-wrap: anywhere; }
.reference-missing { display: grid; place-items: center; width: 50px; height: 38px; color: #806200; border: 1px dashed #b9a45a; background: #fff8d8; font-size: 8px; }

.tracker-shell { background: #fff; }
.tracker-note { display: flex; align-items: center; gap: 8px; padding: 9px 13px; color: #5c4b00; border-bottom: 1px solid #decf78; background: #fff9cf; font-size: 11px; }
.tracker-table { min-width: 1800px; font-family: Calibri, Arial, sans-serif; font-size: 12px; }
.tracker-table th { position: sticky; top: 0; z-index: 7; padding: 6px; color: #000; border-color: #333; background: var(--yellow); text-transform: none; letter-spacing: 0; white-space: normal; }
.tracker-table td { padding: 5px 6px; border-color: #555; }
.tracker-table .sticky-col { min-width: 94px; }
.tracker-table .product-col { min-width: 320px; }
.tracker-table .asset-col { min-width: 260px; }
.tracker-table .date-col { min-width: 95px; text-align: center; }
.tracker-row-tablets { background: var(--peach-row); }
.tracker-row-ideapad { background: var(--green-row); }
.tracker-row-yoga { background: var(--purple-row); }
.tracker-row-loq, .tracker-row-legion { background: var(--blue-row); }
.completion-cell.done { color: #fff; background: var(--green); font-weight: 800; }
.tracker-actions { min-width: 70px; background: #fff; }
.timeline-board { padding: 18px; border-top: 1px solid var(--line); background: #fafafa; }
.timeline-board h3 { margin: 0 0 12px; font-size: 15px; }
.timeline-grid { display: grid; grid-template-columns: repeat(11, minmax(145px, 1fr)); gap: 1px; min-width: 1600px; border: 1px solid #d8d4cd; background: #d8d4cd; }
.timeline-month { min-height: 260px; padding: 8px; background: #fff; }
.timeline-month strong { display: block; padding-bottom: 6px; border-bottom: 2px solid #222; font-size: 12px; }
.timeline-entry { margin-top: 6px; padding: 5px 6px; border-left: 3px solid #777; background: #eee; font: 10px/1.25 Calibri, Arial, sans-serif; }
.timeline-entry.yoga { border-color: #8b4d9a; background: var(--purple-row); }
.timeline-entry.ideapad { border-color: #4e8440; background: var(--green-row); }
.timeline-entry.legion, .timeline-entry.loq { border-color: #3682a0; background: var(--blue-row); }
.timeline-entry.tablets { border-color: #b87858; background: var(--peach-row); }

.empty-table { padding: 58px 24px; text-align: center; color: var(--muted); }
.empty-table strong { display: block; margin-bottom: 5px; color: var(--ink); }
.empty-table > span { display: block; margin-bottom: 16px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; background: rgba(15,15,15,.44); }
.modal { width: min(680px, 96vw); max-height: 92vh; display: flex; flex-direction: column; border: 1px solid #bbb; background: #fff; box-shadow: var(--shadow); }
.modal-wide { width: min(1100px, 97vw); }
.scenario-modal { width: min(940px, 97vw); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 19px 20px 14px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 21px; letter-spacing: -.025em; }
.modal-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.modal-body { padding: 19px 20px 25px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 13px 20px; border-top: 1px solid var(--line); background: #faf9f6; }
.modal-actions { display: flex; gap: 8px; }
.section-title { margin: 20px 0 10px; padding-bottom: 7px; border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.section-title:first-child { margin-top: 0; }
.builder-note, .import-focus-note { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; padding: 11px 12px; border-left: 4px solid var(--red); background: #fff2f0; }
.builder-note strong, .import-focus-note strong { flex: 0 0 auto; font-size: 12px; }
.builder-note span, .import-focus-note span { color: #5e5e5e; font-size: 11px; }
.field-label-row { position: relative; display: flex; align-items: center; gap: 6px; min-height: 19px; }
.field-label-row label { margin-right: auto; }
.help-btn { position: relative; display: inline-grid; place-items: center; width: 18px; height: 18px; padding: 0; color: #666; border: 1px solid #bdb8af; border-radius: 50%; background: #fff; font-size: 10px; font-weight: 900; }
.help-btn:after { position: absolute; right: -8px; bottom: calc(100% + 8px); z-index: 20; visibility: hidden; width: 230px; padding: 8px 9px; color: #fff; border-radius: 3px; background: #222; box-shadow: 0 6px 18px rgba(0,0,0,.2); content: attr(data-tooltip); font-size: 10px; font-weight: 500; line-height: 1.35; opacity: 0; pointer-events: none; transform: translateY(3px); transition: .15s ease; }
.help-btn:hover:after, .help-btn:focus:after { visibility: visible; opacity: 1; transform: translateY(0); }
.suggest-btn { min-height: 24px; padding: 3px 7px; color: #973027; border: 1px solid #efb4af; border-radius: 999px; background: #fff6f5; font-size: 9px; font-weight: 900; }
.suggest-btn:hover { border-color: var(--red); }
.product-context { display: grid; gap: 4px; margin-top: 6px; padding: 10px; border: 1px solid #ded2a4; background: #fffbed; }
.product-context strong { color: #5c4b00; font-size: 11px; }
.product-context span { color: #4f4a39; font-size: 11px; }
.product-context small { color: #7d755f; font-size: 9px; }
.reference-list { display: grid; gap: 7px; margin-top: 9px; }
.reference-empty { padding: 10px; color: var(--muted); border: 1px dashed #c8c4bc; font-size: 11px; }
.reference-item { display: grid; grid-template-columns: 46px minmax(0, 1fr) 32px; align-items: center; gap: 9px; padding: 7px; border: 1px solid var(--line); background: #faf9f6; }
.reference-item img, .reference-pdf { width: 46px; height: 38px; object-fit: cover; border: 1px solid #d0ccc4; background: #fff; }
.reference-item img { cursor: zoom-in; }
.reference-pdf { display: grid; place-items: center; color: var(--red); font-size: 9px; font-weight: 900; }
.reference-item strong, .reference-item span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reference-item strong { font-size: 11px; }
.reference-item span { color: var(--muted); font-size: 9px; }
.reference-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-right: 4px; color: #fff; border-radius: 50%; background: var(--red); font-size: 9px; font-weight: 900; }
.review-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.review-card { padding: 12px; border: 1px solid var(--line); background: var(--soft); }
.review-card strong { display: block; font-size: 22px; }
.review-card span { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.warning-list { margin: 0; padding: 12px 12px 12px 30px; color: #6b4300; border: 1px solid #e5c676; background: #fff7df; }
.review-table { max-height: 230px; overflow: auto; border: 1px solid var(--line); }
.review-table table { min-width: 780px; font-size: 11px; }
.review-check { display: flex; align-items: flex-start; gap: 8px; margin-top: 14px; padding: 11px; border: 1px solid var(--line); background: #faf9f6; }
.review-check input { margin-top: 3px; }
.progress-wrap { padding: 16px; text-align: center; }
.progress-bar { height: 7px; margin-top: 10px; overflow: hidden; border-radius: 999px; background: #e2ded7; }
.progress-bar span { display: block; width: 40%; height: 100%; background: var(--red); animation: loading 1s infinite alternate ease-in-out; }
@keyframes loading { from { transform: translateX(-70%); } to { transform: translateX(210%); } }

.toast { position: fixed; left: 50%; bottom: 22px; z-index: 100; max-width: min(92vw, 520px); padding: 10px 14px; color: #fff; background: #222; box-shadow: var(--shadow); opacity: 0; transform: translate(-50%, 20px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.demo-badge { padding: 5px 8px; color: #4f3700; border-radius: 999px; background: #ffe58b; font-size: 10px; font-weight: 900; letter-spacing: .05em; }
.admin-page { max-width: 1600px; margin: 0 auto; padding: 28px 22px 48px; }
.admin-login { margin: 60px auto; }
.admin-notice { display: flex; gap: 10px; margin-bottom: 14px; padding: 12px 14px; border-left: 4px solid #a47a00; background: #fff6cf; }
.admin-notice span { color: #5f5638; }
.admin-notice-green { border-left-color: #2f8154; background: #e9f6ee; }
.admin-notice-green span { color: #315b43; }
.admin-table-wrap { max-height: calc(100vh - 300px); }
.admin-section-tabs { display: flex; gap: 5px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.admin-section-tab { margin-bottom: -1px; padding: 11px 15px; color: var(--muted); border: 1px solid transparent; border-bottom-color: var(--line); background: transparent; font-weight: 850; }
.admin-section-tab.active { color: var(--ink); border-color: var(--line); border-bottom-color: var(--paper); background: var(--paper); }
.user-admin-grid { display: grid; grid-template-columns: minmax(300px, 390px) minmax(0, 1fr); gap: 14px; align-items: start; }
.user-create-form { padding: 18px; }
.password-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.password-row .btn { min-height: 42px; }
.credential-card { display: grid; gap: 5px; margin: 0 18px 18px; padding: 14px; border: 1px solid #9bc7ab; background: #eef8f1; }
.credential-card > strong { margin-bottom: 4px; color: #155c3a; }
.credential-card > span { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.credential-card code { padding: 7px 8px; overflow-wrap: anywhere; border: 1px solid #c6dccc; background: #fff; font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
.credential-card small { margin-top: 5px; color: #476453; }
.user-list-panel { min-width: 0; }
.user-table-wrap { min-height: 420px; max-height: calc(100vh - 350px); }
.user-table { min-width: 860px; }
.user-table td { vertical-align: middle; }
.user-table .row-actions { flex-wrap: wrap; min-width: 200px; }
.account-badge, .account-status { display: inline-flex; align-items: center; min-height: 24px; padding: 4px 8px; border-radius: 999px; font-size: 10px; font-weight: 850; }
.account-admin { color: #7a271f; background: #fff0ee; }
.account-client { color: #294f78; background: #e9f2fb; }
.account-active { color: #155c3a; background: #e4f5eb; }
.account-inactive { color: #666; background: #eceae6; }
.user-reset-modal { width: min(560px, 96vw); }
.reset-status { color: #155c3a; font-size: 11px; font-weight: 800; }

.lightbox-open { overflow: hidden; }
.reference-lightbox { position: fixed; inset: 0; z-index: 500; display: grid; grid-template-columns: 70px minmax(0, 1fr) 70px; grid-template-rows: auto minmax(0, 1fr) auto; gap: 10px; padding: 16px; color: #fff; background: rgba(8, 8, 8, .94); }
.reference-lightbox[hidden] { display: none; }
.reference-lightbox-bar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-width: 0; }
.reference-lightbox-bar strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reference-lightbox-tools { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.reference-lightbox-tools button, .reference-lightbox-nav { min-width: 36px; min-height: 36px; color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 3px; background: rgba(255,255,255,.1); font: inherit; cursor: pointer; }
.reference-lightbox-tools button:hover, .reference-lightbox-nav:hover { background: rgba(255,255,255,.2); }
.reference-lightbox-tools span { min-width: 48px; font-size: 11px; text-align: center; }
.reference-lightbox-stage { grid-column: 2; grid-row: 2; display: grid; place-items: center; overflow: auto; min-width: 0; min-height: 0; }
.reference-lightbox-stage img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; transform-origin: center; transition: transform .16s ease; }
.reference-lightbox-nav { align-self: center; border: 0; background: transparent; font-size: 48px; }
.reference-lightbox-prev { grid-column: 1; grid-row: 2; }
.reference-lightbox-next { grid-column: 3; grid-row: 2; }
.reference-lightbox-count { grid-column: 1 / -1; grid-row: 3; color: #d7d7d7; font-size: 11px; text-align: center; }

@media (max-width: 980px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .project-list { display: flex; overflow-x: auto; }
  .project-item { min-width: 220px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-head { flex-direction: column; }
  .head-actions { justify-content: flex-start; }
  .matrix-heading { align-items: flex-start; flex-direction: column; }
  .matrix-heading p:last-child { text-align: left; }
  .user-admin-grid { grid-template-columns: 1fr; }
  .user-table-wrap { max-height: 560px; }
}

@media (max-width: 620px) {
  .content { padding: 18px 12px 34px; }
  .topbar { padding: 9px 12px; }
  .brand-title span, .user-chip span { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .stats { grid-template-columns: 1fr 1fr; }
  .review-summary { grid-template-columns: 1fr; }
  .reference-lightbox { grid-template-columns: 42px minmax(0, 1fr) 42px; padding: 10px; }
  .reference-lightbox-bar { align-items: flex-start; flex-direction: column; }
  .reference-lightbox-tools { width: 100%; }
  .reference-lightbox-tools button:last-child { margin-left: auto; }
  .admin-page { padding: 18px 12px 34px; }
  .admin-section-tabs { overflow-x: auto; }
  .admin-section-tab { white-space: nowrap; }
  .password-row { grid-template-columns: 1fr; }
}
