/* ============================================================
   TaskWindow — folha de estilos (sem build / sem CDN)
   ============================================================ */

:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #f0f2f5;
    --surface-3: #e9edf2;
    --border: #e2e6ec;
    --border-strong: #ccd3dc;

    --text: #1e2633;
    --text-2: #55606f;
    --text-3: #8b95a3;

    --accent: #4f46e5;
    --accent-600: #4338ca;
    --accent-soft: #eef2ff;

    --success: #15803d;
    --success-soft: #dcfce7;
    --warning: #b45309;
    --warning-soft: #fef3c7;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --info: #0369a1;
    --info-soft: #e0f2fe;
    --neutral-soft: #eef1f5;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;

    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .10);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, .16);

    --header-h: 60px;
    font-size: 15px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

.muted { color: var(--text-2); }
.tiny { font-size: .8rem; }
.small { font-size: .85rem; }
.strong { font-weight: 600; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- layout ---------- */
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid { display: grid; gap: 12px; }

.app-header {
    position: sticky; top: 0; z-index: 30;
    height: var(--header-h);
    display: flex; align-items: center; gap: 18px;
    padding: 0 18px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
/* Símbolo da marca no cabeçalho: o SVG é quadrado (136x136) e inclui o halo,
   por isso 26px deixa a janela com o mesmo peso óptico do texto ao lado. */
.brand-mark { width: 26px; height: 26px; display: block; }
.main-nav { display: flex; align-items: center; gap: 4px; }
.main-nav a {
    padding: 7px 12px; border-radius: var(--radius-sm);
    color: var(--text-2); font-weight: 500; font-size: .92rem;
}
.main-nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.main-nav a.active { background: var(--accent-soft); color: var(--accent-600); }
.app-main { padding: 18px; max-width: 1280px; margin: 0 auto; }

.bell { position: relative; }
.bell .badge {
    position: absolute; top: -4px; right: -4px;
    background: var(--danger); color: #fff;
    font-size: .68rem; font-weight: 700;
    min-width: 17px; height: 17px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--accent); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .85rem;
}

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 14px; border-radius: var(--radius-sm);
    border: 1px solid transparent; cursor: pointer;
    font-size: .9rem; font-weight: 500; font-family: inherit;
    transition: background .12s, border-color .12s, color .12s;
    white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-600); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-3); }
.btn-outline { background: transparent; color: var(--text-2); border-color: var(--border-strong); }
.btn-outline:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(.94); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-sm { padding: 5px 10px; font-size: .82rem; }
.btn-icon { padding: 6px; width: 32px; height: 32px; }

/* ---------- forms ---------- */
label.field { display: block; }
.field-label { display: block; font-size: .82rem; color: var(--text-2); margin-bottom: 4px; font-weight: 500; }
.input, .select, .textarea {
    width: 100%; padding: 8px 10px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text);
    font-size: .9rem; font-family: inherit;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-2); color: var(--text-3); cursor: not-allowed; }
.textarea { resize: vertical; min-height: 70px; }
.checkbox { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.form-error { color: var(--danger); font-size: .8rem; margin-top: 4px; }

/* ---------- cards / surfaces ---------- */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 16px; }
.card-head { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* ---------- pills / tags / badges ---------- */
.pill, .tag {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 9px; border-radius: 999px;
    font-size: .76rem; font-weight: 600; white-space: nowrap;
}
.pill-neutral, .tag-neutral { background: var(--neutral-soft); color: var(--text-2); }
.pill-success, .tag-success { background: var(--success-soft); color: var(--success); }
.pill-warning, .tag-warning { background: var(--warning-soft); color: var(--warning); }
.pill-danger, .tag-danger { background: var(--danger-soft); color: var(--danger); }
.pill-info, .tag-info { background: var(--info-soft); color: var(--info); }
.pill-accent { background: var(--accent-soft); color: var(--accent-600); }

.dept-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--dept-color, var(--text-3)); }

