/* ============================================================
   IMxr — Gerador de Relatórios · UI do editor (tema dark)
   Tokens amostrados do IMxr Design System.
   ============================================================ */

@font-face { font-family:"Wix Madefor Display"; font-weight:400; font-display:swap; src:url("../assets/fonts/madefor-display-400.woff2") format("woff2"); }
@font-face { font-family:"Wix Madefor Display"; font-weight:600; font-display:swap; src:url("../assets/fonts/madefor-display-600.woff2") format("woff2"); }
@font-face { font-family:"Wix Madefor Display"; font-weight:700; font-display:swap; src:url("../assets/fonts/madefor-display-700.woff2") format("woff2"); }
@font-face { font-family:"Wix Madefor Display"; font-weight:800; font-display:swap; src:url("../assets/fonts/madefor-display-800.woff2") format("woff2"); }
@font-face { font-family:"Wix Madefor Text"; font-weight:400; font-display:swap; src:url("../assets/fonts/madefor-text-400.woff2") format("woff2"); }
@font-face { font-family:"Wix Madefor Text"; font-weight:500; font-display:swap; src:url("../assets/fonts/madefor-text-500.woff2") format("woff2"); }
@font-face { font-family:"Wix Madefor Text"; font-weight:600; font-display:swap; src:url("../assets/fonts/madefor-text-600.woff2") format("woff2"); }

:root {
  --imxr-cyan: #05aaff;
  --imxr-blue: #0d54fa;
  --imxr-blue-deep: #0b2788;
  --imxr-gradient: linear-gradient(118deg, #05aaff 0%, #0d54fa 52%, #0b2788 100%);
  --ink-1000: #07080c;
  --ink-900: #0c0e13;
  --ink-800: #141821;
  --ink-700: #1c2230;
  --ink-600: #29313f;
  --text-strong: #fff;
  --text-body: #c6cede;
  --text-muted: #8693ab;
  --text-faint: #5b6679;
  --border: rgba(255,255,255,0.10);
  --border-strong: rgba(255,255,255,0.18);
  --ok: #1faa6b;
  --warn: #f0a52a;
  --danger: #e5484d;
  --font-d: "Wix Madefor Display", "Segoe UI", system-ui, sans-serif;
  --font-t: "Wix Madefor Text", "Segoe UI", system-ui, sans-serif;
  --radius: 12px;
  --ease: cubic-bezier(0.22,1,0.36,1);
}

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

body {
  font-family: var(--font-t);
  background: var(--ink-900);
  color: var(--text-body);
  -webkit-font-smoothing: antialiased;
  height: 100vh;
  overflow: hidden;
}

/* halftone dot field on the app shell */
.app::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: radial-gradient(rgba(255,255,255,0.035) 1.4px, transparent 1.6px);
  background-size: 18px 18px;
}

.app { display: grid; grid-template-rows: auto 1fr; height: 100vh; position: relative; z-index: 1; }

/* ── Top bar ── */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px; border-bottom: 1px solid var(--border);
  background: rgba(12,14,19,0.85); backdrop-filter: saturate(140%) blur(14px);
}
.topbar .logo {
  font-family: var(--font-d); font-weight: 800; font-size: 20px; letter-spacing: -0.02em;
  background: var(--imxr-gradient); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.topbar .tagline { font-family: var(--font-d); font-size: 10px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-faint); }
.topbar .spacer { flex: 1; }

