/* ============================================================
   FLORA HR — Full Pot of Flowers
   Palette: pine #14532D · leaf #16A34A · mist #F6F7F4 · ink #1C1E1B
   ============================================================ */

:root {
  --pine: #14532D;
  --pine-deep: #0C3A1F;
  --leaf: #16A34A;
  --leaf-soft: #DCFCE7;
  --mist: #F6F7F4;
  --ink: #1C1E1B;
  --ink-soft: #5C6159;
  --line: #E3E7E0;
  --card: #FFFFFF;
  --danger: #DC2626;
  --warn: #D97706;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(20, 83, 45, 0.08), 0 4px 16px rgba(20, 83, 45, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* O atributo hidden tem que vencer qualquer display de autor
   (senao .modal { display:flex } deixa o modal visivel sempre) */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  background: var(--mist);
  color: var(--ink);
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

.screen { min-height: 100dvh; }

button { font-family: inherit; cursor: pointer; }
input, select {
  font-family: inherit;
  font-size: 1rem;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  width: 100%;
  color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--leaf); outline-offset: 1px; border-color: transparent; }
input:disabled { background: var(--mist); color: var(--ink-soft); }

/* ============ LOGIN ============ */

.login-wrap {
  min-height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 500px at 50% -10%, var(--leaf-soft), transparent 60%),
    var(--mist);
}

.login-brand { text-align: center; margin-bottom: 24px; }
.login-logo { width: 72px; height: 72px; border-radius: 18px; box-shadow: var(--shadow); }
.login-brand h1 { font-size: 1.9rem; font-weight: 700; color: var(--pine); margin-top: 12px; letter-spacing: -0.02em; }
.login-sub { color: var(--ink-soft); font-size: 0.9rem; margin-top: 2px; }

.login-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 8px; }
.login-card label { font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); margin-top: 6px; }

.form-error { color: var(--danger); font-size: 0.85rem; text-align: center; margin-top: 6px; }

.login-lang { margin-top: 20px; }

/* ============ SHARED ============ */

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin: 0 16px 14px;
}

.card-title { font-size: 0.95rem; font-weight: 600; color: var(--pine); margin-bottom: 10px; }

.btn-primary {
  background: var(--pine);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 13px;
  font-size: 1rem;
  font-weight: 600;
  margin-top: 12px;
  transition: background 0.15s;
}
.btn-primary:active { background: var(--pine-deep); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }

.btn-link {
  background: none; border: none;
  color: var(--ink-soft);
  font-size: 0.85rem;
  text-decoration: underline;
  margin-top: 12px;
}

.btn-danger-link {
  background: none; border: none;
  color: var(--danger);
  font-size: 0.88rem; font-weight: 600;
  margin-top: 14px;
  width: 100%;
}

.btn-icon {
  background: none; border: none;
  font-size: 1.3rem;
  color: var(--ink-soft);
  padding: 6px;
}

.btn-ghost {
  background: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-soft);
  flex: 1;
}

.btn-small { margin-top: 0; padding: 9px 14px; font-size: 0.88rem; border-radius: 10px; flex: 0 0 auto; }

.btn-back {
  background: none; border: none;
  color: var(--pine);
  font-size: 0.95rem; font-weight: 600;
  padding: 4px 0;
}

.lang-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: #fff; }
.lang-btn {
  border: none; background: none;
  padding: 5px 12px;
  font-size: 0.78rem; font-weight: 600;
  color: var(--ink-soft);
}
.lang-btn.is-active { background: var(--pine); color: #fff; }

.seg-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: #fff; }
.seg-btn {
  border: none; background: none;
  padding: 7px 15px;
  font-size: 0.85rem; font-weight: 600;
  color: var(--ink-soft);
}
.seg-btn.is-active { background: var(--pine); color: #fff; }

.stack-form { display: flex; flex-direction: column; gap: 7px; }
.stack-form label { font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); margin-top: 6px; }

.check-row {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px;
  font-size: 0.95rem; font-weight: 600; color: var(--ink);
}
.check-row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--leaf); flex: 0 0 auto; }

.form-actions { display: flex; gap: 10px; margin-top: 14px; }
.form-actions .btn-primary { flex: 1; margin-top: 0; }

.tab-title { font-size: 1.25rem; font-weight: 700; color: var(--pine); }

