/* ==========================================================================
   EzChannel — Tema (paleta da marca Ezra Tech em tom suave)
   Verde #07a053 · Verde escuro #059343 · Marinho #212741
   ========================================================================== */

:root {
    --brand: #07a053;
    --brand-dark: #059343;
    --brand-600: #0b8f4e;
    --navy: #212741;
    --navy-soft: #2c3350;

    --brand-soft: #e7f5ee;
    --brand-tint: #f4faf6;

    --bg: #f4faf6;
    --surface: #ffffff;
    --surface-2: #f8faf9;
    --border: #e3ece7;
    --border-strong: #d3ddd7;

    --text: #212741;
    --muted: #5a6472;
    --muted-light: #8b93a3;

    --danger: #d6455d;
    --danger-soft: #fdecef;
    --warning: #d98b12;
    --warning-soft: #fdf4e3;
    --info: #2f80c4;
    --success: var(--brand);

    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(33, 39, 65, .06);
    --shadow: 0 4px 16px rgba(33, 39, 65, .08);
    --shadow-lg: 0 12px 32px rgba(33, 39, 65, .12);

    --sidebar-w: 248px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14.5px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { color: var(--navy); font-weight: 700; margin: 0; }

/* ---------- Utilidades ---------- */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ---------- Botões ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    font: inherit; font-weight: 600; font-size: 14px;
    padding: .6rem 1.1rem; border-radius: var(--radius-sm);
    border: 1px solid transparent; cursor: pointer; transition: .15s;
    background: var(--brand); color: #fff; text-decoration: none;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-outline { background: #fff; color: var(--navy); border-color: var(--border-strong); }
.btn-outline:hover { background: var(--surface-2); border-color: var(--brand); color: var(--brand-dark); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--brand-soft); color: var(--brand-dark); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #bd3850; }
.btn-sm { padding: .35rem .7rem; font-size: 13px; }
.btn-block { width: 100%; }

/* ---------- Cartões ---------- */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-body { padding: 1.35rem; }
.card-header {
    padding: 1rem 1.35rem; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}

/* ---------- Formulários ---------- */
.form-group { margin-bottom: 1rem; }
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: .35rem; color: var(--navy); }
.input, input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=tel], select, textarea {
    width: 100%; font: inherit; font-size: 14px;
    padding: .6rem .8rem; border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); background: #fff; color: var(--text);
    transition: .15s;
}
.input:focus, input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}
.field-error { color: var(--danger); font-size: 12.5px; margin-top: .3rem; }

