/* 面板使用纸色工作记录与深色页眉。 */
.panel {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  width: min(740px, calc(100% - 40px));
  max-height: min(760px, calc(100% - 56px));
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(239, 245, 232, .25);
  border-radius: 18px;
  color: var(--ink, #193736);
  background: var(--paper, #f5f0e5);
  box-shadow: 0 24px 84px #091c218c;
  animation: panel-enter .18s ease-out;
  pointer-events: auto;
}

#panel-layer .panel:not(:last-child) { visibility: hidden; }

@keyframes panel-enter {
  from { opacity: .65; transform: translate(-50%, calc(-50% + 10px)); }
  to { opacity: 1; transform: translate(-50%, -50%); }
}

.panel-head {
  position: relative;
  display: grid;
  grid-template-columns: 43px 1fr;
  column-gap: 13px;
  align-items: center;
  min-height: 82px;
  padding: 16px 64px 16px 20px;
  color: #f5f0e5;
  background: #183c40;
  border-bottom: 1px solid #355657;
}

.panel-emblem {
  grid-column: 1;
  grid-row: 1 / span 2;
  flex: none;
  width: 43px;
  height: 43px;
  padding: 10px;
  border: 1px solid #bfe6cb4d;
  border-radius: 11px;
  color: #bfe6cb;
  background: #254a49;
}

.panel-title { grid-column: 2; margin: 0; font-size: 1.35rem; font-weight: 700; }
.panel-sub { grid-column: 2; margin: 4px 0 0; color: #c1d2c8; font-size: .83rem; line-height: 1.4; }

.panel-close {
  position: absolute;
  right: 15px;
  top: 50%;
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  transform: translateY(-50%);
  border: 1px solid #a9c6bb55;
  border-radius: 9px;
  color: #e4f1e5;
  background: #2e504f;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.panel-close:hover { background: #3b6462; }
.panel-close .icon { width: 20px; height: 20px; }

.panel-body {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 18px 20px;
  scrollbar-color: #aab8aa transparent;
  scrollbar-width: thin;
}

.panel-foot {
  display: flex;
  justify-content: flex-end;
  padding: 12px 20px;
  border-top: 1px solid #ded9cc;
  background: #ece7db;
}

.panel-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 8px;
  margin: 0 0 14px;
}

.panel-metric {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid #ded9ca;
  border-radius: 10px;
  background: #faf7ee;
}

.panel-metric.attention { background: #fae9dd; border-color: #ebc9b6; }
.panel-metric.positive { background: #e7eee1; border-color: #c9daca; }
.panel-metric dt { color: #51615b; font-size: .74rem; }
.panel-metric dd { margin: 4px 0 0; font-size: 1.05rem; font-weight: 750; overflow-wrap: anywhere; }

.panel .section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 20px 0 10px;
  color: #274d44;
  font-size: .92rem;
  font-weight: 750;
}

.panel .section-title::after { content: ""; flex: 1; height: 1px; background: #dcd7c7; }
.panel .section-title:first-child { margin-top: 0; }

.panel .row {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 8px;
  padding: 11px 12px;
  border: 1px solid #e3dfd2;
  border-radius: 11px;
  background: #fcfaf3;
}

.panel .row:last-child { margin-bottom: 0; }
.panel .row.policy-active { border-color: #99b9a3; background: #e8f0e3; }
.panel .grow { min-width: 0; flex: 1 1 0; }
.panel .row .title { margin: 0; font-size: 1rem; font-weight: 750; line-height: 1.32; overflow-wrap: anywhere; }
.panel .row .meta { margin: 5px 0 0; color: #53655d; font-size: .79rem; line-height: 1.48; }

.panel-row-icon {
  width: 36px;
  height: 36px;
  flex: none;
  padding: 8px;
  border-radius: 9px;
  color: #41675b;
  background: #e8eee0;
}

.panel-portrait {
  display: block;
  flex: 0 0 54px;
  width: 54px;
  height: 54px;
  border: 1px solid #b6c6ad;
  border-radius: 10px;
  background-color: #dfe9d6;
}

.panel-tags { display: flex; flex-wrap: wrap; gap: 4px 5px; margin-top: 5px; }
.panel .tag { padding: 2px 6px; border-radius: 4px; color: #45564e; background: #e9e9df; font-size: .67rem; font-weight: 650; }
.panel .tag.green { color: #2d5746; background: #dceadd; }
.panel .tag.gold { color: #694c20; background: #f2e6cb; }
.panel .tag.red { color: #853f37; background: #f3ddd5; }

.panel-actions, .panel-toolbar, .panel-filters { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.panel-actions { justify-content: flex-end; flex: 0 1 auto; }
.panel-toolbar { margin: 10px 0; }
.panel-foot .panel-toolbar { margin: 0; justify-content: flex-end; }
.panel-filters { margin-bottom: 11px; }
.panel-actions .btn { flex: 0 0 auto; }
.panel .btn[aria-pressed="true"] { color: #213b30; background: #cbe3ce; border-color: #95bda1; }

.panel .hint { font-size: .82rem; line-height: 1.55; }
.panel-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px 12px;
  color: #405e51;
  background: #e6ebdf;
  border-radius: 8px;
  border: 1px solid #d8e0cf;
}
.panel-note p { margin: 0; }
.panel-note .icon { flex: 0 0 16px; width: 16px; height: 16px; margin-top: 2px; }
.panel-warning { color: #7e4335; background: #fae9de; border-color: #ecccb9; }

.panel .bar {
  height: 6px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 99px;
  background: #dcdfd2;
}
.panel .bar i { display: block; height: 100%; background: #44816a; }

@media (max-width: 640px) {
  .panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    transform: none;
    max-height: calc(100% - 34px);
    border-radius: 16px 16px 0 0;
    animation-name: panel-rise;
  }

  @keyframes panel-rise {
    from { opacity: .65; transform: translateY(13px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .panel-body { padding: 14px; }
  .panel-foot { padding: 11px 14px calc(11px + env(safe-area-inset-bottom)); }
  .panel-row-icon { width: 33px; height: 33px; padding: 7px; }
  .panel-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .panel .row { display: grid; grid-template-columns: auto minmax(0, 1fr); }
  .panel .row .grow:first-child { grid-column: 1 / -1; }
  .panel-actions { grid-column: 1 / -1; justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  .panel { animation: none; }
}
