/* ===== Admin Layout ===== */
.admin-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  background: var(--bg);
}

.sidebar {
  background: #040810;
  border-right: 1px solid #131f38;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 20;
}

.sidebar-brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid #131f38;
}

.sidebar-logo {
  width: 150px;
  height: auto;
  display: block;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 20px;
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  color: #7b93b8;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.nav-item:hover {
  background: #0a1424;
  color: #b8d0f0;
}

.nav-item.active {
  border-left-color: var(--blue);
  background: #0c1829;
  color: #e8f1ff;
  font-weight: 600;
}

.nav-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 8px 0;
  border-top: 1px solid #131f38;
}

.nav-item.logout:hover {
  color: #f87171;
  background: rgba(239, 68, 68, 0.06);
}

/* ===== Content Shell ===== */
.admin-content {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow: hidden;
}

.content-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 28px;
  border-bottom: 1px solid #131f38;
  background: #060d1a;
  position: sticky;
  top: 0;
  z-index: 10;
}

.content-header .page-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #e3ecf9;
}

.sidebar-toggle {
  display: none;
  width: 34px;
  height: 34px;
  border: 1px solid #253a60;
  border-radius: 8px;
  background: transparent;
  color: #8fa6cc;
  cursor: pointer;
  padding: 5px;
}

.sidebar-toggle svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.content-body {
  flex: 1;
  padding: 24px 28px;
  overflow-y: auto;
}

.panel {
  animation: panelIn 0.15s ease;
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.panel-section {
  margin-top: 28px;
}

.section-label {
  margin: 0 0 10px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #6b7fa3;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===== Toolbar ===== */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar-input {
  flex: 1;
  width: auto;
  min-width: 200px;
  padding: 9px 12px;
  border: 1px solid #1f3355;
  border-radius: 8px;
  background: #080f1d;
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  outline: none;
}

.toolbar-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(28, 134, 255, 0.15);
}

.toolbar-select {
  width: auto;
  flex-shrink: 0;
  padding: 9px 12px;
  border: 1px solid #1f3355;
  border-radius: 8px;
  background: #080f1d;
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  outline: none;
  cursor: pointer;
}

.toolbar-select:focus {
  border-color: var(--blue);
}

/* ===== Overview Metrics ===== */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.metric-card {
  border: 1px solid #162240;
  border-radius: 10px;
  background: #0a1220;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s;
}

.metric-card:hover {
  border-color: #253a60;
}

.metric-card[data-goto] {
  cursor: pointer;
}

.metric-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #5a7099;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric-value {
  font-size: 1.55rem;
  font-weight: 700;
  color: #e8f1ff;
  line-height: 1;
  margin: 0;
}

/* ===== Type Bar ===== */
.type-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.type-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
}

