:root{
  --bg:#f4f6fb;
  --panel:#ffffff;
  --panel-soft:#f8fafc;
  --line:#dbe3ee;
  --line-strong:#cfd9e7;
  --text:#12233d;
  --muted:#5f6f84;
  --muted-2:#7f8ca0;
  --navy:#173b67;
  --navy-deep:#102b4a;
  --gold:#dca63d;
  --success:#1e8d63;
  --danger:#b84343;
  --shadow:0 18px 42px rgba(18,35,61,.08);
  --radius:22px;
  --font:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}

*{box-sizing:border-box}
html,body{margin:0;padding:0;font-family:var(--font);background:var(--bg);color:var(--text)}
a{text-decoration:none;color:inherit}
img{max-width:100%;display:block}
button,input,select,textarea{font:inherit}

.eyebrow{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-size:.72rem;
  font-weight:800;
  letter-spacing:.14em;
  text-transform:uppercase;
  color:var(--gold);
}

.btn{
  min-height:52px;
  padding:0 24px;
  border-radius:14px;
  border:1px solid transparent;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  cursor:pointer;
  font-weight:700;
  text-decoration:none;
  transition:transform .15s ease,background-color .15s ease,border-color .15s ease;
}
.btn:hover{transform:translateY(-1px)}
.btn--primary{background:var(--navy);color:#fff}
.btn--primary:hover{background:var(--navy-deep)}
.btn--ghost{background:#fff;border-color:var(--line);color:var(--text)}
.btn--ghost:hover{border-color:var(--line-strong);background:var(--panel-soft)}
.btn--danger{background:#fff;border-color:#f2cccc;color:#b84343}
.btn--danger:hover{background:#fff1f1;border-color:#e6a5a5}
.btn--full{width:100%}
.btn--sm{min-height:38px;padding:0 14px;font-size:.82rem;border-radius:10px;gap:6px}

.flash{
  padding:14px 16px;
  border-radius:16px;
  font-size:.92rem;
  margin-bottom:18px;
  border:1px solid transparent;
}
.flash--top{margin:0 0 20px}
.flash--success{background:#edf9f4;color:#15573d;border-color:#ccebdc}
.flash--error{background:#fff1f1;color:#7a2d2d;border-color:#f2cccc}

.login-shell{min-height:100vh;padding:72px 28px 40px;box-sizing:border-box}
.login-brand-strip{
  max-width:1240px;
  margin:0 auto 40px;
  display:flex;
  align-items:center;
  gap:14px;
  flex-wrap:wrap;
}
.brand-mark{
  display:flex;
  align-items:center;
  flex-shrink:0;
}
.brand-mark img{
  width:auto;
  height:42px;
  max-width:100%;
}
.brand-kicker{font-size:.72rem;font-weight:800;letter-spacing:.12em;text-transform:uppercase;color:var(--muted-2)}
.brand-title{font-size:1.05rem;font-weight:800;color:var(--navy)}
.login-grid{
  max-width:1240px;
  margin:0 auto;
  display:grid;
  grid-template-columns:minmax(0,1.1fr) minmax(0,.9fr);
  gap:22px;
}
.login-panel{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:32px;
  box-shadow:var(--shadow);
  padding:40px;
  min-width:0;
}
.login-panel--showcase{
  background:linear-gradient(180deg,#ffffff 0%,#eef4fb 100%);
}
.login-panel--showcase h1{
  font-size:clamp(1.75rem,4vw,4rem);
  line-height:1.05;
  letter-spacing:-.04em;
  max-width:760px;
  margin:18px 0 18px;
}
.login-panel--showcase p{
  max-width:620px;
  font-size:1.05rem;
  color:var(--muted);
  line-height:1.8;
}
.showcase-list{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-top:32px}
.showcase-item{
  border:1px solid var(--line);
  border-radius:20px;
  background:rgba(255,255,255,.75);
  padding:18px;
}
.showcase-item strong{display:block;font-size:.95rem;margin-bottom:8px}
.showcase-item span{font-size:.88rem;color:var(--muted);line-height:1.6}

.card-head h2{font-size:2rem;letter-spacing:-.04em;margin:12px 0 8px}
.card-head p{color:var(--muted);line-height:1.7;margin:0 0 18px}
.form-stack{display:grid;gap:14px;min-width:0}
.form-stack label{display:grid;gap:8px;min-width:0}
.form-stack span{font-size:.86rem;font-weight:700;color:var(--navy)}
.form-stack input,.form-stack select,.form-stack textarea{
  width:100%;
  max-width:100%;
  box-sizing:border-box;
  min-width:0;
  font-family:inherit;
}
.form-stack input:not([type=file]):not([type=checkbox]):not([type=radio]),
.form-stack select,
.form-stack textarea{
  min-height:50px;
  border-radius:14px;
  border:1px solid var(--line);
  background:#fff;
  color:var(--text);
  padding:0 14px;
}
.form-stack textarea{padding:14px;min-height:120px;resize:vertical}
.form-stack input[type=file]{
  padding:12px 14px;
  border-radius:14px;
  border:1px dashed var(--line-strong);
  background:var(--panel-soft);
  font-size:.88rem;
  color:var(--muted);
  cursor:pointer;
  line-height:1.4;
}
.form-stack input[type=file]::file-selector-button{
  min-height:36px;
  padding:0 14px;
  margin-right:12px;
  border-radius:10px;
  border:1px solid var(--line);
  background:#fff;
  color:var(--navy);
  font-weight:700;
  font-size:.82rem;
  cursor:pointer;
}
.form-stack input[type=file]::-webkit-file-upload-button{
  min-height:36px;
  padding:0 14px;
  margin-right:12px;
  border-radius:10px;
  border:1px solid var(--line);
  background:#fff;
  color:var(--navy);
  font-weight:700;
  font-size:.82rem;
  cursor:pointer;
}
.login-note{
  margin-top:18px;
  display:grid;
  gap:6px;
  font-size:.86rem;
  color:var(--muted);
  padding:16px;
  border-radius:16px;
  background:var(--panel-soft);
  border:1px solid var(--line);
}

.app-shell{display:grid;grid-template-columns:300px minmax(0,1fr);min-height:100vh;align-items:start}
.sidebar{
  background:#fff;
  border-right:1px solid var(--line);
  padding:18px;
  display:flex;
  flex-direction:column;
  gap:18px;
  position:sticky;
  top:0;
  height:100vh;
  overflow-y:auto;
}
.sidebar-brand{
  display:flex;
  align-items:center;
  gap:12px;
  padding:14px;
  border-radius:20px;
  background:var(--panel-soft);
  border:1px solid var(--line);
  min-width:0;
}
.sidebar-brand img{flex-shrink:0;width:auto;height:38px;max-width:none;object-fit:contain}
.sidebar-brand > div{min-width:0;overflow:hidden}
.sidebar-brand .brand-kicker,.sidebar-brand .brand-title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sidebar-brand .brand-title{font-size:.95rem;line-height:1.2}
.sidebar-nav{display:grid;gap:8px}
.nav-link{
  min-height:48px;
  padding:0 14px;
  border-radius:14px;
  display:flex;
  align-items:center;
  color:var(--muted);
  font-weight:700;
}
.nav-link:hover,.nav-link.is-active{background:#edf4fb;color:var(--navy)}
.sidebar-foot{margin-top:auto;display:grid;gap:12px}
.user-pill{
  padding:14px;
  border-radius:18px;
  background:var(--panel-soft);
  border:1px solid var(--line);
}
.user-pill strong{display:block;margin-bottom:4px}
.user-pill span{font-size:.86rem;color:var(--muted)}

.main{padding:22px}
.mobile-top{display:none}
.page-intro{margin-bottom:20px}
.page-intro h1{
  font-size:clamp(2rem,3.6vw,3.2rem);
  letter-spacing:-.05em;
  line-height:1.03;
  margin:14px 0 12px;
  max-width:1000px;
}
.page-intro p{max-width:860px;color:var(--muted);font-size:1rem;line-height:1.8;margin:0}

.stats-row{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(170px,1fr));
  gap:14px;
  margin:0 0 20px;
}
.stat-card,.surface{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:26px;
  box-shadow:var(--shadow);
}
.stat-card{padding:20px}
.stat-card strong{display:block;font-size:1.8rem;letter-spacing:-.04em;color:var(--navy);margin-bottom:6px}
.stat-card span{font-size:.84rem;color:var(--muted);text-transform:uppercase;letter-spacing:.06em}

.admin-grid,.workspace,.workspace-grid{
  display:grid;
  gap:18px;
  margin-bottom:20px;
}
.admin-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
.workspace{grid-template-columns:minmax(280px,.75fr) minmax(0,1.25fr)}
.workspace--solo{grid-template-columns:1fr}
.workspace-grid{grid-template-columns:repeat(2,minmax(0,1fr));margin-top:18px}

.surface{padding:24px;margin-bottom:20px}
.admin-grid > .surface,.workspace > .surface,.workspace-grid > .surface{margin-bottom:0}
.surface--nested{padding:22px;border-radius:22px;box-shadow:none;background:var(--panel-soft);margin-bottom:0}
.surface-head{margin-bottom:16px}
.surface-head--row{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;flex-wrap:wrap}
.surface-head--row > div{flex:1;min-width:240px}
.surface-head h2,.surface-head h3{margin:0 0 8px;letter-spacing:-.03em;color:var(--navy)}
.surface-head p{margin:0;color:var(--muted);line-height:1.7}

.empty-state{
  padding:36px 24px;
  text-align:center;
  border:1px dashed var(--line-strong);
  border-radius:18px;
  background:var(--panel-soft);
  display:grid;
  gap:10px;
  justify-items:center;
}
.empty-state strong{font-size:1.05rem;color:var(--navy)}
.empty-state p{margin:0;color:var(--muted);line-height:1.7;max-width:480px}
.empty-state .btn{margin-top:6px}
.empty-state--inline{padding:24px;text-align:left;justify-items:start}

.project-list,.timeline,.file-list,.account-list{display:grid;gap:10px}
.project-row,.file-row,.timeline-item{
  padding:16px;
  border-radius:18px;
  border:1px solid var(--line);
  background:#fff;
}
.account-card{
  padding:16px;
  border-radius:18px;
  border:1px solid var(--line);
  background:#fff;
}
.project-row strong,.file-row strong,.timeline-item strong{display:block;margin-bottom:6px}
.project-row span,.file-row span,.timeline-item span{display:block;color:var(--muted-2);font-size:.85rem}
.account-card strong{display:block;margin-bottom:6px;color:var(--navy)}
.account-card span{display:block;color:var(--muted-2);font-size:.85rem}
.project-row.is-active{border-color:#b9c9dc;background:#f5f9fd}
.timeline-item p{margin:10px 0 0;color:var(--muted);line-height:1.7}
.timeline-item p{word-break:break-word}
.account-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}
.account-meta{
  display:flex;
  flex-wrap:wrap;
  gap:10px 16px;
  margin:12px 0 14px;
  font-size:.86rem;
  color:var(--muted);
}
.account-card .action-row{margin-top:4px}
.account-card .action-row form{flex:0 0 auto;margin:0}
.account-card .action-row .btn{width:auto}
.action-row--compact{gap:8px}
.approval-list{display:grid;gap:12px}
.approval-card{
  padding:18px;
  border-radius:18px;
  border:1px solid var(--line);
  background:#fff;
}
.approval-card p{margin:10px 0;color:var(--muted);line-height:1.7}
.approval-card--pending{border-color:#d4dfec;background:#fbfdff}
.approval-card--approved{border-color:#ccebdc;background:#f4fbf7}
.approval-card--revision_requested{border-color:#f1ddc0;background:#fff9f0}
.approval-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}
.approval-top strong{display:block;color:var(--navy)}
.approval-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:30px;
  padding:0 12px;
  border-radius:999px;
  font-size:.74rem;
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
}
.approval-badge--pending{background:#edf4fb;color:#173b67}
.approval-badge--approved{background:#e5f6ed;color:#1e8d63}
.approval-badge--revision_requested{background:#fff0d9;color:#a56b14}
.approval-meta{display:block;font-size:.82rem;color:var(--muted-2)}
.approval-note{
  margin-top:12px;
  padding:12px 14px;
  border-radius:14px;
  background:var(--panel-soft);
  border:1px solid var(--line);
  color:var(--text);
  font-size:.92rem;
  line-height:1.7;
}
.action-row{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
.action-row .btn{flex:1 1 180px}

.status-strip{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:12px;
}
.status-block{
  padding:18px;
  border-radius:18px;
  background:#f4f8fc;
  border:1px solid var(--line);
}
.status-block span{display:block;font-size:.76rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--muted-2);margin-bottom:8px}
.status-block strong{letter-spacing:-.02em;color:var(--navy)}

.partner-hero .surface{padding:26px}
.partner-top{
  display:grid;
  grid-template-columns:minmax(0,1fr) 180px;
  gap:18px;
  align-items:center;
  margin-bottom:18px;
}
.partner-top h2{font-size:2rem;letter-spacing:-.04em;margin:12px 0 10px}
.partner-top p{margin:0;color:var(--muted);line-height:1.8;max-width:720px}
.progress-ring{
  min-height:160px;
  border-radius:26px;
  background:linear-gradient(180deg,#173b67 0%,#224a7b 100%);
  color:#fff;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
}
.progress-ring strong{font-size:2.5rem;letter-spacing:-.05em}
.progress-ring span{font-size:.82rem;text-transform:uppercase;letter-spacing:.08em;color:rgba(255,255,255,.72)}

@media (max-width: 1180px){
  .login-grid{grid-template-columns:1fr}
  .login-panel--showcase{order:2}
  .login-panel--form{order:1}
  .showcase-list{grid-template-columns:1fr}
  .stats-row{grid-template-columns:repeat(2,1fr)}
  .admin-grid,.workspace,.workspace-grid{grid-template-columns:1fr}
  .partner-top{grid-template-columns:1fr}
}

@media (max-width: 860px){
  .app-shell{grid-template-columns:1fr}
  .sidebar{
    position:fixed;
    top:0;
    bottom:0;
    left:0;
    width:min(320px,88vw);
    height:100vh;
    z-index:30;
    transform:translateX(-104%);
    transition:transform .2s ease;
    box-shadow:0 18px 42px rgba(18,35,61,.18);
  }
  .sidebar.is-open{transform:translateX(0)}
  .mobile-top{
    display:flex;
    align-items:center;
    justify-content:space-between;
    min-height:60px;
    padding:0 2px 16px;
    font-weight:800;
    color:var(--navy);
  }
  .mobile-toggle{
    min-height:44px;
    padding:0 14px;
    border:1px solid var(--line);
    border-radius:12px;
    background:#fff;
  }
  .main{padding:16px}
  .login-shell{padding:48px 16px 24px}
  .login-panel{padding:24px;border-radius:24px}
  .page-intro h1{font-size:1.7rem;line-height:1.15}
  .page-intro p{font-size:.95rem}
  .status-strip,.stats-row{grid-template-columns:1fr}
  .surface{padding:18px;border-radius:20px}
  .surface--nested{padding:18px;border-radius:18px}
  .surface-head h2{font-size:1.25rem}
  .surface-head h3{font-size:1.05rem}
  .surface-head--row{flex-direction:column;align-items:stretch}
  .surface-head--row .btn{width:100%}
  .approval-top{flex-direction:column}
  .account-top{flex-direction:column}
  .account-card .action-row form{flex:1 1 auto;min-width:0}
  .account-card .action-row .btn{width:100%}
  .partner-hero .surface{padding:22px}
  .partner-top h2{font-size:1.5rem}
  .progress-ring{min-height:120px}
  .progress-ring strong{font-size:2rem}
  .stat-card strong{font-size:1.5rem}
  .login-panel--showcase{padding:24px;border-radius:24px}
  .login-panel--showcase h1{font-size:1.85rem;margin:14px 0}
  .login-panel--showcase p{font-size:.98rem;line-height:1.65}
  .showcase-list{margin-top:20px;gap:10px}
  .showcase-item{padding:14px;border-radius:16px}
  .card-head h2{font-size:1.5rem}
  .form-stack input:not([type=file]):not([type=checkbox]):not([type=radio]),
  .form-stack select,
  .form-stack textarea{min-height:46px;font-size:16px}
  .btn{min-height:48px;font-size:.92rem;padding:0 18px}
  .timeline-item,.project-row,.file-row,.account-card,.approval-card{padding:14px;border-radius:14px}
  .timeline-item p{font-size:.92rem}
  .timeline-item span,.project-row span,.file-row span{font-size:.8rem}
  .login-brand-strip{margin-bottom:28px;gap:10px}
  .login-brand-strip .brand-title{font-size:.95rem}
  .brand-mark img{height:36px}
}

@media (max-width: 480px){
  .login-shell{padding:36px 12px 20px}
  .login-panel{padding:20px;border-radius:20px}
  .login-panel--showcase{padding:20px;border-radius:20px}
  .login-panel--showcase h1{font-size:1.6rem}
  .main{padding:12px}
  .surface{padding:16px;border-radius:18px}
  .page-intro h1{font-size:1.45rem}
  .stats-row{gap:10px}
  .stat-card{padding:16px}
  .stat-card strong{font-size:1.3rem}
  .action-row{gap:8px}
  .login-brand-strip{margin-bottom:22px}
  .login-brand-strip > div:last-child{flex:1;min-width:0}
  .login-brand-strip .brand-title{font-size:.9rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .login-note{padding:14px;font-size:.82rem}
  .modal-progress{padding:20px 16px}
}

/* ═══ SIDEBAR UNREAD PILL ═══ */
.nav-link{position:relative}
.nav-pill{
  margin-left:auto;background:var(--gold);color:#fff;
  font:800 .7rem/1 var(--font);letter-spacing:.04em;
  padding:4px 9px;border-radius:999px;
}

/* ═══ COMMUNICATIONS ═══ */
.page-intro--tight{margin-bottom:14px}
.comms-shell{
  display:grid;grid-template-columns:minmax(260px,340px) minmax(0,1fr);
  gap:16px;height:calc(100vh - 220px);min-height:480px;
}
.comms-list{
  background:var(--panel);border:1px solid var(--line);border-radius:22px;
  box-shadow:var(--shadow);overflow-y:auto;padding:8px;
}
.comms-item{
  display:block;padding:12px 14px;border-radius:14px;
  transition:background .12s;cursor:pointer;margin-bottom:4px;
}
.comms-item:hover{background:var(--panel-soft)}
.comms-item.is-active{background:#eaf2fa;outline:1px solid #c9dcef}
.comms-item-top{display:flex;align-items:center;justify-content:space-between;gap:8px}
.comms-item-top strong{color:var(--navy);font-size:.92rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.comms-item-sub{font-size:.78rem;color:var(--muted-2);margin-top:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.comms-item-preview{font-size:.82rem;color:var(--muted);margin-top:6px;line-height:1.4;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.comms-item-preview span{font-weight:700;color:var(--navy)}
.comms-item-preview--empty{font-style:italic}
.comms-item-time{font-size:.72rem;color:var(--muted-2);margin-top:6px}

.comms-panel{
  background:var(--panel);border:1px solid var(--line);border-radius:22px;
  box-shadow:var(--shadow);display:flex;flex-direction:column;overflow:hidden;min-height:0;
}
.comms-panel--empty{display:flex;align-items:center;justify-content:center}
.comms-header{
  display:flex;align-items:center;gap:12px;padding:14px 18px;
  border-bottom:1px solid var(--line);background:var(--panel-soft);
}
.comms-header > div{flex:1;min-width:0}
.comms-header strong{display:block;color:var(--navy);font-weight:800;font-size:1rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.comms-header span{display:block;color:var(--muted-2);font-size:.82rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.comms-back{display:none;font-weight:700;color:var(--navy);padding:6px 10px;border-radius:10px;background:#fff;border:1px solid var(--line)}
.comms-panel{background:var(--panel-soft)}
.comms-thread{flex:1;max-height:none;border:1px solid var(--line);border-radius:16px;background:#fff;padding:20px;margin:22px 22px 0;gap:14px}
.comms-composer{border:1px solid var(--line);border-radius:16px;padding:18px;background:#fff;margin:16px 22px 22px}
.comms-jump{margin-top:14px;margin-bottom:10px}

@media (max-width:860px){
  .comms-shell{grid-template-columns:1fr;height:auto;min-height:0;gap:12px}
  .comms-shell.is-open .comms-list{display:none}
  .comms-shell:not(.is-open) .comms-panel{display:none}
  .comms-back{display:inline-flex}
  .comms-thread{padding:14px;margin:12px 12px 0}
  .comms-panel{min-height:60vh}
  .comms-composer{margin:12px}
}

/* ═══ NEW COMPONENTS (v=11) ═══ */

/* Link-style inline buttons */
.link-btn{
  background:none;border:none;padding:4px 8px;color:var(--navy);
  font:700 .8rem/1 var(--font);cursor:pointer;border-radius:8px;
  text-decoration:none;display:inline-flex;align-items:center;gap:4px;
  transition:background .15s,color .15s;
}
.link-btn:hover{background:var(--panel-soft)}
.link-btn--danger{color:var(--danger)}
.link-btn--danger:hover{background:#fff1f1}
.inline-form{display:inline-block;margin:0}

/* Timeline edit/delete header */
.timeline-top{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:4px}
.timeline-top strong{display:block;flex:1}
.timeline-actions{display:flex;gap:4px;flex-shrink:0}
.inline-edit{padding:12px;border:1px solid var(--line);border-radius:14px;background:var(--panel-soft)}
.inline-edit select{background:#fff}

/* File rows with actions */
.file-row--with-actions{
  display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap;
}
.file-row-main{flex:1;min-width:200px}
.file-row-main strong{display:block;margin-bottom:4px}
.file-row-main span{display:block;color:var(--muted-2);font-size:.82rem}
.file-row-actions{display:flex;gap:4px;flex-wrap:wrap}

/* Dropzone */
.dropzone{
  position:relative;display:block;padding:28px 20px;
  border:2px dashed var(--line-strong);border-radius:16px;
  background:var(--panel-soft);cursor:pointer;
  transition:background .15s,border-color .15s;text-align:center;
}
.dropzone:hover{border-color:var(--navy);background:#f2f7fc}
.dropzone.is-drag{border-color:var(--navy);background:#eaf2fa;border-style:solid}
.dropzone-input{position:absolute;inset:0;opacity:0;cursor:pointer;width:100%;height:100%}
.dropzone-prompt{display:flex;flex-direction:column;align-items:center;gap:6px;pointer-events:none}
.dropzone-prompt strong{color:var(--navy);font-weight:800}
.dropzone-icon{font-size:1.6rem;color:var(--navy);font-style:normal;opacity:.7}
.dropzone-hint{font-size:.85rem;color:var(--muted);word-break:break-all}

/* Messaging */
.msg-unread-pill{
  display:inline-block;background:var(--gold);color:#fff;
  font:800 .65rem/1 var(--font);letter-spacing:.05em;
  padding:4px 10px;border-radius:999px;vertical-align:middle;
  text-transform:uppercase;margin-left:6px;
}
.msg-thread{
  max-height:480px;overflow-y:auto;display:flex;flex-direction:column;gap:14px;
  padding:20px;background:var(--panel-soft);border:1px solid var(--line);
  border-radius:16px;margin-bottom:18px;scroll-behavior:smooth;
}
.msg-bubble{
  max-width:78%;padding:14px 16px;border-radius:18px;background:#fff;
  border:1px solid var(--line);line-height:1.55;box-shadow:0 2px 6px rgba(18,35,61,.04);
}
.msg-bubble--me{align-self:flex-end;background:var(--navy);color:#fff;border-color:var(--navy)}
.msg-bubble--me .msg-meta{color:rgba(255,255,255,.75)}
.msg-bubble--me a.msg-attach{color:#fff;border-color:rgba(255,255,255,.3)}
.msg-bubble--them{align-self:flex-start}
.msg-meta{font-size:.74rem;color:var(--muted);margin-bottom:6px;letter-spacing:.02em}
.msg-meta strong{color:inherit;font-weight:700}
.msg-body{font-size:.92rem;word-break:break-word}
.msg-attach{
  display:inline-flex;align-items:center;gap:6px;margin-top:8px;
  font-size:.82rem;padding:6px 10px;border:1px solid var(--line);
  border-radius:10px;color:var(--navy);background:rgba(0,0,0,.02);
}
.msg-attach span{color:var(--muted-2);font-weight:600}
.msg-composer{
  display:flex;flex-direction:column;gap:12px;
  padding:16px 18px;border:1px solid var(--line);border-radius:16px;background:#fff;
}
.msg-composer textarea{
  width:100%;box-sizing:border-box;border:none;outline:none;resize:vertical;
  min-height:80px;font-family:inherit;font-size:.95rem;line-height:1.55;background:transparent;
  padding:6px 6px 4px;
}
.msg-composer-actions{
  display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;
  border-top:1px solid var(--line);padding-top:14px;
}
.msg-attach-btn{
  display:inline-flex;align-items:center;gap:10px;cursor:pointer;
  font-size:.84rem;color:var(--navy);font-weight:700;
  padding:8px 12px;border-radius:10px;background:var(--panel-soft);
  transition:background .15s;
}
.msg-attach-btn:hover{background:#edf4fb}
.msg-attach-btn em{font-style:normal;font-weight:500;color:var(--muted-2);font-size:.8rem;max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* Preview modal */
.preview-overlay{
  position:fixed;inset:0;background:rgba(13,25,45,.75);
  backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);
  z-index:900;display:none;align-items:center;justify-content:center;padding:24px;
  opacity:0;transition:opacity .2s;
}
.preview-overlay.is-open{display:flex;opacity:1}
.preview-shell{
  background:#fff;width:100%;max-width:960px;max-height:92vh;
  border-radius:20px;display:flex;flex-direction:column;overflow:hidden;
  box-shadow:0 32px 80px rgba(0,0,0,.3);
}
.preview-head{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:14px 18px;border-bottom:1px solid var(--line);background:var(--panel-soft);
}
.preview-name{font-weight:700;color:var(--navy);font-size:.95rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.preview-actions{display:flex;gap:6px;flex-shrink:0}
.preview-body{flex:1;background:#1a1a1a;display:flex;align-items:center;justify-content:center;overflow:auto}
.preview-iframe{width:100%;height:100%;min-height:70vh;border:0;background:#fff}
.preview-image{max-width:100%;max-height:85vh;display:block;object-fit:contain;background:#fff}

/* Mobile tuning for new components */
@media (max-width:860px){
  .msg-thread{max-height:380px}
  .msg-bubble{max-width:92%}
  .dropzone{padding:22px 14px}
  .file-row--with-actions{flex-direction:column;align-items:stretch;gap:10px}
  .file-row-actions{justify-content:flex-start}
  .timeline-top{flex-direction:column;gap:6px}
  .timeline-actions{flex-wrap:wrap}
  .preview-overlay{padding:0}
  .preview-shell{max-height:100vh;height:100vh;border-radius:0;max-width:100%}
  .preview-head{padding:12px 14px}
  .preview-iframe{min-height:calc(100vh - 56px)}
  .preview-image{max-height:calc(100vh - 56px)}
  .msg-composer-actions{flex-direction:column-reverse;align-items:stretch}
  .msg-attach-btn{justify-content:center}
  .msg-composer-actions .btn{width:100%}
}
@media (max-width:480px){
  .msg-thread{padding:10px;max-height:320px}
  .msg-bubble{padding:10px 12px;font-size:.88rem}
  .msg-body{font-size:.88rem}
}
