:root {
  color-scheme: dark;
  --bg: #07070a;
  --bg-raised: #0d0d12;
  --panel: rgba(18, 18, 23, 0.92);
  --panel-strong: rgba(27, 27, 34, 0.94);
  --panel-hot: rgba(47, 21, 24, 0.7);
  --line: rgba(255, 255, 255, 0.09);
  --line-hot: rgba(255, 92, 64, 0.42);
  --ink: #f7f1e7;
  --muted: #9e98a3;
  --muted-strong: #c8bfbd;
  --ember: #ff4f3f;
  --ember-dark: #9f211b;
  --sulfur: #f6c85f;
  --acid: #65e6a9;
  --violet: #9c7cff;
  --code-bg: #090a0d;
  --code-ink: #efe9dc;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
  --soft-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
  --radius: 14px;
  --radius-tight: 9px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  min-width: 0;
  overflow-x: hidden;
  font-family: "Manrope", "Segoe UI", sans-serif;
  background:
    linear-gradient(118deg, rgba(255, 79, 63, 0.16), transparent 27rem),
    linear-gradient(244deg, rgba(101, 230, 169, 0.1), transparent 23rem),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 42px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 42px),
    linear-gradient(180deg, #0d0b0f 0%, #07070a 58%, #101014 100%);
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 7px 7px, 7px 7px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.45), transparent 74%);
}

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

button,
input,
select,
textarea,
.panel,
.status,
.auth-card {
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.auth-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 1rem;
}

.auth-card {
  width: min(100%, 27rem);
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(155deg, rgba(255, 79, 63, 0.17), transparent 42%),
    linear-gradient(180deg, rgba(23, 23, 29, 0.96), rgba(11, 11, 15, 0.97));
  border: 1px solid var(--line-hot);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem;
  display: grid;
  gap: 0.85rem;
}

.auth-card::after {
  content: "";
  position: absolute;
  inset: auto 1rem 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--ember), var(--sulfur), transparent);
  opacity: 0.86;
}

.auth-brand {
  margin-bottom: 0.2rem;
}

.auth-copy,
.auth-error {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.auth-error {
  color: #ff8d7f;
}

.shell {
  height: 100dvh;
  max-height: 100dvh;
  width: 100%;
  min-width: 0;
  padding: 0.75rem;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  grid-template-areas:
    "topbar topbar"
    "toolbar searchbar"
    "layout layout";
  grid-template-columns: minmax(0, 1.45fr) minmax(20rem, 0.75fr);
  gap: 0.7rem;
  overflow: hidden;
}

.topbar,
.toolbar,
.searchbar,
.panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 42%),
    var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(18px);
}

