/* Ganache — thème chocolaterie */
:root {
  --cocoa: #2E1C13;
  --ganache: #4A2E20;
  --praline: #6B4226;
  --caramel: #C68B59;
  --caramel-soft: #F3E3D3;
  --cream: #F8F2EA;
  --paper: #FFFDFA;
  --line: #E6DACC;
  --text: #2B1D14;
  --muted: #8A7563;
  --gold: #B8862F;
  --ok: #3F7D4E;
  --ok-soft: #E3F1E6;
  --warn: #B7791F;
  --warn-soft: #FDF1DC;
  --danger: #B23A2E;
  --danger-soft: #FBE5E1;
  --info-soft: #E6EEF6;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(46, 28, 19, .06), 0 4px 16px rgba(46, 28, 19, .06);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar: 232px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--sans); color: var(--text); background: var(--cream); font-size: 15px; line-height: 1.45; }
a { color: var(--praline); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; color: var(--cocoa); letter-spacing: -.01em; margin: 0 0 .4em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
small, .muted { color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); flex: 0 0 var(--sidebar); background: var(--cocoa); color: #EBDCCB;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, var(--caramel), #7A4B2C);
  display: grid; place-items: center; font-family: var(--serif); font-size: 20px; color: #fff; box-shadow: inset 0 -3px 0 rgba(0,0,0,.18); }
.brand b { font-family: var(--serif); font-size: 1.25rem; display: block; line-height: 1; }
.brand small { color: #BFA48B; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: #E5D3C0;
  text-decoration: none; font-size: .95rem; position: relative; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(198,139,89,.22); color: #fff; }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--caramel); }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav .badge { margin-left: auto; }
.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.08); padding-top: 12px; }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 10px; color: #fff; text-decoration: none; }
.me small { color: #BFA48B; display: block; font-size: .75rem; }
.linkbtn { background: none; border: 0; color: #BFA48B; cursor: pointer; padding: 6px 10px; font: inherit; font-size: .85rem; }
.linkbtn:hover { color: #fff; }
.main { flex: 1; min-width: 0; padding: 26px 32px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 0; color: var(--muted); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- composants ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.stack > * + * { margin-top: 10px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--paper); color: var(--text);
  padding: 8px 14px; border-radius: 9px; font: inherit; font-size: .9rem; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .12s, border-color .12s; }
.btn:hover { border-color: var(--caramel); background: #fff; }
.btn-primary { background: var(--praline); border-color: var(--praline); color: #fff; }
.btn-primary:hover { background: var(--ganache); border-color: var(--ganache); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: .82rem; border-radius: 7px; }
.btn svg { width: 16px; height: 16px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px; font-size: .72rem; font-weight: 700; background: var(--caramel); color: #fff; }
.badge[hidden] { display: none; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: .78rem;
  border: 1px solid rgba(0,0,0,.06); background: var(--caramel-soft); color: var(--ganache); white-space: nowrap; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-muted { background: #EFEAE4; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; border: 1px solid rgba(0,0,0,.12); }
.swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; border: 1px solid rgba(0,0,0,.12); vertical-align: -2px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 700;
  font-size: .85rem; flex: none; position: relative; text-transform: uppercase; }
.avatar.sm { width: 26px; height: 26px; font-size: .72rem; }
.avatar.lg { width: 44px; height: 44px; font-size: 1rem; }
.avatar .online { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; background: #3FBF5F; border: 2px solid var(--paper); }

.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid transparent; }
.flash-success { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--danger-soft); color: var(--danger); }
.flash-info { background: var(--info-soft); color: #2B5276; }

/* ---------- tableaux ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em;
  padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.inactive td { opacity: .5; }
.table-wrap { overflow-x: auto; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- formulaires ---------- */
label { font-size: .85rem; font-weight: 600; color: var(--ganache); display: block; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.field small { display: block; margin-top: 3px; font-weight: 400; }
input:not([type]), input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=time],
input[type=search], input[type=tel], select, textarea {
  width: 100%; font: inherit; padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(198,139,89,.35); border-color: var(--caramel); }
input[type=color] { width: 44px; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
.check { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; color: var(--text); cursor: pointer; margin: 0; }
.check input { width: 16px; height: 16px; accent-color: var(--praline); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0 16px; }
.form-grid .row input { min-width: 0; flex: 1; padding-left: 8px; padding-right: 6px; }
.form-grid .row { gap: 6px; }
.hours-table td { padding: 5px 6px; }
.hours-table input[type=time] { width: 110px; padding: 6px 8px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 10px; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: radial-gradient(circle at 30% 20%, #6B4226 0, #3A2418 45%, #22140D 100%); color: #F3E3D3; padding: 48px;
  display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art h1 { color: #fff; font-size: 2.6rem; max-width: 12ch; line-height: 1.1; }
.login-art p { max-width: 38ch; color: #D9C3AD; }
.login-art .squares { position: absolute; right: -40px; bottom: -40px; display: grid; grid-template-columns: repeat(4, 70px); gap: 8px; opacity: .55; transform: rotate(-12deg); }
.login-art .squares span { height: 70px; border-radius: 10px; background: linear-gradient(145deg, #7A4B2C, #4A2E20); box-shadow: inset 0 -6px 0 rgba(0,0,0,.25), inset 0 2px 0 rgba(255,255,255,.08); }
.login-form { display: grid; place-items: center; padding: 32px; background: var(--paper); }
.login-form form { width: 100%; max-width: 340px; }

/* ---------- tableau de bord ---------- */
.shop-card { border-left: 5px solid var(--c, var(--caramel)); }
.shop-card .staff { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.shop-card .staff div { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.shop-card .staff span.t { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; font-size: .82rem; }
.my-week { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.my-day { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; }
.my-day.today { border-color: var(--caramel); box-shadow: 0 0 0 2px rgba(198,139,89,.2); }
.my-day h4 { margin: 0 0 6px; font-size: .85rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.my-day .seg { border-radius: 7px; padding: 5px 8px; font-size: .84rem; margin-top: 4px; color: #2B1D14; }
.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-list li { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: .9rem; }
.alert-list li:last-child { border-bottom: 0; }
.bar { height: 6px; border-radius: 4px; background: #EFE6DC; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--caramel); border-radius: 4px; }
.bar.over > i { background: var(--danger); }

/* ---------- planning ---------- */
.planning-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.week-nav { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--paper); }
.week-nav a { padding: 7px 12px; text-decoration: none; color: var(--text); border-right: 1px solid var(--line); }
.week-nav a:last-child { border-right: 0; }
.week-nav a:hover { background: var(--caramel-soft); }
.palette { position: sticky; top: 0; z-index: 30; background: rgba(248, 242, 234, .96); backdrop-filter: blur(4px);
  padding: 10px 0; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.palette .lbl { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-right: 4px; }
.tool { border: 2px solid transparent; border-radius: 9px; padding: 5px 11px; font: inherit; font-size: .85rem; cursor: pointer;
  background: var(--c, #eee); color: #2B1D14; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.tool.active { border-color: var(--cocoa); box-shadow: 0 0 0 2px rgba(46,28,19,.15); }
.tool.eraser { background: #fff; }
.save-state { font-size: .8rem; color: var(--muted); min-width: 110px; }
.pgrid-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); max-height: calc(100vh - 220px); }
table.pgrid { border-collapse: separate; border-spacing: 0; font-size: .78rem; user-select: none; }
.pgrid th, .pgrid td { border-right: 1px solid #EFE6DC; border-bottom: 1px solid #EFE6DC; padding: 0; text-align: center; }
.pgrid thead th { position: sticky; background: var(--paper); z-index: 5; }
.pgrid thead tr.days th { top: 0; height: 30px; font-family: var(--serif); font-size: .92rem; color: var(--cocoa); border-right: 2px solid var(--line); }
.pgrid thead tr.days th.holiday { background: #FFF6D6; }
.pgrid thead tr.emps th { top: 30px; height: 46px; min-width: 52px; max-width: 52px; font-weight: 600; font-size: .72rem; cursor: pointer; }
.pgrid thead tr.emps th .n { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 3px; }
.pgrid thead tr.emps th .bar-c { display: block; height: 4px; margin: 4px 6px 0; border-radius: 2px; }
.pgrid thead tr.emps th.day-end, .pgrid td.day-end { border-right: 2px solid var(--line); }
.pgrid th.slot { position: sticky; left: 0; z-index: 6; background: var(--paper); min-width: 118px; text-align: right; padding: 0 10px;
  font-weight: 500; color: var(--ganache); white-space: nowrap; border-right: 2px solid var(--line); }
.pgrid thead th.slot { z-index: 8; }
.pgrid tr.midi th.slot { color: var(--muted); font-style: italic; }
.pgrid tr.midi td { background-image: repeating-linear-gradient(45deg, transparent 0 5px, rgba(0,0,0,.025) 5px 10px); }
.pgrid td.c { height: 26px; min-width: 52px; cursor: crosshair; position: relative; font-variant-numeric: tabular-nums; color: rgba(43,29,20,.75); }
.pgrid td.c.closed { background: repeating-linear-gradient(-45deg, #F6F1EB 0 4px, #FBF8F4 4px 8px); }
.pgrid td.c:hover { outline: 2px solid var(--cocoa); outline-offset: -2px; z-index: 2; }
.pgrid td.c.code { font-weight: 700; font-size: .66rem; letter-spacing: .03em; color: rgba(0,0,0,.55); }
.pgrid td.c.ro { cursor: default; }
.pgrid td.c.ro:hover { outline: 0; }
.pgrid td.c.me-col { box-shadow: inset 2px 0 0 rgba(198,139,89,.5), inset -2px 0 0 rgba(198,139,89,.5); }
.pgrid tr.total th, .pgrid tr.total td { position: sticky; bottom: 0; background: #FBF5EE; font-weight: 700; height: 28px; z-index: 4; }
.pgrid tr.total th.slot { z-index: 7; }
.pgrid tr.total td.over { color: var(--danger); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); align-items: center; }
.week-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.week-summary .ws { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff; font-size: .86rem; }
.week-summary .ws b { font-variant-numeric: tabular-nums; }
.coverage { font-size: .86rem; }
.coverage li { padding: 5px 0; }
.note-input { min-height: 38px; resize: vertical; }

/* ---------- annualisation ---------- */
table.annual { border-collapse: separate; border-spacing: 0; font-size: .82rem; }
.annual th, .annual td { border-bottom: 1px solid #EFE6DC; border-right: 1px solid #EFE6DC; padding: 4px 8px; text-align: center; white-space: nowrap; }
.annual thead th { position: sticky; top: 0; background: var(--paper); z-index: 3; font-weight: 600; }
.annual thead tr:nth-child(2) th { top: 31px; font-weight: 500; font-size: .74rem; color: var(--muted); }
.annual td.m { font-weight: 700; color: var(--praline); text-align: left; background: #FBF5EE; position: sticky; left: 0; z-index: 2; }
.annual td.w { color: var(--muted); position: sticky; left: 92px; background: var(--paper); z-index: 2; }
.annual td.v { font-variant-numeric: tabular-nums; min-width: 58px; }
.annual td.v.edit { cursor: pointer; }
.annual td.v.edit:hover { outline: 2px solid var(--caramel); outline-offset: -2px; }
.annual td.v.ov { background: #FFF2CC; font-style: italic; }
.annual td.v.tot { font-weight: 700; }
.annual td.v.low { color: var(--warn); }
.annual td.v.high { color: var(--danger); }
.annual tr.current td { background: #FDF3E7; }
.annual tfoot td { font-weight: 700; background: #FBF5EE; position: sticky; bottom: 0; }
.annual tfoot td.lbl { text-align: left; }

/* ---------- chat ---------- */
.chat-page .main { padding: 0; }
.chat { display: grid; grid-template-columns: 340px 1fr; height: 100vh; background: var(--paper); }
.chat-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--paper); }
.chat-list-head { padding: 16px 16px 10px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); }
.chat-list-head .row { justify-content: space-between; }
.conv-list { overflow-y: auto; flex: 1; }
.conv { display: flex; gap: 11px; padding: 11px 16px; cursor: pointer; border-bottom: 1px solid #F3ECE3; align-items: center; }
.conv:hover { background: #FBF5EE; }
.conv.active { background: var(--caramel-soft); }
.conv .body { flex: 1; min-width: 0; }
.conv .top { display: flex; justify-content: space-between; gap: 8px; }
.conv .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .time { font-size: .74rem; color: var(--muted); flex: none; }
.conv .time.unread { color: var(--caramel); font-weight: 700; }
.conv .preview { display: flex; gap: 8px; justify-content: space-between; color: var(--muted); font-size: .86rem; }
.conv .preview span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .kind { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.group-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; color: var(--cocoa); }
.group-ico svg { width: 18px; height: 18px; }
.thread { display: flex; flex-direction: column; min-height: 0; min-width: 0;
  background: #EFE5D8 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='%23d8c6b2' fill-opacity='.35'%3E%3Crect x='8' y='8' width='14' height='14' rx='3'/%3E%3Ccircle cx='55' cy='50' r='6'/%3E%3C/g%3E%3C/svg%3E"); }
.thread-head { display: flex; gap: 12px; align-items: center; padding: 10px 16px; background: var(--paper); border-bottom: 1px solid var(--line); min-height: 62px; }
.thread-head .sub { font-size: .8rem; color: var(--muted); }
.thread-head .sub.typing { color: var(--ok); font-style: italic; }
.messages { flex: 1; overflow-y: auto; padding: 16px 6% 10px; display: flex; flex-direction: column; gap: 2px; }
.daysep { align-self: center; background: rgba(255,253,250,.92); color: var(--muted); font-size: .74rem; padding: 3px 12px; border-radius: 8px; margin: 10px 0 6px; box-shadow: 0 1px 1px rgba(0,0,0,.05); }
.sysmsg { align-self: center; background: #FFF6D6; color: #7A5B12; font-size: .78rem; padding: 4px 12px; border-radius: 8px; margin: 4px 0; }
.msg { max-width: min(72%, 560px); padding: 6px 9px 4px; border-radius: 10px; background: #fff; align-self: flex-start; position: relative;
  box-shadow: 0 1px 1px rgba(0,0,0,.07); margin-top: 2px; word-wrap: break-word; overflow-wrap: anywhere; }
.msg.first { margin-top: 8px; border-top-left-radius: 2px; }
.msg.mine { align-self: flex-end; background: #F6E3CB; }
.msg.mine.first { border-top-left-radius: 10px; border-top-right-radius: 2px; }
.msg .who { font-size: .78rem; font-weight: 700; margin-bottom: 1px; }
.msg .text { white-space: pre-wrap; font-size: .93rem; }
.msg .meta { float: right; margin: 6px 0 -2px 10px; font-size: .68rem; color: var(--muted); display: inline-flex; gap: 3px; align-items: center; }
.msg .ticks { width: 16px; height: 11px; }
.msg .ticks.read { color: #3B8FD9; }
.msg.deleted .text { font-style: italic; color: var(--muted); }
.msg .quote { border-left: 3px solid var(--caramel); background: rgba(0,0,0,.04); padding: 4px 8px; border-radius: 6px; font-size: .8rem; margin-bottom: 4px; cursor: pointer; }
.msg .quote b { display: block; color: var(--praline); font-size: .76rem; }
.msg img.att { max-width: 100%; max-height: 300px; border-radius: 7px; display: block; margin: 2px 0 2px; cursor: zoom-in; }
.msg a.file { display: flex; gap: 8px; align-items: center; background: rgba(0,0,0,.04); padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--text); margin: 2px 0; }
.msg .actions { position: absolute; top: 2px; right: 4px; display: none; gap: 2px; background: inherit; border-radius: 6px; }
.msg:hover .actions { display: flex; }
.msg .actions button { border: 0; background: transparent; cursor: pointer; padding: 2px 4px; color: var(--muted); font-size: .8rem; border-radius: 5px; }
.msg .actions button:hover { background: rgba(0,0,0,.06); color: var(--text); }
.msg.flash-hl { animation: hl 1.4s ease; }
@keyframes hl { 0%, 40% { box-shadow: 0 0 0 3px var(--caramel); } }
.composer { background: var(--paper); padding: 8px 12px; border-top: 1px solid var(--line); }
.composer .reply-box, .composer .file-box { display: flex; align-items: center; gap: 10px; background: #FBF5EE; border-left: 3px solid var(--caramel);
  padding: 6px 10px; border-radius: 8px; margin-bottom: 6px; font-size: .84rem; }
.composer .reply-box[hidden], .composer .file-box[hidden] { display: none; }
.composer .reply-box span, .composer .file-box span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-row { display: flex; gap: 6px; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; max-height: 140px; min-height: 42px; border-radius: 21px; padding: 10px 16px; line-height: 1.35; }
.iconbtn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--muted); flex: none; }
.iconbtn:hover { background: #F3ECE3; color: var(--text); }
.iconbtn.send { background: var(--praline); color: #fff; }
.iconbtn.send:hover { background: var(--ganache); }
.iconbtn svg { width: 20px; height: 20px; }
.emoji-pop { position: absolute; bottom: 60px; left: 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  padding: 8px; display: grid; grid-template-columns: repeat(8, 34px); gap: 2px; z-index: 20; }
.emoji-pop[hidden] { display: none; }
.emoji-pop button { border: 0; background: none; font-size: 20px; cursor: pointer; border-radius: 6px; height: 34px; }
.emoji-pop button:hover { background: #F3ECE3; }
.empty-thread { flex: 1; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 30px; }
.empty-thread .big { font-family: var(--serif); font-size: 1.5rem; color: var(--ganache); }
.modal-back { position: fixed; inset: 0; background: rgba(30,18,12,.45); display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal-back[hidden] { display: none; }
.modal { background: var(--paper); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.25); width: 100%; max-width: 440px; max-height: 85vh; display: flex; flex-direction: column; }
.modal header { padding: 16px 18px 6px; display: flex; justify-content: space-between; align-items: center; }
.modal .content { padding: 6px 18px 12px; overflow-y: auto; }
.modal footer { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.pick { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 8px; cursor: pointer; }
.pick:hover { background: #FBF5EE; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: grid; place-items: center; z-index: 200; cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 6px; }
.back-btn { display: none; }

/* ---------- mobile ---------- */
.mobile-nav { display: none; }
@media (max-width: 980px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .sidebar { display: none; }
  .main { padding: 16px 14px 86px; }
  .mobile-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--cocoa); z-index: 50; justify-content: space-around;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .mobile-nav a { color: #E5D3C0; text-decoration: none; font-size: .68rem; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 6px; position: relative; }
  .mobile-nav a.active { color: #fff; }
  .mobile-nav a .badge { position: absolute; top: -2px; right: -2px; height: 17px; min-width: 17px; font-size: .64rem; }
  .mobile-nav svg { width: 22px; height: 22px; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .chat { grid-template-columns: 1fr; height: calc(100vh - 62px); }
  .chat.has-open .chat-list { display: none; }
  .chat:not(.has-open) .thread { display: none; }
  .back-btn { display: grid; }
  .messages { padding: 12px 10px; }
  .msg { max-width: 86%; }
  .pgrid-wrap { max-height: none; }
  .pgrid th.slot { min-width: 82px; padding: 0 6px; font-size: .7rem; }
  .pgrid td.c, .pgrid thead tr.emps th { min-width: 44px; max-width: 44px; }
  .page-head .toolbar { width: 100%; }
  h1 { font-size: 1.4rem; }
}
@media print {
  .sidebar, .mobile-nav, .palette, .no-print { display: none !important; }
  .main { padding: 0; }
  .pgrid-wrap { max-height: none; overflow: visible; box-shadow: none; }
  body { background: #fff; }
}
