/* ================================================================
   style.css — Design System Unilux PDCA
   Migrado do CSS inline do Streamlit (app.py)
================================================================ */

/* ── VARIÁVEIS ────────────────────────────────────── */
:root {
  --ink:          #1A1919;
  --muted:        #665f54;
  --faint:        #8a8276;
  --line:         #d8d2c7;
  --line-soft:    #e9e4dc;
  --paper:        #F6F6F6;
  --soft:         #fbfaf8;
  --soft-strong:  #eee8dd;
  --black:        #1A1919;

  --sand:         #B9AA8A;
  --soil:         #332D23;
  --wine:         #7C2741;
  --moss:         #4B683E;
  --night:        #1A4251;

  --red:          var(--wine);
  --red-soft:     #f7eef1;
  --red-border:   #d6b6c2;

  --green:        var(--moss);
  --green-soft:   #eef3eb;
  --green-border: #c7d5bf;

  --blue:         var(--night);
  --blue-soft:    #edf3f5;
  --blue-border:  #bbcbd1;

  --amber:        var(--soil);
  --amber-soft:   #f4f0e8;
  --amber-border: #d4c7ae;

  --font-title: 'Metropolis', 'Helvetica Neue', Arial, sans-serif;
  --font-body:  'Metropolis', 'Helvetica Neue', Arial, sans-serif;

  --radius-sm:  2px;
  --radius-md:  2px;
  --radius-lg:  2px;
  --radius-xl:  2px;

  --shadow-card: 0 1px 2px rgba(26,25,25,.04);
  --shadow-md:   0 2px 8px rgba(26,25,25,.06);
  --shadow-lg:   0 8px 24px rgba(26,25,25,.08);

  --sidebar-w: 240px;
}

/* ── RESET ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: var(--font-body);
  background: var(--soft);
  color: var(--ink);
  height: 100%;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--font-body); }
input, textarea, select { font-family: var(--font-body); }

/* ── LAYOUT ───────────────────────────────────────── */
#app {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ──────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 28px 22px 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
  overflow: hidden;
}

.brand-box {
  display: block;
  width: 100%;
  max-width: 126px;
}

.sidebar-brand-logo {
  display: block;
  width: 100%;
  max-width: 126px;
  height: auto;
  object-fit: contain;
}

.sidebar-tagline {
  margin-top: 14px;
  color: var(--faint);
  font-family: var(--font-title);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .28em;
  text-transform: uppercase;
}

.sidebar-nav-label {
  font-family: var(--font-title);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 16px 22px 6px;
  display: block;
}

.sidebar-nav-label:first-child { padding-top: 20px; }

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-title);
  letter-spacing: 0;
  min-height: 42px;
  border-radius: 0;
  background: transparent;
  border: none;
  border-right: 3px solid transparent;
  color: #565d68;
  transition: all .14s ease;
  padding: 0 12px 0 22px;
}

.nav-btn:hover {
  background: var(--soft);
  color: var(--ink);
}

.nav-btn.active {
  background: #eeeeef;
  color: var(--ink);
  border-right-color: var(--ink);
  font-weight: 800;
}

.sidebar-user {
  margin-top: auto;
  border-top: 1px solid var(--line-soft);
  padding: 18px 22px 16px;
}

.sidebar-user-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.sidebar-user-role {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-family: var(--font-title);
  margin-top: 3px;
}

.sidebar-logout {
  margin: 10px 22px 20px;
  width: calc(100% - 44px);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-title);
  letter-spacing: .06em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--muted);
  transition: all .14s ease;
}
.sidebar-logout:hover {
  background: var(--soft);
  border-color: var(--ink);
  color: var(--ink);
}

/* ── MAIN CONTENT ─────────────────────────────────── */
#main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  background: #ffffff;
}

.page-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 40px 64px;
}

/* ── PAGE HEADER ──────────────────────────────────── */
.page-header {
  border-bottom: 1px solid var(--line);
  margin-bottom: 32px;
  padding-bottom: 22px;
}