.topbar {
  grid-area: topbar;
  min-width: 0;
  padding: 0.8rem 0.9rem;
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.brand-lockup {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.78rem;
}

.imp-logo {
  width: 2.55rem;
  height: 2.55rem;
  flex: 0 0 auto;
  position: relative;
  display: inline-grid;
  place-items: center;
  border-radius: 50% 50% 45% 45%;
  background:
    linear-gradient(145deg, #ff6b55 0%, #c82d24 48%, #60100f 100%);
  border: 1px solid rgba(255, 198, 95, 0.36);
  box-shadow:
    inset 0 0 18px rgba(255, 198, 95, 0.18),
    0 0 0 3px rgba(255, 79, 63, 0.1),
    0 16px 30px rgba(255, 79, 63, 0.16);
}

.imp-logo::before,
.imp-logo::after {
  content: "";
  position: absolute;
  top: -0.28rem;
  width: 0.92rem;
  height: 0.92rem;
  background: linear-gradient(135deg, var(--sulfur), #f38440 50%, #7c1614 51%);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  filter: drop-shadow(0 0 8px rgba(246, 200, 95, 0.24));
}

.imp-logo::before {
  left: 0.12rem;
  transform: rotate(-28deg);
}

.imp-logo::after {
  right: 0.12rem;
  transform: rotate(28deg);
}

.imp-logo-large {
  width: 3.35rem;
  height: 3.35rem;
}

.imp-eyes {
  width: 0.34rem;
  height: 0.34rem;
  border-radius: 999px;
  background: var(--sulfur);
  box-shadow:
    0.74rem 0 0 var(--sulfur),
    0 0 12px rgba(246, 200, 95, 0.72),
    0.74rem 0 12px rgba(246, 200, 95, 0.72);
  transform: translateX(-0.37rem) translateY(0.16rem);
}

.eyebrow {
  margin: 0;
  color: var(--ember);
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-family: "Azeret Mono", "SFMono-Regular", monospace;
  font-size: 0.68rem;
  font-weight: 700;
}

h1 {
  margin: 0.12rem 0 0;
  color: var(--ink);
  font-size: clamp(1.35rem, 2.3vw, 2rem);
  line-height: 1.04;
  letter-spacing: 0;
  font-weight: 800;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.status {
  max-width: min(44vw, 34rem);
  min-width: 6.2rem;
  border-radius: 999px;
  padding: 0.54rem 0.78rem;
  background: rgba(101, 230, 169, 0.09);
  border: 1px solid rgba(101, 230, 169, 0.2);
  color: var(--acid);
  font-family: "Azeret Mono", "SFMono-Regular", monospace;
  font-size: 0.74rem;
  font-weight: 600;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status.busy {
  color: var(--sulfur);
  border-color: rgba(246, 200, 95, 0.3);
  background: rgba(246, 200, 95, 0.1);
}

.status.error {
  color: #ff8d7f;
  border-color: rgba(255, 79, 63, 0.36);
  background: rgba(255, 79, 63, 0.1);
}

.toolbar,
.searchbar {
  min-width: 0;
  border-radius: var(--radius-tight);
  padding: 0.58rem;
}

.toolbar {
  grid-area: toolbar;
  display: grid;
  grid-template-columns: minmax(11rem, 0.7fr) minmax(16rem, 1.35fr) auto;
  gap: 0.55rem;
}

.searchbar {
  grid-area: searchbar;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem;
}

.control-field {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.55rem;
  border-radius: var(--radius-tight);
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(5, 5, 8, 0.58);
  padding: 0.34rem 0.45rem 0.34rem 0.62rem;
}

.control-field > span {
  color: var(--muted);
  font-family: "Azeret Mono", "SFMono-Regular", monospace;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.auth-field {
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  padding: 0.58rem;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--ink);
  outline: none;
}

input,
select {
  height: 2.18rem;
  padding: 0 0.6rem;
}

select {
  cursor: pointer;
}

input::placeholder,
textarea::placeholder {
  color: rgba(247, 241, 231, 0.38);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--line-hot);
  box-shadow: 0 0 0 3px rgba(255, 79, 63, 0.14);
}

button {
  min-height: 2.18rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink);
  padding: 0 0.72rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  font-weight: 800;
  line-height: 1;
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 79, 63, 0.42);
  background: rgba(255, 79, 63, 0.12);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.26);
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
  transform: none;
}

button:focus-visible {
  outline: 2px solid var(--sulfur);
  outline-offset: 2px;
}

.button-icon {
  color: var(--sulfur);
  font-family: "Azeret Mono", "SFMono-Regular", monospace;
  font-size: 0.9em;
}

.primary-button {
  border-color: rgba(255, 79, 63, 0.58);
  background:
    linear-gradient(180deg, rgba(255, 198, 95, 0.22), transparent),
    linear-gradient(135deg, #df352b, #7a1714);
  color: white;
  box-shadow: 0 14px 32px rgba(255, 79, 63, 0.18);
}

.primary-button:hover {
  background:
    linear-gradient(180deg, rgba(255, 198, 95, 0.28), transparent),
    linear-gradient(135deg, #f04a3d, #8d1b17);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted-strong);
}

.danger-button {
  border-color: rgba(255, 79, 63, 0.38);
  background: rgba(255, 79, 63, 0.09);
  color: #ffb3a9;
}

.danger-button:hover {
  border-color: rgba(255, 79, 63, 0.58);
  background: rgba(255, 79, 63, 0.16);
}

.toolbar-actions,
.actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.layout {
  grid-area: layout;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(14rem, 0.95fr) minmax(0, 2.1fr) minmax(13rem, 0.85fr);
  gap: 0.7rem;
}

.panel {
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  border-radius: var(--radius-tight);
}

.editor-panel {
  border-color: rgba(255, 79, 63, 0.18);
}

.panel-title {
  min-width: 0;
  min-height: 2.75rem;
  padding: 0.58rem 0.68rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
}

.panel-title.split {
  align-items: center;
}

.panel-count,
.language-badge {
  flex: 0 0 auto;
  border: 1px solid rgba(246, 200, 95, 0.22);
  border-radius: 999px;
  background: rgba(246, 200, 95, 0.08);
  color: var(--sulfur);
  padding: 0.28rem 0.48rem;
  font-family: "Azeret Mono", "SFMono-Regular", monospace;
  font-size: 0.67rem;
  font-weight: 700;
  white-space: nowrap;
}

.language-badge {
  border-color: rgba(101, 230, 169, 0.22);
  background: rgba(101, 230, 169, 0.08);
  color: var(--acid);
}

.active-file {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "Azeret Mono", "SFMono-Regular", monospace;
  font-size: 0.75rem;
  color: var(--muted-strong);
}

.shell.is-dirty .active-file::after {
  content: " edited";
  color: var(--sulfur);
}

.panel-body {
  min-height: 0;
  min-width: 0;
  overflow: auto;
  padding: 0.45rem;
  overscroll-behavior: contain;
  scrollbar-color: rgba(255, 79, 63, 0.48) rgba(255, 255, 255, 0.04);
}

.panel-body::-webkit-scrollbar,
.editor-highlight::-webkit-scrollbar,
.editor-input::-webkit-scrollbar,
.diff-output::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.panel-body::-webkit-scrollbar-thumb,
.editor-highlight::-webkit-scrollbar-thumb,
.editor-input::-webkit-scrollbar-thumb,
.diff-output::-webkit-scrollbar-thumb {
  background: rgba(255, 79, 63, 0.38);
  border-radius: 999px;
  border: 2px solid rgba(0, 0, 0, 0.2);
}

.entry,
.search-result {
  width: 100%;
  min-width: 0;
  margin: 0 0 0.32rem;
  padding: 0.48rem 0.55rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.55rem;
  text-align: left;
  border-radius: 8px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.035);
  color: var(--ink);
  box-shadow: none;
}

.search-result {
  grid-template-columns: minmax(0, 1fr);
  cursor: pointer;
}

.entry:hover,
.entry:focus-visible,
.search-result:hover,
.search-result:focus-visible {
  background:
    linear-gradient(90deg, rgba(255, 79, 63, 0.15), rgba(246, 200, 95, 0.035)),
    rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 79, 63, 0.34);
}

.entry-icon {
  position: relative;
  display: inline-block;
  width: 1.52rem;
  height: 1.26rem;
  border-radius: 4px;
  background: rgba(246, 200, 95, 0.2);
  box-shadow: inset 0 0 0 1px rgba(246, 200, 95, 0.22);
}

.entry-icon::before,
.entry-icon::after {
  content: "";
  position: absolute;
  display: block;
}

.entry.directory .entry-icon {
  background: rgba(246, 200, 95, 0.22);
}

.entry.directory .entry-icon::before {
  left: 0.15rem;
  top: -0.18rem;
  width: 0.62rem;
  height: 0.34rem;
  border-radius: 4px 4px 0 0;
  background: rgba(246, 200, 95, 0.82);
}

.entry.directory .entry-icon::after {
  inset: 0.25rem 0.18rem 0.16rem;
  border-radius: 3px;
  background: rgba(246, 200, 95, 0.42);
}

.entry.file .entry-icon {
  width: 1.2rem;
  height: 1.48rem;
  border-radius: 4px;
  background: rgba(101, 230, 169, 0.16);
  box-shadow: inset 0 0 0 1px rgba(101, 230, 169, 0.23);
}

.entry.file .entry-icon::before {
  right: 0;
  top: 0;
  border-top: 0.38rem solid rgba(101, 230, 169, 0.72);
  border-left: 0.38rem solid transparent;
}

.entry.file .entry-icon::after {
  left: 0.24rem;
  right: 0.24rem;
  top: 0.65rem;
  height: 1px;
  background: rgba(101, 230, 169, 0.58);
  box-shadow: 0 0.26rem 0 rgba(101, 230, 169, 0.42);
}

.entry-text {
  min-width: 0;
  display: grid;
  gap: 0.12rem;
}

.entry strong,
.entry small,
.search-result strong,
.search-result small,
#active-file-label {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.entry strong,
.search-result strong {
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.25;
}

.entry small,
.search-result small {
  display: block;
  color: var(--muted);
  font-family: "Azeret Mono", "SFMono-Regular", monospace;
  font-size: 0.67rem;
  line-height: 1.45;
}

.editor-stack {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.46rem;
}

textarea {
  min-height: 24rem;
  min-width: 0;
  resize: vertical;
}

.editor-shell {
  position: relative;
  min-height: 0;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background:
    linear-gradient(90deg, rgba(255, 79, 63, 0.08), transparent 13rem),
    var(--code-bg);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4);
}

