body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  padding: 0;
  background: #f5f5f5;
  padding-bottom: 3rem;
}

header {
  background: #222;
  color: #fff;
  padding: 1rem 1.5rem;
}

main {
  padding: 1rem 1.5rem;
  max-width: 960px;
  margin: 0 auto;
}

h1 {
  font-size: 1.4rem;
  margin: 0;
}

h2 {
  font-size: 1.2rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

h3 {
  font-size: 1rem;
  margin-top: 1rem;
  margin-bottom: 0.4rem;
}

.card {
  background: #fff;
  border-radius: 0.5rem;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 1rem;
}

label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

input[type="text"],
textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.4rem 0.6rem;
  border-radius: 0.25rem;
  border: 1px solid #ccc;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

button {
  border: none;
  border-radius: 0.25rem;
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
  cursor: pointer;
  margin-right: 0.5rem;
}

button.primary {
  background: #007bff;
  color: #fff;
}

button.secondary {
  background: #e0e0e0;
  color: #222;
}

button[disabled] {
  opacity: 0.6;
  cursor: default;
}

.btn-small {
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

th, td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid #e0e0e0;
  text-align: left;
}

th {
  background: #fafafa;
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-left: 1.5rem;
}

th[data-sort]::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  opacity: 0.3;
}

th[data-sort][data-asc="true"]::before {
  border-bottom: 6px solid #666;
  opacity: 1;
}

th[data-sort][data-asc="false"]::before {
  border-top: 6px solid #666;
  opacity: 1;
}

tbody tr.selected {
  font-weight: bold;
  box-shadow: inset 3px 0 0 0 #007bff;
}

tr:hover {
  background: #f9f9f9;
}

.small {
  font-size: 0.8rem;
  color: #666;
}

.search-container {
  margin-bottom: 0.75rem;
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 400px;
}

.search-container input[type="text"] {
  width: 100%;
  padding-right: 2rem;
  margin-bottom: 0;
}

.search-container .clear-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.2rem 0.4rem;
  line-height: 1;
  display: none;
}

.search-container .clear-btn:hover {
  color: #333;
}

.search-container input[type="text"]:not(:placeholder-shown) ~ .clear-btn {
  display: block;
}

#domain-detail {
  display: none;
}

#domain-detail.active {
  display: block;
}

.pill {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: #eee;
  margin-right: 0.25rem;
  margin-bottom: 0.25rem;
  font-size: 0.8rem;
}

.pill-clickable {
  cursor: pointer;
  transition: background-color 0.2s;
}

.pill-clickable:hover {
  background: #d0d0d0;
}

.pill-active {
  background: #007bff;
  color: #fff;
  font-weight: bold;
}

.keywords-cell {
  max-width: 200px;
}

.dns-section {
  margin-bottom: 0.5rem;
}

.dns-list {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.85rem;
}

.dns-list li {
  margin-bottom: 0.1rem;
}

.back-to-top {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  background: #e0e0e0;
  color: #222;
  text-decoration: none;
  border-radius: 0.25rem;
  font-size: 0.9rem;
  white-space: nowrap;
}

.back-to-top:hover {
  background: #d0d0d0;
}

/* Expiry-based row colouring */
tbody tr.expiry-expired {
  background-color: #ffe5e5; /* light red */
}

tbody tr.expiry-soon {
  background-color: #fff4d6; /* light amber */
}

tbody tr.expiry-ok {
  background-color: #e6f6e6; /* light green */
}

/* Slightly darker on hover, but keep the same hue */
tbody tr.expiry-expired:hover {
  background-color: #ffd6d6;
}

tbody tr.expiry-soon:hover {
  background-color: #ffe8b5;
}

tbody tr.expiry-ok:hover {
  background-color: #d4f0d4;
}


footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #222;
  color: #fff;
  padding: 0.75rem 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  z-index: 1000;
}

footer a {
  color: #fff;
  text-decoration: underline;
}

footer a:hover {
  color: #ddd;
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.6);
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: #fff;
  margin: auto;
  padding: 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  width: 90%;
  max-width: 600px;
}

.modal-buttons {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.code-block {
  background: #f5f5f5;
  padding: 0.75rem;
  border-radius: 0.25rem;
  overflow-x: auto;
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  line-height: 1.4;
  margin: 0.5rem 0;
}

@media (max-width: 600px) {
  /* hide Keywords and Notes columns on narrow screens */
  th:nth-child(5),
  td:nth-child(5),
  th:nth-child(6),
  td:nth-child(6) {
    display: none;
  }
}
