:root {
  --bg: #0f172a;
  --panel: #111827;
  --panel-2: #1f2937;
  --line: #334155;
  --text: #e2e8f0;
  --accent: #f59e0b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top left, #1e293b, var(--bg));
}

.requester {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.65);
  display: grid;
  place-items: center;
  z-index: 9999;
}

.requester.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

.requester-card {
  background: #0b1220;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  min-width: 260px;
  display: grid;
  gap: 0.25rem;
}

.requester-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.requester-wide {
  min-width: min(640px, 92vw);
}

.requester-wide pre {
  margin: 0.35rem 0 0.55rem 0;
  max-height: 220px;
  overflow: auto;
  background: #020617;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.5rem;
}

.conf-form {
  margin-top: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
  min-height: 100%;
  align-content: start;
  align-items: start;
}

.config-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.config-tabs .tab-btn {
  height: 32px;
  min-height: 32px;
  padding: 0 0.6rem;
  line-height: 1;
}

.conf-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem;
  background: rgba(11, 18, 32, 0.65);
  overflow: auto;
}

.conf-tab-panel {
  max-height: calc(100vh - 280px);
}

.conf-section h3 {
  margin: 0 0 0.4rem 0;
  font-size: 0.8rem;
  color: #e2e8f0;
}

.conf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.conf-table th,
.conf-table td {
  border: 1px solid #243244;
  padding: 0.25rem;
  vertical-align: middle;
}

.conf-table td:first-child,
.conf-table th:first-child {
  text-align: center;
}

.conf-table th {
  background: #0f172a;
  color: #cbd5e1;
  position: sticky;
  top: 0;
  z-index: 2;
}

.conf-key {
  font-family: "IBM Plex Mono", monospace;
  color: #e2e8f0;
}

.table-input {
  width: 100%;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b1220;
  color: var(--text);
}

.table-remove-btn,
.table-add-btn {
  padding: 0.2rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #111827;
  color: #e2e8f0;
  font-weight: 700;
}

.table-add-btn {
  margin-top: 0.35rem;
}

.conf-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.conf-actions button {
  height: 34px;
  min-height: 34px;
  padding: 0 0.8rem;
  line-height: 1;
}

.login-body {
  min-height: 100vh;
  margin: 0;
  color: #ffffff;
  font-family: "Anonymous Pro", "IBM Plex Sans", monospace;
  background-attachment: scroll, scroll, scroll, fixed;
  background-color: #645862;
  background-image:
    url("https://www.winstonsmith.org/images/light-bl.svg"),
    url("https://www.winstonsmith.org/images/light-br.svg"),
    url("https://www.winstonsmith.org/images/overlay.png"),
    url("https://www.winstonsmith.org/images/background.jpg");
  background-position: bottom left, bottom right, top left, top center;
  background-repeat: no-repeat, no-repeat, repeat, no-repeat;
  background-size: 25em, 25em, auto, cover;
}

.login-body #banner {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.login-body #banner .inner {
  width: min(520px, 92vw);
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 0.2rem;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  padding: 1rem 1.1rem;
}

.login-body #banner .inner header img {
  width: min(300px, 64vw);
  height: auto;
}

.login-body #banner .inner header h2 {
  margin: 0.1rem 0 0 0;
  font-size: clamp(2.2rem, 6vw, 3rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #ffffff;
}

.login-body #banner .inner p {
  margin: 0;
  font-size: 1rem;
  color: #f1f5f9;
}

.login-body #banner .inner p strong {
  font-size: clamp(1.45rem, 3.8vw, 1.95rem);
  font-weight: 700;
}

.login-footer {
  width: 100%;
  margin-top: 0.65rem;
  padding: 0.95rem;
  background: rgba(17, 24, 39, 0.4);
  border: 1px solid rgba(203, 213, 225, 0.35);
  border-radius: 10px;
}

.login-copy {
  margin: 0 0 0.55rem 0;
  color: #f1f5f9;
}

.login-footer form {
  display: grid;
  gap: 0.55rem;
}

