/* =====================================================================
   Medical Reimbursement Form — lively but clean & professional styling
   (loaded after styles.css; overrides the form's base look)
   ===================================================================== */

.paper {
  position: relative; overflow: hidden; padding: 34px 30px 30px;
  border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 32px rgba(16, 24, 40, .06);
  counter-reset: formsec;
}
.paper::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 6px;
  background: linear-gradient(90deg, #0f7a6c, #1aa48f 45%, #7bd3c3);
}
.paper::after {
  content: ""; position: absolute; top: -120px; right: -120px; width: 280px; height: 280px; border-radius: 50%;
  background: radial-gradient(circle, rgba(26, 164, 143, .10), transparent 70%); pointer-events: none;
}

/* ---------- numbered section cards ---------- */
.paper .section,
.paper .two-col.section > div {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px 20px;
  transition: box-shadow .25s ease, border-color .25s ease;
}
.paper .section { margin-bottom: 18px; animation: secIn .45s ease-out both; }
.paper .section:hover,
.paper .two-col.section > div:hover { border-color: #cfe7e2; box-shadow: 0 6px 18px rgba(15, 122, 108, .07); }
.paper .two-col.section { background: transparent; border: 0; padding: 0; box-shadow: none; }
.paper .section:nth-of-type(2) { animation-delay: .05s; }
.paper .section:nth-of-type(3) { animation-delay: .1s; }
.paper .section:nth-of-type(4) { animation-delay: .15s; }
.paper .section:nth-of-type(5) { animation-delay: .2s; }
.paper .section:nth-of-type(6) { animation-delay: .25s; }
@keyframes secIn { from { opacity: 0; transform: translateY(10px); } }

.paper .section-title {
  font-size: 12.5px; letter-spacing: .07em; border-bottom: 0; padding-bottom: 0; margin-bottom: 14px; gap: 10px;
}
.paper .section-title::before {
  counter-increment: formsec; content: counter(formsec);
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, #0f7a6c, #1aa48f); color: #fff; font-size: 12.5px; letter-spacing: 0;
  box-shadow: 0 3px 8px rgba(15, 122, 108, .25);
}

/* ---------- read-only details as soft info tiles ---------- */
.paper .ro {
  background: var(--bg); border: 0; border-radius: 9px;
  padding: 8px 12px; min-height: 38px; font-weight: 600; color: var(--text);
}
.paper .ro.empty { font-weight: 400; color: var(--muted); }
.paper td .ro { background: transparent; padding: 0; min-height: 0; font-weight: 500; }
.paper .field .lbl { font-size: 11px; letter-spacing: .06em; margin-bottom: 5px; }

/* ---------- inputs: clean white with a teal focus glow ---------- */
.paper input[type=text], .paper input[type=date], .paper input[type=number], .paper select, .paper textarea {
  background: #fff; border: 1px solid #d5dbe6; border-radius: 9px; padding: 8px 11px;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.paper input:hover:not(:disabled), .paper select:hover:not(:disabled), .paper textarea:hover { border-color: #aebfd3; }
.paper input:focus, .paper select:focus, .paper textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(15, 122, 108, .13);
}
.paper .invalid { background: #fff7f6 !important; border-color: #ef9a92 !important; box-shadow: 0 0 0 3px rgba(192, 54, 44, .08); }
.paper input:disabled { background: var(--bg); border-style: dashed; }
.paper input[type=checkbox] { accent-color: var(--accent); }
.paper .check { cursor: pointer; padding: 10px 12px; border-radius: 10px; background: var(--bg); transition: background-color .2s ease; }
.paper .check:hover { background: var(--accent-soft); }

/* ---------- expenses table ---------- */
.paper .exp { border-collapse: separate; border-spacing: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.paper .exp th { background: linear-gradient(180deg, #f3f8f7, #eaf3f1); color: #3d5a55; border: 0; border-bottom: 1px solid var(--border); padding: 10px 8px; }
.paper .exp td { border: 0; border-bottom: 1px solid #eef1f5; padding: 6px; transition: background-color .2s ease; }
.paper .exp tbody tr { animation: secIn .3s ease-out both; }
.paper .exp tbody tr:hover td { background: #f8fbfb; }
.paper .exp td.hrcol { background: #f4faf8; }
.paper .exp tfoot td { background: #f7f9fc; border-bottom: 0; padding: 12px 10px; color: var(--muted); font-size: 12px; letter-spacing: .04em; }
.paper .exp tfoot tr:first-child td { border-top: 1px solid var(--border); }
.paper .exp tfoot td.big { font-size: 17px; color: var(--text); letter-spacing: 0; }
.paper .exp tfoot tr:last-child td.big { color: var(--accent); font-size: 19px; background: var(--accent-soft); }

.row-del { border-radius: 8px; width: 30px; height: 30px; transition: background-color .15s ease, transform .15s ease; }
.row-del:hover:not(:disabled) { background: var(--bad-soft); transform: rotate(90deg); }
.row-del:disabled { opacity: .3; cursor: not-allowed; }

.section-title .add-row {
  border-color: var(--accent); color: var(--accent); font-weight: 700; border-radius: 9px;
  transition: background-color .2s ease, color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.section-title .add-row:hover { background: var(--accent); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(15, 122, 108, .25); }

/* ---------- certification, approvals, balances, log ---------- */
.paper .cert { background: linear-gradient(135deg, #f7faf9, #eef6f4); border: 1px solid #dcebe7; border-radius: 12px; }
.paper .signs, .paper .bal, .paper .log-list {
  border-collapse: separate; border-spacing: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
}
.paper .signs th, .paper .bal th, .paper .log-list th { background: #f3f8f7; border: 0; border-bottom: 1px solid var(--border); }
.paper .signs td, .paper .bal td, .paper .log-list td { border: 0; border-bottom: 1px solid #eef1f5; }
.paper .signs tr:last-child td, .paper .bal tr:last-child td, .paper .log-list tr:last-child td { border-bottom: 0; }

/* ---------- banners inside the form ---------- */
.paper .banner { border-radius: 12px; }
.paper .form-subnote { border: 1px solid #f6d9ae; }

/* ---------- action bar: frosted glass with lively buttons ---------- */
.actionbar {
  background: rgba(255, 255, 255, .82); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(217, 222, 232, .8); padding: 12px 16px;
}
.actionbar .btn { border-radius: 10px; padding: 10px 20px; transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease, border-color .2s ease; }
.actionbar .btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(16, 24, 40, .12); }
.actionbar .btn.primary, .actionbar .btn.approve { background: linear-gradient(135deg, #0f7a6c, #16957f); border-color: transparent; }
.actionbar .btn.primary:hover, .actionbar .btn.approve:hover { box-shadow: 0 8px 20px rgba(15, 122, 108, .32); }

@media (max-width: 600px) {
  .paper { padding: 26px 14px 18px; }
  .paper .section, .paper .two-col.section > div { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .paper .section, .paper .exp tbody tr { animation: none; }
  .row-del:hover:not(:disabled) { transform: none; }
}
@media print {
  .paper::before, .paper::after { display: none; }
  .paper .section, .paper .two-col.section > div { box-shadow: none !important; animation: none; }
}
.paper .cert .check { background: transparent; padding: 0; }
.paper .cert .check:hover { background: transparent; }

/* ---------- pinned form header (title + notes stay on screen) ---------- */
/* overflow: clip keeps the decorative corners clipped without breaking position: sticky */
.paper { overflow: clip; }
.form-head {
  position: sticky; top: var(--topbar-h, 64px); z-index: 12;
  margin: -28px -30px 18px; padding: 24px 30px 2px;
  background: linear-gradient(180deg, #fff 88%, rgba(255, 255, 255, .96));
  transition: padding .25s ease, box-shadow .25s ease;
}
.form-head .paper-title,
.form-head .form-subnote,
.form-head .banner { transition: font-size .25s ease, margin .25s ease, padding .25s ease, letter-spacing .25s ease; }
.form-head .banner { margin-bottom: 16px; }

.form-head.stuck {
  padding: 10px 30px 2px;
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 18px -10px rgba(16, 24, 40, .22);
  border-bottom: 1px solid var(--border);
}
.form-head.stuck .paper-title { font-size: 18px; letter-spacing: .08em; margin-bottom: 6px; }
.form-head.stuck .form-subnote { font-size: 11.5px; padding: 4px 10px; margin-bottom: 8px; }
.form-head.stuck .banner { font-size: 12.5px; padding: 7px 12px; margin-bottom: 10px; }

@media (max-width: 600px) {
  .form-head { margin: -20px -14px 14px; padding: 18px 14px 2px; }
  .form-head.stuck { padding: 8px 14px 2px; }
  .form-head.stuck .paper-title { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .form-head, .form-head .paper-title, .form-head .form-subnote, .form-head .banner { transition: none; }
}
@media print {
  .form-head, .form-head.stuck { position: static; box-shadow: none; border: 0; backdrop-filter: none; margin: 0 0 12px; padding: 0; }
}
.actionbar:not(:has(.btn)) { display: none; }