/* ---------- callouts ---------- */
.callout { border-radius: var(--radius); padding: 12px 14px; border: 1px solid transparent; font-size: .88rem; }
.callout-info { background: var(--info-soft); color: var(--info); border-color: #bae6fd; }
.callout-warning { background: var(--warning-soft); color: var(--warning); border-color: #fde68a; }
.callout-danger { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }
.callout-success { background: var(--success-soft); color: var(--success); border-color: #bbf7d0; }
.callout-title { font-weight: 700; margin-bottom: 3px; }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table th { color: var(--text-2); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.table tr:hover td { background: var(--surface-2); }

/* ---------- auth / login ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(135deg, #eef2ff, #f5f6f8 60%); }
.auth-card { width: 100%; max-width: 420px; }
/* Logotipo no login: ocupa o lugar do título, então zera as métricas do h1. */
.auth-brand { margin: 0; line-height: 1; text-align: center; }
.auth-brand img { width: 230px; max-width: 100%; height: auto; margin: 0 auto; display: block; }
.auth-demo { margin-top: 14px; font-size: .8rem; color: var(--text-2); background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.auth-demo code { background: var(--surface); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border); }

/* ---------- board / tarefas ---------- */
.board-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.date-nav { display: flex; align-items: center; gap: 6px; }
.date-nav .date-label { min-width: 200px; text-align: center; font-weight: 600; }
.date-nav .month-label { font-size: 1.1rem; font-weight: 700; }

.count-badge {
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border-strong); border-radius: 999px;
    padding: 0 7px; font-size: .72rem; font-weight: 700; line-height: 1.5;
}

/* faixa horizontal com os dias do mês */
.day-strip {
    display: flex; gap: 6px; overflow-x: auto; padding: 10px 8px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    margin-bottom: 14px; scrollbar-width: thin;
}
.day-cell {
    flex: 0 0 auto; width: 56px; padding: 8px 4px 6px;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    color: var(--text-2); text-decoration: none;
}
.day-cell:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.day-wd { font-size: .72rem; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.day-num { font-size: 1.15rem; font-weight: 700; line-height: 1.1; }
.day-meta { display: flex; align-items: center; gap: 4px; min-height: 14px; }
.day-count { font-size: .72rem; color: var(--text-2); font-weight: 600; }
.day-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); }
.day-cell.is-today .day-num { color: var(--accent-600); }
.day-cell.is-selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-600); }
.day-cell.is-selected .day-wd { color: var(--accent-600); }

/* Cada linha recebe --dept-color inline (hex do departamento, paleta em config/taskwindow.php):
   faixa lateral + fundo levemente tingido tornam o departamento reconhecível de relance. */
