:root {
  --bg-app: #f1f5f9;
  --bg-sheet: #ffffff;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-light: #64748b;
  --border-dark: #334155;
  --border-line: #94a3b8;
  --border-soft: #e2e8f0;
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;
  --accent-red: #dc2626;
  --accent-red-bg: #fef2f2;
  --accent-green: #16a34a;
  --accent-green-bg: #f0fdf4;
  --accent-amber: #d97706;
  --accent-amber-bg: #fffbeb;
  --input-bg: #f8fafc;
  --input-focus: #eff6ff;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.1);
  --radius: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.4;
  font-size: 13px;
  padding-bottom: 48px;
}

/* Top Navbar / Toolbar */
.top-toolbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #0f172a;
  color: #ffffff;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  flex-wrap: wrap;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: #fff;
  box-shadow: 0 2px 6px rgba(56, 189, 248, 0.35);
}

.brand-title h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-title p {
  font-size: 11px;
  color: #94a3b8;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #334155;
}
.btn-secondary:hover {
  background: #334155;
  color: #fff;
}

.btn-success {
  background: #16a34a;
  color: #fff;
}
.btn-success:hover {
  background: #15803d;
}

.btn-outline {
  background: #fff;
  color: var(--text-main);
  border-color: #cbd5e1;
}
.btn-outline:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 11px;
}

/* Mode Selector Pill */
.calc-mode-pill {
  display: inline-flex;
  align-items: center;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 3px;
  gap: 3px;
}

