.admin {
  max-width: 1400px;
  margin: 0 auto;
  padding: 80px 40px 56px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  gap: 32px;
}

#adminGate {
  margin-top: auto;
  margin-bottom: auto;
}

#adminPanel {
  width: 100%;
  margin-top: 10px;
}

.admin-card {
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg2);
}

.admin-card--center {
  max-width: 420px;
  margin: 0 auto;
  padding: 12px;
  text-align: center;
}

.admin-card h1,
.admin-card h2 {
  color: var(--white);
  margin-bottom: 8px;
}

.admin-card p {
  color: var(--text2);
  margin-bottom: 18px;
}

.admin-login-wrap {
  display: flex;
  justify-content: center;
}

.admin-login {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 380px;
}

.admin-login input {
  flex: 1 1 auto;
  height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--white);
  outline: none;
}

.admin-login input:focus {
  border-color: rgba(14,165,233,.5);
  box-shadow: 0 0 0 3px rgba(14,165,233,.1);
}

.admin-submit {
  height: 44px;
  padding: 0 20px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: #0a0d12;
  border: 1px solid transparent;
  font-weight: 600;
}

.admin-submit:hover {
  filter: brightness(.92);
}

.admin-tabs {
  display: flex;
  gap: 10px;
  margin: 0 0 20px 0;
  padding: 10px;
  position: relative;
  z-index: 2;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .04);
  flex-wrap: wrap;
}

.admin-tabs button {
  width: auto;
  min-width: 150px;
  padding: 12px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text2);
  font-weight: 800;
}

.admin-tabs button.active {
  background: var(--text);
  border-color: transparent;
  color: #0a0d12;
}

.admin-view {
  border-radius: var(--radius);
}

.admin-btn,
td button {
  width: auto;
  min-width: 0;
  padding: 10px 18px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .07);
  color: var(--text);
  font-weight: 800;
}

.admin-btn.btn--fill {
  background: var(--text);
  color: #0a0d12;
  border: 1px solid transparent;
}

.admin-login,
.admin-form,
.step {
  display: grid;
  gap: 14px;
  justify-items: start;
}

.step[hidden],
#adminPanel[hidden],
#adminGate[hidden],
.admin-view[hidden],
#customWrap[hidden],
.admin-tabs[hidden],
.dstep[hidden] {
  display: none;
}

.admin-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text2);
  font-size: 12px;
  font-weight: 700;
}

.admin-form input,
.edit-duration,
.edit-owner {
  height: 42px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--white);
}

.steps {
  display: flex;
  gap: 10px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.steps span,
.stats span {
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  color: var(--text2);
  font-weight: 800;
}

.steps span.active,
.steps span.done {
  background: var(--text);
  color: #0a0d12;
}

.key-builder {
  display: grid;
  grid-template-columns: auto repeat(3, 64px);
  align-items: center;
  gap: 8px;
}

.key-builder span,
#previewKey,
#lastKey {
  color: var(--green);
  font-weight: 800;
}

.key-builder input {
  width: 64px;
  text-align: center;
  text-transform: lowercase;
}

#previewKey,
#lastKey {
  display: block;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  word-break: break-all;
}

#lastKey.bad,
#adminAuthMsg {
  color: #ef4444;
}

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

.fake-select {
  position: relative;
  width: 220px;
}

.fake-select button {
  width: 100%;
  height: 42px;
  padding: 0 36px 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--white);
  text-align: left;
}

.fake-select button::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 18px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--text2);
}

.fake-select div {
  display: none;
  position: absolute;
  z-index: 20;
  top: 48px;
  left: 0;
  right: 0;
  padding: 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #151020;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .35);
}

.fake-select.open div {
  display: grid;
}

.fake-select span {
  padding: 9px 10px;
  border-radius: 7px;
  color: var(--text);
  cursor: pointer;
}

.fake-select span:hover {
  background: rgba(255, 255, 255, .07);
}

.fake-select.mini {
  display: inline-block;
  width: 64px;
  vertical-align: middle;
}

.stats {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  color: var(--text);
  vertical-align: middle;
}

