:root {
  --rust: #9d6849;
  --rust-dark: #714733;
  --rust-soft: #ead7ca;
  --mist: #e4e1d8;
  --mist-light: #f2f0e9;
  --beige: #cdbda8;
  --beige-light: #e8dfd2;
  --oak: #b8895b;
  --oak-dark: #87613e;
  --quartz: #fbfaf6;
  --ink: #29241f;
  --muted: #746b62;
  --line: #d9d0c3;
  --paper: #fffdf8;
  --wash: var(--mist-light);
  --green: var(--rust);
  --mint: var(--rust-soft);
  --orange: var(--rust);
  --red: #9e463b;
  --gold: var(--oak);
  --shadow: 0 18px 50px rgba(80, 58, 42, .12);
  --soft-shadow: 0 7px 24px rgba(80, 58, 42, .07);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--wash);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--wash); }
body.mobile-sheet-open { overflow: hidden; }
body:not(.admin-mode) .admin-only { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button, .btn { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid rgba(157, 104, 73, .25);
  outline-offset: 2px;
}

/* Bandeau terracotta inspiré de Rusty Nail */
.topbar {
  height: 80px;
  position: fixed;
  z-index: 20;
  inset: 0 0 auto 0;
  background: var(--rust);
  border-bottom: 1px solid rgba(67, 39, 26, .2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  box-shadow: 0 4px 22px rgba(83, 52, 37, .12);
}
.topbar::after {
  content: "";
  position: absolute;
  inset: auto 0 -4px;
  height: 4px;
  background: linear-gradient(90deg, var(--rust-dark) 0 24%, var(--oak) 24% 48%, var(--beige) 48% 73%, var(--mist) 73%);
}
.header-left { display: flex; align-items: center; min-width: 0; gap: 17px; }
.hub-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #fffaf4;
  text-decoration: none;
  border: 1px solid rgba(255,250,244,.28);
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 10px;
  letter-spacing: .03em;
  white-space: nowrap;
  background: rgba(255,250,244,.08);
}
.hub-back:hover { background: rgba(255,250,244,.18); }
.hub-back span { font-size: 15px; line-height: 1; }
.brand { display: flex; align-items: center; gap: 13px; color: #fffaf4; text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--quartz);
  color: var(--rust-dark);
  box-shadow: inset 0 0 0 1px rgba(55, 35, 24, .12), 0 6px 14px rgba(62, 34, 20, .15);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 23px;
}
.brand b, .brand small { display: block; }
.brand b { font-family: Georgia, "Times New Roman", serif; font-size: 18px; font-weight: 500; letter-spacing: .01em; }
.brand small { font-size: 10px; color: rgba(255, 250, 244, .76); margin-top: 2px; letter-spacing: .07em; text-transform: uppercase; }
.header-actions { display: flex; gap: 8px; }
.mobile-admin-link { display: none; text-decoration: none; }
.mobile-admin-link[hidden] { display: none !important; }
.mobile-context-action, .mobile-nav, .mobile-more-backdrop { display: none; }
.mobile-context-action[hidden], .mobile-more-backdrop[hidden] { display: none !important; }
.btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--quartz);
  padding: 10px 16px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .01em;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(63, 40, 27, .1); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--quartz); }