.editor-shell::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(var(--ember), var(--sulfur), var(--acid));
  z-index: 2;
  opacity: 0.82;
}

.editor-highlight,
.editor-input {
  position: absolute;
  inset: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 0.82rem 0.92rem 0.82rem 1.05rem;
  overflow: auto;
  white-space: pre;
  font: 0.84rem/1.56 "Azeret Mono", "SFMono-Regular", monospace;
  letter-spacing: 0;
  tab-size: 2;
}

.editor-highlight {
  color: var(--code-ink);
  pointer-events: none;
}

.editor-input {
  min-height: 0;
  height: 100%;
  resize: none;
  background: transparent;
  color: transparent;
  caret-color: var(--sulfur);
  -webkit-text-fill-color: transparent;
}

.editor-input::selection {
  background: rgba(255, 79, 63, 0.38);
}

.editor-input::placeholder {
  color: rgba(247, 241, 231, 0.38);
  -webkit-text-fill-color: rgba(247, 241, 231, 0.38);
}

.tok.key {
  color: #f8c471;
}

.tok.string {
  color: #7ee2a8;
}

.tok.number {
  color: #8dc7ff;
}

.tok.boolean,
.tok.null,
.tok.keyword {
  color: #ff806f;
}

.tok.comment {
  color: #77727a;
}

