/* ============================================================
   Sistema de Envio de Boletos via WhatsApp Web
   Estilo: painel profissional, limpo e responsivo
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px; color: #24292f; background: #f6f8fa;
    height: 100vh; overflow: hidden;
}
body { display: flex; }
a { color: #0969da; text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #eef1f4; padding: 2px 6px; border-radius: 4px;
       font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }

/* ============================== Sidebar ============================== */
.sidebar {
    width: 240px; background: #1f2328; color: #e6e8eb;
    display: flex; flex-direction: column; height: 100vh;
    flex-shrink: 0;
}
.brand {
    padding: 18px 16px; display: flex; gap: 12px; align-items: center;
    border-bottom: 1px solid #33383e;
}
.brand-icon {
    width: 40px; height: 40px; background: #25d366;
    color: white; font-weight: 700; font-size: 20px;
    border-radius: 8px; display: grid; place-items: center;
}
.brand-logo {
    height: 44px; width: auto; max-width: 110px; object-fit: contain;
    background: white; padding: 4px 6px; border-radius: 8px;
}
.brand-title { font-size: 15px; font-weight: 600; }
.brand-sub   { font-size: 11px; color: #9ca3af; }
.sidebar-version {
    text-align: center; font-size: 10px; color: #6e7681;
    padding: 6px 0 10px; border-top: 1px solid #33383e;
    letter-spacing: 0.5px;
}

/* Logo no login */
.login-logo {
    display: block; margin: 0 auto 14px; height: 70px; width: auto;
    max-width: 220px; object-fit: contain;
}

.menu { list-style: none; padding: 10px 0; flex: 1; overflow-y: auto; }
.menu a {
    display: block; padding: 11px 20px; color: #d0d7de;
    font-size: 14px; border-left: 3px solid transparent;
}
.menu a:hover { background: #2a2f36; text-decoration: none; }
.menu a.active {
    background: #2a2f36; color: #25d366; border-left-color: #25d366;
    font-weight: 500;
}
.side-footer {
    padding: 12px 18px; font-size: 11px; color: #6b7280;
    border-top: 1px solid #33383e;
}

/* ============================== Main ============================== */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
    background: white; padding: 18px 28px; border-bottom: 1px solid #d0d7de;
    display: flex; justify-content: space-between; align-items: center;
}
.topbar h1 { font-size: 20px; font-weight: 600; }
.top-actions { display: flex; gap: 8px; }
.content { padding: 24px 28px; overflow-y: auto; flex: 1; }

/* ============================== Cards ============================== */
.cards {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px; margin-bottom: 24px;
}
.card {
    background: white; border: 1px solid #d0d7de; border-radius: 8px;
    padding: 18px 20px;
}
.card-label { font-size: 12px; color: #57606a; text-transform: uppercase; letter-spacing: 0.4px; }
.card-value { font-size: 28px; font-weight: 600; margin-top: 6px; }
.card-link  { font-size: 13px; margin-top: 10px; display: inline-block; }
.card-ok    { border-left: 4px solid #1a7f37; }
.card-warn  { border-left: 4px solid #d97706; }

/* ============================== Panel ============================== */
.panel {
    background: white; border: 1px solid #d0d7de; border-radius: 8px;
    padding: 20px 24px; margin-bottom: 20px;
}
.panel-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px;
}
.panel h2 { font-size: 16px; font-weight: 600; }
.panel h3 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }

/* ============================== Inputs ============================== */
label { display: block; margin-top: 12px; font-size: 13px; color: #1f2328; }
input[type=text], input[type=email], input[type=number],
input[type=file], textarea, select, .input {
    width: 100%; padding: 8px 12px; margin-top: 4px;
    border: 1px solid #d0d7de; border-radius: 6px;
    font-family: inherit; font-size: 14px; background: #fff;
}
input:focus, textarea:focus, select:focus {
    outline: 2px solid #0969da; border-color: transparent;
}
textarea { font-family: "SFMono-Regular", Consolas, monospace; font-size: 13px; resize: vertical; }
.input-inline {
    border: none; background: transparent; font-size: 15px; font-weight: 600;
    padding: 2px 4px;
}
.input-inline:focus { outline: 2px solid #0969da; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }

.row { display: flex; gap: 10px; align-items: flex-end; }
.grow { flex: 1; }
.right { text-align: right; margin-top: 12px; }
.muted { color: #57606a; font-size: 12px; margin-top: 6px; }
.empty { text-align: center; color: #57606a; padding: 40px 20px; font-style: italic; }

/* ============================== Buttons ============================== */
.btn {
    padding: 8px 18px; border: 1px solid transparent; border-radius: 6px;
    font-size: 14px; font-weight: 500; cursor: pointer; transition: 0.15s;
    font-family: inherit;
}
.btn-primary   { background: #1a7f37; color: white; }
.btn-primary:hover   { background: #136824; }
.btn-secondary { background: #f6f8fa; color: #24292f; border-color: #d0d7de; }
.btn-secondary:hover { background: #eef1f4; }
.btn-danger    { background: #cf222e; color: white; }
.btn-danger:hover    { background: #a40e26; }
.btn-lg { padding: 11px 28px; font-size: 15px; }
.btn-sm { padding: 4px 10px; font-size: 12px; background: #f6f8fa;
          border: 1px solid #d0d7de; border-radius: 5px; cursor: pointer; }
.btn-sm:hover { background: #eef1f4; }
.btn:disabled, .btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.quick-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ============================== Table ============================== */
.table {
    width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13px;
}
.table thead th {
    background: #f6f8fa; padding: 10px 12px; text-align: left;
    border-bottom: 2px solid #d0d7de; font-weight: 600; color: #57606a;
    font-size: 12px; text-transform: uppercase;
}
.table tbody td { padding: 10px 12px; border-bottom: 1px solid #eef1f4; }
.table tbody tr:hover { background: #f6f8fa; }
.actions { white-space: nowrap; }
.actions form { margin: 0; display: inline-block; }

/* ============================== Badges ============================== */
.badge {
    display: inline-block; padding: 3px 9px; border-radius: 10px;
    font-size: 11px; font-weight: 600; text-transform: uppercase;
}
.badge-ok  { background: #dafbe1; color: #1a7f37; }
.badge-err { background: #ffebe9; color: #cf222e; }
.badge-tipo {
    display: inline-block; padding: 3px 9px; background: #ddf4ff;
    color: #0969da; border-radius: 10px; font-size: 11px; font-weight: 600;
    margin-right: 8px; font-family: monospace;
}

/* ============================== Info-box ============================== */
.info-box {
    background: #ddf4ff; border: 1px solid #0969da; border-left-width: 4px;
    padding: 12px 16px; border-radius: 6px; font-size: 13px; line-height: 1.6;
}

/* ============================== Template head ============================== */
.tpl-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8px;
}
.switch { display: flex; gap: 6px; align-items: center; }

/* ============================== Modal ============================== */
.modal {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45);
    display: none; place-items: center; z-index: 1000;
}
.modal.open { display: grid; }
.modal-box {
    background: white; border-radius: 8px; max-width: 600px; width: 92%;
    padding: 20px 24px; max-height: 90vh; overflow-y: auto;
}
.modal-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid #eef1f4;
}
.modal-head h3 { font-size: 17px; font-weight: 600; }
.close { background: none; border: none; font-size: 24px; cursor: pointer; color: #57606a; }
.modal-foot { margin-top: 18px; display: flex; gap: 10px; justify-content: flex-end; }

/* ============================== Flash msgs ============================== */
.flashes { padding: 10px 28px 0; }
.flash {
    padding: 10px 14px; border-radius: 6px; margin-bottom: 8px;
    font-size: 13px; border-left: 4px solid;
}
.flash-success { background: #dafbe1; color: #1a7f37; border-color: #1a7f37; }
.flash-danger  { background: #ffebe9; color: #cf222e; border-color: #cf222e; }
.flash-warning { background: #fff8c5; color: #9a6700; border-color: #d4a72c; }
.flash-info    { background: #ddf4ff; color: #0550ae; border-color: #0969da; }

/* ============================== Envios (lote) ============================== */
.resumo-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
}
.resumo-grid > div {
    background: #f6f8fa; padding: 14px 18px; border-radius: 6px;
    display: flex; flex-direction: column; gap: 4px;
}
.rlbl { font-size: 11px; color: #57606a; text-transform: uppercase; }
.resumo-grid span:not(.rlbl) { font-size: 22px; font-weight: 600; }
.rok { color: #1a7f37; }
.rwarn { color: #9a6700; }
.rerr { color: #cf222e; }

.item-card {
    border: 1px solid #d0d7de; border-radius: 6px; padding: 14px 16px;
    margin-bottom: 10px; background: white; border-left-width: 4px;
}
.item-pronto         { border-left-color: #1a7f37; }
.item-sem_cadastro   { border-left-color: #d4a72c; background: #fffbe6; }
.item-erro_pdf       { border-left-color: #cf222e; background: #fff5f5; }
.item-sem_template   { border-left-color: #9a6700; }

.item-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8px;
}
.chk-wrap { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.item-info { font-size: 13px; line-height: 1.7; color: #1f2328; }
.item-motivo { color: #cf222e; font-weight: 500; margin-top: 4px; }
.item-msg { margin-top: 10px; }
.item-msg summary { cursor: pointer; font-size: 12px; color: #0969da; }
.msg-edit { margin-top: 8px; font-size: 12px; }

.badge-status {
    display: inline-block; padding: 3px 10px; border-radius: 10px;
    font-size: 11px; font-weight: 600; text-transform: uppercase;
}
.badge-pronto        { background: #dafbe1; color: #1a7f37; }
.badge-sem_cadastro  { background: #fff8c5; color: #9a6700; }
.badge-erro_pdf      { background: #ffebe9; color: #cf222e; }
.badge-sem_template  { background: #eef1f4; color: #57606a; }

/* ============================== Progress ============================== */
.progress-area { margin: 16px 0; }
.progress-line { font-size: 13px; margin: 6px 0; }
.progress-bar {
    height: 12px; background: #eef1f4; border-radius: 6px; overflow: hidden;
    margin: 10px 0;
}
.progress-bar-fill {
    height: 100%; background: #1a7f37; width: 0%; transition: width 0.3s;
}
.progress-log {
    max-height: 220px; overflow-y: auto; background: #1f2328; color: #e6e8eb;
    padding: 10px 14px; border-radius: 6px; font-family: monospace;
    font-size: 12px; line-height: 1.6;
}
.progress-log .lok { color: #3fb950; }
.progress-log .lerr { color: #f85149; }

.link { font-size: 13px; }

@media (max-width: 900px) {
    .sidebar { width: 72px; }
    .brand-title, .brand-sub, .menu a { font-size: 12px; }
    .cards, .resumo-grid { grid-template-columns: 1fr 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
}
