/* Identidade Visual CALFER - Caldeiraria e Ferramentaria */
:root {
    --primary: #0f3d68;
    --primary-dark: #092744;
    --accent: #1d6fa5;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --border: #cbd5e1;
    --success: #15803d;
    --danger: #b91c1c;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { background: var(--bg); color: var(--text); }
.hidden { display: none !important; }
.w-100 { width: 100%; }
.text-center { text-align: center; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-primary { color: var(--accent); }
.text-muted { color: var(--muted); font-size: 0.88rem; }

/* Login */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, var(--primary-dark), var(--primary)); padding: 20px; }
.login-card { background: var(--surface); padding: 36px; border-radius: 12px; width: 100%; max-width: 420px; box-shadow: 0 15px 35px rgba(0,0,0,0.25); }
.login-header { text-align: center; margin-bottom: 24px; }
.company-logo { max-height: 75px; margin-bottom: 10px; object-fit: contain; }
.login-header h1 { color: var(--primary); font-size: 1.6rem; letter-spacing: 1px; }
.subtitle { color: var(--muted); font-size: 0.9rem; margin-bottom: 8px; }
.badge-system { display: inline-block; background: #e0f2fe; color: var(--primary); font-size: 0.78rem; font-weight: 600; padding: 4px 10px; border-radius: 20px; }

/* Formulários e Botões */
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 0.84rem; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.form-group input, .form-group select { width: 100%; padding: 8px 11px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem; background: #fff; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--accent); }
.btn-primary { background: var(--primary); color: #fff; border: none; padding: 10px 16px; border-radius: 6px; cursor: pointer; font-weight: 600; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--accent); color: #fff; border: none; padding: 10px 14px; border-radius: 6px; cursor: pointer; font-weight: 600; }
.btn-danger { background: var(--danger); color: #fff; border: none; padding: 10px 16px; border-radius: 6px; cursor: pointer; font-weight: 600; }
.btn-danger:hover { background: #991b1b; }
.btn-outline { background: transparent; border: 1px solid var(--border); padding: 8px 14px; border-radius: 6px; cursor: pointer; }
.auth-links { text-align: center; margin-top: 14px; font-size: 0.85rem; }
.auth-links a { color: var(--accent); text-decoration: none; }
.alert { margin-top: 14px; padding: 10px; border-radius: 6px; font-size: 0.85rem; text-align: center; }
.alert.error { background: #fee2e2; color: var(--danger); }
.alert.success { background: #dcfce7; color: var(--success); }

/* Destaque Passo 1 no Cadastro */
.step-highlight { background: #f0f9ff; border: 1px solid #bae6fd; padding: 14px 16px 4px; border-radius: 8px; margin-bottom: 16px; }

/* Topbar e Abas */
.topbar { background: var(--primary); color: #fff; padding: 12px 24px; display: flex; justify-content: space-between; align-items: center; }
.topbar-brand { display: flex; align-items: center; gap: 12px; }
.topbar-logo { height: 42px; background: #fff; padding: 4px; border-radius: 6px; }
.topbar-brand small { display: block; opacity: 0.85; font-size: 0.8rem; }
.topbar-user { display: flex; align-items: center; gap: 12px; font-size: 0.9rem; }
.topbar .btn-outline { color: #fff; border-color: rgba(255,255,255,0.4); }

.tabs-nav { background: #fff; border-bottom: 1px solid var(--border); box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.tabs-container { display: flex; gap: 6px; overflow-x: auto; padding: 0 16px; margin: 0 auto; max-width: 1440px; }
.tab-btn { background: none; border: none; padding: 14px 18px; font-size: 0.92rem; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.container { max-width: 1440px; margin: 20px auto; padding: 0 16px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--surface); padding: 18px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); border-left: 4px solid var(--primary); }
.stat-card span { font-size: 0.84rem; color: var(--muted); }
.stat-card strong { display: block; font-size: 1.8rem; margin-top: 6px; }

/* Gráficos Dashboard */
.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(460px, 1fr)); gap: 18px; }
.chart-card h3 { color: var(--primary); margin-bottom: 12px; font-size: 1rem; }
.chart-wrapper { position: relative; height: 290px; width: 100%; }

.dashboard-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 18px; }
.summary-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.summary-row { display: flex; justify-content: space-between; padding: 8px 10px; background: #f8fafc; border-radius: 6px; font-size: 0.9rem; }

.card { background: var(--surface); padding: 20px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); margin-bottom: 18px; }
.section-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.filters-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }

/* Módulo Informações (Normas) */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.info-box { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 16px; }
.info-box h4 { color: var(--primary); margin-bottom: 8px; font-size: 0.95rem; }
.info-box p { font-size: 0.9rem; line-height: 1.55; color: var(--text); }
.highlight-equiv { background: #f0f9ff; border-color: #bae6fd; }

.danger-zone { margin-top: 22px; padding: 16px; border: 1px solid #fecaca; background: #fef2f2; border-radius: 8px; }
.danger-zone h4 { color: var(--danger); }

/* Tabela */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
th, td { padding: 9px 7px; border-bottom: 1px solid #e2e8f0; text-align: left; }
th { background: #f8fafc; color: var(--primary); font-weight: 700; white-space: nowrap; }
.btn-sm { padding: 4px 8px; font-size: 0.76rem; border-radius: 4px; cursor: pointer; border: 1px solid var(--border); background: #fff; margin-right: 3px; text-decoration: none; color: var(--text); display: inline-block; }
.btn-sm:hover { background: #f1f5f9; }

.tags-container { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tag-chip { background: #e0f2fe; color: var(--primary); padding: 5px 10px; border-radius: 16px; font-size: 0.82rem; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.tag-chip button { background: none; border: none; color: var(--danger); font-weight: bold; cursor: pointer; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 1000; }
.modal-content { background: #fff; width: 100%; border-radius: 10px; padding: 20px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; border-bottom: 1px solid #e2e8f0; padding-bottom: 10px; }
.btn-close { background: none; border: none; font-size: 1.6rem; cursor: pointer; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* Sub-abas dentro do módulo Normas */
.subtabs-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.subtab-btn { background: #fff; border: 1px solid var(--border); padding: 9px 15px; border-radius: 6px; font-size: 0.86rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.subtab-btn:hover { border-color: var(--primary); color: var(--primary); }
.subtab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tag-chip .btn-edit-tag { color: var(--primary); font-size: 0.8rem; margin-left: 2px; }

/* Calculadoras no módulo Normas */
.calc-result-box { background: #f8fafc; border: 1px solid #cbd5e1; border-radius: 8px; padding: 18px; }
.calc-cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 10px; }
.calc-metric { background: #fff; border: 1px solid #e2e8f0; border-left: 4px solid var(--primary); border-radius: 6px; padding: 12px; }
.calc-metric span { display: block; font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.calc-metric strong { display: block; font-size: 1.25rem; color: var(--primary); margin-top: 4px; }


/* ========================================================================== */
/* TELA DE LOGIN CORPORATIVA (SPLIT-SCREEN + PWA)                             */
/* ========================================================================== */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #061a2e 0%, #0f3d68 55%, #165185 100%);
    padding: 24px;
}

.login-wrapper {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    width: 100%;
    max-width: 980px;
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.38);
}

.login-hero {
    background: linear-gradient(160deg, #092744 0%, #0f3d68 65%, #165285 100%);
    color: #ffffff;
    padding: 42px 38px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 24px;
}

.hero-logo-box {
    display: inline-flex;
    background: #ffffff;
    padding: 10px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.hero-logo {
    max-height: 54px;
    object-fit: contain;
}

.hero-tag {
    display: inline-block;
    background: rgba(56, 189, 248, 0.2);
    border: 1px solid rgba(56, 189, 248, 0.45);
    color: #bae6fd;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 10px;
}

.login-hero h1 {
    font-size: 2rem;
    letter-spacing: 1.5px;
    margin-bottom: 2px;
}

.hero-subtitle {
    color: #bae6fd;
    font-size: 0.98rem;
    font-weight: 500;
    margin-bottom: 14px;
}

.hero-desc {
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.9rem;
    line-height: 1.55;
}

.hero-features {
    display: flex;
    flex-direction: column;
    gap: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    padding-top: 18px;
}

.hero-feat-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.feat-dot {
    width: 10px;
    height: 10px;
    min-width: 10px;
    border-radius: 50%;
    background: #38bdf8;
    margin-top: 5px;
}

.hero-feat-item strong {
    display: block;
    font-size: 0.88rem;
    color: #ffffff;
}

.hero-feat-item small {
    display: block;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.4;
}

.hero-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.78rem;
}

.btn-install-pwa {
    background: rgba(56, 189, 248, 0.18);
    color: #ffffff;
    border: 1px solid #38bdf8;
    padding: 9px 14px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-install-pwa:hover {
    background: rgba(56, 189, 248, 0.35);
}

.login-panel {
    padding: 46px 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
}

.login-panel-inner {
    width: 100%;
    max-width: 360px;
}

.mobile-brand {
    display: none;
    text-align: center;
    margin-bottom: 18px;
}

.login-panel-header {
    margin-bottom: 24px;
}

.login-panel-header h2 {
    color: var(--primary);
    font-size: 1.55rem;
    margin-bottom: 6px;
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    padding-right: 40px;
}

.btn-toggle-pass {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.65;
    padding: 4px;
}

.btn-toggle-pass:hover {
    opacity: 1;
}

.btn-lg {
    padding: 12px 16px;
    font-size: 0.96rem;
    margin-top: 6px;
}

.login-security-note {
    margin-top: 26px;
    padding-top: 14px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.45;
}

@media (max-width: 820px) {
    .login-wrapper {
        grid-template-columns: 1fr;
        max-width: 440px;
    }
    .login-hero {
        display: none;
    }
    .mobile-brand {
        display: block;
    }
    .login-panel {
        padding: 32px 26px;
    }
}
