/* =====================================================
   DropBlue - Área do Cliente / Administração
   (complementa style.css)
   ===================================================== */
body.portal { background: var(--blue-50); min-height: 100vh; display: flex; flex-direction: column; }
body.portal main { flex: 1; }

.app-header { background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
.app-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 72px; }
.app-header__brand img { width: 170px; height: auto; }
.app-header__who { display: flex; align-items: center; gap: 1rem; font-size: .9rem; }
.app-header__who strong { display: block; color: var(--blue-900); font-family: var(--font-head); }
.app-header__who small { color: var(--muted); }
.btn--outline { background: transparent; border-color: var(--line); color: var(--ink-soft); }
.btn--outline:hover { background: var(--blue-100); color: var(--blue-800); }
.btn--danger { background: #dc2626; color: var(--white); }
.btn--danger:hover { background: #b91c1c; }
.btn--tiny { padding: .35rem .7rem; font-size: .8rem; }
.btn[disabled] { opacity: .6; cursor: wait; transform: none; box-shadow: none; }

.app { padding: 2rem 0 4rem; }
.app__title { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.app__title h1 { font-size: 1.7rem; margin: 0; }

/* Abas */
.tabs { display: flex; flex-wrap: wrap; gap: .3rem; border-bottom: 2px solid var(--line); margin-bottom: 1.5rem; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -2px; padding: .7rem 1rem; font: inherit; font-weight: 800; color: var(--muted); cursor: pointer; }
.tabs button:hover { color: var(--blue-700); }
.tabs button.active { color: var(--blue-700); border-bottom-color: var(--blue-700); }
.tabs button .count { display: inline-block; min-width: 20px; padding: 0 .4rem; margin-left: .3rem; border-radius: 999px; background: var(--blue-100); color: var(--blue-800); font-size: .75rem; text-align: center; }
.tab-panel[hidden] { display: none; }

/* Blocos */
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
.panel + .panel { margin-top: 1.2rem; }
.panel h2 { font-size: 1.2rem; margin-bottom: 1rem; }
.panel h3 { font-size: 1rem; margin-bottom: .6rem; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.panel__head h2 { margin: 0; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.2rem; margin-bottom: 1.5rem; }
.kpi { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; display: grid; gap: .3rem; }
.kpi__label { font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.kpi__value { font-family: var(--font-head); font-size: 1.7rem; font-weight: 700; color: var(--blue-900); line-height: 1.1; }
.kpi__sub { font-size: .85rem; color: var(--ink-soft); }
.kpi--ok { border-left: 6px solid #16a34a; }
.kpi--erro { border-left: 6px solid #dc2626; }
.kpi--alerta { border-left: 6px solid #f59e0b; }
.kpi--none { border-left: 6px solid var(--line); }

/* Status do backup em destaque */
.backup-hero { display: grid; grid-template-columns: auto 1fr; gap: 1.5rem; align-items: center; }
.backup-hero__icon { width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; font-size: 2.6rem; }
.backup-hero__icon.ok { background: #dcfce7; }
.backup-hero__icon.erro { background: #fee2e2; }
.backup-hero__icon.alerta { background: #fef3c7; }
.backup-hero__icon.none { background: var(--blue-100); }
.backup-hero__title { font-family: var(--font-head); font-size: 1.6rem; font-weight: 700; margin: 0; }
.backup-hero__meta { color: var(--ink-soft); margin: .2rem 0 0; }

/* Badges */
.badge { display: inline-block; padding: .2rem .65rem; border-radius: 999px; font-size: .75rem; font-weight: 800; letter-spacing: .02em; white-space: nowrap; }
.badge--ok, .badge--pago, .badge--ativo, .badge--concluida { background: #dcfce7; color: #166534; }
.badge--erro, .badge--atrasado, .badge--cancelado, .badge--cancelada, .badge--suspenso { background: #fee2e2; color: #991b1b; }
.badge--alerta, .badge--pendente, .badge--em_andamento { background: #fef3c7; color: #92400e; }
.badge--aberta, .badge--executando { background: var(--blue-100); color: var(--blue-800); }
.badge--sem_monitoramento { background: #eef2f7; color: var(--muted); }
.badge--none { background: #eef2f7; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .4rem; background: #cbd5e1; }
.dot--ok { background: #16a34a; } .dot--erro { background: #dc2626; } .dot--alerta { background: #f59e0b; }

/* Tabelas */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: .7rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tr:hover td { background: var(--blue-50); }
.table .actions { white-space: nowrap; display: flex; gap: .3rem; justify-content: flex-end; }
.empty { color: var(--muted); padding: 1.5rem; text-align: center; border: 1px dashed var(--line); border-radius: 10px; }

/* Formulários */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .9rem 1rem; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label, .stack label { display: grid; gap: .3rem; font-size: .85rem; font-weight: 700; color: var(--ink-soft); }
.form-grid input, .form-grid select, .form-grid textarea, .stack input, .stack select, .stack textarea {
  font: inherit; padding: .65rem .8rem; border-radius: 10px; border: 1px solid var(--line); background: var(--white); color: var(--ink); width: 100%;
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus, .stack input:focus, .stack select:focus, .stack textarea:focus { outline: 2px solid var(--blue-500); outline-offset: 1px; }
.form-grid input[readonly] { background: var(--blue-50); color: var(--muted); }
.form-actions { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; margin-top: 1.2rem; }
.stack { display: grid; gap: .9rem; }
.hint { font-size: .82rem; color: var(--muted); }
.notice { padding: .9rem 1.1rem; border-radius: 10px; font-weight: 600; margin-bottom: 1.2rem; }
.notice--warn { background: #fef3c7; color: #92400e; }
.notice--info { background: var(--blue-100); color: var(--blue-800); }
.notice--ok { background: #dcfce7; color: #166534; }
.notice--err { background: #fee2e2; color: #991b1b; }

/* Solicitações */
.req { border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.2rem; display: grid; gap: .5rem; }
.req + .req { margin-top: .8rem; }
.req__head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: center; }
.req__head h3 { margin: 0; font-size: 1rem; }
.req__meta { font-size: .8rem; color: var(--muted); }
.req__body { white-space: pre-wrap; color: var(--ink-soft); }
.req__answer { background: var(--blue-50); border-left: 4px solid var(--blue-500); padding: .7rem .9rem; border-radius: 8px; white-space: pre-wrap; }
.req__answer strong { display: block; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--blue-700); margin-bottom: .2rem; }

/* Login / cadastro */
.auth { display: grid; grid-template-columns: 1fr 1.4fr; gap: 2rem; align-items: start; padding: 3rem 0 4rem; }
.auth--single { grid-template-columns: 1fr; max-width: 480px; }
.auth .panel { padding: 2rem; }
.auth h1 { font-size: 1.5rem; }
.auth__links { display: flex; justify-content: space-between; gap: 1rem; font-size: .85rem; margin-top: .5rem; }

/* Administração */
.admin { display: grid; grid-template-columns: 320px 1fr; gap: 1.5rem; align-items: start; }
.sidebar { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; position: sticky; top: 88px; max-height: calc(100vh - 110px); display: flex; flex-direction: column; }
.sidebar__search { padding: .8rem; border-bottom: 1px solid var(--line); }
.sidebar__search input { width: 100%; font: inherit; padding: .6rem .8rem; border-radius: 10px; border: 1px solid var(--line); }
.sidebar__list { overflow-y: auto; }
.sidebar__item { display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: .8rem 1rem; font: inherit; cursor: pointer; }
.sidebar__item:hover { background: var(--blue-50); }
.sidebar__item.active { background: var(--blue-100); }
.sidebar__item strong { display: block; font-family: var(--font-head); color: var(--blue-900); font-size: .95rem; }
.sidebar__item small { display: flex; gap: .6rem; color: var(--muted); font-size: .78rem; margin-top: .2rem; flex-wrap: wrap; align-items: center; }
.sidebar__home { display: block; width: 100%; background: var(--blue-700); color: var(--white); border: 0; padding: .8rem 1rem; font: inherit; font-weight: 800; cursor: pointer; text-align: left; }
.overview-list a { display: block; padding: .7rem 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.overview-list a:hover { color: var(--blue-700); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--blue-900); color: var(--white); padding: .8rem 1.2rem; border-radius: 10px; font-weight: 700; opacity: 0; transition: .25s; z-index: 100; pointer-events: none; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast--err { background: #b91c1c; }
.toast--ok { background: #15803d; }

@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .admin { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: 320px; }
  .auth { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .kpis { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .backup-hero { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .app-header__brand img { width: 140px; }
  .app-header__who small { display: none; }
}