.task-list { display: flex; flex-direction: column; overflow: hidden; border-radius: var(--radius); }
.task { border-bottom: 1px solid var(--border); border-left: 4px solid var(--dept-color, transparent); }
.task:last-child { border-bottom: 0; }
.task-head {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer;
    background: color-mix(in srgb, var(--dept-color, transparent) 7%, transparent);
}
.task-head:hover { background: color-mix(in srgb, var(--dept-color, var(--text-3)) 16%, var(--surface-2)); }
.task.is-done .task-head { opacity: .6; }
.task-time { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.task-main { flex: 1 1 auto; min-width: 0; }
.task-title { font-weight: 600; }
.task-sub { font-size: .8rem; color: var(--text-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.dept-name {
    font-weight: 600; padding: 1px 8px; border-radius: 999px;
    background: color-mix(in srgb, var(--dept-color, var(--text-3)) 14%, transparent);
    color: color-mix(in srgb, var(--dept-color, var(--text-2)) 65%, #0b1220);
}
.task-pills { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.drag-handle { cursor: grab; color: var(--text-3); font-size: 1rem; user-select: none; line-height: 1; }
.task.is-dragging { opacity: .4; }
.task.drag-over { box-shadow: inset 0 2px 0 var(--accent); }
.chevron { color: var(--text-3); transition: transform .15s; font-size: .8rem; }
.task.open .chevron { transform: rotate(90deg); }

.task-body { padding: 4px 16px 16px; display: none; border-top: 1px dashed var(--border); }
.task.open .task-body { display: block; }
.task-section { margin-top: 14px; }
.task-section > h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-3); margin-bottom: 8px; }

.signoff-list { display: flex; flex-direction: column; gap: 8px; }
.signoff { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.signoff.signed { background: var(--success-soft); border-color: #bbf7d0; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* ---------- seletor de cor do departamento (paleta) ---------- */
.swatch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
.swatch {
    position: relative; display: flex; align-items: center; gap: 8px;
    padding: 7px 10px; cursor: pointer;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.swatch:hover { border-color: var(--border-strong); }
.swatch input { position: absolute; opacity: 0; width: 0; height: 0; }
.swatch-chip {
    width: 16px; height: 16px; border-radius: 50%; flex: 0 0 auto;
    background: var(--dept-color); box-shadow: inset 0 0 0 1px rgba(16, 24, 40, .12);
}
.swatch-name { font-size: .82rem; color: var(--text-2); }
.swatch:has(input:checked) {
    border-color: var(--dept-color);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--dept-color) 28%, transparent);
}
.swatch:has(input:checked) .swatch-name { color: var(--text); font-weight: 600; }
.swatch:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }

.time-field { display: flex; align-items: center; gap: 6px; }
.time-field .input { flex: 1 1 auto; min-width: 0; }
.step-btn { width: 32px; height: 36px; flex: 0 0 auto; padding: 0; font-size: 1rem; line-height: 1; }

.editor-card { border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 14px; background: var(--surface); margin-top: 12px; }
.locked-note { font-size: .82rem; color: var(--warning); display: flex; align-items: center; gap: 6px; }
.file-list { display: flex; flex-direction: column; gap: 6px; }
.file-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); font-size: .85rem; }

/* ---------- métricas / auditoria ---------- */
.metric-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.metric { padding: 14px 16px; }
.metric .value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.metric .label { font-size: .76rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .03em; margin-top: 4px; }
.bar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; min-width: 70px; }
.bar > span { display: block; height: 100%; background: var(--dept-color, var(--accent)); border-radius: 4px; }
/* larguras em passos de 5% (evita style inline dinâmico no Blade) */
.bar span.w0 { width: 0; } .bar span.w5 { width: 5%; } .bar span.w10 { width: 10%; } .bar span.w15 { width: 15%; }
.bar span.w20 { width: 20%; } .bar span.w25 { width: 25%; } .bar span.w30 { width: 30%; } .bar span.w35 { width: 35%; }
.bar span.w40 { width: 40%; } .bar span.w45 { width: 45%; } .bar span.w50 { width: 50%; } .bar span.w55 { width: 55%; }
.bar span.w60 { width: 60%; } .bar span.w65 { width: 65%; } .bar span.w70 { width: 70%; } .bar span.w75 { width: 75%; }
.bar span.w80 { width: 80%; } .bar span.w85 { width: 85%; } .bar span.w90 { width: 90%; } .bar span.w95 { width: 95%; }
.bar span.w100 { width: 100%; }

/* ---------- admin ---------- */
.check-grid { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 4px 0; }
.admin-grid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.admin-link { display: block; color: var(--text); transition: border-color .12s, box-shadow .12s; }
.admin-link:hover { text-decoration: none; border-color: var(--accent); box-shadow: var(--shadow-lg); }

/* ---------- utilities ---------- */
.right { text-align: right; }
.edit-cell { background: var(--surface-2); padding: 14px 16px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--border); border: 0; margin: 12px 0; }

/* ---------- visualizador de arquivos ---------- */
.file-viewer { overflow: hidden; }
.viewer-pad { padding: 16px; }
.img-preview { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.pdf-frame { display: block; width: 100%; height: 82vh; border: 0; background: var(--surface-2); }
.text-preview { margin: 0; padding: 16px; max-height: 82vh; overflow: auto; white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .86rem; line-height: 1.5; }
.table-scroll { overflow: auto; max-height: 82vh; }
.table-dense td { padding: 4px 10px; font-size: .84rem; }

/* ---------- etapas de conclusão ---------- */
.signoff.current { border-color: var(--accent); background: var(--accent-soft); }
.stages-box { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; background: var(--surface-2); }
.stage-editor { display: flex; flex-direction: column; gap: 8px; }
.stage-row { display: grid; grid-template-columns: 22px minmax(150px, 1.6fr) repeat(3, minmax(96px, 1fr)) minmax(112px, 1.1fr) 118px 92px auto auto; gap: 8px; align-items: end; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.stage-row .field-label { font-size: .68rem; }
.stage-num { align-self: center; color: var(--muted); cursor: grab; text-align: center; }
