:root {
  --bg: #f6f3ef;
  --ink: #1e1c1a;
  --muted: #7a726c;
  --brand: #ad4a2a;
  --brand-dark: #7c341d;
  --card: #fffaf5;
  --line: #e4dbd2;
  --shadow: 0 12px 30px rgba(27, 20, 14, 0.12);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, #fff 0%, transparent 40%),
    radial-gradient(circle at 90% 20%, #ffe9da 0%, transparent 35%),
    var(--bg);
}

.app {
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 40px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.brand__logo {
  font-weight: 800;
  font-size: 28px;
  letter-spacing: 1px;
}

.brand__sub {
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 10px;
}

.tab {
  background: transparent;
  border: 1px solid transparent;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
}

.tab.is-active {
  border-color: var(--brand);
  color: var(--brand-dark);
  background: #fff5ec;
}

.content {
  padding: 32px 40px 60px;
}

.panel {
  display: none;
}

.panel.is-active {
  display: block;
}

.panel__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.panel__actions {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}

h1 {
  margin: 0 0 6px;
  font-size: 32px;
}

.muted {
  color: var(--muted);
  margin: 0;
}

.filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter input {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.btn {
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-weight: 600;
  line-height: 1.1;
}

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn-danger {
  background: #2e0f0f;
  border-color: #2e0f0f;
  color: #fff;
}

.btn-danger:hover {
  background: #3a1414;
  border-color: #3a1414;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card__title {
  font-weight: 700;
  font-size: 18px;
  margin: 0;
}

.card__meta {
  font-size: 14px;
  color: var(--muted);
  display: grid;
  gap: 6px;
}

.card__actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.card__actions .btn {
  width: 100%;
}

.empty {
  padding: 40px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px dashed var(--line);
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal.is-open {
  display: flex;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 12, 10, 0.4);
}

.modal__dialog {
  position: relative;
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  width: min(800px, 90vw);
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow);
  animation: pop 0.2s ease-out;
}

.modal__dialog--wide {
  width: min(1200px, 96vw);
}

@keyframes pop {
  from {
    transform: translateY(10px) scale(0.98);
    opacity: 0.6;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.modal__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal__head h3 {
  margin: 0;
}

.icon-btn {
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.form .grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
}

label input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.form__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.details {
  display: grid;
  gap: 8px;
  font-size: 15px;
}

.details strong {
  color: var(--brand-dark);
}

.link {
  color: var(--brand-dark);
  font-weight: 600;
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
}

.file-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.file-download {
  display: inline-block;
  margin-top: 6px;
  font-size: 13px;
  color: var(--brand-dark);
}

.certificate-list {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.certificate-list__title {
  font-weight: 700;
  margin-bottom: 8px;
}

.certificate-list__row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 0.7fr 0.7fr 1.2fr 0.8fr 0.9fr 0.9fr 0.6fr 0.6fr 0.8fr 0.7fr;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
}

.certificate-list__row:last-child {
  border-bottom: none;
}

.certificate-list__row .link {
  font-size: 13px;
}

.certificate-list__empty {
  color: var(--muted);
  font-size: 13px;
}

.certificate-list__actions {
  display: flex;
  gap: 6px;
}

.certificate-list__actions .btn {
  padding: 4px 8px;
  font-size: 12px;
}

.certificates {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.certificates__table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1200px;
}

.certificates__table th,
.certificates__table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
}

.certificates__table th {
  background: #f8f2ec;
  color: var(--brand-dark);
  position: sticky;
  top: 0;
  z-index: 1;
}

.certificates__table tr:last-child td {
  border-bottom: none;
}

.certificates__table .btn {
  padding: 6px 10px;
  font-size: 13px;
}

.calendar-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.calendar-status {
  margin-top: 8px;
  font-size: 14px;
}

.checkbox-field {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
}

.conference__head,
.conference__row {
  display: grid;
  grid-template-columns: 1.4fr 0.7fr 0.8fr 0.8fr 1fr 0.5fr;
  gap: 10px;
  align-items: center;
}

.conference__head {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.conference__row {
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 14px;
}

.conference__row:last-child {
  border-bottom: none;
}

.conference__row input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.conference__row input[type="date"],
.conference__row input[type="number"],
.conference__row input[type="file"] {
  width: 100%;
}

.conference__row .file-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.conference__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.conference__total {
  font-weight: 700;
  color: var(--brand-dark);
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .panel__head {
    flex-direction: column;
    align-items: flex-start;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .card__actions {
    grid-template-columns: 1fr 1fr;
  }

  .card__actions .btn {
    width: 100%;
  }

  .conference__head {
    display: none;
  }

  .conference__row {
    grid-template-columns: 1fr;
  }

  .conference__row > div {
    display: grid;
    gap: 6px;
  }

  .conference__row > div::before {
    content: attr(data-label);
    font-size: 12px;
    color: var(--muted);
  }
}

@media (max-width: 480px) {
  .card__actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .content {
    padding: 24px 20px 48px;
  }

  .modal__dialog {
    width: min(860px, 96vw);
  }

  .form .grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .certificate-list__row {
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
  }

  .certificate-list__row > div {
    display: grid;
    gap: 4px;
  }

  .certificate-list__row > div::before {
    content: attr(data-label);
    font-size: 11px;
    color: var(--muted);
  }
}
