/* V2.4 - UNIFIED EXPLORER */
.content.explorer-content {
  overflow: hidden;
  padding: 14px
}

.unified-workspace {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(300px, 34%) minmax(0, 1fr);
  gap: 14px;
}

.explorer-pane,
.detail-pane {
  height: 100%;
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 15px;
  overflow: hidden
}

.explorer-pane {
  display: flex;
  flex-direction: column
}

.explorer-head {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  flex: 0 0 auto
}

.explorer-titleline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px
}

.explorer-titleline h2 {
  font-size: 18px;
  margin: 0
}

.explorer-search {
  width: 100%;
  margin-top: 10px;
  background: #0c1016;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 9px 10px;
  outline: none
}

.explorer-tree {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px
}

.tree-row {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border-radius: 9px;
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
}

.tree-row:hover {
  background: #1a212d
}

.tree-row.active {
  background: #202a39;
  border-color: #38465b
}

.tree-row.drop-target {
  background: #24344f;
  border-color: #5e88ff
}

.tree-row.dragging {
  opacity: .42
}

.tree-indent {
  width: 0;
  flex: 0 0 auto
}

.tree-caret {
  width: 16px;
  flex: 0 0 16px;
  text-align: center;
  color: #7f8ca2;
  font-size: 11px
}

.tree-icon {
  width: 20px;
  flex: 0 0 20px;
  text-align: center
}

.tree-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.tree-actions {
  opacity: 0;
  transition: .12s
}

.tree-row:hover .tree-actions {
  opacity: 1
}

.tree-actions button {
  border: 0;
  background: transparent;
  color: #8090a8;
  padding: 2px 5px;
  border-radius: 5px
}

.tree-actions button:hover {
  background: #2a3445;
  color: white
}

.tree-item-meta {
  font-size: 11px;
  color: #738198;
  margin-left: 4px
}

.tree-root-drop {
  margin: 8px 9px 3px;
  border: 1px dashed #37445a;
  border-radius: 9px;
  padding: 8px 10px;
  color: #7d8ca3;
  font-size: 11px
}

.tree-root-drop.drop-target {
  background: #23334d;
  border-color: #5e88ff;
  color: white
}

.detail-pane {
  display: flex;
  flex-direction: column
}

.detail-pane>#detailHost {
  height: 100%;
  min-height: 0
}

.explorer-empty {
  padding: 24px;
  color: #78869b;
  text-align: center
}

.explorer-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #69778b;
  padding: 10px 9px 5px
}

/* HOME V2.4 */
.home-v24 {
  max-width: 1380px;
  margin: 0 auto
}

.home-v24-head {
  margin-bottom: 18px
}

.home-v24-head h1 {
  font-size: 28px;
  margin: 0 0 6px
}

.home-v24-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr);
  gap: 18px
}

.home-note-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 18px;
  min-height: 540px;
  display: flex;
  flex-direction: column
}

.home-note-card textarea {
  flex: 1;
  min-height: 430px;
  width: 100%;
  resize: none;
  background: #0c1016;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  padding: 16px;
  outline: none;
  line-height: 1.55
}

.home-note-card textarea:focus {
  border-color: var(--accent)
}

.home-side {
  display: flex;
  flex-direction: column;
  gap: 14px
}

.home-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 17px
}

.home-panel h3 {
  margin: 0 0 12px;
  font-size: 15px
}

.home-section-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #10151d;
  color: var(--text);
  text-align: left
}

.home-section-btn:hover {
  background: #18202b;
  border-color: #41506a
}

.home-section-btn span:last-child {
  color: #8190a6
}

.home-tip {
  font-size: 12px;
  color: #7f8ba0;
  line-height: 1.55
}

@media(max-width:980px) {
  .unified-workspace {
    grid-template-columns: 300px minmax(0, 1fr)
  }

  .home-v24-grid {
    grid-template-columns: 1fr
  }
}

/* V2.5 - interface plus compacte */
.content.explorer-content {
  padding: 10px
}

.unified-workspace {
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 10px;
}

.explorer-head {
  padding: 11px
}

.explorer-titleline h2 {
  font-size: 16px
}

.explorer-titleline {
  align-items: flex-start;
  flex-direction: column;
}

.explorer-titleline>div:last-child {
  width: 100%;
  display: grid !important;
  grid-template-columns: 1fr;
  gap: 6px !important;
}

.explorer-titleline button {
  width: 100%;
  padding: 8px 9px;
}

.explorer-search {
  margin-top: 8px;
  padding: 8px 9px
}

.tree-row {
  min-height: 34px;
  padding-top: 5px;
  padding-bottom: 5px;
  font-size: 13px;
}

.tree-root-drop {
  margin: 6px 7px 2px;
  padding: 6px 8px;
  font-size: 10px;
}

.explorer-tree {
  padding: 6px
}

/* Accueil totalement vide */
.home-empty {
  height: 100%;
  width: 100%;
}

/* Coffre : occupation plus dense */
.vault-view-body {
  padding: 14px 16px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: auto;
  gap: 9px 10px;
}

