/* FREEYOND O.S. — Design system base */
:root {
    --fy-bg: #f4f6f9;
    --fy-surface: #ffffff;
    --fy-border: #e3e7ee;
    --fy-text: #1c2333;
    --fy-text-muted: #6b7280;
    --fy-primary: #1e3a8a;
    --fy-primary-light: #3b5bdb;
    --fy-accent: #0ea5a4;
    --fy-success: #16a34a;
    --fy-warning: #d97706;
    --fy-danger: #dc2626;
    --fy-critical: #b91c1c;
    --fy-sidebar-bg: #101828;
    --fy-sidebar-text: #cbd5e1;
    --fy-radius: 10px;
    --fy-shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.06);
    font-size: 15px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
    background: var(--fy-bg);
    color: var(--fy-text);
}

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

.app-shell { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
    width: 250px;
    background: var(--fy-sidebar-bg);
    color: var(--fy-sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand-mark {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--fy-primary-light), var(--fy-accent));
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: #fff;
}
.sidebar-brand strong { display: block; color: #fff; font-size: 15px; }
.sidebar-brand small { color: #94a3b8; font-size: 11px; letter-spacing: .03em; }

.sidebar-nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.nav-item {
    display: block;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 2px;
    font-size: 14px;
    color: var(--fy-sidebar-text);
    transition: background .15s;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }

.sidebar-logout { padding: 14px; border-top: 1px solid rgba(255,255,255,0.08); }
.btn-logout {
    width: 100%; padding: 10px; border: none; border-radius: 8px;
    background: rgba(220,38,38,0.15); color: #fca5a5; font-weight: 600; cursor: pointer;
}
.btn-logout:hover { background: rgba(220,38,38,0.28); }

/* ---------- Main ---------- */
.main-content { flex: 1; min-width: 0; }
.topbar {
    background: var(--fy-surface);
    border-bottom: 1px solid var(--fy-border);
    padding: 14px 24px;
    display: flex; align-items: center; gap: 16px;
    position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-weight: 700; font-size: 18px; flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--fy-text-muted); }
.menu-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; }

