* {
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(180deg, #eef1f7 0%, #f4f6f9 240px);
  margin: 0;
  padding: 48px 16px;
  color: #1f2937;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.page-header h1 {
  margin: 0 0 4px;
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-header .logo {
  font-size: 1.5rem;
}

.page-header p {
  margin: 0;
  color: #6b7280;
}

.card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  padding: 24px;
  transition: box-shadow 0.15s ease;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.06);
}

.card h2 {
  margin: 0 0 16px;
  font-size: 1.1rem;
}

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

.card-header h2 {
  margin: 0;
}

.count-badge {
  background: #eef2ff;
  color: #4338ca;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
}

form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-row {
  display: flex;
  gap: 14px;
}

.field-row .field {
  flex: 1;
}

label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #374151;
}

.hint {
  font-size: 0.8rem;
  font-weight: 400;
  color: #6b7280;
}

input {
  padding: 9px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.9rem;
}

input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

input[type="file"] {
  padding: 6px;
  color: #6b7280;
}

input[type="file"]::file-selector-button {
  padding: 7px 14px;
  margin-right: 10px;
  border: none;
  border-radius: 5px;
  background: #eef2ff;
  color: #4338ca;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

input[type="file"]::file-selector-button:hover {
  background: #e0e7ff;
}

button {
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  background: #2563eb;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

button:hover {
  background: #1d4ed8;
}

.btn-download {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 6px;
  background: #16a34a;
  color: white;
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 12px;
  transition: background 0.15s ease;
}

.btn-download[hidden] {
  display: none;
}

.btn-download:hover {
  background: #15803d;
}

.documents-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.documents-table th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #6b7280;
  border-bottom: 1px solid #e5e7eb;
  padding: 8px 10px;
}

.documents-table td {
  padding: 10px;
  border-bottom: 1px solid #f1f2f4;
  vertical-align: middle;
}

.documents-table tbody tr:hover {
  background: #f9fafb;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-active {
  background: #dcfce7;
  color: #166534;
}

.badge-upcoming {
  background: #dbeafe;
  color: #1e40af;
}

.badge-expired {
  background: #fee2e2;
  color: #991b1b;
}

.actions {
  display: flex;
  gap: 6px;
  white-space: nowrap;
}

.actions button {
  padding: 5px 10px;
  font-size: 0.8rem;
}

.btn-delete {
  background: #dc2626;
}

.btn-delete:hover {
  background: #b91c1c;
}

.empty-state {
  color: #6b7280;
  font-size: 0.9rem;
  text-align: center;
  padding: 16px 0 0;
}

.status {
  color: #6b7280;
  font-size: 0.85rem;
  margin: 8px 0 0;
}

dialog.modal {
  border: none;
  border-radius: 10px;
  padding: 0;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}
dialog.modal::backdrop {
  background: rgba(15, 23, 42, 0.5);
}

.modal-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-title {
  margin: 0;
  font-size: 1.05rem;
  color: #991b1b;
}

.modal-content p {
  margin: 0;
  color: #374151;
  font-size: 0.9rem;
  line-height: 1.4;
}

.modal-content button {
  align-self: flex-end;
  background: #991b1b;
}

.modal-content button:hover {
  background: #7f1d1d;
}

.page-nav {
  margin-top: 10px;
}

.page-nav a {
  color: #2563eb;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.page-nav a:hover {
  text-decoration: underline;
}

.analysis-result {
  background: #0f172a;
  color: #e2e8f0;
  padding: 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}