.calc-mode-pill button {
  background: transparent;
  color: #94a3b8;
  border: none;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.calc-mode-pill button.active {
  background: var(--primary);
  color: #fff;
}

/* Layout Container */
.main-container {
  max-width: 1460px;
  margin: 20px auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 1fr 440px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 1180px) {
  .main-container {
    grid-template-columns: 1fr;
  }
}

/* Paper Sheet Form (Matches Reference Image) */
.paper-sheet {
  background: var(--bg-sheet);
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 28px 32px;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.sheet-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 2px solid #0f172a;
}

.sheet-badge-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sheet-badge-tag {
  background: #0f172a;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sheet-badge-hint {
  font-size: 12px;
  color: var(--text-muted);
}

/* Form Input Styling (Underline & Box style like paper form) */
input[type="text"],
input[type="number"],
input[type="date"],
select {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  background: var(--input-bg);
  border: none;
  border-bottom: 1.5px solid #475569;
  padding: 3px 6px;
  border-radius: 3px 3px 0 0;
  transition: all 0.15s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus {
  outline: none;
  background: var(--input-focus);
  border-bottom-color: var(--primary);
  box-shadow: 0 2px 0 0 var(--primary);
}

input.input-box {
  border: 1.5px solid #475569;
  border-radius: 4px;
  padding: 4px 8px;
}

input.input-right {
  text-align: right;
}

input.input-center {
  text-align: center;
}

input.readonly-calc {
  background: #f1f5f9;
  color: #0369a1;
  border-bottom-style: dashed;
}

/* Header Rows (Comp, Cust, Tanggal, Ukuran, Kertas) */
.header-grid-row1 {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 0.9fr;
  gap: 16px;
  margin-bottom: 10px;
  align-items: center;
}

.field-inline {
  display: flex;
  align-items: center;
  gap: 6px;
}

.field-label {
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
  min-width: 62px;
}

.field-label-sm {
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
}

.header-grid-row2 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.kertas-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.kertas-box-wrapper {
  flex: 1;
  border: 1.5px solid #334155;
  padding: 5px 10px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: #fff;
}

/* Middle Section: Quantity, Order No, Cut Size Diagram, Mata Plano */
.mid-spec-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr 0.75fr;
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.qty-order-col {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.order-no-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 6px;
}

.order-no-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

/* Plano Cutting Pattern Diagram Box (Middle Box in Image) */
.plano-pattern-box {
  border: 1.5px solid #334155;
  padding: 8px 10px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #ffffff;
  min-height: 120px;
  border-radius: 4px;
}

.plano-pattern-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 4px;
}

.plano-pattern-canvas {
  width: 100%;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 4px;
  overflow: hidden;
}

.plano-pattern-canvas svg {
  max-width: 100%;
  max-height: 100%;
}

/* Plano & Mounting Column */
.mata-col {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 8px;
}

.mata-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mata-group-label {
  font-size: 11px;
  font-weight: 600;
  color: #334155;
}

.mata-input-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.mata-input-line span {
  font-size: 16px;
  font-weight: 700;
}

/* Calculation Table Rows */
.calc-section-divider {
  border-top: 2px solid #1e293b;
  margin: 14px 0;
}

.calc-rows-container {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.calc-row {
  display: grid;
  grid-template-columns: 88px 1fr 18px 140px 150px;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.12s;
}

.calc-row:hover {
  background: #f8fafc;
}

.calc-row-title {
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.calc-row-body {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.calc-eq {
  font-weight: 700;
  text-align: center;
  color: #334155;
}

.row-subformula {
  font-size: 11px;
  color: #0369a1;
  background: #f0f9ff;
  border-left: 3px solid #0284c7;
  padding: 3px 8px;
  margin: -2px 0 6px 96px;
  border-radius: 0 4px 4px 0;
  line-height: 1.4;
}

/* Exact Formula Preview Column & Final Amount Column */
.exact-val-col {
  text-align: right;
  font-size: 11.5px;
  color: #64748b;
  padding-right: 6px;
  border-bottom: 1px solid #cbd5e1;
  height: 27px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.final-val-col {
  position: relative;
  display: flex;
  align-items: center;
}

.final-val-input {
  width: 100%;
  text-align: right;
  font-size: 14px !important;
  font-weight: 800 !important;
  color: #0f172a !important;
  border-bottom: 1.5px solid #334155 !important;
  padding-right: 24px !important;
}

.final-val-input.is-overridden {
  background: #fffbeb !important;
  color: #b45309 !important;
  border-bottom-color: #d97706 !important;
}

.btn-sync-row {
  position: absolute;
  right: 3px;
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 12px;
  padding: 2px;
  line-height: 1;
  border-radius: 3px;
  title: "Reset ke rumus otomatis";
}

.btn-sync-row:hover {
  color: var(--primary);
  background: #e2e8f0;
}

/* Total (TT) & Modal (Md) / TC Footer Section */
.totals-footer-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  margin-top: 14px;
  align-items: start;
}

/* Red Historical Note Box */
.red-note-box {
  border: 1.5px solid #475569;
  padding: 10px 14px;
  text-align: center;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.red-note-input {
  width: 100%;
  text-align: center;
  color: var(--accent-red) !important;
  font-size: 18px !important;
  font-weight: 900 !important;
  letter-spacing: 0.01em;
  border-bottom: 1px dashed #fca5a5 !important;
  background: transparent !important;
  text-transform: uppercase;
}

.tt-md-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tt-row {
  display: grid;
  grid-template-columns: 45px 140px 150px;
  align-items: center;
  gap: 8px;
  justify-content: end;
}

.tt-label {
  font-weight: 800;
  font-size: 14px;
  text-align: right;
}

.tt-double-line {
  height: 30px;
  border-bottom: 4px double #0f172a;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-weight: 700;
  font-size: 12px;
  color: #64748b;
  padding-right: 6px;
}

.tt-total-display {
  height: 30px;
  border-bottom: 4px double #0f172a;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-weight: 900;
  font-size: 16px;
  color: #0f172a;
  padding-right: 6px;
}

.md-tc-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
}

/* Bottom Section: Box Dieline Preview + Secondary Calculation Rows */
.bottom-split-section {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 18px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1.5px dashed #cbd5e1;
}

.dieline-preview-card {
  border: 1.5px solid #94a3b8;
  border-radius: 6px;
  background: #f8fafc;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dieline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 700;
  color: #334155;
}

.dieline-canvas-wrap {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 250px;
  position: relative;
}

.dieline-canvas-wrap img {
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
}

/* Right Sidebar: Executive Summary, Formula Breakdown & Quantity Simulator */
.sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 72px;
}

.card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 18px;
  box-shadow: var(--shadow-md);
}

.card-title {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.kpi-box {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.kpi-box.highlight-blue {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.kpi-box.highlight-green {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 3px;
}

.kpi-val {
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
}

.kpi-sub {
  font-size: 11px;
  color: #475569;
  margin-top: 2px;
}

/* Formula Breakdown List */
.formula-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 4px;
}

.formula-item {
  padding: 8px 10px;
  border-radius: 6px;
  background: #f8fafc;
  border-left: 3px solid var(--primary);
  font-size: 11.5px;
}

.formula-item-head {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 2px;
}

.formula-item-math {
  color: #475569;
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 11px;
}

/* PL Kertas Table (Matches Handwritten Reference Image) */
#cardPlKertas {
  padding: 14px 12px;
}

.pl-kertas-card {
  overflow-x: auto;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
}

.pl-kertas-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10.5px;
}

.pl-kertas-table th {
  text-align: left;
  padding: 5px 4px;
  background: #f1f5f9;
  color: #1e293b;
  font-weight: 800;
  border: 1px solid #cbd5e1;
  font-size: 10px;
  white-space: nowrap;
}

.pl-kertas-table td {
  padding: 4px 4px;
  border: 1px solid #cbd5e1;
  vertical-align: middle;
  font-size: 10.5px;
}

.pl-kertas-table select {
  font-size: 10px;
  padding: 2px 2px;
  border: 1px solid #94a3b8;
  border-radius: 3px;
  background: #ffffff;
  width: 100%;
  max-width: 64px;
  font-weight: 600;
}

.pl-kertas-table input[type="number"] {
  font-size: 10px;
  padding: 2px 2px;
  border: 1px solid #94a3b8;
  border-radius: 3px;
  width: 100%;
  max-width: 50px;
  text-align: right;
  font-weight: 700;
}

.pl-kertas-table tbody tr {
  cursor: pointer;
  transition: all 0.15s ease;
}

.pl-kertas-table tbody tr:hover {
  background-color: #f1f5f9;
}

.pl-kertas-table tbody tr.active-pl-row {
  background-color: #eff6ff !important;
}

.pl-kertas-table tbody tr.active-pl-row td {
  border-color: #93c5fd;
  background-color: #eff6ff;
}

.badge-active-paper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 6px;
  background: #16a34a;
  color: #ffffff;
  border-radius: 4px;
  white-space: nowrap;
}

.pill-active-mini {
  display: inline-block;
  font-size: 8px;
  font-weight: 800;
  padding: 1px 3px;
  background: #0284c7;
  color: #ffffff;
  border-radius: 3px;
  line-height: 1;
}

.btn-apply-paper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  padding: 2px 8px;
  background: #0284c7;
  color: #ffffff;
  border: 1px solid #0284c7;
  border-radius: 4px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-apply-paper:hover {
  background: #0369a1;
  border-color: #0369a1;
  transform: scale(1.05);
}

.btn-apply-paper.is-active {
  background: #16a34a;
  border-color: #16a34a;
  cursor: default;
}

/* Quantity Simulation Table */
.sim-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.sim-table th {
  text-align: left;
  padding: 7px 8px;
  background: #f1f5f9;
  color: #334155;
  font-weight: 700;
  border-bottom: 1.5px solid #cbd5e1;
}

.sim-table td {
  padding: 7px 8px;
  border-bottom: 1px solid #e2e8f0;
}

.sim-table tr.active-qty-row {
  background: #e0f2fe;
  font-weight: 700;
}

.sim-table tr:hover {
  background: #f8fafc;
  cursor: pointer;
}

/* Saved Calculations Modal / Drawer */
.saved-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.saved-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
}