.type-chip.install  { background: #1d6fd6; }
.type-chip.trouble  { background: #d17a1b; }
.type-chip.rma      { background: #3f9b67; }
.type-chip.training { background: #6e58c7; }
.type-chip.other    { background: #6b7280; }

/* ===== Utilization ===== */
.util-grid {
  display: grid;
  gap: 4px;
}

.util-row {
  display: grid;
  grid-template-columns: 100px 1fr 1fr;
  gap: 14px;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid #0e1726;
}

.util-row:last-child {
  border-bottom: 0;
}

.util-date {
  font-size: 0.8rem;
  color: #8fa6cc;
  font-weight: 500;
}

.util-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.util-bar-label {
  font-size: 0.68rem;
  color: #5a7099;
  width: 40px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.util-track {
  flex: 1;
  height: 7px;
  border-radius: 4px;
  background: #111c30;
  overflow: hidden;
}

.util-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.util-pct {
  font-size: 0.72rem;
  color: #6b7fa3;
  width: 34px;
  text-align: right;
  flex-shrink: 0;
}

/* ===== Data Tables ===== */
.table-wrap {
  overflow-x: auto;
  border: 1px solid #162240;
  border-radius: 10px;
  background: #0a1220;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  color: #5a7099;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #162240;
  background: #070e1c;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #0e1726;
  color: #c8d8f0;
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover {
  background: rgba(28, 134, 255, 0.035);
}

.td-sub {
  font-size: 0.76rem;
  color: #5a7099;
}

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

.row-btn {
  padding: 4px 10px;
  border: 1px solid #1f3355;
  border-radius: 6px;
  background: transparent;
  color: #8fb0d8;
  font: inherit;
  font-size: 0.76rem;
  cursor: pointer;
  transition: all 0.12s;
  margin-left: 4px;
}

.row-btn:first-child {
  margin-left: 0;
}

.row-btn:hover {
  background: #0c1829;
  border-color: #3a5a8a;
  color: #d0e4ff;
}

.row-btn.danger {
  color: #f87171;
  border-color: #4a1c1c;
}

.row-btn.danger:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: #7a2626;
}

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: #4a6188;
  font-size: 0.88rem;
}

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge.active    { background: rgba(34, 197, 94, 0.12);  color: #4ade80; }
.badge.suspended { background: rgba(245, 158, 11, 0.12); color: #fbbf24; }
.badge.cancelled { background: rgba(239, 68, 68, 0.12);  color: #f87171; }
.badge.deleted   { background: rgba(107, 114, 128, 0.12); color: #9ca3af; }
.badge.pending   { background: rgba(245, 158, 11, 0.12); color: #fbbf24; }

.type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
}

.type-badge.install  { background: #1d6fd6; }
.type-badge.trouble  { background: #d17a1b; }
.type-badge.rma      { background: #3f9b67; }
.type-badge.training { background: #6e58c7; }
.type-badge.other    { background: #6b7280; }

/* ===== Registrations ===== */
.reg-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.reg-list {
  display: grid;
  gap: 8px;
}

.reg-card {
  border: 1px solid #162240;
  border-radius: 10px;
  background: #0a1220;
  padding: 12px 14px;
  display: grid;
  gap: 5px;
}

.reg-card .meta {
  font-size: 0.8rem;
  color: #5a7099;
}

.reg-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

/* ===== Calendar ===== */
.calendar-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.calendar-nav {
  display: flex;
  gap: 6px;
}

.range-label {
  color: #5a7099;
  font-size: 0.84rem;
  margin: 0 0 8px;
}

/* ===== Modals ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 100;
  animation: modalFadeIn 0.12s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  width: min(560px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid #1d2f52;
  border-radius: 14px;
  background: linear-gradient(180deg, #0e1729 0%, #0a1220 100%);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  animation: modalSlideUp 0.18s ease;
}

.modal-sm {
  width: min(400px, 90vw);
}

@keyframes modalSlideUp {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #1a2a4a;
}

.modal-head h2 {
  margin: 0;
  font-size: 1.05rem;
  color: #e3ecf9;
}

.modal-x {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #6b7fa3;
  font-size: 1.15rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.12s;
}

.modal-x:hover {
  background: #1a2a4a;
  color: #e3ecf9;
}

.modal-body {
  padding: 16px 20px;
  display: grid;
  gap: 12px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 6px;
}

.modal textarea {
  min-height: 60px;
}

/* ===== Form Layout ===== */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-field {
  display: grid;
  gap: 5px;
}

.form-field label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #6b7fa3;
}

/* ===== Detail Pairs (Event Modal) ===== */
.detail-pair {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px;
  padding: 3px 0;
}

.detail-key {
  font-size: 0.8rem;
  color: #5a7099;
  font-weight: 500;
}

.detail-val {
  font-size: 0.84rem;
  color: #c8d8f0;
}

.detail-section {
  padding-top: 8px;
  margin-top: 4px;
  border-top: 1px solid #162240;
}

.attachment-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.attachment-link {
  display: inline-block;
  font-size: 0.82rem;
  color: #3b8bff;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
  background: #0c1a30;
  border: 1px solid #162240;
  transition: all 0.12s;
  word-break: break-all;
}

.attachment-link:hover {
  background: #122240;
  border-color: #3b8bff;
  color: #6bb0ff;
}

/* ===== Button Variants ===== */
.btn-sm {
  padding: 7px 12px;
  font-size: 0.82rem;
}

.btn-danger {
  background: linear-gradient(180deg, #dc2626, #b91c1c);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-danger:hover {
  filter: brightness(1.1);
}

.back-link {
  color: #4a6188;
  font-size: 0.85rem;
  text-decoration: none;
  transition: color 0.12s;
}

.back-link:hover {
  color: #8fb0d8;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    width: 240px;
    transition: left 0.25s ease;
    z-index: 30;
  }

  .sidebar.open {
    left: 0;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 25;
  }

  .sidebar-toggle {
    display: block;
  }

  .content-body {
    padding: 16px;
  }

  .reg-layout {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .util-row {
    grid-template-columns: 80px 1fr;
    gap: 6px;
  }

  .util-row .util-bar:nth-child(2) {
    grid-column: 2;
  }

  .calendar-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .calendar-nav {
    justify-content: center;
  }
}
