:root {
  --brand: #2f7d32;
  --brand-strong: #247234;
  --brand-dark: #165b2d;
  --brand-deep: #143820;
  --brand-soft: #eaf5eb;
  --blue: var(--brand-dark);
  --blue2: var(--brand-strong);
  --green: var(--brand);
  --red: #b43535;
  --amber: #b87500;
  --ink: #18211c;
  --muted: #68736d;
  --line: #dfe6e1;
  --soft: #f3f6f4;
  --white: #fff;
  --shadow: 0 16px 50px rgba(22, 48, 32, .07);
  --radius: 16px;
}

* { box-sizing: border-box; }

html {
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--soft);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 88% 8%, rgba(71, 143, 65, .09), transparent 26rem),
    var(--soft);
}

a { color: var(--blue2); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: block;
  color: var(--ink);
  border-top: 4px solid var(--brand);
  border-bottom: 1px solid rgba(28, 65, 40, .11);
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 5px 18px rgba(22, 48, 32, .04);
  backdrop-filter: blur(16px);
}

.topbar::before {
  position: absolute;
  top: -4px;
  right: 0;
  left: 0;
  height: 1px;
  background: #173c5a;
  content: "";
}

.topbar-inner {
  width: min(1220px, calc(100% - 40px));
  min-height: 84px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
  flex: 0 0 auto;
  color: var(--ink);
}

.brand:hover { text-decoration: none; }

.brand-logo {
  display: block;
  width: 308px;
  height: auto;
}

.brand-product strong,
.brand-product small { display: block; }

.brand-product strong {
  color: var(--brand-dark);
  font-size: 15px;
  line-height: 1.15;
}

.brand-product small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .04em;
}

.brand-product {
  padding: 5px 0 5px 18px;
  border-left: 1px solid var(--line);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 99px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  font-size: 12px;
  font-weight: 800;
}

.logout-button {
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid #cdd9d0;
  border-radius: 10px;
  color: var(--brand-dark);
  background: #fff;
  font-weight: 800;
  cursor: pointer;
}

.logout-button:hover { border-color: #86aa8c; background: #f8fbf8; }

.nav {
  border-top: 1px solid #edf1ee;
  background: rgba(255, 255, 255, .92);
}

.nav-inner {
  display: flex;
  width: min(1220px, calc(100% - 40px));
  margin: 0 auto;
  align-items: center;
  gap: 16px;
}

.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 4px;
  border-bottom: 2px solid transparent;
  color: #26362d;
  font-size: 13px;
  font-weight: 750;
}

.nav a:hover {
  color: var(--brand-dark);
  text-decoration: none;
  border-bottom-color: #a8c9ad;
}

.nav a.active { color: var(--brand-dark); border-bottom-color: var(--brand); }

.inline { display: inline; }

.menu-button {
  display: none;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid #cdd9d0;
  border-radius: 9px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  font-weight: 800;
}

.homologation {
  padding: 8px 16px;
  border-bottom: 1px solid #ecc875;
  color: #784700;
  background: #fff1d7;
  text-align: center;
  font-size: 13px;
  font-weight: 750;
}

.container {
  width: min(1180px, calc(100% - 32px));
  margin: 30px auto 60px;
}

.footer {
  padding: 24px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--green);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 12px;
  color: var(--brand-dark);
  font-size: clamp(27px, 4vw, 40px);
  line-height: 1.12;
}

h2 {
  margin: 0 0 16px;
  color: var(--brand-dark);
  font-size: 20px;
}

p { line-height: 1.55; }

