:root {
  --ink: #17132f;
  --muted: #667085;
  --line: #e7e3f0;
  --panel: #ffffff;
  --soft: #faf7ff;
  --violet: #6d28d9;
  --violet-dark: #3b0764;
  --amber: #d97706;
  --green: #047857;
  --danger: #dc2626;
  --shadow: 0 18px 48px rgba(48, 30, 84, .12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #f6f2fb;
}

button, input, textarea { font: inherit; }
select {
  font: inherit;
  height: 28px;
  border: 1px solid var(--line);
  background: white;
  padding: 0 6px;
  font-weight: 800;
  color: var(--ink);
}

.app-shell {
  min-height: 100vh;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.topbar {
  flex-shrink: 0;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 14px;
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(109,40,217,.12);
  box-shadow: var(--shadow);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--violet), var(--violet-dark));
  color: white;
  font-weight: 900;
  font-size: 18px;
}
.brand h1 { margin: 0; font-size: 16px; line-height: 1; font-weight: 900; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 10.5px; font-weight: 700; }

.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.workspace {
  height: calc(100vh - 100px);
  min-height: 760px;
  display: flex;
}

.chat-panel {
  width: var(--chat-width, 390px);
  min-width: 280px;
  max-width: 600px;
  flex-shrink: 0;
}

.resizer {
  width: 12px;
  cursor: col-resize;
  flex-shrink: 0;
  position: relative;
}
.resizer::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 40px;
  border-radius: 4px;
  background: rgba(109,40,217,.12);
  transition: background 0.2s;
}
.resizer:hover::after, .resizer:active::after {
  background: var(--violet);
}

.rab-panel {
  flex: 1;
  min-width: 0;
}

.chat-panel, .rab-panel {
  min-height: 0;
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(109,40,217,.12);
  box-shadow: var(--shadow);
}

.chat-panel { display: flex; flex-direction: column; }

.panel-head {
  height: 48px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-head h2 { margin: 0; font-size: 14px; font-weight: 900; }
.panel-head p { margin: 3px 0 0; color: var(--muted); font-size: 10.5px; font-weight: 700; }
.status-dot { width: 10px; height: 10px; border-radius: 999px; background: var(--green); box-shadow: 0 0 0 4px rgba(4,120,87,.12); }

.chat-log {
  flex: 1;
  min-height: 0;
  padding: 16px 16px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.chat-log > * {
  flex-shrink: 0;
}

.msg-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.msg {
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg-ai-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.msg-ai-head .avatar {
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, var(--violet), var(--violet-dark));
  color: white;
  display: grid;
  place-items: center;
  border-radius: 6px;
  font-weight: 900;
  font-size: 14px;
}
.msg-ai-head strong {
  font-size: 13px;
  color: var(--ink);
}
.msg.ai {
  background: transparent;
  color: var(--ink);
  padding: 0 0 0 32px;
  max-width: 100%;
}
.msg.user {
  align-self: flex-end;
  background: #f3f4f6;
  color: #1f2937;
  padding: 12px 16px;
  border-radius: 16px 16px 4px 16px;
  max-width: 85%;
  border: none;
}
.msg.system {
  background: #fff8ed;
  color: #7c2d12;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  align-self: center;
  max-width: 90%;
  text-align: center;
}
.msg strong {
  font-weight: 700;
}
.draft-msg { 
  max-width: 100%; 
  width: 100%;
  text-align: left; 
  background: var(--soft) !important;
  color: var(--violet-dark) !important;
  border: 1px solid var(--line);
  padding: 10px !important;
  border-radius: 6px;
}
.draft-msg strong {
  font-size: 13px;
}
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 8px 0;
}
.draft-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  background: white;
}
.draft-table th,
.draft-table td {
  border: 1px solid var(--line);
  padding: 4px 6px;
  vertical-align: top;
  white-space: nowrap;
}
.draft-table th {
  background: rgba(109,40,217,.04);
  color: var(--violet-dark);
  text-align: left;
}
.draft-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.draft-actions button {
  border: 1px solid rgba(109,40,217,.2);
  background: white;
  color: var(--violet-dark);
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
}
.draft-actions button:first-child {
  background: var(--violet);
  color: white;
  border-color: var(--violet);
}

