:root {
  --azul: #8a8a8a;
  --azul-esc: #146060;
  --azul-claro: #e6f4f4;
  --tinta: #1f2a37;
  --cinza: #6b7280;
  --linha: #e5e7eb;
  --fundo: #f4f7f9;
  --branco: #ffffff;
  --verde: #16a34a;
  --vermelho: #dc2626;
  --ambar: #d97706;
  --sombra: 0 6px 24px rgba(20, 40, 60, .08);
  --raio: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Tinos', Georgia, "Times New Roman", serif; color: var(--tinta); background: var(--fundo); }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
a { color: var(--azul); font-weight: 700; }

/* ------------------------------- Botoes ------------------------------- */
.btn { border: none; border-radius: 8px; padding: 10px 16px; font-size: 14px; font-weight: 700; transition: .15s; }
.btn-primary { background: var(--azul); color: #fff; }
.btn-primary:hover { background: var(--azul-esc); }
.btn-outline { background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,.7); }
.btn-outline:hover { background: rgba(255,255,255,.15); }
.btn-ghost { background: transparent; color: var(--cinza); border: 1px solid var(--linha); }
.btn-ghost:hover { background: var(--fundo); }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }
.btn-danger { background: var(--vermelho); color: #fff; }
.btn-success { background: var(--verde); color: #fff; }

/* ------------------------------- Landing ------------------------------ */
.landing { min-height: 100vh; background: linear-gradient(135deg, var(--azul) 0%, var(--azul-esc) 100%); color: #fff; display: flex; flex-direction: column; }
.landing-top { display: flex; justify-content: space-between; align-items: center; padding: 22px 40px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 20px; }
/* Brasao Dr. Reges Jr.: logomarca oficial no lugar do simbolo generico.
   O SVG tem proporcao 100:132, entao so a altura e fixada -- travar largura
   e altura juntas distorceria o escudo. */
.brand-crest { display: block; height: 59px; width: auto; flex-shrink: 0; }
.brand-name strong { font-weight: 700; text-transform: uppercase; }
.sidebar-brand span { text-transform: uppercase; }
.landing-hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 18px; padding: 40px; }
.landing-hero h1 { font-size: 44px; line-height: 1.15; font-weight: 700; }
.landing-hero p { font-size: 18px; opacity: .9; }
.landing-rodape { text-align: center; padding: 24px 20px 28px; color: rgba(255,255,255,.85); font-size: 13.5px; line-height: 1.6; }
.landing-rodape p:first-child { font-weight: 400; }
/* Assinatura de autoria: discreta, e o nome em dourado YveTech -- o teal da
   marca do ERP nao vale para o credito, que e da fabricante do sistema. */
.landing-rodape p.assinatura-yvetech { font-weight: 400; }
.landing-rodape .assinatura-yvetech a { color: #F3E5AB; text-decoration: none; font-weight: 700; }
.landing-rodape .assinatura-yvetech a:hover { text-decoration: underline; }

/* -------------------------------- Modal ------------------------------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 30, 40, .55); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal { background: #fff; border-radius: var(--raio); box-shadow: var(--sombra); width: 100%; max-width: 560px; padding: 28px; position: relative; max-height: 90vh; overflow-y: auto; }
.modal-close { position: absolute; top: 12px; right: 16px; background: none; border: none; font-size: 26px; color: var(--cinza); line-height: 1; }
.login-card { max-width: 400px; }
.login-head { text-align: center; margin-bottom: 20px; }
.login-head .brand-crest { height: 76px; margin: 0 auto 14px; padding: 12px 16px; background: #141414; border-radius: 14px; box-sizing: content-box; }
.login-head h2 { font-size: 22px; }
.login-head p { color: var(--cinza); font-size: 14px; margin-top: 4px; }

/* -------------------------------- Forms ------------------------------- */
form label { display: block; font-size: 13px; font-weight: 400; color: var(--tinta); margin-bottom: 14px; }
form input, form select, form textarea {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px; font-size: 14px;
  border: 1px solid var(--linha); border-radius: 8px; font-family: inherit; background: #fff;
}
form input:focus, form select:focus, form textarea:focus { outline: 2px solid var(--azul-claro); border-color: var(--azul); }
form textarea { resize: vertical; min-height: 70px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .col-full { grid-column: 1 / -1; }
.form-erro { color: var(--vermelho); font-size: 13px; min-height: 18px; margin-bottom: 8px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* --------------------------------- App -------------------------------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 244px; background: #141414; color: #cfe3e6; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 22px 20px; font-weight: 700; font-size: 17px; color: #fff; }
.menu { display: flex; flex-direction: column; padding: 8px; gap: 2px; flex: 1; }
.menu-item { display: flex; align-items: center; gap: 8px; text-align: left; background: none; border: none; color: #cfe3e6; padding: 12px 14px; border-radius: 8px; font-size: 14px; font-weight: 400; }
.menu-item:hover { background: rgba(255,255,255,.06); }
.menu-item.active { background: var(--azul); color: #fff; font-weight: 700; }
.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--azul); color: #fff; display: grid; place-items: center; font-weight: 700; }
.user-nome { font-size: 13.5px; color: #fff; font-weight: 400; }
.user-perfil { font-size: 11.5px; color: #9fc0c4; text-transform: capitalize; }

.content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 20px 28px; background: #fff; border-bottom: 1px solid var(--linha); }
.topbar h1 { font-size: 20px; }
.topbar-acoes { display: flex; gap: 10px; }
.view { padding: 24px 28px; overflow-x: auto; }

/* ------------------------------- Cards -------------------------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 24px; }
.card { background: #fff; border: 1px solid var(--linha); border-radius: var(--raio); padding: 18px 20px; box-shadow: var(--sombra); }
.card .rotulo { font-size: 12.5px; color: var(--cinza); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.card .valor { font-size: 26px; font-weight: 700; margin-top: 6px; }
.card .valor.verde { color: var(--verde); }
.card .valor.vermelho { color: var(--vermelho); }
.card .valor.ambar { color: var(--ambar); }

/* ------------------------------- Tabela ------------------------------- */
.painel { background: #fff; border: 1px solid var(--linha); border-radius: var(--raio); box-shadow: var(--sombra); overflow: hidden; }
.painel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--linha); flex-wrap: wrap; }
.painel-head h2 { font-size: 16px; }
.barra-filtros { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.barra-filtros input, .barra-filtros select { padding: 8px 10px; border: 1px solid var(--linha); border-radius: 8px; font-size: 13px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--linha); white-space: nowrap; }
th { background: #f8fafb; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--cinza); }
tbody tr:hover { background: #f9fbfc; }
td .acoes { display: flex; gap: 6px; }
.vazio { text-align: center; color: var(--cinza); padding: 40px; }

/* ------------------------------- Badges ------------------------------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 700; }
.badge.verde { background: #dcfce7; color: #166534; }
.badge.vermelho { background: #fee2e2; color: #991b1b; }
.badge.ambar { background: #fef3c7; color: #92400e; }
.badge.cinza { background: #eef2f5; color: #475569; }
.badge.azul { background: var(--azul-claro); color: var(--azul-esc); }

/* -------------------------------- Toast ------------------------------- */
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--tinta); color: #fff; padding: 13px 18px; border-radius: 8px; font-size: 14px; box-shadow: var(--sombra); z-index: 80; max-width: 340px; }
.toast.ok { background: var(--verde); }
.toast.erro { background: var(--vermelho); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--linha); margin-bottom: 16px; }
.tab { padding: 10px 16px; border: none; background: none; font-size: 14px; font-weight: 400; color: var(--cinza); border-bottom: 2px solid transparent; }
.tab.active { color: var(--azul); border-bottom-color: var(--azul); }
.mini-lista { display: flex; flex-direction: column; gap: 8px; }
.mini-item { border: 1px solid var(--linha); border-radius: 8px; padding: 12px 14px; font-size: 13.5px; }
.mini-item .data { color: var(--cinza); font-size: 12px; }

/* ------------------------------- Graficos ----------------------------- */
.grid-graficos { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 8px; }
.painel-grafico { padding-bottom: 12px; }
.grafico-box { position: relative; height: 280px; padding: 14px 16px; }
@media (max-width: 900px) { .grid-graficos { grid-template-columns: 1fr; } }

/* --------------------------- Agenda semanal --------------------------- */
.agenda-grade { table-layout: fixed; }
.agenda-grade th, .agenda-grade td { border: 1px solid var(--linha); vertical-align: top; }
.agenda-grade th { text-align: center; font-size: 11.5px; padding: 8px 4px; }
.agenda-grade th small { color: var(--cinza); font-weight: 400; }
.ag-hora { width: 62px; text-align: center; color: var(--cinza); font-size: 12px; background: #f8fafb; white-space: nowrap; }
.ag-cel { height: 46px; cursor: pointer; padding: 3px; transition: background .1s; }
.ag-cel:hover { background: var(--azul-claro); }
.ag-chip { font-size: 11px; padding: 3px 6px; border-radius: 5px; margin-bottom: 3px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; }
.ag-chip.ag-agendado { background: var(--azul); }
.ag-chip.ag-confirmado { background: var(--verde); }
.ag-chip.ag-realizado { background: var(--cinza); }
.ag-chip.ag-cancelado { background: var(--vermelho); text-decoration: line-through; opacity: .8; }

@media (max-width: 820px) {
  .sidebar { width: 64px; }
  .sidebar-brand span:last-child, .menu-item span, .user-chip > div, .sidebar-foot .btn { display: none; }
  .menu-item { justify-content: center; }
  .landing-hero h1 { font-size: 30px; }
  .form-grid { grid-template-columns: 1fr; }
}