.vault-view-body .info-box {
  grid-column: span 4;
  padding: 10px 12px;
  min-height: 68px;
}

.vault-view-body .custom-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 9px;
}

.vault-view-body .vault-notes {
  min-height: 76px;
  max-height: 115px;
}

.detail-head {
  padding: 15px 17px;
}

.detail-title h2 {
  font-size: 20px;
  margin-bottom: 4px;
}

.info-box .label {
  margin-bottom: 4px;
}

.secret-line {
  gap: 5px;
  flex-wrap: wrap;
}

.secret-line .ghost {
  padding: 6px 8px;
  min-width: 76px;
}

.vault-edit-body {
  padding: 12px 16px;
  gap: 8px 10px;
}

.vault-edit-body .field {
  grid-column: span 4;
}

.vault-edit-body .field.third {
  grid-column: span 4;
}

.vault-edit-body .field.wide,
.vault-edit-body .notes-field {
  grid-column: span 12;
}

.vault-edit-body .field input,
.vault-edit-body .field select,
.vault-edit-body .field textarea {
  padding: 8px 9px;
}

.vault-edit-footer {
  padding: 9px 16px;
}

.edit-banner {
  padding: 9px 11px;
}

@media(max-width:1150px) {
  .unified-workspace {
    grid-template-columns: 220px minmax(0, 1fr)
  }

  .vault-view-body .info-box {
    grid-column: span 6
  }

  .vault-edit-body .field,
  .vault-edit-body .field.third {
    grid-column: span 6
  }
}

/* V2.6 - Responsive auto layout */
.content.explorer-content {
  padding: 0;
}

.unified-workspace {
  grid-template-columns: clamp(190px, 18vw, 270px) minmax(0, 1fr);
  gap: clamp(8px, 1vw, 14px);
}

.explorer-head {
  padding: clamp(9px, 1vw, 14px);
}

.tree-row {
  font-size: clamp(12px, .9vw, 14px);
}

.detail-pane {
  min-width: 0;
}

/* Coffre : grille réellement adaptative */
.vault-view-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: clamp(8px, .9vw, 14px);
  padding: clamp(12px, 1.4vw, 22px);
  overflow: auto;
  align-content: start;
}

.vault-view-body .info-box,
.vault-view-body .custom-grid,
.vault-view-body .vault-notes,
.vault-view-tags {
  grid-column: auto;
}

.vault-view-body .custom-grid {
  display: contents;
}

.vault-view-body .vault-notes {
  min-height: 90px;
  max-height: none;
}

.vault-view-tags {
  grid-column: 1/-1;
}

.vault-edit-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: clamp(8px, .8vw, 12px);
  padding: clamp(10px, 1.2vw, 18px);
  overflow: auto;
  align-content: start;
}

.vault-edit-body .field,
.vault-edit-body .field.third,
.vault-edit-body .field.wide,
.vault-edit-body .notes-field,
.vault-edit-body .custom-editor {
  grid-column: auto;
}

.vault-edit-body .custom-editor,
.vault-edit-body .notes-field {
  grid-column: 1/-1;
}

.vault-edit-body #customFields {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  max-height: none;
  overflow: visible;
}

/* Accueil responsive */
.home-dashboard {
  min-height: calc(100vh - 70px);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 4vw, 70px);
}

.home-dashboard-inner {
  width: min(1180px, 100%);
}

.home-dashboard-title {
  text-align: center;
  margin-bottom: clamp(26px, 4vw, 54px);
}

.home-dashboard-title h1 {
  margin: 0 0 10px;
  font-size: clamp(30px, 4vw, 56px);
  letter-spacing: -.03em;
}

.home-dashboard-title p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(13px, 1.1vw, 17px);
}

.home-section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: clamp(14px, 2vw, 24px);
}

.home-section-card {
  min-height: clamp(210px, 24vw, 310px);
  background: linear-gradient(180deg, #151b25, #10151d);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: clamp(22px, 2.5vw, 34px);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: .18s ease;
  box-shadow: 0 14px 35px rgba(0, 0, 0, .16);
}

.home-section-card:hover {
  transform: translateY(-3px);
  border-color: #516582;
  background: linear-gradient(180deg, #192231, #121923);
}

.home-section-card-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: #202b3c;
  font-size: 25px;
}

.home-section-card h2 {
  margin: 22px 0 8px;
  font-size: clamp(21px, 1.8vw, 28px);
}

.home-section-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: clamp(12px, 1vw, 15px);
}

.home-section-card-bottom {
  margin-top: 28px;
  display: flex;
  justify-content: space-between;
  align-items: end;
}

.home-count {
  font-size: clamp(28px, 3vw, 44px);
  font-weight: 800;
  line-height: 1;
}

.home-count-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 5px;
  text-transform: uppercase;
  letter-spacing: .07em;
}

.home-arrow {
  font-size: 26px;
  color: #789cff;
}

