/* ============================================================
   SOS CAR · Painel administrativo
   Design system: navy #0F1F3D + laranja #F26B1D (marca do app)
   ============================================================ */

:root {
    --navy: #0F1F3D;
    --navy-2: #16294D;
    --navy-dark: #0A1529;
    --navy-tint: #E8EDF6;
    --orange: #F26B1D;
    --orange-dark: #D45500;
    --orange-tint: #FDEEDD;
    --green: #12B76A;
    --green-tint: #E7F8F0;
    --amber: #DC8B08;
    --amber-tint: #FDF3DC;
    --violet: #6B3FF2;
    --violet-tint: #EFE9FF;
    --red: #E5484D;
    --red-tint: #FDE8E8;
    --bg: #F4F6F9;
    --card: #FFFFFF;
    --border: #E4E8F0;
    --text: #101828;
    --muted: #667085;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-lg: 0 12px 32px rgba(15, 31, 61, .12);
    /* compat com estilos antigos embutidos nas páginas */
    --blue: var(--navy);
    --blue-dark: var(--navy-dark);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", -apple-system, Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}

a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--orange); }

h1, h2, h3 { color: var(--text); }

/* ===== Página de login / instalação ===== */
.center-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(1200px 600px at 85% -10%, rgba(242, 107, 29, .14), transparent 60%),
        radial-gradient(900px 500px at -10% 110%, rgba(22, 41, 77, .5), transparent 55%),
        var(--navy);
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 28px;
}

.center-page .card { border: none; box-shadow: var(--shadow-lg); border-radius: 22px; }

.auth-card { width: 100%; max-width: 400px; padding: 36px; }
.install-card { width: 100%; max-width: 560px; }

.logo {
    color: var(--navy);
    font-size: 26px;
    font-weight: 800;
    font-style: italic;
    margin: 0 0 4px;
    letter-spacing: -.5px;
}
.logo .sos { color: var(--orange); }

.auth-card h2 { margin: 0 0 22px; font-size: 15px; font-weight: 500; color: var(--muted); }
.install-card h2 { margin: 4px 0 16px; font-size: 19px; }

label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); margin: 14px 0 6px; }

input[type=text], input[type=email], input[type=password], input[type=tel], select, textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(15, 31, 61, .12);
}

/* ===== Botões ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    border: 1px solid transparent;
    cursor: pointer;
    padding: 11px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    width: 100%;
    margin-top: 18px;
    transition: background .15s, color .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); color: #fff; }
.btn-accent { background: var(--orange); color: #fff; }
.btn-accent:hover { background: var(--orange-dark); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { filter: brightness(.95); }
.btn-ghost { background: #fff; color: var(--navy); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--navy); color: var(--navy); }
.btn-danger { background: var(--red-tint); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { width: auto; padding: 7px 13px; font-size: 13px; margin: 0; border-radius: 8px; }

.actions { display: flex; gap: 12px; margin-top: 20px; }
.actions .btn { margin-top: 0; }

.muted { color: var(--muted); font-size: 13px; }
.center-text { text-align: center; }
.mt { margin-top: 16px; }

.alert { padding: 11px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 14px; font-weight: 500; }
.alert-error { background: var(--red-tint); color: var(--red); }
.alert-ok { background: var(--green-tint); color: var(--green); }

.steps { line-height: 1.9; padding-left: 18px; font-size: 13.5px; }

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

.sidebar {
    width: 236px;
    min-width: 236px;
    background: linear-gradient(180deg, var(--navy) 0%, var(--navy-dark) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sb-logo {
    font-size: 21px;
    font-weight: 800;
    font-style: italic;
    color: #fff;
    padding: 22px 22px 18px;
    letter-spacing: -.5px;
}
.sb-logo:hover { color: #fff; }
.sb-logo .sos { color: var(--orange); }
.sb-logo small { display: block; font-size: 10px; font-weight: 600; font-style: normal; letter-spacing: 2px; color: rgba(255,255,255,.45); margin-top: 2px; }

.sb-nav { flex: 1; padding: 6px 12px; overflow-y: auto; }
.sb-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    margin-bottom: 2px;
    border-radius: 10px;
    color: rgba(255, 255, 255, .72);
    font-size: 14px;
    font-weight: 500;
    transition: background .15s, color .15s;
}
.sb-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.sb-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sb-item.active {
    background: rgba(242, 107, 29, .16);
    color: #fff;
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--orange);
}
.sb-item.active svg { color: var(--orange); }

.sb-foot { padding: 14px 16px; border-top: 1px solid rgba(255, 255, 255, .08); }
.sb-user { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sb-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--orange); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.sb-user .n { font-size: 13px; font-weight: 600; color: #fff; line-height: 1.2; }
.sb-user .r { font-size: 11px; color: rgba(255, 255, 255, .5); }
.sb-logout {
    display: flex; align-items: center; gap: 8px;
    color: rgba(255, 255, 255, .6); font-size: 13px; font-weight: 500;
    padding: 6px 8px; border-radius: 8px;
}
.sb-logout:hover { background: rgba(229, 72, 77, .18); color: #ff9b9e; }
.sb-logout svg { width: 15px; height: 15px; }

/* ===== Área de conteúdo ===== */
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page-head {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 20px 32px;
}
.page-head h1 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -.3px; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.page-body { padding: 26px 32px 40px; max-width: 1220px; width: 100%; }