.saved-item-info strong {
  display: block;
  font-size: 12px;
  color: #0f172a;
}

.saved-item-info span {
  font-size: 11px;
  color: #64748b;
}

/* Auto Dimension Formula Helper Banner */
.auto-dim-helper {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11.5px;
  color: #0c4a6e;
}

.auto-dim-steps {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.auto-dim-pill {
  background: #ffffff;
  border: 1px solid #7dd3fc;
  border-radius: 5px;
  padding: 4px 8px;
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 11px;
  color: #0369a1;
  font-weight: 600;
}

.auto-dim-arrow {
  color: #0284c7;
  font-weight: 800;
}

/* Checkbox styling */
.chk-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
}

.chk-label input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* APKI Pricelist Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: #ffffff;
  border-radius: 10px;
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  border: 1px solid #cbd5e1;
}

.modal-header {
  padding: 14px 20px;
  border-bottom: 1.5px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
}

.modal-title {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
}

.modal-body {
  padding: 16px 20px;
}

.apki-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: right;
}

.apki-table th, .apki-table td {
  border: 1px solid #cbd5e1;
  padding: 6px 10px;
}

.apki-table th {
  background: #0f172a;
  color: #ffffff;
  font-weight: 700;
  text-align: center;
}

.apki-table td.apki-cell-btn:hover {
  background: #e0f2fe;
  cursor: pointer;
  font-weight: 800;
  color: #0284c7;
}

