/* Identidade visual da Faculdade Península (faculdadepeninsula.edu.br):
   azul petróleo + dourado, títulos em Source Serif, menus/botões em Poppins, texto em Inter. */
:root {
  --bg: #f6f8fa;
  --card: #ffffff;
  --text: #333333;
  --heading: #4d4e4e;
  --muted: #6b6f72;
  --line: #e3e7eb;
  --primary: #005a75;       /* azul petróleo da marca */
  --primary-dark: #00455a;
  --navy: #0d3b52;
  --gold: #ae8d68;          /* dourado da marca (detalhes) */
  --gold-text: #8a6a47;     /* dourado escurecido para texto legível */
  --gold-bg: #f6f0e9;
  --danger: #b42318;
  --warn: #9a5a12;
  --ok-bg: #e7f6ec;
  --ok-text: #146c2e;
  --err-bg: #fdecea;
  --info-bg: #e6f0f3;
  --radius: 12px;
  --font-text: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-ui: "Poppins", var(--font-text);
  --font-title: "Source Serif Pro", "Source Serif 4", Georgia, "Times New Roman", serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font-text);
}
a { color: var(--primary); }
h1, h2 { font-family: var(--font-title); color: var(--heading); font-weight: 600; letter-spacing: -.005em; }
h1 { font-size: 1.6rem; margin: 0 0 .5rem; line-height: 1.2; }
h2 { font-size: 1.25rem; margin: 0 0 .5rem; line-height: 1.25; }
p { margin: 0 0 .75rem; }

.wrap { max-width: 680px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 20px; padding-bottom: 48px; }