.diff-output {
  max-height: 13rem;
  margin: 0;
  overflow-x: auto;
  white-space: pre-wrap;
  border: 1px solid rgba(246, 200, 95, 0.18);
  border-radius: 10px;
  background: #0b0b0e;
  color: #f4eadc;
  padding: 0.85rem;
  font: 0.78rem/1.5 "Azeret Mono", "SFMono-Regular", monospace;
}

.empty-state {
  margin: 0.3rem;
  padding: 0.85rem;
  border: 1px dashed rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

@media (max-width: 1180px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "topbar"
      "toolbar"
      "searchbar"
      "layout";
    grid-template-rows: auto auto auto minmax(0, 1fr);
  }

  .layout {
    grid-template-columns: minmax(14rem, 0.95fr) minmax(0, 1.65fr);
  }

  .search-panel {
    grid-column: 1 / -1;
    min-height: 12rem;
  }
}

@media (max-width: 820px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow-y: auto;
  }

  .shell {
    height: auto;
    max-height: none;
    min-height: 100dvh;
    padding: 0.52rem;
    overflow: visible;
  }

  .topbar {
    position: sticky;
    top: 0.5rem;
    z-index: 10;
    align-items: flex-start;
  }

  .topbar,
  .toolbar,
  .searchbar,
  .layout {
    gap: 0.52rem;
  }

  .toolbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .toolbar-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .searchbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
    overflow: visible;
  }

  .panel {
    min-height: 15rem;
  }

  .explorer-panel,
  .search-panel {
    max-height: 62dvh;
  }

  .editor-panel {
    min-height: min(72dvh, 42rem);
  }

  .panel-title.split {
    align-items: stretch;
    flex-direction: column;
  }

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

  .active-file {
    white-space: normal;
  }
}

@media (max-width: 560px) {
  .auth-shell {
    align-items: stretch;
  }

  .auth-card {
    align-self: center;
    padding: 0.9rem;
  }

  .topbar {
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .status {
    max-width: none;
    min-width: 0;
  }

  .brand-lockup {
    align-items: center;
  }

  .imp-logo {
    width: 2.25rem;
    height: 2.25rem;
  }

  .control-field {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.32rem;
  }

  .searchbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .searchbar .tool-button,
  .auth-card .primary-button {
    width: 100%;
  }

  .toolbar-actions,
  .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar-actions .tool-button:first-child,
  .actions .language-badge {
    grid-column: 1 / -1;
  }

  .panel-body {
    padding: 0.38rem;
  }

  .editor-stack {
    padding: 0.38rem;
  }

  .editor-highlight,
  .editor-input {
    font-size: 0.78rem;
  }
}