.role-badge { padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.role-admin { background: #ede9fe; color: #6d28d9; }
.role-gestor { background: #dbeafe; color: #1d4ed8; }
.role-supervisor { background: #fef3c7; color: #92400e; }
.role-colaborador { background: #dcfce7; color: #15803d; }

.content-area { padding: 24px; max-width: 1400px; }

/* ---------- Componentes ---------- */
.card {
    background: var(--fy-surface);
    border: 1px solid var(--fy-border);
    border-radius: var(--fy-radius);
    box-shadow: var(--fy-shadow);
    padding: 20px;
    margin-bottom: 20px;
}
.card h2, .card h3 { margin-top: 0; }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.alert-warning { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.alert-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

.btn {
    display: inline-block; padding: 10px 18px; border-radius: 8px; border: none;
    font-weight: 600; font-size: 14px; cursor: pointer; text-align: center;
}
.btn-primary { background: var(--fy-primary); color: #fff; }
.btn-primary:hover { background: var(--fy-primary-light); }
.btn-success { background: var(--fy-success); color: #fff; }
.btn-warning { background: var(--fy-warning); color: #fff; }
.btn-danger { background: var(--fy-danger); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--fy-border); color: var(--fy-text); }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--fy-text-muted); }
.form-control {
    width: 100%; padding: 10px 12px; border: 1px solid var(--fy-border);
    border-radius: 8px; font-size: 14px; background: #fff; color: var(--fy-text);
}
.form-control:focus { outline: none; border-color: var(--fy-primary-light); box-shadow: 0 0 0 3px rgba(59,91,219,0.15); }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 200px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
table th { text-align: left; padding: 10px 12px; color: var(--fy-text-muted); font-size: 12px; text-transform: uppercase; border-bottom: 2px solid var(--fy-border); }
table td { padding: 12px; border-bottom: 1px solid var(--fy-border); }
table tr:hover td { background: #fafbfc; }

.status-pill { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; display: inline-block; }
.status-nova { background: #f1f5f9; color: #475569; }
.status-agendada { background: #dbeafe; color: #1d4ed8; }
.status-aguardando_execucao { background: #fef9c3; color: #a16207; }
.status-em_execucao { background: #dcfce7; color: #15803d; }
.status-pausada { background: #ffedd5; color: #c2410c; }
.status-concluida { background: #e0e7ff; color: #4338ca; }
.status-cancelada { background: #fee2e2; color: #b91c1c; }

.badge-no_prazo { color: #16a34a; }
.badge-atencao { color: #d97706; }
.badge-atrasado { color: #ea580c; }
.badge-procrastinacao_critica { color: #b91c1c; font-weight: 700; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card { background: var(--fy-surface); border: 1px solid var(--fy-border); border-radius: var(--fy-radius); padding: 18px; box-shadow: var(--fy-shadow); }
.kpi-value { font-size: 28px; font-weight: 800; }
.kpi-label { font-size: 12px; color: var(--fy-text-muted); text-transform: uppercase; letter-spacing: .02em; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f1b3d, #16233f 55%, #0ea5a4); padding: 20px; }
.login-card { background: #fff; border-radius: 16px; padding: 40px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand .brand-mark { margin: 0 auto 12px; width: 52px; height: 52px; font-size: 22px; }
.login-brand h1 { font-size: 20px; margin: 0; }
.login-brand p { color: var(--fy-text-muted); font-size: 13px; margin: 4px 0 0; }
.login-card .btn { width: 100%; margin-top: 6px; }

/* ---------- Timer widget ---------- */
.timer-display {
    font-size: 42px; font-weight: 800; font-variant-numeric: tabular-nums;
    text-align: center; padding: 16px; border-radius: var(--fy-radius);
    background: #0f172a; color: #4ade80; letter-spacing: .04em;
}

/* ---------- Responsivo ---------- */
@media (max-width: 900px) {
    .sidebar { position: fixed; left: -260px; z-index: 40; transition: left .2s; box-shadow: 0 0 40px rgba(0,0,0,0.3); }
    .sidebar.open { left: 0; }
    .menu-toggle { display: block; }
    .content-area { padding: 16px; }
}

/* ================================================================
   PAINEL DO COLABORADOR — layout dedicado, mobile-first
   Interface própria para operação em campo: fontes grandes, botões
   grandes, áreas de toque generosas, sem menu lateral permanente.
   ================================================================ */
.pc-body { margin: 0; background: var(--fy-bg); font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif; }
.pc-shell { max-width: 640px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; background: var(--fy-bg); }

.pc-topbar {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px;
    background: var(--fy-sidebar-bg); color: #fff; position: sticky; top: 0; z-index: 20;
}
.pc-menu-btn {
    background: rgba(255,255,255,0.1); border: none; color: #fff; font-size: 22px;
    width: 44px; height: 44px; border-radius: 10px; cursor: pointer; flex-shrink: 0;
}
.pc-brand { display: flex; align-items: center; gap: 8px; flex: 1; font-size: 15px; }
.pc-user-avatar {
    width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--fy-primary-light), var(--fy-accent));
    color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0;
}

/* Abas fixas — sempre visíveis, nunca escondidas em menu */
.pc-tabs {
    display: flex; gap: 8px; padding: 12px 16px; background: var(--fy-surface);
    border-bottom: 1px solid var(--fy-border); position: sticky; top: 64px; z-index: 19;
}
.pc-tab {
    flex: 1; text-align: center; padding: 16px 8px; font-size: 15px; font-weight: 800;
    border-radius: 12px; background: #eef1f6; color: var(--fy-text); letter-spacing: .02em;
    min-height: 52px; display: flex; align-items: center; justify-content: center;
}
.pc-tab.active { background: var(--fy-primary); color: #fff; box-shadow: 0 4px 12px rgba(30,58,138,0.3); }

.pc-content { flex: 1; padding: 16px; padding-bottom: 40px; }

/* Drawer off-canvas */
.pc-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 49;
    opacity: 0; pointer-events: none; transition: opacity .2s;
}
.pc-overlay.open { opacity: 1; pointer-events: auto; }
.pc-drawer {
    position: fixed; top: 0; left: -300px; width: 280px; height: 100vh; background: #fff;
    z-index: 50; transition: left .2s; box-shadow: 4px 0 30px rgba(0,0,0,0.2); padding: 20px 0; overflow-y: auto;
}
.pc-drawer.open { left: 0; }
.pc-drawer-header { display: flex; align-items: center; gap: 12px; padding: 8px 20px 20px; border-bottom: 1px solid var(--fy-border); margin-bottom: 10px; }
.pc-drawer-item {
    display: block; width: 100%; text-align: left; padding: 16px 20px; font-size: 16px; font-weight: 600;
    color: var(--fy-text); border: none; background: none; cursor: pointer; box-sizing: border-box;
}
.pc-drawer-item:hover { background: #f4f6f9; }
.pc-drawer-logout { color: var(--fy-danger); border-top: 1px solid var(--fy-border); margin-top: 10px; }

/* Cards de O.S. — informação essencial em destaque, fácil de ler sem zoom */
.pc-os-card {
    background: var(--fy-surface); border-radius: 16px; padding: 18px; margin-bottom: 14px;
    box-shadow: 0 2px 10px rgba(16,24,40,0.08); border-left: 6px solid var(--fy-border);
}
.pc-os-card.em-execucao { border-left-color: var(--fy-success); }
.pc-os-card.pausada { border-left-color: var(--fy-warning); }
.pc-os-card.concluida { border-left-color: #4338ca; }

.pc-os-hora { font-size: 22px; font-weight: 800; color: var(--fy-text); }
.pc-os-numero { font-size: 13px; color: var(--fy-text-muted); font-weight: 600; }
.pc-os-atividade { font-size: 19px; font-weight: 700; margin: 8px 0 6px; line-height: 1.3; }
.pc-os-meta { font-size: 15px; color: var(--fy-text-muted); line-height: 1.6; }
.pc-os-status {
    display: inline-block; padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; margin-top: 10px;
}

.pc-timer { font-size: 44px; font-weight: 800; text-align: center; padding: 20px; border-radius: 16px;
    background: #0f172a; color: #4ade80; margin: 14px 0; letter-spacing: .03em; font-variant-numeric: tabular-nums; }

/* Botões grandes, fáceis de tocar */
.pc-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.pc-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 18px; font-size: 18px; font-weight: 800; border-radius: 14px; border: none;
    cursor: pointer; min-height: 58px; width: 100%; box-sizing: border-box;
}
.pc-btn-start { background: var(--fy-success); color: #fff; }
.pc-btn-pause { background: var(--fy-warning); color: #fff; }
.pc-btn-resume { background: var(--fy-success); color: #fff; }
.pc-btn-finish { background: var(--fy-primary); color: #fff; }
.pc-btn:active { transform: scale(0.98); }

.pc-empty { text-align: center; padding: 60px 20px; color: var(--fy-text-muted); font-size: 17px; }

/* Modal de pausa — mesmo padrão grande */
.pc-pause-form { background: #fffbeb; border: 1px solid #fde68a; border-radius: 14px; padding: 16px; margin-top: 14px; }
.pc-pause-form select, .pc-pause-form input {
    width: 100%; padding: 14px; font-size: 16px; border-radius: 10px; border: 1px solid var(--fy-border); box-sizing: border-box;
}

@media (min-width: 641px) {
    .pc-shell { box-shadow: 0 0 40px rgba(0,0,0,0.08); }
}

/* ---------- Agenda — responsividade em telas pequenas ---------- */
@media (max-width: 600px) {
    .agenda-periodo-btns { flex-direction: column; }
    .agenda-periodo-btns .btn { width: 100%; text-align: center; }
    .agenda-nav-row { flex-wrap: wrap; }
    .agenda-nav-row .btn { flex: 1; min-width: 100px; }
    .agenda-nav-row span { width: 100%; margin-left: 0 !important; margin-top: 8px; }
}
