/* =================================================================
   CYRELA IPÊS — PORTAL DA PORTARIA
   Paleta inspirada no site cyrelaipes.com.br
   - Verde escuro/musgo (#2e4732) — primary
   - Verde médio (#3d5e42) — primary hover
   - Verde-folha (#6f8b62) — accent
   - Bege creme (#faf6ee) — background
   - Bege escuro (#f0e8d2) — surface
   - Dourado (#b9a861 / #d9c98a) — divisor
   - Texto profundo (#1f2a24)
================================================================= */

:root {
  --c-bg: #faf6ee;
  --c-surface: #ffffff;
  --c-surface-2: #f7f3e3;
  --c-surface-3: #f0e8d2;
  --c-primary: #2e4732;
  --c-primary-2: #3d5e42;
  --c-primary-3: #4f7657;
  --c-leaf: #6f8b62;
  --c-gold: #b9a861;
  --c-gold-soft: #d9c98a;
  --c-text: #1f2a24;
  --c-text-soft: #5a6b5e;
  --c-text-mute: #8a9489;
  --c-border: #e6dfc9;
  --c-border-strong: #d6cfb8;
  --c-success: #3d8c4a;
  --c-danger: #b13a3a;
  --c-warning: #c98226;
  --c-info: #3a6a8c;

  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;

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

  --shadow-sm: 0 1px 3px rgba(46, 71, 50, .08);
  --shadow: 0 4px 16px rgba(46, 71, 50, .10);
  --shadow-lg: 0 12px 40px rgba(46, 71, 50, .14);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

/* Pequena textura de fundo (pontos verdes muito sutis) */
body {
  background-image:
    radial-gradient(circle at 20% 10%, rgba(111, 139, 98, .05) 0, transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(185, 168, 97, .05) 0, transparent 40%);
  background-attachment: fixed;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-2); text-decoration: underline; }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; color: var(--c-primary); margin: 0 0 .5em; line-height: 1.15; }
h1 { font-size: 32px; letter-spacing: .3px; }
h2 { font-size: 24px; }
h3 { font-size: 19px; }
p  { margin: 0 0 .75em; }

/* =====================  TOPBAR  ===================== */
.topbar {
  background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-2) 100%);
  color: #f5f0dc;
  border-bottom: 3px solid var(--c-gold);
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow);
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; gap: 24px;
  padding: 12px 24px;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  color: #f5f0dc; text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand img {
  height: 44px; width: auto;
  background: #f5f0dc;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name { font-family: var(--font-display); font-size: 20px; letter-spacing: .8px; }
.brand-sub { font-size: 11px; text-transform: uppercase; letter-spacing: 2px; opacity: .8; margin-top: 4px; }

.navlinks { display: flex; gap: 6px; margin-left: 24px; flex: 1; }
.navlinks a {
  color: #f5f0dc;
  padding: 8px 14px;
  font-size: 13px; letter-spacing: .5px; font-weight: 500;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  border: 1px solid transparent;
}
.navlinks a:hover { background: rgba(255,255,255,.1); text-decoration: none; }
.navlinks a.active { background: rgba(245,240,220,.15); border-color: var(--c-gold-soft); }

.user-chip {
  display: flex; align-items: center; gap: 10px;
  background: rgba(0,0,0,.18);
  padding: 6px 6px 6px 14px;
  border-radius: 24px;
  font-size: 12px;
}
.user-name { font-weight: 600; }
.user-role { color: var(--c-gold-soft); font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; }
.logout {
  background: var(--c-gold);
  color: var(--c-primary);
  width: 30px; height: 30px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  text-decoration: none;
}
.logout:hover { background: #d9c98a; text-decoration: none; }

/* =====================  CONTENT / LAYOUT  ===================== */
.content {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 24px;
  min-height: calc(100vh - 180px);
}
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; margin-bottom: 24px;
  border-bottom: 1px solid var(--c-gold-soft);
  padding-bottom: 16px;
}
.page-head h1 { margin-bottom: 4px; }
.page-head .subtitle { color: var(--c-text-soft); font-size: 13px; }

