:root {
  --bg: #071521;
  --bg-alt: #0a1d2b;
  --panel: rgba(255,255,255,0.06);
  --panel-strong: rgba(255,255,255,0.1);
  --border: rgba(255,255,255,0.12);
  --text: rgba(255, 255, 255, 0.94);
  --muted: rgba(255,255,255,0.65);
  --accent: #2fb7ff;
  --accent-2: #2dd4bf;
  --danger: #ff6b6b;
  --warning: #ffbf47;
  --radius: 18px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(47,183,255,0.18), transparent 22%),
    radial-gradient(circle at top right, rgba(45,212,191,0.12), transparent 20%),
    linear-gradient(180deg, var(--bg) 0%, #08111a 100%);
  color: var(--text);
}

button, input, select, textarea, a {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  max-width: 1500px;
  margin: 0 auto;
  padding: 18px;
}

.hero-card, .panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero-card {
  padding: 20px;
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  font-weight: 700;
}

h1, h2 {
  margin: 0;
}

.hero-copy, .muted {
  color: var(--muted);
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.metric-card {
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}

.metric-card span {
  display: block;
  color: darkgray;
  margin-bottom: 8px;
}

.metric-card strong {
  font-size: 2rem;
}

.layout-grid {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 18px;
  align-items: start;
}

.panel {
  padding: 18px;
}

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

.responsive-head {
  align-items: flex-start;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.search-input,
.toolbar-select {
  min-width: 180px;
}

.export-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.form-grid {
  display: grid;
  color: #0a1d2b;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label span {
  font-size: 0.92rem;
  color: grey;
  font-weight: 600;
}

input, select, textarea {
  width: 100%;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(47,183,255,0.7);
  background-color: #08111a ;
  box-shadow: 0 0 0 3px rgba(47,183,255,0.18);
}

textarea {
  resize: vertical;
  min-height: 108px;
}

.primary-btn, .ghost-btn {
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  padding: 11px 15px;
  font-weight: 700;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), #63d6ff);
  color: #00121a;
}

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

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1080px;
}

thead {
  background: rgba(255,255,255,0.05);
}

th, td {
  padding: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.condition-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,0.1);
}

.condition-working, .condition-repaired, .condition-returned-to-store {
  background: rgba(45,212,191,0.15);
  color: #9cf3dc;
}

.condition-needs-repair, .condition-maintenance {
  background: rgba(255,191,71,0.12);
  color: #ffd98f;
}

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

.small-btn {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
}

.small-btn.delete {
  border-color: rgba(255,107,107,0.35);
  color: #ffc2c2;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 24px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(1, 7, 14, 0.75);
}

.modal-dialog {
  position: relative;
  width: min(920px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  margin: 12px auto;
}

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

.history-card {
  background: rgba(255,255,255,0.045);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
}

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

.history-action {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.action-created {
  background: rgba(45,212,191,0.15);
  color: #9cf3dc;
}

.action-updated {
  background: rgba(47,183,255,0.15);
  color: #9cdcff;
}

.action-deleted {
  background: rgba(255,107,107,0.16);
  color: #ffc2c2;
}

.history-text {
  margin: 0;
  line-height: 1.55;
  white-space: pre-wrap;
}

.hidden {
  display: none !important;
}

@media (max-width: 1100px) {
  .layout-grid {
    grid-template-columns: 1fr;
  }

  .hero-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .table-wrap {
    overflow-x: auto;
    margin: 0 -14px;
    padding: 0 14px;
  }

  table {
    min-width: 820px;
  }
}

@media (max-width: 700px) {
  .app-shell {
    padding: 12px;
  }

  .form-grid,
  .hero-metrics {
    grid-template-columns: 1fr;
  }

  .panel, .hero-card {
    padding: 14px;
  }

  .panel-head,
  .toolbar,
  .history-head {
    flex-direction: column;
    align-items: stretch;
  }

  .table-wrap {
    overflow: hidden;
    border: 0;
    box-shadow: none;
    background: transparent;
  }

  table {
    display: block;
    width: 100%;
    min-width: 0;
    border: none;
  }

  thead {
    display: none;
  }

  tbody tr {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    border: 1px solid var(--border);
    margin-bottom: 12px;
    border-radius: 14px;
    background: rgba(255,255,255,0.03);
    padding: 10px;
  }

  tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 0;
    padding: 8px 10px;
    background: transparent;
  }

  tbody td:before {
    content: attr(data-label);
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 700;
    margin-right: 10px;
    white-space: nowrap;
  }

  tbody td:last-child {
    justify-content: flex-end;
  }

  .row-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .small-btn {
    flex: 1 1 48%;
    min-width: 120px;
  }

  .hero-card {
    grid-template-columns: 1fr;
  }

  .modal-dialog {
    width: calc(100vw - 16px);
    margin: 8px auto;
    max-height: calc(100vh - 16px);
  }
}
