:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --text: #151515;
  --muted: #6b7280;
  --line: #e5e7eb;
  --dark: #111111;
  --accent: #d9ff43;
  --accent-dark: #b7d92f;
  --success: #168255;
  --warning: #b56b00;
  --danger: #c44141;
  --info: #3269c8;
  --shadow: 0 18px 45px rgba(17, 24, 39, .08);
  --radius: 18px;
}
* { box-sizing: border-box; }
html { font-family: Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 1.05fr) minmax(420px, .95fr); background: var(--dark); }
.auth-brand { padding: 54px 64px; color: #fff; display: flex; flex-direction: column; justify-content: space-between; background: radial-gradient(circle at 10% 15%, rgba(217,255,67,.18), transparent 34%), linear-gradient(145deg,#0b0b0b,#1b1b1b); }
.brand-chip { display: inline-flex; width: fit-content; padding: 10px 14px; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; font-size: 12px; letter-spacing: .12em; }
.brand-copy { max-width: 650px; }
.brand-copy h1 { font-size: clamp(42px,5.3vw,78px); line-height: .98; margin: 18px 0 22px; letter-spacing: -.045em; }
.brand-copy p { color: rgba(255,255,255,.72); font-size: 18px; line-height: 1.6; max-width: 570px; }
.brand-footer { display: flex; gap: 22px; color: rgba(255,255,255,.55); font-size: 13px; text-transform: uppercase; letter-spacing: .1em; }
.auth-panel { background: #fff; display: grid; place-items: center; padding: 40px; position: relative; }
.auth-card { width: min(440px,100%); }
.mobile-brand { display: none; font-size: 22px; margin-bottom: 30px; }
.auth-card h2 { margin: 8px 0 10px; font-size: 32px; letter-spacing: -.03em; }
.auth-card form { display: grid; gap: 12px; margin-top: 26px; }
.legal { position: absolute; bottom: 24px; color: var(--muted); font-size: 12px; }

.section-label, .eyebrow { color: #78850c; font-weight: 700; font-size: 11px; letter-spacing: .13em; text-transform: uppercase; }
.muted { color: var(--muted); line-height: 1.55; }
label { display: grid; gap: 7px; font-size: 13px; font-weight: 600; color: #34373c; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 11px; background: #fff; padding: 12px 13px; color: var(--text); outline: none; transition: .18s border,.18s box-shadow; }
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: #a9c51f; box-shadow: 0 0 0 4px rgba(217,255,67,.22); }
.password-field { position: relative; }
.password-field input { padding-right: 70px; }
.show-password { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; font-size: 12px; font-weight: 700; }
.primary-button, .secondary-button { border: 1px solid transparent; border-radius: 11px; padding: 13px 18px; font-weight: 700; transition: .18s; }
.primary-button { background: var(--accent); color: #111; }
.primary-button:hover { background: #c9ee39; transform: translateY(-1px); }
.secondary-button { background: #fff; border-color: var(--line); color: var(--text); }
.secondary-button:hover { border-color: #c4c8ce; background: #fafafa; }
.compact { padding: 10px 14px; width: auto; }
.text-button { border: 0; background: transparent; color: #5e690b; font-weight: 700; padding: 4px; }
.standalone { margin: 16px auto 0; display: block; }
.config-warning, .load-failure { background: #fff4e5; border: 1px solid #f1cf98; color: #7b4d00; border-radius: 12px; padding: 13px; margin: 18px 0; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 264px 1fr; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 264px; background: #111; color: #fff; padding: 22px 16px; display: flex; flex-direction: column; z-index: 30; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; border-bottom: 1px solid rgba(255,255,255,.1); }
.m2-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 11px; background: var(--accent); color: #111; font-weight: 900; }
.sidebar-brand div { display: grid; gap: 2px; }
.sidebar-brand strong { letter-spacing: .08em; }
.sidebar-brand small { color: rgba(255,255,255,.52); }
.main-nav { display: grid; gap: 5px; padding-top: 18px; overflow-y: auto; }
.nav-item { width: 100%; border: 0; background: transparent; color: rgba(255,255,255,.7); text-align: left; padding: 11px 12px; border-radius: 10px; display: flex; align-items: center; gap: 10px; font-weight: 500; }
.nav-item span { color: rgba(255,255,255,.34); font-size: 11px; width: 20px; }
.nav-item b { margin-left: auto; min-width: 22px; height: 22px; border-radius: 999px; background: rgba(255,255,255,.12); display: grid; place-items: center; font-size: 11px; }
.nav-item:hover, .nav-item.active { color: #111; background: var(--accent); }
.nav-item.active span, .nav-item:hover span { color: rgba(17,17,17,.55); }
.sidebar-bottom { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.1); }
.logout-button { width: 100%; margin-top: 6px; border: 1px solid rgba(255,255,255,.14); background: transparent; color: rgba(255,255,255,.7); padding: 10px; border-radius: 10px; }
.workspace { grid-column: 2; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; height: 78px; background: rgba(255,255,255,.93); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 22px; padding: 0 28px; }
.menu-button { display: none; border: 0; background: transparent; font-size: 24px; }
.topbar-title { display: grid; min-width: 180px; }
.breadcrumb { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.topbar-title strong { font-size: 18px; margin-top: 2px; }
.project-switcher { margin-left: auto; display: grid; grid-template-columns: auto 250px; align-items: center; gap: 10px; font-size: 11px; color: var(--muted); }
.project-switcher select { padding: 9px 10px; min-width: 250px; }
.user-menu { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.user-menu div:last-child { display: grid; gap: 2px; }
.user-menu span { color: var(--muted); font-size: 12px; }
.user-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: #111; color: var(--accent); font-weight: 800; }
.content-area { padding: 28px; max-width: 1700px; margin: 0 auto; }
.page-section { display: none; }
.page-section.active { display: block; }
.page-heading { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 24px; }
.page-heading h1 { margin: 5px 0 6px; font-size: 34px; letter-spacing: -.035em; }
.page-heading p { margin: 0; color: var(--muted); }

.metrics-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.metrics-grid.six { grid-template-columns: repeat(6,minmax(0,1fr)); }
.metric-card, .panel-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 30px rgba(17,24,39,.035); }
.metric-card { padding: 18px; display: grid; gap: 6px; }
.metric-card span { color: var(--muted); font-size: 12px; }
.metric-card strong { font-size: 27px; letter-spacing: -.03em; }
.metric-card small { color: #8a919b; }
.dashboard-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.panel-card { padding: 20px; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 15px; }
.panel-header h2 { margin: 3px 0 0; font-size: 19px; }
.project-list, .activity-list { display: grid; gap: 10px; }
.project-row, .activity-item { border: 1px solid var(--line); border-radius: 13px; padding: 13px; display: flex; gap: 12px; align-items: center; background: #fff; }
.project-row:hover { border-color: #cfd3d8; }
.project-row .client-logo, .client-initial { width: 42px; height: 42px; border-radius: 12px; background: #111; color: var(--accent); display: grid; place-items: center; font-weight: 800; flex: 0 0 auto; overflow: hidden; }
.client-logo img { width: 100%; height: 100%; object-fit: cover; }
.project-row-main { min-width: 0; flex: 1; display: grid; gap: 3px; }
.project-row-main strong, .project-row-main span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-row-main span { color: var(--muted); font-size: 12px; }
.progress-bar { height: 7px; border-radius: 999px; background: #eceef1; overflow: hidden; min-width: 90px; }
.progress-bar i { display: block; height: 100%; background: var(--accent-dark); border-radius: inherit; }
.activity-item { align-items: flex-start; }
.activity-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent-dark); margin-top: 5px; flex: 0 0 auto; }
.activity-item div { display: grid; gap: 3px; }
.activity-item small { color: var(--muted); }
.activity-table { display: grid; }
.activity-table .table-row { grid-template-columns: 110px 1fr 1fr 130px; }

.toolbar { display: flex; gap: 10px; margin-bottom: 16px; }
.toolbar input { max-width: 380px; }
.toolbar select { width: 190px; }
.cards-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 15px; }
.client-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 19px; box-shadow: 0 8px 30px rgba(17,24,39,.035); display: grid; gap: 15px; }
.client-card-header { display: flex; gap: 12px; align-items: center; }
.client-card-header .client-initial { background: var(--client-color,#111); color: #111; }
.client-card h3 { margin: 0; font-size: 18px; }
.client-card p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.client-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.client-meta div { background: var(--surface-2); border-radius: 10px; padding: 10px; display: grid; gap: 3px; }
.client-meta span { color: var(--muted); font-size: 11px; }
.client-meta strong { font-size: 13px; }
.card-actions { display: flex; gap: 8px; justify-content: flex-end; }
.icon-button { border: 1px solid var(--line); border-radius: 9px; background: #fff; padding: 8px 10px; color: #333; }
.icon-button.danger { color: var(--danger); }

.data-table { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table-row { display: grid; grid-template-columns: 1.4fr 1fr .8fr .8fr .8fr 110px; gap: 12px; align-items: center; padding: 13px 16px; border-top: 1px solid var(--line); font-size: 13px; }
.table-row:first-child { border-top: 0; }
.table-row.header { background: var(--surface-2); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.table-row strong { display: block; }
.table-row small { color: var(--muted); }
.table-actions { display: flex; gap: 5px; justify-content: flex-end; }
.compact-table .table-row { grid-template-columns: 1.5fr .8fr .7fr .7fr 90px; }
.badge { display: inline-flex; width: fit-content; align-items: center; padding: 5px 8px; border-radius: 999px; background: #eef0f3; color: #555; font-size: 11px; font-weight: 700; }
.badge.success { background: #e4f6ed; color: var(--success); }
.badge.warning { background: #fff1dc; color: var(--warning); }
.badge.danger { background: #fde8e8; color: var(--danger); }
.badge.info { background: #e8effc; color: var(--info); }
.badge.dark { background: #222; color: var(--accent); }

.summary-strip { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.summary-pill { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 13px; display: flex; gap: 8px; align-items: center; }
.summary-pill strong { font-size: 15px; }
.summary-pill span { color: var(--muted); font-size: 12px; }
.responses-board { display: grid; gap: 12px; }
.stage-review { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stage-review-header { padding: 17px 19px; display: flex; align-items: center; gap: 14px; cursor: pointer; }
.stage-number { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: #111; color: var(--accent); font-weight: 800; }
.stage-review-title { flex: 1; }
.stage-review-title h3 { margin: 0 0 4px; font-size: 17px; }
.stage-review-title p { margin: 0; color: var(--muted); font-size: 12px; }
.stage-review-body { border-top: 1px solid var(--line); display: none; }
.stage-review.open .stage-review-body { display: block; }
.answer-row { display: grid; grid-template-columns: minmax(220px,.8fr) minmax(280px,1.4fr) 145px 120px; gap: 14px; padding: 15px 19px; border-top: 1px solid var(--line); align-items: start; }
.answer-row:first-child { border-top: 0; }
.answer-question { display: grid; gap: 5px; }
.answer-question strong { font-size: 13px; }
.answer-question small { color: var(--muted); }
.answer-value { white-space: pre-wrap; word-break: break-word; background: var(--surface-2); border-radius: 10px; padding: 10px; min-height: 39px; font-size: 13px; line-height: 1.45; }
.answer-value.empty { color: #999; font-style: italic; }
.json-table { display: grid; gap: 8px; }
.json-row { border: 1px solid var(--line); border-radius: 9px; padding: 9px; display: grid; gap: 4px; background: #fff; }
.json-row div { display: grid; grid-template-columns: 140px 1fr; gap: 8px; }
.json-row span { color: var(--muted); font-size: 11px; }

.kanban-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 15px; }
.kanban-column { background: #eef0f3; border-radius: var(--radius); padding: 13px; min-height: 280px; }
.kanban-column-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.kanban-column-header h3 { margin: 0; font-size: 15px; }
.task-card { background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 13px; display: grid; gap: 8px; margin-bottom: 9px; }
.task-card h4 { margin: 0; font-size: 14px; }
.task-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.task-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.messages-layout { display: grid; grid-template-columns: 360px minmax(0,1fr); gap: 15px; min-height: 600px; }
.message-list, .message-thread { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.message-list { padding: 10px; display: grid; align-content: start; gap: 6px; }
.message-item { border: 0; background: transparent; border-radius: 11px; padding: 12px; display: grid; gap: 5px; text-align: left; }
.message-item:hover, .message-item.active { background: #f0f2f4; }
.message-item-head { display: flex; justify-content: space-between; gap: 8px; }
.message-item small { color: var(--muted); }
.message-thread { display: grid; grid-template-rows: 1fr auto; }
.thread-content { padding: 24px; overflow: auto; }
.thread-card { max-width: 820px; display: grid; gap: 12px; }
.thread-card p { font-size: 15px; line-height: 1.65; white-space: pre-wrap; }
.message-form { border-top: 1px solid var(--line); padding: 14px; }
.message-form textarea { min-height: 90px; }
.form-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; }
.checkbox-line { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 8px; font-weight: 500; }
.checkbox-line input { width: 17px; height: 17px; }

.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; }
.filter-chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 11px; font-size: 12px; }
.filter-chip.active { background: #111; color: var(--accent); border-color: #111; }
.analysis-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.analysis-card { background: #fff; border: 1px solid var(--line); border-top: 4px solid #777; border-radius: 14px; padding: 16px; display: grid; gap: 10px; }
.analysis-card.strength { border-top-color: var(--success); }
.analysis-card.weakness { border-top-color: var(--warning); }
.analysis-card.risk { border-top-color: var(--danger); }
.analysis-card.recommendation { border-top-color: var(--info); }
.analysis-card.opportunity { border-top-color: #7556c8; }
.analysis-card.internal_note { border-top-color: #555; }
.analysis-card h3 { margin: 0; font-size: 16px; }
.analysis-card p { margin: 0; color: #454b54; line-height: 1.5; white-space: pre-wrap; }
.analysis-card-footer { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 11px; }

.split-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 15px; }
.report-preview { margin-bottom: 16px; }
.report-paper { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 42px; box-shadow: var(--shadow); }
.report-cover { border-bottom: 4px solid var(--accent); padding-bottom: 25px; margin-bottom: 25px; }
.report-cover h2 { font-size: 34px; margin: 8px 0; }
.report-section { margin-top: 25px; }
.report-section h3 { font-size: 19px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.report-list { display: grid; gap: 8px; }
.report-item { border-left: 3px solid var(--accent-dark); padding: 8px 12px; background: var(--surface-2); }
.report-actions { display: flex; gap: 8px; margin-top: 20px; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-card { display: grid; gap: 12px; align-content: start; }
.form-card h2 { margin: 0 0 8px; }
.empty-state { color: var(--muted); text-align: center; padding: 35px; }

.modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 18px; }
.modal.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.56); backdrop-filter: blur(3px); }
.modal-dialog { position: relative; width: min(760px,100%); max-height: calc(100vh - 36px); overflow: auto; background: #fff; border-radius: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.modal-dialog.small { width: min(520px,100%); }
.modal-dialog header { position: sticky; top: 0; z-index: 2; background: #fff; padding: 20px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: flex-start; }
.modal-dialog header h2 { margin: 4px 0 0; }
.modal-dialog header > button { border: 0; background: transparent; font-size: 28px; line-height: 1; }
.modal-dialog form { padding: 20px 22px; display: grid; gap: 13px; }
.modal-dialog footer { display: flex; justify-content: flex-end; gap: 8px; padding-top: 8px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid .full { grid-column: 1 / -1; }
.review-question { background: var(--surface-2); border-radius: 12px; padding: 13px; color: #40454d; line-height: 1.45; }

.loading-overlay { position: fixed; inset: 0; z-index: 300; background: rgba(255,255,255,.78); backdrop-filter: blur(4px); display: grid; place-items: center; align-content: center; gap: 12px; }
.loader { width: 40px; height: 40px; border: 4px solid #e7e8eb; border-top-color: #111; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; z-index: 400; right: 22px; bottom: 22px; max-width: 390px; background: #151515; color: #fff; padding: 13px 16px; border-radius: 12px; box-shadow: var(--shadow); transform: translateY(20px); opacity: 0; pointer-events: none; transition: .22s; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: #8d2626; }
.toast.success { background: #145c3e; }
.load-failure { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; }
.load-failure span { flex: 1; }

@media (max-width: 1300px) {
  .metrics-grid.six { grid-template-columns: repeat(3,1fr); }
  .cards-grid, .analysis-grid { grid-template-columns: repeat(2,1fr); }
  .answer-row { grid-template-columns: minmax(180px,.8fr) minmax(240px,1.3fr) 130px 90px; }
}
@media (max-width: 1000px) {
  .app-shell { display: block; }
  .sidebar { transform: translateX(-100%); transition: .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .workspace { margin-left: 0; }
  .menu-button { display: block; }
  .project-switcher span { display: none; }
  .project-switcher { grid-template-columns: 1fr; }
  .user-menu div:last-child { display: none; }
  .dashboard-grid, .split-grid, .messages-layout, .profile-grid { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: span 1; }
  .kanban-grid { grid-template-columns: 1fr; }
  .answer-row { grid-template-columns: 1fr; }
  .table-row { min-width: 900px; }
  .data-table { overflow-x: auto; }
}
@media (max-width: 760px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-panel { min-height: 100vh; padding: 28px 20px 70px; }
  .mobile-brand { display: block; }
  .topbar { height: auto; min-height: 72px; padding: 12px 15px; gap: 12px; flex-wrap: wrap; }
  .topbar-title { min-width: 120px; }
  .project-switcher { order: 3; width: 100%; margin-left: 0; }
  .project-switcher select { width: 100%; min-width: 0; }
  .content-area { padding: 20px 14px; }
  .page-heading { display: grid; }
  .page-heading h1 { font-size: 28px; }
  .metrics-grid, .metrics-grid.six, .cards-grid, .analysis-grid { grid-template-columns: 1fr; }
  .toolbar { display: grid; }
  .toolbar input, .toolbar select { max-width: none; width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .report-paper { padding: 24px 18px; }
  .user-menu { min-width: auto; }
}
@media print {
  body * { visibility: hidden; }
  #reportPreview, #reportPreview * { visibility: visible; }
  #reportPreview { position: absolute; inset: 0; }
  .report-actions { display: none !important; }
  .report-paper { border: 0; box-shadow: none; }
}

.field-help{display:block;margin-top:7px;color:#73777f;font-size:12px;line-height:1.45;font-weight:400}