/* ---------- Alertas / flash ---------- */
.alert { padding: .8rem 1rem; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 1rem; border: 1px solid transparent; }
.alert-success { background: var(--brand-soft); color: var(--brand-dark); border-color: #bfe6d1; }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: #f6cdd4; }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: #f3e0b8; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-green { background: var(--brand-soft); color: var(--brand-dark); }
.badge-navy { background: #e8eaf1; color: var(--navy); }
.badge-gray { background: #eef1f0; color: var(--muted); }
.badge-red { background: var(--danger-soft); color: var(--danger); }
.badge-amber { background: var(--warning-soft); color: var(--warning); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-green { background: var(--brand); } .dot-gray { background: var(--muted-light); }
.dot-amber { background: var(--warning); } .dot-red { background: var(--danger); }

/* ---------- Tabelas ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; padding: .7rem .9rem; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--border); }
.table td { padding: .8rem .9rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:hover td { background: var(--surface-2); }

/* ==========================================================================
   Layout com sidebar
   ========================================================================== */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w); background: var(--navy); color: #cfd4e2;
    display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0;
}
.sidebar-brand { padding: 1.3rem 1.4rem; display: flex; align-items: center; gap: .6rem; }
.sidebar-brand .logo {
    width: 34px; height: 34px; border-radius: 9px; background: var(--brand);
    display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 17px;
}
.sidebar-brand b { color: #fff; font-size: 17px; }
.sidebar-brand small { display: block; color: #8b93a3; font-size: 11px; }
.sidebar-nav { padding: .5rem .7rem; flex: 1; overflow-y: auto; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 1rem .8rem .4rem; color: #737b96; }
.nav-item {
    display: flex; align-items: center; gap: .7rem; padding: .6rem .8rem;
    border-radius: var(--radius-sm); color: #cfd4e2; font-weight: 500; font-size: 14px;
    margin-bottom: 2px; transition: .12s;
}
.nav-item:hover { background: var(--navy-soft); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--brand); color: #fff; }
.nav-item .ico { width: 18px; text-align: center; opacity: .9; }
.sidebar-footer { padding: 1rem; border-top: 1px solid rgba(255,255,255,.08); }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.topbar {
    height: 62px; background: var(--surface); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; padding: 0 1.6rem;
    position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 18px; }
.content { padding: 1.6rem; flex: 1; }

.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); display: grid; place-items: center; font-weight: 700; font-size: 13px; }

/* ---------- Grid de estatísticas ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--shadow-sm); }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 1.9rem; font-weight: 800; color: var(--navy); margin-top: .2rem; }
.stat .ico { float: right; width: 40px; height: 40px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-dark); display: grid; place-items: center; font-size: 18px; }

/* ==========================================================================
   Autenticação
   ========================================================================== */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: linear-gradient(155deg, var(--navy) 0%, #16391f 55%, var(--brand-dark) 100%); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: center; }
.auth-side h2 { color: #fff; font-size: 2rem; line-height: 1.2; }
.auth-side p { color: #cfe6d9; max-width: 380px; }
.auth-side .feat { display: flex; align-items: center; gap: .7rem; margin-top: 1rem; color: #eafff2; }
.auth-side .feat .ico { width: 30px; height: 30px; border-radius: 8px; background: rgba(255,255,255,.14); display: grid; place-items: center; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.5rem; }
.auth-card .brand .logo { width: 40px; height: 40px; border-radius: 10px; background: var(--brand); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 19px; }
@media (max-width: 860px) { .auth-wrap { grid-template-columns: 1fr; } .auth-side { display: none; } }

/* ==========================================================================
   Chat / atendimento
   ========================================================================== */
.chat { display: grid; grid-template-columns: 340px 1fr; height: calc(100vh - 62px); background: var(--surface); }
.chat-list { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.chat-list-head { padding: .9rem 1rem; border-bottom: 1px solid var(--border); }
.chat-tabs { display: flex; gap: .3rem; margin-top: .6rem; }
.chat-tab { flex: 1; text-align: center; padding: .4rem; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.chat-tab.active { background: var(--brand-soft); color: var(--brand-dark); }
.conv-list { overflow-y: auto; flex: 1; }
.conv {
    display: flex; gap: .7rem; padding: .8rem 1rem; border-bottom: 1px solid var(--border);
    cursor: pointer; transition: .12s;
}
.conv:hover { background: var(--surface-2); }
.conv.active { background: var(--brand-soft); }
.conv .avatar { flex: none; }
.conv .meta { min-width: 0; flex: 1; }
.conv .name { font-weight: 600; color: var(--navy); font-size: 14px; display: flex; justify-content: space-between; }
.conv .preview { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .badge-unread { background: var(--brand); color: #fff; border-radius: 999px; font-size: 11px; padding: .05rem .4rem; }

.chat-thread { display: flex; flex-direction: column; min-height: 0; background: var(--brand-tint); }
.thread-head { padding: .8rem 1.2rem; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.thread-body { flex: 1; overflow-y: auto; padding: 1.2rem; display: flex; flex-direction: column; gap: .5rem; }
.thread-empty { flex: 1; display: grid; place-items: center; color: var(--muted-light); text-align: center; }
.bubble { max-width: 68%; padding: .55rem .8rem; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow-sm); position: relative; word-wrap: break-word; }
.bubble .time { font-size: 10.5px; color: var(--muted-light); display: block; text-align: right; margin-top: .2rem; }
.bubble.in { align-self: flex-start; background: #fff; border-bottom-left-radius: 3px; }
.bubble.out { align-self: flex-end; background: var(--brand-soft); border-bottom-right-radius: 3px; }
.bubble.out .time .ack { color: var(--info); font-weight: 700; }
.thread-compose { padding: .8rem 1.2rem; background: var(--surface); border-top: 1px solid var(--border); display: flex; gap: .6rem; }
.thread-compose input { flex: 1; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(33,39,65,.45); display: none; place-items: center; z-index: 50; padding: 1rem; }
.modal-backdrop.open { display: grid; }
.modal { background: #fff; border-radius: var(--radius); max-width: 480px; width: 100%; box-shadow: var(--shadow-lg); }
.modal-header { padding: 1.1rem 1.35rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 1.35rem; max-height: 70vh; overflow-y: auto; }
.modal-footer { padding: 1rem 1.35rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .6rem; }

/* ---------- QR ---------- */
.qr-box { display: grid; place-items: center; padding: 1rem; }
.qr-box img, .qr-box canvas { width: 240px; height: 240px; border: 1px solid var(--border); border-radius: var(--radius-sm); }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.3rem; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }

/* ==========================================================================
   CRM — Kanban de funil de vendas
   ========================================================================== */
.kanban { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 1rem; align-items: flex-start; }
.kb-col { flex: 0 0 288px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 210px); }
.kb-col.drag-over { outline: 2px dashed var(--brand); outline-offset: -2px; background: var(--brand-soft); }
.kb-head { padding: .75rem .9rem; border-bottom: 1px solid var(--border); position: sticky; top: 0; }
.kb-head .title { display: flex; align-items: center; gap: .45rem; font-weight: 700; color: var(--navy); font-size: 14px; }
.kb-head .stage-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.kb-head .sub { font-size: 12px; color: var(--muted); margin-top: .25rem; display: flex; justify-content: space-between; }
.kb-body { padding: .7rem; overflow-y: auto; flex: 1; min-height: 60px; }
.kb-card {
    background: #fff; border: 1px solid var(--border); border-left: 3px solid var(--brand);
    border-radius: var(--radius-sm); padding: .7rem .8rem; margin-bottom: .6rem;
    box-shadow: var(--shadow-sm); cursor: grab;
}
.kb-card:active { cursor: grabbing; }
.kb-card.dragging { opacity: .5; }
.kb-card .kb-title { font-weight: 600; color: var(--navy); font-size: 13.5px; }
.kb-card .kb-value { color: var(--brand-dark); font-weight: 700; font-size: 13px; margin-top: .2rem; }
.kb-card .kb-meta { display: flex; align-items: center; justify-content: space-between; margin-top: .5rem; font-size: 11.5px; color: var(--muted); }
.kb-card .kb-contact { display: flex; align-items: center; gap: .35rem; }
.kb-add { width: 100%; border: 1px dashed var(--border-strong); background: transparent; color: var(--muted); padding: .5rem; border-radius: var(--radius-sm); cursor: pointer; font: inherit; font-size: 13px; }
.kb-add:hover { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); }
.pipe-tabs { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.pipe-tab { padding: .4rem .8rem; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--border); text-decoration: none; }
.pipe-tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.pipe-tab:hover { text-decoration: none; }

/* ==========================================================================
   Pedidos — board com cores suaves por status
   ========================================================================== */
.st-novo       { --st-bg:#eaf2fb; --st-fg:#2f6fb0; --st-dot:#2f80c4; }
.st-em_preparo { --st-bg:#fdf4e3; --st-fg:#b9770f; --st-dot:#d98b12; }
.st-preparado  { --st-bg:#f0ebfa; --st-fg:#6a3fc0; --st-dot:#7a4fd6; }
.st-saindo     { --st-bg:#e6f5f7; --st-fg:#1f8194; --st-dot:#2596a8; }
.st-entregue   { --st-bg:#e7f5ee; --st-fg:#0a7d45; --st-dot:#07a053; }
.st-cancelado  { --st-bg:#fdecef; --st-fg:#c23a52; --st-dot:#d6455d; }

.ord-col .kb-head { background: var(--st-bg); border-bottom-color: transparent; }
.ord-col .kb-head .title { color: var(--st-fg); }
.ord-col .kb-head .stage-dot { background: var(--st-dot); border-radius: 50%; }
.ord-col .kb-card { border-left-color: var(--st-dot); }
.ord-badge { background: var(--st-bg); color: var(--st-fg); }

.ord-card .num { font-weight: 800; color: var(--navy); }
.ord-card .when { font-size: 11px; color: var(--muted-light); }
.ord-card .cust { font-size: 13px; color: var(--navy); margin-top: .2rem; }
.ord-card .tot { color: var(--brand-dark); font-weight: 700; font-size: 13px; }
.ord-card .tags { display: flex; gap: .3rem; margin-top: .4rem; flex-wrap: wrap; }
.ord-tag { font-size: 10.5px; padding: .1rem .45rem; border-radius: 999px; background: #eef1f0; color: var(--muted); }

/* Steppers e carrinho do cardápio público */
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 999px; overflow: hidden; }
.qty button { border: 0; background: var(--surface-2); width: 30px; height: 30px; font-size: 16px; cursor: pointer; color: var(--brand-dark); }
.qty span { min-width: 30px; text-align: center; font-weight: 600; }
.cart-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; z-index: 60; max-width: 600px; width: calc(100% - 2.4rem); box-shadow: var(--shadow-lg); }
.cart-line { display: flex; justify-content: space-between; align-items: center; padding: .5rem 0; border-bottom: 1px solid var(--border); gap: .5rem; }
.pay-opt { display: flex; align-items: center; gap: .5rem; padding: .6rem .8rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; margin-bottom: .5rem; }
.pay-opt input { width: auto; }
.pay-opt.sel { border-color: var(--brand); background: var(--brand-soft); }