.page-overline {
  color: var(--faint);
  font-family: var(--font-title);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .28em;
  text-transform: uppercase;
  margin: 0 0 8px;
}

.page-title {
  font-family: var(--font-title);
  font-size: clamp(36px, 4.2vw, 56px);
  letter-spacing: -.03em;
  line-height: .96;
  margin: 16px 0 14px;
  font-weight: 800;
  color: var(--ink);
}

.page-subtitle {
  color: var(--muted);
  font-size: 16px;
  margin: 0;
  max-width: 760px;
  line-height: 1.48;
}

/* ── METRIC CARD ──────────────────────────────────── */
.metric-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  min-height: 112px;
  padding: 18px 20px;
}
.metric-card.attention { background: var(--red-soft);   border-color: var(--red-border); }
.metric-card.warning   { background: var(--amber-soft); border-color: var(--amber-border); }
.metric-card.success   { background: var(--green-soft); border-color: var(--green-border); }
.metric-card.info      { background: var(--blue-soft);  border-color: var(--blue-border); }
.metric-card.neutral   { background: var(--soft);       border-color: var(--line); }

.metric-label {
  color: var(--faint);
  font-family: var(--font-title);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .28em;
  text-transform: uppercase;
}

.metric-value {
  display: block;
  font-family: var(--font-title);
  font-size: 34px;
  letter-spacing: -.03em;
  line-height: 1;
  margin-top: 12px;
  font-weight: 800;
  color: var(--ink);
}

.metric-sub {
  color: var(--muted);
  display: block;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 500;
}

/* ── GRID HELPERS ─────────────────────────────────── */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-2-1 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; }

