:root {
  --red: #CA0011;
  --red-dark: #95000c;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --soft: #f9fafb;
  --green: #047857;
  --blue: #1d4ed8;
  --shadow: 0 18px 45px rgba(0, 0, 0, .12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Segoe UI, Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(202,0,17,.12), transparent 34%),
    linear-gradient(180deg, #fff, var(--bg));
  color: var(--text);
}

.hidden { display: none !important; }

.page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
}

.access-card {
  width: 100%;
  max-width: 460px;
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.8);
}

.header {
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: #fff;
  padding: 28px 24px;
  text-align: center;
}

.header .icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 12px;
  border-radius: 18px;
  background: rgba(255,255,255,.16);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.header h1 { margin: 0; font-size: 26px; letter-spacing: -.4px; }
.header p { margin: 7px 0 0; opacity: .92; font-size: 14px; font-weight: 500; }

.content { padding: 25px; }
.step-title { margin: 0 0 18px; font-size: 18px; font-weight: 800; color: #111827; }
.form-group { margin-bottom: 17px; }

label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 700;
  color: #374151;
}

input, select {
  width: 100%;
  height: 46px;
  border: 1px solid #d7d7d7;
  border-radius: 12px;
  padding: 0 13px;
  font-size: 15px;
  background: #fff;
  outline: none;
  transition: .18s;
}

input:focus, select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(202,0,17,.12);
}

.btn {
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--red);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  transition: .18s;
}

