:root {
  color-scheme: dark;
  font-family: "Inter", "Segoe UI", sans-serif;
  background: #020617;
  color: #e7edf8;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at top, rgba(59,130,246,0.16), transparent 28%),
              linear-gradient(180deg, #020617 0%, #01040f 100%);
}

button, input, textarea {
  font: inherit;
}

body {
  padding: 24px;
}

.page-shell {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hero-card {
  background: rgba(15,23,42,0.92);
  border: 1px solid rgba(59,130,246,0.16);
  box-shadow: 0 24px 60px rgba(3,9,26,0.35);
  border-radius: 30px;
  padding: 32px;
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #3b82f6, #60a5fa);
  color: #020617;
  font-weight: 800;
  font-size: 1.75rem;
  border-radius: 18px;
  box-shadow: 0 0 30px rgba(59,130,246,0.35);
}

.brand-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 18px;
  background: rgba(255,255,255,0.05);
  padding: 10px;
}

.brand-name {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: 0.16em;
}

.brand-subtitle {
  margin: 6px 0 0;
  color: #94a3b8;
}

.hero-copy {
  margin: 24px 0 0;
  max-width: 780px;
  line-height: 1.8;
  color: #cbd5e1;
}

.dashboard-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(320px, 1.25fr) minmax(320px, 1fr);
}

.panel {
  background: rgba(15,23,42,0.96);
  border-radius: 28px;
  border: 1px solid rgba(255,255,255,0.04);
  padding: 28px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}

.section-header, .agreements-header, .result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 22px;
}

.section-label {
  margin: 0 0 6px;
  color: #60a5fa;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
}

h2, h3 {
  margin: 0;
  font-weight: 700;
}

h2 {
  font-size: 1.7rem;
}

