/* Power Safety Manager - Public CSS */
:root {
  --psm-blue:    #0B3D91;
  --psm-orange:  #E8530A;
  --psm-green:   #2e7d32;
  --psm-red:     #c62828;
  --psm-gray:    #f4f6fb;
  --psm-border:  #e0e4ed;
  --psm-text:    #1a1a2e;
  --psm-muted:   #666;
  --psm-radius:  8px;
}

/* ── Portal Container ──────────────────────── */
.psm-portal { max-width: 960px; margin: 40px auto; padding: 0 20px; }
.psm-page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; flex-wrap: wrap; gap: 12px; }
.psm-page-header h2 { font-size: 1.6rem; font-weight: 800; color: var(--psm-text); margin: 0; }

/* ── Auth Box ──────────────────────────────── */
.psm-auth-container { display: flex; justify-content: center; padding: 40px 0; }
.psm-auth-box { background: #fff; border-radius: 16px; box-shadow: 0 8px 40px rgba(0,0,0,.1); padding: 40px; width: 100%; max-width: 440px; }
.psm-auth-logo { text-align: center; font-size: 1.6rem; font-weight: 800; color: var(--psm-blue); margin-bottom: 28px; }
.psm-auth-tabs { display: flex; gap: 4px; background: var(--psm-gray); padding: 4px; border-radius: 8px; margin-bottom: 24px; }
.psm-auth-tab { flex: 1; padding: 9px; text-align: center; border-radius: 6px; border: none; background: transparent; cursor: pointer; font-weight: 600; color: var(--psm-muted); font-size: .9rem; transition: all .2s; }
.psm-auth-tab.active { background: #fff; color: var(--psm-blue); box-shadow: 0 1px 4px rgba(0,0,0,.1); }

/* ── Portal Dashboard ──────────────────────── */
.psm-portal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; flex-wrap: wrap; gap: 12px; }
.psm-portal-header h2 { margin: 0; font-size: 1.4rem; font-weight: 700; color: var(--psm-text); }
.psm-portal-header p { color: var(--psm-muted); font-size: .9rem; margin: 4px 0 0; }
.psm-portal-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 16px; margin-bottom: 32px; }
.psm-pcard {
  background: #fff; border-radius: 12px; padding: 24px 16px; text-align: center;
  box-shadow: 0 2px 12px rgba(0,0,0,.06); text-decoration: none;
  transition: transform .2s, box-shadow .2s; border-top: 4px solid transparent;
  display: block;
}
.psm-pcard:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,.1); text-decoration: none; }
.psm-pcard-blue   { border-top-color: var(--psm-blue); }
.psm-pcard-orange { border-top-color: var(--psm-orange); }
.psm-pcard-purple { border-top-color: #6a1b9a; }
.psm-pcard-icon   { font-size: 2rem; margin-bottom: 10px; }
.psm-pcard-number { font-size: 1.8rem; font-weight: 800; color: var(--psm-text); }
.psm-pcard-label  { font-size: .8rem; color: var(--psm-muted); margin-top: 4px; }

/* ── Sections ──────────────────────────────── */
.psm-portal-section { margin-top: 32px; }
.psm-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.psm-section-header h3 { font-size: 1.1rem; font-weight: 700; color: var(--psm-text); margin: 0; }

/* ── OS cards ──────────────────────────────── */
.psm-os-item { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: #fff; border-radius: 8px; margin-bottom: 10px; box-shadow: 0 1px 6px rgba(0,0,0,.06); }
.psm-os-item-left { display: flex; flex-direction: column; gap: 3px; }
.psm-os-item-left strong { font-size: .85rem; color: var(--psm-blue); }
.psm-os-item-left span  { font-size: .95rem; color: var(--psm-text); font-weight: 500; }
.psm-os-item-left small { color: var(--psm-muted); font-size: .8rem; }

.psm-filter-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.psm-pill { padding: 6px 16px; border-radius: 20px; background: #fff; border: 1.5px solid var(--psm-border); cursor: pointer; font-size: .85rem; font-weight: 500; color: var(--psm-muted); transition: all .2s; }
.psm-pill.active { background: var(--psm-blue); color: #fff; border-color: var(--psm-blue); }

.psm-os-list { display: flex; flex-direction: column; gap: 12px; }
.psm-os-card {
  background: #fff; border-radius: 10px; padding: 18px; cursor: pointer;
  box-shadow: 0 1px 6px rgba(0,0,0,.07); border-left: 4px solid var(--psm-border);
  transition: box-shadow .2s, transform .2s;
}
.psm-os-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12); transform: translateX(3px); }
.psm-os-status-aberta       { border-left-color: #1565c0; }
.psm-os-status-em_andamento { border-left-color: var(--psm-orange); }
.psm-os-status-concluida    { border-left-color: var(--psm-green); }
.psm-os-status-urgente      { border-left-color: var(--psm-red); }
.psm-os-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.psm-os-num { font-size: .82rem; font-weight: 700; color: var(--psm-blue); }
.psm-os-card-title { font-size: 1rem; font-weight: 600; color: var(--psm-text); margin-bottom: 8px; }
.psm-os-card-meta  { display: flex; align-items: center; gap: 12px; font-size: .82rem; color: var(--psm-muted); flex-wrap: wrap; }

/* ── Tickets ───────────────────────────────── */
.psm-ticket-list { display: flex; flex-direction: column; gap: 10px; }
.psm-ticket-card {
  background: #fff; border-radius: 10px; padding: 16px; cursor: pointer;
  box-shadow: 0 1px 6px rgba(0,0,0,.07); transition: box-shadow .2s;
}
.psm-ticket-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12); }
.psm-ticket-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.psm-ticket-num-badge { font-size: .8rem; font-weight: 700; color: var(--psm-blue); }
.psm-ticket-subject { font-size: .95rem; font-weight: 600; color: var(--psm-text); margin-bottom: 4px; }
.psm-ticket-meta { font-size: .8rem; color: var(--psm-muted); }

/* ── Mensagens ─────────────────────────────── */
.psm-msg { padding: 12px; border-radius: 10px; margin-bottom: 10px; max-width: 82%; }
.psm-msg-admin  { background: #e3f2fd; margin-left: auto; }
.psm-msg-client { background: #f5f5f5; }
.psm-msg-interno { opacity: .7; border-left: 3px solid #6a1b9a; }
.psm-msg-meta   { font-size: .75rem; color: var(--psm-muted); margin-bottom: 4px; display: flex; justify-content: space-between; }
.psm-msg-body   { font-size: .9rem; }

/* ── Vagas ─────────────────────────────────── */
.psm-jobs-intro { background: #e8f0fe; border-radius: 10px; padding: 20px 24px; margin-bottom: 32px; color: var(--psm-text); }
.psm-vagas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 20px; margin-bottom: 32px; }
.psm-vaga-card { background: #fff; border-radius: 12px; padding: 24px; box-shadow: 0 2px 12px rgba(0,0,0,.07); }
.psm-vaga-espontanea { background: var(--psm-gray); text-align: center; }
.psm-vaga-area { font-size: .8rem; font-weight: 700; letter-spacing: .5px; color: var(--psm-blue); margin-bottom: 10px; }
.psm-vaga-title { font-size: 1.1rem; font-weight: 700; color: var(--psm-text); margin-bottom: 10px; }
.psm-vaga-desc  { font-size: .88rem; color: var(--psm-muted); margin-bottom: 12px; }
.psm-vaga-req   { font-size: .82rem; color: var(--psm-text); background: var(--psm-gray); padding: 10px; border-radius: 6px; margin-bottom: 16px; }

/* ── Teste ─────────────────────────────────── */
.psm-test-loading { text-align: center; padding: 60px; color: var(--psm-muted); }
.psm-test-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.psm-test-prog-bar { flex: 1; height: 8px; background: var(--psm-gray); border-radius: 4px; overflow: hidden; }
.psm-test-prog-bar div { height: 100%; background: var(--psm-blue); border-radius: 4px; transition: width .3s; }
.psm-question-block { background: #fff; border-radius: 12px; padding: 24px; margin-bottom: 16px; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.psm-question-num { font-size: .78rem; font-weight: 700; color: var(--psm-blue); margin-bottom: 8px; letter-spacing: .5px; text-transform: uppercase; }
.psm-question-text { font-size: 1rem; font-weight: 600; color: var(--psm-text); margin-bottom: 18px; line-height: 1.5; }
.psm-options { display: flex; flex-direction: column; gap: 10px; }
.psm-option {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px;
  border: 2px solid var(--psm-border); border-radius: 8px; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.psm-option:has(input:checked) { border-color: var(--psm-blue); background: #e8f0fe; }
.psm-option input { display: none; }
.psm-option-letter {
  width: 28px; height: 28px; border-radius: 50%; background: var(--psm-gray);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; color: var(--psm-blue); flex-shrink: 0;
}
.psm-option:has(input:checked) .psm-option-letter { background: var(--psm-blue); color: #fff; }

/* ── Resultado ─────────────────────────────── */
.psm-result-box { text-align: center; padding: 48px 32px; border-radius: 16px; margin: 20px 0; }
.psm-result-ok   { background: linear-gradient(135deg, #e8f5e9, #f1f8e9); }
.psm-result-fail { background: linear-gradient(135deg, #fff3e0, #fce4ec); }
.psm-result-icon { font-size: 4rem; margin-bottom: 16px; }
.psm-result-box h2 { font-size: 1.6rem; font-weight: 800; margin-bottom: 12px; }
.psm-result-score { font-size: 1.3rem; font-weight: 700; margin-bottom: 16px; color: var(--psm-blue); }

/* ── CV Upload ─────────────────────────────── */
.psm-upload-area {
  border: 2px dashed var(--psm-border); border-radius: 12px; padding: 40px;
  text-align: center; cursor: pointer; transition: border-color .2s, background .2s;
}
.psm-upload-area:hover, .psm-upload-area.drag-over { border-color: var(--psm-blue); background: #e8f0fe; }
.psm-upload-icon { font-size: 3rem; margin-bottom: 12px; }
.psm-upload-area p { color: var(--psm-text); font-weight: 500; margin-bottom: 4px; }
.psm-upload-area small { color: var(--psm-muted); }

/* ── Formulários ───────────────────────────── */
.psm-form-card { background: #fff; border-radius: 12px; padding: 32px; box-shadow: 0 4px 24px rgba(0,0,0,.08); }
.psm-field { margin-bottom: 16px; }
.psm-field label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 6px; color: var(--psm-muted); }
.psm-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 16px; }
.psm-input, .psm-select, .psm-textarea {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--psm-border);
  border-radius: 8px; font-size: .93rem; color: var(--psm-text); background: #fff;
  transition: border .2s; font-family: inherit;
}
.psm-input:focus, .psm-select:focus, .psm-textarea:focus { outline: none; border-color: var(--psm-blue); box-shadow: 0 0 0 3px rgba(11,61,145,.1); }
.psm-textarea { resize: vertical; min-height: 90px; }

/* ── Botões ────────────────────────────────── */
.psm-btn {
  background: var(--psm-blue); color: #fff; border: none; padding: 10px 22px;
  border-radius: 8px; font-weight: 700; cursor: pointer; font-size: .9rem;
  transition: background .2s, transform .2s; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.psm-btn:hover { background: #082d6e; transform: translateY(-1px); text-decoration: none; color: #fff; }
.psm-btn-block { width: 100%; justify-content: center; }
.psm-btn-large { padding: 14px 28px; font-size: 1.05rem; }
.psm-btn-sm    { padding: 6px 14px; font-size: .82rem; }
.psm-btn-outline {
  background: transparent; color: var(--psm-blue); border: 2px solid var(--psm-blue);
  padding: 8px 18px; border-radius: 8px; font-weight: 600; cursor: pointer;
  font-size: .88rem; transition: all .2s; text-decoration: none;
}
.psm-btn-outline:hover { background: var(--psm-blue); color: #fff; text-decoration: none; }

/* ── Alerts ────────────────────────────────── */
.psm-alert { padding: 12px 16px; border-radius: 8px; font-size: .9rem; margin-bottom: 16px; }
.psm-alert-warning { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; }
.psm-alert-error   { background: #ffebee; color: var(--psm-red); border: 1px solid #ef9a9a; }
.psm-alert-success { background: #e8f5e9; color: var(--psm-green); border: 1px solid #a5d6a7; }

/* ── Badges (público) ──────────────────────── */
.psm-badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: .75rem; font-weight: 600; background: #e8eaf6; color: #3f51b5; }
.psm-status-aberta       { background: #e3f2fd; color: #1565c0; }
.psm-status-em_andamento { background: #fff3e0; color: #e65100; }
.psm-status-concluida    { background: #e8f5e9; color: var(--psm-green); }
.psm-status-cancelada    { background: #efebe9; color: #4e342e; }
.psm-status-aberto       { background: #e3f2fd; color: #1565c0; }
.psm-status-resolvido    { background: #e8f5e9; color: var(--psm-green); }
.psm-status-fechado      { background: #f5f5f5; color: #757575; }
.psm-badge-baixa  { background: #e8f5e9; color: var(--psm-green); }
.psm-badge-normal { background: #e3f2fd; color: #1565c0; }
.psm-badge-alta   { background: #fff3e0; color: #e65100; }
.psm-badge-urgente{ background: #ffebee; color: var(--psm-red); }

/* ── Empty state ───────────────────────────── */
.psm-empty-state { text-align: center; padding: 60px 20px; color: var(--psm-muted); }
.psm-empty-state p { margin: 12px 0 20px; font-size: 1rem; }
.psm-empty { color: var(--psm-muted); font-size: .9rem; padding: 20px; text-align: center; }

/* ── Link ──────────────────────────────────── */
.psm-link { color: var(--psm-blue); font-size: .88rem; font-weight: 600; text-decoration: none; }
.psm-link:hover { text-decoration: underline; }

/* ── Hist (public) ─────────────────────────── */
.psm-hist-item { padding: 10px 0; border-bottom: 1px solid var(--psm-border); }
.psm-hist-meta { font-size: .78rem; color: var(--psm-muted); margin-bottom: 4px; }
.psm-hist-msg  { font-size: .88rem; white-space: pre-wrap; }

/* ── Modal ─────────────────────────────────── */
.psm-modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 16px; }
.psm-modal-box { background: #fff; border-radius: 14px; width: 100%; max-width: 580px; box-shadow: 0 20px 60px rgba(0,0,0,.2); max-height: 92vh; overflow-y: auto; }
.psm-modal-large { max-width: 760px; }
.psm-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--psm-border); }
.psm-modal-header h3 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.psm-modal-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--psm-muted); }
.psm-modal-body { padding: 20px 24px; }
.psm-modal-footer { padding: 16px 24px; border-top: 1px solid var(--psm-border); text-align: right; }
.psm-detail-table { width: 100%; border-collapse: collapse; }
.psm-detail-table th { padding: 9px 14px; background: var(--psm-gray); font-size: .82rem; color: var(--psm-muted); width: 130px; font-weight: 600; }
.psm-detail-table td { padding: 9px 14px; border-top: 1px solid var(--psm-border); font-size: .9rem; }

/* ── Spinner ───────────────────────────────── */
.psm-spinner { width: 40px; height: 40px; border: 4px solid var(--psm-border); border-top-color: var(--psm-blue); border-radius: 50%; animation: psm-spin .8s linear infinite; display: inline-block; }
@keyframes psm-spin { to { transform: rotate(360deg); } }
.psm-loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 40px; color: var(--psm-muted); }

/* Purchase detail modal */
.psm-purchase-report-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
  margin: 0 0 18px;
  background: #f8fbff;
  border: 1px solid #d8e2ef;
  border-radius: 10px;
}
.psm-purchase-report-form label {
  display: grid;
  gap: 6px;
  color: var(--psm-muted);
  font-size: .82rem;
  font-weight: 700;
}
.psm-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 18px;
  background: #f4f7fb;
  border: 1px solid #d8e2ef;
  border-radius: 10px;
  margin-bottom: 18px;
}
.psm-detail-head small,
.psm-detail-row span,
.psm-detail-list-item span,
.psm-timeline-item span,
.psm-timeline-item small {
  color: var(--psm-muted);
  font-size: .82rem;
}
.psm-detail-head h2 { margin: 4px 0; color: var(--psm-blue); }
.psm-detail-head p { margin: 0; color: var(--psm-text); }
.psm-detail-badges,
.psm-detail-list-item {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.psm-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.psm-detail-row,
.psm-detail-text,
.psm-detail-list-item,
.psm-timeline-item {
  background: #fff;
  border: 1px solid #d8e2ef;
  border-radius: 10px;
  padding: 12px;
}
.psm-detail-row { display: grid; gap: 5px; }
.psm-detail-row strong { color: var(--psm-text); font-size: .94rem; line-height: 1.35; }
.psm-detail-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.psm-detail-text h4,
#psm-purchase-detail-body > h4 {
  margin: 0 0 8px;
  color: var(--psm-text);
}
.psm-detail-text p,
.psm-timeline-item p {
  white-space: pre-wrap;
  margin: 0;
}
.psm-detail-list {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}
.psm-detail-list-item { justify-content: space-between; }
.psm-detail-list-item > div { display: grid; gap: 3px; }
.psm-timeline {
  border-left: 3px solid var(--psm-blue);
  display: grid;
  gap: 10px;
  margin-left: 8px;
  padding-left: 16px;
}
.psm-timeline-item {
  position: relative;
  display: grid;
  gap: 5px;
}
.psm-timeline-item:before {
  content: "";
  position: absolute;
  left: -24px;
  top: 15px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--psm-blue);
}
@media (max-width: 760px) {
  .psm-detail-grid,
  .psm-detail-columns,
  .psm-purchase-report-form { grid-template-columns: 1fr; }
  .psm-detail-head { flex-direction: column; }
}