.btn:hover { background: var(--red-dark); transform: translateY(-1px); }
.btn:disabled { background: #c8c8c8; cursor: not-allowed; transform: none; }

.btn-light {
  background: #fff;
  color: var(--red);
  border: 1px solid var(--red);
  margin-top: 10px;
}

.btn-light:hover { background: #fff5f6; color: var(--red); }

.msg {
  display: none;
  margin-top: 14px;
  padding: 12px 13px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.35;
}

.msg.ok { display: block; color: var(--green); background: #ecfdf5; border: 1px solid #a7f3d0; }
.msg.erro { display: block; color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; }

.footer-link { text-align: center; margin-top: 19px; font-size: 13px; }
.footer-link a { text-decoration: none; color: var(--red); font-weight: 800; }

.cliente-box {
  padding: 15px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--soft);
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--muted);
}

.cliente-box strong { display: block; margin-top: 5px; color: #111827; font-size: 17px; }

.channel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.channel { border: 1px solid var(--border); background: #fff; border-radius: 14px; padding: 13px; cursor: pointer; font-size: 13px; font-weight: 800; text-align: center; color: #374151; }
.channel.active { border-color: var(--red); color: var(--red); box-shadow: 0 0 0 3px rgba(202,0,17,.10); }
.channel.disabled { opacity: .45; cursor: not-allowed; background: #f3f4f6; }
.channel small { display:block; margin-top:6px; font-size:12px; color: var(--muted); font-weight:700; }
.code-area { margin-top: 18px; }
.success-strip { padding: 12px 13px; border-radius: 12px; background: #ecfdf5; color: var(--green); border: 1px solid #a7f3d0; font-size: 14px; margin-bottom: 15px; font-weight: 700; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  min-height: 72px;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: #fff;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 10px 25px rgba(149,0,12,.22);
}

.brand h1 { margin: 0; font-size: 21px; }
.brand p { margin: 3px 0 0; font-size: 13px; opacity: .9; }
.user-area { display: flex; align-items: center; gap: 12px; font-size: 13px; text-align: right; }

.btn-sair {
  border: 1px solid rgba(255,255,255,.65);
  background: rgba(255,255,255,.12);
  color: #fff;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
}

.main { width: 100%; max-width: 1120px; margin: 0 auto; padding: 24px; flex: 1; }
.panel { background: #fff; border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 10px 28px rgba(0,0,0,.07); overflow: hidden; }
.panel-head { padding: 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.panel-head h2 { margin: 0; font-size: 20px; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.portal-resumo {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fff, #fffafa);
}

.card-resumo {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 8px 24px rgba(0,0,0,.05);
}

.resumo-icon {
  width: 56px;
  height: 56px;
  min-width: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 27px;
}

.red-soft { background: #ffe4e8; color: var(--red); }
.green-soft { background: #dcfce7; color: var(--green); }
.blue-soft { background: #dbeafe; color: var(--blue); }
.resumo-title { font-size: 13px; color: #374151; font-weight: 800; }
.resumo-value { margin-top: 5px; font-size: 22px; color: var(--red); font-weight: 900; letter-spacing: .01em; }
.resumo-value.green { color: var(--green); }
.resumo-value.blue { color: var(--blue); }
.resumo-sub { margin-top: 4px; color: var(--muted); font-size: 12px; }

.filters { padding: 18px 20px; display: grid; grid-template-columns: 1.4fr .7fr .7fr auto; gap: 12px; border-bottom: 1px solid var(--border); background: var(--soft); align-items: end; }
.filters .btn { height: 44px; min-width: 120px; }
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; }
th { color: #374151; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; background: #fff; }
tr:hover td { background: #fffafa; }

.status { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; background: #ecfdf5; color: var(--green); font-weight: 800; font-size: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mini-btn { height: 34px; border: 1px solid var(--border); background: #fff; border-radius: 10px; padding: 0 10px; font-weight: 800; color: var(--red); cursor: pointer; }
.mini-btn:hover { border-color: var(--red); background: #fff5f6; }
.mini-btn.refresh { height: 40px; padding: 0 14px; color: #1f2937; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); font-size: 15px; }

.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; width: 380px; max-width: 92vw; height: 100vh; background: #fff; z-index: 30; box-shadow: -18px 0 45px rgba(0,0,0,.22); display: flex; flex-direction: column; }
.drawer-head { padding: 20px; background: linear-gradient(135deg, var(--red), var(--red-dark)); color: #fff; }
.drawer-head h3 { margin: 0; font-size: 20px; }
.drawer-head p { margin: 5px 0 0; opacity: .9; }
.drawer-body { padding: 20px; flex: 1; }
.detail-row { padding: 13px 0; border-bottom: 1px solid var(--border); }
.detail-row span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.detail-row strong { display: block; margin-top: 4px; color: #111827; font-size: 15px; }
.drawer-actions { padding: 20px; border-top: 1px solid var(--border); }

@media (max-width: 900px) {
  .portal-resumo { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .user-area { width: 100%; justify-content: space-between; text-align: left; }
  .main { padding: 14px; }
  .filters { grid-template-columns: 1fr; }
  .panel-head { flex-direction: column; align-items: flex-start; }
  .channel-grid { grid-template-columns: 1fr; }
  .page { padding: 14px; align-items: flex-start; }
  .access-card { margin-top: 20px; }
}

/* Ajuda ao Paciente */
.help-panel { margin-top: 22px; }
.help-panel-head { background: linear-gradient(180deg, #fff, #fffafa); }
.help-heading { display: flex; align-items: center; gap: 14px; }
.help-heading-icon {
  width: 52px;
  height: 52px;
  min-width: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffe4e8;
  color: var(--red);
  font-size: 22px;
  font-weight: 900;
}

.help-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 20px;
}

.help-card {
  min-height: 92px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  text-align: left;
}

button.help-card { font: inherit; cursor: pointer; }
.help-card-active { border: 2px solid rgba(202,0,17,.30); box-shadow: 0 8px 22px rgba(202,0,17,.08); transition: .18s; }
.help-card-active:hover,
.help-card-active:focus-visible { border-color: var(--red); background: #fff8f8; transform: translateY(-1px); outline: none; }
.help-card-coming { background: #fafafa; }
.help-card-icon {
  width: 54px;
  height: 54px;
  min-width: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #f3f4f6;
  font-size: 27px;
}
.help-card-active .help-card-icon { background: #ffe4e8; }
.help-card-content { flex: 1; min-width: 0; }
.help-card-content strong { display: block; font-size: 17px; line-height: 1.25; color: #111827; }
.help-card-content small { display: block; margin-top: 6px; font-size: 14px; color: var(--muted); line-height: 1.35; }
.help-card-action {
  min-width: 102px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--red);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
}
.help-badge {
  padding: 7px 10px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #4b5563;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.help-drawer { width: 560px; max-width: 96vw; }
.help-drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.drawer-close {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border: 1px solid rgba(255,255,255,.65);
  border-radius: 50%;
  background: rgba(255,255,255,.14);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}
.help-drawer-body { overflow-y: auto; }
.help-video-intro { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.help-video-icon {
  width: 58px;
  height: 58px;
  min-width: 58px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffe4e8;
  font-size: 30px;
}
.help-video-intro strong { display: block; font-size: 19px; line-height: 1.3; }
.help-video-intro p { margin: 5px 0 0; color: var(--muted); font-size: 15px; line-height: 1.4; }
.video-box { overflow: hidden; border-radius: 16px; border: 1px solid var(--border); background: #111; box-shadow: 0 10px 25px rgba(0,0,0,.12); }
.video-box video { display: block; width: 100%; max-height: 62vh; background: #000; }
.help-note { margin: 16px 0 0; padding: 14px; border-radius: 12px; background: #f9fafb; color: #4b5563; font-size: 15px; line-height: 1.45; }
.help-close-btn { margin-top: 0; min-height: 52px; font-size: 17px; }
body.drawer-open { overflow: hidden; }

@media (max-width: 760px) {
  .help-grid { grid-template-columns: 1fr; padding: 14px; }
  .help-card { min-height: 104px; padding: 14px; }
  .help-card-content strong { font-size: 16px; }
  .help-card-action { min-width: 88px; }
  .help-badge { align-self: flex-start; }
  .help-drawer { width: 100%; max-width: 100vw; }
}

@media (max-width: 470px) {
  .help-card { align-items: flex-start; flex-wrap: wrap; }
  .help-card-content { min-width: calc(100% - 72px); }
  .help-card-action, .help-badge { margin-left: 68px; }
}


/* ============================================================
   AJUDA AO PACIENTE - GRUPOS DE VIDEOS
   ============================================================ */
.help-groups { padding: 4px 0 20px; }
.help-group { border-bottom: 1px solid var(--border); }
.help-group:last-child { border-bottom: 0; }
.help-group-title {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 0;
}
.help-group-title > span {
  width: 42px;
  height: 42px;
  min-width: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  background: #fff1f2;
  font-size: 22px;
}
.help-group-title h3 { margin: 0; font-size: 18px; color: #111827; }
.help-group-title p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.help-group .help-grid { padding-top: 14px; }

@media (max-width: 760px) {
  .help-group-title { padding: 18px 14px 0; }
}