.login-footer label {
  font-size: 0.88rem;
  color: #e2e8f0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

.login-body input,
.login-body button {
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

.login-body input {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #94a3b8;
  color: #0f172a;
}

.login-body button {
  background: #111827;
  color: #f8fafc;
}

.login-body .message {
  margin-top: 0.4rem;
  color: #fca5a5;
}

input,
select,
button,
textarea {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
}

button {
  cursor: pointer;
  background: linear-gradient(90deg, #f59e0b, #d97706);
  border: none;
  color: #111827;
  font-weight: 700;
}

.dashboard-grid {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 300px 1fr;
  grid-template-rows: 56px 1fr 180px;
  grid-template-areas:
    "top top"
    "left center"
    "bottom bottom";
}

.status-bar {
  grid-area: top;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.95);
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.edition-label {
  font-size: 0.85rem;
  color: #cbd5e1;
}

#edition-select {
  min-width: 180px;
  max-width: 260px;
}

#status-text {
  margin-left: 0.6rem;
  margin-right: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main-tabs {
  display: flex;
  gap: 0.35rem;
}

.left-panel {
  grid-area: left;
  overflow: auto;
  border-right: 1px solid var(--line);
  padding: 1rem;
  background: rgba(2, 6, 23, 0.5);
}

.editor-panel {
  grid-area: center;
  padding: 1rem;
  min-height: 0;
}

.editor-toolbar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 0.5rem;
  gap: 0.6rem;
}

#current-file {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
  color: #cbd5e1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

#editor {
  width: 100%;
  height: calc(100% - 5rem);
  resize: none;
  font-family: "IBM Plex Mono", "Fira Code", monospace;
}

#editor-view,
#config-view,
#publish-view {
  height: 100%;
}

#config-view {
  overflow: auto;
  padding-right: 0.35rem;
}

#publish-view {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0.55rem;
  min-height: 0;
}

.publish-toolbar {
  display: flex;
  gap: 0.5rem;
}

.publish-output {
  margin: 0;
  background: #020617;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem;
  overflow: auto;
  white-space: pre-wrap;
}

.bottom-panel {
  grid-area: bottom;
  border-top: 1px solid var(--line);
  padding: 0.8rem 1rem;
  background: rgba(15, 23, 42, 0.95);
  display: grid;
  gap: 0.6rem;
}

#command-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  align-items: center;
}

#command-input {
  width: 100%;
}

.messages {
  margin: 0;
  background: #020617;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem;
  height: 110px;
  overflow: auto;
}

.repo-info {
  display: grid;
  gap: 0.45rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
}

.repo-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem;
  background: rgba(15, 23, 42, 0.5);
}

.repo-good {
  border-color: #14532d;
}

.repo-warn {
  border-color: #854d0e;
}

.repo-bad {
  border-color: #7f1d1d;
}

.repo-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
}

.repo-title {
  color: #e2e8f0;
  font-weight: 600;
}

.repo-actions {
  display: flex;
  gap: 0.25rem;
}

.repo-badges {
  margin-top: 0.35rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.repo-badge {
  font-size: 0.7rem;
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--line);
}

.repo-badge.good {
  background: rgba(22, 163, 74, 0.2);
  border-color: #166534;
}

.repo-badge.warn {
  background: rgba(245, 158, 11, 0.2);
  border-color: #92400e;
}

.repo-badge.bad {
  background: rgba(239, 68, 68, 0.2);
  border-color: #991b1b;
}

.repo-badge.neutral {
  background: rgba(51, 65, 85, 0.35);
}

.repo-last {
  margin-top: 0.35rem;
  font-size: 0.72rem;
}

.repo-last pre {
  margin: 0.35rem 0 0 0;
  max-height: 120px;
  overflow: auto;
  background: #020617;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.4rem;
}

.repo-btn {
  background: #0b1220;
  color: #cbd5e1;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  line-height: 1.1;
  font-size: 0.78rem;
}

.file-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.2rem;
}

.file-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
  align-items: center;
}

#open-vars-org {
  margin-left: auto;
}

.status-legend {
  margin-bottom: 0.45rem;
  font-size: 0.72rem;
  color: #94a3b8;
}

.tab-btn {
  background: #0b1220;
  color: #cbd5e1;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.3rem 0.55rem;
  font-size: 0.78rem;
}

.tab-btn.active {
  background: #f59e0b;
  color: #111827;
}

#logout-button {
  background: #b91c1c;
  color: #fee2e2;
  border: 1px solid #7f1d1d;
  font-weight: 700;
  width: 34px;
  min-width: 34px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  line-height: 1;
}

#logout-button:hover {
  background: #dc2626;
}

.file-list li {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
  color: #cbd5e1;
}

.file-btn {
  all: unset;
  cursor: pointer;
  color: #cbd5e1;
}

.file-btn:hover {
  color: #f59e0b;
}

.org-icon {
  margin-right: 0.18rem;
}

.org-path {
  margin-left: 0.25rem;
}

.message {
  min-height: 1.25rem;
  color: #fda4af;
}

.file-context-menu {
  position: fixed;
  z-index: 10000;
  background: #0b1220;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.25rem;
  display: grid;
  gap: 0.2rem;
  min-width: 150px;
}

.file-context-menu.hidden {
  display: none;
}

.file-context-menu button {
  background: #111827;
  color: #cbd5e1;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.3rem 0.45rem;
  font-size: 0.78rem;
  text-align: left;
}

@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 56px 260px 1fr 180px;
    grid-template-areas:
      "top"
      "left"
      "center"
      "bottom";
  }
}