/* ── FOCUS PANEL ──────────────────────────────────── */
.focus-panel {
  border: 1px solid var(--ink);
  border-radius: var(--radius-lg);
  padding: 30px;
  height: 100%;
}
.focus-panel.attention { background: #fff; border-color: var(--red-border); }
.focus-panel.warning   { background: #fff; border-color: var(--amber-border); }
.focus-panel.success   { background: #fff; border-color: var(--green-border); }

.focus-label {
  color: var(--faint);
  font-family: var(--font-title);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .28em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 12px;
}

.focus-panel h2 {
  font-family: var(--font-title);
  font-size: 28px;
  letter-spacing: -.03em;
  margin: 0 0 8px;
  font-weight: 800;
  color: var(--ink);
}

.focus-panel p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.48;
  margin: 0;
}

.focus-actions { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ── WORKFLOW CARD ────────────────────────────────── */
.workflow-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  height: 100%;
}

.workflow-card h3 {
  font-family: var(--font-title);
  letter-spacing: -.02em;
  margin: 0 0 18px;
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
}

.workflow-card ol {
  margin: 0;
  padding-left: 20px;
}

.workflow-card li {
  font-weight: 700;
  margin-bottom: 11px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.48;
}

/* ── SECTION HEADING ──────────────────────────────── */
.section-heading {
  align-items: flex-end;
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-heading h3 {
  font-family: var(--font-title);
  font-size: 20px;
  letter-spacing: -.02em;
  margin: 0;
  font-weight: 800;
  color: var(--ink);
}

.section-heading p {
  color: var(--muted);
  margin: 0;
  font-size: 13px;
}

/* ── TASK ROW ─────────────────────────────────────── */
.task-list { border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }

.task-row {
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  border-left: 4px solid transparent;
  display: flex;
  justify-content: space-between;
  min-height: 72px;
  padding: 16px 18px;
  background: #fff;
}

.task-row:last-child { border-bottom: 0; }
.task-row.attention { background: #fff; border-left-color: var(--red);   }
.task-row.warning   { background: #fff; border-left-color: var(--amber); }
.task-row.info      { background: #fff; border-left-color: var(--blue);  }
.task-row.success   { background: #fff; border-left-color: var(--green); }

.task-row strong { display: block; font-family: var(--font-title); font-size: 15px; font-weight: 700; color: var(--ink); }
.task-row span   { color: var(--muted); font-size: 13px; }

/* ── CHIP / BADGE ─────────────────────────────────── */
.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  white-space: nowrap;
  font-family: var(--font-title);
  display: inline-block;
}
.chip.attention { background: var(--red-soft);   border-color: var(--red-border);   color: var(--red);   }
.chip.warning   { background: var(--amber-soft); border-color: var(--amber-border); color: var(--amber); }
.chip.success   { background: var(--green-soft); border-color: var(--green-border); color: var(--green); }
.chip.info      { background: var(--blue-soft);  border-color: var(--blue-border);  color: var(--blue);  }
.chip.muted     { background: var(--soft); }

/* ── BUTTONS ──────────────────────────────────────── */
.btn {
  border-radius: var(--radius-md);
  font-weight: 800;
  font-family: var(--font-title);
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  min-height: 42px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  transition: all .14s ease;
  padding: 0 20px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover { background: var(--soft); border-color: var(--ink); }

.btn-primary {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.btn-primary:hover { background: #2b2d3e; border-color: #2b2d3e; }

.btn-sm { min-height: 34px; font-size: 11px; padding: 0 14px; }
.btn-full { width: 100%; justify-content: center; }
.btn-danger { border-color: var(--red-border); color: var(--red); }
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); }

/* ── PROGRESS BAR ─────────────────────────────────── */
.progress-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.progress-header { display: flex; justify-content: space-between; margin-bottom: 10px; }
.progress-header span { font-weight: 700; color: var(--ink); font-size: 14px; }
.progress-header b   { font-weight: 800; color: var(--ink); font-family: var(--font-title); font-size: 15px; }
.progress-track { background: var(--soft-strong); border-radius: 999px; height: 8px; overflow: hidden; }
.progress-fill  { height: 100%; border-radius: 999px; transition: width .6s ease; }

/* ── EXEC ITEM ────────────────────────────────────── */
.exec-item {
  background: var(--soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
}

/* ── PDCA CARD (grid) ─────────────────────────────── */
.pdca-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow .14s;
  position: relative;
}

.pdca-card:hover { box-shadow: var(--shadow-md); }

.pdca-card-title {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  line-height: 1.2;
}

.pdca-card-meta { font-size: 11px; color: var(--muted); margin-top: auto; }

.pdca-status-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  align-self: flex-start;
}

/* ── FORM ELEMENTS ────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
  letter-spacing: .01em;
}

.form-control {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink);
  min-height: 44px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font-body);
  transition: border-color .14s, box-shadow .14s;
  outline: none;
}

.form-control:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(37,94,232,.12);
}

.form-control::placeholder { color: var(--faint); }

textarea.form-control { min-height: 90px; resize: vertical; }

select.form-control { cursor: pointer; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.form-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-card);
}

/* ── TABS ─────────────────────────────────────────── */
.tabs-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}

.tab-btn {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: .06em;
  padding: 0 14px;
  height: 40px;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--muted);
  background: transparent;
  text-transform: uppercase;
  transition: color .14s, border-color .14s;
}

.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--ink); border-bottom-color: var(--ink); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── ALERT BANNER ─────────────────────────────────── */
.alert-banner {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-banner.error   { background: var(--red-soft);   border: 1px solid var(--red-border);   color: var(--red);   }
.alert-banner.success { background: var(--green-soft); border: 1px solid var(--green-border); color: var(--green); }
.alert-banner.info    { background: var(--blue-soft);  border: 1px solid var(--blue-border);  color: var(--blue);  }
.alert-banner.warning { background: var(--amber-soft); border: 1px solid var(--amber-border); color: var(--amber); }

/* ── MODAL (Login) ────────────────────────────────── */
#login-overlay {
  position: fixed;
  inset: 0;
  background: var(--soft);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 80px rgba(20,22,32,.08);
  max-width: 460px;
  width: 90%;
  padding: 44px 44px 36px;
}

.login-brand-box {
  display: block;
  width: 100%;
  max-width: 174px;
  margin-bottom: 20px;
  overflow: hidden;
}

.login-brand-logo {
  display: block;
  width: 100%;
  max-width: 174px;
  height: auto;
  object-fit: contain;
}

.login-overline {
  font-family: var(--font-title);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 10px;
}

.login-title {
  font-family: var(--font-title);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--ink);
  margin: 0 0 6px;
}

.login-hint {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 28px;
  line-height: 1.48;
}

.login-form .form-group { margin-bottom: 16px; }

/* ── HISTORY ITEM ─────────────────────────────────── */
.history-item {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--radius-md);
  background: #fff;
  padding: 16px 18px;
  margin-bottom: 10px;
}

/* ── EXPANDER ─────────────────────────────────────── */
.expander { border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; margin-bottom: 8px; }

.expander-header {
  width: 100%;
  background: #fff;
  border: none;
  text-align: left;
  padding: 14px 18px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background .14s;
}
.expander-header:hover { background: var(--soft); }
.expander-header .expander-arrow { font-size: 12px; color: var(--muted); transition: transform .2s; }
.expander-header.open .expander-arrow { transform: rotate(180deg); }

.expander-body { display: none; padding: 16px 18px; border-top: 1px solid var(--line); background: #fff; }
.expander-body.open { display: block; }

/* ── DOSSIÊ ───────────────────────────────────────── */
.dossie-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.dossie-title {
  font-family: var(--font-title);
  font-size: 32px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -.03em;
  line-height: 1.1;
}

.dossie-actions { display: flex; gap: 10px; flex-shrink: 0; }

/* ── CHECKLIST ────────────────────────────────────── */
.checklist-item {
  background: var(--soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 14px;
}

.checklist-item-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
  font-family: var(--font-title);
}

.checklist-item-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  margin-bottom: 14px;
}

.checklist-radio-group { display: flex; gap: 12px; margin-bottom: 10px; }

.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}

