/* =====================================================================
   Portal de Sistemas — Secretaria de Tecnologia da Informação
   Santa Tereza do Oeste - PR
   Design system compartilhado (v2 — redesign 2026)
   ===================================================================== */

:root{
  /* Paleta institucional modernizada */
  --primary-50:  #eafbf1;
  --primary-100: #cdf3dc;
  --primary-400: #2fa863;
  --primary-500: #17914f;
  --primary-600: #0f7a41;
  --primary-700: #0c6335;
  --primary-900: #0a3d22;

  --accent-500: #0e6fc9;
  --accent-600: #0b5aa3;

  /* Cores fixas da marca — usadas no sidebar e no painel de login.
     Não mudam com o tema claro/escuro, para manter a identidade
     visual sempre presente (padrão comum em painéis administrativos). */
  --brand-900: #0a3d22;
  --brand-700: #0c6335;
  --brand-600: #0f7a41;
  --brand-accent-600: #0b5aa3;

  --warn-500: #c2660f;
  --warn-100: #fdf0e2;
  --danger-500: #d1332a;
  --danger-100: #fbe1df;

  --bg: #f3f5f4;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f7f9f8;
  --border: #e3e8e5;
  --border-strong: #cdd5d0;

  --text: #1b2320;
  --text-muted: #5c6864;
  --text-faint: #8b948f;
  --text-on-primary: #ffffff;

  --shadow-sm: 0 1px 2px rgba(15, 30, 20, 0.06);
  --shadow-md: 0 6px 20px -4px rgba(15, 30, 20, 0.12), 0 2px 6px rgba(15, 30, 20, 0.06);
  --shadow-lg: 0 20px 45px -12px rgba(10, 30, 20, 0.28);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --sidebar-w: 264px;
  --topbar-h: 68px;

  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, Arial, Helvetica, sans-serif;

  color-scheme: light;
}

[data-theme="dark"]{
  --bg: #0f1512;
  --bg-elevated: #141c18;
  --surface: #17201c;
  --surface-soft: #1b2521;
  --border: #26332c;
  --border-strong: #33453b;

  --text: #eaf1ec;
  --text-muted: #a3b0aa;
  --text-faint: #71807a;

  --primary-50:  #10261a;
  --primary-100: #123521;
  --primary-400: #37c17c;
  --primary-500: #2fa863;
  --primary-600: #3fce88;
  --primary-700: #63dc9f;

  --warn-100: #2e2113;
  --danger-100: #301715;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.35);
  --shadow-md: 0 10px 30px -8px rgba(0,0,0,0.55), 0 2px 8px rgba(0,0,0,0.3);
  --shadow-lg: 0 25px 60px -15px rgba(0,0,0,0.65);

  color-scheme: dark;
}