/* Plano Comparison Modal Styles */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.compare-card {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 12px;
  background: #f8fafc;
}

.compare-card.active {
  border-color: #0284c7;
  background: #f0f9ff;
}

.compare-card-title {
  font-size: 12.5px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  margin-bottom: 16px;
}

.compare-table th, .compare-table td {
  border: 1px solid #cbd5e1;
  padding: 6px 10px;
  text-align: center;
}

.compare-table th {
  background: #f1f5f9;
  font-weight: 700;
  color: #334155;
}

.compare-table tr.active-paper-row {
  background: #e0f2fe;
  font-weight: 700;
}

.preset-test-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.preset-box-btn {
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.preset-box-btn:hover {
  border-color: #0284c7;
  background: #f0f9ff;
  transform: translateY(-1px);
}

.preset-box-btn strong {
  display: block;
  font-size: 12px;
  color: #0f172a;
}

.preset-box-btn span {
  font-size: 10.5px;
  color: #64748b;
}

.preset-box-btn .badge-mata {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  background: #0284c7;
}

/* ==========================================
   SMART PAPER RECOMMENDATION CARD (AI RECOM)
   ========================================== */
.smart-rec-card {
  background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 55%, #f8fafc 100%);
  border: 1.5px solid #0284c7;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 14px;
  box-shadow: 0 4px 14px -2px rgba(2, 132, 199, 0.12);
  transition: all 0.25s ease;
}

.smart-rec-card.rec-is-active-match {
  border-color: #16a34a;
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 55%, #f8fafc 100%);
  box-shadow: 0 4px 14px -2px rgba(22, 163, 74, 0.12);
}

.smart-rec-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.smart-rec-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.smart-rec-icon {
  font-size: 26px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(2, 132, 199, 0.3));
}

.smart-rec-main-title {
  font-size: 13.5px;
  font-weight: 900;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  letter-spacing: -0.2px;
}

.badge-rec-status {
  background: #0284c7;
  color: #fff;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-rec-status.status-matched {
  background: #16a34a;
}

.badge-rec-status.status-diff {
  background: #ea580c;
}

.smart-rec-subtitle {
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
  margin-top: 1px;
}