/* ── NOVA AUDITORIA ───────────────────────────────────────────── */
.audit-form {
  border-top: 1px solid var(--line);
}

.audit-section {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 16px;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.audit-step {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  font-family: var(--font-title);
  margin-top: 2px;
}
.audit-step.blue  { background: var(--blue); }
.audit-step.green { background: var(--green); }
.audit-step.amber { background: var(--amber); }
.audit-step.black { background: var(--ink); }

.audit-section-body h2 {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--ink);
  margin: 0 0 10px;
}

.audit-help {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin: 10px 0 0;
}

.audit-topic {
  display: grid;
  grid-template-columns: 1fr minmax(330px, 430px);
  gap: 18px;
  border: 1px solid var(--green-border);
  border-left: 3px solid var(--green);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 16px 14px;
  margin-bottom: 10px;
  transition: background .14s, border-color .14s;
}

.audit-topic.desvio {
  border-color: var(--red-border);
  border-left-color: var(--red);
  background: var(--red-soft);
}

.audit-topic-text strong {
  display: block;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 5px;
}

.audit-topic-text span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.audit-topic-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.audit-segmented {
  background: var(--soft-strong);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 3px;
  display: inline-flex;
  width: fit-content;
  gap: 2px;
}

.audit-segmented input { display: none; }

.audit-segmented span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  cursor: pointer;
}

.audit-segmented input:checked + span {
  background: #fff;
  box-shadow: var(--shadow-card);
}

.audit-segmented label:first-child input:checked + span { color: var(--green); }
.audit-segmented label:last-child input:checked + span { color: var(--red); }

.audit-problem {
  display: none;
  min-height: 48px !important;
}

.audit-topic.desvio .audit-problem {
  display: block;
}