/* ============ TOPBAR ============ */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px 12px;
  background: var(--mist);
}
.topbar-id { display: flex; flex-direction: column; }
.topbar-name { font-weight: 700; font-size: 1.02rem; color: var(--pine); }
.topbar-loc { font-size: 0.78rem; color: var(--ink-soft); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* ============ CLOCK TAB ============ */

.tab-panel { padding-bottom: 92px; }

.today-date {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.88rem;
  margin: 4px 0 14px;
  text-transform: capitalize;
}

.punch-zone { text-align: center; margin-bottom: 18px; }

/* Signature element: the punch dial */
.punch-btn {
  width: 210px; height: 210px;
  border-radius: 50%;
  border: none;
  display: inline-flex;
  flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px;
  font-weight: 700;
  color: #fff;
  position: relative;
  transition: transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.punch-btn:active { transform: scale(0.97); }
.punch-btn:disabled { opacity: 0.55; cursor: default; }

.punch-btn.is-out {
  background: radial-gradient(circle at 32% 28%, #22C55E, var(--leaf) 55%, #12813B);
  box-shadow: 0 10px 30px rgba(22, 163, 74, 0.35);
}
.punch-btn.is-in {
  background: radial-gradient(circle at 32% 28%, #1E6B3F, var(--pine) 55%, var(--pine-deep));
  box-shadow: 0 10px 30px rgba(20, 83, 45, 0.4);
}
.punch-btn.is-in::before {
  content: '';
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  border: 2px solid rgba(22, 163, 74, 0.5);
  animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.045); opacity: 0.35; }
}
@media (prefers-reduced-motion: reduce) {
  .punch-btn.is-in::before { animation: none; }
}

.punch-state { font-size: 1.25rem; letter-spacing: 0.01em; }
.punch-timer {
  font-size: 1.05rem; font-weight: 500;
  font-variant-numeric: tabular-nums;
  opacity: 0.92; min-height: 1.2em;
}

.punch-since { margin-top: 12px; font-size: 0.9rem; color: var(--ink-soft); min-height: 1.2em; }
.punch-gps { font-size: 0.75rem; color: var(--ink-soft); opacity: 0.8; min-height: 1em; margin-top: 2px; }

/* stats */
.stat-row { display: flex; }
.stat { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat-label { font-size: 0.75rem; color: var(--ink-soft); }
.stat-value { font-size: 1.22rem; font-weight: 700; color: var(--pine); font-variant-numeric: tabular-nums; }
.stat-value.is-ot { color: var(--warn); }

/* entries (clock tab) */
.entries-list { list-style: none; }
.entries-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.entries-list li:last-child { border-bottom: none; }
.entry-times { font-variant-numeric: tabular-nums; font-weight: 600; }
.entry-open { color: var(--leaf); font-weight: 600; font-size: 0.8rem; margin-left: 4px; }
.entry-edited { color: var(--warn); font-size: 0.85rem; }
.entry-dur { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.entry-dur.strong { color: var(--pine); font-weight: 700; }
.entry-dur.is-ot { color: var(--warn); }

.empty-note { color: var(--ink-soft); font-size: 0.88rem; text-align: center; padding: 8px 0; }

.soon-card { text-align: center; padding: 40px 18px; margin-top: 24px; }
.soon-card h2 { color: var(--pine); margin-bottom: 6px; }
.soon-card p { color: var(--ink-soft); }

/* ============ HOURS TAB ============ */

.hours-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 8px 16px 12px;
  gap: 10px;
}

.week-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 16px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
}
.wk-btn {
  background: none; border: none;
  font-size: 1.4rem; line-height: 1;
  color: var(--pine);
  padding: 4px 16px;
}
.wk-btn:disabled { color: var(--line); cursor: default; }
.wk-label { font-size: 0.86rem; font-weight: 600; color: var(--ink); text-align: center; flex: 1; }

.day-list { list-style: none; }
.day-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 12px 0 6px;
  font-size: 0.8rem; font-weight: 700;
  color: var(--ink-soft);
  text-transform: capitalize;
  border-bottom: 1px solid var(--line);
}
.day-head:first-child { padding-top: 2px; }
.day-total { color: var(--pine); font-variant-numeric: tabular-nums; }

.day-entry {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.day-entry:last-child { border-bottom: none; }
.day-entry.is-editable { cursor: pointer; }
.day-entry.is-editable:active { background: var(--mist); }

.live-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--leaf);
  margin-left: 7px;
  vertical-align: middle;
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

.member-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 16px 12px;
}

