:root {
    --primary: #0066cc;
    --ink: #1d1d1f;
    --canvas: #ffffff;
    --parchment: #f5f5f7;
    --pearl: #fafafc;
    --muted: #6e6e73;
    --hairline: #e0e0e0;
    --danger: #d70015;
    --success: #1a7d3a;
    --warning: #b25000;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(0,0,0,0.04);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', -apple-system, 'SF Pro Text', system-ui, sans-serif;
    font-weight: 400;
    color: var(--ink);
    background: var(--parchment);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: 'Inter', -apple-system, 'SF Pro Display', system-ui, sans-serif;
    color: var(--ink);
    font-weight: 600;
    letter-spacing: -0.2px;
    margin: 0 0 .5rem;
}
h1 { font-weight: 700; }

a { color: inherit; text-decoration: none; }

.brand-signature {
    font-size: .72rem;
    letter-spacing: .04em;
    color: var(--muted);
    text-transform: uppercase;
}

/* ---------- Login ---------- */
.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eef2f8;
    padding: 1.5rem;
}
.auth-card {
    background: var(--canvas);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem 2.25rem;
    text-align: center;
}
.auth-card .logo {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: var(--ink);
}
.auth-card .logo span { color: var(--primary); }
.auth-card form { text-align: left; margin-top: 1.75rem; }

/* ---------- Forms ---------- */
label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: var(--ink);
    margin: 0 0 .35rem;
}
input, select, textarea {
    width: 100%;
    padding: .7rem .85rem;
    border: 1px solid var(--hairline);
    border-radius: 8px;
    background: var(--pearl);
    font-family: inherit;
    font-size: .92rem;
    color: var(--ink);
    margin-bottom: 1.1rem;
    transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
}
button, .btn {
    font-family: inherit;
    font-weight: 600;
    font-size: .9rem;
    border: none;
    border-radius: 999px;
    padding: .75rem 1.4rem;
    cursor: pointer;
    background: var(--primary);
    color: #fff;
    transition: transform .1s, opacity .15s;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}
button:hover, .btn:hover { opacity: .92; }
button:active, .btn:active { transform: scale(.97); }
button.ghost, .btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--hairline); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.small, .btn.small { padding: .45rem .85rem; font-size: .8rem; border-radius: 999px; }
.full-width { width: 100%; }

.alert {
    padding: .75rem 1rem;
    border-radius: 10px;
    font-size: .85rem;
    margin-bottom: 1rem;
    display: none;
}
.alert.error { background: #fdeceb; color: var(--danger); }
.alert.success { background: #e9f7ee; color: var(--success); }
.alert.warning { background: #fdf1e2; color: var(--warning); }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: #000000;
    color: #fff;
    padding: 1.75rem 1.25rem;
    display: flex;
    flex-direction: column;
}
.sidebar .logo { font-size: 1.15rem; font-weight: 700; margin-bottom: .1rem; }
.sidebar nav { margin-top: 2.25rem; display: flex; flex-direction: column; gap: .3rem; flex: 1; }
.sidebar nav a {
    color: rgba(255,255,255,.65);
    padding: .65rem .85rem;
    border-radius: 8px;
    font-size: .88rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: .6rem;
}
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar .footer-signature { font-size: .65rem; color: rgba(255,255,255,.4); margin-top: 1.5rem; line-height: 1.4; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    background: var(--canvas);
    padding: 1.1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--hairline);
}
.topbar .user-chip { display: flex; align-items: center; gap: .75rem; font-size: .85rem; }
.topbar .badge {
    background: rgba(0,102,204,0.1);
    color: var(--primary);
    padding: .15rem .6rem;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
}
.content { padding: 2rem; flex: 1; }

/* ---------- Cards / grid ---------- */
.grid { display: grid; gap: 1.25rem; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .grid-4, .grid-3 { grid-template-columns: 1fr; } .app { flex-direction: column; } .sidebar { width: auto; } }

.card {
    background: var(--canvas);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.stat-card .label { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.stat-card .value { font-size: 1.9rem; font-weight: 700; color: var(--ink); margin-top: .35rem; }
.stat-card .value.small { font-size: 1.3rem; }

table { width: 100%; border-collapse: collapse; font-size: .87rem; }
th, td { text-align: left; padding: .8rem .9rem; border-bottom: 1px solid var(--parchment); }
th { color: var(--muted); text-transform: uppercase; font-size: .72rem; letter-spacing: .04em; font-weight: 700; }
tr:last-child td { border-bottom: none; }

.status-pill {
    display: inline-block;
    padding: .2rem .65rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
}
.status-pill.novo { background: rgba(0,102,204,0.1); color: var(--primary); }
.status-pill.contatado { background: #fdf1e2; color: var(--warning); }
.status-pill.convertido { background: #e9f7ee; color: var(--success); }

.routing-pill {
    display: inline-block;
    padding: .15rem .55rem;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 700;
    background: var(--parchment);
    color: var(--ink);
    margin-right: .25rem;
}

.actions-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; flex-wrap: wrap; gap: .75rem; }
.muted { color: var(--muted); font-size: .85rem; }

.toast {
    position: fixed; bottom: 1.5rem; right: 1.5rem;
    background: var(--ink); color: #fff;
    padding: .85rem 1.25rem; border-radius: 10px; font-size: .85rem;
    box-shadow: var(--shadow); z-index: 100; opacity: 0; transform: translateY(10px);
    transition: opacity .2s, transform .2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }
