* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f5f7fb;
  color: #1a1a1a;
}

.container {
  max-width: 720px;
  margin: 24px auto;
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.topbar {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.topbar a {
  color: #2f6fed;
  text-decoration: none;
}

.topbar a:hover {
  text-decoration: underline;
}

h1 {
  margin-top: 0;
}

form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

label {
  font-weight: 600;
}

input,
select,
button {
  font-size: 16px;
  padding: 10px;
}

button {
  background: #2f6fed;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 10px;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.contract-options {
  margin: 0.75rem 0 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border, #ccc);
  border-radius: 6px;
}

.contract-options__modes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.5rem;
}

.contract-options__radio,
.contract-options__check {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  cursor: pointer;
}

.contract-options__radio input,
.contract-options__check input {
  margin-top: 0.2rem;
}

.hidden {
  display: none;
}

.result,
.error {
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
}

.result {
  background: #eaf7ed;
  border: 1px solid #3ca55c;
}

.error {
  background: #fdebec;
  border: 1px solid #d9534f;
}

.verify-panel {
  margin-bottom: 24px;
  padding: 16px;
  background: #f0f4ff;
  border: 1px solid #c8d9ff;
  border-radius: 10px;
}

.verify-panel__title {
  margin: 0 0 8px;
  font-size: 1.25rem;
}

.verify-panel__links {
  margin: 0 0 12px;
  font-size: 15px;
}

.verify-panel__sep {
  margin: 0 6px;
  color: #888;
}

.muted {
  font-size: 13px;
  color: #666;
  line-height: 1.45;
  margin-top: 8px;
}

.admin-auth {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
  max-width: 420px;
}

.admin-auth code {
  font-size: 12px;
  background: #eee;
  padding: 2px 6px;
  border-radius: 4px;
}

.verify-panel__subtitle {
  margin: 16px 0 10px;
  font-size: 1rem;
  font-weight: 600;
  color: #333;
}

.contract-history {
  min-height: 1.5em;
}

.history-empty {
  margin: 0;
  color: #555;
  font-size: 14px;
  line-height: 1.45;
}

.history-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}

.history-table th,
.history-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #e8e8e8;
  text-align: left;
  vertical-align: top;
}

.history-table th {
  background: #e8eefc;
  font-weight: 600;
  white-space: nowrap;
}

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

.history-actions {
  white-space: nowrap;
}

.history-muted {
  font-size: 12px;
  color: #666;
  line-height: 1.35;
}

.btn-secondary {
  background: #5a6fd8;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
  margin-top: 0;
}

.btn-secondary:hover {
  background: #4a5fc8;
}

a.btn-secondary.btn-file-link {
  text-decoration: none;
  display: inline-block;
  color: #fff;
}

.history-table button.btn-secondary,
.history-table a.btn-secondary {
  margin-top: 0;
  vertical-align: middle;
}

.history-footer {
  margin: 10px 0 0;
  font-size: 14px;
}

.link-button {
  background: none;
  border: none;
  color: #2f6fed;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  font-size: 14px;
}

.link-button:hover {
  color: #1a4fc4;
}

@media (max-width: 640px) {
  .history-table thead {
    display: none;
  }

  .history-table tbody tr {
    display: block;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid #dde4f5;
  }

  .history-table tbody td {
    display: block;
    padding: 4px 0;
    border: none;
  }

  .history-table tbody td::before {
    content: attr(data-label) ": ";
    font-weight: 600;
    color: #444;
  }

  .history-actions {
    margin-top: 6px;
  }
}