.chat-panel { position: relative; }
.chat-form {
  padding: 12px 16px 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.95) 20%, #ffffff 100%);
  position: sticky;
  bottom: 0;
  z-index: 10;
}
.chat-input-wrapper {
  position: relative;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 24px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
  display: flex;
  align-items: flex-end;
  padding: 4px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.chat-input-wrapper:focus-within {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(109,40,217,.12);
}
.chat-input-wrapper textarea {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  padding: 14px 16px;
  min-height: 56px;
  max-height: 180px;
  resize: none;
  font-size: 14px;
  line-height: 1.5;
  overflow-y: auto;
  scrollbar-width: none;
}
.chat-input-wrapper textarea::-webkit-scrollbar {
  display: none;
}
.chat-submit {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--violet);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin: 8px;
  flex-shrink: 0;
  transition: opacity 0.2s;
}
.chat-submit:hover { opacity: 0.9; }
.chat-submit:disabled { background: var(--muted); cursor: not-allowed; }
.chat-submit span { font-size: 18px; }

.prompt-box {
  border-top: 1px solid var(--line);
  padding: 12px;
  background: #fbfaff;
}
.prompt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.prompt-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 900;
}
.prompt-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.prompt-box textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 1px solid var(--line);
  background: white;
  padding: 10px;
  outline: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
}
.prompt-box textarea:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(109,40,217,.12); }

.rab-panel { display: flex; flex-direction: column; padding: 12px; gap: 10px; }
.project-row, .search-row { display: flex; gap: 10px; align-items: flex-end; position: relative; }

.field { display: grid; gap: 5px; min-width: 160px; }
.field.grow { flex: 1; min-width: 220px; }
.field.small { min-width: 74px; width: 78px; }
.field span { color: var(--muted); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.field input {
  height: 30px;
  border: 1px solid var(--line);
  background: white;
  padding: 0 8px;
  outline: none;
  font-weight: 700;
  font-size: 12px;
}

.icon-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  background: white;
  color: var(--violet-dark);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.icon-btn .material-symbols-outlined { font-size: 16px; }
.icon-btn:hover { border-color: var(--violet); color: var(--violet); }
.icon-btn.danger { color: var(--danger); }

.doc-btn {
  min-height: 30px;
  border: 1px solid var(--line);
  background: white;
  color: var(--violet-dark);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  font-weight: 800;
  font-size: 11.5px;
  white-space: nowrap;
}
.doc-btn .material-symbols-outlined { font-size: 16px; }
.doc-btn:hover { border-color: var(--violet); color: var(--violet); }

.search-results {
  position: absolute;
  top: 64px;
  left: 0;
  right: 0;
  max-height: min(520px, 62vh);
  overflow-y: auto;
  background: white;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 20;
  display: none;
}
.search-results.show { display: block; }
.result-item {
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: white;
  padding: 8px 12px;
  cursor: pointer;
}
.result-item:hover { background: var(--soft); }
.result-item strong { display: block; font-size: 12px; }
.result-item span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }

.table-wrap {
  flex: 1;
  min-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  background: white;
}