.panel,
.auth-card,
.punch-card,
.clock-card,
.status-hero {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.panel { padding: 22px; margin-bottom: 22px; }

.auth-card {
  max-width: 500px;
  margin: 7vh auto;
  padding: 34px;
  border-top: 4px solid var(--green);
}

.form-stack { display: grid; gap: 15px; margin: 20px 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.span-2 { grid-column: 1 / -1; }

label {
  display: grid;
  gap: 7px;
  color: #304338;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 43px;
  padding: 9px 11px;
  border: 1px solid #b9c9be;
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

input:focus,
select:focus,
textarea:focus,
button:focus,
a:focus {
  outline: 3px solid rgba(63, 174, 90, .3);
  outline-offset: 2px;
}

textarea { min-height: 105px; resize: vertical; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid var(--brand-strong);
  border-radius: 10px;
  color: var(--brand-dark);
  background: #fff;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}

.button:hover {
  filter: brightness(.98);
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(46, 141, 72, .16);
  transform: translateY(-1px);
}

.button:active { transform: translateY(2px); }

.button.primary {
  border-color: var(--brand-strong);
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
}

.button.secondary { border-color: #87978c; color: #3f5045; }
.button.small { min-height: 34px; padding: 6px 10px; font-size: 12px; }
.danger-button { border-color: #d68181; color: #972626; background: #fff5f5; }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; }

.hero-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
  margin-bottom: 20px;
}

.clock-card {
  padding: 22px 30px;
  border-top: 4px solid var(--green);
  text-align: center;
}

.clock-card span {
  display: block;
  color: var(--brand-dark);
  font-size: 38px;
  font-variant-numeric: tabular-nums;
  font-weight: 850;
}

.clock-card small { color: var(--muted); }
.punch-card { padding: 26px; margin-bottom: 22px; text-align: center; }

.punch-button {
  min-height: 62px;
  padding-inline: 38px;
  border-color: var(--green);
  color: #fff;
  background: linear-gradient(135deg, var(--green), var(--brand-strong));
  font-size: 20px;
}

.muted { color: var(--muted); font-size: 13px; }
.grid { display: grid; gap: 22px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.split { grid-template-columns: minmax(0, 1.6fr) minmax(280px, .8fr); }

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading.compact { margin-bottom: 4px; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 99px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.badge.warn,
.badge.pending { color: #805000; background: #fff0d0; }
.badge.approved,
.badge.success { color: #087042; background: #ddf5e9; }
.badge.rejected { color: #982929; background: #fbe1e1; }
.muted-badge { color: #64716a; background: #eceff2; }

.timeline { display: grid; gap: 10px; padding: 0; margin: 0; list-style: none; }

.timeline li {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.timeline strong {
  color: var(--brand-dark);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.timeline span { color: var(--muted); }
.action-list,
.card-list { display: grid; gap: 11px; }

.action,
.mini-card,
.person-card,
.request-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.action {
  display: grid;
  padding: 14px;
  border-left: 4px solid transparent;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.action:hover {
  border-left-color: var(--green);
  background: var(--brand-soft);
  text-decoration: none;
  transform: translateX(2px);
}

.action span,
.person-card p,
.mini-card p { margin: 4px 0; color: var(--muted); font-size: 13px; }

.mini-card,
.person-card,
.request-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 14px;
}

.mini-card.block { display: block; }
.person-card { flex-wrap: wrap; }
.request-card { align-items: flex-start; }
.inline-form,
.decision { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-form select,
.inline-form input,
.decision input { width: auto; min-width: 150px; }
.schedule-days { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.schedule-days span { padding: 6px 8px; border-radius: 7px; background: var(--soft); font-size: 12px; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin: 20px 0;
}

.stats article {
  padding: 20px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--green);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(14, 58, 35, .06);
}

.stats article.danger { border-top-color: var(--red); }
.stats strong { display: block; color: var(--brand-dark); font-size: 34px; }
.stats span { color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; }
.table-wrap table { width: 100%; min-width: 650px; border-collapse: collapse; }

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  color: var(--brand-dark);
  background: var(--soft);
  font-size: 12px;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.schedule-editor input { min-width: 100px; }
.schedule-editor input[type=checkbox] { width: 20px; min-width: 20px; }
.checks { display: grid; gap: 10px; padding-left: 22px; }
.checks li::marker { color: var(--green); }

.alert {
  padding: 13px 16px;
  margin-bottom: 18px;
  border: 1px solid;
  border-radius: 11px;
}

.alert.success { color: #086840; border-color: #addfc5; background: #e5f7ee; }
.alert.error { color: #8b2424; border-color: #efb8b8; background: #fff0f0; }
.empty { max-width: 650px; margin: 8vh auto; text-align: center; }
.empty-copy { padding: 20px 0; color: var(--muted); }
.status-hero { padding: 20px; margin: 18px 0; }
.status-hero strong { color: var(--brand-dark); font-size: 22px; }
.warning-bg { border-left: 5px solid var(--amber); }
.success-bg { border-left: 5px solid var(--green); }
.compliance-list { display: grid; gap: 10px; padding: 0; list-style: none; }

.compliance-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 9px;
  background: var(--soft);
}

.compliance-list li span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  font-weight: 900;
}

.compliance-list .ok span { color: #087044; background: #d8f4e6; }
.compliance-list .missing span { color: #875100; background: #ffe7c4; }
.hash { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; word-break: break-all; }

@media (max-width: 1080px) {
  .menu-button { display: block; }

  .nav {
    display: none;
    border-top: 1px solid var(--line);
    background: #fff;
  }

  .nav.open { display: block; }
  .nav-inner { align-items: stretch; flex-direction: column; gap: 0; padding: 8px 0 12px; }
  .nav a { width: 100%; min-height: 42px; padding: 0 10px; border-bottom-width: 0; border-left: 3px solid transparent; }
  .nav a.active { border-left-color: var(--brand); background: var(--brand-soft); }
  .grid.two,
  .grid.split,
  .stats { grid-template-columns: 1fr 1fr; }
  .hero-grid { grid-template-columns: 1fr; }
  .clock-card { width: 100%; }
}

@media (max-width: 650px) {
  .topbar-inner,
  .nav-inner { width: min(100% - 20px, 1220px); }
  .topbar-inner { min-height: 74px; gap: 8px; }
  .brand { min-width: 0; }
  .brand-logo { width: 205px; }
  .brand-product { display: none; }
  .user-chip { display: none; }
  .menu-button { flex: 0 0 auto; padding-inline: 11px; }
  .container { width: min(100% - 20px, 1180px); margin-top: 20px; }
  .grid.two,
  .grid.split,
  .stats,
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .stats { grid-template-columns: 1fr 1fr; }
  .panel { padding: 16px; }
  .auth-card { padding: 22px; }
  .timeline li { grid-template-columns: 76px 1fr; }
  .timeline li a { grid-column: 2; }
  .clock-card span { font-size: 34px; }
  .person-card,
  .request-card { align-items: stretch; flex-direction: column; }
  .inline-form,
  .decision { align-items: stretch; flex-direction: column; }
  .inline-form select,
  .inline-form input,
  .decision input { width: 100%; }
  .punch-button { width: 100%; font-size: 17px; }
  .footer { padding-inline: 14px; line-height: 1.5; }
}

@media (max-width: 390px) {
  .brand-logo { width: 174px; }
  .logout-button { padding-inline: 10px; }
  .stats { grid-template-columns: 1fr; }
}
