/* ============================================================
   App shell layout — 4 column portal
   ============================================================ */

/* capture mode: freeze animations so html-to-image grabs final state */
body.capture *, body.capture *::before, body.capture *::after { animation: none !important; transition: none !important; }
body.capture .persona { display: none !important; }

.app {
  display: grid;
  grid-template-columns: 240px 312px minmax(0, 1fr) 372px;
  height: 100vh;
  background: var(--bg);
  overflow: hidden;
}

/* ---------------- col 1: nav ---------------- */
.nav {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 26px 18px;
  display: flex; flex-direction: column;
}
.nav__logo { font-size: 21px; font-weight: 800; letter-spacing: -0.03em; color: #15181E; padding: 0 8px 26px; }
.nav__logo span { color: var(--primary); }
.nav__group { margin-bottom: 4px; }
.nav__item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: var(--r-xs);
  font-size: 14.5px; font-weight: 500; color: var(--text-2);
  cursor: pointer; transition: background .12s, color .12s;
  white-space: nowrap;
}
.nav__item:hover { background: var(--surface-2); }
.nav__item.head { font-weight: 700; color: var(--text); margin-top: 14px; }
.nav__item.active { color: var(--primary); font-weight: 700; }
.nav__sub { padding-left: 18px; }
.nav__sub .nav__item { font-size: 14px; padding: 7px 10px; }
.nav__sub .nav__item.active { color: var(--primary); }

