/* 版面骨架：左側固定側邊欄 ＋ 主內容 */
.shell { display: flex; min-height: 100vh; }
.side-nav {
  width: 14rem; flex-shrink: 0; background: #fff;
  border-right: 1px solid #e3ddd3; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; padding: 1.25rem .75rem;
}
.side-brand {
  font-size: 1.15rem; font-weight: 900; color: #3d3a35;
  padding: .25rem .75rem 1rem; display: block;
}
.side-links { display: flex; flex-direction: column; gap: .25rem; }
.side-link {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem .75rem; border-radius: .6rem; font-weight: 600;
  font-size: .92rem; color: #5a554c; border-left: 3px solid transparent;
  transition: background .15s, color .15s;
}
.side-link:hover { background: #f6f3ee; }
.side-link-active {
  background: #f6f3ee; color: #c98b6b; border-left-color: #c98b6b;
}
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: .5rem; padding-top: 1rem; }
.main-area { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1.1rem 1.5rem; border-bottom: 1px solid #e3ddd3;
  background: #fbf9f5; position: sticky; top: 0; z-index: 5;
}
@media (max-width: 768px) {
  .shell { display: block; }
  .side-nav {
    width: auto; height: auto; position: static; flex-direction: row;
    align-items: center; gap: .5rem; overflow-x: auto;
    border-right: 0; border-bottom: 1px solid #e3ddd3; padding: .6rem .75rem;
  }
  .side-brand { padding: 0 .5rem; font-size: 1rem; white-space: nowrap; }
  .side-links { flex-direction: row; gap: .25rem; }
  .side-link { white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; padding: .45rem .6rem; }
  .side-link-active { border-left: 0; border-bottom-color: #c98b6b; }
  .side-foot { margin-top: 0; flex-direction: row; padding-top: 0; }
  .side-foot .btn-ghost { padding: .4rem .7rem; white-space: nowrap; }
  .topbar { padding: .8rem 1rem; }
}

/* 共用元件 */
.btn-primary {
  background: #c98b6b; color: #fff; font-weight: 700;
  padding: .5rem 1rem; border-radius: 9999px; font-size: .875rem;
  transition: background .15s; display: inline-block;
}
.btn-primary:hover { background: #b0734f; }
.btn-ghost {
  background: #fff; color: #5a554c; font-weight: 600;
  padding: .5rem 1rem; border-radius: 9999px; font-size: .875rem;
  border: 1px solid #e3ddd3; transition: background .15s; display: inline-block;
}
.btn-ghost:hover { background: #f6f3ee; }

.fld {
  width: 100%; border: 1px solid #e3ddd3; border-radius: .5rem;
  padding: .5rem .75rem; font-size: .9rem; background: #fff;
  color: #3d3a35; outline: none; resize: vertical;
}
.fld:focus { border-color: #c98b6b; box-shadow: 0 0 0 2px rgba(201,139,107,.18); }

/* 9 框水彩底色（對應圖示三列配色） */
.card {
  border-radius: 1rem; padding: 1.1rem; position: relative; overflow: hidden;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.card::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 6px;
}
.tone-blue::before  { background: linear-gradient(90deg,#b9c1cf,#cdd3dd); }
.tone-peach::before { background: linear-gradient(90deg,#f0cdbf,#f7ddd2); }
.tone-sage::before  { background: linear-gradient(90deg,#b7c6ad,#cdd8c6); }
.tone-blue  { background: linear-gradient(180deg,#f4f6f9 0,#fff 70px); }
.tone-peach { background: linear-gradient(180deg,#fdf3ee 0,#fff 70px); }
.tone-sage  { background: linear-gradient(180deg,#f3f6f0 0,#fff 70px); }

/* 列印：只留卡片內容 */
/* 不確定型進度條（AI 分流等待用） */
.pbar {
  height: 6px; background: #ece2d6; border-radius: 9999px; overflow: hidden;
}
.pbar > i {
  display: block; height: 100%; width: 40%; border-radius: 9999px;
  background: linear-gradient(90deg, #c98b6b, #e2b69e);
  animation: pbar 1.1s ease-in-out infinite;
}
@keyframes pbar {
  0%   { margin-left: -40%; }
  100% { margin-left: 100%; }
}
.btn-primary:disabled, .btn-ghost:disabled {
  opacity: .55; cursor: not-allowed;
}

@media print {
  .side-nav, .topbar, .btn-primary, .btn-ghost, #ai-status, #conflict-box,
  #p-transcript, [data-act="ai-classify"] { display: none !important; }
  .main-area { min-width: 0; }
  body { background: #fff; }
  .card { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; }
  .card-grid { display: block !important; }
  .card { margin-bottom: 1rem; }
}

.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 1rem; }
.modal-box { background: #fff; border-radius: 1rem; padding: 1.25rem 1.5rem; max-width: 640px; width: 100%; max-height: 85vh; overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.2); }

.drag-handle { cursor: grab; font-size: 1.1rem; line-height: 1; padding: 2px 4px; display: inline-block; }
.drag-handle:active { cursor: grabbing; }
tr.dragging { opacity: .4; }
tr.drop-target td { box-shadow: inset 0 -2px 0 #d27a5a; }