.audit-attachments {
  margin: 18px 0;
  display: grid;
  gap: 10px;
}

.audit-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 14px 16px;
  background: var(--soft);
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
}

.audit-file-btn input {
  display: none;
}

.audit-attachment-card {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px;
  background: #fff;
}

.audit-attachment-card img {
  width: 72px;
  height: 54px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line-soft);
}

.audit-attachment-card strong,
.audit-attachment-card span {
  display: block;
  font-size: 13px;
}

.audit-attachment-card span { color: var(--muted); margin-top: 3px; }

.audit-action-card {
  border: 1px solid var(--amber-border);
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
}

.audit-action-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.audit-action-head strong {
  font-family: var(--font-title);
  font-size: 15px;
  font-weight: 800;
}

.audit-actions-footer {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.history-attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.history-attachment {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #fff;
  display: block;
}

.history-attachment img {
  width: 100%;
  height: 92px;
  object-fit: cover;
  display: block;
}

.history-attachment span {
  display: block;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-action {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--soft);
  padding: 12px;
  margin-top: 8px;
}

.history-action strong,
.history-action span {
  display: block;
}

.history-action strong {
  color: var(--ink);
  font-size: 13px;
  margin-bottom: 4px;
}

.history-action span,
.history-action p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.history-action p { margin-top: 6px; }

/* ── SPACER ───────────────────────────────────────── */
.spacer-8  { height: 8px; }
.spacer-16 { height: 16px; }
.spacer-24 { height: 24px; }
.spacer-32 { height: 32px; }
.spacer-40 { height: 40px; }

/* ── DIVIDER ──────────────────────────────────────── */
hr { border: none; border-top: 1px solid var(--line); margin: 20px 0; }

/* ── FOOTER ───────────────────────────────────────── */
.footer-bar {
  text-align: center;
  padding: 48px 0 24px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
}

/* ── SCROLLBAR ────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--soft); }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--faint); }

/* ── ANIMAÇÕES ────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn .28s ease forwards; }

@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--line);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}

/* ── LOADING OVERLAY ──────────────────────────────── */
.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  gap: 14px;
  color: var(--muted);
  font-weight: 600;
}

/* ── EMPTY STATE ──────────────────────────────────── */
.empty-state {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 28px;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  background: #fff;
}

/* ── TOPICO LIST ──────────────────────────────────── */
.topico-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.topico-row:last-child { border-bottom: none; }
.topico-row strong { flex: 1; font-size: 14px; color: var(--ink); }
.topico-row span   { font-size: 12px; color: var(--muted); }

.topico-edit-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft-strong);
}
.topico-edit-main { flex: 1; min-width: 0; }
.topico-edit-row textarea { resize: vertical; min-height: 66px; }

@media (max-width: 640px) {
  .topico-edit-row { align-items: stretch; flex-direction: column; }
  .topico-remove-btn { align-self: flex-end; }
}

/* ── RESPONSIVE ───────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  #sidebar { transform: translateX(-240px); width: 240px; transition: transform .2s; }
  #sidebar.open { transform: translateX(0); }
  #main { margin-left: 0; }
  .page-content { padding: 24px 20px 48px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-2-1 { grid-template-columns: 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .audit-topic { grid-template-columns: 1fr; }
  .audit-section { grid-template-columns: 30px 1fr; }
}

@media (max-width: 600px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .login-card { padding: 28px 22px; }
}

/* ================================================================
   Refinamento visual Unilux
   Aplicação operacional do padrão institucional:
   Paper/Ink/Sand/Soil/Moss/Wine/Night, componentes retos,
   bordas finas, sombra discreta e hierarquia editorial.
================================================================ */
html,
body {
  background: var(--paper);
}

#sidebar,
#main,
.login-card,
.workflow-card,
.form-card,
.pdca-card,
.metric-card,
.history-item,
.expander-header,
.expander-body,
.task-row,
.progress-wrap,
.exec-item,
.audit-topic,
.audit-action-card,
.audit-attachment-card,
.history-action,
.empty-state {
  border-radius: 2px !important;
  box-shadow: none !important;
}

