/* Portail client Côte & Bois — direction « 1B · Éditorial teal ».
 * Feuille de style dédiée au portail : n'affecte pas l'app interne (static/dashboards/style.css).
 * Tokens repris du handoff docs/design_handoff_portail_client/README.md.
 * Polices self-hébergées (aucun appel Google Fonts) — cf. static/vendor/fonts/LICENSE.md. */

/* ------------------------------------------------------------------ polices */
@font-face {
  font-family: 'Varela Round';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../vendor/fonts/varela-round-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Varela Round';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../vendor/fonts/varela-round-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Questrial';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../vendor/fonts/questrial-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Questrial';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../vendor/fonts/questrial-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ------------------------------------------------------------------ tokens */
:root {
  color-scheme: light;
  --teal: #007F77;
  --teal-d: #006861;
  --sable: #D7BE82;
  --sable-clair: #EBDDBE;
  --sable-ink: #7A6A3E;
  --creme: #F3ECDD;
  --creme-alt: #FAF6EC;
  --blanc: #FFFFFF;
  --viewer: #26302E;
  --ink: #2C2A26;
  --titre: #1F3B37;
  --mut: #8A8070;
  --mut2: #A0967F;
  --line: #EAE0CC;
  --line-field: #E4D9C2;
  --sh-card: 0 12px 26px -20px rgba(31, 59, 55, .45);
  --sh-teal: 0 12px 22px -12px rgba(0, 127, 119, .8);
  --sh-view: 0 20px 50px -20px rgba(0, 0, 0, .5);
  --r-field: 11px;
  --r-bar: 10px;
  --r-card: 14px;
  --r-badge: 6px;
  --r-pill: 9px;
  --font: 'Questrial', 'Century Gothic', sans-serif;
  --font-titre: 'Varela Round', sans-serif;
}
* { box-sizing: border-box; }
.pt-body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--creme);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-titre); font-weight: 400; color: var(--titre); }
a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-d); }
::placeholder { color: #A99F8B; }
.pt-mut { color: var(--mut); }

/* ================================================================== AUTH (écran 1) */
.pt-auth { display: flex; min-height: 100vh; }
.pt-brandpane {
  width: 45%; max-width: 520px; flex: none; background: var(--teal); color: #fff;
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 50px; text-align: center;
}
.pt-brandpane .cernes {
  position: absolute; left: -120px; bottom: -120px; width: 520px; height: 520px;
  opacity: .16; pointer-events: none;
}
.pt-brandpane .inner { position: relative; }
.pt-brandpane .logo { width: 210px; height: auto; display: inline-block; }
.pt-rule { width: 44px; height: 2px; background: var(--sable); margin: 30px auto 26px; }
.pt-accroche { font-size: 15px; line-height: 1.6; opacity: .92; max-width: 300px; margin: 0 auto; }

.pt-formpane {
  flex: 1; background: var(--creme);
  display: flex; align-items: center; justify-content: center; padding: 50px;
}
.pt-form { width: 360px; max-width: 100%; }
.pt-form h1 { font-size: 28px; margin: 0 0 8px; }
.pt-form .lede { margin: 0 0 30px; font-size: 15px; line-height: 1.55; color: #7C7362; }
.pt-label {
  display: block; font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--teal); margin: 0 0 7px;
}
.pt-input {
  width: 100%; height: 48px; background: #fff; border: 1px solid var(--line-field);
  border-radius: var(--r-field); padding: 0 15px; color: var(--ink); font-size: 15px;
  font-family: var(--font); margin: 0 0 18px;
}
.pt-input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(0, 127, 119, .12); }
.pt-input[type="password"] { letter-spacing: 3px; }
.pt-submit {
  width: 100%; height: 50px; background: var(--teal); color: #fff; border: 0;
  border-radius: var(--r-field); font-size: 15px; letter-spacing: 1px; cursor: pointer;
  font-family: var(--font); box-shadow: var(--sh-teal); margin-top: 8px;
}
.pt-submit:hover { background: var(--teal-d); }
.pt-formlink { margin-top: 20px; font-size: 13.5px; }
.pt-msg { padding: 10px 13px; border-radius: var(--r-field); margin: 0 0 18px; font-size: 14px; }
.pt-msg.err { background: #F7E7E7; color: #A33; }
.pt-msg.ok { background: #E7F2EA; color: #2F6B39; }

/* ================================================================== APP (écrans 2 & 3) */
.pt-app { display: flex; min-height: 100vh; }

/* --- sidebar --- */
.pt-side {
  width: 248px; flex: none; background: var(--teal); color: #fff;
  display: flex; flex-direction: column; padding: 26px 20px;
}
.pt-side .logo { width: 150px; height: auto; display: block; margin: 0 auto 32px; }
.pt-sectitle {
  font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; opacity: .7; margin: 0 0 12px;
}
.pt-sectitle + .pt-sectitle, .pt-tree + .pt-sectitle { margin-top: 22px; }
.pt-proj {
  display: flex; align-items: center; gap: 9px; padding: 11px 13px; border-radius: var(--r-bar);
  font-size: 14px; color: #fff; margin: 0 0 6px; opacity: .8;
}
.pt-proj:hover { opacity: 1; color: #fff; background: rgba(255, 255, 255, .08); }
.pt-proj.on { background: rgba(255, 255, 255, .14); opacity: 1; }
.pt-proj .dot { width: 8px; height: 8px; border-radius: 2px; background: var(--sable); flex: none; }
.pt-tree { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.pt-treerow { position: relative; display: flex; align-items: center; }
.pt-tree a {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 9px 13px;
  border-radius: var(--r-pill); color: #fff; opacity: .78;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pt-tree a:hover { opacity: 1; background: rgba(255, 255, 255, .08); color: #fff; }
.pt-tree a.on { background: rgba(255, 255, 255, .14); opacity: 1; }
.pt-tree a svg { flex: none; }
/* Menu ⋯ du dossier : discret, révélé au survol de la ligne (toujours visible au clavier). */
.pt-treemore {
  position: absolute; right: 4px; border: 0; background: transparent; color: #fff; opacity: 0;
  cursor: pointer; display: flex; align-items: center; padding: 5px; border-radius: 6px;
}
.pt-treerow:hover .pt-treemore, .pt-treemore:focus { opacity: .85; }
.pt-treemore:hover { opacity: 1; background: rgba(255, 255, 255, .16); }
/* Le menu déroulant de la sidebar s'affiche en clair, au-dessus du panneau teal. */
.pt-treerow .pt-menu { right: 4px; left: auto; }
.pt-user {
  margin-top: auto; padding-top: 22px; border-top: 1px solid rgba(255, 255, 255, .18);
  display: flex; align-items: center; gap: 10px; font-size: 13px;
}
.pt-avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--sable); color: #3A3320;
  display: flex; align-items: center; justify-content: center; font-size: 11px; flex: none;
}
.pt-user .who { flex: 1; min-width: 0; }
/* display:block indispensable : text-overflow est sans effet sur un élément inline. */
.pt-user .mail { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-user .out { display: inline-block; font-size: 11px; opacity: .7; color: #fff; }
.pt-user .out:hover { opacity: 1; color: #fff; text-decoration: underline; }

/* --- zone principale --- */
.pt-main { flex: 1; background: var(--creme); display: flex; flex-direction: column; min-width: 0; }
.pt-topbar {
  height: 64px; flex: none; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 28px; gap: 12px;
}
.pt-crumb { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--mut); min-width: 0; }
.pt-crumb .cur { color: var(--titre); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-topacts { display: flex; align-items: center; gap: 12px; flex: none; }
.pt-btn {
  height: 40px; padding: 0 16px; border-radius: var(--r-bar); display: inline-flex; align-items: center;
  gap: 8px; font-size: 13.5px; font-family: var(--font); cursor: pointer; border: 0; white-space: nowrap;
}
.pt-btn.ghost { border: 1.5px solid var(--teal); color: var(--teal); background: transparent; }
.pt-btn.ghost:hover { background: rgba(0, 127, 119, .06); }
.pt-btn.solid { background: var(--teal); color: #fff; }
.pt-btn.solid:hover { background: var(--teal-d); box-shadow: var(--sh-teal); }
.pt-burger { display: none; width: 44px; height: 44px; align-items: center; justify-content: center;
  border: 0; background: transparent; cursor: pointer; margin-left: -10px; flex: none; }
.pt-topavatar { display: none; }
/* Barre d'actions repliée sous le titre en mobile (affichée dans la media query). */
.pt-mobacts { display: none; }

.pt-content { padding: 30px 28px 34px; }
.pt-content h1 { font-size: 30px; margin: 0 0 4px; }
.pt-sub { margin: 0 0 24px; font-size: 14px; color: var(--mut); }
.pt-flash { margin: 0 0 18px; }

/* --- grille de fichiers --- */
.pt-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.pt-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden;
  box-shadow: var(--sh-card); position: relative; transition: transform .12s, box-shadow .12s;
}
.pt-card:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -18px rgba(31, 59, 55, .5); }
.pt-thumb {
  height: 158px; position: relative; display: flex; align-items: center; justify-content: center;
  cursor: pointer; background: #EFE7D3; overflow: hidden;
}
.pt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Repli pour les documents sans miniature (PDF) : trame sable + libellé. */
.pt-thumb.fallback {
  background: repeating-linear-gradient(45deg, #E4D9BF, #E4D9BF 10px, #EFE7D3 10px, #EFE7D3 20px);
  color: #9A8B66; flex-direction: column; gap: 8px;
}
.pt-thumb.fallback .kind { font-size: 11px; letter-spacing: 2px; }
.pt-vbadge {
  position: absolute; top: 10px; left: 10px; background: var(--sable-clair); color: var(--sable-ink);
  font-size: 11px; padding: 2px 8px; border-radius: var(--r-badge);
}
.pt-cardbody { padding: 14px 16px; }
.pt-cardname {
  font-family: var(--font-titre); font-size: 15px; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
.pt-cardmeta { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.pt-size { font-size: 12.5px; color: var(--mut); }
.pt-cardicons { display: flex; align-items: center; gap: 12px; }
.pt-com { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--mut2); }
.pt-com.has { color: var(--teal); }
.pt-icbtn {
  border: 0; background: transparent; cursor: pointer; color: #5C5445; display: flex;
  align-items: center; padding: 2px; border-radius: 6px;
}
.pt-icbtn:hover { color: var(--teal); background: rgba(0, 127, 119, .07); }

/* --- menu ⋯ --- */
.pt-menuwrap { position: relative; }
.pt-menu {
  position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line);
  border-radius: var(--r-bar); box-shadow: 0 12px 30px -12px rgba(31, 59, 55, .4); z-index: 20;
  min-width: 178px; overflow: hidden; padding: 4px 0;
}
.pt-menu button {
  display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: transparent;
  text-align: left; padding: 9px 14px; font-size: 13.5px; font-family: var(--font);
  color: var(--ink); cursor: pointer;
}
.pt-menu button:hover { background: var(--creme-alt); color: var(--teal); }
.pt-menu button.danger:hover { background: #F7E7E7; color: #A33; }

/* --- tuile d'upload --- */
.pt-drop {
  border: 2px dashed #CDBF9E; border-radius: var(--r-card); display: flex; flex-direction: column;
  align-items: center; justify-content: center; color: var(--mut2); gap: 10px; min-height: 236px;
  cursor: pointer; text-align: center; padding: 16px; background: transparent;
  font-family: var(--font); font-size: 13.5px; line-height: 1.4;
}
.pt-drop b { color: var(--teal); font-weight: normal; }
.pt-drop.over { border-color: var(--teal); color: var(--teal); background: rgba(0, 127, 119, .05); }
.pt-drop.over svg { stroke: var(--teal); }
.pt-empty { color: var(--mut); }

/* ================================================================== DÉTAIL (écran 3) */
.pt-doc { display: flex; min-height: 100vh; }
.pt-viewer { flex: 1; background: var(--viewer); display: flex; flex-direction: column; min-width: 0; }
.pt-viewbar {
  height: 58px; flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px; border-bottom: 1px solid rgba(255, 255, 255, .1); color: #D8CFC0;
}
.pt-viewbar a, .pt-viewbar .dl { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #D8CFC0; }
.pt-viewbar a:hover, .pt-viewbar .dl:hover { color: #fff; }
.pt-viewbar .right { display: flex; align-items: center; gap: 16px; font-size: 13px; }
.pt-viewbody { flex: 1; display: flex; align-items: center; justify-content: center; padding: 34px; }
.pt-preview {
  width: 100%; max-width: 560px; border-radius: 10px; box-shadow: var(--sh-view);
  background: #333E3C; overflow: hidden;
}
.pt-preview img { width: 100%; height: auto; display: block; }
.pt-preview iframe { width: 100%; height: 70vh; border: 0; display: block; background: #fff; }
.pt-preview .none {
  aspect-ratio: 4/3; display: flex; align-items: center; justify-content: center; color: #8FA39E;
  font-size: 13px; padding: 20px; text-align: center;
}

.pt-panel { width: 392px; flex: none; background: #fff; display: flex; flex-direction: column; }
.pt-panelhead { padding: 22px 24px; border-bottom: 1px solid #F0E8D6; }
.pt-panelhead .row { display: flex; align-items: center; gap: 9px; }
.pt-panelhead .nom { font-family: var(--font-titre); font-size: 18px; color: var(--titre); }
.pt-panelhead .badge {
  background: var(--sable-clair); color: var(--sable-ink); font-size: 11px; padding: 2px 8px;
  border-radius: var(--r-badge);
}
.pt-panelhead .date { font-size: 12.5px; color: var(--mut); margin-top: 4px; }
.pt-comtitle { padding: 16px 24px 6px; font-family: var(--font-titre); font-size: 15px; color: var(--titre); }
.pt-comtitle span { color: var(--mut2); }
.pt-comlist { flex: 1; padding: 12px 24px; display: flex; flex-direction: column; gap: 18px; overflow: auto; }
.pt-comitem { display: flex; gap: 11px; }
.pt-comav {
  width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: 12px; flex: none;
}
.pt-comav.client { background: var(--teal); color: #fff; }
.pt-comav.staff { background: var(--sable-clair); color: var(--sable-ink); font-size: 11px; }
.pt-comwho { font-size: 13px; color: var(--ink); }
.pt-comwho .when { color: var(--mut2); }
.pt-comtxt { font-size: 14px; color: #3A362E; line-height: 1.5; margin-top: 4px; overflow-wrap: anywhere; }
.pt-comform { padding: 18px 24px; border-top: 1px solid #F0E8D6; flex: none; }
.pt-comform textarea {
  width: 100%; background: var(--creme-alt); border: 1px solid var(--line-field);
  border-radius: var(--r-field); padding: 12px 14px; font-size: 14px; font-family: var(--font);
  color: var(--ink); min-height: 56px; resize: vertical;
}
.pt-comform textarea:focus { outline: none; border-color: var(--teal); }
.pt-comform .pt-submit { height: 44px; margin-top: 12px; box-shadow: none; }
.pt-comform .pt-submit:hover { box-shadow: var(--sh-teal); }

/* ================================================================== responsive (390 px) */
.pt-scrim { display: none; }
@media (max-width: 860px) {
  /* --- auth : panneau de marque empilé au-dessus --- */
  .pt-auth { flex-direction: column; min-height: 100vh; }
  .pt-brandpane { width: 100%; max-width: none; padding: 46px 32px 40px; }
  .pt-brandpane .cernes { left: -90px; bottom: -90px; width: 300px; height: 300px; }
  .pt-brandpane .logo { width: 150px; }
  .pt-rule { margin: 26px auto 20px; }
  .pt-accroche { font-size: 14px; }
  .pt-formpane { padding: 30px 28px 40px; align-items: flex-start; }
  .pt-form h1 { font-size: 26px; }
  .pt-input { height: 50px; }
  .pt-submit { height: 52px; }
  .pt-formlink { text-align: center; }

  /* --- app : sidebar en tiroir --- */
  .pt-side {
    position: fixed; top: 0; left: 0; bottom: 0; width: 300px; z-index: 60;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 20px 0 50px -20px rgba(0, 0, 0, .5);
  }
  .pt-side.open { transform: translateX(0); }
  .pt-scrim {
    display: block; position: fixed; inset: 0; background: rgba(31, 59, 55, .45); z-index: 50;
    opacity: 0; pointer-events: none; transition: opacity .22s;
  }
  .pt-scrim.open { opacity: 1; pointer-events: auto; }
  .pt-burger { display: flex; }
  .pt-topavatar { display: flex; width: 34px; height: 34px; }
  .pt-topbar { height: 60px; padding: 0 16px; }
  .pt-topacts { display: none; } /* les actions passent sous le titre */
  .pt-content { padding: 22px 18px 28px; }
  .pt-content h1 { font-size: 26px; }
  .pt-mobacts { display: flex; gap: 10px; margin: 0 0 22px; }
  .pt-mobacts .pt-btn { flex: 1; height: 48px; justify-content: center; border-radius: var(--r-field); }
  .pt-grid { grid-template-columns: 1fr; gap: 14px; }
  .pt-thumb { height: 168px; }
  .pt-drop { min-height: 120px; }

  /* --- détail : empilé --- */
  .pt-doc { flex-direction: column; min-height: 0; }
  .pt-viewer { min-height: 0; }
  .pt-viewbar { padding: 0 16px; height: 56px; }
  .pt-viewbody { padding: 22px; }
  .pt-preview iframe { height: 60vh; }
  .pt-panel { width: 100%; }
  .pt-comlist { overflow: visible; }
}