/* Cabeçalho branco como no site, com a marca e um fio dourado */
.topbar { background: #fff; color: var(--heading); border-bottom: 1px solid var(--line); box-shadow: inset 0 -3px 0 var(--gold); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; padding-bottom: 3px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--heading); text-decoration: none; }
.brand-mark { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.brand-mark small { font-family: var(--font-ui); font-size: .5rem; letter-spacing: .28em; text-transform: uppercase; margin: 0 0 3px .28em; color: var(--muted); }
.brand-mark strong { font-family: var(--font-title); font-weight: 500; font-size: 1.3rem; letter-spacing: .16em; margin-left: .16em; }
.brand-app {
  font-family: var(--font-ui); font-size: .72rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--gold-text); padding-left: 12px; border-left: 1px solid var(--line); align-self: stretch; display: flex; align-items: center;
}
.topbar-user { display: flex; gap: 12px; align-items: center; margin: 0; font-family: var(--font-ui); font-size: .85rem; }
.topbar-user .muted { color: var(--muted); }
.topbar .link { color: var(--primary); font-weight: 600; text-decoration: none; }
.topbar .link:hover { text-decoration: underline; }
@media (max-width: 380px) { .brand-app { display: none; } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(13, 59, 82, .04);
}
.card.narrow { max-width: 440px; margin: 24px auto; }
.card.empty { text-align: center; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.page-head h1, .page-head h2 { margin: 0; }
.back { display: inline-block; margin-bottom: 12px; text-decoration: none; font-size: .95rem; }
.meta { margin: 8px 0 0; color: var(--muted); font-size: .95rem; }

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.warn { color: var(--warn); font-weight: 600; }

.stack { display: flex; flex-direction: column; gap: 16px; }
[hidden] { display: none !important; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .row { grid-template-columns: 1fr; } }

label, .label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .95rem; margin: 0; }
input[type=text], input[type=email], input[type=date], select {
  font: inherit;
  font-weight: 400;
  padding: 11px 12px;
  border: 1px solid #cdd3d8;
  border-radius: 10px;
  background: #fff;
  width: 100%;
  min-height: 46px;
  color: var(--text);
}
select:focus,
input:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
input.filled { background: var(--gold-bg); }
select:invalid { color: #757575; }
select option { color: var(--text); }

fieldset.choices { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
fieldset.choices legend { font-weight: 600; color: var(--heading); margin-bottom: 8px; padding: 0; }
.choice {
  flex-direction: row; align-items: flex-start; gap: 12px; font-weight: 400;
  border: 1px solid var(--line); border-radius: 8px; padding: 12px; cursor: pointer;
}
.choice:has(input:checked) { border-color: var(--primary); background: var(--info-bg); }
.choice input { margin-top: 4px; width: 18px; height: 18px; flex: none; }
.choice span { display: flex; flex-direction: column; }
.check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; }
.check input { width: 20px; height: 20px; flex: none; margin-top: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 500 .95rem/1.2 var(--font-ui); text-decoration: none; cursor: pointer;
  padding: 11px 20px; min-height: 46px;
  border-radius: 10px; border: 1px solid #cdd3d8; background: #fff; color: var(--heading);
  transition: background-color .15s, border-color .15s;
}
.btn:hover { background: #f3f5f7; border-color: #b9c1c8; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; text-transform: uppercase; letter-spacing: .03em; font-size: .875rem; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn-small { padding: 6px 12px; min-height: 36px; font-size: .9rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .7; cursor: progress; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; text-decoration: underline; }
.link-danger { color: var(--danger); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.danger-zone { text-align: center; margin-top: 8px; }

.alert { border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; }
.alert-error { background: var(--err-bg); color: var(--danger); }
.alert-success { background: var(--ok-bg); color: var(--ok-text); }
.alert-info { background: var(--info-bg); }

.list { list-style: none; margin: 0; padding: 0; }
.list li + li { border-top: 1px solid var(--line); }
.card > .list { margin: 0 -20px; }
.list-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 20px; color: inherit; text-decoration: none;
}
.list > li > a.list-item:hover { background: #f4f8f9; }

/* Gastos do pedido: cada um numa moldura, com × no canto para remover (rascunho) */
.expenses { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.expense { position: relative; }
.expense-body {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fbfcfd; color: inherit; text-decoration: none;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
a.expense-body:hover { border-color: #b3c9d0; background: #fff; box-shadow: 0 2px 8px rgba(16, 42, 67, .07); }
a.expense-body:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.expense-remove { position: absolute; top: -9px; right: -9px; margin: 0; }
.x-btn {
  position: relative; display: grid; place-items: center;
  width: 22px; height: 22px; padding: 0; border-radius: 50%;
  border: 1px solid #f3c7c3; background: #fff; color: var(--danger); cursor: pointer;
  box-shadow: 0 1px 3px rgba(16, 42, 67, .12);
  transition: background-color .15s, color .15s, border-color .15s;
}
.x-btn::before { content: ""; position: absolute; inset: -10px; } /* área de toque maior no celular */
.x-btn:hover, .x-btn:focus-visible { background: var(--danger); border-color: var(--danger); color: #fff; outline: none; }
body > main > .list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
body > main > .list:not(:has(li)) { display: none; }
.list-main { display: flex; flex-direction: column; min-width: 0; }
.list-title { font-weight: 600; overflow-wrap: anywhere; }
.list-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.amount { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.amount.big { font-size: 1.2rem; }

.badge { font-family: var(--font-ui); font-size: .72rem; font-weight: 600; letter-spacing: .02em; padding: 2px 8px; border-radius: 999px; background: #e4e7eb; color: #3e4c59; white-space: nowrap; }
.badge-rascunho { background: var(--gold-bg); color: var(--gold-text); }
.badge-recebido { background: var(--info-bg); color: var(--primary-dark); }
.badge-aprovado { background: #e3eef6; color: var(--navy); }
.badge-pago { background: var(--ok-bg); color: var(--ok-text); }
.badge-recusado { background: var(--err-bg); color: var(--danger); }

.upload { border: 2px dashed #c9b49b; border-radius: var(--radius); padding: 14px; background: #fcfaf7; }
.upload-label { cursor: pointer; gap: 4px; }
.upload-title { font-size: 1rem; color: var(--heading); }
.upload input[type=file] { margin-top: 8px; font: inherit; font-weight: 400; max-width: 100%; }
.upload-list { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.upload-list li { display: flex; align-items: center; gap: 6px; font-size: .85rem; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px 4px 4px; max-width: 100%; }
.upload-list img { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; }
.upload-list .pdf { width: 40px; height: 40px; display: grid; place-items: center; background: var(--err-bg); color: var(--danger); font-weight: 700; border-radius: 4px; font-size: .7rem; }
.upload-list span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.ai-status { margin: 10px 0 0; font-size: .9rem; }
.attached { margin: 6px 0 0; padding-left: 18px; }
.attached li { margin-bottom: 4px; overflow-wrap: anywhere; }
.attached .link { margin-left: 8px; font-size: .875rem; }

.review { width: 100%; border-collapse: collapse; font-size: .95rem; }
.review th, .review td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.review th { font-family: var(--font-ui); font-weight: 600; font-size: .72rem; text-transform: uppercase; color: var(--muted); letter-spacing: .03em; }
.review td:first-child { white-space: nowrap; }
.review .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.review tfoot td { font-weight: 700; border-bottom: 0; }

.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* Tela do pedido: área para soltar/escolher as notas; cada arquivo vira um gasto */
.dropzone {
  border: 2px dashed #c9b49b; border-radius: var(--radius); background: #fcfaf7;
  position: relative; padding: 20px 16px; margin: 4px 0 0; text-align: center; transition: background-color .15s, border-color .15s;
}
.dropzone.dragging { background: var(--gold-bg); border-color: var(--gold); }
.dropzone-label { align-items: center; gap: 4px; cursor: pointer; font-weight: 400; }
.dropzone-icon { font-size: 1.6rem; line-height: 1; }
.dropzone .upload-title { font-weight: 600; }
.dropzone-btn { margin-top: 10px; }
.dropzone-label:hover .dropzone-btn { background: #f3f5f7; border-color: #b9c1c8; }
.dropzone-label:focus-within .dropzone-btn { outline: 2px solid var(--gold); outline-offset: 2px; }
.dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dropzone noscript .btn { margin-top: 10px; }
.receipt-progress { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.receipt-progress li { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px 6px 6px; font-size: .9rem; }
.receipt-progress img, .receipt-progress .pdf { width: 40px; height: 40px; flex: none; border-radius: 4px; object-fit: cover; }
.receipt-progress .pdf { display: grid; place-items: center; background: var(--err-bg); color: var(--danger); font-weight: 700; font-size: .7rem; }
.receipt-text { display: flex; flex-direction: column; min-width: 0; }
.receipt-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.receipt-status { color: var(--muted); overflow-wrap: anywhere; }
.receipt-progress li.ok .receipt-status { color: var(--ok-text); }
.receipt-progress li.warn .receipt-status { color: var(--warn); }
.receipt-progress li.err { border-color: #f3c7c3; }
.receipt-progress li.err .receipt-status { color: var(--danger); }
.receipt-progress li.summary { justify-content: center; background: var(--info-bg); border-color: transparent; padding: 10px; }
.manual-link { margin: 10px 0 0; font-size: .95rem; text-align: center; }
.manual-link a { text-decoration: none; font-weight: 500; }
.manual-link a:hover { text-decoration: underline; }
.expense-pending .expense-body { border-color: #e5c99d; background: #fffaf2; }
.attached-thumb { display: block; margin: 4px 0; }
.attached-thumb img { display: block; max-width: 100%; max-height: 360px; border-radius: 8px; border: 1px solid var(--line); }