/* ============ TEAM (admin) ============ */

.team-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 8px 16px 14px;
}

.team-list-card { padding: 6px 18px; }
.team-list { list-style: none; }
.team-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.team-item:last-child { border-bottom: none; }
.team-item-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.team-name { font-weight: 600; }
.team-sub { font-size: 0.78rem; color: var(--ink-soft); }
.team-item.is-inactive .team-name { color: var(--ink-soft); text-decoration: line-through; }
.team-tag { font-size: 0.72rem; color: var(--warn); font-weight: 700; text-transform: uppercase; }

/* ============ MODAL ============ */

.modal {
  position: fixed; inset: 0;
  background: rgba(28, 30, 27, 0.45);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 100;
  padding: 0;
}
.modal-card {
  background: #fff;
  width: 100%;
  max-width: 480px;
  border-radius: 20px 20px 0 0;
  padding: 22px 20px calc(env(safe-area-inset-bottom, 0px) + 22px);
  max-height: 92dvh;
  overflow-y: auto;
}
.modal-meta { font-size: 0.78rem; color: var(--ink-soft); margin-top: 10px; }

@media (min-width: 700px) {
  .tab-panel { max-width: 520px; margin: 0 auto; }
  .topbar { max-width: 520px; margin: 0 auto; }
  .modal { align-items: center; }
  .modal-card { border-radius: 20px; }
}

/* ============ BOTTOM NAV ============ */

.bottomnav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 40;
}
.nav-btn {
  flex: 1;
  background: none; border: none;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 0 7px;
  font-size: 0.68rem;
  color: var(--ink-soft);
}
.nav-btn .nav-ico { font-size: 1.15rem; }
.nav-btn.is-active { color: var(--pine); font-weight: 700; }

/* ============ TOAST ============ */

.toast {
  position: fixed;
  left: 50%; bottom: 84px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.88rem;
  box-shadow: var(--shadow);
  z-index: 200;
  max-width: 90vw;
  text-align: center;
}
.toast.is-error { background: var(--danger); }

/* ============ TIME OFF ============ */

.bal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.bal-head .card-title { margin-bottom: 0; }

.stat-sub { font-size: 0.68rem; color: var(--ink-soft); }

