﻿:root {
  --bg: #f3f8f2;
  --panel: #ffffff;
  --ink: #203327;
  --muted: #64736a;
  --line: #d7e5d7;
  --brand: #4f9551;
  --brand-2: #2f6f36;
  --accent: #74b843;
  --danger: #b23b3b;
  --shadow: 0 14px 34px rgba(32, 51, 39, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

.hidden {
  display: none !important;
}

.auth-locked .app-shell {
  display: none;
}

.public-invite-mode .app-shell,
.public-invite-mode .login-screen {
  display: none !important;
}

.login-screen {
  display: none;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(79, 149, 81, 0.12), rgba(116, 184, 67, 0.08)),
    var(--bg);
}

.login-screen.active {
  display: grid;
}

.public-invite-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(79, 149, 81, 0.12), rgba(116, 184, 67, 0.08)),
    var(--bg);
}

.public-invite-card {
  width: min(980px, 100%);
  max-width: calc(100vw - 48px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
  overflow: hidden;
}

.public-invite-card h1 {
  margin: 0 0 8px;
  text-align: center;
}

.public-invite-form {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

.public-invite-form button {
  grid-column: 1 / -1;
}

.public-invite-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  min-width: 0;
}

.public-invite-section legend {
  padding: 0 8px;
  font-weight: 700;
  color: var(--brand-2);
}

.public-invite-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  max-width: 100%;
}

.public-invite-grid label,
.public-invite-section,
.public-invite-grid input {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.participant-entry {
  grid-template-columns: minmax(220px, 1.35fr) minmax(150px, 0.7fr) minmax(180px, 1fr);
  align-items: end;
}

.participant-entry button {
  grid-column: 1 / -1;
  min-height: 42px;
}

.public-participants-list {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
  color: var(--muted);
}

.public-participants-list table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
}

.public-participants-list th,
.public-participants-list td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.public-participants-list th {
  color: var(--ink);
  font-size: 13px;
  text-transform: uppercase;
}

.public-participants-list .empty-row {
  padding: 14px;
}

.public-invite-success {
  margin-top: 14px;
  color: var(--brand-2);
  font-weight: 700;
}

.login-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
  text-align: left;
}

@media (max-width: 720px) {
  .public-invite-grid,
  .participant-entry {
    grid-template-columns: 1fr;
  }
}

.login-logo {
  display: block;
  width: 150px;
  max-height: 76px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  margin: 0 auto 18px;
}

.login-card h1 {
  font-size: 22px;
}

.login-card form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.login-checkbox {
  color: var(--ink);
  font-weight: 600;
}

.login-error {
  min-height: 20px;
  margin-top: 14px;
  color: var(--danger);
  font-weight: 700;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  min-height: 40px;
  padding: 0 16px;
  font-weight: 700;
}

button:hover {
  filter: brightness(0.95);
}

button.secondary {
  background: #edf3f0;
  color: var(--ink);
  border: 1px solid var(--line);
}

button.danger {
  background: #fff0f0;
  color: var(--danger);
  border: 1px solid #f0c9c9;
}

button.small-btn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.user-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(79, 149, 81, 0.98), rgba(47, 111, 54, 0.98)),
    url("assets/seconci-logo.png");
  background-repeat: no-repeat;
  background-size: auto, 170px auto;
  background-position: center, center calc(100% - 34px);
  color: #fff;
  padding: 24px 16px;
}

.brand {
  display: grid;
  justify-items: start;
  gap: 10px;
  margin-bottom: 28px;
}

.brand-logo {
  display: block;
  width: 120px;
  max-height: 68px;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
  padding: 8px;
}

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

.brand small {
  color: #e6f3e8;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  color: #f7fff8;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.2);
}