#sidebar,
.login-card,
.workflow-card,
.form-card,
.pdca-card,
.metric-card,
.history-item,
.expander,
.expander-header,
.expander-body,
.task-row,
.progress-wrap,
.audit-attachment-card,
.history-attachment,
.empty-state {
  background: #fff;
}

.sidebar-tagline,
.sidebar-nav-label,
.page-overline,
.metric-label,
.focus-label,
.checklist-item-label,
.form-label,
.tab-btn,
.btn,
.sidebar-logout,
.chip,
.pdca-status-badge {
  letter-spacing: .14em;
  font-weight: 500;
}

.page-title,
.login-title,
.focus-panel h2,
.dossie-title {
  font-weight: 300;
}

.section-heading h3,
.workflow-card h3,
.audit-section-body h2 {
  font-weight: 400;
}

.metric-value {
  font-weight: 300;
}

.btn {
  border-radius: 2px;
  min-height: 40px;
  text-transform: none;
  letter-spacing: .02em;
  font-weight: 500;
}

.btn-primary {
  background: var(--ink);
  border-color: var(--ink);
}

.btn-primary:hover {
  background: var(--soil);
  border-color: var(--soil);
}

.btn-danger {
  color: var(--wine);
  border-color: var(--red-border);
}

.form-control {
  border-radius: 2px;
  background: #fff;
}

.form-control:focus {
  border-color: var(--night);
  box-shadow: 0 0 0 2px rgba(26,66,81,.12);
}

.nav-btn.active {
  background: var(--soft-strong);
  border-right-color: var(--soil);
}

.focus-panel,
.task-row.attention,
.task-row.warning,
.task-row.info,
.task-row.success,
.audit-action-card {
  background: #fff !important;
}

.alert-banner {
  border-radius: 2px;
}

.alert-banner.error {
  background: var(--red-soft);
  color: var(--wine);
}

.alert-banner.success {
  background: var(--green-soft);
  color: var(--moss);
}

.alert-banner.info {
  background: var(--blue-soft);
  color: var(--night);
}

.alert-banner.warning {
  background: var(--amber-soft);
  color: var(--soil);
}

.chip,
.audit-step,
.audit-segmented,
.audit-segmented span {
  border-radius: 2px;
}

.pdca-card:hover {
  box-shadow: inset 0 0 0 1px var(--soil) !important;
}


/* ── AUTH E ACESSOS ──────────────────────────────── */
[hidden] { display: none !important; }

button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.auth-text-button {
  display: block;
  width: 100%;
  margin-top: 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.auth-text-button:hover {
  color: var(--ink);
  text-decoration: underline;
}

#reset-form { margin-top: 18px; }

.settings-form { max-width: 620px; }

.form-help {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin: -4px 0 18px;
}

.access-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 10px;
}

.access-card-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.access-card-summary strong {
  display: block;
  font-size: 15px;
  color: var(--ink);
}

.access-card-summary p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.access-meta,
.access-actions,
.access-form-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.access-meta { margin-top: 10px; }

.access-edit-form {
  border-top: 1px solid var(--line-soft);
  margin-top: 18px;
  padding-top: 18px;
}

.access-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 18px;
}

@media (max-width: 720px) {
  .access-card-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .access-actions { width: 100%; }
}
.access-last-login {
  margin-top: 10px !important;
  font-size: 12px !important;
}

.access-temp-form {
  border-top: 1px solid var(--line-soft);
  margin-top: 18px;
  padding-top: 18px;
}

.access-temp-input {
  max-width: 360px;
}

.access-temp-help {
  margin: 12px 0 0;
  max-width: 680px;
}

.temporary-password-card {
  margin-top: 22px;
}

.temporary-password-mode .nav-btn {
  opacity: .45;
  pointer-events: none;
}
