* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0f172a;
  color: #e2e8f0;
}

.muted {
  color: #94a3b8;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.card {
  background: linear-gradient(160deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.85));
  border-radius: 16px;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 20px 35px rgba(7, 12, 24, 0.45);
}

.hero-card {
  background: linear-gradient(155deg, rgba(56, 189, 248, 0.18), rgba(15, 23, 42, 0.9));
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.card-header h2 {
  margin-bottom: 0.25rem;
}

.card-header p {
  margin: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  background: rgba(148, 163, 184, 0.15);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

h1, h2 {
  margin: 0 0 0.75rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  align-items: stretch;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  background: #38bdf8;
  color: #0f172a;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.button:hover {
  background: #0ea5e9;
  transform: translateY(-1px);
}

.button.secondary {
  background: transparent;
  color: #38bdf8;
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.summary-item {
  background: rgba(148, 163, 184, 0.08);
  padding: 1rem;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.summary-item span {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
}

.summary-item strong {
  font-size: 1.25rem;
}

.summary-item.highlight {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.insight-tile {
  background: rgba(148, 163, 184, 0.08);
  padding: 1rem;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.insight-tile span {
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #94a3b8;
}

.insight-tile strong {
  font-size: 1.6rem;
}

.insight-tile small {
  color: #94a3b8;
}

.insight-sublayout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.insight-sublayout h3 {
  margin: 0 0 0.75rem;
}

.stat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stat-list li {
  background: rgba(148, 163, 184, 0.06);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(148, 163, 184, 0.12);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.stat-list li span {
  font-size: 0.85rem;
}

.stat-list li strong {
  font-size: 1rem;
}

.stat-list li.soon {
  border-color: rgba(250, 204, 21, 0.4);
  background: rgba(250, 204, 21, 0.12);
}

.stat-list li.overdue {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.16);
}

.stat-list li.empty {
  justify-content: center;
  color: #94a3b8;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.form-grid {
  gap: 1.1rem;
}

.grid.small {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.9rem;
}

input, select, textarea {
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.4);
  color: inherit;
}

.range-field input[type="range"] {
  width: 100%;
  margin-top: 0.35rem;
}

.range-value {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 0.35rem;
}

.range-value strong {
  color: #e2e8f0;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(14, 165, 233, 0.5);
  outline-offset: 2px;
}

textarea {
  resize: vertical;
}

.alert {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fca5a5;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.9rem;
}

#import-preview .table-wrapper {
  max-height: 320px;
  overflow: auto;
}

#import-preview-note {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: #94a3b8;
}

.hidden {
  display: none !important;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: flex-end;
}

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.pill-button {
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: transparent;
  color: inherit;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.pill-button:hover {
  border-color: rgba(56, 189, 248, 0.6);
  transform: translateY(-1px);
}

.pill-button.is-active {
  background: #38bdf8;
  color: #0f172a;
  border-color: #38bdf8;
  box-shadow: 0 10px 20px rgba(56, 189, 248, 0.25);
}

.filter-meta {
  font-size: 0.8rem;
  color: #94a3b8;
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
}

#clear-filters {
  border: none;
  background: none;
  color: #38bdf8;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}

#clear-filters:hover {
  color: #0ea5e9;
}

.table-wrapper {
  overflow-x: auto;
}

.table-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.table-toolbar span {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-right: auto;
}

#server-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

#server-table th, #server-table td {
  padding: 0.6rem;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

#server-table tbody tr:hover {
  background: rgba(56, 189, 248, 0.08);
}

.action-buttons {
  display: flex;
  gap: 0.5rem;
}

.action-buttons button {
  font-size: 0.75rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.action-buttons .edit {
  background: rgba(16, 185, 129, 0.85);
  color: #0f172a;
}

.action-buttons .delete {
  background: rgba(244, 63, 94, 0.9);
  color: #fff;
}

.action-buttons button:hover {
  opacity: 0.85;
}

.not-found-container {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.not-found-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.not-found-label {
  font-size: 3.5rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: rgba(148, 163, 184, 0.45);
}

.not-found-card p {
  margin-bottom: 1.5rem;
}

.not-found-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

@media (max-width: 720px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
