:root {
  color-scheme: dark;
  --bg: #09111f;
  --bg-2: #0d1829;
  --panel: #172334;
  --panel-soft: #202d3f;
  --header: #354154;
  --line: #344154;
  --line-soft: rgba(92, 109, 134, 0.28);
  --text: #f7fbff;
  --muted: #a9bad1;
  --accent: #57a7ff;
  --accent-2: #ffd23f;
  --blue-soft: #91c7ff;
  --blue-deep: #1a6fb5;
  --green: #6de0b5;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 18% 0%, rgba(46, 83, 122, 0.22), transparent 34rem),
    linear-gradient(135deg, var(--bg), var(--bg-2) 58%, #0a1424);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.shell {
  width: min(1216px, calc(100% - 48px));
  margin: 30px auto;
}

.library-panel {
  min-height: calc(100vh - 60px);
  padding: 24px;
  border: 1px solid rgba(123, 143, 174, 0.28);
  border-radius: 8px;
  background: rgba(27, 40, 58, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo {
  width: 46px;
  height: 46px;
  object-fit: contain;
  filter: drop-shadow(0 8px 18px rgba(40, 126, 206, 0.28));
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--blue-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(22px, 2vw, 30px);
  line-height: 1.1;
  font-weight: 760;
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #9dccff;
  cursor: pointer;
  font: inherit;
  transition:
    color 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease;
}

.panel-header .ghost-button:first-of-type {
  margin-left: auto;
}

.admin-account {
  display: grid;
  justify-items: center;
  gap: 3px;
}

.admin-account > span {
  color: var(--blue-soft);
  font-size: 12px;
  font-weight: 720;
  line-height: 1;
}

.ghost-button:hover,
.ghost-button:focus-visible {
  border-color: rgba(87, 167, 255, 0.36);
  background: rgba(87, 167, 255, 0.1);
  color: #d9edff;
  outline: none;
}

.ghost-button svg,
.icon-button svg,
.wiki-link svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.ghost-button svg path,
.icon-button svg path,
.wiki-link svg path,
.plugin-badge svg path,
.file-row svg path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: rgba(28, 41, 59, 0.9);
}

.new-plugin-zone {
  display: grid;
  gap: 5px;
  margin-bottom: 14px;
  padding: 18px;
  border: 1px dashed rgba(145, 199, 255, 0.48);
  border-radius: 7px;
  background: rgba(9, 17, 31, 0.18);
  color: var(--muted);
  cursor: pointer;
  text-align: center;
}

.new-plugin-zone strong {
  color: var(--text);
}

.new-plugin-zone span {
  font-size: 12px;
}

.new-plugin-zone input {
  display: none;
}

.new-plugin-zone.is-dragging {
  border-color: var(--accent);
  background: rgba(87, 167, 255, 0.1);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: fixed;
}

thead {
  background: var(--header);
}

th,
td {
  height: 45px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: #f6fbff;
  font-size: 13px;
  font-weight: 740;
}

tbody tr {
  transition:
    background-color 160ms ease,
    box-shadow 160ms ease;
}

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

tbody tr:hover {
  background: rgba(53, 65, 84, 0.35);
  box-shadow: inset 2px 0 0 var(--accent);
}

.download-col {
  width: 84px;
}

.name-col {
  width: 44%;
}

.date-col {
  width: 260px;
}

.wiki-col {
  width: 180px;
}

.settings-col {
  width: 110px;
}

.download-col,
.date-col,
.wiki-col,
.settings-col,
th:nth-child(3),
td:nth-child(1),
td:nth-child(3),
td:nth-child(4),
td:nth-child(5) {
  text-align: center;
}

.plugin-name {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 720;
}

.plugin-badge {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 210, 63, 0.45);
  border-radius: 5px;
  color: var(--accent-2);
  background: rgba(255, 210, 63, 0.08);
}

.plugin-badge svg {
  width: 15px;
  height: 15px;
}

.date {
  color: #bdd0e7;
  font-variant-numeric: tabular-nums;
}

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

.icon-button,
.wiki-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(123, 143, 174, 0.22);
  border-radius: 6px;
  background: rgba(9, 17, 31, 0.28);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease,
    color 160ms ease;
}

.icon-button {
  color: #f2cb33;
}

.wiki-link {
  color: #c7d7ee;
}

.icon-button:hover,
.icon-button:focus-visible,
.wiki-link:hover,
.wiki-link:focus-visible {
  border-color: rgba(87, 167, 255, 0.46);
  background: rgba(87, 167, 255, 0.11);
  color: #d9edff;
  outline: none;
  transform: translateY(-1px);
}

.status-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.is-hidden {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 9, 18, 0.72);
  backdrop-filter: blur(10px);
}

.modal,
.editor-modal {
  width: min(420px, 100%);
  border: 1px solid rgba(123, 143, 174, 0.32);
  border-radius: 8px;
  background: #172334;
  box-shadow: var(--shadow);
}

