/* Relatório Diário — interface otimizada para iPhone e desktop */
:root{
  --navy:#06131f;
  --navy-2:#0a1b2a;
  --blue:#0a66ff;
  --blue-2:#1b73ff;
  --text:#111827;
  --muted:#6b7280;
  --line:#dfe5ec;
  --panel:#ffffff;
  --bg:#f5f7fa;
  --success:#12a05c;
  --danger:#d83b3b;
  --shadow:0 16px 50px rgba(7,21,34,.12);
  --radius:22px;
  --safe-bottom:max(14px, env(safe-area-inset-bottom));
}

*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%; background:var(--navy)}
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Display","SF Pro Text","Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  -webkit-font-smoothing:antialiased;
}
button,input,textarea{font:inherit}
button{-webkit-tap-highlight-color:transparent}
button:focus-visible,input:focus-visible,textarea:focus-visible{outline:3px solid rgba(10,102,255,.25);outline-offset:2px}

.app-shell{min-height:100vh;padding-bottom:118px}
.topbar{
  background:linear-gradient(180deg,var(--navy),#091a29);
  color:#fff;
  padding:calc(18px + env(safe-area-inset-top)) 20px 28px;
}
.topbar-inner{max-width:980px;margin:0 auto;display:flex;gap:18px;align-items:flex-end;justify-content:space-between}
.eyebrow{font-size:11px;letter-spacing:.13em;opacity:.58;margin:0 0 8px;font-weight:700}
h1{font-size:clamp(31px,7vw,44px);line-height:1.03;margin:0;font-weight:800;letter-spacing:-.035em}
.subtitle{margin:10px 0 0;color:rgba(255,255,255,.68);font-size:14px;line-height:1.45;max-width:480px}

.language-pill{
  display:flex;align-items:center;gap:10px;color:white;background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.15);border-radius:16px;padding:10px 12px;min-width:112px;
}
.language-pill small{display:block;color:rgba(255,255,255,.58);font-size:10px;line-height:1}
.language-pill strong{display:block;font-size:15px;margin-top:4px}
.globe{font-size:22px}.chev{margin-left:auto;opacity:.6}