.sub-head {
  font-size: 0.82rem; font-weight: 700;
  color: var(--pine);
  margin: 18px 0 6px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.bal-grid { display: flex; gap: 8px; }
.bal-grid > div { flex: 1; min-width: 0; }
.bal-grid label { display: block; margin-top: 0; margin-bottom: 4px; font-size: 0.72rem; }
.bal-grid input { padding: 10px; text-align: center; }

.setting-hint { font-size: 0.82rem; color: var(--ink-soft); margin-bottom: 4px; }

.req-list { list-style: none; }
.req-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.req-item:last-child { border-bottom: none; }
.req-item.is-editable { cursor: pointer; }
.req-item.is-editable:active { background: var(--mist); }
.req-top { font-weight: 600; }
.req-review-note {
  font-size: 0.76rem; color: var(--ink-soft);
  font-style: italic; margin-top: 3px;
}

.req-status {
  font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 4px 9px;
  border-radius: 999px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.req-status.is-pending  { background: #FEF3C7; color: #92400E; }
.req-status.is-approved { background: var(--leaf-soft); color: #14532D; }
.req-status.is-denied   { background: #FEE2E2; color: #991B1B; }
.req-status.is-cancelled{ background: var(--mist); color: var(--ink-soft); }

.rv-line { font-size: 0.92rem; margin-bottom: 4px; }
#rv-who { font-weight: 700; color: var(--pine); font-size: 1.05rem; }
.rv-balance { color: var(--ink-soft); font-size: 0.82rem; margin-top: 8px; }

.stack-label {
  display: block;
  font-size: 0.82rem; font-weight: 600;
  color: var(--ink-soft);
  margin: 14px 0 6px;
}

.btn-deny {
  background: #fff;
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: 12px;
  padding: 12px;
  font-size: 0.95rem; font-weight: 600;
  flex: 1;
}
.btn-deny:active { background: #FEE2E2; }

/* ============ ROLES & PERMISSOES ============ */

.perm-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.perm-row:last-child { border-bottom: none; }
.perm-label { font-size: 0.88rem; flex: 1; min-width: 0; }
.perm-scope {
  width: auto; flex: 0 0 auto;
  padding: 7px 10px;
  font-size: 0.85rem;
  border-radius: 8px;
}
.team-tag.is-sys { color: var(--ink-soft); }

/* ============ EXPORT DA FOLHA ============ */

.head-actions { display: flex; align-items: center; gap: 8px; }

.date-pair { display: flex; gap: 8px; }
.date-pair input { flex: 1; min-width: 0; }

.quick-weeks { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.chip {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.8rem; font-weight: 600;
  color: var(--ink-soft);
}
.chip:active { background: var(--leaf-soft); border-color: var(--leaf); color: var(--pine); }

.ex-summary {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.ex-tot {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 8px; flex-wrap: wrap;
  font-size: 0.88rem; color: var(--ink-soft);
  margin-bottom: 8px;
}
.ex-tot b { color: var(--warn); }
.ex-pay { color: var(--pine); font-weight: 700; font-size: 1.05rem; }

.ex-list { list-style: none; max-height: 210px; overflow-y: auto; }
.ex-list li {
  display: flex; justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.86rem;
}
.ex-list li:last-child { border-bottom: none; }
.ex-hours { font-variant-numeric: tabular-nums; color: var(--ink-soft); }

.ex-warning {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--warn);
  background: #FEF3C7;
  padding: 8px 10px;
  border-radius: 8px;
}

/* ============ ALERTAS ============ */

.bell { position: relative; }
.bell.has-alerts { color: var(--warn); }
.badge {
  position: absolute;
  top: -1px; right: -3px;
  background: var(--danger);
  color: #fff;
  font-size: 0.6rem; font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

.alert-group {
  font-size: 0.78rem; font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 14px 0 4px;
}
.alert-group:first-child { margin-top: 4px; }

.alert-list { list-style: none; }
.alert-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px;
  border-radius: 10px;
  margin-bottom: 5px;
  font-size: 0.88rem;
}
.alert-item.is-warn { background: #FEF3C7; }
.alert-item.is-bad  { background: #FEE2E2; }
.alert-ico { flex: 0 0 auto; font-size: 0.95rem; }
.alert-text { flex: 1; min-width: 0; }
.alert-loc {
  flex: 0 0 auto;
  font-size: 0.7rem; font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
}

.days-row { display: flex; gap: 5px; margin-top: 2px; }
.day-chip {
  flex: 1;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 9px 0;
  font-size: 0.8rem; font-weight: 700;
  color: var(--ink-soft);
}
.day-chip.is-on { background: var(--pine); border-color: var(--pine); color: #fff; }

.mini-input {
  width: 78px; flex: 0 0 auto;
  padding: 7px 9px;
  font-size: 0.85rem;
  text-align: center;
}

/* ============ ESCALA (grade) ============ */

.grid-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 16px 8px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.sch-grid { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }

.sch-grid th, .sch-grid td { border-bottom: 1px solid var(--line); }

.sch-corner, .sch-name {
  position: sticky; left: 0; z-index: 2;
  background: var(--card);
  text-align: left;
  padding: 10px 12px;
  font-size: 0.82rem; font-weight: 600;
  min-width: 116px; max-width: 116px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 1px 0 0 var(--line);
}
.sch-corner { z-index: 3; }

.sch-day {
  padding: 8px 6px;
  min-width: 66px;
  font-size: 0.72rem; font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  background: var(--card);
}
.sch-day span { display: block; }
.sch-day small { display: block; font-size: 0.85rem; font-weight: 600; color: var(--ink); }
.sch-day.is-today { color: var(--leaf); }
.sch-day.is-today small { color: var(--pine); }

.sch-cell {
  padding: 5px 4px;
  text-align: center;
  vertical-align: middle;
  min-width: 66px;
}
.sch-cell.is-empty {
  color: var(--line);
  font-size: 1.1rem;
  cursor: pointer;
}
.sch-cell.is-empty:active { background: var(--mist); }

.shift-chip {
  background: var(--leaf-soft);
  color: var(--pine);
  border-radius: 7px;
  padding: 5px 4px;
  font-size: 0.7rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  margin-bottom: 3px;
  white-space: nowrap;
}
.shift-chip:last-child { margin-bottom: 0; }
.shift-chip:active { background: var(--leaf); color: #fff; }

#sch-total { margin: 0 16px 12px; text-align: right; }
