:root {
  --green: #005246;
  --green-2: #0a6b5d;
  --mint: #dcefeb;
  --mint-2: #eff8f5;
  --gold: #d7b56d;
  --orange: #d7864f;
  --ink: #102d29;
  --muted: #6f7c78;
  --line: #dce5e1;
  --paper: #fffaf6;
  --white: #ffffff;
  --shadow: 0 18px 48px rgba(0, 82, 70, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(135deg, #fbf3ee 0%, #f7fbf9 48%, #edf6f3 100%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  max-width: 100%;
}

button {
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, opacity 0.16s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.hidden {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(460px, 100%);
  padding: 34px;
  border: 1px solid rgba(0, 82, 70, 0.12);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green-2);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--ink);
}

h1 {
  font-size: 32px;
}

h2 {
  font-size: 28px;
}

h3 {
  font-size: 20px;
}

.login-copy,
.hint,
.panel-head p {
  color: var(--muted);
  line-height: 1.7;
}

label {
  display: grid;
  gap: 8px;
  margin: 18px 0;
  color: var(--ink);
  font-weight: 700;
}

.field {
  display: grid;
  gap: 7px;
  margin: 0;
  min-width: 0;
}

.field span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.field small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--white);
  outline: none;
}

textarea {
  min-height: 64px;
  padding: 10px 14px;
  line-height: 1.55;
  resize: vertical;
}

.readonly-value {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--mint-2);
}

.customer-maintain-form {
  display: grid;
  gap: 16px;
}

.customer-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.customer-form-grid .field {
  min-width: 0;
}

.customer-form-grid input,
.customer-form-grid select,
.customer-form-grid textarea {
  width: 100%;
}

.service-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.service-grid .field:last-child {
  grid-column: 1 / -1;
}

.ops-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sub-section-title {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0, 82, 70, 0.12);
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
  min-height: 42px;
  border-radius: 12px;
  padding: 0 18px;
  border: 0;
  font-weight: 800;
  white-space: nowrap;
}

.primary-button {
  color: var(--white);
  background: var(--green);
}

.secondary-button {
  color: var(--green);
  background: var(--mint);
}

.danger-button {
  color: #8d3f22;
  background: #ffe4d6;
}

.danger-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.small-button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 13px;
}

.ghost-button {
  width: 100%;
  color: var(--green);
  background: rgba(255, 255, 255, 0.58);
}

.form-message {
  min-height: 22px;
  color: var(--orange);
  font-weight: 700;
}

.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 18px;
  background: var(--green);
  color: var(--white);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 10px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  color: var(--green);
  background: var(--mint);
  font-weight: 900;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.7);
}

.nav-list {
  display: grid;
  gap: 8px;
  flex: 1;
}

.nav-item {
  position: relative;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 0 14px;
  text-align: left;
  color: rgba(255, 255, 255, 0.76);
  background: transparent;
  font-weight: 800;
}

.nav-item.active {
  color: var(--green);
  background: var(--mint);
}