.content{max-width:980px;margin:-1px auto 0;padding:20px}
.hero-grid{display:grid;grid-template-columns:1fr 150px;gap:14px}
.panel,.counter-panel{
  background:#fff;border:1px solid var(--line);border-radius:20px;box-shadow:0 5px 25px rgba(8,24,40,.04)
}
.panel{padding:18px}.counter-panel{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:16px}
.section-label{font-size:12px;font-weight:800;letter-spacing:.06em;color:#697586}
.counter-panel strong{font-size:42px;line-height:1;margin:8px 0 5px}.counter-panel span:last-child{font-size:13px;color:var(--muted)}
.segmented{margin-top:12px;display:grid;grid-template-columns:repeat(3,1fr);padding:4px;background:#f0f3f7;border-radius:15px}
.segmented button{border:0;background:transparent;border-radius:12px;min-height:52px;font-weight:800;font-size:20px;color:#26313c}
.segmented button.active{background:var(--blue);color:white;box-shadow:0 6px 18px rgba(10,102,255,.25)}
.hint{font-size:12px;color:var(--muted);margin:10px 2px 0}

.toolbar{display:flex;align-items:end;justify-content:space-between;gap:12px;margin:26px 2px 12px}
.toolbar h2{font-size:19px;margin:0 0 3px}.toolbar p{font-size:12px;color:var(--muted);margin:0}
.ghost-btn{border:0;background:transparent;color:var(--blue);font-weight:700;padding:10px}

.groups{display:grid;gap:10px}
.group{
  background:#fff;border:1px solid var(--line);border-radius:18px;overflow:hidden;
  box-shadow:0 5px 24px rgba(8,24,40,.035)
}
.group-head{
  width:100%;min-height:72px;padding:14px 15px;border:0;background:white;display:flex;align-items:center;gap:13px;text-align:left
}
.group-title{flex:1}.group-title strong{display:block;font-size:16px}.group-title small{display:block;color:var(--muted);margin-top:4px}
.group-arrow{font-size:24px;color:#4c5a68;transform:rotate(0);transition:.18s}
.group.open .group-arrow{transform:rotate(90deg)}
.group-body{display:none;border-top:1px solid var(--line)}
.group.open .group-body{display:block}

.activity-row{
  display:grid;grid-template-columns:38px 1fr auto;align-items:center;gap:10px;min-height:62px;padding:8px 12px;
  border-bottom:1px solid #edf0f4
}
.activity-row:last-child{border-bottom:0}
.check{
  appearance:none;width:27px;height:27px;border:1.8px solid #aab6c3;border-radius:8px;background:white;display:grid;place-content:center;margin:0
}
.check:checked{background:var(--blue);border-color:var(--blue)}
.check:checked::after{content:"✓";font-size:18px;color:white;font-weight:900;line-height:1}
.activity-main{min-width:0}
.activity-name{font-size:14px;font-weight:650;line-height:1.25}
.activity-summary{font-size:11px;color:var(--blue);margin-top:5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.activity-edit{
  border:0;background:#f4f7fb;color:#314050;border-radius:10px;min-width:40px;height:40px;font-size:19px
}

.sticky-actions{
  position:fixed;left:0;right:0;bottom:0;z-index:20;padding:10px 14px var(--safe-bottom);
  background:rgba(250,251,253,.88);backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px);
  border-top:1px solid rgba(210,218,227,.9);display:grid;grid-template-columns:minmax(150px,.72fr) minmax(190px,1.28fr);gap:10px
}
.sticky-actions>button{min-height:64px;border-radius:16px;padding:10px 13px;display:flex;align-items:center;justify-content:center;gap:10px;border:0;text-align:left}
.sticky-actions strong{display:block;font-size:14px}.sticky-actions small{display:block;font-size:10px;margin-top:3px;opacity:.75}
.secondary-action{background:white;color:#1d2936;border:1px solid var(--line)!important}
.primary-action{background:linear-gradient(135deg,var(--blue),var(--blue-2));color:white;box-shadow:0 8px 22px rgba(10,102,255,.23)}
.count-badge{width:30px;height:30px;border-radius:50%;display:grid;place-items:center;background:#e8f0ff;color:var(--blue);font-weight:800}
.copy-icon{font-size:24px}

.sheet{border:0;padding:0;background:transparent;max-width:none;width:100%;height:100%}
.sheet::backdrop{background:rgba(1,8,14,.54);backdrop-filter:blur(2px)}
.sheet[open]{display:flex;align-items:flex-end;justify-content:center}
.sheet-card{
  width:min(680px,100%);max-height:88vh;background:#fff;border-radius:24px 24px 0 0;padding:10px 18px calc(18px + env(safe-area-inset-bottom));
  box-shadow:var(--shadow);overflow:auto
}
.sheet-card.tall{max-height:92vh}
.grabber{width:42px;height:5px;background:#d7dce2;border-radius:999px;margin:1px auto 15px}
.sheet-head{display:flex;align-items:flex-start;justify-content:space-between;gap:15px}
.sheet-head small{font-size:10px;letter-spacing:.09em;color:#778493;font-weight:800}
.sheet-head h3{font-size:22px;margin:4px 0 0}
.icon-btn{border:0;background:#f0f3f7;border-radius:50%;width:38px;height:38px;font-size:24px;color:#40505e}

.form-grid{display:grid;gap:14px;margin-top:18px}
.field label{font-size:12px;font-weight:750;color:#4f5d6b;display:block;margin:0 0 7px}
.field input,.field textarea{
  width:100%;border:1px solid #d8dfe7;border-radius:12px;min-height:48px;padding:10px 12px;background:#fbfcfd;color:#111827
}
.field textarea{min-height:86px;resize:vertical}
.field-row{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}
.sheet-actions{display:grid;grid-template-columns:1fr 1.35fr;gap:10px;margin-top:20px}
.btn{border:0;border-radius:14px;min-height:52px;font-weight:800}
.btn.muted{background:#eef2f6;color:#283643}.btn.blue{background:var(--blue);color:white}
.sheet-help{font-size:12px;color:var(--muted);margin:10px 0 14px}

.selected-list{display:grid;gap:8px}
.selected-item{display:grid;grid-template-columns:30px 1fr 42px;gap:9px;align-items:center;border:1px solid var(--line);border-radius:14px;padding:10px;background:#fff}
.drag{font-size:22px;color:#99a5b2;cursor:grab;user-select:none;text-align:center}
.selected-item strong{font-size:13px;display:block}
.selected-item small{font-size:11px;color:var(--muted);display:block;margin-top:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.remove{border:0;background:#fff1f1;color:var(--danger);border-radius:10px;width:36px;height:36px;font-size:18px}

.report-meta{display:flex;gap:8px;flex-wrap:wrap;margin:14px 0}
.report-meta span{font-size:11px;background:#f0f4f8;border-radius:999px;padding:7px 10px;color:#506070}
#reportOutput{width:100%;min-height:340px;border:1px solid var(--line);border-radius:16px;padding:16px;background:#fbfcfd;line-height:1.55;font-size:14px;resize:none}
.copy-feedback{text-align:center;color:var(--success);font-weight:700;min-height:18px;font-size:12px;margin:10px 0 0}

@media (max-width:620px){
  .topbar-inner{align-items:flex-start}
  .language-pill{min-width:98px}
  .hero-grid{grid-template-columns:1fr 108px}
  .counter-panel strong{font-size:35px}
  .content{padding:16px 14px}
}
@media (max-width:420px){
  .subtitle{max-width:235px}
  .hero-grid{grid-template-columns:1fr}
  .counter-panel{display:none}
  .sticky-actions{grid-template-columns:1fr 1.45fr}
  .sticky-actions small{display:none}
  .field-row{grid-template-columns:1fr}
  .stacked-mobile{grid-template-columns:1fr}
}

/* v2: clean technical list — no decorative icons in report stages */
.group-head{gap:10px}
.group-title strong{font-size:16px;letter-spacing:-.01em}
.activity-row{grid-template-columns:38px 1fr auto}
.activity-name{font-weight:650}

/* v3: reordenação confiável no iPhone — botões de subir/descer */
.selected-item{
  grid-template-columns:32px minmax(0,1fr) 82px 38px;
  gap:8px;
  touch-action:manipulation;
  user-select:none;
  -webkit-user-select:none;
}
.order-number{
  width:28px;height:28px;border-radius:9px;background:#eef4ff;color:#0a66ff;
  display:grid;place-items:center;font-size:12px;font-weight:850;
}
.selected-copy{min-width:0}
.reorder-controls{display:grid;grid-template-columns:1fr 1fr;gap:5px}
.move-btn{
  width:38px;height:40px;border:1px solid #dbe3ec;border-radius:10px;background:#f7f9fc;
  color:#1f4f8f;font-size:20px;font-weight:800;line-height:1;
  -webkit-tap-highlight-color:transparent;
}
.move-btn:active:not(:disabled){transform:scale(.94);background:#e8f0ff}
.move-btn:disabled{opacity:.25}
.empty-selected{padding:30px 12px;text-align:center;color:#7a8794;font-size:13px}
@media(max-width:420px){
  .selected-item{grid-template-columns:30px minmax(0,1fr) 78px 36px}
  .move-btn{width:36px}
}

/* v4 — controles de ordem grandes e explícitos para Safari/Chrome no iPhone */
.selected-item{
  grid-template-columns:32px minmax(0,1fr) 112px 40px !important;
  align-items:center;
  padding:11px 10px !important;
}
.reorder-controls{
  display:flex !important;
  flex-direction:column;
  gap:6px;
  width:106px;
}
.move-btn{
  display:flex !important;
  align-items:center;
  justify-content:center;
  gap:5px;
  width:106px !important;
  height:40px !important;
  padding:0 8px;
  border:1px solid #cdd9e7 !important;
  border-radius:10px !important;
  background:#eef4ff !important;
  color:#075dcc !important;
  font-size:12px !important;
  font-weight:800 !important;
  visibility:visible !important;
  opacity:1;
  -webkit-appearance:none;
  appearance:none;
  touch-action:manipulation;
}
.move-btn span{font-size:18px;line-height:1}
.move-btn:disabled{opacity:.28 !important}
.selected-copy,.selected-copy *{
  -webkit-user-select:none !important;
  user-select:none !important;
}
@media(max-width:420px){
  .selected-item{grid-template-columns:28px minmax(0,1fr) 94px 36px !important}
  .reorder-controls,.move-btn{width:90px !important}
  .move-btn{font-size:11px !important}
}

/* v5 — lista única de atividades, sem separação por processos */
.groups{display:block}
.single-activity-list{
  background:#fff;
  border:1px solid var(--line);
  border-radius:18px;
  overflow:hidden;
  box-shadow:0 5px 24px rgba(8,24,40,.035);
}
.single-row{
  grid-template-columns:38px minmax(0,1fr) 42px;
  min-height:64px;
}
.single-row .activity-spacer{width:42px;height:1px}
.single-row .activity-name{font-size:14px}
.single-row .activity-summary{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.version-chip{
  display:inline-block;
  margin-left:6px;
  padding:2px 6px;
  border:1px solid rgba(255,255,255,.22);
  border-radius:999px;
  font-size:10px;
  font-weight:800;
  color:rgba(255,255,255,.72);
  vertical-align:1px;
}
