:root {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-card-2: #24334d;
  --border: #334155;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --accent: #38bdf8;
  --accent-dim: #0369a1;
  --green: #4ade80;
  --amber: #fbbf24;
  --red: #f87171;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 78px;
}

.hidden { display: none !important; }

/* ---------- Login ---------- */
#login-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px;
  gap: 18px;
  text-align: center;
}

#login-screen h1 { font-size: 22px; margin: 0; }
#login-screen p { color: var(--text-dim); font-size: 14px; margin: 0; max-width: 320px; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

input, textarea, select {
  width: 100%;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 12px;
  font-size: 15px;
  font-family: inherit;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

button {
  cursor: pointer;
  font-family: inherit;
}

.btn {
  background: var(--accent);
  color: #04202f;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  width: 100%;
}

.btn:disabled { opacity: .5; }

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
}

.btn-icon {
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
}

/* ---------- Top bar ---------- */
header#topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(15,23,42,.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header#topbar h2 { margin: 0; font-size: 17px; }
header#topbar .sub { color: var(--text-dim); font-size: 12px; }

/* ---------- Sections ---------- */
main { padding: 16px; display: flex; flex-direction: column; gap: 16px; }

.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-dim);
  margin: 4px 0 -4px;
}

.list-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.list-item .row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.list-item .title { font-weight: 600; font-size: 15px; }
.list-item .meta { font-size: 12px; color: var(--text-dim); }
.list-item .desc { font-size: 14px; color: var(--text); }
.list-item img.thumb { max-width: 100%; border-radius: 10px; margin-top: 6px; }

.badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}
.badge.manha, .badge.tarde, .badge.noite { background: rgba(56,189,248,.15); color: var(--accent); }
.badge.folga { background: rgba(148,163,184,.2); color: var(--text-dim); }
.badge.ferias { background: rgba(74,222,128,.15); color: var(--green); }
.badge.atestado { background: rgba(248,113,113,.15); color: var(--red); }
.badge.ativo { background: rgba(74,222,128,.15); color: var(--green); }
.badge.inativo { background: rgba(248,113,113,.15); color: var(--red); }

.empty {
  color: var(--text-dim);
  font-size: 14px;
  text-align: center;
  padding: 24px 12px;
}

form.stack { display: flex; flex-direction: column; gap: 10px; }
form.stack label { font-size: 13px; color: var(--text-dim); margin-bottom: -6px; }

.fab-form {
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 12px;
}

/* ---------- Bottom nav ---------- */
nav#bottomnav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: rgba(15,23,42,.97);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
}

nav#bottomnav .inner {
  max-width: 560px;
  width: 100%;
  display: flex;
}

nav#bottomnav button {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 10px 2px 8px;
  font-size: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

nav#bottomnav button .ic { font-size: 18px; }
nav#bottomnav button.active { color: var(--accent); }

/* ---------- AI chat ---------- */
#ia-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 200px;
}

.msg {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
}
.msg.user { align-self: flex-end; background: var(--accent-dim); color: #fff; }
.msg.ai { align-self: flex-start; background: var(--bg-card); border: 1px solid var(--border); }

#ia-input-row { display: flex; gap: 8px; position: sticky; bottom: 74px; }
#ia-input-row input { flex: 1; }

.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: #111827;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  z-index: 50;
}