.rab-table { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 960px; }
.rab-table .col-no { width: 36px; }
.rab-table .col-code { width: 88px; }
.rab-table .col-volume { width: 110px; }
.rab-table .col-unit { width: 48px; }
.rab-table .col-price { width: 118px; }
.rab-table .col-total { width: 124px; }
.rab-table .col-actions { width: 112px; }
.rab-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--violet-dark);
  color: #f5f3ff;
  text-align: left;
  padding: 7px;
  font-size: 10.5px;
  text-transform: uppercase;
  vertical-align: middle;
}
.rab-table th.actions-head { text-align: center; }
.rab-table td { border-bottom: 1px solid var(--line); padding: 5px 7px; font-size: 12px; vertical-align: middle; }
.rab-table tr:hover td { background: #fbfaff; }
.rab-table input {
  width: 92px;
  height: 26px;
  border: 1px solid var(--line);
  padding: 0 5px;
  font-weight: 800;
  font-size: 12px;
}
.rab-table .work-name { font-weight: 700; }
.rab-table .work-name textarea {
  display: block;
  min-height: 24px;
  line-height: 1.35;
}
.rab-table .money { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rab-table tr.row-disabled td {
  background: #f8fafc;
  color: #94a3b8;
}
.rab-table tr.row-disabled .work-name textarea {
  color: #94a3b8;
}
.row-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
}
.row-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}
.row-icon-spacer {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}
.row-icon .material-symbols-outlined {
  font-size: 10px;
  line-height: 1;
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 14;
}
.row-toggle.is-on {
  border-color: #22c55e;
  color: #22c55e;
}
.row-toggle.is-off {
  border-color: var(--danger);
  color: var(--danger);
}
.row-toggle .material-symbols-outlined {
  font-size: 9px;
}
.row-delete {
  color: var(--danger);
}
.delete-popover {
  position: fixed;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .12);
}
.delete-popover button {
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.delete-popover .confirm-delete {
  border-color: rgba(220, 38, 38, .35);
  color: var(--danger);
}
.delete-popover .cancel-delete {
  color: var(--muted);
}
.drag-handle {
  cursor: grab;
}
.drag-handle:active {
  cursor: grabbing;
}

.summary {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.summary div {
  border: 1px solid var(--line);
  background: white;
  padding: 6px 10px;
  border-radius: 6px;
}
.summary span { display: block; color: var(--muted); font-size: 10px; font-weight: 900; text-transform: uppercase; }
.summary strong { display: block; margin-top: 2px; font-size: 14px; text-align: left; white-space: nowrap; }
.summary .grand { background: var(--violet-dark); color: white; border-color: var(--violet-dark); }
.summary .grand span { color: #ddd6fe; }

.document-panel {
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(109,40,217,.12);
  box-shadow: var(--shadow);
  padding: 12px;
}

.document-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.document-title-group {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.document-controls {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.document-controls .field.small {
  margin: 0;
}
.document-controls .field.small span {
  font-size: 10px;
  margin-bottom: 4px;
  white-space: nowrap;
}
.document-controls .field.small input,
.document-controls .field.small select {
  padding: 6px 8px;
  font-size: 13px;
  height: 32px;
}
.document-controls button {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.document-controls .icon-btn {
  width: 32px;
  padding: 0;
  justify-content: center;
}
.document-controls .icon-btn .material-symbols-outlined { font-size: 18px; }
.document-controls .doc-btn .material-symbols-outlined { font-size: 16px; }

.document-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
}

.document-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.doc-empty {
  border: 1px dashed #d8cdec;
  background: #fbfaff;
  color: var(--muted);
  padding: 16px;
  font-size: 13px;
  font-weight: 700;
}

.print-report { display: none; }
.print-report.screen-report {
  display: block;
  max-height: 720px;
  overflow: auto;
  background: #f1f5f9;
  border: 1px solid var(--line);
  padding: 16px;
}

.print-page {
  background: white;
  color: #1f2937;
  padding: 22mm 18mm;
  page-break-after: always;
}

.screen-report .print-page {
  max-width: 920px;
  min-height: auto;
  margin: 0 auto 16px;
  padding: 34px 42px;
  box-shadow: 0 14px 42px rgba(15,23,42,.12);
}

.report-kicker {
  color: #64748b;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
}

.print-page h1 {
  margin: 6px 0 12px;
  font-size: 25px;
  line-height: 1.1;
}

.report-meta {
  display: grid;
  gap: 3px;
  color: #475569;
  font-size: 12px;
  margin-bottom: 14px;
}

.recipient, .ahsp-card {
  display: grid;
  gap: 5px;
  background: #f8fafc;
  border: 1px solid #edf2f7;
  padding: 12px;
  margin: 12px 0;
  border-radius: 8px;
  font-size: 12px;
}

.report-section h2, .ahsp-block h2 {
  margin: 14px 0 8px;
  padding: 8px 10px;
  background: #eef7f2;
  border-radius: 8px;
  font-size: 13px;
}

.report-lead {
  color: #64748b;
  font-size: 12px;
  line-height: 1.6;
  max-width: 640px;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
  font-size: 11px;
}

.report-table th {
  background: #f1f5f9;
  border: 1px solid #e5e7eb;
  padding: 8px 7px;
  text-align: left;
  font-weight: 900;
}

.report-table td {
  border: 1px solid #e5e7eb;
  padding: 7px;
  vertical-align: top;
}
.report-table .report-header-lantai td {
  background: var(--report-bg-lantai, #e2e8f0);
}
.report-table .report-header-divisi td {
  background: var(--report-bg-divisi, #f8fafc);
  font-weight: 900;
}

.report-table .num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.report-table tr.report-row-disabled td {
  color: #94a3b8;
  background: #f8fafc;
}
.report-table tr.report-row-disabled strong {
  color: #64748b;
}

.report-summary {
  width: 300px;
  margin-left: auto;
  display: grid;
  gap: 0;
  border: 1px solid #e5e7eb;
}

.report-summary div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 12px;
}

.report-summary div:last-child {
  border-bottom: 0;
  background: #f8fafc;
  font-weight: 900;
}

.ahsp-block {
  break-inside: avoid;
  page-break-inside: avoid;
  margin-bottom: 18px;
}

.ahsp-table .total-row td {
  font-weight: 900;
  background: #fbfdff;
}

.print-page.template-executive {
  --report-accent: #172554;
  --report-bg-lantai: #dbeafe;
  --report-bg-divisi: #eff6ff;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  border-top: 7px solid #172554;
}

.template-executive .report-kicker {
  color: #b45309;
  letter-spacing: .16em;
}

.template-executive h1 {
  color: #172554;
  font-size: 28px;
  border-bottom: 2px solid #172554;
  padding-bottom: 10px;
}

.template-executive .report-meta,
.template-executive .recipient,
.template-executive .ahsp-card {
  background: #f8fafc;
  border-color: #cbd5e1;
  border-radius: 0;
}

.template-executive .report-table th {
  background: #172554;
  border-color: #172554;
  color: white;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.template-executive .report-summary div:last-child {
  background: #172554;
  color: white;
}

.print-page.template-minimal {
  --report-accent: #111827;
  --report-bg-lantai: #e5e7eb;
  --report-bg-divisi: #f3f4f6;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111827;
}

.template-minimal .report-kicker {
  color: #111827;
  letter-spacing: .12em;
}

.template-minimal h1 {
  font-size: 24px;
  font-weight: 800;
  border-bottom: 1px solid #111827;
  padding-bottom: 12px;
}

.template-minimal .recipient,
.template-minimal .ahsp-card,
.template-minimal .report-meta,
.template-minimal .report-summary {
  background: white;
  border-color: #d1d5db;
  border-radius: 0;
}

.template-minimal .report-table th {
  background: white;
  border-top: 2px solid #111827;
  border-bottom: 2px solid #111827;
  color: #111827;
}

.template-minimal .report-table td {
  border-left: 0;
  border-right: 0;
}

.template-minimal .report-summary div:last-child {
  background: #f3f4f6;
}

.print-page.template-emerald {
  --report-accent: #065f46;
  --report-bg-lantai: #d1fae5;
  --report-bg-divisi: #ecfdf5;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #14342f;
}

.template-emerald .report-kicker {
  display: inline-block;
  background: #047857;
  color: white;
  padding: 5px 9px;
  border-radius: 999px;
  letter-spacing: .12em;
}

.template-emerald h1 {
  color: #065f46;
  font-size: 27px;
}

.template-emerald .report-meta,
.template-emerald .recipient,
.template-emerald .ahsp-card {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.template-emerald .report-table th {
  background: #065f46;
  border-color: #065f46;
  color: white;
}

.template-emerald .report-summary {
  border-color: #86efac;
}

.template-emerald .report-summary div:last-child {
  background: #dcfce7;
  color: #064e3b;
}

.print-page.template-slate-gold {
  --report-accent: #334155;
  --report-bg-lantai: #e2e8f0;
  --report-bg-divisi: #f8fafc;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1f2937;
  border-top: 6px solid #334155;
}

.template-slate-gold .report-kicker {
  color: #b45309;
  letter-spacing: .18em;
}

.template-slate-gold h1 {
  color: #334155;
  font-size: 27px;
  border-bottom: 2px solid #d97706;
  padding-bottom: 9px;
}

.template-slate-gold .report-meta,
.template-slate-gold .recipient,
.template-slate-gold .ahsp-card {
  background: #fffbeb;
  border-color: #fde68a;
  border-radius: 6px;
}

.template-slate-gold .report-table th {
  background: #334155;
  border-color: #334155;
  color: #fef3c7;
}

.template-slate-gold .report-summary div:last-child {
  background: #78350f;
  color: white;
}

.print-page.template-maroon {
  --report-accent: #7f1d1d;
  --report-bg-lantai: #fee2e2;
  --report-bg-divisi: #fef2f2;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #2f1515;
  border-left: 8px solid #7f1d1d;
}

.template-maroon .report-kicker {
  color: #991b1b;
  letter-spacing: .14em;
}

.template-maroon h1 {
  color: #7f1d1d;
  font-size: 29px;
  border-bottom: 1px solid #fecaca;
  padding-bottom: 10px;
}

.template-maroon .report-meta,
.template-maroon .recipient,
.template-maroon .ahsp-card {
  background: #fff7f7;
  border-color: #fecaca;
}

.template-maroon .report-table th {
  background: #7f1d1d;
  border-color: #7f1d1d;
  color: white;
}

.template-maroon .report-summary {
  border-color: #fecaca;
}

.template-maroon .report-summary div:last-child {
  background: #fee2e2;
  color: #7f1d1d;
}

.print-page.template-indigo {
  --report-accent: #312e81;
  --report-bg-lantai: #e0e7ff;
  --report-bg-divisi: #eef2ff;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1e1b4b;
}

.template-indigo .report-kicker {
  display: inline-block;
  color: #4338ca;
  border-bottom: 2px solid #a5b4fc;
  padding-bottom: 4px;
}

.template-indigo h1 {
  color: #312e81;
  font-size: 26px;
}

.template-indigo .report-meta,
.template-indigo .recipient,
.template-indigo .ahsp-card {
  background: #eef2ff;
  border-color: #c7d2fe;
}

.template-indigo .report-table th {
  background: #312e81;
  border-color: #312e81;
  color: white;
}

.template-indigo .report-table tbody tr:nth-child(even) td {
  background: #f8faff;
}

.template-indigo .report-summary div:last-child {
  background: #312e81;
  color: white;
}

.print-page.template-copper {
  --report-accent: #92400e;
  --report-bg-lantai: #ffedd5;
  --report-bg-divisi: #fff7ed;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #2d1b12;
  border-top: 5px solid #92400e;
}

.template-copper .report-kicker {
  color: #92400e;
  letter-spacing: .15em;
}

.template-copper h1 {
  color: #78350f;
  font-size: 28px;
  border-bottom: 2px solid #fed7aa;
  padding-bottom: 10px;
}

.template-copper .report-meta,
.template-copper .recipient,
.template-copper .ahsp-card {
  background: #fff7ed;
  border-color: #fed7aa;
  border-radius: 4px;
}

.template-copper .report-table th {
  background: #92400e;
  border-color: #92400e;
  color: #fffbeb;
}

.template-copper .report-summary {
  border-color: #fed7aa;
}

.template-copper .report-summary div:last-child {
  background: #ffedd5;
  color: #7c2d12;
}

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .chat-panel { min-height: 430px; }
  .topbar, .project-row, .document-head { align-items: stretch; flex-direction: column; }
  .top-actions { justify-content: flex-start; }
  .summary { grid-template-columns: 1fr 1fr; }
  .screen-report .print-page { padding: 22px 18px; }
}

@media print {
  body { background: white; }
  .topbar, .workspace, .document-head, .doc-empty, #statusBar { display: none !important; }
  .document-panel { display: block; padding: 0; border: 0; box-shadow: none; }
  .app-shell { display: block; min-height: auto; padding: 0; }
  .print-report, .print-report.screen-report { display: block; max-height: none; overflow: visible; border: 0; padding: 0; background: white; }
  .screen-report .print-page { max-width: none; margin: 0; box-shadow: none; padding: 22mm 18mm; }
  .print-page { min-height: 100vh; }
  @page { size: A4; margin: 0; }
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(23, 19, 47, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}
.modal-content {
  background: white;
  border-radius: 12px;
  width: 400px;
  max-width: 90vw;
  padding: 24px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  transform: translateY(20px);
  transition: transform 0.2s;
}
.modal-overlay.show .modal-content {
  transform: translateY(0);
}
.modal-content h3 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 900;
}

.toast-notification {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--violet);
  color: white;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(109, 40, 217, 0.3);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 99999;
  pointer-events: none;
}
.toast-notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
