:root {
  color-scheme: dark;
  --bg: #050a12;
  --panel: #0b1320;
  --ink: #f6fbff;
  --muted: #a8b8c8;
  --line: rgba(80, 219, 255, .2);
  --green: #27d6ff;
  --blue: #7b61ff;
  --red: #b13f36;
  --amber: #d9a642;
  --shadow: 0 18px 48px rgba(0, 0, 0, .26);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 94% 2%, rgba(39, 214, 255, .18), transparent 20rem),
    linear-gradient(110deg, rgba(39,214,255,.04) 0 1px, transparent 1px 90px),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #141c26;
  color: var(--ink);
  padding: 9px 10px;
}

select option {
  background: #141c26;
  color: var(--ink);
}

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

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

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

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

td {
  font-size: 14px;
}

.hidden {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 18px;
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-logo {
  display: block;
  width: min(100%, 330px);
  height: auto;
  margin: 0 0 16px;
}

.google-login {
  display: grid;
  gap: 14px;
}

.divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  background: var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background:
    linear-gradient(90deg, rgba(39,214,255,.1), transparent 48%),
    #07101c;
  color: #f4f7f0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand small {
  display: block;
  color: #9fb7c8;
}

.mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid rgba(126,232,255,.55);
  background: radial-gradient(circle at 65% 30%, rgba(39,214,255,.28), rgba(5,10,18,.96));
  object-fit: cover;
  padding: 3px;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

main {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.view {
  display: grid;
  gap: 18px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.nav-item,
.ghost,
.primary,
.small,
.icon-button {
  min-height: 36px;
  border-radius: 6px;
  padding: 8px 12px;
  font-weight: 800;
}

.nav-item {
  background: rgba(39,214,255,.1);
  color: #dce9f5;
}

.nav-item.active {
  background: linear-gradient(135deg, #27d6ff, #11a7df);
  color: #03111a;
}

.primary {
  background: linear-gradient(135deg, #27d6ff, #11a7df);
  color: #03111a;
}

.sso-button {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.ghost {
  background: rgba(255,255,255,.06);
  color: var(--ink);
}

.topbar .ghost {
  background: rgba(39,214,255,.1);
  color: #f4f7f0;
}

.danger {
  color: #ffd6d2 !important;
}

.small {
  min-height: 32px;
  background: rgba(39,214,255,.1);
  color: var(--green);
}

.danger-row {
  background: #f4e7e5;
  color: var(--red);
}

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

.mail-actions button + button {
  margin-left: 6px;
}

.mail-actions button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.icon-button {
  width: 36px;
  padding: 0;
  background: rgba(255,255,255,.06);
  color: var(--muted);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.metric,
.table-wrap,
.template-grid,
.notice {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric {
  padding: 16px;
}

.metric span {
  display: block;
  font-size: 28px;
  font-weight: 900;
}

.metric small {
  color: var(--muted);
  font-weight: 800;
}

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

.request-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.request-form input {
  width: 190px;
}

.check {
  width: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.check input {
  width: auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2ed;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.badge.active,
.badge.complete,
.badge.verified {
  background: #e2f3e7;
  color: var(--green);
}

.badge.pending,
.badge.unchecked,
.badge.requested {
  background: #f7eedc;
  color: var(--amber);
}

.badge.deleted,
.badge.revoked,
.badge.failed {
  background: #f4e7e5;
  color: var(--red);
}

.badge.queued,
.badge.running,
.badge.deleting,
.badge.delete_queued {
  background: #f7eedc;
  color: var(--amber);
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  padding: 12px;
}

.workspace-list {
  display: grid;
  gap: 18px;
}

.dashboard-list {
  display: grid;
  gap: 18px;
}

.dashboard-section {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.workspace-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.template-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.app-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 250px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.035);
}

.app-card.fiverr-lead-filter {
  grid-column: span 2;
}

.app-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.app-card-head h4,
.card-detail {
  margin: 0;
}

.card-detail {
  min-height: 38px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.card-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
}

.card-metric {
  min-height: 66px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 10px;
  border: 1px solid rgba(80, 219, 255, .16);
  border-radius: 6px;
  background: rgba(255,255,255,.045);
  overflow: hidden;
}

.card-metric span {
  font-size: 18px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.card-metric small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.event-list {
  display: grid;
  gap: 6px;
}

.event-row {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-left: 3px solid rgba(39,214,255,.65);
  background: rgba(255,255,255,.04);
}

.fiverr-review-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.event-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.feedback-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-grade {
  min-height: 28px;
  padding: 5px 7px;
  border-radius: 6px;
  background: rgba(39,214,255,.1);
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
}

.icon-grade.correct {
  background: rgba(39,214,255,.22);
  color: var(--green);
}

.icon-grade.read {
  background: rgba(255,255,255,.12);
}

.icon-grade.delete {
  background: rgba(255,96,96,.14);
  color: #ffb4b4;
}

.icon-grade:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.feedback-note {
  color: var(--green) !important;
}

.delete-note {
  color: #ffb4b4 !important;
}

.fiverr-review-row.deleted {
  opacity: .72;
}

.message-body {
  margin-top: 8px;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid rgba(39,214,255,.14);
  border-radius: 6px;
  background: rgba(0,0,0,.18);
  padding: 10px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
}

.event-row span,
.event-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-row small {
  color: var(--muted);
}

.template-card h4,
.template-card p {
  margin: 0;
}

.template-card p {
  color: var(--muted);
}

.template-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

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

.minecraft-provision-card {
  align-content: start;
}

.minecraft-provision-form {
  display: grid;
  gap: 8px;
}

.minecraft-provision-form input[type="file"] {
  min-height: 42px;
}

.notice {
  padding: 12px 14px;
  color: var(--blue);
  background: #edf3f7;
}

.error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-weight: 800;
}

dialog {
  width: min(560px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(18, 24, 20, 0.45);
}

.dialog-body {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.env-fields {
  display: grid;
  gap: 12px;
}

.app-env-fields {
  display: grid;
  gap: 12px;
  max-height: min(60vh, 620px);
  overflow-y: auto;
  padding-right: 4px;
}

.app-env-fields textarea {
  min-height: 80px;
  resize: vertical;
}

#app-env-dialog { width: min(820px, calc(100vw - 24px)); }
.editor-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.editor-tabs button { border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); padding: 8px 14px; cursor: pointer; }
.editor-tabs button[aria-selected="true"] { border-bottom-color: var(--green); color: var(--ink); }
.app-file-editor { display: grid; gap: 12px; }
.app-file-editor textarea { min-height: min(55vh, 520px); width: 100%; resize: vertical; font-family: Consolas, monospace; font-size: 12px; line-height: 1.5; }

.files-toolbar { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.files-toolbar label { min-width: 180px; }
.files-toolbar #files-path { color: var(--muted); overflow-wrap: anywhere; flex: 1; }
.files-upload { display: inline-flex; align-items: center; justify-content: center; min-width: 90px !important; padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; color: var(--ink); }
.files-upload input { display: none; }

.env-empty {
  margin: 0;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 760px) {
  .topbar,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar nav,
  .metrics {
    grid-template-columns: 1fr;
  }

  .metrics {
    display: grid;
  }

  .app-card.fiverr-lead-filter {
    grid-column: span 1;
  }

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

  .feedback-actions {
    justify-content: flex-start;
  }
}
