/* Atlas Files V2 — application layer. Core Atlas Chief remains untouched. */
[hidden] { display: none !important; }

.files-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  border-bottom: 1px solid var(--atlas-border);
  background: rgba(4, 10, 20, .92);
  backdrop-filter: blur(18px);
}
.files-topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(100%, 1200px);
  min-height: 78px;
  margin: 0 auto;
  padding: 11px clamp(18px, 4vw, 32px);
}
.files-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--atlas-text);
  text-decoration: none;
}
.files-brand__avatar {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(125, 211, 252, .38);
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 4px rgba(14, 165, 233, .06);
}
.files-brand__copy {
  display: grid;
  line-height: 1;
}
.files-brand__copy small {
  margin-bottom: 5px;
  color: #67e8f9;
  font-size: .68rem;
  font-weight: 950;
  letter-spacing: .14em;
}
.files-brand__copy strong {
  font-size: 1.08rem;
  font-weight: 950;
  letter-spacing: -.02em;
}
.files-shell {
  position: relative;
  padding-top: clamp(28px, 4vw, 38px);
}
.files-user { display: flex; align-items: center; gap: 10px; }
.files-auth-badge { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 12px; border: 1px solid rgba(52,211,153,.24); border-radius: 999px; background: rgba(16,185,129,.09); color: #bbf7d0; font-size: .78rem; font-weight: 850; }
.files-auth-badge__dot { width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 4px rgba(52,211,153,.12); }
.files-account { position: relative; }
.files-account__toggle { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 5px 9px 5px 6px; border: 1px solid var(--atlas-border); border-radius: 16px; background: rgba(255,255,255,.025); color: var(--atlas-text); cursor: pointer; }
.files-account__avatar { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 auto; border-radius: 12px; background: linear-gradient(135deg, #2563eb, #10b981); color: white; font-size: .78rem; font-weight: 950; box-shadow: 0 8px 24px rgba(37,99,235,.2); }
.files-account__copy { display: grid; min-width: 110px; text-align: left; line-height: 1.15; }
.files-account__copy strong { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; }
.files-account__copy small { margin-top: 3px; color: var(--atlas-muted); font-size: .68rem; }
.files-account__chevron { color: var(--atlas-soft); font-size: .7rem; transition: transform var(--atlas-transition); }
.files-account__toggle[aria-expanded="true"] .files-account__chevron { transform: rotate(180deg); }
.files-account__menu { position: absolute; top: calc(100% + 9px); right: 0; z-index: 80; width: min(310px, calc(100vw - 32px)); padding: 10px; border: 1px solid var(--atlas-border); border-radius: 18px; background: rgba(7,11,20,.98); box-shadow: var(--atlas-shadow-md); }
.files-account__identity { display: flex; align-items: center; gap: 11px; padding: 8px; }
.files-account__identity div { display: grid; min-width: 0; }
.files-account__identity strong, .files-account__identity small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files-account__identity small { margin-top: 3px; color: var(--atlas-muted); font-size: .75rem; }
.files-account__avatar--large { width: 44px; height: 44px; border-radius: 14px; }
.files-account__meta { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 8px; border-top: 1px solid var(--atlas-border); font-size: .76rem; }
.files-account__meta span { color: var(--atlas-muted); }
.files-account__meta i { width: 18px; color: #86efac; }
.files-account__logout { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; min-height: 42px; margin-top: 4px; border: 1px solid rgba(248,113,113,.24); border-radius: 13px; background: rgba(248,113,113,.08); color: #fecaca; font: inherit; font-weight: 850; cursor: pointer; }
.files-auth { width: min(520px, 100%); margin: 10vh auto 0; text-align: center; }
.files-auth .atlas-card__body { display: grid; justify-items: center; gap: 16px; padding: 34px; }
.files-auth img { width: 82px; height: 82px; border-radius: 24px; object-fit: cover; box-shadow: var(--atlas-shadow-primary); }
.files-auth h1 { margin: 2px 0 0; font-size: clamp(1.8rem, 5vw, 2.7rem); letter-spacing: -.055em; }
.files-auth p { max-width: 36ch; margin: 0 0 6px; }

.files-hero {
  display: flex; align-items: end; justify-content: space-between; gap: 24px;
  padding: clamp(22px, 5vw, 42px); border: 1px solid var(--atlas-border);
  border-radius: var(--atlas-radius-lg); overflow: hidden;
  background: linear-gradient(135deg, rgba(13,110,253,.19), rgba(6,12,24,.78) 56%, rgba(37,224,176,.08));
  box-shadow: var(--atlas-shadow-sm);
}
.files-hero h1 { margin: 5px 0 8px; font-size: clamp(2.15rem, 7vw, 4.8rem); line-height: .96; letter-spacing: -.07em; }
.files-hero p { margin: 0; color: var(--atlas-muted); font-size: 1.02rem; }
.files-eyebrow { color: #93c5fd; font-size: .72rem; font-weight: 950; letter-spacing: .17em; }
.files-hero__badge { display: flex; align-items: center; gap: 9px; white-space: nowrap; color: #bbf7d0; font-weight: 850; }
.files-hero__badge i { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: var(--atlas-success-soft); }

.files-stats .atlas-card__body { display: grid; gap: 7px; min-height: 132px; }
.files-stats i { color: #93c5fd; font-size: 1.15rem; }
.files-stats span { color: var(--atlas-muted); font-size: .84rem; font-weight: 800; }
.files-stats strong { margin-top: auto; font-size: clamp(1.45rem, 4vw, 2.25rem); letter-spacing: -.055em; }

.files-library__header { align-items: end; }
.files-library__header h2 { margin-top: 5px; }
.files-library__header p { margin: 6px 0 0; color: var(--atlas-muted); }
.files-filters { display: grid; grid-template-columns: minmax(230px, 1fr) minmax(160px, .55fr); gap: 10px; width: min(560px, 100%); }
.files-list { display: grid; gap: 10px; }
.files-item {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 14px;
  padding: 13px; border: 1px solid var(--atlas-border); border-radius: 18px;
  background: rgba(255,255,255,.025); transition: border-color var(--atlas-transition), transform var(--atlas-transition);
}
.files-item:hover { transform: translateY(-1px); border-color: rgba(147,197,253,.34); }
.files-item__icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--atlas-primary-soft); color: #bfdbfe; font-size: 1.2rem; }
.files-item__copy { min-width: 0; }
.files-item__copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files-item__meta { margin-top: 5px; color: var(--atlas-soft); font-size: .8rem; }
.files-item__tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.files-tag { min-height: 25px; padding: 0 8px; border: 1px solid var(--atlas-border); border-radius: 999px; background: transparent; color: #bfdbfe; font-size: .72rem; font-weight: 800; }
.files-item__actions { display: flex; gap: 7px; }
.files-item__actions .atlas-btn { width: 40px; min-height: 40px; padding: 0; border-radius: 13px; }
.files-loading { display: grid; gap: 12px; padding: 8px; }
.files-loading .atlas-skeleton { height: 68px; border-radius: 18px; }
.files-empty { min-height: 220px; }
.files-toast { position: fixed; right: 18px; bottom: 18px; z-index: 100; max-width: min(390px, calc(100% - 36px)); padding: 13px 15px; border: 1px solid rgba(248,113,113,.35); border-radius: 15px; background: rgba(49,10,15,.94); color: #fecaca; box-shadow: var(--atlas-shadow-md); }

@media (max-width: 760px) {
  .files-auth-badge, .files-account__copy { display: none; }
  .files-account__toggle { min-height: 44px; padding: 4px; }
  .files-account__chevron { display: none; }
  .files-hero { align-items: start; flex-direction: column; }
  .files-library__header { align-items: stretch; flex-direction: column; }
  .files-filters { grid-template-columns: 1fr; }
  .files-item { grid-template-columns: 44px minmax(0, 1fr); }
  .files-item__icon { width: 44px; height: 44px; border-radius: 14px; }
  .files-item__actions { grid-column: 1 / -1; justify-content: flex-end; padding-top: 3px; }
}

/* CPAP-aligned application header */
.files-topbar .files-account__toggle {
  min-height: 46px;
  border-radius: 14px;
  background: rgba(10, 20, 36, .78);
}
.files-topbar .files-account__avatar {
  border-radius: 11px;
  background: linear-gradient(135deg, #0ea5e9, #14b8a6);
}
.files-topbar .files-account__copy strong {
  font-size: .8rem;
}
.files-topbar .files-account__copy small {
  font-size: .66rem;
}
@media (max-width: 760px) {
  .files-topbar__inner {
    min-height: 68px;
    padding-inline: 14px;
  }
  .files-brand__avatar {
    width: 40px;
    height: 40px;
  }
  .files-brand__copy strong {
    font-size: 1rem;
  }
}


/* Atlas Files V2 — édition des métadonnées */
.files-edit {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--atlas-border, #20324d);
  border-radius: 20px;
  color: #f7fbff;
  background: #0b1423;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .55);
}
.files-edit::backdrop { background: rgba(2, 7, 15, .78); backdrop-filter: blur(5px); }
.files-edit__panel { display: grid; gap: 20px; padding: 24px; }
.files-edit__panel header,
.files-edit__panel footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.files-edit__panel h2 { margin: 4px 0 0; font-size: 1.45rem; }
.files-edit__panel label { display: grid; gap: 8px; font-weight: 700; }
.files-edit__panel label small { color: #91a4bf; font-weight: 400; }
.files-edit__panel footer { justify-content: flex-end; margin-top: 4px; }
.files-edit__close {
  width: 40px; height: 40px; border: 1px solid #20324d; border-radius: 12px;
  color: #dce8f8; background: #101c2e; cursor: pointer;
}
.files-edit__close:hover { border-color: #55b7ff; color: #fff; }
.files-edit .atlas-input { width: 100%; box-sizing: border-box; }
.files-item__actions button { flex: 0 0 auto; }


/* Atlas Files — couverture fonctionnelle complète */
.files-library__actions { display: flex; justify-content: flex-end; margin-left: auto; }
.files-item__description { margin: 7px 0 0; color: #a9bad0; font-size: .88rem; line-height: 1.45; }
.files-modal {
  width: min(680px, calc(100vw - 28px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid #20324d;
  border-radius: 20px;
  color: #f7fbff;
  background: #0b1423;
  box-shadow: 0 28px 90px rgba(0,0,0,.58);
}
.files-modal::backdrop { background: rgba(2,7,15,.8); backdrop-filter: blur(5px); }
.files-modal__panel { display: grid; gap: 19px; padding: 24px; overflow: auto; }
.files-modal__panel > header,
.files-modal__panel > footer { display: flex; align-items: center; gap: 12px; }
.files-modal__panel > header { justify-content: space-between; }
.files-modal__panel > footer { justify-content: flex-end; }
.files-modal__panel h2 { margin: 4px 0 0; font-size: 1.45rem; }
.files-modal__panel header p,
.files-modal__panel > p { margin: 6px 0 0; color: #9fb0c8; }
.files-modal__close {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  padding: 0;
  border: 1px solid #2a405f;
  border-radius: 50%;
  color: #dce8f8;
  background: #101c2e;
  line-height: 1;
  cursor: pointer;
}
.files-modal__close i {
  display: block;
  width: 1em;
  height: 1em;
  line-height: 1;
  text-align: center;
}
.files-modal__close:hover { border-color: #55b7ff; color: #fff; }
.files-modal__spacer { flex: 1; }
.files-field { display: grid; gap: 8px; color: #edf5ff; font-weight: 700; }
.files-field > span small,
.files-field > small { color: #8fa2bc; font-weight: 400; }
.files-field textarea { resize: vertical; min-height: 96px; }
.files-field .atlas-input,
.files-field .atlas-select { width: 100%; box-sizing: border-box; }
.files-form-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 14px; }
.files-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.files-presets button,
.files-tags-menu button {
  border: 1px solid #263a57; border-radius: 10px;
  color: #c9d8ec; background: #101c2e; cursor: pointer;
}
.files-presets button { min-height: 40px; padding: 0 14px; font-weight: 700; }
.files-presets button:hover,
.files-presets button.is-selected { border-color: #22c9b5; color: #79f2cf; background: rgba(16,116,104,.22); }
.files-duration { display: grid; grid-template-columns: 1fr 150px; gap: 10px; }
.files-tags-control { position: relative; }
.files-tags-control > div:first-child {
  display: flex; flex-wrap: wrap; align-items: center; gap: 7px;
  min-height: 48px; padding: 7px 10px;
  border: 1px solid #263a57; border-radius: 12px; background: #08111f;
}
.files-tags-control input {
  min-width: 190px; flex: 1; height: 34px; border: 0; outline: 0;
  color: #f7fbff; background: transparent;
}
.files-tags-values { display: contents; }
.files-tags-values > span {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 8px; border: 1px solid #1f5670; border-radius: 999px;
  color: #8bdcff; background: rgba(18,87,122,.22); font-size: .82rem;
}
.files-tags-values button { padding: 0; border: 0; color: inherit; background: none; cursor: pointer; }
.files-tags-menu {
  position: fixed;
  inset: auto;
  z-index: 1000;
  display: grid;
  gap: 4px;
  max-height: 230px;
  margin: 0;
  overflow: auto;
  padding: 7px;
  border: 1px solid #263a57;
  border-radius: 12px;
  background: #0b1627;
  box-shadow: 0 22px 65px rgba(0,0,0,.62);
}
.files-tags-menu::backdrop { background: transparent; }
.files-tags-menu button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 10px; text-align: left;
}
.files-tags-menu button:hover,
.files-tags-menu button.is-create { border-color: #22c9b5; color: #79f2cf; }
.files-tags-menu > small { padding: 10px; color: #8fa2bc; }
.files-relations { display: grid; gap: 10px; padding: 14px; border: 1px solid #1d2d45; border-radius: 14px; background: #08111f; }
.files-relations__head { display: flex; justify-content: space-between; gap: 10px; }
.files-relations__head span { color: #8fa2bc; font-size: .85rem; }
.files-relations article { display: flex; gap: 10px; align-items: flex-start; padding-top: 10px; border-top: 1px solid #18263a; }
.files-relations article div { display: grid; gap: 3px; }
.files-relations article small,
.files-muted { color: #8fa2bc; }
.files-warning { display: flex; gap: 10px; padding: 14px; border: 1px solid rgba(255,103,103,.35); border-radius: 12px; color: #ffb0b0; background: rgba(130,28,35,.16); }
.atlas-btn--danger { border-color: rgba(255,103,103,.45); color: #ffd3d3; background: rgba(130,28,35,.26); }
.atlas-btn--danger:hover { border-color: #ff6767; background: rgba(160,35,45,.42); }
.files-link-result { display: grid; gap: 9px; padding: 14px; border: 1px solid #1d6b61; border-radius: 13px; background: rgba(14,99,88,.16); }
.files-link-result a { overflow-wrap: anywhere; color: #7eeed0; }
.files-toast.is-error { border-color: rgba(255,103,103,.45); color: #ffd0d0; }
@media (max-width: 760px) {
  .files-library__actions { width: 100%; justify-content: stretch; }
  .files-library__actions .atlas-btn { width: 100%; }
  .files-form-grid,
  .files-duration { grid-template-columns: 1fr; }
  .files-modal__panel { padding: 19px; }
  .files-modal__panel > footer { flex-wrap: wrap; }
  .files-modal__spacer { display: none; }
  .files-modal__panel > footer .atlas-btn { flex: 1 1 auto; }
}


/* Atlas Files — interaction documentaire Atlas Chief */
.files-library__header { display:grid; grid-template-columns:minmax(180px,.7fr) minmax(420px,1.3fr); align-items:end; gap:24px; }
.files-library__header .files-filters { justify-self:end; }
.files-item { position:relative; cursor:pointer; }
.files-item:focus-visible { outline:2px solid #38bdf8; outline-offset:3px; }
.files-item__actions { position:relative; z-index:2; }
.files-tag { display:inline-flex; align-items:center; gap:6px; min-height:27px; padding:0 10px; border-color:rgba(96,165,250,.24); background:linear-gradient(180deg,rgba(30,64,175,.15),rgba(8,23,45,.48)); color:#c7ddff; }
.files-tag i { color:#60a5fa; font-size:.65rem; }
.files-tag:hover { border-color:rgba(45,212,191,.52); color:#ccfbf1; background:rgba(13,148,136,.14); }
.files-modal { width:min(720px,calc(100vw - 28px)); }
.files-editor { gap:14px; padding:0; }
.files-editor__header { position:sticky; top:0; z-index:5; padding:22px 24px 18px; border-bottom:1px solid #1d2d45; background:linear-gradient(180deg,rgba(12,25,43,.99),rgba(9,19,34,.97)); }
.files-editor__heading { display:flex; align-items:center; gap:14px; }
.files-editor__heading h2 { margin-top:2px; }
.files-editor__icon { display:grid; place-items:center; width:46px; height:46px; flex:0 0 auto; border:1px solid rgba(56,189,248,.28); border-radius:15px; color:#bae6fd; background:linear-gradient(135deg,rgba(37,99,235,.22),rgba(13,148,136,.16)); }
.files-editor__section { display:grid; gap:14px; margin-inline:24px; padding:18px; border:1px solid #1d2d45; border-radius:17px; background:rgba(7,17,31,.72); }
.files-editor__section-title { display:flex; align-items:center; min-height:24px; }
.files-editor__section-title strong { font-size:.92rem; }
.files-editor>footer { padding:4px 24px 22px; }
.files-editor>.files-relations { margin-inline:24px; }
.files-relations summary { display:flex; align-items:center; justify-content:space-between; gap:12px; cursor:pointer; list-style:none; }
.files-relations summary::-webkit-details-marker { display:none; }
.files-relations summary>span:first-child { display:inline-flex; align-items:center; gap:9px; font-weight:800; }
.files-relations[open] summary { padding-bottom:10px; border-bottom:1px solid #18263a; }
.files-tags-control>.files-tags-input { display:flex; flex-wrap:wrap; align-items:center; gap:7px; min-height:52px; padding:7px 11px; border:1px solid #263a57; border-radius:14px; background:#07111f; transition:border-color var(--atlas-transition),box-shadow var(--atlas-transition); }
.files-tags-control>.files-tags-input:focus-within { border-color:#2689ff; box-shadow:0 0 0 3px rgba(38,137,255,.15); }
.files-tags-input>i { color:#64748b; }
.files-tags-values { display:flex; flex-wrap:wrap; gap:6px; }
.files-tags-values>span { padding:6px 9px; border-color:rgba(45,212,191,.28); color:#ccfbf1; background:linear-gradient(180deg,rgba(13,148,136,.2),rgba(8,60,69,.18)); }
.files-tags-values>span>i { color:#5eead4; font-size:.64rem; }
.files-tags-menu { padding:6px; border-radius:14px; max-height:230px; }
.files-tags-menu button { min-height:40px; border-color:transparent; border-radius:10px; }
.files-tags-menu button:hover,
.files-tags-menu button.is-active { border-color:rgba(56,189,248,.28); background:rgba(37,99,235,.16); color:#e0f2fe; }
.files-tags-menu button.is-create { background:rgba(13,148,136,.1); }
@media(max-width:760px) {
 .files-library__header { grid-template-columns:1fr; gap:16px; }
 .files-library__header .files-filters { justify-self:stretch; }
 .files-item::after { display:none; }
 .files-editor__header { padding:18px; }
 .files-editor__icon { display:none; }
 .files-editor__section,.files-editor>.files-relations { margin-inline:18px; }
 .files-editor__section { padding:15px; }
 .files-editor>footer { padding-inline:18px; }
}