*, *::before, *::after{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease, color 0.2s ease;
}
h1,h2,h3,h4,p{ margin: 0; }
a{ color: inherit; }
button{ font-family: inherit; }
img, svg{ display:block; }
.icon{ width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

::selection{ background: var(--primary-100); color: var(--primary-900); }

:focus-visible{
  outline: 2px solid var(--accent-500);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------------------------------------------------------------------
   App shell: sidebar + main
   --------------------------------------------------------------------- */
.app-shell{
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar{
  background: linear-gradient(180deg, var(--brand-900), var(--brand-700) 65%, var(--brand-600));
  color: #eafbf1;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}
.sidebar-brand{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 22px 8px;
}
.brasao{
  width: 42px; height: 42px;
  border-radius: 12px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.22);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.4px;
  flex-shrink: 0;
}
.sidebar-brand .titulo{
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.25;
}
.sidebar-brand .subtitulo{
  font-size: 11px;
  opacity: 0.75;
  margin-top: 2px;
}

.sidebar-nav{
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 6px;
}
.nav-label{
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.55;
  padding: 16px 12px 6px 12px;
}
.nav-item{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  color: rgba(255,255,255,0.88);
  text-decoration: none;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.nav-item .icon{ width: 18px; height: 18px; opacity: 0.9; }
.nav-item:hover{
  background: rgba(255,255,255,0.10);
}
.nav-item.ativo{
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.24);
  color: #ffffff;
}
.nav-item .badge-lock{
  margin-left: auto;
  opacity: 0.7;
}

.sidebar-spacer{ flex: 1; }

.sidebar-footer{
  border-top: 1px solid rgba(255,255,255,0.14);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.theme-toggle{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.16);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.theme-toggle:hover{ background: rgba(255,255,255,0.14); }
.theme-toggle .icon{ width: 16px; height: 16px; }

.user-chip{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.16);
}
.user-chip .avatar{
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.user-chip .info{ min-width: 0; flex: 1; }
.user-chip .nome{
  font-size: 12.5px; font-weight: 700; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-chip .sair{
  font-size: 11px; color: rgba(255,255,255,0.75); text-decoration: none; font-weight: 600;
}
.user-chip .sair:hover{ color: #fff; text-decoration: underline; }

.mobile-topbar{ display: none; }

.sidebar-overlay{
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 39;
}
.sidebar-overlay.ativo{ display: block; }

/* ---------------------------------------------------------------------
   Main content
   --------------------------------------------------------------------- */
.main-content{
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar{
  padding: 30px 40px 6px 40px;
}
.topbar h1{
  font-size: 21px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.2px;
}
.topbar p{
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--text-muted);
  max-width: 620px;
  line-height: 1.55;
}

.conteudo{
  padding: 22px 40px 48px 40px;
  flex: 1;
}

.secao[hidden]{ display: none; }
.secao{ animation: apareceu 0.25s ease; }
@keyframes apareceu{
  from{ opacity: 0; transform: translateY(6px); }
  to{ opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------------------
   Cards
   --------------------------------------------------------------------- */
.cards{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.card{
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 22px;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.card:hover{
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-400);
}
.card .icon-tile{
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, var(--primary-500), var(--primary-700));
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.card .icon-tile .icon{ width: 22px; height: 22px; stroke-width: 2; }
.card .icon-tile.acento{ background: linear-gradient(150deg, var(--accent-500), var(--accent-600)); }
.card h3{
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.card .rota{
  font-size: 11.5px;
  color: var(--text-faint);
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.card .acessar{
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary-600);
}
.card .acessar .icon{ width: 14px; height: 14px; transition: transform 0.15s ease; }
.card:hover .acessar .icon{ transform: translateX(3px); }

/* ---------------------------------------------------------------------
   Paginação
   --------------------------------------------------------------------- */
.paginador{
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 0 4px 0;
}
.pg-paginas{ display: flex; align-items: center; gap: 5px; }
.pg-num, .pg-seta{
  min-width: 32px; height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.pg-num:hover, .pg-seta:hover{ border-color: var(--primary-400); color: var(--primary-600); }
.pg-num.ativo{ background: var(--primary-500); border-color: var(--primary-500); color: #fff; }
.pg-seta .icon{ width: 16px; height: 16px; }
.pg-seta:disabled{ opacity: 0.35; cursor: default; }
.pg-seta:disabled:hover{ border-color: var(--border); color: var(--text-muted); }

/* ---------------------------------------------------------------------
   Busca
   --------------------------------------------------------------------- */
.busca{
  position: relative;
  width: 100%;
  max-width: 420px;
  margin-bottom: 20px;
}
.busca .icon{
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  width: 17px; height: 17px;
  color: var(--text-faint);
}
.busca input{
  width: 100%;
  padding: 11px 14px 11px 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 14px;
  outline: none;
  background: var(--surface);
  color: var(--text);
}
.busca input:focus{ border-color: var(--primary-400); box-shadow: 0 0 0 3px var(--primary-100); }
.busca input::placeholder{ color: var(--text-faint); }

/* ---------------------------------------------------------------------
   Lista de relógios de ponto
   --------------------------------------------------------------------- */
.lista-relogios{
  width: 100%;
  display: grid;
  gap: 10px;
}
.item-relogio{
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}
.item-relogio:hover{ border-color: var(--primary-400); transform: translateX(2px); }
.item-relogio .num{
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: 9px;
  background: var(--primary-50);
  color: var(--primary-700);
  font-size: 11.5px; font-weight: 800;
  flex-shrink: 0;
}
.item-relogio .nome{ flex: 1; min-width: 0; }
.item-relogio .nome strong{
  display: block; font-size: 14px; color: var(--text); font-weight: 700;
}
.item-relogio .nome span{
  display: block; font-size: 12px; color: var(--text-faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
}
.item-relogio .tag{
  font-size: 11px; font-weight: 700;
  color: var(--warn-500);
  background: var(--warn-100);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  flex-shrink: 0;
}
.item-relogio .ir{
  font-size: 12px; font-weight: 700;
  color: var(--primary-700);
  background: var(--primary-50);
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 5px;
}
.item-relogio .ir .icon{ width: 13px; height: 13px; }
.item-relogio:hover .ir{ background: var(--primary-500); color: #fff; }

.sem-resultado{
  padding: 30px;
  text-align: center;
  color: var(--text-faint);
  font-size: 14px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
}

.voltar{
  margin-top: 26px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--primary-600);
  text-decoration: none;
  font-weight: 700;
}
.voltar:hover{ text-decoration: underline; }
.voltar .icon{ width: 15px; height: 15px; }

/* ---------------------------------------------------------------------
   Rodapé
   --------------------------------------------------------------------- */
footer.rodape{
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: var(--text-faint);
  border-top: 1px solid var(--border);
}

/* ---------------------------------------------------------------------
   Login — tela dividida
   --------------------------------------------------------------------- */
body.tela-login{
  min-height: 100vh;
  display: flex;
  background: var(--bg);
}
.login-shell{
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  width: 100%;
  min-height: 100vh;
}
.login-painel{
  background:
    radial-gradient(circle at 15% 20%, rgba(255,255,255,0.10), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(255,255,255,0.08), transparent 45%),
    linear-gradient(150deg, var(--brand-900), var(--brand-600) 70%, var(--brand-accent-600));
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px;
}
.login-painel .marca{ display: flex; align-items: center; gap: 12px; }
.login-painel .marca .brasao{ width: 46px; height: 46px; font-size: 15px; }
.login-painel .marca .nome{ font-size: 14px; font-weight: 700; line-height: 1.3; }
.login-painel .frase{ max-width: 380px; }
.login-painel .frase h2{ font-size: 26px; font-weight: 800; line-height: 1.3; letter-spacing: -0.3px; }
.login-painel .frase p{ margin-top: 12px; font-size: 14px; opacity: 0.82; line-height: 1.6; }
.login-painel .rodape-painel{ font-size: 12px; opacity: 0.65; }

.login-form-area{
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
}
.caixa-login{
  width: 100%;
  max-width: 360px;
}
.caixa-login .topo{ margin-bottom: 28px; }
.caixa-login .topo h1{ font-size: 20px; font-weight: 800; color: var(--text); }
.caixa-login .topo p{ margin-top: 6px; font-size: 13px; color: var(--text-muted); }

.campo{ margin-bottom: 16px; }
.campo label{
  display: block; font-size: 12.5px; font-weight: 700; color: var(--text);
  margin-bottom: 7px;
}
.campo .input-wrap{ position: relative; }
.campo .input-wrap .icon{
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-faint);
}
.campo input{
  width: 100%;
  padding: 11px 14px 11px 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  background: var(--surface);
  color: var(--text);
}
.campo input:focus{ border-color: var(--primary-400); box-shadow: 0 0 0 3px var(--primary-100); }

.btn-entrar{
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary-500);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 6px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn-entrar:hover{ background: var(--primary-600); }
.btn-entrar:active{ transform: translateY(1px); }
.btn-entrar .icon{ width: 16px; height: 16px; }

.alerta-erro{
  display: flex; align-items: center; gap: 10px;
  background: var(--danger-100);
  color: var(--danger-500);
  border: 1px solid rgba(209,51,42,0.25);
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 18px;
}
.alerta-erro .icon{ width: 16px; height: 16px; flex-shrink: 0; }

.rodape-caixa{
  text-align: center;
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 26px;
}

/* ---------------------------------------------------------------------
   Manutenção
   --------------------------------------------------------------------- */
body.tela-manutencao{
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.manut-header{
  background: linear-gradient(120deg, var(--brand-900), var(--brand-600));
  color: #fff;
  padding: 34px 20px;
  text-align: center;
}
.manut-header .brasao{ margin: 0 auto 14px auto; }
.manut-header h1{ font-size: 19px; font-weight: 800; }
.manut-header p{ margin-top: 6px; font-size: 13.5px; opacity: 0.85; }
.manut-main{
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 44px 20px;
}
.manut-box{
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 46px 38px;
  text-align: center;
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}
.manut-box .icon-tile{
  width: 72px; height: 72px;
  margin: 0 auto 22px auto;
  border-radius: 20px;
  background: var(--warn-100);
  color: var(--warn-500);
  display: flex; align-items: center; justify-content: center;
}
.manut-box .icon-tile .icon{ width: 32px; height: 32px; stroke-width: 1.7; }
.manut-box h2{ font-size: 19px; color: var(--text); margin-bottom: 12px; font-weight: 800; }
.manut-box p{ font-size: 14px; color: var(--text-muted); line-height: 1.65; margin-bottom: 8px; }
.manut-box .suporte{
  margin-top: 18px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  text-align: left;
  display: inline-block;
}
.manut-box .suporte h3{
  font-size: 11.5px; color: var(--accent-500); text-transform: uppercase;
  letter-spacing: 0.06em; margin-bottom: 12px; text-align: center; font-weight: 800;
}
.manut-box .suporte a{
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text);
  font-size: 15.5px; font-weight: 700; padding: 7px 0;
}
.manut-box .suporte a .icon{ width: 17px; height: 17px; color: var(--primary-500); }

/* ---------------------------------------------------------------------
   Responsivo
   --------------------------------------------------------------------- */
@media (max-width: 980px){
  .app-shell{ grid-template-columns: 1fr; }
  .sidebar{
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 82vw);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.aberta{ transform: translateX(0); }
  .mobile-topbar{
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--primary-700);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 30;
  }
  .mobile-topbar .btn-menu{
    width: 34px; height: 34px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
  }
  .mobile-topbar .titulo-mobile{ font-size: 13.5px; font-weight: 700; }
  .topbar, .conteudo{ padding-left: 20px; padding-right: 20px; }
  .login-shell{ grid-template-columns: 1fr; }
  .login-painel{ display: none; }
}

@media (max-width: 560px){
  .cards{ grid-template-columns: 1fr 1fr; }
  .item-relogio{ flex-wrap: wrap; }
}
@media (max-width: 420px){
  .cards{ grid-template-columns: 1fr; }
}
