/* CMF Bonaberi — Client Review, Correction, Feedback & Approval System */

/* .review-gate/.review-panel/.review-modal each set their own `display`
   (grid/flex) to lay themselves out when open. Without this, that author
   rule ties with the UA's `[hidden]{display:none}` on specificity and wins
   by source order, so the `hidden` attribute stops actually hiding them. */
[hidden]{display:none!important}

.review-status-pending{color:var(--muted)}
.review-status-approved{color:#1a9c5e}
.review-status-changes{color:var(--red)}

/* ---------- Access gate ---------- */
.review-gate{position:fixed;inset:0;z-index:200;display:grid;place-items:center;background:rgba(2,13,34,.72);backdrop-filter:blur(6px);padding:20px}
.review-gate-card{width:100%;max-width:440px;background:#fff;border-radius:24px;padding:clamp(22px,5vw,34px);box-shadow:0 40px 100px rgba(2,13,34,.4);text-align:center;max-height:90vh;max-height:calc(100dvh - 2rem);overflow:auto}
.review-gate-card img{width:64px;height:64px;border-radius:50%;object-fit:cover;margin:0 auto 12px}
.review-gate-card h2{font-size:28px;margin-bottom:10px}
.review-gate-lead{font-size:15px;color:var(--muted);line-height:1.5;margin-bottom:22px}
.review-gate-card form{display:flex;flex-direction:column;gap:14px;text-align:left}
.review-gate-card label{font-size:13px;font-weight:800;color:var(--navy);display:flex;flex-direction:column;gap:6px}
.review-gate-card label span{font-weight:600;color:var(--muted);font-size:12px}
.review-gate-card input{border:1px solid var(--line);border-radius:12px;padding:11px 13px;font-size:15px;font-family:inherit}
.review-gate-card input:focus{outline:2px solid var(--blue);outline-offset:1px}
.review-error{background:#fdecec;color:var(--red);border:1px solid #f6c9c9;border-radius:10px;padding:9px 12px;font-size:13px;font-weight:700}
.review-gate-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:4px}
.review-gate-actions button{border-radius:10px;padding:11px 18px;font-weight:800;cursor:pointer;border:1px solid var(--line);background:#fff;color:var(--navy)}
.review-gate-actions button[type="submit"]{background:var(--blue);border-color:var(--blue);color:#fff}
.review-gate-actions button[type="submit"]:hover{background:#0043a1}

/* ---------- Slide-in review panel ---------- */
.deck{transition:margin-right .25s ease}
.controls{transition:right .25s ease}
body.review-mode .deck{margin-right:380px}
body.review-mode .controls{right:380px}

.review-panel{position:fixed;top:0;right:0;bottom:0;width:380px;z-index:120;background:#fff;border-left:1px solid var(--line);box-shadow:-16px 0 40px rgba(7,27,63,.14);display:flex;transform:translateX(0);transition:transform .25s ease}
.review-panel.collapsed{transform:translateX(100%)}
.review-panel-inner{flex:1;display:flex;flex-direction:column;padding:20px;gap:14px;overflow:auto}
.review-expand-tab{position:absolute;top:24px;right:380px;z-index:119;background:var(--blue);color:#fff;border:0;border-radius:10px 0 0 10px;padding:12px 10px;font-weight:800;cursor:pointer;writing-mode:horizontal-tb}
.review-panel-header{display:flex;justify-content:space-between;align-items:flex-start;gap:10px;border-bottom:1px solid var(--line);padding-bottom:12px}
.review-panel-eyebrow{display:block;text-transform:uppercase;letter-spacing:.08em;font-size:11px;font-weight:800;color:var(--blue)}
.review-panel-header h4{margin:4px 0 0;font-size:18px;line-height:1.25}
.review-icon-btn{border:1px solid var(--line);background:#fff;border-radius:8px;width:30px;height:30px;cursor:pointer;font-size:16px;color:var(--navy)}

.review-status-group{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.review-status-group button{border:1px solid var(--line);background:#fff;border-radius:10px;padding:9px 6px;font-size:12px;font-weight:800;color:var(--navy);cursor:pointer}
.review-status-group button[data-status="approved"].active{background:#1a9c5e;border-color:#1a9c5e;color:#fff}
.review-status-group button[data-status="changes"].active{background:var(--red);border-color:var(--red);color:#fff}
.review-status-group button[data-status="pending"].active{background:var(--muted);border-color:var(--muted);color:#fff}

.review-comment-form{display:flex;flex-direction:column;gap:8px}
.review-comment-form textarea{border:1px solid var(--line);border-radius:12px;padding:10px 12px;font-family:inherit;font-size:14px;min-height:74px;resize:vertical}
.review-comment-form button{align-self:flex-end;border:0;background:var(--blue);color:#fff;font-weight:800;border-radius:10px;padding:9px 16px;cursor:pointer}
.review-comment-form button:hover{background:#0043a1}

.review-comment-list{display:flex;flex-direction:column;gap:10px;max-height:280px;overflow:auto}
.review-comment-list.wide{max-height:340px}
.review-empty{color:var(--muted);font-size:13px;font-style:italic}
.review-comment-item{background:#f7fbff;border:1px solid var(--line);border-radius:12px;padding:10px 12px;position:relative}
.review-comment-meta{display:flex;flex-wrap:wrap;justify-content:space-between;gap:4px 8px;font-size:11px;color:var(--muted);margin-bottom:4px}
.review-comment-author{font-weight:800;color:var(--navy);overflow-wrap:anywhere}
.review-comment-text{font-size:13.5px;line-height:1.45;margin:0;white-space:pre-wrap;overflow-wrap:anywhere}
.review-comment-delete{position:absolute;top:8px;right:10px;border:0;background:transparent;color:var(--red);font-size:11px;font-weight:800;cursor:pointer}
.review-comment-slide-tag{display:inline-block;font-size:11px;font-weight:800;color:var(--blue);text-transform:uppercase;letter-spacing:.03em;margin-bottom:6px}

.review-progress-strip{display:flex;flex-wrap:wrap;gap:6px;padding-top:6px;border-top:1px solid var(--line)}
.review-dot{width:14px;height:14px;border-radius:50%;border:2px solid var(--line);background:#fff;padding:0;cursor:pointer}
.review-dot.status-approved{background:#1a9c5e;border-color:#1a9c5e}
.review-dot.status-changes{background:var(--red);border-color:var(--red)}
.review-dot.status-pending{background:#fff}
.review-dot.current{outline:2px solid var(--blue);outline-offset:2px}

.review-panel-footer{margin-top:auto;display:flex;gap:8px;padding-top:12px;border-top:1px solid var(--line)}
.review-panel-footer button{flex:1;border-radius:10px;padding:10px;font-weight:800;cursor:pointer;border:1px solid var(--line);background:#fff;color:var(--navy)}
#rvOpenDashboard{background:var(--navy);border-color:var(--navy);color:#fff}
#rvOpenDashboard:hover{background:#000c22}
#rvLock:hover{background:#fdecec;border-color:#f6c9c9;color:var(--red)}

/* ---------- Dashboard modal ---------- */
.review-modal{position:fixed;inset:0;z-index:150;display:grid;place-items:center;padding:24px}
.review-modal-backdrop{position:absolute;inset:0;background:rgba(2,13,34,.6);backdrop-filter:blur(4px)}
.review-modal-dialog{position:relative;background:#fff;border-radius:24px;width:100%;max-width:920px;max-height:88vh;max-height:calc(100dvh - 2rem);display:flex;flex-direction:column;box-shadow:0 50px 120px rgba(2,13,34,.45)}
.review-modal-dialog header{display:flex;justify-content:space-between;align-items:center;padding:22px 26px;border-bottom:1px solid var(--line)}
.review-modal-dialog header h2{font-size:22px;margin:0}
.review-modal-dialog header button{border:0;background:transparent;font-size:24px;cursor:pointer;color:var(--muted);line-height:1}
.review-modal-body{padding:22px 26px;overflow:auto;display:flex;flex-direction:column;gap:26px}
.review-section h3{font-size:16px;margin-bottom:12px;color:var(--navy)}

.review-stats{display:grid;grid-template-columns:repeat(5,1fr);gap:12px}
.review-stat-card{background:#f7fbff;border:1px solid var(--line);border-radius:16px;padding:14px;text-align:center}
.review-stat-card strong{display:block;font-size:26px;color:var(--navy)}
.review-stat-card span{font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.04em;color:var(--muted)}
.review-stat-card.stat-approved strong{color:#1a9c5e}
.review-stat-card.stat-changes strong{color:var(--red)}
.review-stat-card.stat-pending strong{color:var(--muted)}

.review-slide-table{display:flex;flex-direction:column;gap:6px}
.review-slide-row{display:grid;grid-template-columns:32px 1fr 130px 100px 70px;align-items:center;gap:10px;padding:9px 10px;border:1px solid var(--line);border-radius:10px;font-size:13px}
.review-slide-row-num{color:var(--muted);font-weight:800}
.review-slide-row-title{font-weight:700;color:var(--navy)}
.review-slide-row-count{color:var(--muted);font-size:12px}
.review-slide-row-view{border:1px solid var(--line);background:#fff;border-radius:8px;padding:6px 10px;font-weight:800;cursor:pointer;font-size:12px}
.review-badge{display:inline-block;padding:4px 10px;border-radius:999px;font-size:11px;font-weight:800;text-align:center}
.review-badge.status-approved{background:#e5f7ee;color:#1a9c5e}
.review-badge.status-changes{background:#fdecec;color:var(--red)}
.review-badge.status-pending{background:#eef2f7;color:var(--muted)}

.review-approval-banner{border-radius:14px;padding:14px 16px;margin-bottom:14px;display:flex;flex-direction:column;gap:4px;background:#e5f7ee;border:1px solid #bfe8d3}
.review-approval-banner strong{color:#127a49}
.review-approval-banner.decision-revisions_required{background:#fdecec;border-color:#f6c9c9}
.review-approval-banner.decision-revisions_required strong{color:var(--red)}
.review-approval-banner.decision-approved_with_corrections{background:#fff6e0;border-color:#f3dfa4}
.review-approval-banner.decision-approved_with_corrections strong{color:#9a6b00}
.review-approval-banner span{font-size:12.5px;color:var(--ink)}

#rvApprovalForm{display:flex;flex-direction:column;gap:12px}
.review-decision-group{display:flex;flex-direction:column;gap:10px;background:#f7fbff;border:1px solid var(--line);border-radius:14px;padding:14px 16px}
.review-decision-group label{display:flex;align-items:center;gap:10px;font-weight:700;font-size:14px;color:var(--navy)}
#rvApprovalComments{border:1px solid var(--line);border-radius:12px;padding:10px 12px;min-height:70px;font-family:inherit;font-size:14px;resize:vertical}
.review-approver-line{font-size:13px;color:var(--muted);margin:0}
#rvApprovalForm button[type="submit"]{align-self:flex-start;border:0;background:var(--navy);color:#fff;font-weight:800;border-radius:10px;padding:11px 20px;cursor:pointer}
#rvApprovalForm button[type="submit"]:hover{background:#000c22}

.review-export-actions{display:flex;gap:10px}
.review-export-actions button{border:1px solid var(--line);background:#fff;color:var(--navy);font-weight:800;border-radius:10px;padding:10px 16px;cursor:pointer}
.review-export-actions button:hover{background:var(--blue);border-color:var(--blue);color:#fff}

@media(max-width:1100px){
  body.review-mode .deck{margin-right:0}
  body.review-mode .controls{right:0}
  .review-panel{width:100%;top:auto;height:78vh;height:78dvh;left:0;right:0;border-left:0;border-top:1px solid var(--line);border-radius:20px 20px 0 0;transform:translateY(0)}
  .review-panel.collapsed{transform:translateY(100%)}
  .review-expand-tab{position:fixed;right:16px;bottom:16px;top:auto;border-radius:999px;min-width:44px;min-height:44px}
  .review-icon-btn{width:38px;height:38px}
  .review-stats{grid-template-columns:repeat(2,1fr)}
  .review-slide-row{
    grid-template-columns:auto 1fr auto;
    grid-template-areas:"num title view" "badge count count";
    row-gap:6px;
  }
  .review-slide-row-num{grid-area:num}
  .review-slide-row-title{grid-area:title}
  .review-badge{grid-area:badge;justify-self:start}
  .review-slide-row-count{grid-area:count;justify-self:end}
  .review-slide-row-view{grid-area:view;min-height:36px}
  .review-status-group button,.review-gate-actions button,.review-comment-form button,.review-panel-footer button,.review-export-actions button{min-height:44px}
}

@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}
}

@media(max-width:480px){
  .review-stats{grid-template-columns:1fr 1fr}
  .review-status-group{grid-template-columns:1fr}
}

.cover-review-btn{margin-top:26px;padding:13px 28px;border-radius:999px;border:1px solid rgba(255,255,255,.55);background:rgba(255,255,255,.16);color:#fff;font-weight:800;font-size:15px;letter-spacing:.02em;cursor:pointer;transition:background .2s ease,color .2s ease,transform .2s ease}
.cover-review-btn:hover{background:#fff;color:var(--navy);transform:translateY(-1px)}
body.review-mode .cover-review-btn{display:none}

@media print{
  .review-gate,.review-panel,.review-modal,.review-expand-tab,#reviewModeBtn,#reviewDashboardBtn,.cover-review-btn{display:none!important}
}