.main {
  padding: 28px;
  overflow-x: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.user-session {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 260px;
}

.user-session strong,
.user-session span {
  display: block;
  text-align: right;
}

.user-session span {
  color: var(--muted);
  font-size: 13px;
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 18px;
}

.topbar-logo {
  display: block;
  width: 150px;
  max-height: 76px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 10px 24px rgba(32, 51, 39, 0.08);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: 28px;
}

h2 {
  font-size: 20px;
}

.topbar p,
.muted {
  color: var(--muted);
}

.toolbar,
.form-actions,
.doc-actions,
.panel-title,
.template-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.panel-title {
  justify-content: space-between;
  margin-bottom: 12px;
}

.panel-title h2 {
  margin: 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.print-storage {
  display: none;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.metric strong {
  display: block;
  font-size: 22px;
  line-height: 1.2;
}

.panel {
  padding: 20px;
  margin-bottom: 16px;
}

.dashboard-controls {
  display: grid;
  grid-template-columns: minmax(120px, 240px) minmax(280px, 520px);
  gap: 12px;
  align-items: end;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.chart-panel {
  min-height: 330px;
}

.wide-chart {
  grid-column: 1 / -1;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(12, minmax(34px, 1fr));
  align-items: end;
  gap: 10px;
  min-height: 230px;
  padding-top: 14px;
}

.bar-item {
  display: grid;
  align-items: end;
  gap: 8px;
  min-width: 0;
  height: 220px;
}

.bar-fill {
  width: 100%;
  min-height: 4px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--accent), var(--brand-2));
  display: grid;
  align-items: start;
  justify-items: center;
  padding-top: 6px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.bar-label {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.compact-table table {
  min-width: 760px;
}

.empty-state {
  display: none;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.empty-state.active {
  display: block;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

.consent-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 0;
  line-height: 1.45;
}

.consent-check input {
  width: auto;
  margin-top: 3px;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.checkbox-line input {
  width: auto;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
}

textarea {
  resize: vertical;
}

.full {
  grid-column: 1 / -1;
}

.system-field {
  display: none !important;
}

.participant-form {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.9fr 1fr 0.9fr auto auto;
  gap: 10px;
}

#cancelParticipantEdit {
  display: none;
}

.participant-context {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(260px, 1.2fr);
  gap: 8px;
  align-items: end;
}

.participant-class-summary {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  min-height: 40px;
}

.participant-share .panel-title {
  align-items: flex-start;
}

.participant-share .panel-title p {
  margin: 6px 0 0;
}

.link-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}

.link-row input {
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1040px;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td button {
  min-height: 32px;
  padding: 0 10px;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.signature-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 22px;
}

canvas {
  width: 100%;
  height: 260px;
  border: 1px dashed #91a29a;
  border-radius: 8px;
  background: #fff;
  touch-action: none;
}

.signature-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.signature-preview span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.signature-preview img {
  max-width: 100%;
  min-height: 120px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.signature-preview small,
.biometric-time,
.digital-signature-note {
  color: var(--muted);
  font-size: clamp(8px, 0.9cqw, 12px);
  line-height: 1.35;
}

.bridge-status {
  display: block;
  margin-top: 0.65rem;
  color: var(--muted);
  font-weight: 700;
}

.audit-note {
  margin-top: 1.2cqw;
  color: var(--muted);
  font-size: clamp(8px, 0.86cqw, 12px);
  line-height: 1.35;
}

.biometric-block {
  text-align: center;
}

.biometric-block img {
  display: block;
  max-width: 190px;
  height: 58px;
  object-fit: contain;
  margin: 0 auto 4px;
}

.worker-signatures {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.signature-line.certificate-worker {
  border-top: 1px solid #9aa59d;
  padding-top: 0.7cqw;
}

.signature-line.certificate-worker img {
  width: 96%;
  max-width: 96%;
  height: 8.8cqw;
  margin: -8cqw auto 0.2cqw;
}

.doc-actions {
  margin-bottom: 16px;
}

.print-worker-select {
  display: grid;
  gap: 4px;
  min-width: min(420px, 100%);
  color: var(--muted);
  font-weight: 700;
}

.print-worker-select select {
  min-height: 40px;
}

.print-area {
  display: grid;
  gap: 18px;
}

.certificate {
  background: #fff;
  overflow: hidden;
  position: relative;
}

.model-page {
  aspect-ratio: 297 / 210;
  min-height: 0;
  padding: 0;
  display: block;
  border: 1px solid #d5ddd5;
  box-shadow: var(--shadow);
  container-type: inline-size;
}

.model-page::before,
.model-page::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.model-page::before {
  background:
    linear-gradient(75deg, transparent 0 78.5%, rgba(116, 184, 67, 0.18) 78.5% 82%, rgba(79, 149, 81, 0.34) 82% 85.5%, rgba(116, 184, 67, 0.78) 85.5% 89%, #4f9551 89% 100%),
    linear-gradient(105deg, #74b843 0 3.2%, transparent 3.2% 100%);
}

.model-page::after {
  display: none;
}

.model-brand {
  position: absolute;
  left: 4.2%;
  top: 5.8%;
  width: 12.5%;
  z-index: 1;
  background: transparent;
}

.model-brand img,
.back-logo {
  display: block;
  max-width: 100%;
  mix-blend-mode: multiply;
}

.model-content {
  position: absolute;
  z-index: 1;
  text-align: center;
  left: 17%;
  top: 5.2%;
  width: 63%;
  max-width: none;
  margin: 0;
}

.front-content h2,
.back-content h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: clamp(24px, 4.4cqw, 58px);
  margin: 0;
  letter-spacing: 0;
}

.front-content .intro {
  font-style: italic;
  font-weight: 700;
  margin-bottom: 18px;
}

.certificate-statement {
  max-width: none;
  margin: 7.4cqw auto 1.5cqw;
  font-size: clamp(12px, 1.58cqw, 22px);
  line-height: 1.52;
}

.certificate-revalidation {
  margin: 0 auto 1.5cqw;
  max-width: 86%;
  color: var(--muted);
  font-size: clamp(10px, 1.04cqw, 15px);
  line-height: 1.42;
}

.front-content h3 {
  font-size: 22px;
  margin: 0 0 18px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.front-content h4 {
  color: var(--brand-2);
  font-size: 25px;
  margin: 8px 0 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.front-content p {
  font-size: clamp(11px, 1.12cqw, 16px);
  line-height: 1.45;
  margin-bottom: 0.8cqw;
}

.place-date {
  text-align: right;
  font-style: italic;
  padding-right: 4.2%;
  font-size: clamp(11px, 1.25cqw, 18px) !important;
}

.model-signatures {
  position: absolute;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10%;
  left: 8%;
  right: 8.5%;
  bottom: 7.8%;
  margin: 0;
}

.signature-line {
  text-align: center;
  min-width: 0;
  border-top: 1px solid #9aa59d;
  padding-top: 0.55cqw;
}

.signature-line strong,
.signature-line span {
  display: block;
}

.signature-line strong {
  font-size: clamp(10px, 1.08cqw, 15px);
}

.signature-line span {
  color: var(--muted);
  font-size: clamp(8px, 0.9cqw, 13px);
}

.signature-line img {
  display: block;
  width: 86%;
  max-width: 86%;
  height: 5.2cqw;
  object-fit: contain;
  margin: -5.1cqw auto 0.25cqw;
}

.digital-signature-stamp {
  width: 62%;
  min-height: 4.8cqw;
  margin: -5.4cqw auto 0.35cqw;
  display: grid;
  place-items: center;
  gap: 0.15cqw;
  color: var(--brand-2);
  line-height: 1.05;
}

.digital-signature-stamp strong {
  color: var(--brand-2);
  font-size: clamp(8px, 0.82cqw, 12px);
  letter-spacing: 0;
}

.digital-signature-stamp span {
  color: var(--brand-2);
  font-size: clamp(6px, 0.62cqw, 9px);
  overflow-wrap: anywhere;
}

.technical-note {
  color: var(--muted);
  font-size: clamp(8px, 0.92cqw, 12px);
  line-height: 1.35;
  margin-top: 1.1cqw;
}

.back-technical-signature {
  width: 48%;
  margin: 1.2cqw auto 0;
  text-align: center;
}

.back-technical-signature img {
  display: block;
  width: 68%;
  height: 4.2cqw;
  object-fit: contain;
  margin: 0 auto -0.35cqw;
  mix-blend-mode: multiply;
}

.program-list {
  columns: 2;
  column-gap: 4.5cqw;
  margin: 2.2cqw auto 1.4cqw;
  max-width: none;
  text-align: left;
  font-size: clamp(10px, 1.16cqw, 16px);
  line-height: 1.35;
}

.program-list li {
  break-inside: avoid;
  margin-bottom: 0.42cqw;
}

.back-content {
  top: 6%;
  left: 10.5%;
  width: 70%;
  max-width: none;
  text-align: left;
  padding: 0;
}

.back-content h2 {
  text-align: center;
  margin-bottom: 2cqw;
}

.back-content h3 {
  font-size: clamp(10px, 1.2cqw, 16px);
  margin: 0 0 0.8cqw;
}

.validity-text {
  font-weight: 700;
  font-size: clamp(9px, 1.04cqw, 14px);
}

.empty-program {
  color: var(--muted);
}

.back-logo {
  position: absolute;
  z-index: 1;
  bottom: 4.2%;
  left: 50%;
  width: 11.5%;
  transform: translateX(-50%);
}

.certificate-code {
  position: absolute;
  z-index: 1;
  right: 2.8%;
  bottom: 2.8%;
  color: var(--brand-2);
  font-size: clamp(8px, 0.9cqw, 12px);
  font-weight: 700;
  text-align: center;
}

.attendance-sheet {
  background: #fff;
  padding: 26px;
  border: 1px solid var(--line);
}

.attendance-header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 2px solid var(--brand);
}

.attendance-header img {
  width: 145px;
  height: auto;
}

.attendance-header h2 {
  margin: 0;
  color: var(--ink);
}

.attendance-header p {
  margin: 3px 0 0;
  color: var(--muted);
}

.attendance-sheet h2 {
  margin-bottom: 4px;
}

.attendance-info {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.attendance-info p {
  margin: 0;
}

.attendance-sheet table {
  width: 100%;
  min-width: 0;
  margin-top: 12px;
  border-collapse: collapse;
  table-layout: fixed;
  border: 1px solid var(--line);
}

.attendance-sheet th,
.attendance-sheet td {
  border: 1px solid var(--line);
  padding: 8px 7px;
  vertical-align: middle;
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.attendance-sheet th {
  background: #eaf6ef;
  color: var(--brand-2);
  font-size: 11px;
  text-transform: uppercase;
}

.attendance-number {
  width: 30px;
  text-align: center;
}

.attendance-name {
  font-weight: 700;
}

.attendance-status {
  text-align: center;
  font-weight: 700;
  color: var(--brand-2);
}

.attendance-signature {
  width: 150px;
}

.attendance-sheet .biometric-block {
  display: grid;
  place-items: center;
  gap: 3px;
  min-height: 54px;
  text-align: center;
}

.attendance-sheet .biometric-block img {
  width: 86px;
  max-width: 86px;
  height: 42px;
  object-fit: contain;
  margin: 0 auto;
}

.attendance-sheet .biometric-block .biometric-time {
  display: block;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.15;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  background: #eaf6ef;
  color: #17613b;
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .topbar,
  .signature-layout {
    display: block;
  }

  .topbar-title {
    align-items: flex-start;
  }

  .topbar-logo {
    width: 112px;
  }

  .toolbar {
    margin-top: 12px;
  }

  .metrics,
  .dashboard-controls,
  .dashboard-grid,
  .form-grid,
  .participant-form,
  .participant-context,
  .link-row,
  .worker-signatures {
    grid-template-columns: 1fr;
  }

  .bar-chart {
    overflow-x: auto;
  }

}

@media print {
  @page {
    size: A4 landscape;
    margin: 0;
  }

  @page attendancePage {
    size: A4 portrait;
    margin: 10mm;
  }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  html,
  body {
    background: #fff;
    width: 297mm;
    min-height: 210mm;
    margin: 0;
  }

  .sidebar,
  .topbar,
  .nav,
  .doc-actions,
  .panel:not(.printable) {
    display: none !important;
  }

  .app-shell,
  .main {
    display: block;
    padding: 0;
    margin: 0;
    width: 297mm;
  }

  body.print-attendance,
  body.print-attendance .app-shell,
  body.print-attendance .main {
    width: 210mm;
    min-height: 297mm;
  }

  .view {
    display: none !important;
  }

  .view.printing {
    display: block !important;
  }

  .print-area,
  .certificates {
    display: block !important;
    gap: 0;
  }

  .model-page {
    width: 297mm;
    height: 210mm;
    aspect-ratio: auto;
    background: #fff !important;
    border: 0;
    box-shadow: none;
    page-break-after: always;
    break-after: page;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .model-page::before,
  .model-page::after {
    display: block !important;
  }

  .certificate,
  .attendance-sheet {
    page-break-after: always;
    border-color: #999;
    box-shadow: none;
  }

  .attendance-sheet {
    page: attendancePage;
    width: 190mm;
    min-height: 277mm;
    padding: 0;
    border: 0;
  }

  .attendance-sheet table {
    width: 100%;
    min-width: 0;
    font-size: 10px;
  }

  .attendance-sheet th,
  .attendance-sheet td {
    padding: 7px 6px;
  }
}