.nav-badge {
  position: absolute;
  top: 9px;
  right: 10px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  padding: 0 5px;
  color: #ffffff;
  background: #d9472f;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

.content-shell {
  min-width: 0;
  padding: clamp(18px, 2.2vw, 28px);
  overflow-x: clip;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.boundary-note {
  flex: 0 1 auto;
  border: 1px solid rgba(215, 181, 109, 0.28);
  border-radius: 999px;
  padding: 10px 16px;
  color: #7a5b12;
  background: #fff3c9;
  font-weight: 800;
}

.page {
  display: none;
}

.page.active {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 14px;
}

.metric-card,
.panel,
.row-card,
.event-card,
.template-card {
  min-width: 0;
  border: 1px solid rgba(0, 82, 70, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 26px rgba(0, 82, 70, 0.06);
}

.metric-card {
  padding: 18px;
}

.metric-value {
  margin-top: 10px;
  color: var(--green);
  font-size: 30px;
  font-weight: 900;
}

.panel {
  padding: 20px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
  min-width: 0;
}

.panel-head > div {
  min-width: 0;
}

.toolbar,
.inline-form,
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.result-summary {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.inline-form {
  padding: 14px;
  border-radius: 14px;
  background: var(--mint-2);
  margin-bottom: 16px;
}

.compact-form {
  align-items: stretch;
}

.no-margin {
  margin: 0;
}

.filter-bar {
  padding: 12px;
  border: 1px solid rgba(0, 82, 70, 0.08);
  border-radius: 14px;
  background: var(--mint-2);
  margin-bottom: 16px;
}

.filter-bar input,
.filter-bar select {
  flex: 1 1 160px;
}

.inline-form input,
.inline-form select {
  flex: 1 1 190px;
}

.list,
.table-list,
.timeline-list,
.template-list {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.compact-list {
  gap: 8px;
}

.table-head,
.customer-row-compact,
.advisor-row-compact,
.template-row-compact,
.file-row-compact {
  display: grid;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.customer-table-head,
.customer-row-compact {
  grid-template-columns: minmax(220px, 1.35fr) minmax(120px, 0.75fr) minmax(160px, 1fr) minmax(110px, 0.7fr) minmax(130px, 0.75fr) 118px;
}

.advisor-table-head,
.advisor-row-compact {
  grid-template-columns: minmax(220px, 1.2fr) minmax(180px, 1fr) minmax(110px, 0.65fr) minmax(90px, 0.55fr) 118px;
}

.template-table-head,
.template-row-compact {
  grid-template-columns: minmax(240px, 1.25fr) minmax(110px, 0.6fr) minmax(90px, 0.55fr) minmax(260px, 1.2fr) 170px;
}

.file-table-head,
.file-row-compact {
  grid-template-columns: minmax(220px, 1.25fr) minmax(260px, 1.2fr) minmax(120px, 0.7fr) minmax(110px, 0.65fr) 118px;
}

.customer-table-wrap {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 2px;
}

.table-head {
  min-width: 760px;
  margin-bottom: 8px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.customer-row-compact,
.advisor-row-compact,
.template-row-compact,
.file-row-compact {
  min-width: 760px;
  padding: 14px;
  border: 1px solid rgba(0, 82, 70, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  cursor: pointer;
}

.admin-table-wrap {
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 2px;
}

.customer-row-compact.selected,
.advisor-row-compact.selected,
.template-row-compact.selected,
.file-row-compact.selected {
  border-color: var(--green);
  background: var(--mint-2);
  box-shadow: 0 10px 24px rgba(0, 82, 70, 0.08);
}

.customer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.package-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.65fr);
  gap: 14px;
  align-items: start;
}

.package-workspace .result-summary {
  grid-column: 1 / -1;
}

.file-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid rgba(0, 82, 70, 0.1);
  margin: 10px 0 16px;
}

.file-tab {
  min-height: 42px;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.file-tab.active {
  color: var(--green);
  border-bottom-color: var(--green);
}

.package-table-wrap {
  min-width: 0;
  overflow-x: auto;
}

.package-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.package-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid rgba(0, 82, 70, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
}

.package-card:hover,
.package-card.selected {
  border-color: var(--green);
  background: var(--mint-2);
  box-shadow: 0 12px 28px rgba(0, 82, 70, 0.08);
}

.package-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.package-card-meta,
.package-card-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.package-card-counts span {
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  background: rgba(0, 82, 70, 0.06);
  font-size: 12px;
  font-weight: 800;
}

.folder-card-head {
  display: flex;
  gap: 12px;
  align-items: center;
}

.folder-icon {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 7px;
  background: var(--green);
  box-shadow: inset 0 -8px 0 rgba(255, 255, 255, 0.12);
  vertical-align: -5px;
}

.folder-icon::before {
  content: "";
  position: absolute;
  left: 4px;
  top: -6px;
  width: 18px;
  height: 10px;
  border-radius: 6px 6px 0 0;
  background: var(--green);
}

.folder-card-count {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.folder-card-count strong {
  color: var(--green);
  font-size: 30px;
  line-height: 1;
}

.folder-card-count span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.package-table-head,
.package-table-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) minmax(120px, 0.8fr) minmax(92px, 0.65fr) 64px 64px minmax(104px, 0.75fr) 112px;
  gap: 12px;
  align-items: center;
  min-width: 860px;
}

.package-table-head,
.recent-file-head {
  padding: 0 12px 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.package-table-list,
.recent-file-list {
  display: grid;
  gap: 8px;
}

.package-table-row,
.recent-file-row {
  padding: 14px 12px;
  border: 1px solid rgba(0, 82, 70, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
}

.package-table-row:hover,
.package-table-row.selected,
.recent-file-row:hover,
.recent-file-row.selected {
  border-color: var(--green);
  background: var(--mint-2);
}

.package-table-row > div,
.recent-file-row > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

.package-table-row .row-title {
  display: flex;
  gap: 10px;
  align-items: center;
}

.package-table-row .folder-icon {
  width: 30px;
  height: 22px;
  border-radius: 6px;
}

.package-table-row .folder-icon::before {
  top: -5px;
  width: 15px;
  height: 8px;
}

.pending-number {
  color: #b15f00;
  font-weight: 900;
}

.recent-file-head,
.recent-file-row {
  display: grid;
  grid-template-columns: 104px minmax(130px, 0.85fr) minmax(240px, 1.55fr) 82px 82px minmax(150px, 1fr) 96px;
  gap: 12px;
  align-items: center;
  min-width: 980px;
}

.package-detail {
  display: grid;
  gap: 16px;
  min-width: 0;
  border: 1px solid rgba(0, 82, 70, 0.1);
  border-radius: 18px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.94);
}

.package-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

.package-detail-head > div {
  min-width: 0;
}

.package-detail-head h3 {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 4px 0 4px;
  font-size: 22px;
}

.package-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 10px;
}

.package-stats div {
  display: grid;
  gap: 4px;
  border-radius: 14px;
  padding: 14px;
  background: var(--mint-2);
}

.package-stats strong {
  color: var(--green);
  font-size: 24px;
}

.package-stats span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.package-section {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.package-file-list {
  display: grid;
  gap: 10px;
}

.package-file-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 14px;
  align-items: center;
  border: 1px solid rgba(0, 82, 70, 0.09);
  border-radius: 14px;
  padding: 14px;
  background: rgba(248, 252, 250, 0.9);
}

.package-file-card.selected {
  border-color: var(--green);
  background: var(--mint-2);
}

.package-file-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.package-file-main strong,
.package-file-main span,
.package-file-main p {
  overflow-wrap: anywhere;
}

.package-file-main span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.package-file-main p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.package-file-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.folder-file-head,
.folder-file-row {
  display: grid;
  grid-template-columns: minmax(260px, 2.1fr) minmax(112px, 0.85fr) 76px 96px 76px 96px;
  gap: 10px;
  align-items: center;
  min-width: 760px;
}

.folder-file-head {
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.folder-file-list {
  display: grid;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
}

.folder-file-row {
  padding: 14px;
  border: 1px solid rgba(0, 82, 70, 0.08);
  border-radius: 14px;
  background: rgba(248, 252, 250, 0.92);
}

.folder-file-row.selected {
  border-color: var(--green);
  background: var(--mint-2);
}

.folder-file-row > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

.folder-file-row .row-title,
.recent-file-row .row-title {
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.file-preview-box {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(0, 82, 70, 0.1);
  border-radius: 14px;
  padding: 16px;
  background: var(--mint-2);
}

.file-preview-box strong,
.file-preview-box small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.file-preview-box span,
.file-preview-box small {
  color: var(--muted);
  line-height: 1.55;
}

.file-open-button {
  width: fit-content;
  margin-top: 4px;
}

/* 文件预览 */
.preview-loading {
  text-align: center;
  padding: 24px;
  color: var(--muted);
}

.preview-error {
  text-align: center;
  padding: 24px;
  color: #d93025;
}

.preview-unsupported {
  text-align: center;
  padding: 24px;
  color: var(--muted);
}

.preview-image {
  display: none;
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
  border-radius: 8px;
  margin: 0 auto;
}

.preview-iframe {
  width: 100%;
  height: 60vh;
  border: none;
  border-radius: 8px;
  background: #f5f5f5;
}

/* 备注编辑 */
.note-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.note-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(0, 82, 70, 0.15);
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
  font-family: inherit;
  resize: vertical;
  background: #fff;
  transition: border-color 0.2s;
}

.note-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0, 82, 70, 0.1);
}

.note-saved {
  background: #16a34a !important;
  pointer-events: none;
}

.detail-panel {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.detail-head,
.detail-section {
  border: 1px solid rgba(0, 82, 70, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 26px rgba(0, 82, 70, 0.05);
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  padding: 18px;
}

.detail-head > div {
  min-width: 0;
}

.detail-section {
  padding: 16px;
}

.detail-section h4 {
  margin: 0 0 12px;
  font-size: 16px;
}

.detail-form,
.node-form,
.flow-form,
.flow-head-form,
.template-head-form,
.template-node-row,
.file-push-form {
  display: grid;
  gap: 10px;
}

.detail-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-form h4,
.detail-form button {
  grid-column: 1 / -1;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.node-form {
  grid-template-columns: minmax(130px, 1fr) 140px 120px minmax(160px, 1.2fr) auto;
  margin-bottom: 12px;
}

.flow-form {
  grid-template-columns: minmax(180px, 1fr) 160px auto;
  margin-bottom: 12px;
}

.flow-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.flow-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(0, 82, 70, 0.12);
  border-radius: 14px;
  background: rgba(239, 248, 245, 0.72);
}

.flow-tabs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 0 2px;
}

.flow-tab {
  display: grid;
  gap: 4px;
  min-width: 170px;
  border: 1px solid rgba(0, 82, 70, 0.12);
  border-radius: 14px;
  padding: 12px;
  color: var(--green);
  background: rgba(255, 255, 255, 0.82);
  text-align: left;
  font-weight: 900;
}

.flow-tab span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.flow-tab.active {
  border-color: var(--green);
  background: var(--mint);
  box-shadow: 0 8px 18px rgba(0, 82, 70, 0.08);
}

.flow-head-form {
  grid-template-columns: minmax(180px, 1fr) 150px 120px auto auto;
  align-items: center;
}

.node-form.simplified {
  grid-template-columns: minmax(150px, 1fr) 150px 120px minmax(180px, 1.2fr) auto;
}

.labeled-inline {
  align-items: end;
}

.node-list,
.file-group {
  display: grid;
  gap: 10px;
}

.node-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfefd;
}

.node-card.deleted {
  opacity: 0.72;
  background: #f7f2ed;
}

.node-card form[data-form="node-update"] {
  display: grid;
  grid-template-columns: 70px minmax(130px, 1fr) 140px 110px 120px minmax(160px, 1.2fr) auto;
  gap: 10px;
  align-items: start;
}

.node-table-head {
  grid-template-columns: 70px minmax(130px, 1fr) 140px 110px 120px minmax(160px, 1.2fr) minmax(140px, auto);
}

.node-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 13px;
}

.mini-row,
.file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(0, 82, 70, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.file-row {
  grid-template-columns: minmax(0, 1fr) 150px 130px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.info-grid div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid rgba(0, 82, 70, 0.08);
  border-radius: 12px;
  background: var(--mint-2);
}

.info-grid span {
  color: var(--muted);
  font-size: 13px;
}

.info-grid strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.template-head-form {
  grid-template-columns: minmax(200px, 1fr) 140px auto;
  margin-bottom: 14px;
}

.section-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.template-node-list {
  display: grid;
  gap: 10px;
}

.template-node-row {
  display: grid;
  grid-template-columns: 92px minmax(140px, 1fr) 110px minmax(180px, 1.4fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid rgba(0, 82, 70, 0.1);
  border-radius: 14px;
  background: #fff;
}

.template-node-row.dragging {
  opacity: 0.62;
  border-color: var(--brand);
  box-shadow: 0 14px 24px rgba(0, 82, 70, 0.12);
}

.template-node-order-cell {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.template-node-order {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 82, 70, 0.12);
  border-radius: 12px;
  font-weight: 900;
  color: var(--ink);
}

.drag-handle {
  min-height: 42px;
  border: 1px dashed rgba(0, 82, 70, 0.2);
  border-radius: 12px;
  background: var(--mint-2);
  color: var(--brand);
  cursor: grab;
}

.drag-handle:active {
  cursor: grabbing;
}

.template-node-head {
  grid-template-columns: 92px minmax(140px, 1fr) 110px minmax(180px, 1.4fr) minmax(88px, auto);
}

.template-node-create-card {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(0, 82, 70, 0.12);
  border-radius: 14px;
  background: var(--mint-2);
}

.compact-title {
  margin-bottom: 0;
}

.compact-title h4 {
  margin: 0;
}

.template-node-create-grid {
  display: grid;
  grid-template-columns: 90px minmax(150px, 1fr) 120px minmax(220px, 1.4fr);
  gap: 10px;
  align-items: end;
}

.form-footer {
  display: flex;
  justify-content: flex-end;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.settings-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: 14px;
  margin: 14px 0;
}

.setting-card {
  padding: 16px;
  border: 1px solid rgba(0, 82, 70, 0.1);
  border-radius: 14px;
  background: var(--mint-2);
}

.setting-card.status-card {
  display: grid;
  gap: 4px;
  background: rgba(255, 255, 255, 0.9);
}

.setting-card.status-card strong {
  color: var(--green);
  font-size: 28px;
  line-height: 1;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.setting-card.action-card {
  display: grid;
  gap: 14px;
  align-content: start;
  background: rgba(255, 255, 255, 0.94);
}

.setting-card.danger-zone {
  border-color: rgba(202, 90, 45, 0.22);
  background: #fff8f3;
}

.setting-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.row-card,
.event-card,
.template-card {
  padding: 16px;
}

.row-card {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 240px) minmax(120px, 160px) auto;
  gap: 12px;
  align-items: center;
}

.customer-row {
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 220px) minmax(210px, 300px) minmax(90px, 120px) auto;
}

.customer-row .flow-config {
  grid-column: 1 / -1;
}

.flow-config {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  background: var(--mint-2);
}

.advisor-row {
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 280px) minmax(80px, 100px) minmax(80px, 100px) auto;
}

.registration-row {
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 260px) auto;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  min-width: 0;
}

.compact-actions {
  align-items: center;
}

.row-title {
  font-weight: 900;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.row-sub,
.muted {
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  color: var(--green);
  background: var(--mint);
  font-size: 13px;
  font-weight: 900;
  white-space: normal;
  overflow-wrap: anywhere;
}

.tag.gold {
  color: #7a5b12;
  background: #fff1bf;
}

.tag.orange {
  color: #8d3f22;
  background: #ffe4d6;
}

.archived-row {
  opacity: 0.78;
  background: #f8f5f0;
}

.event-card {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 160px;
  gap: 14px;
  align-items: center;
}

.event-card > div {
  min-width: 0;
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.42fr);
  gap: 16px;
  align-items: start;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.calendar-week {
  padding: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.calendar-cell {
  min-height: 118px;
  border: 1px solid rgba(0, 82, 70, 0.1);
  border-radius: 14px;
  padding: 10px;
  text-align: left;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 20px rgba(0, 82, 70, 0.04);
}

.calendar-cell.blank {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.calendar-cell strong {
  display: block;
  margin-bottom: 6px;
  color: var(--green);
  font-size: 18px;
}

.calendar-cell em {
  display: inline-flex;
  margin-bottom: 8px;
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--green);
  background: var(--mint);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.calendar-cell.has-event {
  border-color: rgba(0, 82, 70, 0.2);
}

.calendar-cell.selected {
  border-color: var(--green);
  background: var(--mint-2);
  box-shadow: 0 12px 26px rgba(0, 82, 70, 0.12);
}

.calendar-preview {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.calendar-preview span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-side {
  position: sticky;
  top: 24px;
  padding: 16px;
  border: 1px solid rgba(0, 82, 70, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 26px rgba(0, 82, 70, 0.05);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 45, 41, 0.36);
}

.modal-card {
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid rgba(0, 82, 70, 0.14);
  border-radius: 20px;
  padding: 22px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.confirm-card {
  width: min(460px, 100%);
}

.detail-modal-card {
  width: min(1120px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding-top: 0;
}

.detail-modal-card > .panel-head {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 -22px 18px;
  padding: 22px;
  border-bottom: 1px solid rgba(0, 82, 70, 0.08);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.detail-modal-body {
  max-height: calc(100vh - 156px);
  overflow: auto;
  padding-right: 4px;
}

.modal-form {
  display: grid;
  gap: 12px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 48px));
  border: 1px solid rgba(0, 82, 70, 0.14);
  border-radius: 14px;
  padding: 13px 16px;
  color: #8d3f22;
  background: #fff2e8;
  box-shadow: var(--shadow);
  font-weight: 800;
}

.toast.success {
  color: var(--green);
  background: var(--mint);
}

.event-date {
  color: var(--green);
  font-size: 22px;
  font-weight: 900;
}

.empty {
  display: grid;
  gap: 6px;
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

.empty strong {
  color: var(--ink);
}

.empty span {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1180px) {
  .package-workspace {
    grid-template-columns: 1fr;
  }

  .package-detail {
    position: static;
  }

  .calendar-layout {
    grid-template-columns: 1fr;
  }

  .calendar-side {
    position: static;
  }

  .table-head,
  .customer-row-compact {
    grid-template-columns: minmax(180px, 1.2fr) minmax(100px, 0.7fr) minmax(140px, 1fr) minmax(100px, 0.7fr) 110px;
  }

  .advisor-table-head,
  .advisor-row-compact,
  .template-table-head,
  .template-row-compact,
  .file-table-head,
  .file-row-compact {
    grid-template-columns: minmax(200px, 1fr) minmax(140px, 0.8fr) minmax(90px, 0.6fr) 112px;
  }

  .customer-table-head span:nth-child(5),
  .customer-row-compact > div:nth-child(5) {
    display: none;
  }

  .template-table-head span:nth-child(4),
  .template-row-compact > div:nth-child(4),
  .file-table-head span:nth-child(2),
  .file-row-compact > div:nth-child(2) {
    display: none;
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(3, 1fr);
  }

  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .row-card,
  .event-card,
  .topbar,
  .panel-head,
  .detail-head {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .flow-config {
    grid-template-columns: 1fr;
  }

  .calendar-layout,
  .detail-form,
  .flow-form,
  .flow-head-form,
  .node-form,
  .node-card form[data-form="node-update"],
  .file-row,
  .template-head-form,
  .customer-form-grid,
  .template-node-row,
  .template-node-create-grid,
  .settings-grid,
  .settings-actions {
    grid-template-columns: 1fr;
  }

  .table-head {
    display: none;
  }

  .customer-row-compact,
  .advisor-row-compact,
  .template-row-compact,
  .file-row-compact,
  .package-table-row,
  .recent-file-row,
  .calendar-grid {
    grid-template-columns: 1fr;
  }

  .calendar-cell.blank,
  .calendar-week {
    display: none;
  }

  .calendar-side {
    position: static;
  }

  .customer-row-compact,
  .advisor-row-compact,
  .template-row-compact,
  .file-row-compact,
  .package-table-row,
  .recent-file-row {
    min-width: 0;
    padding: 14px;
    border-radius: 14px;
  }

  .customer-row-compact > div,
  .advisor-row-compact > div,
  .template-row-compact > div,
  .file-row-compact > div,
  .package-table-row > div,
  .recent-file-row > div {
    min-width: 0;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .package-detail-head,
  .package-file-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .package-detail-head,
  .package-file-card,
  .folder-file-row {
    grid-template-columns: 1fr;
  }

  .package-table-head,
  .recent-file-head,
  .folder-file-head {
    display: none;
  }

  .folder-file-row {
    min-width: 0;
  }

  .detail-modal-card {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    padding: 16px;
  }
}