/* ===== Tabelas ===== */
.table-wrap {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 18px; font-size: 13.5px; vertical-align: middle; }
thead th {
    background: #F9FAFC;
    color: var(--muted);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .8px;
    border-bottom: 1px solid var(--border);
}
tbody tr { border-bottom: 1px solid #EEF1F5; transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #FAFBFD; }

.badge {
    display: inline-block; padding: 4px 11px; border-radius: 50px;
    font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.b-recebido  { background: var(--navy-tint); color: var(--navy); }
.b-aceito    { background: var(--violet-tint); color: var(--violet); }
.b-a_caminho { background: var(--amber-tint); color: var(--amber); }
.b-no_local  { background: var(--orange-tint); color: var(--orange-dark); }
.b-concluido { background: var(--green-tint); color: var(--green); }
.b-cancelado { background: #EEF0F3; color: #7A8699; }

.status-select { padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border); font-size: 13px; width: auto; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-right: 6px; animation: livepulse 2s infinite; }
@keyframes livepulse { 50% { opacity: .4; } }
.live { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ===== Formulários das páginas de gestão ===== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 4px 18px;
    align-items: start;
}
.form-grid .btn { margin-top: 18px; }
.form-grid label { margin-top: 12px; }

.code-list { display: flex; flex-wrap: wrap; gap: 10px; }
.gen-code {
    background: var(--orange-tint); color: var(--orange-dark);
    font-size: 17px; font-weight: 800; letter-spacing: 2px;
    padding: 10px 16px; border-radius: 10px;
    font-family: Consolas, monospace;
}

/* ===== Gestor de chamados (dashboard) ===== */
.ops { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100vh; overflow: hidden; }
.ops-head {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    background: var(--card); border-bottom: 1px solid var(--border);
    padding: 14px 24px; flex-wrap: wrap;
}
.ops-head h1 { margin: 0; font-size: 18px; font-weight: 700; }
.ops-head .tabs { display: flex; gap: 8px; }
.ops-head .right { display: flex; align-items: center; gap: 14px; }

.tab {
    background: #fff; border: 1px solid var(--border); border-radius: 50px; padding: 8px 16px;
    font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; font-family: inherit;
    transition: all .15s;
}
.tab:hover { border-color: var(--navy); color: var(--navy); }
.tab.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.tab-count {
    display: inline-block; min-width: 20px; padding: 1px 6px; margin-left: 6px;
    background: var(--orange); color: #fff; border-radius: 50px; font-size: 11px; text-align: center;
}

.ops-grid { display: grid; grid-template-columns: 360px 1fr; flex: 1; min-height: 0; }
.orders-col { border-right: 1px solid var(--border); display: flex; flex-direction: column; background: #F9FAFC; min-height: 0; }
.orders-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; font-weight: 700; font-size: 13px; border-bottom: 1px solid var(--border); background: #fff;
}
#orders-list { overflow-y: auto; padding: 12px; flex: 1; }
.empty { color: var(--muted); padding: 30px 12px; text-align: center; }

.order-card {
    background: #fff; border: 1px solid var(--border); border-radius: 12px;
    padding: 13px 14px; margin-bottom: 10px; cursor: pointer;
    border-left: 4px solid var(--border);
    transition: transform .08s, box-shadow .12s, border-color .12s;
}
.order-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.order-card.selected { border-color: var(--navy); border-left-color: var(--orange); box-shadow: 0 0 0 1px var(--navy); }
.order-card.s-recebido  { border-left-color: var(--navy); }
.order-card.s-aceito    { border-left-color: var(--violet); }
.order-card.s-a_caminho { border-left-color: var(--amber); }
.order-card.s-no_local  { border-left-color: var(--orange); }
.order-card.s-concluido { border-left-color: var(--green); }
.order-card.s-cancelado { border-left-color: #B9C0CC; }
.order-card.is-new { animation: cardflash 1s ease 3; }
@keyframes cardflash { 0%,100% { background: #fff; } 50% { background: var(--orange-tint); } }
.oc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.oc-top strong { font-size: 14px; }
.oc-user { color: var(--text); font-size: 13px; margin-top: 3px; }
.oc-addr { color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.45; }
.oc-foot { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 9px; }

.detail-col { position: relative; background: var(--bg); min-height: 0; }
#detail-frame { width: 100%; height: 100%; border: none; display: none; }
.detail-placeholder {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    color: var(--muted); text-align: center;
}
.detail-placeholder .ph-icon { font-size: 44px; margin-bottom: 10px; }

/* ===== Responsivo básico ===== */
@media (max-width: 920px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; min-width: 0; height: auto; position: static; flex-direction: row; align-items: center; overflow-x: auto; }
    .sb-logo { padding: 14px 16px; white-space: nowrap; }
    .sb-logo small { display: none; }
    .sb-nav { display: flex; padding: 8px; }
    .sb-item { white-space: nowrap; padding: 9px 12px; }
    .sb-foot { border-top: none; padding: 8px 12px; }
    .sb-user { display: none; }
    .page-head, .page-body { padding-left: 18px; padding-right: 18px; }
    .ops { height: auto; overflow: visible; }
    .ops-grid { grid-template-columns: 1fr; }
    .orders-col { max-height: 45vh; }
    .detail-col { min-height: 55vh; }
}
