:root {
  --admin-panel-radius: 1.25rem;
}

body.admin-view {
  min-height: 100vh;
  background: radial-gradient(circle at top, rgba(7, 14, 30, 0.95) 0%, #050b1d 60%, #030610 100%);
  color: var(--text, #f4f6fb);
}

.admin-header {
  gap: 1rem;
}

.admin-main {
  padding: clamp(1.5rem, 4vw, 3rem);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.admin-panel,
.module,
.summary-card {
  background: rgba(9, 15, 28, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--admin-panel-radius);
  padding: 1.5rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.auth-panel form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.auth-panel label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 500;
}

.auth-panel input {
  padding: 0.65rem 0.85rem;
  border-radius: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #f4f6fb;
}

.admin-dashboard {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.dashboard-header-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: rgba(8, 15, 29, 0.8);
  border-radius: var(--admin-panel-radius);
  padding: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.role-badge {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0 0.5rem;
}

.admin-tab {
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  color: #f4f6fb;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.admin-tab[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.admin-tab.active {
  background: rgba(61, 143, 255, 0.2);
  border-color: rgba(61, 143, 255, 0.6);
}

.admin-tab-panel {
  display: none;
  flex-direction: column;
  gap: 1.5rem;
}

.admin-tab-panel.active {
  display: flex;
}

.manifest-editor {
  margin-top: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.02);
}

.manifest-editor summary {
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.manifest-editor summary::-webkit-details-marker {
  display: none;
}

.manifest-editor[open] summary::after,
.manifest-editor:not([open]) summary::after {
  content: attr(data-indicator);
}

.manifest-editor[open] summary::after {
  content: '▲';
  float: right;
  font-size: 0.85rem;
}

.manifest-editor:not([open]) summary::after {
  content: '▼';
  float: right;
  font-size: 0.85rem;
}

.manifest-form textarea {
  width: 100%;
  margin-top: 0.5rem;
  border-radius: 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #f4f6fb;
  padding: 0.55rem 0.75rem;
  resize: vertical;
}

.summary-card h2 {
  margin: 0.2rem 0;
  font-size: 2rem;
}

.module header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.module-note {
  color: var(--muted, #9ca8c7);
  font-size: 0.85rem;
  max-width: 260px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th,
td {
  text-align: left;
  padding: 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

th {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted, #8a92a8);
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tag-pending {
  background: rgba(255, 184, 0, 0.15);
  color: #ffd782;
}

.tag-ready {
  background: rgba(73, 208, 142, 0.15);
  color: #6df0b7;
}

.tag-hold {
  background: rgba(255, 99, 132, 0.08);
  color: #ff9caf;
}

.tag-warning {
  background: rgba(255, 184, 0, 0.15);
  color: #ffd782;
}

.proof-links {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.action-group button {
  padding: 0.35rem 0.7rem;
  border-radius: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: #f4f6fb;
  font-size: 0.8rem;
  cursor: pointer;
}

.action-group button[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

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

.tool-card {
  padding: 1rem;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.tool-card .hint {
  font-size: 0.8rem;
  color: var(--muted, #97a0bb);
}

.tool-card .level {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted, #7f8ab2);
}

.force-panel {
  margin-top: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1.25rem;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

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

.force-form label {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
  gap: 0.35rem;
}

.force-form input[type="text"],
.force-form input[type="number"],
.force-form input[type="url"],
.force-form select,
.force-form textarea,
.manifest-form select,
.manifest-form input[type="text"] {
  padding: 0.55rem 0.75rem;
  border-radius: 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #f4f6fb;
}

.force-form select,
.manifest-form select,
.table-controls select,
.admin-main select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, rgba(255, 255, 255, 0.6) 50%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.6) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 2px), calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 2.25rem;
  cursor: pointer;
}

.force-form select:focus,
.manifest-form select:focus,
.admin-main select:focus {
  border-color: rgba(61, 143, 255, 0.6);
  outline: none;
}

.admin-main select option {
  background: #0d111f;
  color: #f4f6fb;
}

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

.deduction-grid h4 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted, #7f8ab2);
}

.table-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.table-controls input[type="search"] {
  flex: 1;
  min-width: 180px;
  border-radius: 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #f4f6fb;
  padding: 0.5rem 0.75rem;
}

.table-content.collapsed,
.table-content[hidden] {
  display: none;
}

.admin-modal {
  position: fixed;
  inset: 0;
  background: rgba(1, 4, 12, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.admin-modal[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}

.admin-modal-content {
  width: min(480px, 100%);
  background: rgba(5, 10, 24, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1.25rem;
  padding: 1.5rem;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-modal-content h3 {
  margin: 0;
}

.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  border: none;
  background: transparent;
  color: #f4f6fb;
  font-size: 1.5rem;
  cursor: pointer;
}

.force-form .checkbox {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--muted, #92a0c2);
}

.status {
  min-height: 1rem;
  font-size: 0.85rem;
  color: var(--muted, #9ca8c7);
  margin-top: 0.5rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(31, 198, 140, 0.15);
  color: #7df0c7;
  border: 1px solid rgba(31, 198, 140, 0.45);
}

.status-pill-offline {
  background: rgba(255, 89, 100, 0.12);
  color: #ff9aa3;
  border-color: rgba(255, 89, 100, 0.45);
}

.proof-links {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.proof-thumb {
  display: inline-flex;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  width: 88px;
  height: 52px;
  background: rgba(255, 255, 255, 0.04);
}

.proof-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (max-width: 720px) {
  .module header {
    flex-direction: column;
  }
}
