/* The shared file picker uses the Explorer palette on its own modal surface. */
.notepad-file-dialog-cover {
  position: fixed;
  inset: 0;
  z-index: 2147483500;
  display: grid;
  place-items: center;
  padding: clamp(8px, 3vw, 24px);
  background: #10182780;
}

.notepad-file-dialog {
  --explorer-surface: #fff;
  --explorer-text: #202020;
  --explorer-muted: #53647a;
  --explorer-caption: #dce3eb;
  --explorer-nav: #f2f5f8;
  --explorer-field: #fbfbfc;
  --explorer-line: #d8dde4;
  --explorer-hover: #edf4fa;
  --explorer-selected: #dcebf9;
  --explorer-side-selected: #e9eef4;
  --picker-accent: #076bb6;
  --picker-border: #aebbc9;
  --picker-danger: #b3261e;
  --picker-columns: minmax(110px, 2.2fr) minmax(92px, 1.1fr) minmax(76px, .92fr) minmax(52px, .58fr);
  position: relative;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  width: min(980px, 100%);
  height: min(626px, 100%);
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--picker-border);
  border-radius: 9px;
  background: var(--explorer-surface);
  color: var(--explorer-text);
  box-shadow: 0 20px 72px #0006;
  font: 13px/1.35 "Segoe UI Variable", "Segoe UI", Tahoma, sans-serif;
}

.notepad-file-dialog :is(button, input, select) {
  box-sizing: border-box;
  font: inherit;
  color: inherit;
}
.notepad-file-dialog [hidden] { display: none; }
.notepad-file-dialog button { cursor: pointer; }
.notepad-file-dialog button:disabled { cursor: default; opacity: .45; }
.notepad-file-dialog :is(button, input, select, [tabindex]):focus-visible {
  outline: 2px solid var(--picker-accent);
  outline-offset: -2px;
}