.modal {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.modal-header h2 {
  margin: 0;
  font-size: 22px;
}

.modal label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.modal input {
  width: 100%;
  height: 40px;
  border: 1px solid rgba(123, 143, 174, 0.36);
  border-radius: 6px;
  background: rgba(9, 17, 31, 0.42);
  color: var(--text);
  font: inherit;
  padding: 0 12px;
}

.modal input:focus {
  border-color: rgba(87, 167, 255, 0.8);
  outline: none;
}

.icon-only,
.primary-button,
.secondary-button {
  border: 1px solid rgba(123, 143, 174, 0.28);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

.icon-only {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: rgba(9, 17, 31, 0.32);
  font-size: 22px;
  line-height: 1;
}

.primary-button,
.secondary-button {
  min-height: 38px;
  padding: 0 14px;
}

.primary-button {
  background: var(--blue-deep);
}

.secondary-button {
  background: rgba(87, 167, 255, 0.1);
}

.primary-button:hover,
.secondary-button:hover,
.icon-only:hover {
  border-color: rgba(87, 167, 255, 0.6);
  background: rgba(87, 167, 255, 0.2);
}

.form-error {
  min-height: 18px;
  margin: 0;
  color: #ffb0b0;
  font-size: 13px;
}

.editor-backdrop {
  place-items: stretch;
}

.editor-modal {
  display: flex;
  flex-direction: column;
  width: min(1180px, 100%);
  height: min(760px, calc(100vh - 48px));
  margin: auto;
  padding: 20px;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
}

.editor-toolbar span {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.save-button {
  min-height: 38px;
  margin-left: auto;
  padding: 0 18px;
  border: 1px solid rgba(109, 224, 181, 0.48);
  border-radius: 6px;
  background: rgba(109, 224, 181, 0.14);
  color: #d8fff0;
  cursor: pointer;
  font: inherit;
  font-weight: 760;
}

.save-button:hover:not(:disabled),
.save-button:focus-visible:not(:disabled) {
  border-color: rgba(109, 224, 181, 0.8);
  background: rgba(109, 224, 181, 0.24);
  outline: none;
}

.save-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.save-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 132px;
  min-height: 38px;
  margin-left: 0 !important;
  padding: 0 14px;
  border: 1px solid rgba(123, 143, 174, 0.3);
  border-radius: 6px;
  background: rgba(9, 17, 31, 0.32);
  color: var(--muted) !important;
  font-size: 13px !important;
  font-weight: 760;
}

.save-state.is-unsaved {
  border-color: rgba(255, 210, 63, 0.68);
  background: rgba(255, 210, 63, 0.12);
  color: #ffe480 !important;
}

.save-state.is-saving {
  border-color: rgba(87, 167, 255, 0.68);
  background: rgba(87, 167, 255, 0.13);
  color: #cce7ff !important;
}

.save-state.is-saved {
  border-color: rgba(109, 224, 181, 0.78);
  background: rgba(109, 224, 181, 0.16);
  color: #caffed !important;
  box-shadow: 0 0 0 3px rgba(109, 224, 181, 0.08);
}

.save-state.is-locked {
  border-color: rgba(255, 176, 176, 0.46);
  background: rgba(255, 176, 176, 0.1);
  color: #ffd3d3 !important;
}

.editor-grid {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 16px;
  min-height: 0;
  flex: 1;
}

.file-pane,
.code-pane {
  min-height: 0;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: rgba(9, 17, 31, 0.22);
}

.file-pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.drop-zone {
  display: grid;
  gap: 5px;
  margin: 12px;
  padding: 18px;
  border: 1px dashed rgba(145, 199, 255, 0.48);
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
  text-align: center;
}

.drop-zone strong {
  color: var(--text);
}

.drop-zone span {
  font-size: 12px;
}

.drop-zone input {
  display: none;
}

.drop-zone.is-dragging {
  border-color: var(--accent);
  background: rgba(87, 167, 255, 0.1);
}

.folder-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px 12px;
}

.folder-bar .secondary-button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.folder-bar span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-list {
  display: grid;
  align-content: start;
  gap: 4px;
  overflow: auto;
  padding: 0 12px 12px;
}

.file-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.file-row:hover,
.file-row:focus-visible {
  border-color: rgba(87, 167, 255, 0.35);
  background: rgba(87, 167, 255, 0.08);
  outline: none;
}

.file-row svg {
  width: 16px;
  height: 16px;
  color: var(--blue-soft);
}

.file-row span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row small {
  color: var(--muted);
  font-size: 11px;
}

.code-pane {
  display: grid;
  grid-template-rows: 42px minmax(0, 1fr);
  overflow: hidden;
}

.file-title {
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 13px;
}

#fileEditor {
  width: 100%;
  height: 100%;
  resize: none;
  border: 0;
  outline: 0;
  background: rgba(4, 10, 20, 0.36);
  color: #dcecff;
  font: 13px/1.55 Consolas, "Cascadia Mono", "SFMono-Regular", monospace;
  padding: 14px;
  tab-size: 2;
}

#fileEditor:disabled {
  color: var(--muted);
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 24px, 1216px);
    margin: 12px auto;
  }

  .library-panel {
    min-height: calc(100vh - 24px);
    padding: 16px;
  }

  .panel-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .brand {
    gap: 10px;
  }

  .brand-logo {
    width: 38px;
    height: 38px;
  }

  .ghost-button span {
    display: none;
  }

  .download-col {
    width: 72px;
  }

  .wiki-col {
    width: 130px;
  }

  .editor-grid {
    grid-template-columns: 1fr;
  }

  .editor-modal {
    height: calc(100vh - 24px);
    padding: 14px;
  }
}