/* =====================  CARDS  ===================== */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-section { padding: 22px 26px; }
.card-section + .card-section { border-top: 1px solid var(--c-border); }
.section-title {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--c-primary);
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--c-gold-soft);
  display: flex; align-items: center; gap: 8px;
}
.section-title .num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px;
  background: var(--c-primary); color: #f5f0dc;
  border-radius: 50%;
  font-size: 12px; font-family: var(--font-body); font-weight: 700;
}

/* =====================  FORMULÁRIOS  ===================== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 20px; }
.col-full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field-label {
  font-size: 11px; font-weight: 600; letter-spacing: 1.2px;
  color: var(--c-text-soft); text-transform: uppercase;
}
.field input[type="text"],
.field input[type="password"],
.field input[type="datetime-local"],
.field input[type="email"],
.field textarea,
.field select {
  width: 100%; box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--c-border-strong);
  background: #fbf9f0;
  border-radius: var(--radius);
  font-family: var(--font-body); font-size: 14px;
  color: var(--c-text);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--c-primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(46, 71, 50, .12);
}
.field input.valid { border-color: var(--c-success); background: #f0fbf2; }
.field input.invalid { border-color: var(--c-danger); background: #fdf3f3; }

.field-hint { font-size: 11px; color: var(--c-text-mute); margin-top: 2px; }
.field-error { font-size: 12px; color: var(--c-danger); display: flex; align-items: center; gap: 4px; }
.field-ok    { font-size: 12px; color: var(--c-success); display: flex; align-items: center; gap: 4px; font-weight: 600; }

.input-with-button { display: flex; gap: 8px; }
.input-with-button input { flex: 1; }

/* Radio cards (tipo de pessoa) */
.radio-cards { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-cards label {
  flex: 1; min-width: 100px;
  border: 1px solid var(--c-border-strong);
  background: #fbf9f0;
  padding: 12px 14px;
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  font-size: 13px; font-weight: 500; letter-spacing: .3px;
  color: var(--c-text);
  transition: all .15s;
  user-select: none;
}
.radio-cards label:hover { border-color: var(--c-leaf); background: #fff; }
.radio-cards input[type="radio"] { display: none; }
.radio-cards input[type="radio"]:checked + .radio-card-content,
.radio-cards label.checked,
.radio-cards label:has(input:checked) {
  background: var(--c-primary);
  color: #f5f0dc;
  border-color: var(--c-primary);
  font-weight: 700;
}

/* Pontos de acesso (dois blocos lado a lado) */
.access-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.access-block {
  background: var(--c-surface-2);
  border: 1px solid var(--c-gold-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.access-block h4 {
  font-family: var(--font-body);
  font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--c-primary); margin: 0 0 10px;
  display: flex; align-items: center; gap: 6px;
}
.access-block .ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  background: var(--c-primary); color: #f5f0dc;
  border-radius: 50%; font-size: 12px;
}
.access-options { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.access-options label {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 9px; border-radius: 6px;
  font-size: 12.5px; cursor: pointer;
  transition: background .12s;
}
.access-options label:hover { background: #fff; }
.access-options input[type="radio"] { accent-color: var(--c-primary); }
.access-options label:has(input:checked) {
  background: var(--c-primary);
  color: #f5f0dc;
  font-weight: 600;
}
.access-options label:has(input:checked) input { accent-color: var(--c-gold); }

/* =====================  BOTÕES  ===================== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  background: var(--c-primary); color: #f5f0dc;
  border: none; border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 12.5px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase;
  cursor: pointer;
  transition: background .15s, transform .05s;
  text-decoration: none;
}
.btn:hover { background: var(--c-primary-2); text-decoration: none; color: #f5f0dc; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-2));
  padding: 12px 24px;
  box-shadow: 0 2px 0 rgba(0,0,0,.1);
}
.btn-secondary {
  background: transparent; color: var(--c-text-soft);
  border: 1px solid var(--c-border-strong);
}
.btn-secondary:hover { color: var(--c-primary); border-color: var(--c-primary); background: #fff; }
.btn-danger { background: var(--c-danger); }
.btn-danger:hover { background: #8e2929; }
.btn-now {
  background: var(--c-gold); color: var(--c-primary);
  padding: 10px 14px; white-space: nowrap;
  font-weight: 700;
}
.btn-now:hover { background: #c8b86e; color: var(--c-primary); }
.btn-sm { padding: 6px 12px; font-size: 11px; }

.actions-bar {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 18px 26px;
  background: var(--c-surface-2);
  border-top: 1px solid var(--c-border);
}

/* =====================  STATUS PILLS  ===================== */
.status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 14px;
  font-size: 11px; font-weight: 700;
  letter-spacing: .8px; text-transform: uppercase;
  border: 1px solid;
  white-space: nowrap;
}
.status::before { content: "●"; }
.status-aguardando  { background: #fef6e3; color: #8a6611; border-color: #ecd28a; }
.status-atribuido   { background: #eaf1fb; color: #2c4a72; border-color: #b9cae6; }
.status-pendente    { background: #fbe8d8; color: #8a4a16; border-color: #ecbe92; }
.status-solucionado { background: #e3f5e7; color: #266b30; border-color: #a5d3ad; }

/* =====================  KPI CARDS  ===================== */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.kpi {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-left: 4px solid var(--c-primary);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex; flex-direction: column; gap: 4px;
}
.kpi.k-aguardando  { border-left-color: #c98226; }
.kpi.k-atribuido   { border-left-color: var(--c-info); }
.kpi.k-pendente    { border-left-color: #b87420; }
.kpi.k-solucionado { border-left-color: var(--c-success); }
.kpi-label { font-size: 10.5px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--c-text-soft); font-weight: 600; }
.kpi-value { font-family: var(--font-display); font-size: 30px; line-height: 1; color: var(--c-primary); }
.kpi-link  { font-size: 11px; color: var(--c-text-mute); margin-top: 4px; }

/* =====================  TABELAS  ===================== */
.table-wrap { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-lg); overflow: hidden; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl thead th {
  background: var(--c-surface-2);
  text-align: left;
  padding: 12px 14px;
  font-size: 11px; letter-spacing: 1.3px; text-transform: uppercase;
  color: var(--c-text-soft);
  border-bottom: 1px solid var(--c-border-strong);
  font-weight: 600;
}
table.tbl tbody td { padding: 12px 14px; border-bottom: 1px solid var(--c-border); vertical-align: middle; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: var(--c-surface-2); }
table.tbl .id-cell { font-weight: 700; color: var(--c-primary); font-family: var(--font-display); font-size: 16px; }
table.tbl .glpi-pill { display: inline-block; font-size: 10px; padding: 2px 6px; background: var(--c-gold-soft); color: var(--c-primary); border-radius: 8px; letter-spacing: .5px; font-weight: 700; }
table.tbl .empty { text-align: center; padding: 40px; color: var(--c-text-mute); }

.filter-bar {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.filter-bar a {
  padding: 6px 14px;
  border: 1px solid var(--c-border-strong);
  border-radius: 18px;
  background: var(--c-surface);
  font-size: 12px; font-weight: 600;
  color: var(--c-text-soft);
  text-decoration: none;
  letter-spacing: .5px;
}
.filter-bar a:hover { color: var(--c-primary); border-color: var(--c-primary); text-decoration: none; }
.filter-bar a.active { background: var(--c-primary); color: #f5f0dc; border-color: var(--c-primary); }

/* =====================  DETALHE CHAMADO  ===================== */
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 22px; }
.detail-grid > .card { align-self: start; }
.kv-table { width: 100%; }
.kv-table td { padding: 8px 0; border-bottom: 1px dashed var(--c-border); font-size: 13.5px; }
.kv-table tr:last-child td { border-bottom: none; }
.kv-table td:first-child { width: 35%; color: var(--c-text-soft); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .8px; }
.kv-table td:last-child { color: var(--c-text); }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li {
  position: relative; padding: 0 0 18px 22px;
  border-left: 2px solid var(--c-gold-soft);
  font-size: 13px;
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -7px; top: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--c-primary); border: 2px solid var(--c-bg);
}
.timeline .when { font-size: 11px; color: var(--c-text-mute); }
.timeline .what { font-weight: 600; color: var(--c-primary); }

/* =====================  FLASHES  ===================== */
.flashes { margin-bottom: 18px; display: flex; flex-direction: column; gap: 8px; }
.flash {
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 13.5px; font-weight: 500;
  border: 1px solid;
}
.flash-success { background: #e3f5e7; color: #266b30; border-color: #a5d3ad; }
.flash-danger  { background: #fbe5e5; color: #8a2929; border-color: #e6a3a3; }
.flash-warning { background: #fef0d7; color: #8a5a16; border-color: #ecc88a; }
.flash-info    { background: #e6eef5; color: #2c4a72; border-color: #b1c5db; }

/* =====================  LOGIN  ===================== */
body.login-bg {
  background:
    linear-gradient(135deg, rgba(46,71,50,.92), rgba(61,94,66,.92)),
    radial-gradient(circle at 30% 30%, rgba(185,168,97,.4), transparent 50%);
  background-attachment: fixed;
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--c-bg);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--c-gold-soft);
}
.login-header {
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-2));
  padding: 32px 28px 24px;
  text-align: center;
  position: relative;
  border-bottom: 3px solid var(--c-gold);
}
.login-header::after {
  content: ""; position: absolute; bottom: -1px; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--c-gold), transparent);
}
.login-header img {
  height: 80px; background: #f5f0dc; padding: 8px 16px; border-radius: var(--radius);
  margin-bottom: 14px;
}
.login-header h1 {
  font-family: var(--font-display); color: #f5f0dc; font-size: 26px; letter-spacing: 1px;
  margin: 0;
}
.login-header .tag {
  font-size: 11px; letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--c-gold-soft); margin-top: 6px;
}
.login-body { padding: 28px; }
.login-body .field { margin-bottom: 14px; }
.login-body .btn-primary { width: 100%; justify-content: center; padding: 14px; }
.login-footer {
  border-top: 1px solid var(--c-border);
  padding: 14px 28px; text-align: center;
  font-size: 11px; color: var(--c-text-mute);
  background: var(--c-surface-2);
}

/* =====================  FOOTER  ===================== */
.footer {
  margin-top: 40px;
  border-top: 1px solid var(--c-gold-soft);
  background: var(--c-surface-2);
  padding: 14px 24px;
  font-size: 11px; color: var(--c-text-mute);
  display: flex; justify-content: space-between; gap: 12px;
  letter-spacing: .3px;
}
.footer-h4t strong { color: var(--c-primary); }

/* =====================  RESPONSIVO  ===================== */
@media (max-width: 880px) {
  .form-grid, .form-grid-3, .access-grid, .detail-grid, .kpi-row { grid-template-columns: 1fr !important; }
  .topbar-inner { flex-wrap: wrap; gap: 12px; padding: 10px 14px; }
  .navlinks { order: 3; width: 100%; margin-left: 0; }
  .content { padding: 20px 14px; }
  .actions-bar { flex-direction: column-reverse; }
  .actions-bar .btn { width: 100%; justify-content: center; }
  .access-options { grid-template-columns: 1fr; }
  table.tbl thead { display: none; }
  table.tbl, table.tbl tbody, table.tbl tr, table.tbl td { display: block; width: 100%; box-sizing: border-box; }
  table.tbl tr { border-bottom: 1px solid var(--c-border); padding: 8px 12px; }
  table.tbl td { border: none; padding: 4px 0; }
  table.tbl td::before { content: attr(data-label) " "; font-weight: 700; color: var(--c-text-soft); font-size: 11px; text-transform: uppercase; }
}

/* Print: gerar relatório */
@media print {
  .topbar, .footer, .actions-bar, .filter-bar, .kpi-row { display: none; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #999; }
}