/* ---------------- col 2: channels ---------------- */
.chl {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  min-height: 0;
}
.chl__head { display: flex; align-items: center; justify-content: space-between; padding: 26px 22px 14px; }
.chl__title { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; }
.chl__add { width: 32px; height: 32px; border-radius: 9px; border: none; background: transparent; color: var(--text-2); display: grid; place-items: center; }
.chl__add:hover { background: var(--surface-3); color: var(--primary); }
.chl__search { position: relative; padding: 0 18px 12px; }
.chl__search input {
  width: 100%; height: 44px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface-2); padding: 0 14px 0 42px; font-size: 14px; outline: none;
}
.chl__search input:focus { border-color: var(--primary-border); background: #fff; }
.chl__search svg { position: absolute; left: 32px; top: 13px; color: var(--text-3); }
.chl__list { overflow: auto; padding: 4px 12px 12px; }
.chl__item {
  padding: 16px 14px; border-radius: var(--r);
  font-size: 14.5px; font-weight: 500; color: var(--text-2);
  cursor: pointer; transition: background .12s;
  display: flex; align-items: center; gap: 10px;
  line-height: 1.35;
}
.chl__item:hover { background: var(--surface-2); }
.chl__item.active { background: var(--surface-3); color: var(--text); font-weight: 600; }
.chl__item .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- col 3: chat ---------------- */
.chat { display: flex; flex-direction: column; min-width: 0; background: var(--surface); }
.chat__head {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 28px; border-bottom: 1px solid var(--border);
}
.chat__head .ico { color: var(--text-2); }
.chat__name { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.chat__tabs { display: flex; gap: 22px; margin-left: 18px; }
.chat__tab { font-size: 15px; font-weight: 600; color: var(--text-3); padding: 6px 0; border-bottom: 2px solid transparent; cursor: pointer; }
.chat__tab.active { color: var(--text); border-color: var(--primary); }
.chat__head-right { margin-left: auto; display: flex; align-items: center; gap: 16px; color: var(--text-2); }
.chat__members { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; }
.chat__hicon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; cursor: pointer; }
.chat__hicon:hover { background: var(--surface-3); }

.feed { flex: 1; overflow: auto; padding: 26px 28px 8px; display: flex; flex-direction: column; gap: 18px; min-height: 0; }

.msg { display: flex; flex-direction: column; max-width: 72%; animation: slideIn .22s ease; }
.msg.out { align-self: flex-end; align-items: flex-end; }
.msg.in { align-self: flex-start; }
.msg__meta { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; font-size: 13px; color: var(--text-3); }
.msg__meta .who { font-weight: 700; color: var(--text-2); }
.msg__row { display: flex; gap: 10px; align-items: flex-end; }
.msg.in .msg__row { align-items: flex-start; }
.bubble {
  padding: 13px 17px; border-radius: 16px; font-size: 14.5px; line-height: 1.62; color: var(--text);
  letter-spacing: -0.01em; white-space: pre-wrap;
}
.msg.out .bubble { background: var(--bubble-out); border-top-right-radius: 6px; }
.msg.in .bubble { background: var(--bubble-in); border-top-left-radius: 6px; }
.msg .filechip { margin-top: 9px; max-width: 380px; }
.msg.out .filechip { background: #fff; }
.msg__time { font-size: 12px; color: var(--text-4); }

/* system message */
.sys { align-self: center; display: flex; align-items: center; gap: 9px; max-width: 88%; animation: slideIn .22s ease; }
.sys__pill {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 9px 16px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 13px; color: var(--text-2); font-weight: 500;
}
.sys__pill b { color: var(--text); font-weight: 700; }
.sys__pill .tag { font-weight: 700; white-space: nowrap; }
.sys__pill.is-reject .tag { color: var(--danger); }
.sys__pill.is-approve .tag { color: var(--success); }
.sys__pill.is-info .tag { color: var(--primary); }
.sys__pill.is-redo .tag { color: var(--warn); }

/* composer */
.composer { padding: 14px 28px 22px; position: relative; }
.composer__box {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border-strong); border-radius: 16px;
  padding: 8px 10px 8px 20px; background: var(--surface);
}
.composer__box.disabled { background: var(--surface-2); opacity: .7; }
.composer__input { flex: 1; border: none; outline: none; background: transparent; font-size: 14.5px; padding: 10px 0; }
.composer__btns { display: flex; align-items: center; gap: 6px; }
.composer__plus { width: 38px; height: 38px; border-radius: 10px; border: none; background: transparent; color: var(--primary); display: grid; place-items: center; }
.composer__plus:hover { background: var(--primary-weak); }
.composer__send { width: 38px; height: 38px; border-radius: 50%; border: none; background: var(--primary); color: #fff; display: grid; place-items: center; }
.composer__send:hover { background: var(--primary-hover); }
.composer__menu {
  position: absolute; right: 28px; bottom: 78px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow-pop); padding: 7px; width: 188px;
  animation: pop .15s ease; z-index: 20;
}
.composer__menu button {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 11px 12px; border: none; background: transparent; border-radius: 10px;
  font-size: 14px; font-weight: 600; color: var(--text); text-align: left;
}
.composer__menu button:hover { background: var(--surface-2); }
.composer__menu .ic { color: var(--text-2); }

/* ---------------- col 4: progress panel ---------------- */
.side { background: var(--bg); border-left: 1px solid var(--border); overflow: auto; padding: 20px 18px 28px; display: flex; flex-direction: column; gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.panel__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 12px; }
.panel__title { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; }
.panel__sel { display: flex; align-items: center; gap: 6px; max-width: 168px; font-size: 12.5px; font-weight: 600; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 7px 10px; }
.panel__sel .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* close banner */
.closebanner {
  margin: 0 16px 14px; padding: 16px; border-radius: var(--r);
  background: linear-gradient(135deg, #11A06B, #0C8C5C); color: #fff;
  animation: cardIn .3s ease;
}
.closebanner .t { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.closebanner .num { margin-top: 10px; font-size: 12px; opacity: .85; white-space: nowrap; }
.closebanner .num b { font-size: 15px; display: block; margin-top: 2px; letter-spacing: .01em; }
.closebanner .filechip { margin-top: 12px; background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.28); }
.closebanner .filechip__name { color: #fff; }

/* progress cards stack */
.stack { padding: 4px 16px 18px; }
.pcard {
  position: relative; border: 1.5px solid var(--border); border-radius: var(--r);
  padding: 15px 16px; background: var(--surface);
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.pcard + .pcard { margin-top: 26px; }
.pcard.active { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-weak); background: var(--primary-weak-2); }
.pcard.locked { opacity: .62; }
.pcard.rejected { border-color: var(--danger-border); background: #FFF8F8; }
.pcard__conn { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); color: var(--text-4); }
.pcard__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pcard__label { font-size: 12px; font-weight: 700; color: var(--text-3); letter-spacing: .02em; text-transform: uppercase; white-space: nowrap; }
.pcard__who { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.pcard__name { font-size: 15.5px; font-weight: 700; letter-spacing: -0.01em; }
.pcard__team { font-size: 12.5px; color: var(--text-3); margin-top: 1px; white-space: nowrap; }
.pcard__time { font-size: 12px; color: var(--text-4); margin-top: 9px; }
.pcard__note { font-size: 12.5px; color: var(--text-2); margin-top: 9px; line-height: 1.5; background: var(--surface-2); border-radius: 9px; padding: 9px 11px; }
.pcard__note.reject { background: var(--danger-weak); color: #B23232; }
.pcard__rev { font-size: 12.5px; color: var(--text-2); margin-top: 10px; display: flex; align-items: center; gap: 7px; }
.pcard__rev b { color: var(--text); font-weight: 700; }
.pcard__act { margin-top: 13px; display: flex; gap: 8px; }
.pcard__act .btn { flex: 1; }

/* history log inside card */
.phist { margin-top: 12px; border-top: 1px dashed var(--border-strong); padding-top: 11px; display: flex; flex-direction: column; gap: 9px; }
.phist__row { display: flex; gap: 9px; font-size: 12px; color: var(--text-2); line-height: 1.45; }
.phist__row .ic { flex: none; margin-top: 1px; }
.phist__row .tm { color: var(--text-4); margin-left: auto; white-space: nowrap; padding-left: 8px; }

/* recent files */
.rfile { display: flex; align-items: center; gap: 11px; padding: 11px 8px; border-radius: 10px; cursor: pointer; }
.rfile:hover { background: var(--surface-2); }
.rfile .nm { font-size: 13.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* perspective switcher (demo control) */
.persona {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px; z-index: 50;
  background: #20242C; color: #fff; border-radius: 999px; padding: 7px 8px 7px 16px;
  box-shadow: var(--shadow-lg); font-size: 13px;
}
.persona__label { font-weight: 600; opacity: .7; margin-right: 4px; }
.persona__opt {
  display: flex; align-items: center; gap: 7px; padding: 6px 12px 6px 7px; border-radius: 999px;
  border: none; background: transparent; color: #C9CDD6; font-weight: 600; font-size: 13px;
  white-space: nowrap;
}
.persona__label { white-space: nowrap; }
.persona__opt.active { background: #fff; color: #20242C; }
.persona__opt:hover:not(.active) { background: rgba(255,255,255,.1); color: #fff; }
.persona__reset { margin-left: 6px; border: none; background: rgba(255,255,255,.12); color: #fff; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; }
.persona__reset:hover { background: rgba(255,255,255,.22); }

/* next-step hint */
.hint {
  display: flex; align-items: center; gap: 10px;
  margin: 0 16px 14px; padding: 12px 14px; border-radius: var(--r);
  background: var(--primary-weak); border: 1px solid var(--primary-border);
  font-size: 13px; color: #1F5BD8; line-height: 1.45;
  animation: cardIn .3s ease;
}
.hint .ic { flex: none; }
.hint b { font-weight: 700; }

/* empty state */
.pempty { padding: 36px 20px; text-align: center; color: var(--text-3); }
.pempty .big { font-size: 14px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.pempty .sm { font-size: 12.5px; line-height: 1.5; }
.pempty .btn { margin-top: 16px; }

/* segmented action picker in forms */
.seg { display: flex; flex-direction: column; gap: 10px; }
.segopt {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px;
  border: 1.5px solid var(--border-strong); border-radius: var(--r-xs); cursor: pointer;
  transition: border-color .14s, background .14s;
}
.segopt:hover { border-color: var(--primary-border); }
.segopt.sel { border-color: var(--primary); background: var(--primary-weak-2); }
.segopt.sel.danger { border-color: var(--danger); background: var(--danger-weak); }
.segopt__radio { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-strong); margin-top: 1px; display: grid; place-items: center; }
.segopt.sel .segopt__radio { border-color: var(--primary); }
.segopt.sel.danger .segopt__radio { border-color: var(--danger); }
.segopt.sel .segopt__radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.segopt.sel.danger .segopt__radio::after { background: var(--danger); }
.segopt__t { font-size: 14.5px; font-weight: 700; }
.segopt__d { font-size: 12.5px; color: var(--text-2); margin-top: 3px; line-height: 1.45; }

/* approver list rows in 기안하기 */
.aprow {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px;
  border: 1px solid var(--border); border-radius: var(--r-xs); background: var(--surface);
}
.aprow + .aprow { margin-top: 9px; }
.aprow__grip { color: var(--text-4); cursor: grab; }
.aprow__seq { width: 22px; height: 22px; border-radius: 50%; background: var(--primary-weak); color: var(--primary); font-size: 12px; font-weight: 700; display: grid; place-items: center; flex: none; }
.aprow__name { font-size: 14.5px; font-weight: 700; }
.aprow__team { font-size: 12.5px; color: var(--text-3); }
.aprow__x { margin-left: auto; border: none; background: transparent; color: var(--text-4); width: 28px; height: 28px; border-radius: 8px; }
.aprow__x:hover { background: var(--danger-weak); color: var(--danger); }

.docpreview {
  display: flex; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--r-xs);
  background: var(--surface-2);
}
.docpreview .t { font-size: 14px; font-weight: 700; }
.docpreview .d { font-size: 12.5px; color: var(--text-2); margin-top: 4px; line-height: 1.5; }
