@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --bg: #0f1116;
  --card: rgba(20, 22, 30, 0.92);
  --glass: rgba(255, 255, 255, 0.06);
  --text: #f2f5ff;
  --muted: #a5adbf;
  --accent: #5eead4;
  --accent-2: #38bdf8;
  --danger: #f97316;
  --border: rgba(255, 255, 255, 0.1);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

body.modal-open {
  overflow: hidden;
}

.bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 10% 20%, rgba(94, 234, 212, 0.2), transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(56, 189, 248, 0.2), transparent 35%),
    radial-gradient(circle at 50% 90%, rgba(249, 115, 22, 0.18), transparent 45%),
    #0f1116;
  z-index: -1;
}

.shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 28px;
  backdrop-filter: blur(12px);
}

.login {
  max-width: 420px;
  margin: 12vh auto 0;
}

.brand {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 22px;
}

.logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  color: #0b1320;
  font-weight: 700;
  font-size: 20px;
}

.eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
}

h1, h2, h3 {
  margin: 0;
}

label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

input, select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(15, 17, 22, 0.7);
  color: var(--text);
  font-size: 14px;
}

input:focus, select:focus {
  outline: 2px solid rgba(94, 234, 212, 0.4);
  border-color: transparent;
}

button {
  border: none;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

button:hover {
  transform: translateY(-1px);
}

.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b1320;
}

.ghost {
  background: var(--glass);
  color: var(--text);
  border: 1px solid var(--border);
}

.danger {
  background: linear-gradient(135deg, #fb7185, #f97316);
  color: #2a0a0a;
}

.error {
  color: #fecaca;
  min-height: 18px;
}

.muted {
  color: var(--muted);
}

.hidden {
  display: none;
}

[hidden] {
  display: none !important;
}

.app {
  display: grid;
  gap: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--border);
  font-size: 13px;
}

.controls {
  display: grid;
  gap: 16px;
}

.control-row {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  align-items: end;
}

.file {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--glass);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text);
}

.file input {
  display: none;
}

.table {
  padding: 0;
  overflow: hidden;
}

.infrastructure-panel {
  display: grid;
  gap: 16px;
}

.table-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 26px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.badge {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--border);
  font-size: 12px;
}

.table-scroll {
  max-height: 540px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.row-actions {
  display: flex;
  gap: 8px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 10, 0.6);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-card {
  width: min(720px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--card);
  border-radius: 18px;
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.modal-card.details {
  width: min(820px, 100%);
}

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

.details-actions {
  display: flex;
  gap: 10px;
}

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

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 12px;
}

.details-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 18px;
}

.details-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.detail-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

.detail-value {
  font-size: 15px;
}

.monospace {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--glass);
  font-size: 12px;
}

.infra-totals {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.resource-list {
  display: grid;
  gap: 12px;
}

.resource-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.resource-item.assigned {
  border-color: rgba(94, 234, 212, 0.35);
  background: rgba(94, 234, 212, 0.06);
}

.resource-item.is-warning {
  border-color: rgba(249, 115, 22, 0.45);
  background: rgba(249, 115, 22, 0.08);
}

.resource-item.is-expired {
  border-color: rgba(251, 113, 133, 0.55);
  background: rgba(251, 113, 133, 0.1);
}

.resource-item.is-unpaid {
  border-color: rgba(148, 163, 184, 0.4);
}

.resource-item input[type='checkbox'] {
  width: 18px;
  height: 18px;
  margin-top: 4px;
}

.resource-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 6px;
}

.resource-name {
  font-weight: 600;
}

.resource-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.resource-assignment {
  color: var(--text);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.resource-assignment.assigned {
  color: #052a26;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
}

.resource-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.quick-extend {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
}

.quick-extend-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.funding-badge.is-warning,
.funding-inline.is-warning {
  background: rgba(249, 115, 22, 0.14);
  border-color: rgba(249, 115, 22, 0.35);
  color: #fdba74;
}

.funding-badge.is-expired,
.funding-inline.is-expired {
  background: rgba(251, 113, 133, 0.14);
  border-color: rgba(251, 113, 133, 0.35);
  color: #fda4af;
}

.funding-badge.is-unpaid,
.funding-inline.is-unpaid {
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.35);
  color: #cbd5e1;
}

.funding-badge.is-active,
.funding-inline.is-active {
  background: rgba(94, 234, 212, 0.12);
  border-color: rgba(94, 234, 212, 0.35);
  color: #99f6e4;
}

.funding-inline {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 12px;
  white-space: nowrap;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
}

.history-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}

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

  .section-head {
    flex-direction: column;
  }

  .details-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