.smart-rec-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-apply-rec {
  background: #16a34a;
  color: #fff;
  border: 1.5px solid #15803d;
  font-weight: 800;
  font-size: 11.5px;
  padding: 5px 12px;
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 4px rgba(22, 163, 74, 0.2);
  transition: all 0.15s ease;
}

.btn-apply-rec:hover {
  background: #15803d;
  transform: translateY(-1px);
}

.btn-apply-rec:disabled {
  background: #94a3b8;
  border-color: #64748b;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.btn-toggle-rec {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  font-weight: 700;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-toggle-rec:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.smart-rec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.smart-rec-box {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 8px 12px;
  position: relative;
  overflow: hidden;
}

.rec-box-paper {
  border-left: 3.5px solid #0284c7;
}

.rec-box-waste {
  border-left: 3.5px solid #ea580c;
}

.rec-box-price {
  border-left: 3.5px solid #16a34a;
}

.rec-box-label {
  font-size: 9.5px;
  font-weight: 800;
  color: #64748b;
  letter-spacing: 0.4px;
  margin-bottom: 3px;
}

.rec-box-value {
  font-size: 13.5px;
  font-weight: 900;
  color: #0f172a;
}

.rec-box-sub {
  font-size: 10.5px;
  color: #475569;
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.pill-rec-mata {
  background: #0284c7;
  color: #fff;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 800;
  font-size: 10px;
}

.pill-rec-orient {
  background: #f1f5f9;
  color: #334155;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 600;
  font-size: 10px;
}

.smart-rec-reason {
  background: #ffffff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid #0284c7;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 11.5px;
  line-height: 1.6;
  color: #1e293b;
  margin-bottom: 8px;
}

.smart-rec-reason .reason-title {
  font-weight: 800;
  color: #0369a1;
  font-size: 12px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.smart-rec-reason ul {
  margin: 4px 0 0 16px;
  padding: 0;
}

.smart-rec-reason li {
  margin-bottom: 4px;
}

.smart-rec-table-wrap {
  margin-top: 10px;
  border-top: 1px dashed #cbd5e1;
  padding-top: 10px;
}

.smart-rec-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: #334155;
}

.rec-filter-pills {
  display: flex;
  gap: 4px;
}

.rec-filter-btn {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  color: #475569;
}

.rec-filter-btn.active {
  background: #0284c7;
  color: #fff;
  border-color: #0284c7;
}

.smart-rec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10.5px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.smart-rec-table th {
  background: #f1f5f9;
  padding: 6px 8px;
  text-align: left;
  font-weight: 800;
  color: #334155;
  border-bottom: 1.5px solid #cbd5e1;
}

.smart-rec-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.smart-rec-table tr.winner-row {
  background: #eff6ff;
  font-weight: 700;
}

.smart-rec-table tr.winner-row td {
  border-top: 1.5px solid #93c5fd;
  border-bottom: 1.5px solid #93c5fd;
}

.badge-rank-1 {
  background: #fef08a;
  color: #854d0e;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 9.5px;
  font-weight: 800;
  border: 1px solid #fde047;
}

.badge-rank-other {
  background: #f1f5f9;
  color: #475569;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 9.5px;
  font-weight: 700;
}

.badge-rec-pill {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10.5px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.badge-rec-pill:hover {
  background: #fde68a;
  transform: translateY(-1px);
}

/* Print Stylesheet */
@media print {
  body {
    background: #fff;
    padding: 0;
    font-size: 11.5px;
  }
  .top-toolbar,
  .sidebar-panel,
  .sheet-badge,
  .btn-sync-row,
  .no-print {
    display: none !important;
  }
  .main-container {
    display: block;
    max-width: 100%;
    margin: 0;
    padding: 0;
  }
  .paper-sheet {
    border: none;
    box-shadow: none;
    padding: 10px;
  }
  input[type="text"],
  input[type="number"],
  input[type="date"],
  select {
    background: transparent !important;
  }
}
