/* ============================================================
   ALPHA RISK - Sistema de Escoltas Armadas
   Design: Tático / Profissional / Autoridade
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@400;500;600;700&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --black:      #0A0C0F;
    --navy:       #0D1B2A;
    --steel:      #1B2B3B;
    --panel:      #162032;
    --border:     #1E3045;
    --gold:       #C8922A;
    --gold-light: #E5A83A;
    --red:        #C0392B;
    --green:      #1A7A4A;
    --green-light:#22A060;
    --text:       #D8DDE5;
    --muted:      #6B7A8D;
    --white:      #F0F4F8;
    --shadow:     0 4px 24px rgba(0,0,0,0.5);
    --radius:     6px;
    --font-display: 'Rajdhani', sans-serif;
    --font-body:    'Inter', sans-serif;
    --font-mono:    'JetBrains Mono', monospace;
    --sidebar-w:  240px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 15px;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background: var(--black);
    color: var(--text);
    font-family: var(--font-body);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    max-width: 100vw;
}

/* ── SIDEBAR ── */
.sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--navy);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    z-index: 200;
    transition: transform 0.25s ease;
}

.sidebar-logo {
    padding: 20px 16px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
}

.sidebar-logo img, .login-logo img {
    background: transparent !important;
    object-fit: contain !important;
}

.logo-text {
    font-family: var(--font-display);
    font-size: 1.3rem; font-weight: 700;
    color: var(--white); letter-spacing: 0.05em;
    line-height: 1.1;
}

.logo-sub {
    font-size: 0.65rem; color: var(--gold);
    letter-spacing: 0.15em; text-transform: uppercase;
}

.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }

.nav-section {
    padding: 8px 20px 4px;
    font-size: 0.65rem; font-weight: 600;
    color: var(--muted); letter-spacing: 0.15em;
    text-transform: uppercase;
}

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.88rem; font-weight: 500;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.nav-item:hover, .nav-item.active {
    color: var(--white);
    background: rgba(200,146,42,0.08);
    border-left-color: var(--gold);
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    font-size: 0.78rem; color: var(--muted);
}
.sidebar-footer a { color: var(--gold); text-decoration: none; }

/* Overlay para fechar sidebar no mobile */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 199;
}
.sidebar-overlay.open { display: block; }

/* ── MAIN ── */
.main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex; flex-direction: column;
}

.topbar {
    background: var(--navy);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 90;
    gap: 12px;
}

.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }

.menu-toggle {
    display: none;
    background: none; border: none;
    color: var(--text); cursor: pointer;
    padding: 6px; border-radius: var(--radius);
    font-size: 1.3rem; line-height: 1;
    flex-shrink: 0;
}
.menu-toggle:hover { background: rgba(255,255,255,0.08); }

.page-title {
    font-family: var(--font-display);
    font-size: 1.3rem; font-weight: 600;
    color: var(--white); letter-spacing: 0.04em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.page-subtitle { font-size: 0.75rem; color: var(--muted); margin-top: 1px; }

.topbar-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.user-badge {
    display: flex; align-items: center; gap: 8px;
    background: var(--steel);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 5px 12px 5px 6px;
}

.user-avatar {
    width: 28px; height: 28px;
    background: var(--gold);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display);
    font-size: 0.85rem; font-weight: 700;
    color: var(--black); flex-shrink: 0;
}

.content { padding: 24px; flex: 1; }

/* ── MÉTRICAS ── */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.metric-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    position: relative; overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute; left: 0; top: 0; bottom: 0;
    width: 3px; background: var(--gold);
}

.metric-card.green::before { background: var(--green-light); }
.metric-card.red::before   { background: var(--red); }
.metric-card.blue::before  { background: #3B82F6; }

.metric-label {
    font-size: 0.72rem; font-weight: 600;
    color: var(--muted); letter-spacing: 0.12em;
    text-transform: uppercase; margin-bottom: 8px;
}

.metric-value {
    font-family: var(--font-display);
    font-size: 1.9rem; font-weight: 700;
    color: var(--white); line-height: 1;
    overflow-wrap: anywhere;
}

.metric-value.money { color: var(--gold-light); }
.metric-value.green { color: var(--green-light); }
.metric-sub { font-size: 0.75rem; color: var(--muted); margin-top: 6px; }
.metric-icon {
    position: absolute; right: 14px; top: 50%;
    transform: translateY(-50%);
    opacity: 0.08; font-size: 2.8rem;
}

/* ── TABELA ── */
.table-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.table-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 10px;
}

.table-title {
    font-family: var(--font-display);
    font-size: 1rem; font-weight: 600;
    color: var(--white); letter-spacing: 0.04em;
}

.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }

th {
    background: rgba(0,0,0,0.3);
    padding: 10px 14px;
    text-align: left;
    font-size: 0.68rem; font-weight: 600;
    color: var(--muted); letter-spacing: 0.1em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 11px 14px;
    border-bottom: 1px solid rgba(30,48,69,0.5);
    color: var(--text);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(200,146,42,0.04); }
.td-mono { font-family: var(--font-mono); font-size: 0.82rem; }

/* ── BADGES ── */
.badge {
    display: inline-flex; align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.7rem; font-weight: 600;
    letter-spacing: 0.06em; text-transform: uppercase;
    white-space: nowrap;
}

