.page {
  height: 100%;
  overflow: auto;
  padding: 2rem 2.25rem 3rem;
  color: var(--primary-text);
  background: var(--primary-bg);
}

.center { height: 100%; display: grid; place-items: center; }

.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  max-width: 1100px;
  margin: 0 auto 1.5rem;

  h1 { margin: .25rem 0 .4rem; font-size: 1.75rem; }
  p { margin: 0; color: var(--secondary-text); font-size: .82rem; line-height: 1.5; }
}

.eyebrow { color: #9d62ff; text-transform: uppercase; letter-spacing: .12em; font-size: .65rem; font-weight: 700; }

.status {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  border: 1px solid;
  border-radius: 999px;
  padding: .45rem .75rem;
  font-size: .72rem;
  font-weight: 650;
  white-space: nowrap;
}
.connected { color: #7ee787; border-color: #2d6b3a; background: #14251a; }
.disconnected { color: #d0b27a; border-color: #5d4a24; background: #251f13; }

.alert, .card, .summary {
  max-width: 1100px;
  margin: 0 auto 1rem;
}

.card {
  padding: 1.25rem;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--secondary-bg);
}

.cardHeader {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
  h2 { margin: 0 0 .25rem; font-size: 1rem; }
  p { margin: 0; color: var(--secondary-text); font-size: .72rem; }
}

.hostGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.hostChoice {
  display: flex;
  align-items: center;
  gap: .85rem;
  min-height: 80px;
  padding: 1rem;
  text-align: left;
  color: var(--primary-text);
  border: 1px solid #303030;
  border-radius: 10px;
  background: #111;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;

  > svg { color: #a16aff; font-size: 1.35rem; }
  > span { display: flex; min-width: 0; flex-direction: column; gap: .25rem; }
  strong { font-size: .84rem; }
  small { color: var(--secondary-text); font-size: .68rem; line-height: 1.4; }
  &:hover { border-color: #6e38c8; background: #15121a; }
}
.hostChoiceSelected { border-color: #9d62ff; background: #191120; box-shadow: 0 0 0 1px #9d62ff33; }

.field {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  margin-top: 1rem;
  label { display: flex; align-items: center; gap: .4rem; font-size: .75rem; font-weight: 650; }
  > small { color: var(--secondary-text); font-size: .65rem; line-height: 1.45; }

  :global(.ant-input),
  :global(.ant-select-selector) {
    min-height: 42px !important;
    color: var(--primary-text) !important;
    background: #151515 !important;
    border-color: #454545 !important;
    box-shadow: none !important;
  }

  :global(.ant-input) {
    padding-inline: .75rem;
    caret-color: #b884ff;
    -webkit-text-fill-color: var(--primary-text);

    &::placeholder {
      color: #737373 !important;
      opacity: 1;
      -webkit-text-fill-color: #737373;
    }

    &:hover { border-color: #6e6e6e !important; }
    &:focus {
      border-color: #9d62ff !important;
      box-shadow: 0 0 0 2px rgba(157, 98, 255, .16) !important;
    }
  }

  :global(.ant-select-selection-item) {
    color: var(--primary-text) !important;
    font-weight: 500;
    line-height: 40px !important;
  }

  :global(.ant-select-selection-placeholder) {
    color: #737373 !important;
    line-height: 40px !important;
  }

  :global(.ant-select-arrow) { color: #a5a5a5 !important; }

  :global(.ant-select:hover .ant-select-selector) {
    border-color: #6e6e6e !important;
  }

  :global(.ant-select-focused .ant-select-selector) {
    border-color: #9d62ff !important;
    box-shadow: 0 0 0 2px rgba(157, 98, 255, .16) !important;
  }
}
.select { width: 100%; }
.folderInputRow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .55rem;

  :global(.ant-btn) {
    min-height: 42px;
    color: #e5e5e5;
    background: #1a1a1a;
    border-color: #454545;
  }

  :global(.ant-btn:hover:not(:disabled)) {
    color: #fff !important;
    background: #242027 !important;
    border-color: #9d62ff !important;
  }
}
.selectPopup {
  padding: .3rem !important;
  color: var(--primary-text) !important;
  background: #171717 !important;
  border: 1px solid #393939;

  :global(.ant-select-item) {
    color: #d7d7d7 !important;
    border-radius: 6px;
  }

  :global(.ant-select-item-option-active:not(.ant-select-item-option-disabled)) {
    background: #242027 !important;
  }

  :global(.ant-select-item-option-selected:not(.ant-select-item-option-disabled)) {
    color: #fff !important;
    background: #30213f !important;
  }

  :global(.ant-select-item-option-disabled) { color: #686868 !important; }
  :global(.ant-empty-description) { color: var(--secondary-text) !important; }
}
.fieldError { color: #ff8e8e !important; }

.actions { display: flex; justify-content: flex-end; gap: .6rem; padding-top: 1rem; margin-top: 1rem; border-top: 1px solid var(--border-subtle); }

.summary {
  display: grid;
  grid-template-columns: .75fr 1.25fr 1.25fr;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--border-subtle);
  > div { min-width: 0; padding: .8rem 1rem; background: var(--secondary-bg); }
  span { display: block; margin-bottom: .3rem; color: var(--secondary-text); font-size: .6rem; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; }
  strong { display: block; overflow: hidden; color: var(--primary-text); font-size: .7rem; font-family: monospace; text-overflow: ellipsis; white-space: nowrap; }
}

.desktopHeader { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.desktopIntro {
  display: flex;
  align-items: center;
  gap: .8rem;
  > svg { color: #a16aff; font-size: 1.3rem; }
  h2 { margin: 0 0 .2rem; font-size: 1rem; }
  p { margin: 0; color: var(--secondary-text); font-size: .7rem; }
}
.desktopActions { display: flex; gap: .55rem; }
.desktopSetup { padding-top: 1.25rem; margin-top: 1.25rem; border-top: 1px solid var(--border-subtle); }

.directoryModal {
  :global(.ant-modal-content) {
    padding: 0;
    overflow: hidden;
    color: var(--primary-text);
    background: #101010;
    border: 1px solid #343434;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .65);
  }

  :global(.ant-modal-header) {
    margin: 0;
    padding: 1rem 1.15rem;
    background: #101010;
    border-bottom: 1px solid #2b2b2b;
  }

  :global(.ant-modal-title) { color: #f2f2f2; font-size: .95rem; }
  :global(.ant-modal-close) { color: #a5a5a5; }
  :global(.ant-modal-close:hover) { color: #fff; background: #242424; }
  :global(.ant-modal-body) { padding: 1rem 1.15rem; }
  :global(.ant-modal-footer) {
    margin: 0;
    padding: .85rem 1.15rem;
    background: #0d0d0d;
    border-top: 1px solid #2b2b2b;
  }
}

.directoryContext {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-bottom: .75rem;
  color: var(--secondary-text);
  font-size: .7rem;

  strong { color: var(--primary-text); }
  span { margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  code { color: #c8a7ff; }
}

.directoryPathRow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .5rem;

  :global(.ant-input) {
    min-height: 38px;
    color: #f0f0f0 !important;
    caret-color: #b884ff;
    background: #171717 !important;
    border-color: #454545 !important;
    -webkit-text-fill-color: #f0f0f0;
  }

  :global(.ant-input::placeholder) {
    color: #747474 !important;
    -webkit-text-fill-color: #747474;
  }

  :global(.ant-input:focus) {
    border-color: #9d62ff !important;
    box-shadow: 0 0 0 2px rgba(157, 98, 255, .16) !important;
  }

  :global(.ant-btn) { min-height: 38px; }
}

.directoryError { margin-top: .7rem; }

.directoryFilterStatus {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-top: .55rem;
  color: var(--secondary-text);
  font-size: .63rem;

  strong { color: #c8a7ff; font-weight: 600; }

  button {
    flex: 0 0 auto;
    padding: 0;
    color: #b884ff;
    font: inherit;
    border: 0;
    background: transparent;
    cursor: pointer;
  }

  button:hover { color: #d8c1ff; text-decoration: underline; }
}

.directoryToolbar {
  display: flex;
  align-items: center;
  min-height: 42px;
  margin-top: .75rem;
  padding: .25rem .35rem;
  border: 1px solid #303030;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #141414;

  :global(.ant-btn) { color: #b8b8b8; }
  :global(.ant-btn:hover:not(:disabled)) { color: #fff !important; background: #29242f !important; }
}

.directoryBreadcrumbs {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: .25rem;
  overflow-x: auto;
  padding: 0 .4rem;
  color: #696969;
  scrollbar-width: thin;

  > svg { flex: 0 0 auto; font-size: .55rem; }

  button {
    flex: 0 0 auto;
    padding: .18rem .3rem;
    color: #c7c7c7;
    font: inherit;
    font-size: .65rem;
    border: 0;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
  }

  button:hover { color: #fff; background: #2b2532; }
}

.directoryList {
  height: 330px;
  overflow-y: auto;
  padding: .35rem;
  border: 1px solid #303030;
  border-radius: 0 0 8px 8px;
  background: #0c0c0c;

  :global(.ant-empty) { margin-block: 6rem; }
  :global(.ant-empty-description) { color: var(--secondary-text); }
}

.directoryLoading {
  height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: .7rem;
  color: var(--secondary-text);
  font-size: .7rem;
}

.directoryRow {
  display: grid;
  width: 100%;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .65rem;
  padding: .65rem .7rem;
  color: #dedede;
  text-align: left;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;

  > svg:first-child { color: #b884ff; font-size: 1rem; }
  > svg:last-child { color: #696969; font-size: .65rem; }
  span { overflow: hidden; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }

  &:hover, &:focus-visible {
    color: #fff;
    outline: none;
    background: #211a28;
  }
}

@media (max-width: 760px) {
  .page { padding: 1.25rem; }
  .header, .desktopHeader { flex-direction: column; gap: .8rem; }
  .hostGrid, .summary { grid-template-columns: 1fr; }
  .actions, .desktopActions { width: 100%; flex-direction: column; }
  .actions :global(.ant-btn), .desktopActions :global(.ant-btn) { width: 100%; }
  .directoryContext { align-items: flex-start; flex-direction: column; }
  .directoryContext span { width: 100%; margin-left: 0; }
  .directoryList { height: 280px; }
}