.notepad-file-dialog-top {
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  padding-inline-start: 14px;
  background: var(--explorer-caption);
}
.notepad-file-dialog-top strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.notepad-file-dialog .notepad-file-dialog-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 38px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 20px;
}
.notepad-file-dialog-close:hover { background: #c42b1c; color: #fff; }

.notepad-file-dialog-tools,
.notepad-file-dialog-commandbar {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding-inline: 9px;
  border-bottom: 1px solid var(--explorer-line);
}
.notepad-file-dialog-tools {
  grid-row: 2;
  min-height: 47px;
  padding-block: 6px;
  background: var(--explorer-nav);
}
.notepad-file-dialog .notepad-file-dialog-nav {
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  font-size: 17px;
}
.notepad-file-dialog-crumbs {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 72px;
  gap: 4px;
  height: 32px;
  padding-inline: 7px;
  overflow: auto hidden;
  scrollbar-width: none;
  border-radius: 5px;
  background: var(--explorer-field);
  white-space: nowrap;
}
.notepad-file-dialog-crumb {
  flex: none;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 0;
  border-radius: 3px;
  padding: 3px 6px;
  background: transparent;
  white-space: nowrap;
}
.notepad-file-dialog-search {
  flex: 0 1 226px;
  min-width: 110px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: var(--explorer-field);
}
.notepad-file-dialog-search::placeholder { color: var(--explorer-muted); opacity: 1; }
.notepad-file-dialog-commandbar { grid-row: 3; min-height: 43px; }
.notepad-file-dialog-new-folder {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 31px;
  padding: 0 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  white-space: nowrap;
}
.notepad-file-dialog :is(.notepad-file-dialog-nav, .notepad-file-dialog-crumb, .notepad-file-dialog-new-folder):hover:not(:disabled) {
  background: var(--explorer-hover);
}

.notepad-file-dialog-body {
  grid-row: 4;
  display: grid;
  grid-template-columns: clamp(144px, 22%, 205px) minmax(0, 1fr);
  min-height: 0;
}
.notepad-file-dialog-side {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 6px 4px;
  border-inline-end: 1px solid var(--explorer-line);
  scrollbar-width: thin;
}
.notepad-file-dialog-place {
  display: block;
  width: 100%;
  min-height: 32px;
  padding: 4px 9px;
  overflow: hidden;
  border: 1px solid transparent;
  background: transparent;
  text-align: start;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notepad-file-dialog-place > span:first-child,
.notepad-file-dialog-icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 18px;
  height: 18px;
  margin-inline-end: 5px;
  color: var(--picker-accent);
  vertical-align: middle;
}
.notepad-file-dialog :is(.notepad-file-dialog-icon, .notepad-file-dialog-place, .notepad-file-dialog-new-folder, .notepad-file-dialog-nav, .notepad-file-dialog-crumbs) svg {
  display: block;
  width: 16px;
  height: 16px;
  flex: none;
}
.notepad-file-dialog-place:hover { background: var(--explorer-hover); }
.notepad-file-dialog-place.active,
.notepad-file-dialog-place[aria-current="location"] {
  border-color: var(--explorer-line);
  background: var(--explorer-side-selected);
}

.notepad-file-dialog-list {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding-inline: 7px;
  scrollbar-gutter: stable;
}
.notepad-file-dialog-columns,
.notepad-file-dialog-entry {
  display: grid;
  grid-template-columns: var(--picker-columns);
  align-items: center;
  width: 100%;
  min-width: 0;
}
.notepad-file-dialog-columns {
  position: sticky;
  top: 0;
  z-index: 1;
  min-height: 28px;
  padding-inline: 1px;
  border-bottom: 1px solid var(--explorer-line);
  background: var(--explorer-surface);
  color: var(--explorer-muted);
  font-size: 12px;
}
.notepad-file-dialog-columns > span {
  align-content: center;
  min-width: 0;
  height: 100%;
  padding-inline: 6px;
  overflow: hidden;
  border-inline-end: 1px solid var(--explorer-line);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notepad-file-dialog-columns > span:last-child { border-inline-end: 0; }
.notepad-file-dialog .notepad-file-dialog-entry {
  min-height: 29px;
  padding: 1px 0;
  border: 1px solid transparent;
  background: transparent;
  text-align: start;
  font-size: 12px;
}
.notepad-file-dialog-entry:hover { background: var(--explorer-hover); }
.notepad-file-dialog-entry[aria-selected="true"] {
  border-color: var(--explorer-line);
  background: var(--explorer-selected);
}
.notepad-file-dialog-entry > span {
  min-width: 0;
  padding-inline: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notepad-file-dialog-entry-name {
  display: flex;
  align-items: center;
  min-width: 0;
}
.notepad-file-dialog-entry-name > :not(.notepad-file-dialog-icon) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notepad-file-dialog-entry.folder .notepad-file-dialog-icon { color: #b68110; }
.notepad-file-dialog-entry :is(.notepad-file-dialog-entry-date, .notepad-file-dialog-entry-kind, .notepad-file-dialog-entry-size) {
  color: var(--explorer-muted);
  font-size: 11px;
}
.notepad-file-dialog-empty {
  margin: 25px 8px;
  color: var(--explorer-muted);
  text-align: center;
}

.notepad-file-dialog-footer {
  grid-row: 5;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
  padding: 8px 10px 10px;
  border-top: 1px solid var(--explorer-line);
  background: var(--explorer-nav);
}
.notepad-file-dialog-name {
  display: flex;
  align-items: center;
  flex: 1 1 230px;
  min-width: 0;
  gap: 7px;
  white-space: nowrap;
}
.notepad-file-dialog-name input,
.notepad-file-dialog-type {
  min-width: 0;
  height: 32px;
  padding: 4px 8px;
  border: 1px solid var(--picker-border);
  border-radius: 4px;
  background: var(--explorer-field);
}
.notepad-file-dialog-name input { flex: 1; }
.notepad-file-dialog-type { max-width: 194px; font-size: 11px; }
.notepad-file-dialog-footer > button,
.notepad-file-dialog-confirm-box button {
  min-width: 76px;
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid var(--picker-border);
  border-radius: 4px;
  background: var(--explorer-field);
}
.notepad-file-dialog-footer > button:hover:not(:disabled),
.notepad-file-dialog-confirm-box button:hover:not(:disabled) { background: var(--explorer-hover); }
.notepad-file-dialog .notepad-file-dialog-footer > button.primary {
  border-color: var(--picker-accent);
  background: var(--picker-accent);
  color: #fff;
}
.notepad-file-dialog .notepad-file-dialog-footer > button.primary:hover:not(:disabled) { filter: brightness(.92); }
.notepad-file-dialog-message,
.notepad-file-dialog-hint {
  flex: 1 0 100%;
  margin: 0;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.notepad-file-dialog-hint { color: var(--explorer-muted); }
.notepad-file-dialog-message,
.notepad-file-dialog-submessage { color: var(--picker-danger); }

.notepad-file-dialog-confirm {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  background: #1824355e;
}
.notepad-file-dialog-confirm-box {
  width: min(360px, calc(100% - 30px));
  padding: 16px;
  border: 1px solid var(--picker-border);
  border-radius: 8px;
  background: var(--explorer-surface);
  box-shadow: 0 12px 45px #0004;
}
.notepad-file-dialog-confirm-box p:not(.notepad-file-dialog-submessage) {
  color: var(--explorer-muted);
  overflow-wrap: anywhere;
}
.notepad-file-dialog-confirm-box button { float: inline-end; margin-inline-start: 7px; }
.notepad-file-dialog-confirm-box button.danger { border-color: #b3261e; background: #b3261e; color: #fff; }
.notepad-file-dialog-confirm-box button.danger:hover { background: #97201a; }
.notepad-file-dialog-confirm-box label { display: grid; gap: 6px; font-weight: 600; }
.notepad-file-dialog-confirm-box input {
  min-width: 0;
  height: 32px;
  padding: 5px 8px;
  border: 1px solid var(--picker-border);
  border-radius: 4px;
  background: var(--explorer-field);
}
.notepad-file-dialog-submessage { min-height: 16px; margin: 7px 0; font-size: 12px; }

body[data-theme="dark"] .notepad-file-dialog {
  --explorer-surface: #202020;
  --explorer-text: #eee;
  --explorer-muted: #b3bcc9;
  --explorer-caption: #303844;
  --explorer-nav: #272727;
  --explorer-field: #343434;
  --explorer-line: #42454b;
  --explorer-hover: #344658;
  --explorer-selected: #263e59;
  --explorer-side-selected: #414955;
  --picker-accent: #146eac;
  --picker-border: #626978;
  --picker-danger: #ff9f99;
  color-scheme: dark;
}
body[data-theme="dark"] .notepad-file-dialog :is(button, input, select, [tabindex]):focus-visible {
  outline-color: #9aceef;
}

@media (max-width: 720px) {
  .notepad-file-dialog-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .notepad-file-dialog-side {
    display: flex;
    gap: 2px;
    padding: 4px 6px;
    border-inline-end: 0;
    border-bottom: 1px solid var(--explorer-line);
  }
  .notepad-file-dialog-place { width: auto; flex: none; }
}

@media (max-width: 510px) {
  .notepad-file-dialog { --picker-columns: minmax(0, 1fr) minmax(54px, .3fr); }
  .notepad-file-dialog-tools { flex-wrap: wrap; }
  .notepad-file-dialog .notepad-file-dialog-nav { flex-basis: 28px; }
  .notepad-file-dialog-search { flex: 1 0 100%; }
  .notepad-file-dialog-columns > :is(:nth-child(2), :nth-child(3)),
  .notepad-file-dialog-entry > :is(.notepad-file-dialog-entry-date, .notepad-file-dialog-entry-kind) { display: none; }
  .notepad-file-dialog-name { flex-basis: 100%; }
  .notepad-file-dialog-type { flex: 1; margin-inline-end: auto; }
  .notepad-file-dialog-footer > button { min-width: 64px; padding-inline: 7px; }
}