h3 {
  font-size: 1.2rem;
  color: #e2e8f0;
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.field-row.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

label {
  font-size: 0.95rem;
  color: #cbd5e1;
}

input, textarea {
  width: 100%;
  background: #0f172a;
  border: 1px solid rgba(148,163,184,0.16);
  color: #e2e8f0;
  border-radius: 16px;
  padding: 14px 16px;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

input:focus, textarea:focus {
  outline: none;
  border-color: rgba(59,130,246,0.9);
  box-shadow: 0 0 0 4px rgba(59,130,246,0.12);
}

input::placeholder, textarea::placeholder {
  color: #7c93b7;
}

button {
  border: none;
  border-radius: 16px;
  cursor: pointer;
  padding: 14px 20px;
  font-weight: 700;
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

button:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  box-shadow: 0 18px 35px rgba(59,130,246,0.28);
}

.secondary-button {
  background: rgba(59,130,246,0.12);
  color: #e2e8f0;
  border: 1px solid rgba(59,130,246,0.35);
}

.outline-button {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(59,130,246,0.45);
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.agreement-list {
  display: grid;
  gap: 18px;
}

.agreement-card {
  background: rgba(30,41,59,0.9);
  border: 1px solid rgba(59,130,246,0.16);
  border-radius: 20px;
  padding: 20px;
  position: relative;
}

.agreement-card .remove-agreement {
  position: absolute;
  top: 18px;
  right: 18px;
  background: rgba(255,255,255,0.08);
  color: #e2e8f0;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
}

.agreement-card .remove-agreement:hover {
  background: rgba(248,113,113,0.2);
}

.agreement-card label {
  font-size: 0.9rem;
}

.agreement-card input,
.agreement-card select,
.agreement-card textarea {
  border-radius: 14px;
}

.agreement-card select.status-select {
  width: 100%;
  background: rgba(15,23,42,0.96);
  border: 1px solid rgba(148,163,184,0.16);
  color: #e2e8f0;
  padding: 12px 14px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-open {
  background: rgba(59,130,246,0.18);
  color: #eff6ff;
  border: 1px solid rgba(59,130,246,0.3);
}

.status-progress {
  background: rgba(245,158,11,0.16);
  color: #92400e;
  border: 1px solid rgba(245,158,11,0.28);
}

.status-completed {
  background: rgba(16,185,129,0.18);
  color: #064e3b;
  border: 1px solid rgba(16,185,129,0.3);
}

.status-cancelled {
  background: rgba(148,163,184,0.18);
  color: #0f172a;
  border: 1px solid rgba(148,163,184,0.3);
}

.status-overdue {
  background: rgba(248,113,113,0.18);
  color: #7f1d1d;
  border: 1px solid rgba(248,113,113,0.3);
}

.result-panel {
  min-height: 520px;
  display: flex;
  flex-direction: column;
}

.minuta-card {
  opacity: 0;
  transform: translateY(24px);
  animation: fadeInUp 0.8s ease forwards;
}

.minuta-card.visible {
  opacity: 1;
  transform: none;
}

.minuta-header {
  background: linear-gradient(135deg, rgba(59,130,246,0.2), rgba(15,23,42,0.95));
  padding: 26px;
  border-radius: 24px;
  border: 1px solid rgba(59,130,246,0.24);
}

.minuta-header .brand-inline {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.minuta-title {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0.12em;
}

.minuta-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.meta-item {
  background: rgba(255,255,255,0.03);
  border-radius: 16px;
  padding: 18px;
}

.meta-item strong {
  display: block;
  margin-bottom: 8px;
  color: #cbd5e1;
}

.section-block {
  margin-top: 24px;
}

.section-block h3 {
  margin-bottom: 12px;
}

.section-block p, .section-block ul {
  line-height: 1.75;
  color: #cbd5e1;
}

.section-block ul {
  padding-left: 18px;
  margin: 0;
}

.agreements-table {
  width: 100%;
  border-collapse: collapse;
}

.agreements-table th,
.agreements-table td {
  border: 1px solid rgba(148,163,184,0.14);
  padding: 14px 16px;
  text-align: left;
}

.agreements-table th {
  background: rgba(59,130,246,0.08);
  color: #e2e8f0;
}

.agreements-table td {
  color: #d1d5db;
}

.footer-note {
  margin-top: 28px;
  padding: 18px 20px;
  background: rgba(15,23,42,0.8);
  border-radius: 18px;
  color: #94a3b8;
  text-align: center;
  font-size: 0.95rem;
}

.hidden {
  display: none;
}

.input-error {
  border-color: #fb7185;
  box-shadow: 0 0 0 3px rgba(248,113,113,0.18);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  body {
    padding: 16px;
  }
  .hero-card,
  .panel {
    padding: 20px;
  }
  .field-row.split {
    display: flex;
    flex-direction: column;
  }
  .minuta-meta {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: #fff;
    color: #111827;
    margin: 0 !important;
    padding: 0 !important;
  }
  body * {
    visibility: hidden !important;
  }
  .hero-card,
  .form-panel,
  .result-header,
  .page-shell > *:not(.dashboard-grid),
  .dashboard-grid > :not(.result-panel) {
    display: none !important;
  }
  #minutaOutput,
  #minutaOutput * {
    visibility: visible !important;
  }
  #minutaOutput {
    display: block !important;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
  }
  .result-panel {
    display: block !important;
    page-break-before: auto !important;
  }
  .minuta-card {
    transform: none !important;
    opacity: 1 !important;
    box-shadow: none !important;
  }
  .minuta-card,
  .minuta-header,
  .section-block,
  .footer-note {
    background: transparent !important;
    border: none !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  .section-block {
    page-break-before: auto !important;
    page-break-after: auto !important;
    margin-bottom: 24px;
  }
  .agreements-table {
    width: 100%;
    page-break-inside: auto !important;
    break-inside: auto !important;
    border-collapse: collapse;
  }
  thead {
    display: table-header-group;
  }
  tfoot {
    display: table-footer-group;
  }
  tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  .agreements-table th,
  .agreements-table td {
    color: #111827;
    border-color: #9ca3af;
    padding: 14px 16px;
  }
}