.badge-aberto    { background: rgba(59,130,246,0.15);  color: #60A5FA;          border: 1px solid rgba(59,130,246,0.3); }
.badge-andamento { background: rgba(200,146,42,0.15);  color: var(--gold-light);border: 1px solid rgba(200,146,42,0.3); }
.badge-retroativo{ background: rgba(230,126,34,0.15);  color: #E67E22;          border: 1px solid rgba(230,126,34,0.4); }
.badge-concluido { background: rgba(26,122,74,0.15);   color: var(--green-light);border: 1px solid rgba(26,122,74,0.3); }
.badge-cancelado { background: rgba(192,57,43,0.15);   color: #E74C3C;          border: 1px solid rgba(192,57,43,0.3); }
.badge-faturado  { background: rgba(139,92,246,0.15);  color: #A78BFA;          border: 1px solid rgba(139,92,246,0.3); }

/* ── BOTÕES ── */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 16px;
    border: none; border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.85rem; font-weight: 600;
    cursor: pointer; text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-primary { background: var(--gold); color: var(--black); }
.btn-primary:hover { background: var(--gold-light); transform: translateY(-1px); }

.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }

.btn-danger  { background: var(--red); color: #fff; }
.btn-danger:hover { background: #E74C3C; }

.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: var(--green-light); }

.btn-sm { padding: 5px 11px; font-size: 0.78rem; }
.btn-icon { padding: 8px; }

/* ── FORMS ── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }

label {
    font-size: 0.75rem; font-weight: 600;
    color: var(--muted); letter-spacing: 0.08em;
    text-transform: uppercase;
}

input, select, textarea {
    background: var(--steel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--white);
    font-family: var(--font-body);
    font-size: 0.88rem;
    padding: 10px 12px;
    width: 100%;
    transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(200,146,42,0.15);
}

input[readonly], input[disabled] { opacity: 0.6; cursor: not-allowed; }
select option { background: var(--steel); }
textarea { resize: vertical; min-height: 80px; }

.input-prefix { position: relative; }
.input-prefix span {
    position: absolute; left: 10px; top: 50%;
    transform: translateY(-50%);
    color: var(--muted); font-size: 0.85rem;
    pointer-events: none;
}
.input-prefix input { padding-left: 32px; }

.form-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 18px;
}

.form-section-title {
    font-family: var(--font-display);
    font-size: 1rem; font-weight: 600;
    color: var(--gold);
    letter-spacing: 0.06em;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 8px;
}

/* ── ALERTAS ── */
.alert {
    padding: 11px 14px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-bottom: 14px;
    display: flex; align-items: center; gap: 8px;
}

.alert-success { background: rgba(26,122,74,0.15);  border: 1px solid rgba(34,160,96,0.3); color: var(--green-light); }
.alert-error   { background: rgba(192,57,43,0.15);  border: 1px solid rgba(231,76,60,0.3); color: #E74C3C; }
.alert-info    { background: rgba(59,130,246,0.1);  border: 1px solid rgba(59,130,246,0.3); color: #60A5FA; }

/* ── FILTROS ── */
.filters-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filters-bar input, .filters-bar select { width: auto; min-width: 150px; padding: 8px 12px; }

/* ── TOTAL BOX ── */
.total-box {
    background: rgba(200,146,42,0.1);
    border: 1px solid rgba(200,146,42,0.3);
    border-radius: var(--radius);
    padding: 14px 18px;
    display: flex; align-items: center; justify-content: space-between;
}
.total-box .label { font-size: 0.85rem; color: var(--muted); }
.total-box .valor {
    font-family: var(--font-display);
    font-size: 1.8rem; font-weight: 700;
    color: var(--gold-light);
}

/* ── LOGIN ── */
.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(200,146,42,0.06) 0%, transparent 60%),
        var(--black);
}

.login-card {
    width: 100%; max-width: 400px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 36px 32px;
    box-shadow: var(--shadow);
}

.login-logo { text-align: center; margin-bottom: 28px; }
.login-title {
    font-family: var(--font-display);
    font-size: 1.8rem; font-weight: 700;
    color: var(--white); letter-spacing: 0.06em;
}
.login-sub { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }

/* ── MISC ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 14px; }
.text-muted { color: var(--muted); font-size: 0.82rem; }
.text-gold { color: var(--gold); }
.text-right { text-align: right; }
.fw-bold { font-weight: 600; }
.hidden { display: none; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--navy); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ══════════════════════════════════════════
   RESPONSIVIDADE
   ══════════════════════════════════════════ */

/* Tablet (< 1024px) */
@media (max-width: 1024px) {
    .form-grid-3 { grid-template-columns: 1fr 1fr; }
    .content { padding: 20px; }
}

/* Mobile Menu (< 900px) */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow);
    }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .menu-toggle { display: flex; }
    .content { padding: 16px; }
    .topbar { padding: 10px 14px; }
    .metrics-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
    .metric-value { font-size: 1.6rem; }
    .page-title { font-size: 1.1rem; }

    /* Tabelas viram scroll horizontal */
    .table-responsive { overflow-x: auto; }
    table { min-width: 600px; }

    /* Topbar — esconder texto do nome no mobile */
    .user-badge span:not(.badge) { display: none; }
}

/* Mobile pequeno (< 600px) */
@media (max-width: 600px) {
    .form-grid, .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
    .metrics-grid { grid-template-columns: 1fr; }
    .filters-bar { flex-direction: column; align-items: stretch; }
    .filters-bar input, .filters-bar select { width: 100%; min-width: 0; }
    .content { padding: 12px; }
    .form-card { padding: 14px; }
    .table-header { flex-direction: column; align-items: flex-start; }
    .table-header .btn { width: 100%; justify-content: center; }
    .login-card { padding: 24px 18px; }

    /* Botões da topbar ficam menores */
    .topbar-actions .btn { padding: 6px 10px; font-size: 0.78rem; }
    .topbar-actions .btn span { display: none; }
}

/* Mobile muito pequeno (< 400px) */
@media (max-width: 400px) {
    .metric-card { padding: 14px; }
    .metric-value { font-size: 1.4rem; }
    .btn { padding: 8px 12px; font-size: 0.8rem; }
}