.btn.secondary { background: var(--quartz); border-color: var(--line); color: var(--rust-dark); }
.btn.danger { color: var(--red); border-color: #dfbdb4; background: #fff8f3; }
.btn.ghost { background: rgba(255, 250, 244, .13); border-color: rgba(255, 250, 244, .35); color: #fffaf4; }
.modal .btn.ghost { background: var(--quartz); border-color: var(--line); color: var(--ink); }

/* Navigation beige pierre */
.sidebar {
  position: fixed;
  z-index: 10;
  top: 80px;
  bottom: 0;
  left: 0;
  width: 250px;
  overflow-y: auto;
  padding: 32px 20px 24px;
  background:
    linear-gradient(rgba(255,255,255,.11), rgba(255,255,255,.11)),
    var(--beige);
  border-right: 1px solid rgba(102, 78, 57, .13);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nav-label, .eyebrow { font-size: 9px; font-weight: 850; letter-spacing: .17em; color: var(--rust-dark); }
.nav-label { padding: 0 13px 8px; opacity: .72; }
.sidebar a {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: #5d5045;
  padding: 12px 13px;
  border-radius: 11px;
  font-weight: 680;
  font-size: 13px;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.sidebar a:hover { background: rgba(255, 253, 248, .3); transform: translateX(2px); }
.sidebar a span { width: 20px; text-align: center; font-size: 17px; }
.sidebar a.active { color: var(--quartz); background: var(--rust-dark); box-shadow: 0 7px 18px rgba(94, 60, 41, .17); }
.sidebar a em { margin-left: auto; font-style: normal; font-size: 10px; background: rgba(255,255,255,.36); padding: 2px 7px; border-radius: 10px; }
.sidebar a.active em { background: rgba(255,255,255,.16); }
.sidebar-note {
  position: relative;
  overflow: hidden;
  margin-top: auto;
  border: 1px solid rgba(102, 78, 57, .18);
  border-radius: 13px;
  padding: 15px;
  background: rgba(255, 253, 248, .55);
}
.sidebar-note::before {
  content: "";
  display: block;
  height: 5px;
  margin: -15px -15px 13px;
  background: repeating-linear-gradient(90deg, var(--oak-dark) 0 1px, var(--oak) 1px 9px, #c79a6b 9px 12px);
}
.sidebar-note span { font-size: 9px; letter-spacing: .13em; font-weight: 850; color: var(--rust-dark); }
.sidebar-note p { font-size: 11px; color: #6f6258; line-height: 1.45; margin: 6px 0; }
.sidebar-note small { font-size: 11px; color: var(--rust-dark); font-weight: 750; }
.sidebar-note a { display: inline-block; margin: 3px 0 8px; color: var(--rust-dark); font-size: 11px; font-weight: 800; text-decoration: none; }

/* Toile Gray Mist avec une veine de quartz à peine visible */
main {
  position: relative;
  margin-left: 250px;
  padding: 120px 38px 54px;
  min-height: 100vh;
  max-width: 1600px;
  background-color: var(--mist-light);
  background-image:
    linear-gradient(128deg, transparent 0 46%, rgba(130, 122, 113, .035) 46.15%, transparent 46.4%),
    linear-gradient(43deg, transparent 0 72%, rgba(130, 122, 113, .026) 72.1%, transparent 72.35%);
}
.page-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 29px; }
.page-head h1, .panel h2, .modal h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: -.018em;
}
.page-head h1 { font-size: clamp(31px, 3vw, 42px); margin: 7px 0 4px; color: #332a24; }
.page-head p { margin: 0; color: var(--muted); font-size: 13px; }
.date-chip { font-size: 11px; color: var(--rust-dark); border: 1px solid var(--line); background: rgba(255,253,248,.68); padding: 9px 13px; border-radius: 999px; }
.page-actions { display: flex; align-items: center; gap: 8px; }

/* Aujourd’hui — cockpit quotidien */
.today-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: end;
  gap: 28px;
  margin-bottom: 18px;
  padding: 28px;
  border-radius: 18px;
  color: var(--quartz);
  background:
    linear-gradient(125deg, rgba(255,255,255,.05), transparent 45%),
    var(--rust-dark);
  box-shadow: 0 16px 38px rgba(83,52,37,.17);
}
.today-hero::after { content: ""; position: absolute; width: 230px; height: 230px; right: -75px; top: -110px; border: 1px solid rgba(255,255,255,.11); border-radius: 50%; box-shadow: 0 0 0 28px rgba(255,255,255,.025), 0 0 0 62px rgba(255,255,255,.02); }
.today-hero.calm { grid-template-columns: 1fr; background: linear-gradient(125deg,var(--rust-dark),#8c634c); }
.today-hero-focus { position: relative; z-index: 1; min-width: 0; }
.today-hero .eyebrow { color: var(--beige); }
.today-hero h2 { max-width: 720px; margin: 9px 0 7px; font: 400 clamp(24px,3vw,34px) Georgia,"Times New Roman",serif; line-height: 1.1; }
.today-hero p { margin: 0; color: rgba(255,250,244,.76); font-size: 11px; line-height: 1.55; }
.today-hero-actions { display: flex; align-items: center; gap: 13px; margin-top: 20px; }
.today-hero-actions .btn.secondary { color: var(--rust-dark); border-color: transparent; }
.today-hero-actions .text-link { color: var(--beige); }
.today-pulse { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3,minmax(82px,1fr)); gap: 1px; overflow: hidden; min-width: 310px; border: 1px solid rgba(255,255,255,.14); border-radius: 14px; background: rgba(255,255,255,.14); }
.today-pulse span { padding: 16px 14px; background: rgba(255,255,255,.07); text-align: center; }
.today-pulse strong, .today-pulse small { display: block; }
.today-pulse strong { font: 400 25px Georgia,"Times New Roman",serif; }
.today-pulse small { margin-top: 4px; color: rgba(255,250,244,.68); font-size: 8px; text-transform: uppercase; letter-spacing: .07em; }
.today-layout { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(285px,.8fr); align-items: start; gap: 18px; }
.today-main, .today-side { display: grid; gap: 18px; min-width: 0; }
.today-focus-panel .panel-head, .today-week .panel-head, .today-watch .panel-head, .today-activity .panel-head { align-items: end; }
.today-focus-panel .panel-head h2, .today-week .panel-head h2, .today-watch .panel-head h2, .today-activity .panel-head h2 { margin-top: 5px; }
.today-task-list { display: grid; gap: 10px; }
.today-task-card { padding: 17px; border: 1px solid #e4dbcf; border-radius: 13px; background: var(--paper); cursor: pointer; transition: transform .16s ease,border-color .16s ease,box-shadow .16s ease; }
.today-task-card:hover { transform: translateY(-2px); border-color: #c3a88e; box-shadow: var(--soft-shadow); }
.today-task-card > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.today-task-card h3 { margin: 11px 0 5px; font-size: 14px; }
.today-task-card > p { display: -webkit-box; overflow: hidden; margin: 0 0 13px; color: var(--muted); font-size: 10px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.today-task-card > footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-top: 12px; border-top: 1px solid #eee7dd; }
.today-task-card > footer > span { min-width: 0; }
.today-task-card > footer b, .today-task-card > footer small { display: block; }
.today-task-card > footer b { font-size: 10px; }
.today-task-card > footer small { overflow: hidden; margin-top: 3px; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.today-task-actions { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.today-task-actions .btn { padding: 7px 11px; font-size: 9px; }
.today-task-actions .text-link { padding: 7px 4px; }
.today-reason { display: inline-flex; align-items: center; min-height: 23px; padding: 4px 8px; border-radius: 999px; color: #66564a; background: var(--beige-light); font-size: 8px; font-weight: 830; letter-spacing: .02em; }
.today-reason.blocked, .today-reason.late { color: #7e362e; background: #f5dcd5; }
.today-reason.today, .today-reason.active { color: var(--rust-dark); background: var(--rust-soft); }
.today-reason.decision { color: #765326; background: #f4e6c9; }
.today-reason.upcoming { color: #5f5b4b; background: #e7e5da; }
.today-week-list { display: grid; }
.today-week-list article { display: grid; grid-template-columns: 48px minmax(0,1fr) auto; align-items: center; gap: 13px; padding: 12px 0; border-top: 1px solid #ebe3d9; cursor: pointer; }
.today-week-list article:first-child { border-top: 0; }
.today-week-list article:hover h3 { color: var(--rust-dark); }
.today-week-list time { width: 45px; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--mist-light); text-align: center; }
.today-week-list time b, .today-week-list time span { display: block; }
.today-week-list time b { padding: 4px; color: var(--quartz); background: var(--rust); font-size: 7px; text-transform: uppercase; }
.today-week-list time span { padding: 5px 4px; font: 400 17px Georgia,serif; }
.today-week-list small { color: var(--muted); font-size: 7px; font-weight: 800; letter-spacing: .08em; }
.today-week-list h3 { margin: 3px 0 2px; font-size: 11px; transition: color .16s ease; }
.today-week-list p { margin: 0; color: var(--muted); font-size: 8px; }
.today-watch-card { position: relative; padding: 13px 13px 13px 16px; margin-top: 9px; border: 1px solid #ead9ce; border-left: 3px solid var(--rust); border-radius: 0 12px 12px 0; background: #fff8f2; cursor: pointer; }
.today-watch-card:hover { border-color: #c9a992; }
.today-watch-card h3 { margin: 8px 0 5px; font-size: 11px; line-height: 1.35; }
.today-watch-card > small { color: var(--muted); font-size: 8px; }
.today-all-clear { display: grid; place-items: center; padding: 24px; color: var(--muted); text-align: center; }
.today-all-clear span { width: 42px; height: 42px; display: grid; place-items: center; margin-bottom: 9px; border-radius: 50%; color: var(--quartz); background: var(--rust); }
.today-all-clear b, .today-all-clear small { display: block; }
.today-all-clear b { color: var(--ink); font-size: 12px; }
.today-all-clear small { margin-top: 4px; font-size: 9px; }
.today-activity > article { display: grid; grid-template-columns: 34px minmax(0,1fr); align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid #ebe3d9; }
.today-activity > article:first-of-type { border-top: 0; }
.today-activity > article > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--rust-dark); background: var(--beige-light); font: 13px Georgia,serif; }
.today-activity > article b, .today-activity > article small { display: block; }
.today-activity > article b { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.today-activity > article small { margin-top: 4px; color: var(--muted); font-size: 8px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat, .panel { background: rgba(255, 253, 248, .9); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--soft-shadow); }
.stat { position: relative; overflow: hidden; padding: 20px; min-height: 139px; }
.stat::after { content: ""; position: absolute; width: 48px; height: 5px; border-radius: 9px; left: 20px; bottom: 0; background: var(--beige); }
.stat:nth-child(1)::after { background: var(--rust); }
.stat:nth-child(2)::after { background: var(--oak); }
.stat:nth-child(3)::after { background: var(--beige); }
.stat:nth-child(4)::after { background: var(--rust-dark); }
.stat .label { font-size: 9px; font-weight: 820; letter-spacing: .13em; color: var(--muted); }
.stat strong { font-family: Georgia, "Times New Roman", serif; display: block; font-size: 31px; margin: 11px 0 5px; font-weight: 400; color: #3e3028; }
.stat small { color: var(--muted); font-size: 11px; }
.stat .positive { color: var(--rust-dark); }
.progress { height: 5px; background: var(--beige-light); border-radius: 8px; overflow: hidden; margin-top: 12px; }
.progress i { height: 100%; display: block; background: linear-gradient(90deg, var(--oak), var(--rust)); border-radius: 8px; }
.dashboard-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; }
.panel { padding: 21px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.panel h2 { font-size: 21px; margin: 0; color: #392e27; }
.text-link { border: 0; background: none; color: var(--rust-dark); font-size: 11px; font-weight: 800; }
.task-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid #e9e2d8; cursor: pointer; }
.task-row:first-of-type { border-top: 0; }
.task-row:hover b { color: var(--rust-dark); }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--beige); box-shadow: 0 0 0 4px rgba(205,189,168,.22); }
.status-dot[data-status="Bloqué"] { background: var(--red); box-shadow: 0 0 0 4px rgba(158,70,59,.12); }
.status-dot[data-status="En cours"] { background: var(--rust); box-shadow: 0 0 0 4px rgba(157,104,73,.13); }
.status-dot[data-status="En attente"] { background: var(--oak); box-shadow: 0 0 0 4px rgba(184,137,91,.13); }
.task-row b { font-size: 13px; display: block; transition: color .16s ease; }
.task-row small { color: var(--muted); font-size: 11px; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 9px; background: var(--beige-light); color: #645346; font-size: 9px; font-weight: 800; white-space: nowrap; letter-spacing: .02em; }
.badge.Critique, .badge.Haute { background: var(--rust-soft); color: var(--rust-dark); }
.badge.done { background: #e0ded1; color: #5c5a4d; }
.alert-card { border-left: 3px solid var(--red); background: #fff5ef; padding: 13px; margin: 10px 0; border-radius: 0 10px 10px 0; }
.alert-card.decision { border-color: var(--oak); background: #fbf5e9; }
.alert-card b { font-size: 13px; }
.alert-card p { font-size: 11px; color: var(--muted); margin: 6px 0 9px; line-height: 1.45; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 15px; }
.filters input, .filters select { border: 1px solid var(--line); border-radius: 999px; background: rgba(255,253,248,.85); padding: 10px 14px; font-size: 12px; }
.filters input { min-width: 250px; }
.ticket-mobile-tools { display: none; }
.ticket-table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin: 0 2px 10px; color: var(--muted); font-size: 10px; }
.ticket-table-toolbar b { color: var(--ink); }
.ticket-table-toolbar .text-link:disabled { opacity: .38; cursor: default; }
.table-wrap { overflow: auto; background: rgba(255,253,248,.91); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--soft-shadow); }
.data-table { width: 100%; border-collapse: collapse; min-width: 940px; }
.data-table th { text-align: left; padding: 12px 13px; font-size: 9px; letter-spacing: .12em; color: var(--rust-dark); background: var(--beige-light); border-bottom: 1px solid var(--line); }
.data-table td { padding: 13px; font-size: 11px; border-bottom: 1px solid #eae3d9; vertical-align: middle; }
.data-table tbody tr { cursor: pointer; transition: background .14s ease; }
.data-table tbody tr:hover { background: #f7efe7; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .title-cell b { display: block; font-size: 12px; margin-bottom: 3px; }
.data-table .title-cell small { color: var(--muted); }
.ticket-table { min-width: 1280px; table-layout: fixed; }
.ticket-table th:nth-child(1) { width: 105px; }
.ticket-table th:nth-child(2) { width: 230px; }
.ticket-table th:nth-child(3) { width: 135px; }
.ticket-table th:nth-child(4) { width: 190px; }
.ticket-table th:nth-child(5), .ticket-table th:nth-child(6) { width: 145px; }
.ticket-table th:nth-child(7) { width: 130px; }
.ticket-table th:nth-child(8) { width: 105px; }
.ticket-table th:nth-child(9) { width: 135px; }
.column-sort { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 7px; padding: 0; border: 0; color: inherit; background: transparent; font-size: 9px; font-weight: 850; letter-spacing: .1em; text-align: left; text-transform: uppercase; }
.column-sort i { color: #a88a72; font-size: 12px; font-style: normal; }
.column-sort.active { color: var(--rust-dark); }
.column-sort.active i { color: var(--rust-dark); }
.column-filter-row th { padding: 7px 6px; background: #f1e9de; }
.column-filter-row input, .column-filter-row select { width: 100%; min-width: 0; height: 33px; padding: 6px 8px; border: 1px solid #d4c5b5; border-radius: 8px; color: #5d5045; background: rgba(255,253,248,.92); font-size: 9px; letter-spacing: 0; }
.column-filter-row input::placeholder { color: #9b8e82; }
.ticket-order-cell { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.ticket-order-cell > b { min-width: 18px; color: var(--rust-dark); font-size: 10px; }
.row-actions { display: flex; gap: 4px; }
.icon-btn { border: 0; background: transparent; font-size: 24px; color: var(--rust-dark); padding: 4px; }
.order-btn { border: 1px solid var(--line); color: var(--rust-dark); background: var(--quartz); border-radius: 50%; width: 25px; height: 25px; padding: 0; }
.order-btn:disabled { opacity: .3; cursor: default; }
.empty { text-align: center; color: var(--muted); padding: 35px; }

.gantt-shell { background: var(--paper); border: 1px solid var(--line); border-radius: 15px; overflow: auto; box-shadow: var(--soft-shadow); }
.gantt { min-width: 900px; }
.gantt-header, .gantt-row { display: grid; grid-template-columns: 260px 1fr; }
.gantt-header { background: var(--beige-light); border-bottom: 1px solid var(--line); }
.gantt-label { padding: 12px 14px; border-right: 1px solid var(--line); font-size: 10px; font-weight: 700; }
.gantt-months, .gantt-track { position: relative; min-height: 45px; background-image: linear-gradient(to right, transparent calc(100% - 1px), #e7dfd4 calc(100% - 1px)); background-size: calc(100% / var(--days)) 100%; }
.gantt-month { position: absolute; padding: 12px; font-size: 9px; color: var(--rust-dark); border-left: 1px solid var(--line); }
.gantt-row { border-bottom: 1px solid #eae3d9; cursor: pointer; }
.gantt-row:hover { background: #fcf7f0; }
.gantt-row .gantt-label { display: flex; flex-direction: column; justify-content: center; }
.gantt-row .gantt-label small { color: var(--muted); margin-top: 3px; }
.gantt-bar { position: absolute; top: 11px; height: 23px; border-radius: 999px; background: linear-gradient(90deg, var(--oak), var(--rust)); color: #fff; font-size: 9px; padding: 5px 8px; overflow: hidden; min-width: 5px; box-shadow: 0 4px 8px rgba(113,71,51,.14); }
.gantt-bar.blocked { background: var(--red); }
.gantt-bar.done { background: #928f80; }

.budget-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.budget-card { position: relative; overflow: hidden; background: var(--rust); color: white; padding: 23px; border-radius: 15px; box-shadow: var(--soft-shadow); }
.budget-card::after { content: "$"; position: absolute; right: 15px; bottom: -23px; color: rgba(255,255,255,.08); font-family: Georgia, serif; font-size: 100px; }
.budget-card:nth-child(2) { background: var(--quartz); color: var(--ink); border: 1px solid var(--line); }
.budget-card:nth-child(2)::after { color: rgba(157,104,73,.07); }
.budget-card:nth-child(3) { background: var(--beige); color: var(--ink); }
.budget-card:nth-child(3)::after { color: rgba(71,48,34,.07); }
.budget-card small { opacity: .76; font-size: 9px; letter-spacing: .1em; }
.budget-card strong { position: relative; z-index: 1; font-family: Georgia, serif; font-size: 29px; display: block; margin-top: 8px; font-weight: 400; }
.bar-split { height: 12px; border-radius: 10px; overflow: hidden; background: var(--beige-light); display: flex; margin: 15px 0; }
.bar-split i:first-child { background: var(--rust); }
.bar-split i:last-child { background: var(--oak); }
.legend { display: flex; gap: 20px; color: var(--muted); font-size: 10px; }

.blocker-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.blocker-card { background: rgba(255,253,248,.9); border: 1px solid var(--line); border-radius: 13px; padding: 17px; margin-bottom: 10px; box-shadow: var(--soft-shadow); cursor: pointer; }
.blocker-card:hover { border-color: #c3a88e; }
.blocker-card header { display: flex; justify-content: space-between; gap: 10px; }
.blocker-card h3 { font-size: 13px; margin: 0; }
.blocker-card p { color: var(--muted); font-size: 11px; line-height: 1.5; }
.blocker-card footer { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); }

/* Journal, versions et corbeille */
.journal-tabs { display: flex; gap: 7px; margin-bottom: 15px; padding: 5px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,253,248,.66); }
.journal-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 39px; padding: 8px 14px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; font-size: 10px; font-weight: 800; }
.journal-tabs button.active { color: var(--quartz); background: var(--rust-dark); box-shadow: 0 5px 13px rgba(113,71,51,.14); }
.journal-tabs span { min-width: 19px; height: 19px; display: grid; place-items: center; padding: 0 5px; border-radius: 10px; background: rgba(157,104,73,.12); font-size: 8px; }
.journal-tabs button.active span { background: rgba(255,255,255,.16); }
.journal-panel { min-width: 0; }
.journal-search { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.journal-search input { min-width: 280px; flex: 1; max-width: 540px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,253,248,.88); font-size: 11px; }
.journal-search span { color: var(--muted); font-size: 9px; }
.journal-timeline { position: relative; max-width: 950px; padding-left: 20px; }
.journal-timeline::before { content: ""; position: absolute; top: 14px; bottom: 18px; left: 22px; width: 1px; background: #cdbba8; }
.journal-event { position: relative; display: grid; grid-template-columns: 42px minmax(0,1fr); gap: 13px; margin-bottom: 12px; }
.journal-event-glyph { position: relative; z-index: 1; width: 42px; height: 42px; display: grid; place-items: center; border: 5px solid var(--mist-light); border-radius: 50%; color: var(--quartz); background: var(--rust-dark); font: 15px Georgia,"Times New Roman",serif; }
.journal-event.manual .journal-event-glyph { color: var(--rust-dark); background: var(--beige); }
.journal-event-copy { min-width: 0; padding: 15px 17px 12px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,253,248,.92); box-shadow: var(--soft-shadow); }
.journal-event-copy > header, .journal-event-copy > footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.journal-event-copy time, .journal-event-copy footer small { color: var(--muted); font-size: 8px; }
.journal-event-copy h3 { margin: 10px 0 5px; font: 400 17px Georgia,"Times New Roman",serif; }
.journal-event-copy p { margin: 0 0 10px; color: var(--muted); font-size: 10px; line-height: 1.55; white-space: pre-line; }
.journal-event-copy footer { min-height: 24px; padding-top: 8px; border-top: 1px solid #eee7dd; }
.journal-event-copy footer .text-link { padding: 4px 0; }
.version-list, .trash-list { display: grid; gap: 10px; }
.version-card, .trash-card { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 14px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,253,248,.92); box-shadow: var(--soft-shadow); }
.version-card > span { padding: 5px 8px; border-radius: 999px; color: var(--rust-dark); background: var(--rust-soft); font-size: 7px; font-weight: 850; letter-spacing: .08em; }
.version-card h3, .trash-card h3 { margin: 0 0 4px; font-size: 12px; }
.version-card p, .trash-card small { margin: 0; color: var(--muted); font-size: 9px; }
.trash-glyph { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: var(--rust-dark); background: var(--beige-light); font: 16px Georgia,serif; }
.trash-actions { display: flex; align-items: center; gap: 10px; }
.danger-text { color: var(--red); }
.journal-page-actions .btn:disabled { opacity: .4; cursor: default; transform: none; box-shadow: none; }

/* Parties prenantes */
.stakeholder-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 15px; }
.stakeholder-card { min-width: 0; overflow: hidden; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,253,248,.92); box-shadow: var(--soft-shadow); cursor: pointer; transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.stakeholder-card:hover { transform: translateY(-3px); border-color: #c3a88e; box-shadow: var(--shadow); }
.stakeholder-card > header { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 17px; border-bottom: 1px solid #ebe3d9; }
.stakeholder-avatar { width: 45px; height: 45px; display: grid; place-items: center; border-radius: 14px; color: var(--quartz); background: linear-gradient(145deg,var(--rust),var(--rust-dark)); font-family: Georgia,"Times New Roman",serif; font-size: 16px; box-shadow: 0 7px 16px rgba(113,71,51,.17); }
.stakeholder-card header h2 { overflow: hidden; margin: 4px 0 0; font: 400 19px Georgia,"Times New Roman",serif; text-overflow: ellipsis; white-space: nowrap; }
.stakeholder-card header small { display: block; overflow: hidden; color: var(--muted); font-size: 8px; font-weight: 750; letter-spacing: .05em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.stakeholder-card header em { align-self: start; padding: 5px 8px; border-radius: 999px; color: var(--rust-dark); background: var(--rust-soft); font-size: 8px; font-style: normal; font-weight: 800; white-space: nowrap; }
.stakeholder-details { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 15px 17px; }
.stakeholder-details > div, .stakeholder-details > a { min-width: 0; padding: 10px; border-radius: 10px; color: inherit; background: var(--mist-light); text-decoration: none; }
.stakeholder-details > a:hover b { color: var(--rust-dark); }
.stakeholder-details i, .stakeholder-details b { display: block; overflow-wrap: anywhere; }
.stakeholder-details i { margin-bottom: 4px; color: var(--muted); font-size: 7px; font-style: normal; font-weight: 850; letter-spacing: .1em; }
.stakeholder-details b { font-size: 10px; font-weight: 680; line-height: 1.45; }
.stakeholder-details p { grid-column: 1/-1; margin: 8px 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.stakeholder-card > footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding: 12px 17px; border-top: 1px solid #ebe3d9; color: var(--muted); font-size: 9px; }
.stakeholder-card > footer a { overflow: hidden; color: var(--rust-dark); font-weight: 750; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.stakeholder-card > footer button { flex: 0 0 auto; }
.privacy-note { margin: 0 0 18px; padding: 11px 13px; border: 1px solid #dfc7a8; border-radius: 11px; color: #70563d; background: #fbf2e5; font-size: 10px; line-height: 1.5; }
.privacy-note b { margin-right: 4px; }

/* Bibliothèque et galerie */
.drop-zone {
  min-height: 140px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 24px;
  margin-bottom: 17px;
  border: 2px dashed #c5ad96;
  border-radius: 17px;
  color: var(--rust-dark);
  background: rgba(255,253,248,.68);
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.drop-zone:hover, .drop-zone.dragging { border-color: var(--rust); background: #fff8ef; transform: translateY(-1px); }
.drop-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 15px; background: var(--rust-soft); font-size: 27px; }
.drop-zone b { display: block; font-family: Georgia, "Times New Roman", serif; font-size: 19px; font-weight: 400; color: var(--ink); }
.drop-zone p { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.library-filters { align-items: center; }
.result-count { margin-left: auto; color: var(--muted); font-size: 10px; }
.library-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 15px; }
.library-card { min-width: 0; overflow: hidden; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,253,248,.92); box-shadow: var(--soft-shadow); cursor: pointer; transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.library-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #c3a88e; }
.library-thumb { position: relative; overflow: hidden; aspect-ratio: 16/9; display: grid; place-items: center; background: var(--beige-light); color: var(--rust-dark); }
.library-thumb.link { background: var(--rust-soft); }
.library-thumb.file { background: var(--mist); }
.library-thumb img, .gallery-image img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .18s ease; }
.library-thumb img.loaded, .gallery-image img.loaded { opacity: 1; }
.library-thumb img.broken, .gallery-image img.broken { display: none; }
.image-fallback { position: absolute; color: var(--muted); font-size: 9px; letter-spacing: .18em; }
.file-glyph { font-family: Georgia, "Times New Roman", serif; font-size: clamp(28px,4vw,48px); }
.link-fallback { position: absolute; inset: 0; display: grid; place-content: center; gap: 8px; text-align: center; color: var(--rust-dark); }
.link-fallback b { font: 400 clamp(30px,4vw,50px) Georgia, serif; }
.link-fallback small { max-width: 210px; overflow: hidden; padding: 0 14px; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-overflow: ellipsis; white-space: nowrap; }
.library-thumb.has-preview .link-fallback { opacity: 0; }
.link-preview-image { position: relative; z-index: 1; }
.type-pill { position: absolute; top: 10px; left: 10px; z-index: 2; padding: 5px 8px; border-radius: 999px; color: var(--ink); background: rgba(255,253,248,.88); backdrop-filter: blur(4px); font-size: 8px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.library-card-copy { padding: 16px 17px 13px; }
.library-card-copy h3 { margin: 0 0 7px; font-family: Georgia, "Times New Roman", serif; font-size: 18px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.library-card-copy p { height: 34px; overflow: hidden; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.tag-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 11px; }
.tag-row span { border-radius: 999px; padding: 4px 7px; color: var(--rust-dark); background: var(--beige-light); font-size: 8px; }
.library-card footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding: 11px 17px; border-top: 1px solid #ebe3d9; color: var(--muted); font-size: 9px; }
.library-card footer button { padding: 3px 0; }
.empty-state { display: grid; place-items: center; text-align: center; min-height: 330px; padding: 40px 20px; border: 1px solid var(--line); border-radius: 17px; background: rgba(255,253,248,.7); color: var(--muted); }
.empty-state > span { width: 70px; height: 70px; display: grid; place-items: center; border-radius: 21px; color: var(--rust-dark); background: var(--rust-soft); font-size: 31px; }
.empty-state h2 { margin: 18px 0 7px; color: var(--ink); font-family: Georgia, "Times New Roman", serif; font-size: 23px; font-weight: 400; }
.empty-state p { margin: 0 0 18px; max-width: 440px; font-size: 11px; line-height: 1.55; }
.empty-state.compact { min-height: 260px; }
.gallery-grid { columns: 3 260px; column-gap: 15px; }
.gallery-filter-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 0 16px; }
.gallery-filter-row > small { flex: 0 0 auto; color: var(--muted); font-size: 9px; }
.gallery-filters { display: flex; flex-wrap: wrap; gap: 7px; min-width: 0; }
.gallery-filters button { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 999px; color: #66584d; background: rgba(255,253,248,.86); font-size: 9px; font-weight: 750; white-space: nowrap; }
.gallery-filters button.active { color: white; border-color: var(--rust-dark); background: var(--rust-dark); }
.gallery-filters button span { min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 5px; border-radius: 9px; background: rgba(157,104,73,.12); font-size: 8px; }
.gallery-filters button.active span { background: rgba(255,255,255,.16); }
.gallery-card { width: 100%; display: block; break-inside: avoid; overflow: hidden; padding: 0; margin: 0 0 15px; text-align: left; border: 1px solid var(--line); border-radius: 15px; background: var(--paper); box-shadow: var(--soft-shadow); transition: transform .16s ease, box-shadow .16s ease; }
.gallery-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.gallery-image { position: relative; display: grid; place-items: center; min-height: 190px; aspect-ratio: 4/3; overflow: hidden; color: var(--muted); background: var(--beige-light); }
.gallery-image i { position: absolute; font-style: normal; font-size: 9px; letter-spacing: .16em; }
.gallery-caption { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 14px; }
.gallery-caption b { overflow: hidden; font-family: Georgia, "Times New Roman", serif; font-size: 15px; font-weight: 400; white-space: nowrap; text-overflow: ellipsis; }
.gallery-caption small { flex: 0 0 auto; color: var(--muted); font-size: 8px; }
.library-file-summary { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--beige-light); }
.library-file-summary > span { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; color: var(--quartz); background: var(--rust-dark); font: 15px Georgia, serif; }
.library-file-summary b, .library-file-summary small { display: block; }
.library-file-summary b { font-size: 12px; }
.library-file-summary small { margin-top: 4px; color: var(--muted); font-size: 9px; }

.image-viewer { padding: 30px; }
.viewer-card { position: relative; overflow: hidden; width: min(1060px,100%); max-height: 92vh; display: grid; grid-template-columns: minmax(0,1.45fr) minmax(280px,.55fr); border-radius: 18px; background: var(--quartz); box-shadow: var(--shadow); }
.viewer-media { min-height: 520px; display: grid; place-items: center; overflow: hidden; background: #211f1d; }
.viewer-media img { max-width: 100%; max-height: 82vh; object-fit: contain; }
.viewer-copy { overflow: auto; padding: 46px 30px 30px; }
.viewer-copy h2 { margin: 9px 0 15px; font: 400 28px Georgia, serif; }
.viewer-copy p { min-height: 50px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.viewer-close { position: absolute; z-index: 2; top: 12px; right: 12px; width: 36px; height: 36px; border: 0; border-radius: 50%; color: var(--ink); background: rgba(255,253,248,.9); font-size: 24px; }
.viewer-ticket-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 20px 0; }
.viewer-ticket-row .badge { border: 0; cursor: pointer; }
.viewer-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.viewer-actions a { text-decoration: none; }
.muted-copy { color: var(--muted); font-size: 10px; }

/* Courriels privés */
.email-page-actions { align-items: center; }
.email-address-chip { display: grid; grid-template-columns: auto auto; gap: 2px 12px; min-width: 236px; padding: 11px 14px; text-align: left; border: 1px solid #c9b9aa; border-radius: 14px; color: var(--ink); background: rgba(255,253,248,.88); box-shadow: var(--soft-shadow); }
.email-address-chip span { grid-column: 1/-1; color: var(--muted); font-size: 8px; font-weight: 850; letter-spacing: .11em; }
.email-address-chip b { align-self: center; font-size: 12px; }
.email-address-chip i { align-self: center; justify-self: end; color: var(--rust-dark); font-size: 9px; font-style: normal; font-weight: 800; }
.email-stats { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin-bottom: 17px; }
.email-stats article { padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,253,248,.82); box-shadow: var(--soft-shadow); }
.email-stats span { display: block; color: var(--muted); font-size: 8px; font-weight: 850; letter-spacing: .1em; }
.email-stats strong { display: block; margin-top: 6px; color: var(--rust-dark); font: 400 27px Georgia, serif; }
.email-filters { align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,253,248,.64); }
.email-filters input { flex: 1; }
.email-list { display: grid; gap: 10px; }
.email-card { min-width: 0; display: grid; grid-template-columns: 46px minmax(0,1fr) auto; align-items: start; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,253,248,.92); box-shadow: var(--soft-shadow); cursor: pointer; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.email-card:hover { transform: translateY(-2px); border-color: #c5ac96; box-shadow: var(--shadow); }
.email-card-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; color: var(--rust-dark); background: var(--rust-soft); font-size: 19px; }
.email-card-copy { min-width: 0; }
.email-card-copy > header { display: flex; align-items: center; gap: 9px; }
.email-card-copy time { margin-left: auto; color: var(--muted); font-size: 9px; }
.email-card-copy h3 { overflow: hidden; margin: 8px 0 3px; font: 400 18px Georgia, serif; text-overflow: ellipsis; white-space: nowrap; }
.email-card-copy > small { display: block; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.email-card-copy > p { display: -webkit-box; overflow: hidden; margin: 10px 0; color: #62594f; font-size: 10px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.email-card-copy > footer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 13px; color: var(--muted); font-size: 8px; }
.email-status, .email-ticket-pill { display: inline-flex; align-items: center; width: fit-content; padding: 5px 8px; border-radius: 999px; font-size: 8px; font-weight: 800; }
.email-status.unclassified, .email-ticket-pill.waiting { color: #84502d; background: #f2dfc5; }
.email-status.classified, .email-ticket-pill { color: #66533f; background: var(--mist); }
.email-card-arrow { align-self: center; color: var(--rust-dark); font-size: 18px; }
.email-locked { border-style: dashed; }
.email-modal { width: min(900px,100%); }
.email-detail-meta { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-bottom: 18px; }
.email-detail-meta > span { min-width: 0; padding: 11px 12px; border-radius: 11px; background: var(--mist-light); }
.email-detail-meta small, .email-detail-meta b { display: block; }
.email-detail-meta small { margin-bottom: 4px; color: var(--muted); font-size: 8px; font-weight: 850; letter-spacing: .08em; }
.email-detail-meta b { overflow-wrap: anywhere; font-size: 10px; line-height: 1.45; }
.email-attachment-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin: 18px 0; }
.email-attachment-list > .eyebrow { grid-column: 1/-1; }
.email-attachment { min-width: 0; display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 2px 10px; padding: 10px; text-align: left; border: 1px solid var(--line); border-radius: 11px; background: #fffefa; }
.email-attachment > span { grid-row: 1/3; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: var(--rust-dark); background: var(--rust-soft); }
.email-attachment b, .email-attachment small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-attachment b { font-size: 10px; }
.email-attachment small { color: var(--muted); font-size: 8px; }
.email-body { margin-top: 18px; }
.email-conversation { position: relative; display: grid; gap: 12px; margin-top: 10px; padding-left: 22px; }
.email-conversation::before { content: ""; position: absolute; inset: 10px auto 10px 7px; width: 2px; border-radius: 2px; background: var(--beige); }
.email-message { position: relative; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: #fffefa; box-shadow: 0 4px 14px rgba(80,58,42,.05); }
.email-message::before { content: ""; position: absolute; top: 21px; left: -20px; width: 10px; height: 10px; border: 3px solid var(--quartz); border-radius: 50%; background: var(--rust); }
.email-message.mine::before { background: var(--oak); }
.email-message > header { display: grid; grid-template-columns: 36px minmax(0,1fr) auto; align-items: center; gap: 9px; }
.email-message-avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: var(--rust-dark); background: var(--rust-soft); font-size: 8px; font-weight: 900; }
.email-message.mine .email-message-avatar { color: #fff; background: var(--oak-dark); }
.email-message header b, .email-message header small { display: block; }
.email-message header b { font-size: 11px; }
.email-message header small, .email-message header time { overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.email-message details { margin-top: 10px; }
.email-message summary { width: fit-content; color: var(--rust-dark); font-size: 9px; font-weight: 800; cursor: pointer; }
.email-message pre { max-height: 42vh; overflow: auto; margin: 10px 0 0; padding: 14px; border: 1px solid #e7ded3; border-radius: 10px; color: #4c443d; background: var(--mist-light); font: 10px/1.65 Inter, ui-sans-serif, system-ui, sans-serif; white-space: pre-wrap; overflow-wrap: anywhere; }
.email-message > footer { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 10px; }
.email-message > footer > .text-link { margin-left: auto; }
.email-attachment.compact { width: min(280px,100%); grid-template-columns: 28px minmax(0,1fr); padding: 7px 9px; }
.email-attachment.compact > span { width: 28px; height: 28px; }
.email-photo { position: relative; overflow: hidden; width: min(190px,calc(50% - 4px)); aspect-ratio: 4/3; padding: 0; border: 1px solid var(--line); border-radius: 11px; color: white; background: var(--beige-light); }
.email-photo img { width: 100%; height: 100%; display: block; object-fit: cover; opacity: 0; transition: opacity .18s ease; }
.email-photo img.loaded { opacity: 1; }
.email-photo span { position: absolute; inset: auto 0 0; overflow: hidden; padding: 18px 8px 7px; color: white; background: linear-gradient(transparent,rgba(32,24,19,.78)); font-size: 7px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.ticket-email-links { display: grid; gap: 7px; }
.ticket-email-links button { min-width: 0; display: grid; grid-template-columns: 30px minmax(0,1fr) auto; align-items: center; gap: 9px; padding: 9px 10px; text-align: left; border: 1px solid var(--line); border-radius: 10px; background: #fffefa; }
.ticket-email-links span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; color: var(--rust-dark); background: var(--rust-soft); }
.ticket-email-links b { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.ticket-email-links small { color: var(--muted); font-size: 8px; }

.modal-backdrop { position: fixed; z-index: 50; inset: 0; background: rgba(48, 34, 26, .64); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(760px, 100%); max-height: 92vh; overflow: auto; background: var(--quartz); border-radius: 18px; box-shadow: var(--shadow); }
.modal > header { position: sticky; top: 0; z-index: 2; background: rgba(251,250,246,.96); display: flex; justify-content: space-between; padding: 23px 25px 16px; border-bottom: 1px solid var(--line); }
.modal h2 { margin: 6px 0 0; font-size: 25px; }
.modal form { padding: 21px 25px 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; margin-bottom: 14px; }
.field label { font-size: 10px; font-weight: 800; color: #66564a; letter-spacing: .02em; }
.field input, .field select, .field textarea { border: 1px solid #d2c4b6; border-radius: 10px; padding: 10px 11px; background: #fffefa; font-size: 12px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--rust); }
.field select[multiple] { padding: 5px; }
.field small { color: var(--muted); font-size: 9px; }
.money { position: relative; }
.money input { width: 100%; padding-right: 30px; }
.money span { position: absolute; right: 11px; top: 9px; color: var(--rust-dark); }
.modal footer { display: grid; grid-template-columns: auto 1fr auto auto; gap: 9px; padding-top: 22px; }
.modal footer .btn.primary { background: var(--rust-dark); border-color: var(--rust-dark); }
.toast { position: fixed; z-index: 99; right: 25px; bottom: 25px; background: var(--rust-dark); color: white; border-radius: 999px; padding: 12px 18px; font-size: 11px; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: none; }

@media (max-width: 820px) {
  .topbar { height: auto; min-height: 74px; padding: 10px 15px; }
  .header-left { gap: 9px; }
  .hub-back { padding: 8px 9px; }
  .brand small { display: none; }
  .header-actions .ghost { display: none; }
  .mobile-admin-link { display: inline-flex; align-items: center; color: #fffaf4; background: rgba(255,250,244,.12); border-color: rgba(255,250,244,.42); }
  .desktop-ticket-action, .sidebar { display: none !important; }
  .mobile-context-action { display: inline-flex; align-items: center; }
  .mobile-nav {
    position: fixed;
    z-index: 40;
    inset: auto 0 0;
    height: calc(72px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(4,1fr);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(102,78,57,.16);
    background: rgba(251,250,246,.96);
    box-shadow: 0 -8px 26px rgba(70,48,34,.09);
    backdrop-filter: blur(14px);
  }
  .mobile-nav a, .mobile-nav button {
    position: relative;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 5px 4px;
    border: 0;
    border-radius: 12px;
    color: #75685d;
    background: transparent;
    text-decoration: none;
  }
  .mobile-nav a.active, .mobile-nav button.active, .mobile-nav button.open { color: var(--rust-dark); background: var(--rust-soft); }
  .mobile-nav a span, .mobile-nav button > span { font-size: 19px; line-height: 1; }
  .mobile-nav small { overflow: hidden; max-width: 100%; font-size: 9px; font-weight: 760; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-nav em { position: absolute; top: 5px; right: calc(50% - 22px); min-width: 17px; height: 17px; display: grid; place-items: center; padding: 0 4px; border-radius: 10px; color: white; background: var(--red); font-size: 8px; font-style: normal; font-weight: 850; }
  .mobile-nav em[hidden], .mobile-more-grid em[hidden] { display: none !important; }
  .mobile-more-backdrop { position: fixed; z-index: 45; inset: 0; display: block; background: rgba(47,34,26,.48); backdrop-filter: blur(2px); }
  .mobile-more-sheet { position: absolute; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); overflow: auto; max-height: calc(100vh - 40px - env(safe-area-inset-bottom)); padding: 19px; border: 1px solid rgba(102,78,57,.15); border-radius: 22px; background: var(--quartz); box-shadow: 0 24px 60px rgba(49,32,22,.26); }
  .mobile-more-sheet > header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
  .mobile-more-sheet h2 { margin: 4px 0 0; font: 400 25px Georgia,serif; }
  .mobile-more-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
  .mobile-more-grid a { position: relative; min-width: 0; display: grid; grid-template-columns: 36px 1fr; align-items: center; gap: 9px; padding: 13px 11px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--paper); text-decoration: none; }
  .mobile-more-grid a.active { border-color: #c49c7f; background: var(--rust-soft); }
  .mobile-more-grid a > span { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; color: var(--rust-dark); background: var(--beige-light); font-size: 18px; font-weight: 700; }
  .mobile-more-grid b, .mobile-more-grid small { display: block; }
  .mobile-more-grid b { font-size: 12px; }
  .mobile-more-grid small { overflow: hidden; margin-top: 3px; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-more-grid em { position: absolute; top: 8px; right: 8px; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 4px; border-radius: 9px; color: white; background: var(--red); font-size: 8px; font-style: normal; font-weight: 850; }
  .mobile-account { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding: 13px 14px; border-radius: 14px; background: var(--beige-light); }
  .mobile-account small, .mobile-account b { display: block; }
  .mobile-account small { color: var(--muted); font-size: 8px; letter-spacing: .09em; }
  .mobile-account b { margin-top: 4px; font-size: 11px; }
  .mobile-account i { width: 9px; height: 9px; border-radius: 50%; background: var(--rust); box-shadow: 0 0 0 4px rgba(157,104,73,.13); }
  main { margin: 0; padding: 102px 14px calc(100px + env(safe-area-inset-bottom)); }
  .page-head { align-items: flex-start; }
  .page-head h1 { font-size: 30px; }
  .date-chip { display: none; }
  .today-page-action { display: none !important; }
  .today-hero { grid-template-columns: 1fr; align-items: stretch; gap: 20px; padding: 22px; }
  .today-hero::after { width: 180px; height: 180px; right: -80px; top: -95px; }
  .today-hero h2 { font-size: 26px; }
  .today-pulse { width: 100%; min-width: 0; }
  .today-pulse span { padding: 13px 8px; }
  .today-layout { grid-template-columns: 1fr; }
  .today-task-card > footer { align-items: flex-start; flex-direction: column; }
  .today-task-actions { width: 100%; justify-content: flex-end; }
  .today-task-actions .text-link { margin-right: auto; }
  .stats { grid-template-columns: 1fr 1fr; }
  .dashboard-grid, .blocker-grid { grid-template-columns: 1fr; }
  .budget-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .modal-backdrop { padding: 0; }
  .modal { max-height: 100vh; height: 100%; border-radius: 0; }
  .filters input { min-width: 100%; flex: 1; }
  .email-address-chip { width: 100%; min-width: 0; }
  .email-page-actions > .btn { width: 100%; }
  .email-stats { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
  .email-stats article { padding: 12px; }
  .email-card { grid-template-columns: 38px minmax(0,1fr); gap: 10px; padding: 13px; }
  .email-card-icon { width: 38px; height: 38px; border-radius: 11px; font-size: 16px; }
  .email-card-arrow { display: none; }
  .email-detail-meta, .email-attachment-list { grid-template-columns: 1fr; }
  .email-attachment-list > .eyebrow { grid-column: auto; }
  .email-modal footer { grid-template-columns: 1fr 1fr; }
  .email-modal footer > span { display: none; }
  .email-modal footer .btn { width: 100%; }
  .ticket-mobile-tools { display: block; overflow: hidden; margin: 0 0 13px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,253,248,.91); box-shadow: var(--soft-shadow); }
  .ticket-mobile-tools summary { min-height: 50px; display: flex; align-items: center; gap: 9px; padding: 12px 14px; color: var(--rust-dark); font-size: 11px; font-weight: 820; list-style: none; cursor: pointer; }
  .ticket-mobile-tools summary::-webkit-details-marker { display: none; }
  .ticket-mobile-tools summary em { min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 5px; border-radius: 10px; color: white; background: var(--rust-dark); font-size: 8px; font-style: normal; }
  .ticket-mobile-tools summary i { margin-left: auto; font-size: 17px; font-style: normal; transition: transform .16s ease; }
  .ticket-mobile-tools[open] summary { border-bottom: 1px solid var(--line); }
  .ticket-mobile-tools[open] summary i { transform: rotate(180deg); }
  .ticket-mobile-sort { display: flex; align-items: end; gap: 8px; padding: 13px 13px 8px; }
  .ticket-mobile-sort label { min-width: 0; flex: 1; }
  .ticket-mobile-sort label, .ticket-mobile-filter-grid label { display: flex; flex-direction: column; gap: 5px; }
  .ticket-mobile-sort label > span, .ticket-mobile-filter-grid label > span { color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
  .ticket-mobile-sort select, .ticket-mobile-filter-grid input, .ticket-mobile-filter-grid select { width: 100%; min-width: 0; height: 40px; padding: 8px 10px; border: 1px solid #d2c4b6; border-radius: 10px; background: #fffefa; font-size: 11px; }
  .ticket-mobile-sort .btn { min-height: 40px; padding: 8px 12px; font-size: 10px; }
  .ticket-mobile-filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 5px 13px 13px; }
  .ticket-mobile-filter-grid .wide { grid-column: 1/-1; }
  .ticket-mobile-reset { margin: 0 13px 14px; padding: 4px 0; }
  .ticket-table-toolbar { margin: 0 2px 9px; }
  .ticket-table-toolbar .text-link { min-height: 36px; }
  .ticket-table .column-filter-row { display: none; }
  .ticket-table { min-width: 1020px; }
  .header-actions .btn { padding: 9px 11px; }
  .gantt-header, .gantt-row { grid-template-columns: 210px 1fr; }
  .page-actions { flex-direction: column; align-items: stretch; }
  .page-actions .btn { padding: 9px 11px; }
  .journal-page-actions .btn.primary { display: none; }
  .journal-page-actions .btn.secondary { max-width: 142px; white-space: normal; font-size: 9px; line-height: 1.25; }
  .journal-tabs { overflow-x: auto; margin-left: -14px; margin-right: -14px; padding-left: 14px; padding-right: 14px; border-left: 0; border-right: 0; border-radius: 0; scrollbar-width: none; }
  .journal-tabs::-webkit-scrollbar { display: none; }
  .journal-tabs button { flex: 0 0 auto; }
  .journal-search input { min-width: 0; }
  .journal-timeline { padding-left: 0; }
  .journal-timeline::before { left: 17px; }
  .journal-event { grid-template-columns: 34px minmax(0,1fr); gap: 9px; }
  .journal-event-glyph { width: 34px; height: 34px; border-width: 4px; font-size: 13px; }
  .journal-event-copy { padding: 13px; }
  .journal-event-copy > header { align-items: flex-start; flex-direction: column; gap: 6px; }
  .version-card, .trash-card { grid-template-columns: auto minmax(0,1fr); padding: 13px; }
  .version-card > .btn, .trash-actions { grid-column: 1/-1; justify-self: stretch; }
  .version-card > .btn { width: 100%; }
  .trash-actions { justify-content: space-between; }
  .page-head > button[data-action="new"], .page-head > button[data-action="new-stakeholder"], .page-actions [data-pick-files], .drop-zone { display: none !important; }
  .stakeholder-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .library-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .gallery-filter-row { display: block; }
  .gallery-filter-row > small { display: block; margin-top: 8px; }
  .gallery-filters { flex-wrap: nowrap; overflow-x: auto; margin: 0 -14px; padding: 0 14px 5px; overscroll-behavior-x: contain; scrollbar-width: none; }
  .gallery-filters::-webkit-scrollbar { display: none; }
  .gallery-filters button { flex: 0 0 auto; min-height: 38px; }
  .viewer-card { max-height: 100%; grid-template-columns: 1fr; overflow: auto; }
  .viewer-media { min-height: 50vh; }
  .viewer-copy { padding: 26px 20px 24px; }
}

@media (max-width: 600px) {
  .stakeholder-grid { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
  .stats { grid-template-columns: 1fr; }
  .stat { min-height: 124px; }
  .brand b { font-size: 15px; }
  .brand-mark { width: 38px; height: 38px; }
  .hub-back b { display: none; }
  .hub-back { border-radius: 50%; width: 38px; height: 38px; padding: 0; justify-content: center; }
  .header-actions { gap: 5px; }
  .mobile-context-action { font-size: 11px; }
  .today-hero { margin-left: -2px; margin-right: -2px; padding: 20px 17px; }
  .today-hero-actions { align-items: flex-start; flex-direction: column; }
  .today-hero-actions .btn { width: 100%; }
  .today-task-card { padding: 14px; }
  .today-task-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .today-task-actions .text-link { grid-column: 1/-1; justify-self: start; }
  .today-task-actions .btn { width: 100%; min-height: 38px; }
  .today-week-list article { grid-template-columns: 45px minmax(0,1fr); }
  .today-week-list article > .badge { display: none; }
  .email-stats { grid-template-columns: 1fr 1fr; }
  .email-stats article { padding: 10px 8px; text-align: center; }
  .email-stats span { font-size: 7px; }
  .email-stats strong { font-size: 23px; }
  .email-card-copy > header { align-items: flex-start; flex-direction: column; gap: 5px; }
  .email-card-copy time { margin-left: 0; }
  .email-conversation { padding-left: 17px; }
  .email-conversation::before { left: 5px; }
  .email-message::before { left: -17px; }
  .email-message > header { grid-template-columns: 34px minmax(0,1fr); }
  .email-message header time { grid-column: 2; }
  .email-message > footer > .text-link { width: 100%; margin-left: 0; text-align: left; }
  .email-photo { width: 100%; }
  .email-modal footer { grid-template-columns: 1fr; }
  .ticket-email-links button { grid-template-columns: 30px minmax(0,1fr); }
  .ticket-email-links small { grid-column: 2; }
  .ticket-mobile-sort { align-items: stretch; flex-direction: column; }
  .ticket-mobile-filter-grid { grid-template-columns: 1fr; }
  .ticket-mobile-filter-grid .wide { grid-column: auto; }
  .modal form, .modal > header { padding-left: 16px; padding-right: 16px; }
  .library-grid { grid-template-columns: 1fr; }
  .library-card-copy p { height: auto; max-height: 34px; }
  .image-viewer { padding: 0; }
  .viewer-card { height: 100%; border-radius: 0; }
  .viewer-media { min-height: 55vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