/* ── Buttons ── */
.btn {
  font-family: var(--font-d); font-weight: 700; font-size: 13px; letter-spacing: 0.01em;
  border: 1px solid var(--border-strong); background: var(--ink-700); color: var(--text-strong);
  padding: 9px 16px; border-radius: 100px; cursor: pointer; transition: all var(--ease) 160ms;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
}
.btn:hover { border-color: var(--imxr-cyan); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--imxr-blue); border-color: transparent; color: #fff;
  box-shadow: 0 8px 30px rgba(13,84,250,0.35), inset 0 1px 0 rgba(255,255,255,0.18);
}
.btn-primary:hover { background: #1f63ff; border-color: transparent; box-shadow: 0 10px 34px rgba(13,84,250,0.45); }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-ghost:hover { background: var(--ink-800); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-danger:hover { border-color: var(--danger); color: #ffb4b6; }
.btn-icon { padding: 7px; border-radius: 8px; line-height: 1; }

/* ── Layout: editor | preview ── */
.workspace { display: grid; grid-template-columns: minmax(380px, 460px) 1fr; overflow: hidden; }
.workspace.wide-preview { grid-template-columns: 1fr; }
.workspace.wide-preview .editor { display: none; }

.editor { overflow-y: auto; padding: 22px; border-right: 1px solid var(--border); }
.preview-wrap { overflow-y: auto; background: #d7dbe2; padding: 30px 20px; }

/* scrollbars */
.editor::-webkit-scrollbar, .preview-wrap::-webkit-scrollbar { width: 10px; }
.editor::-webkit-scrollbar-thumb, .preview-wrap::-webkit-scrollbar-thumb { background: rgba(120,130,150,0.4); border-radius: 10px; }

/* ── Editor sections ── */
.section-title {
  font-family: var(--font-d); font-size: 11px; font-weight: 700; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--imxr-cyan); margin: 4px 0 14px;
}
.card {
  background: var(--ink-800); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px;
}
.card.store-card { border-left: 2px solid var(--imxr-cyan); }
.store-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.store-card-head .num {
  font-family: var(--font-d); font-weight: 800; font-size: 12px; color: var(--imxr-cyan);
  background: rgba(5,170,255,0.12); border-radius: 8px; padding: 3px 9px; letter-spacing: 0.04em;
}
.store-card-head .title { font-family: var(--font-d); font-weight: 700; font-size: 14px; color: var(--text-strong); flex: 1; }

/* ── Form fields ── */
.field { margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block; font-family: var(--font-d); font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px;
}
.row { display: grid; gap: 10px; }
.row-2 { grid-template-columns: 1fr 1fr; }
.row-3 { grid-template-columns: 2fr 1fr 1fr; }

input[type="text"], input[type="date"], textarea, select {
  width: 100%; font-family: var(--font-t); font-size: 13.5px; color: var(--text-strong);
  background: var(--ink-900); border: 1px solid var(--border); border-radius: 9px;
  padding: 9px 11px; transition: border-color var(--ease) 140ms, box-shadow var(--ease) 140ms;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--imxr-cyan); box-shadow: 0 0 0 3px rgba(5,170,255,0.15);
}
textarea { resize: vertical; min-height: 60px; line-height: 1.5; }
select { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' stroke='%238693ab' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px;
}

/* ── Repeatable bullet lists ── */
.bullets { display: flex; flex-direction: column; gap: 8px; }
.bullet-row { display: flex; gap: 8px; align-items: flex-start; }
.bullet-row .mark { flex-shrink: 0; width: 22px; height: 34px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; }
.mark-good { color: var(--ok); }
.mark-bad { color: var(--warn); }
.mark-act { color: var(--imxr-cyan); }
.bullet-row input { flex: 1; }
.bullet-row .btn-icon { align-self: center; }

.sub-label {
  display: flex; align-items: center; gap: 8px; margin: 14px 0 8px;
  font-family: var(--font-d); font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted);
}
.sub-label .dot { width: 7px; height: 7px; border-radius: 50%; }
.sub-label .spacer { flex: 1; }

.add-line { margin-top: 8px; }