@media(max-width:820px) {
  .unified-workspace {
    grid-template-columns: minmax(165px, 32vw) minmax(0, 1fr);
  }
}

@media(max-width:620px) {
  .unified-workspace {
    grid-template-columns: 1fr;
    height: auto;
  }

  .explorer-pane {
    max-height: 330px;
  }

  .home-dashboard {
    align-items: flex-start;
  }
}

/* V2.7 - Couleurs + dashboard stats */
:root {
  --vault: #49c58f;
  --memo: #6e94ff;
  --template: #b983ff;
  --mail: #ffb657;
  --danger2: #ff6e7a;
}

.global-tabs button[data-section="vault"].active {
  background: var(--vault);
  border-color: var(--vault);
  color: #07120d
}

.global-tabs button[data-section="memo"].active {
  background: var(--memo);
  border-color: var(--memo)
}

.global-tabs button[data-section="template"].active {
  background: var(--template);
  border-color: var(--template)
}

.dashboard {
  width: min(1380px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 2.3vw, 36px);
}

.dashboard-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 20px
}

.dashboard-head h1 {
  margin: 0 0 5px;
  font-size: clamp(24px, 2.5vw, 36px)
}

.dashboard-head p {
  margin: 0;
  color: var(--muted)
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: clamp(10px, 1.2vw, 16px);
}

.metric-card,
.dash-card {
  background: linear-gradient(180deg, #161c27, #121720);
  border: 1px solid var(--line);
  border-radius: 17px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .12)
}

.metric-card {
  grid-column: span 3;
  padding: 17px;
  min-height: 122px;
  position: relative;
  overflow: hidden
}

.metric-card:before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--metric-color, var(--accent))
}

.metric-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #8290a4
}

.metric-value {
  font-size: clamp(27px, 3vw, 40px);
  font-weight: 800;
  margin-top: 12px
}

.metric-foot {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px
}

.dash-card {
  padding: 18px
}

.dash-card h3 {
  margin: 0 0 15px;
  font-size: 15px
}

.dash-span-4 {
  grid-column: span 4
}

.dash-span-5 {
  grid-column: span 5
}

.dash-span-7 {
  grid-column: span 7
}

.dash-span-8 {
  grid-column: span 8
}

.dash-span-12 {
  grid-column: span 12
}

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 230px
}

.donut {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  position: relative;
  flex: 0 0 auto;
  background: conic-gradient(var(--vault) 0 var(--p1), var(--memo) var(--p1) var(--p2), var(--template) var(--p2) 100%)
}

.donut:after {
  content: "";
  position: absolute;
  inset: 25px;
  border-radius: 50%;
  background: #141923;
  border: 1px solid var(--line)
}

.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 2;
  text-align: center;
  font-size: 12px;
  color: var(--muted)
}

.donut-center b {
  display: block;
  color: var(--text);
  font-size: 25px
}

.legend {
  display: grid;
  gap: 10px;
  flex: 1
}

.legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px
}

.legend-name {
  display: flex;
  align-items: center;
  gap: 8px
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%
}

.bar-chart {
  height: 220px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding-top: 16px
}

.bar-col {
  flex: 1;
  min-width: 0;
  text-align: center
}

.bar-track {
  height: 170px;
  display: flex;
  align-items: flex-end;
  justify-content: center
}

.bar {
  width: min(42px, 72%);
  min-height: 3px;
  height: var(--h);
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, var(--accent2), #466bd0);
  position: relative
}

.bar-value {
  font-size: 11px;
  color: #b8c5d7;
  margin-bottom: 6px
}

.bar-label {
  font-size: 10px;
  color: #758298;
  margin-top: 7px;
  white-space: nowrap
}

.storage-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center
}

.storage-state {
  display: flex;
  gap: 12px;
  align-items: flex-start
}

.storage-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: #1d2a3a;
  font-size: 22px
}

.storage-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end
}

.backup-warning {
  color: #f6bf68
}

.backup-ok {
  color: #66d99a
}

.section-accent-vault .explorer-head {
  border-top: 3px solid var(--vault)
}

.section-accent-memo .explorer-head {
  border-top: 3px solid var(--memo)
}

.section-accent-template .explorer-head {
  border-top: 3px solid var(--template)
}

.section-accent-vault .primary {
  background: var(--vault);
  border-color: var(--vault);
  color: #06120c
}

.section-accent-memo .primary {
  background: var(--memo);
  border-color: var(--memo)
}

.section-accent-template .primary {
  background: var(--template);
  border-color: var(--template)
}

@media(max-width:1050px) {
  .metric-card {
    grid-column: span 6
  }

  .dash-span-4,
  .dash-span-5,
  .dash-span-7,
  .dash-span-8 {
    grid-column: span 12
  }
}

@media(max-width:650px) {
  .metric-card {
    grid-column: span 12
  }

  .donut-wrap {
    flex-direction: column
  }

  .storage-card {
    grid-template-columns: 1fr
  }

  .storage-actions {
    justify-content: flex-start
  }
}