th {
  color: var(--text2);
  font-weight: 700;
}

.edit-duration {
  width: 72px;
}

.edit-owner {
  width: 180px;
}

.key-log {
  margin-top: 18px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--bg2);
  border: 1px solid var(--border);
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.key-log-item {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(14, 165, 233, .08);
  border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
}

.ticket-list {
  display: grid;
  gap: 14px;
}

.ticket-card {
  padding: 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  display: grid;
  gap: 12px;
}

.ticket-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.ticket-subject {
  font-weight: 700;
  font-size: 16px;
  color: var(--white);
}

.ticket-status-badge {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-open {
  background: rgba(234,179,8,.15);
  color: #eab308;
  border: 1px solid rgba(234,179,8,.25);
}

.status-in_progress {
  background: rgba(14,165,233,.15);
  color: #0ea5e9;
  border: 1px solid rgba(14,165,233,.25);
}

.status-closed {
  background: rgba(34,197,94,.15);
  color: #22c55e;
  border: 1px solid rgba(34,197,94,.25);
}

.ticket-meta {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--text2);
  flex-wrap: wrap;
}

.ticket-meta span {
  white-space: nowrap;
}

.ticket-meta code {
  font-size: 12px;
  color: var(--text);
  background: rgba(255,255,255,.06);
  padding: 2px 6px;
  border-radius: 4px;
}

.ticket-body {
  padding: 14px;
  border-radius: 8px;
  background: rgba(255,255,255,.04);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
}

.ticket-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.ticket-actions select {
  height: 38px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  font-weight: 600;
}

.btn--danger {
  background: rgba(239,68,68,.12);
  color: #ef4444;
  border: 1px solid rgba(239,68,68,.2);
}

.btn--danger:hover {
  background: rgba(239,68,68,.2);
}

@media (max-width: 600px) {
  .ticket-meta {
    flex-direction: column;
    gap: 6px;
  }
  .ticket-meta span {
    white-space: normal;
  }
}

.g-bg, .g-glass, .noise { display: none !important; }

.key-log:empty,
#lastKey:empty {
  display: none !important;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
}

.table-wrap table {
  min-width: 1100px;
}

.copyable-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  width: max-content;
}

.copyable-cell code {
  font-size: 13px !important;
  font-family: ui-monospace, SFMono-Regular, SF Pro Mono, Menlo, Consolas, monospace;
}

.copy-btn {
  background: none !important;
  border: none !important;
  padding: 4px !important;
  margin: 0 !important;
  color: #0ea5e9 !important; /* theme blue instead of var(--text2) */
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  min-width: 0 !important;
  width: auto !important;
  height: auto !important;
  opacity: 0.8; /* high opacity */
}

.copy-btn:hover {
  color: var(--white) !important;
  background: rgba(255,255,255,.08) !important;
  opacity: 1;
}

.actions-cell {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 250px;
}

.duration-row,
.actions-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.action-select {
  height: 38px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.action-select:focus {
  border-color: rgba(14,165,233,.5);
}

.btn-save {
  padding: 8px 12px !important;
  height: 38px;
  font-size: 13px;
}

/* forum-like admin refresh */
.admin { max-width: 1460px; padding-top: 72px; }
.admin-card { border-radius: 3px; background: rgba(23,23,21,.94); box-shadow: none; }
.admin-tabs { border-radius: 3px; background: transparent; padding: 0; border: 0; gap: 18px; border-bottom: 1px solid var(--border); }
.admin-tabs button { min-width: 0; padding: 10px 0; border: 0; border-radius: 0; background: transparent; color: var(--text2); }
.admin-tabs button.active { background: transparent; color: var(--white); border-bottom: 2px solid var(--primary); }
.admin-btn, td button { border-radius: 3px; background: rgba(255,255,255,.045); }
.admin-btn.btn--fill { background: #e7e7df; color: #11110f; }
.steps span, .stats span { border-radius: 3px; background: rgba(255,255,255,.045); }
.steps span.active, .steps span.done { background: var(--primary); color: var(--white); }
.table-wrap, table, .ticket-card { border-radius: 3px; }
thead th { color: var(--primary); }
