@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg: #0b1224;
  --card: rgba(255, 255, 255, 0.9);
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --text: #0f172a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #dc2626;
  --success: #059669;
  --shadow: 0 25px 80px rgba(15, 23, 42, 0.18);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', 'Segoe UI', Tahoma, sans-serif;
  background:
    radial-gradient(circle at 20% 20%, rgba(37, 99, 235, 0.18), transparent 40%),
    radial-gradient(circle at 80% 0%, rgba(5, 150, 105, 0.14), transparent 38%),
    linear-gradient(135deg, #0f172a 0%, #111827 45%, #0b1224 100%);
  color: var(--text);
  min-height: 100vh;
}

body.view-page {
  background: #f4f4f4;
  color: #0f172a;
  font-family: Calibri, 'Segoe UI', Arial, sans-serif;
}

.document-container {
  max-width: 960px;
  padding: 32px 16px 64px;
}

.document-sheet {
  background: #ffffff;
  border: 1px solid #d1d5db;
  padding: 26px 28px;
  box-shadow: none;
  border-radius: 0;
}

.doc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid #d1d5db;
  padding-bottom: 12px;
}

.company-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.doc-title {
  font-size: 16px;
  font-weight: 700;
  margin-top: 4px;
  letter-spacing: 0.8px;
}

.doc-meta {
  display: grid;
  gap: 6px;
  min-width: 220px;
}

.meta-line {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  gap: 12px;
}

.meta-label {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.meta-value {
  font-weight: 600;
}

.doc-section {
  padding: 12px 0 4px;
  border-top: 1px solid #d1d5db;
}

.doc-section:first-of-type {
  border-top: none;
}

.doc-section h3 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 8px 24px;
}

.doc-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 12px;
  align-items: flex-start;
}

.doc-label {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  position: relative;
  padding-right: 8px;
}

.doc-label::after {
  content: ':';
  position: absolute;
  right: 0;
}

.doc-value {
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 4px;
}

.doc-table th,
.doc-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #d1d5db;
  font-size: 13px;
}

.doc-table th {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}



.doc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  margin-top: 18px;
  padding-top: 10px;
  border-top: 1px solid #d1d5db;
}

.page-number::after {
  content: 'Page ' counter(page) ' of ' counter(pages);
}

.attachment-block {
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid #d1d5db;
}

.attachment-heading {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.3px;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.attachment-frame {
  width: 100%;
  height: 260mm;
  border: 1px solid #cfd3dc;
  border-radius: 0;
}

.attachment-image {
  width: 100%;
  max-height: 260mm;
  object-fit: contain;
  border: 1px solid #cfd3dc;
  border-radius: 0;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 16px 64px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand img {
  height: 44px;
  width: auto;
  object-fit: contain;
}

.brand-title {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.header .brand-title h1,
.header .brand-title .helper {
  color: #e5e7eb;
}

h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.5px;
}

.card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  color: var(--text);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px 18px;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid #dfe3ec;
  border-radius: 12px;
  font-size: 14px;
  background: #f9fafb;
  transition: border 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.15);
  background: #ffffff;
  transform: translateY(-1px);
}

button {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border: none;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

button:hover {
  filter: brightness(1.05);
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.45);
}

button:active {
  transform: translateY(1px);
}

.helper {
  color: var(--muted);
  font-size: 12px;
}

.error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 4px;
}

.error:empty {
  display: none;
}

.input-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.alert {
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
}

.alert-success {
  background: #ecfdf3;
  border-color: #bbf7d0;
  color: #166534;
}

.alert-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.table th,
.table td {
  padding: 12px 10px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}

.cell-nowrap {
  white-space: nowrap;
}

.subtext {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.table th {
  color: #1f2937;
  background: #f3f4f6;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.table tbody tr:hover {
  background: #f8fafc;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.14);
  color: #e0e7ff;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.actions {
  display: flex;
  gap: 8px;
}

.actions-stack {
  flex-direction: column;
  align-items: flex-start;
}

.actions-stack form {
  width: 100%;
}

.button-ghost {
  display: inline-block;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f8fafc;
  color: #0f172a;
  font-weight: 600;
  text-align: center;
  box-shadow: none;
}

.button-ghost:hover {
  background: #e5e7eb;
  text-decoration: none;
}

.actions a,
.actions form button {
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 8px;
}

.doc-menu {
  position: relative;
  display: inline-block;
}

.doc-menu-toggle {
  display: inline-block;
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #f8fafc;
  font-weight: 600;
  cursor: pointer;
  color: #0f172a;
  user-select: none;
}

.doc-menu-toggle:hover {
  background: #e5e7eb;
}

.doc-menu-list {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 180px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
  padding: 8px 0;
  z-index: 5;
}

.doc-menu-list a {
  display: block;
  padding: 8px 12px;
  color: #0f172a;
}

.doc-menu-list a:hover {
  background: #f3f4f6;
}

.doc-menu:hover .doc-menu-list,
.doc-menu:focus-within .doc-menu-list {
  display: block;
}

.search-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.input-inline {
  width: 280px;
}

.section-title {
  margin: 8px 0 14px;
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: 0.2px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: #0f172a;
  color: #e5e7eb;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin: 12px 0 8px;
}

.detail-grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.detail-grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.detail-item {
  background: #ffffff;
  border: 1px solid #e8edf7;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.detail-label {
  font-size: 12px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.detail-value {
  font-weight: 600;
  color: #0f172a;
  word-break: break-word;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 0 10px;
}

.section-heading h3 {
  margin: 0;
  font-size: 18px;
}

.meta-text {
  color: #6b7280;
  font-size: 13px;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.doc-frame {
  width: 100%;
  height: 420px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
}

.doc-image {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
}

.pill {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #312e81;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #c7d2fe;
}

.pill-soft {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #e2e8f0;
}

.print-sheet {
  background: #ffffff;
  border-radius: var(--radius);
  border: 1px solid #e5e7eb;
  padding: 18px;
  box-shadow: var(--shadow);
}

.page-break {
  page-break-after: always;
}

.no-print {
  display: block;
}

@media print {
  body {
    background: #ffffff;
    font-family: Calibri, 'Segoe UI', Arial, sans-serif;
  }
  .container {
    max-width: none;
    padding: 0;
  }
  .no-print {
    display: none !important;
  }
  .document-container {
    padding: 0;
  }
  .document-sheet {
    border: none;
    padding: 0;
    box-shadow: none;
  }
  .doc-grid {
    grid-template-columns: repeat(2, minmax(200px, 1fr));
  }
  .doc-row {
    grid-template-columns: 180px 1fr;
  }
  .attachment-frame {
    height: 240mm;
  }
  .attachment-image {
    max-height: 240mm;
  }
  @page {
    size: A4;
    margin: 16mm 14mm 20mm 14mm;
  }
}

.stat-label {
  font-size: 12px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: #9ca3af;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  color: #f8fafc;
}

@media (max-width: 640px) {
  .input-inline {
    width: 100%;
  }
}