/* ── Photo gallery editor ── */
.photos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; margin-top: 8px; }
.photo-thumb { position: relative; border-radius: 9px; overflow: hidden; border: 1px solid var(--border); aspect-ratio: 4/3; background: var(--ink-900); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb .remove {
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(7,8,12,0.75); color: #fff; border: none; cursor: pointer; font-size: 12px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.photo-thumb .remove:hover { background: var(--danger); }
.dropzone {
  border: 1px dashed var(--border-strong); border-radius: 9px; padding: 16px; text-align: center;
  color: var(--text-muted); font-size: 12px; cursor: pointer; transition: all var(--ease) 140ms; margin-top: 8px;
}
.dropzone:hover, .dropzone.drag { border-color: var(--imxr-cyan); color: var(--text-body); background: rgba(5,170,255,0.06); }

/* ── Next steps rows ── */
.next-editor-row { display: grid; grid-template-columns: 1fr 1.6fr 110px 32px; gap: 8px; align-items: center; margin-bottom: 8px; }

/* ── Divider / helper ── */
.hr { height: 1px; background: var(--border); margin: 20px 0; }
.muted-note { font-size: 12px; color: var(--text-faint); line-height: 1.5; }
.count-pill {
  font-family: var(--font-d); font-size: 10px; font-weight: 700; color: var(--text-muted);
  background: var(--ink-700); border-radius: 100px; padding: 2px 9px;
}

/* ── Toast ── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink-700); border: 1px solid var(--border-strong); color: var(--text-strong);
  padding: 11px 20px; border-radius: 100px; font-family: var(--font-d); font-weight: 600; font-size: 13px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55); opacity: 0; pointer-events: none;
  transition: all var(--ease) 240ms; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.section-toggle { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.section-toggle .spacer { flex: 1; }

/* ── Views (SPA) ── */
.view { display: none; height: 100%; overflow: hidden; }
.view.active { display: block; }
#view-editor.active, #view-shared.active { display: grid; grid-template-rows: auto 1fr; }

/* ── Home: lista de relatórios ── */
.home { height: 100%; overflow-y: auto; padding: 40px clamp(24px, 6vw, 80px); }
.home-head { display: flex; align-items: flex-end; gap: 18px; margin-bottom: 32px; flex-wrap: wrap; }
.home-head h1 { font-family: var(--font-d); font-weight: 800; font-size: 32px; letter-spacing: -0.03em; color: var(--text-strong); }
.home-head h1 .grad { background: var(--imxr-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.home-head p { color: var(--text-muted); font-size: 14px; margin-top: 4px; }
.home-head .spacer { flex: 1; }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; padding-bottom: 60px; }

.report-card {
  background: var(--ink-800); border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
  cursor: pointer; transition: all var(--ease) 180ms; display: flex; flex-direction: column;
}
.report-card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: 0 24px 60px rgba(0,0,0,0.45); }
.report-card .thumb {
  height: 150px; background: var(--ink-700) center/cover no-repeat; position: relative;
  border-bottom: 1px solid var(--border);
}
.report-card .thumb.empty { display: flex; align-items: center; justify-content: center; }
.report-card .thumb.empty::after {
  content: "IMxr"; font-family: var(--font-d); font-weight: 800; font-size: 26px; letter-spacing: -0.02em;
  background: var(--imxr-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; opacity: 0.6;
}
.report-card .thumb .count { position: absolute; bottom: 8px; right: 8px; font-family: var(--font-d); font-size: 10px; font-weight: 700; background: rgba(7,8,12,0.7); color: #fff; padding: 3px 9px; border-radius: 100px; }
.report-card .body { padding: 16px; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.report-card h3 { font-family: var(--font-d); font-weight: 700; font-size: 16px; color: var(--text-strong); line-height: 1.25; }
.report-card .meta-line { font-size: 12px; color: var(--text-muted); }
.report-card .stats { display: flex; gap: 14px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.report-card .stat { display: flex; flex-direction: column; }
.report-card .stat .n { font-family: var(--font-d); font-weight: 800; font-size: 15px; color: var(--text-strong); }
.report-card .stat .l { font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.08em; }
.report-card .actions { display: flex; gap: 6px; padding: 0 12px 12px; }
.report-card .actions .btn { flex: 1; justify-content: center; }

.empty-state { text-align: center; padding: 80px 20px; color: var(--text-muted); }
.empty-state h2 { font-family: var(--font-d); font-size: 22px; color: var(--text-strong); margin-bottom: 8px; }

/* ── Editor toolbar (topo do editor) ── */
.editor-bar { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--border); background: rgba(12,14,19,0.85); backdrop-filter: saturate(140%) blur(14px); }
.editor-bar .doc-name { font-family: var(--font-d); font-weight: 700; font-size: 14px; color: var(--text-strong); max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-bar .spacer { flex: 1; }
.save-status { font-family: var(--font-d); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; color: var(--text-faint); display: flex; align-items: center; gap: 6px; }
.save-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); }
.save-status[data-state="saved"]::before { background: var(--ok); }
.save-status[data-state="saving"] { color: var(--text-muted); }
.save-status[data-state="saving"]::before { background: var(--warn); animation: pulse 1s ease-in-out infinite; }
.save-status[data-state="error"] { color: var(--danger); }
.save-status[data-state="error"]::before { background: var(--danger); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
.readonly-badge { font-family: var(--font-d); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; color: var(--text-faint); border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; background: var(--ink-800); border: 1px solid var(--border); border-radius: 100px; padding: 3px; }
.tab { font-family: var(--font-d); font-weight: 700; font-size: 12.5px; color: var(--text-muted); background: transparent; border: none; padding: 7px 16px; border-radius: 100px; cursor: pointer; transition: all var(--ease) 160ms; }
.tab.active { background: var(--imxr-blue); color: #fff; }
.tab:not(.active):hover { color: var(--text-body); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Despesas editor ── */
.exp-card { background: var(--ink-900); border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.exp-card-top { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.exp-card-top input { flex: 1; min-width: 0; }
.exp-card-top .btn-icon { flex-shrink: 0; }
.exp-card-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.exp-card-grid .field { margin-bottom: 0; min-width: 0; }
.exp-card-attach { margin-top: 10px; border-radius: 9px; transition: outline-color var(--ease) 140ms; outline: 2px dashed transparent; outline-offset: 2px; }
.exp-card-attach.drag { outline-color: var(--imxr-cyan); }
.exp-attach-dropzone { margin-top: 0; padding: 12px; font-size: 12px; }
.exp-attach-chip { display: flex; align-items: center; gap: 8px; background: var(--ink-800); border: 1px solid var(--border); border-radius: 9px; padding: 6px 8px; }
.exp-attach-chip img { width: 32px; height: 32px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.exp-attach-icon { width: 32px; height: 32px; border-radius: 6px; background: var(--ink-700); color: var(--text-muted); font-family: var(--font-d); font-size: 9px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.exp-attach-name { flex: 1; min-width: 0; font-size: 12px; color: var(--text-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exp-attach-chip .btn-icon { flex-shrink: 0; }
.exp-total-line { display: flex; align-items: baseline; justify-content: space-between; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.exp-total-line .lbl { font-family: var(--font-d); font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }
.exp-total-line .val { font-family: var(--font-d); font-size: 22px; font-weight: 800; color: var(--text-strong); letter-spacing: -0.02em; }
input[type="number"] { width: 100%; font-family: var(--font-t); font-size: 13.5px; color: var(--text-strong); background: var(--ink-900); border: 1px solid var(--border); border-radius: 9px; padding: 9px 11px; }
input[type="number"]:focus { outline: none; border-color: var(--imxr-cyan); box-shadow: 0 0 0 3px rgba(5,170,255,0.15); }

.video-badge-mini { position: absolute; bottom: 4px; left: 4px; font-size: 9px; font-weight: 700; background: rgba(7,8,12,0.75); color: #fff; padding: 1px 6px; border-radius: 100px; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .editor { border-right: none; border-bottom: 1px solid var(--border); }
}
