:root {
  --bg: #eef5f8;
  --surface: #ffffff;
  --surface-soft: #f9fafc;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --green: #0f766e;
  --red: #dc2626;
  --amber: #b45309;
  --ink: #111827;
  --shadow: 0 20px 48px rgba(33, 43, 69, 0.1);
  --shadow-soft: 0 10px 30px rgba(33, 43, 69, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, #eef7ff 0%, #f7fbf4 48%, #fff7ec 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

body.auth-locked {
  min-height: 100vh;
  overflow: auto;
}

body.auth-locked .app-shell,
body.auth-locked .topbar,
body.auth-locked dialog {
  display: none;
}

.access-gate {
  display: none;
  min-height: 100vh;
  align-items: center;
  justify-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 18%, rgba(185, 233, 227, 0.42), transparent 32%),
    radial-gradient(circle at 78% 28%, rgba(255, 195, 164, 0.32), transparent 30%),
    linear-gradient(135deg, #eef7ff 0%, #f7fbf4 48%, #fff7ec 100%);
}

body.auth-locked .access-gate {
  display: grid;
}

.access-card {
  width: min(440px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 28px;
  border: 1px solid rgba(202, 214, 232, 0.78);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.access-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.access-brand span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.access-brand h1 {
  margin: 4px 0 0;
  font-size: 24px;
  letter-spacing: 0;
}

.access-form {
  display: grid;
  gap: 14px;
}

.access-register-form {
  display: none;
  gap: 16px;
}

body.register-mode .access-form,
body.register-mode .access-divider,
body.register-mode .access-writer-btn {
  display: none;
}

body.register-mode .access-register-form {
  display: grid;
}

body.register-mode .access-card {
  width: min(560px, 100%);
}

.access-step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.access-step-head .ghost-btn {
  width: auto;
  min-height: 36px;
  padding: 0 12px;
}

.access-step-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.register-code-step,
.register-detail-step {
  display: grid;
  gap: 14px;
}

.register-code-step .primary-btn,
.register-detail-step .primary-btn {
  width: 100%;
}

.register-detail-step {
  display: none;
}

.verified-code-card {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 8px;
  background: #eff6ff;
  padding: 12px;
}

.verified-code-card strong {
  color: var(--primary-dark);
  font-size: 16px;
}

.verified-code-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.access-form .primary-btn,
.access-writer-btn {
  width: 100%;
}

.login-error {
  min-height: 20px;
  margin: -4px 0 0;
  color: var(--red);
  font-size: 13px;
}

.access-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.access-divider::before,
.access-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.admin-logout-btn {
  align-self: end;
}

body.writer-public-mode .sidebar {
  display: none;
}

body.writer-public-mode .app-shell {
  grid-template-columns: minmax(0, 1fr);
}

body.writer-public-mode .main {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
}

body.writer-public-mode .topbar,
body.writer-public-mode .admin-logout-btn,
body.writer-public-mode .view:not(#writerView) {
  display: none !important;
}

body.writer-public-mode #writerView {
  display: block;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 22px 16px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.9) 0%, rgba(239, 249, 250, 0.92) 35%, rgba(239, 239, 255, 0.9) 68%, rgba(255, 241, 233, 0.88) 100%),
    #f8fbff;
  color: #243045;
  border-right: 1px solid rgba(202, 214, 232, 0.72);
  box-shadow: 12px 0 36px rgba(94, 125, 170, 0.12);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 6px 24px;
  border-bottom: 1px solid rgba(167, 188, 214, 0.34);
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffe6a8 0%, #ffc3a4 48%, #b9e9e3 100%);
  color: #293043;
  font-weight: 800;
  overflow: hidden;
  box-shadow: 0 12px 24px rgba(244, 169, 132, 0.24);
}

.brand-mark img,
.brand-preview-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 4px;
  color: #76839a;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 6px;
  margin-top: 18px;
}

.nav-item {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #536176;
  text-align: left;
  padding: 0 12px;
  font-weight: 700;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.nav-item:hover,
.nav-item.active {
  background:
    linear-gradient(90deg, rgba(185, 233, 227, 0.72), rgba(232, 224, 255, 0.7) 58%, rgba(255, 236, 216, 0.68)),
    rgba(255, 255, 255, 0.74);
  color: #1f2a44;
  box-shadow:
    inset 4px 0 0 #67d7cf,
    0 10px 22px rgba(98, 125, 168, 0.14);
}

.nav-item:hover {
  transform: translateX(2px);
}

.main {
  min-width: 0;
  padding: 26px;
}

.site-record {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.site-record a {
  color: inherit;
  text-decoration: none;
}

.site-record a:hover {
  color: var(--primary);
}

.access-record {
  margin-top: 18px;
}

.app-record {
  margin-top: 22px;
  padding: 12px 0 4px;
}

.hero-board {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 154px;
  margin-bottom: 16px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(119, 139, 224, 0.16), rgba(94, 186, 164, 0.12) 46%, rgba(246, 196, 132, 0.16)),
    #ffffff;
  padding: 24px;
  box-shadow: var(--shadow);
}

.hero-board h2 {
  margin-top: 8px;
  font-size: 26px;
}

.hero-board p {
  max-width: 760px;
  margin-top: 8px;
}

.eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.topbar,
.section-bar,
.panel-heading,
.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 22px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  color: var(--ink);
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  color: var(--ink);
  font-size: 18px;
}

h3 {
  color: var(--ink);
  font-size: 16px;
}

p {
  color: var(--muted);
  line-height: 1.6;
}

#pageSubtitle {
  margin-top: 6px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: var(--muted);
  font-size: 12px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  outline: none;
}

.field textarea {
  min-height: 78px;
  resize: vertical;
}

.field .multi-select {
  min-height: 112px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.field.compact {
  min-width: 110px;
}

.field.is-hidden,
.is-hidden {
  display: none;
}

.filter-card {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid #dce8f3;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.07), rgba(15, 118, 110, 0.06)),
    #ffffff;
  box-shadow: var(--shadow-soft);
}

.invite-filter-card {
  justify-content: flex-start;
}

.inline-filter {
  min-width: 170px;
}

.link-btn {
  min-height: 0;
  margin-top: 4px;
  border: 0;
  background: transparent;
  color: var(--primary);
  padding: 0;
  font-size: 12px;
  font-weight: 700;
}

.link-btn:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.dialog-warning {
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff1f2;
  color: #991b1b;
  padding: 12px;
  line-height: 1.6;
}

.blocked-login-card {
  max-width: 760px;
  border-color: #fecaca;
  background:
    linear-gradient(135deg, rgba(254, 202, 202, 0.42), rgba(255, 255, 255, 0.92)),
    #ffffff;
}

.primary-btn,
.ghost-btn,
.icon-btn,
.small-btn {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
}

.primary-btn {
  background: var(--primary);
  color: #fff;
}

.primary-btn:hover {
  background: var(--primary-dark);
}

.ghost-btn,
.small-btn {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}

.ghost-btn:hover,
.small-btn:hover {
  background: var(--surface-soft);
}

.danger-btn {
  min-height: 38px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: linear-gradient(135deg, #ef4444, #fb7185);
  color: #ffffff;
  padding: 0 14px;
  font-weight: 800;
  box-shadow: 0 14px 28px rgba(239, 68, 68, 0.18);
}

.danger-btn:hover {
  background: linear-gradient(135deg, #dc2626, #f43f5e);
}

.icon-btn {
  width: 36px;
  padding: 0;
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
  font-size: 24px;
  line-height: 1;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

#metrics.metric-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.metric-card,
.panel,
.person-card,
.department-card,
.partner-card,
.level-card,
.permission-card,
.writer-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel,
.person-card,
.department-card,
.partner-card,
.level-card,
.permission-card,
.writer-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 252, 255, 0.98)),
    var(--surface);
}

.person-card,
.partner-card,
.department-card,
.writer-card {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.person-card:hover,
.partner-card:hover,
.department-card:hover,
.writer-card:hover {
  border-color: #c7d8f6;
  box-shadow: 0 24px 54px rgba(33, 43, 69, 0.13);
  transform: translateY(-2px);
}

.person-head-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.metric-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  background: linear-gradient(135deg, #7b84d1 0%, #a09ad0 100%);
  color: #ffffff;
  border-color: transparent;
  min-height: 128px;
}

.metric-card:nth-child(2n) {
  background: linear-gradient(135deg, #50bfa5 0%, #80c7b6 100%);
}

.metric-card:nth-child(3n) {
  background: linear-gradient(135deg, #d98897 0%, #e7bd7b 100%);
}

.metric-card:nth-child(4n) {
  background: linear-gradient(135deg, #b479c7 0%, #cc8199 100%);
}

.metric-card:nth-child(5n) {
  background: linear-gradient(135deg, #5f9ed4 0%, #68bfd0 100%);
}

.metric-card span {
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  font-weight: 800;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  color: #ffffff;
  font-size: 28px;
}

.metric-card small {
  display: block;
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 700;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.7fr);
  gap: 16px;
}

.chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.8fr);
  gap: 16px;
  margin-bottom: 16px;
}

.chart-grid.single-chart {
  grid-template-columns: 1fr;
}

canvas {
  display: block;
  width: 100%;
  height: 320px;
}

.panel canvas {
  border-top: 1px solid #eef2f7;
  background: #ffffff;
}

.chart-scroll-control {
  display: grid;
  grid-template-columns: auto minmax(140px, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  border-top: 1px solid #eef2f7;
  background:
    linear-gradient(90deg, rgba(239, 249, 250, 0.88), rgba(248, 250, 252, 0.96) 45%, rgba(255, 241, 233, 0.7)),
    #ffffff;
  padding: 10px 18px 12px;
}

.chart-scroll-control span,
.chart-scroll-control output {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.chart-scroll-control input[type="range"] {
  width: 100%;
  accent-color: #67d7cf;
}

.chart-scroll-control input[type="range"]:disabled {
  opacity: 0.42;
}

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f3f4f6;
  padding: 3px;
}

.segmented button {
  min-width: 42px;
  min-height: 28px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
}

.segmented button.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: var(--shadow-soft);
}

.chart-control-stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.metric-switch {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 36px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #f8fafc;
  padding: 3px;
}

.metric-switch button {
  min-height: 28px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #64748b;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 800;
}

.metric-switch button.active {
  background: #111827;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.chart-department-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 42px;
  border-top: 1px solid #eef2f7;
  background: #ffffff;
  padding: 8px 14px;
}

.chart-department-row:empty {
  display: none;
}

.chart-department-row > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.chart-department-row .metric-switch {
  max-width: 100%;
}

.panel {
  overflow: hidden;
}

.brand-settings-panel {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(260px, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(239, 246, 255, 0.92), rgba(246, 253, 246, 0.92) 54%, rgba(255, 247, 237, 0.95)),
    #ffffff;
}

.brand-preview-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 94px;
  border: 1px solid rgba(191, 219, 254, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 14px;
}

.brand-preview-mark {
  display: grid;
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(135deg, #f7d767, #f9b65c);
  color: #111827;
  font-size: 20px;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(244, 179, 64, 0.18);
}

.brand-preview-card span,
.brand-setting-copy span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.brand-preview-card h2 {
  margin-top: 4px;
  font-size: 22px;
}

.brand-setting-copy {
  display: grid;
  gap: 6px;
}

.brand-setting-copy strong {
  color: var(--ink);
  font-size: 16px;
}

.danger-zone-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
  border-color: rgba(252, 165, 165, 0.72);
  background:
    linear-gradient(135deg, rgba(255, 241, 242, 0.94), rgba(255, 251, 235, 0.9) 58%, rgba(255, 255, 255, 0.96)),
    #ffffff;
  padding: 18px;
  box-shadow: 0 18px 44px rgba(178, 48, 48, 0.09);
}

.danger-zone-panel h2 {
  margin-top: 7px;
  color: #7f1d1d;
}

.danger-zone-panel p {
  max-width: 780px;
  margin-top: 8px;
  color: #7f4638;
}

.danger-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid rgba(248, 113, 113, 0.42);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: #b91c1c;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 900;
}

.danger-guard-list,
.danger-zone-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.danger-guard-list {
  margin-top: 12px;
}

.danger-guard-list span {
  min-height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: #9f1239;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(253, 164, 175, 0.42);
}

.danger-zone-actions {
  justify-content: flex-end;
}

.below-panel {
  margin-top: 16px;
}

.panel-heading {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

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

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.panel .table-wrap {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  text-align: left;
  white-space: nowrap;
}

th {
  background: var(--surface-soft);
  color: #4b5563;
  font-size: 13px;
  font-weight: 700;
}

td {
  color: #374151;
  font-size: 14px;
}

.wrap-cell {
  max-width: 320px;
  white-space: normal;
  line-height: 1.55;
}

tr:last-child td {
  border-bottom: 0;
}

.section-bar {
  margin-bottom: 16px;
}

.section-bar p {
  margin-top: 4px;
}

.people-grid,
.department-grid,
.partner-grid,
.level-grid,
.permission-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

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

.rank-admin-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.72fr) minmax(0, 1.28fr);
  gap: 16px;
}

.person-card,
.department-card,
.partner-card,
.level-card,
.permission-card,
.writer-card {
  padding: 16px;
}

.person-card {
  padding: 12px;
}

.person-head,
.level-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  border-radius: 8px;
  background: #eef2ff;
  color: #3730a3;
  padding: 4px 8px;
  font-weight: 700;
}

.badge.green {
  background: #ecfdf5;
  color: var(--green);
}

.badge.amber {
  background: #fffbeb;
  color: var(--amber);
}

.badge.red {
  background: #fef2f2;
  color: var(--red);
}

.badge.gray {
  background: #f3f4f6;
  color: #4b5563;
}

.cute-icon {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: #fff7ed;
  font-size: 24px;
}

.meta-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.person-card .meta-list {
  gap: 6px;
  margin-top: 10px;
}

.person-department-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
  gap: 7px;
  margin-top: 10px;
}

.person-department-strip button {
  min-height: 48px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  color: #1e3a8a;
  padding: 7px 9px;
  text-align: left;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.person-department-strip button:hover {
  border-color: #93c5fd;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.1);
  transform: translateY(-1px);
}

.person-department-strip span,
.person-department-strip strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-department-strip span {
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.person-department-strip strong {
  margin-top: 4px;
  color: #111827;
  font-size: 13px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 14px;
}

.meta-row strong {
  color: var(--text);
  text-align: right;
}

.stars {
  color: #f59e0b;
  letter-spacing: 0;
}

.score-strip {
  display: grid;
  grid-template-columns: auto 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

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

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

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.settlement-toolbar {
  justify-content: flex-end;
}

.pending-settlement-row {
  background: linear-gradient(90deg, rgba(255, 251, 235, 0.72), rgba(255, 255, 255, 0));
}

.person-card .card-actions {
  gap: 6px;
  margin-top: 10px;
}

.person-card .small-btn {
  min-height: 32px;
  padding: 0 9px;
  font-size: 13px;
}

.mini-alert {
  margin-top: 10px;
  border-radius: 8px;
  background: #fffbeb;
  color: var(--amber);
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 700;
}

.partner-members {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.partner-members span {
  min-height: 28px;
  border-radius: 8px;
  background: #eef2ff;
  color: #3730a3;
  padding: 5px 9px;
  font-size: 13px;
}

.department-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.department-tabs button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #475569;
  padding: 0 12px;
  font-weight: 700;
}

.department-tabs button.active {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: var(--primary);
}

.mini-metrics .metric-card {
  padding: 14px;
  box-shadow: var(--shadow-soft);
}

.mini-metrics .metric-card strong {
  font-size: 23px;
}

.dept-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  margin: 2px 4px 2px 0;
  border-radius: 8px;
  background: #eef6ff;
  color: #1d4ed8;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.partner-member-panel {
  padding: 14px;
}

.member-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.member-panel-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.member-panel-head p {
  margin-top: 4px;
  font-size: 13px;
}

.partner-member-table {
  min-width: 980px;
}

.period-stat {
  display: grid;
  gap: 2px;
}

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

.period-stat em {
  color: var(--green);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

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

.traffic-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
  box-shadow: var(--shadow-soft);
}

.traffic-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.traffic-card-head p,
.traffic-note {
  margin-top: 4px;
  font-size: 13px;
}

.traffic-card-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.traffic-card-metrics div {
  display: grid;
  align-content: center;
  min-height: 66px;
  border: 1px solid #eef2f7;
  border-radius: 8px;
  background: #f8fafc;
  padding: 9px 10px;
}

.traffic-card-metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.traffic-card-metrics strong {
  display: block;
  margin-top: 7px;
  color: var(--ink);
  font-size: 16px;
}

.roi-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #475569;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 900;
}

.roi-chip.good {
  background: #ecfdf5;
  color: var(--green);
}

.roi-chip.bad {
  background: #fef2f2;
  color: var(--red);
}

.audit-list {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.alert-list,
.announcement-list,
.feedback-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.alert-item,
.notice-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
  text-align: left;
}

.alert-item:hover,
.notice-card:hover {
  background: #f8fafc;
}

.alert-item strong,
.alert-item span {
  display: block;
}

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

.alert-item span,
.notice-card p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.notice-head,
.detail-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.notice-head {
  margin-bottom: 8px;
}

.detail-strip {
  flex-wrap: wrap;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.detail-strip div {
  min-width: 150px;
}

.detail-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.detail-strip strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 16px;
}

.compact-strip {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0 14px 12px;
}

.rank-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  padding: 14px;
}

#publishedRankings.rank-preview {
  grid-template-columns: 1fr;
  max-height: 680px;
  overflow: auto;
}

.rank-card {
  position: relative;
  overflow: hidden;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.72)),
    linear-gradient(135deg, #f6c453 0%, #ec6f8f 50%, #7b84d1 100%);
  padding: 14px;
  box-shadow: 0 18px 44px rgba(96, 74, 130, 0.18);
}

.rank-card::before {
  content: "";
  position: absolute;
  inset: -36px auto auto -36px;
  width: 120px;
  height: 120px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
}

.rank-theme-1 {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.72)),
    linear-gradient(135deg, #50bfa5 0%, #4b8fe2 54%, #b479c7 100%);
}

.rank-theme-2 {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.72)),
    linear-gradient(135deg, #f59e0b 0%, #ef7e7e 45%, #6d8dd9 100%);
}

.rank-theme-3 {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.72)),
    linear-gradient(135deg, #6bbf9f 0%, #7b84d1 54%, #e4a368 100%);
}

.rank-card.muted-card {
  background: #f9fafb;
  opacity: 0.72;
}

.rank-card-head,
.rank-row,
.rank-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rank-card-head {
  position: relative;
  z-index: 1;
  color: #111827;
}

.rank-card-head h3 {
  margin-top: 3px;
  line-height: 1.35;
}

.rank-card-head small {
  color: #7c2d12;
  font-size: 12px;
  font-weight: 900;
}

.rank-card-head span,
.rank-toggle small {
  color: #7c2d12;
  font-size: 12px;
  font-weight: 900;
}

.rank-card-head > span {
  flex: 0 0 auto;
  min-height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
  padding: 6px 10px;
  white-space: nowrap;
}

.rank-champion {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 74px;
  margin-top: 12px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 12px;
  box-shadow: 0 12px 28px rgba(124, 45, 18, 0.1);
}

.rank-champion > div:not(.rank-crown) {
  min-width: 0;
}

.rank-crown {
  display: grid;
  width: 58px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #f7d767, #f59e0b);
  color: #78350f;
  font-size: 12px;
  font-weight: 1000;
}

.rank-champion strong {
  display: block;
  color: #111827;
  font-size: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-champion span {
  display: block;
  margin-top: 3px;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-champion em {
  min-width: max-content;
  color: #be123c;
  font-size: 20px;
  font-style: normal;
  font-weight: 1000;
  white-space: nowrap;
}

.rank-list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.rank-row {
  min-height: 34px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  padding: 7px 9px;
  min-width: 0;
}

.rank-row strong {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 8px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 12px;
}

.rank-row.rank-1 strong {
  background: #fef3c7;
  color: #92400e;
}

.rank-row.rank-2 strong {
  background: #e0f2fe;
  color: #0369a1;
}

.rank-row.rank-3 strong {
  background: #fce7f3;
  color: #be185d;
}

.rank-row span {
  display: grid;
  gap: 1px;
  flex: 1;
  min-width: 0;
  color: var(--text);
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-row small {
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-row em {
  flex: 0 0 auto;
  color: var(--green);
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.rank-toggle-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.rank-toggle {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 10px 12px;
}

.rank-toggle span {
  flex: 1;
  color: var(--text);
}

.rank-limit-control input {
  width: 76px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 900;
  text-align: center;
}

.rank-limit-control small {
  white-space: nowrap;
}

.register-preview {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
}

.register-preview div {
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: #374151;
  padding: 12px;
}

.safety-preview {
  grid-template-columns: 1fr;
}

.writer-auth-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(239, 246, 255, 0.9), rgba(236, 253, 245, 0.88) 52%, rgba(255, 247, 237, 0.92)),
    #ffffff;
}

.auth-panel-copy {
  min-width: 0;
}

.auth-panel-copy span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.auth-panel-copy h3 {
  margin-top: 5px;
}

.auth-panel-copy p {
  margin-top: 5px;
  font-size: 13px;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.profile-lock-card {
  display: grid;
  gap: 14px;
  grid-column: 1 / -1;
  border-color: #fed7aa;
  background:
    linear-gradient(135deg, rgba(255, 247, 237, 0.94), rgba(255, 255, 255, 0.96)),
    #ffffff;
  padding: 18px;
}

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

.profile-required-grid div {
  border: 1px solid rgba(251, 191, 36, 0.36);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 12px;
}

.profile-required-grid span {
  display: block;
  color: var(--amber);
  font-size: 12px;
  font-weight: 900;
}

.profile-required-grid strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
}

.account-settings-card {
  display: grid;
  gap: 16px;
  grid-column: 1 / -1;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(241, 249, 255, 0.95), rgba(246, 253, 245, 0.92) 48%, rgba(255, 247, 237, 0.9)),
    #ffffff;
}

.account-settings-head,
.account-security-footer,
.login-method-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.account-settings-head span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.account-settings-head h3 {
  margin-top: 5px;
  font-size: 20px;
}

.account-settings-head p,
.account-security-footer p,
.login-method-row small {
  color: var(--muted);
  font-size: 13px;
}

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

.account-info-grid div {
  min-width: 0;
  border: 1px solid rgba(191, 219, 254, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 12px;
}

.account-info-grid span {
  display: block;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.account-info-grid strong {
  display: block;
  overflow: hidden;
  margin-top: 6px;
  color: #111827;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-method-list {
  display: grid;
  overflow: hidden;
  border: 1px solid rgba(219, 227, 239, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.login-method-row {
  min-height: 72px;
  padding: 12px 14px;
}

.login-method-row + .login-method-row {
  border-top: 1px solid #edf2f7;
}

.method-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #dbeafe, #ccfbf1);
  color: #0f766e;
  font-weight: 900;
}

.login-method-row > div:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.login-method-row strong {
  display: block;
  color: #111827;
}

.method-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.account-security-footer {
  flex-wrap: wrap;
  border: 1px solid rgba(254, 202, 202, 0.82);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  padding: 12px;
}

.account-security-footer > div {
  flex: 1 1 260px;
}

.account-security-footer strong {
  color: #7f1d1d;
}

.account-security-footer p {
  margin-top: 4px;
}

.todo-list {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.todo-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
}

.todo-item strong {
  display: block;
  color: var(--ink);
  margin-bottom: 4px;
}

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

.permission-card h3 {
  margin-bottom: 12px;
}

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

.check-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #374151;
}

#writerProfile,
#partnerProfile {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  gap: 16px;
}

body.writer-public-mode #writerProfile {
  grid-template-columns: minmax(280px, 0.72fr) minmax(0, 1.28fr);
  align-items: start;
}

.writer-rank-card,
.linked-partner-card {
  grid-column: 1 / -1;
}

.writer-auth-panel.is-hidden {
  display: none;
}

.compact-rank-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(170px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.compact-rank-card {
  min-width: 0;
  border: 1px solid rgba(226, 232, 240, 0.88);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 247, 237, 0.82), rgba(239, 246, 255, 0.9)),
    #ffffff;
  padding: 10px;
}

.compact-rank-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.compact-rank-head strong {
  color: var(--ink);
  font-size: 14px;
}

.compact-rank-head span {
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  color: #92400e;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
}

.compact-rank-list {
  display: grid;
  gap: 6px;
}

.compact-rank-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  padding: 6px;
}

.compact-rank-row b {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 8px;
  background: #fef3c7;
  color: #92400e;
  font-size: 12px;
}

.compact-rank-row span,
.compact-rank-row small {
  display: block;
  min-width: 0;
}

.compact-rank-row span {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-rank-row small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.compact-rank-row em {
  color: var(--green);
  font-size: 13px;
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.linked-partner-card {
  display: grid;
  gap: 14px;
}

.linked-partner-table {
  margin-top: 0;
}

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

.portal-metrics div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(239, 246, 255, 0.92)),
    #f8fafc;
  padding: 12px;
}

.portal-metrics span,
.portal-metrics small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.portal-metrics strong {
  display: block;
  margin: 8px 0 4px;
  color: var(--ink);
  font-size: 22px;
}

.writer-hero {
  display: grid;
  gap: 14px;
  background:
    linear-gradient(135deg, rgba(123, 132, 209, 0.13), rgba(80, 191, 165, 0.1) 48%, rgba(231, 189, 123, 0.14)),
    #ffffff;
}

.writer-badge {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid rgba(226, 232, 240, 0.85);
  background: rgba(255, 255, 255, 0.68);
}

.writer-badge .cute-icon {
  width: 58px;
  height: 58px;
  font-size: 34px;
  overflow: hidden;
}

.writer-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--green));
}

.compact-table {
  margin-top: 14px;
  box-shadow: none;
}

.sub-title {
  margin-top: 18px;
}

.writer-ranks {
  grid-template-columns: 1fr;
  padding: 12px 0 0;
}

.writer-chart-card,
.writer-orders-card {
  grid-column: 1 / -1;
}

.writer-chart-card {
  overflow: hidden;
  padding: 0;
}

.writer-chart-card .panel-heading {
  padding: 16px 18px 0;
}

.writer-chart-card canvas {
  width: 100%;
  min-height: 300px;
  border-top: 1px solid #eef2f7;
}

.writer-data-jump {
  justify-self: start;
}

.large-members span {
  min-height: 34px;
  padding: 8px 10px;
}

.partner-portal-summary,
.portal-members-card,
.portal-chart-card,
.portal-orders-card {
  grid-column: 1 / -1;
}

.portal-chart-card {
  overflow: hidden;
  padding: 0;
}

.portal-chart-card canvas {
  border-top: 1px solid #eef2f7;
}

.portal-member-table {
  min-width: 980px;
}

.dialog-card {
  width: min(720px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: #fff;
}

.wide-dialog-card {
  width: min(1180px, calc(100vw - 28px));
  overflow: hidden;
}

dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.46);
}

.dialog-head,
.dialog-actions {
  padding: 16px 18px;
}

.dialog-head {
  border-bottom: 1px solid var(--line);
}

.dialog-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.dialog-actions {
  border-top: 1px solid var(--line);
}

.dialog-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  max-height: min(66vh, 650px);
  overflow-y: auto;
  padding: 18px;
}

.dialog-body .wide {
  grid-column: 1 / -1;
}

.payment-info-card {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
}

.payment-qr-box {
  display: grid;
  min-height: 220px;
  place-items: center;
  overflow: hidden;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
}

.payment-qr-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #ffffff;
}

.payment-info-list {
  display: grid;
  gap: 10px;
}

.payment-info-list div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.payment-info-list span,
.payment-info-list strong {
  display: block;
}

.payment-info-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.payment-info-list strong {
  margin-top: 4px;
  color: var(--ink);
}

.partner-modal-body {
  display: grid;
  gap: 14px;
  max-height: min(76vh, 760px);
  overflow-y: auto;
  padding: 16px;
  background: #f8fafc;
}

.partner-chart-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.partner-chart-panel canvas {
  border-top: 1px solid #eef2f7;
}

.empty-state {
  padding: 26px;
  color: var(--muted);
  text-align: center;
}

.danger-text {
  color: var(--red);
}

.money-positive {
  color: var(--green);
  font-weight: 700;
}

.money-negative {
  color: var(--red);
  font-weight: 700;
}

@media (max-width: 1080px) {
  .metric-grid,
  .people-grid,
  .department-grid,
  .partner-grid,
  .level-grid,
  .permission-grid,
  .traffic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .chart-grid,
  .rank-admin-grid,
  .brand-settings-panel,
  .danger-zone-panel,
  .profile-required-grid,
  .account-info-grid,
  #writerProfile,
  #partnerProfile {
    grid-template-columns: 1fr;
  }

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

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

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

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

  .main {
    padding: 18px;
  }

  .topbar,
  .section-bar,
  .hero-board,
  .writer-auth-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar {
    justify-content: flex-start;
  }

  .metric-grid,
  .people-grid,
  .department-grid,
  .partner-grid,
  .level-grid,
  .permission-grid,
  .traffic-grid,
  .rank-preview,
  .register-preview,
  .dialog-body {
    grid-template-columns: 1fr;
  }

  .portal-metrics,
  .traffic-card-metrics {
    grid-template-columns: 1fr;
  }

  .member-panel-head {
    flex-direction: column;
  }

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

  .account-settings-head,
  .account-security-footer,
  .login-method-row {
    align-items: stretch;
    flex-direction: column;
  }

  .method-actions {
    justify-content: flex-start;
  }
}

/* ---- Admin Profile Card (马卡龙配色) ---- */
.admin-profile-card {
  background: #faf8f5;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 20px rgba(0,0,0,.04), 0 8px 40px rgba(0,0,0,.02);
}

.ap-card {
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 14px;
}

.ap-card-header {
  background: linear-gradient(135deg, #fce4ec 0%, #f8bbd0 50%, #e1bee7 100%);
  border-radius: 16px 16px 0 0;
  padding: 24px 28px 20px;
  margin-bottom: 0;
}

.admin-profile-head2 {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-profile-avatar2 {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: #c2185b;
  box-shadow: 0 3px 12px rgba(194,24,91,.15);
  flex-shrink: 0;
}

.admin-profile-avatar2 img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
}

.admin-profile-head2 h3 {
  font-size: 19px;
  color: #4a0024;
  margin-bottom: 4px;
}

.admin-profile-head2 p {
  font-size: 13px;
  color: #6d1b42;
  opacity: .8;
}

.ap-perm-tip {
  margin-top: 12px;
  font-size: 12px;
  color: #9c4d6b;
  background: rgba(255,255,255,.6);
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
}

.ap-body {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Macaron card colors */
.ap-card-mint {
  background: #e8f8f0;
  border: 1px solid #c8eed8;
}

.ap-card-lavender {
  background: #f0ebf8;
  border: 1px solid #dfd4f0;
}

.ap-card-peach {
  background: #fef4ee;
  border: 1px solid #fce0cf;
}

.ap-card-sky {
  background: #edf6fc;
  border: 1px solid #d3eaf8;
}

.ap-card-pink {
  background: #fef0f4;
  border: 1px solid #fccfdf;
}

.ap-card-cream {
  background: #fefdf8;
  border: 1px solid #f5f0e0;
}

.ap-card-title {
  font-size: 13px;
  font-weight: 700;
  color: #5a4c3a;
  margin-bottom: 12px;
  letter-spacing: .3px;
}

.ap-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
}

.info-cell {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(0,0,0,.04);
}

.info-cell:last-child {
  border-bottom: none;
}

.info-label {
  font-size: 13px;
  color: #8b7a6b;
  flex-shrink: 0;
  margin-right: 8px;
}

.info-value {
  font-size: 13px;
  font-weight: 600;
  color: #3d3226;
  text-align: right;
  word-break: break-all;
}

.info-value.tag-success {
  color: #2e7d32;
}

.info-value.tag-warning {
  color: #e65100;
}

.info-value.tag-danger {
  color: #c62828;
}

.ap-history-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ap-history-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  gap: 12px;
}

.ap-history-row.odd {
  background: rgba(0,0,0,.015);
}

.ap-history-row span {
  color: #8b7a6b;
  flex-shrink: 0;
}

.ap-history-row strong {
  color: #3d3226;
  text-align: right;
  word-break: break-all;
}

.ap-empty {
  font-size: 13px;
  color: #b0a595;
  text-align: center;
  padding: 12px 0;
}

/* ===== 新增功能样式：自动提醒规则 ===== */
.reminder-rules-grid {
  display: grid;
  gap: 14px;
  margin-bottom: 20px;
}

.reminder-rule-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid #e8ecf1;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.reminder-rule-card .rule-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.reminder-rule-card .rule-info strong {
  font-size: 14px;
  color: #1f2937;
}

.reminder-rule-card .rule-info span {
  font-size: 12px;
  color: #6b7280;
}

.reminder-rule-card .rule-actions {
  display: flex;
  gap: 8px;
}

.rule-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.rule-chip.active {
  background: #d1fae5;
  color: #065f46;
}

.rule-chip.paused {
  background: #fef3c7;
  color: #92400e;
}

/* ===== 导出/导入按钮 ===== */
.export-btn-group {
  display: flex;
  gap: 8px;
}

/* ===== 结算单样式 ===== */
.sheet-status-pending { background: #fef3c7; color: #92400e; }
.sheet-status-confirmed { background: #dbeafe; color: #1e40af; }
.sheet-status-paid { background: #d1fae5; color: #065f46; }

/* ===== 恢复审批样式 ===== */
.approval-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
}

.approval-status.pending { background: #fef3c7; color: #92400e; }
.approval-status.approved { background: #d1fae5; color: #065f46; }
.approval-status.rejected { background: #fee2e2; color: #991b1b; }

/* ===== 公告已读统计 ===== */
.read-stats {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #f9fafb;
  font-size: 12px;
}

.read-stats span {
  color: #6b7280;
}

.read-stats strong {
  color: #1f2937;
}

/* ===== 权限提示 ===== */
.perm-denied-hint {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 11px;
  font-weight: 600;
}

/* ===== 部门自定义字段 ===== */
.custom-fields-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed #e5e7eb;
}

.custom-field-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 10px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 600;
  background: #eef2ff;
  color: #4338ca;
}

/* ===== CSV 导入 ===== */
.csv-import-area {
  min-height: 160px;
  padding: 14px;
  border: 2px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  resize: vertical;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
}

.csv-import-hint {
  margin-top: 6px;
  font-size: 12px;
  color: #6b7280;
}

/* ===== 结算单确认按钮组 ===== */
.sheet-actions {
  display: flex;
  gap: 6px;
}


/* ===== 工具栏统一对齐 ===== */
.toolbar {
  align-items: flex-end;
  gap: 8px;
}

/* ===== 顶栏筛选器：三个框必须等宽 ===== */
.topbar .toolbar .field.compact {
  width: 165px;
  min-width: 165px;
  max-width: 165px;
  flex-shrink: 0;
}

.topbar .toolbar .field.compact input,
.topbar .toolbar .field.compact select {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
}

/* ===== 人员页：搜索框和未接单框缩窄 ===== */
#peopleView .toolbar .field.compact:first-of-type {
  min-width: 130px;
  max-width: 180px;
  flex: 0 1 150px;
}

#peopleView .toolbar .field.compact:nth-of-type(2) {
  min-width: 90px;
  max-width: 110px;
  flex: 0 0 100px;
}

/* ===== 合作人员页：搜索框合适宽度 ===== */
#partnersView .toolbar .field.compact {
  min-width: 120px;
  max-width: 160px;
  flex: 0 0 140px;
}

/* ===== 工具栏按钮统一高度 ===== */
.toolbar .primary-btn,
.toolbar .ghost-btn,
.toolbar .small-btn,
.section-bar > .primary-btn,
.section-bar > .ghost-btn,
.section-bar > .small-btn {
  height: 38px;
  padding: 0 15px;
  font-size: 14px;
  font-weight: 600;
  box-sizing: border-box;
  flex-shrink: 0;
  line-height: 36px;
  border-width: 1px;
  border-style: solid;
}

.ghost-btn {
  border-color: #d1d5db;
}

/* ===== 字段标签居中 ===== */
.field.compact span {
  text-align: center;
  line-height: 1.4;
  white-space: nowrap;
}

/* ===== section-bar 内顶部对齐 ===== */
.section-bar .toolbar {
  align-items: flex-end;
}

.settlement-toolbar {
  align-items: flex-end;
  gap: 8px;
}

/* ===== 自动提醒页面 ===== */
#autoReminderView .section-bar { margin-bottom: 20px; }

/* ===== 订单页/支出页：按钮紧凑排列 ===== */
#ordersView .section-bar,
#expensesView .section-bar {
  gap: 10px;
}

/* ===== 合作伙伴搜索框内部文字居中 ===== */

/* ===== 输入框文字垂直居中 ===== */
.field input,
.field select {
  line-height: 1.4;
  padding: 8px 10px;
}

/* ===== 人员页：搜索框居中、天数居中、防换行 ===== */
#peopleView .toolbar {
  flex-wrap: nowrap;
  justify-content: flex-start;
}
#peopleView .toolbar .field.compact:first-of-type input {
  text-align: center;
  font-size: 13px;
}

#peopleView .toolbar .field.compact:first-of-type input::placeholder {
  text-align: center;
  font-size: 12px;
}

#peopleView .toolbar .field.compact:nth-of-type(2) input {
  text-align: center;
}
#partnersView .toolbar .field.compact input {
  text-align: center;
  line-height: 1.4;
  font-size: 13px;
}

#partnersView .toolbar .field.compact input::placeholder {
  text-align: center;
  font-size: 12px;
}
#partnersView .toolbar .field.compact input::placeholder {
  text-align: center;
}

/* ===== 人员页按钮允许收缩以防换行 ===== */
/* ===== 订单支出页紧凑 ===== */
#ordersView .section-bar,
#expensesView .section-bar {
  gap: 10px;
}

/* ===== 合作人员马卡龙卡片 ===== */
.partner-macaron {
  padding: 0 !important;
  overflow: hidden;
  border-radius: 12px !important;
  background: #fff !important;
  box-shadow: 0 2px 16px rgba(0,0,0,.06) !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.partner-macaron:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0,0,0,.1) !important;
}

.partner-macaron-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 18px 14px;
  background: linear-gradient(135deg, #fdfcfb 0%, #faf8f5 50%, #f8f6fc 100%);
}

.partner-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0,0,0,.1);
}

.partner-macaron-info {
  flex: 1;
  min-width: 0;
}

.partner-macaron-info h3 {
  font-size: 16px;
  font-weight: 700;
  color: #2d3748;
  margin: 0;
}

.partner-macaron-info p {
  font-size: 12px;
  color: #718096;
  margin: 3px 0 0;
}

.partner-rate-badge {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}

.partner-macaron-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 0;
  border-bottom: 1px solid #f0f0f0;
}

.pm-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 8px;
  border-right: 1px solid #f5f5f5;
}

.pm-stat:last-child {
  border-right: none;
}

.pm-stat-val {
  font-size: 16px;
  font-weight: 700;
  color: #374151;
}

.pm-stat-val.accent {
  color: #e85d75;
}

.pm-stat-label {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 3px;
}

.partner-macaron-note {
  font-size: 12px;
  color: #9ca3af;
  padding: 10px 18px 0;
  margin: 0;
  font-style: italic;
}

.partner-macaron .card-actions {
  display: flex;
  gap: 8px;
  padding: 12px 18px 16px;
}

/* ===== 部门马卡龙卡片 ===== */
.dept-macaron {
  padding: 0 !important;
  overflow: hidden;
  border-radius: 12px !important;
  background: #fff !important;
  box-shadow: 0 2px 16px rgba(0,0,0,.06) !important;
}

.dept-macaron-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 18px 14px;
  background: linear-gradient(135deg, #fdfcfb, #faf8f5 50%, #f8f6fc);
}

.dept-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0,0,0,.1);
}

.dept-macaron-info { flex:1; min-width:0; }
.dept-macaron-info h3 { font-size:16px; font-weight:700; color:#2d3748; margin:0; }
.dept-macaron-info p { font-size:12px; color:#718096; margin:3px 0 0; }

.dept-macaron-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  border-bottom: 1px solid #f0f0f0;
}

.dm-stat {
  display: flex; flex-direction: column; align-items: center;
  padding: 14px 8px;
  border-right: 1px solid #f5f5f5;
}
.dm-stat:last-child { border-right:none; }
.dm-stat-val { font-size:16px; font-weight:700; color:#374151; }
.dm-stat-val.accent { color:#e85d75; }
.dm-stat-label { font-size:11px; color:#9ca3af; margin-top:3px; }

.dept-macaron .card-actions { padding:12px 18px 16px; display:flex; gap:8px; }

/* ===== 人员马卡龙卡片 ===== */
.person-macaron {
  padding: 0 !important;
  overflow: hidden;
  border-radius: 12px !important;
  background: #fff !important;
  box-shadow: 0 2px 16px rgba(0,0,0,.06) !important;
}

.person-macaron-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 12px;
  background: linear-gradient(135deg, #fdfcfb, #faf8f5 50%, #f8f6fc);
}

.person-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(0,0,0,.1);
}

.person-macaron-info { flex:1; min-width:0; }
.person-macaron-info h3 { font-size:15px; font-weight:700; color:#2d3748; margin:0; }
.person-macaron-info p { font-size:11px; color:#718096; margin:2px 0 0; }

.person-macaron-badges {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 4px; flex-shrink: 0;
}

.person-macaron-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  border-bottom: 1px solid #f0f0f0;
}

.pms-stat {
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 6px;
  border-right: 1px solid #f5f5f5;
}
.pms-stat:last-child { border-right:none; }
.pms-stat-val { font-size:14px; font-weight:700; color:#374151; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.pms-stat-label { font-size:10px; color:#9ca3af; margin-top:2px; }

.person-macaron-meta {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 10px 16px;
  font-size: 11px; color: #6b7280;
}
.person-macaron-meta span {
  background: #f3f4f6; padding: 2px 10px; border-radius: 12px;
  white-space: nowrap;
}

.person-macaron .card-actions {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 16px 14px;
}

/* department strip 马卡龙化 */
.person-department-strip {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 16px 8px;
}
.person-department-strip button {
  padding: 5px 12px;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  font-size: 12px;
  cursor: pointer;
  transition: background .15s;
}
.person-department-strip button:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
}

/* ===== 侧栏导航马卡龙配色 ===== */
.nav-item {
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.nav-item:nth-child(1):hover, .nav-item:nth-child(1).active { border-left: 4px solid #f8bbd0; background: linear-gradient(90deg, rgba(248,187,208,.25), rgba(255,255,255,.5)); }
.nav-item:nth-child(2):hover, .nav-item:nth-child(2).active { border-left: 4px solid #b3e5fc; background: linear-gradient(90deg, rgba(179,229,252,.25), rgba(255,255,255,.5)); }
.nav-item:nth-child(3):hover, .nav-item:nth-child(3).active { border-left: 4px solid #c8e6c9; background: linear-gradient(90deg, rgba(200,230,201,.25), rgba(255,255,255,.5)); }
.nav-item:nth-child(4):hover, .nav-item:nth-child(4).active { border-left: 4px solid #ffe0b2; background: linear-gradient(90deg, rgba(255,224,178,.25), rgba(255,255,255,.5)); }
.nav-item:nth-child(5):hover, .nav-item:nth-child(5).active { border-left: 4px solid #e1bee7; background: linear-gradient(90deg, rgba(225,190,231,.25), rgba(255,255,255,.5)); }
.nav-item:nth-child(6):hover, .nav-item:nth-child(6).active { border-left: 4px solid #b2dfdb; background: linear-gradient(90deg, rgba(178,223,219,.25), rgba(255,255,255,.5)); }
.nav-item:nth-child(7):hover, .nav-item:nth-child(7).active { border-left: 4px solid #ffccbc; background: linear-gradient(90deg, rgba(255,204,188,.25), rgba(255,255,255,.5)); }
.nav-item:nth-child(8):hover, .nav-item:nth-child(8).active { border-left: 4px solid #d1c4e9; background: linear-gradient(90deg, rgba(209,196,233,.25), rgba(255,255,255,.5)); }
.nav-item:nth-child(9):hover, .nav-item:nth-child(9).active { border-left: 4px solid #f8bbd0; background: linear-gradient(90deg, rgba(248,187,208,.25), rgba(255,255,255,.5)); }
.nav-item:nth-child(10):hover, .nav-item:nth-child(10).active { border-left: 4px solid #b3e5fc; background: linear-gradient(90deg, rgba(179,229,252,.25), rgba(255,255,255,.5)); }
.nav-item:nth-child(11):hover, .nav-item:nth-child(11).active { border-left: 4px solid #c8e6c9; background: linear-gradient(90deg, rgba(200,230,201,.25), rgba(255,255,255,.5)); }
.nav-item:nth-child(12):hover, .nav-item:nth-child(12).active { border-left: 4px solid #ffe0b2; background: linear-gradient(90deg, rgba(255,224,178,.25), rgba(255,255,255,.5)); }
.nav-item:nth-child(13):hover, .nav-item:nth-child(13).active { border-left: 4px solid #e1bee7; background: linear-gradient(90deg, rgba(225,190,231,.25), rgba(255,255,255,.5)); }
.nav-item:nth-child(14):hover, .nav-item:nth-child(14).active { border-left: 4px solid #b2dfdb; background: linear-gradient(90deg, rgba(178,223,219,.25), rgba(255,255,255,.5)); }
.nav-item:nth-child(15):hover, .nav-item:nth-child(15).active { border-left: 4px solid #ffccbc; background: linear-gradient(90deg, rgba(255,204,188,.25), rgba(255,255,255,.5)); }
.nav-item:nth-child(16):hover, .nav-item:nth-child(16).active { border-left: 4px solid #d1c4e9; background: linear-gradient(90deg, rgba(209,196,233,.25), rgba(255,255,255,.5)); }
.nav-item:nth-child(17):hover, .nav-item:nth-child(17).active { border-left: 4px solid #f8bbd0; background: linear-gradient(90deg, rgba(248,187,208,.25), rgba(255,255,255,.5)); }
.nav-item:nth-child(18):hover, .nav-item:nth-child(18).active { border-left: 4px solid #b3e5fc; background: linear-gradient(90deg, rgba(179,229,252,.25), rgba(255,255,255,.5)); }
.nav-item:nth-child(19):hover, .nav-item:nth-child(19).active { border-left: 4px solid #c8e6c9; background: linear-gradient(90deg, rgba(200,230,201,.25), rgba(255,255,255,.5)); }

/* ===== Mobile and tablet responsive shell ===== */
@media (max-width: 900px) {
  html {
    overflow-x: hidden;
  }

  body {
    overflow-x: hidden;
    background:
      linear-gradient(155deg, #eef7ff 0%, #f7fbf4 52%, #fff7ec 100%);
  }

  .app-shell {
    display: block;
    width: 100%;
    min-height: 100vh;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: auto;
    max-height: none;
    padding: 12px 12px 10px;
    border-right: 0;
    border-bottom: 1px solid rgba(202, 214, 232, 0.72);
    box-shadow: 0 10px 28px rgba(94, 125, 170, 0.12);
  }

  .brand {
    gap: 10px;
    padding: 2px 2px 10px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
  }

  .brand strong {
    font-size: 15px;
  }

  .brand span {
    margin-top: 2px;
    font-size: 11px;
  }

  .nav {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 2px 4px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .nav::-webkit-scrollbar,
  .table-wrap::-webkit-scrollbar {
    height: 5px;
  }

  .nav::-webkit-scrollbar-thumb,
  .table-wrap::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.58);
  }

  .nav-item {
    width: auto;
    min-width: max-content;
    min-height: 34px;
    flex: 0 0 auto;
    scroll-snap-align: start;
    border: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    padding: 0 12px;
    color: #475569;
    text-align: center;
    font-size: 13px;
    box-shadow: none;
  }

  .nav-item:hover,
  .nav-item.active,
  .nav-item:nth-child(n):hover,
  .nav-item:nth-child(n).active {
    border-left: 1px solid rgba(103, 215, 207, 0.72);
    border-color: rgba(103, 215, 207, 0.78);
    background:
      linear-gradient(135deg, rgba(219, 234, 254, 0.94), rgba(204, 251, 241, 0.8)),
      #ffffff;
    color: #0f172a;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.1);
    transform: none;
  }

  .main {
    width: 100%;
    min-width: 0;
    padding: 14px 12px 22px;
  }

  .topbar,
  .section-bar,
  .hero-board,
  .writer-auth-panel,
  .account-settings-head,
  .account-security-footer,
  .login-method-row,
  .member-panel-head,
  .notice-head,
  .traffic-card-head,
  .danger-zone-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    gap: 12px;
    margin-bottom: 14px;
  }

  h1 {
    font-size: 24px;
  }

  .hero-board {
    min-height: 0;
    padding: 16px;
  }

  .hero-board h2 {
    font-size: 20px;
  }

  .hero-actions,
  .auth-actions,
  .method-actions,
  .member-panel-actions,
  .danger-zone-actions,
  .card-actions,
  .row-actions,
  .sheet-actions {
    justify-content: flex-start;
  }

  .toolbar,
  #peopleView .toolbar,
  #partnersView .toolbar,
  .settlement-toolbar {
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
  }

  .topbar .toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
    gap: 10px;
  }

  .topbar .toolbar .field.compact,
  #peopleView .toolbar .field.compact:first-of-type,
  #peopleView .toolbar .field.compact:nth-of-type(2),
  #partnersView .toolbar .field.compact,
  .toolbar .field.compact {
    width: auto;
    min-width: 0;
    max-width: none;
    flex: 1 1 140px;
  }

  .field.compact span {
    text-align: left;
  }

  .toolbar .primary-btn,
  .toolbar .ghost-btn,
  .toolbar .small-btn,
  .section-bar > .primary-btn,
  .section-bar > .ghost-btn,
  .section-bar > .small-btn,
  .hero-actions > button,
  .auth-actions > button {
    height: auto;
    min-height: 38px;
    line-height: 1.2;
    white-space: normal;
  }

  .metric-grid,
  #metrics.metric-grid,
  .people-grid,
  .department-grid,
  .partner-grid,
  .level-grid,
  .permission-grid,
  .traffic-grid,
  .rank-admin-grid,
  .dashboard-grid,
  .chart-grid,
  .brand-settings-panel,
  .danger-zone-panel,
  .profile-required-grid,
  .account-info-grid,
  #writerProfile,
  #partnerProfile,
  .payment-info-card,
  .dialog-body {
    grid-template-columns: 1fr;
  }

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

  .metric-card {
    min-height: 104px;
    padding: 14px;
  }

  .metric-card strong {
    font-size: 23px;
  }

  .panel-heading,
  .rank-card-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .panel-heading {
    padding: 14px;
  }

  .chart-control-stack,
  .chart-department-row {
    justify-content: flex-start;
    width: 100%;
  }

  .chart-control-stack,
  .metric-switch,
  .segmented,
  .department-tabs,
  .chart-department-row {
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .metric-switch button,
  .segmented button,
  .department-tabs button {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  canvas,
  .writer-chart-card canvas,
  .portal-chart-card canvas {
    height: 260px;
    min-height: 240px;
  }

  .table-wrap {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 700px;
  }

  .compact-table table {
    min-width: 620px;
  }

  .partner-member-table,
  .portal-member-table {
    min-width: 860px;
  }

  th,
  td {
    padding: 11px 10px;
    font-size: 13px;
  }

  .wrap-cell {
    max-width: 220px;
  }

  .rank-preview,
  #publishedRankings.rank-preview,
  .register-preview {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .rank-toggle {
    align-items: flex-start;
    flex-direction: column;
  }

  .rank-limit-control {
    width: 100%;
  }

  .rank-limit-control input {
    width: 100%;
    max-width: 140px;
  }

  .portal-metrics,
  .traffic-card-metrics,
  .partner-macaron-stats,
  .dept-macaron-stats,
  .person-macaron-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pm-stat:nth-child(2n),
  .dm-stat:nth-child(2n),
  .pms-stat:nth-child(2n) {
    border-right: none;
  }

  .partner-macaron-top,
  .dept-macaron-top,
  .person-macaron-top {
    align-items: flex-start;
  }

  .person-macaron-badges {
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .person-macaron-meta span {
    white-space: normal;
  }

  .card-actions .small-btn,
  .card-actions .ghost-btn,
  .card-actions .danger-btn,
  .person-macaron .card-actions .small-btn,
  .dept-macaron .card-actions .small-btn,
  .partner-macaron .card-actions .small-btn {
    flex: 1 1 calc(50% - 8px);
    min-width: 112px;
  }

  .writer-badge {
    align-items: flex-start;
  }

  .dialog-card,
  .wide-dialog-card,
  dialog {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
  }

  .dialog-head,
  .dialog-actions {
    padding: 14px;
  }

  .dialog-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .dialog-body,
  .partner-modal-body {
    max-height: min(72vh, 680px);
    padding: 14px;
  }

  .detail-strip {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .access-gate {
    align-items: start;
    padding: 12px;
  }

  .access-card {
    max-height: none;
    padding: 20px;
  }

  .access-brand {
    margin-bottom: 18px;
  }

  .main {
    padding: 12px 10px 20px;
  }

  .sidebar {
    padding: 10px 10px 8px;
  }

  .topbar .toolbar,
  .metric-grid,
  #metrics.metric-grid,
  .portal-metrics,
  .traffic-card-metrics,
  .partner-macaron-stats,
  .dept-macaron-stats,
  .person-macaron-stats,
  .register-preview {
    grid-template-columns: 1fr;
  }

  .hero-actions,
  .auth-actions,
  .section-bar .toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .hero-actions button,
  .auth-actions button,
  .section-bar .toolbar button,
  .filter-card .primary-btn,
  .filter-card .ghost-btn,
  .filter-card .small-btn {
    width: 100%;
  }

  .filter-card {
    align-items: stretch;
    padding: 12px;
  }

  .filter-card .field {
    flex: 1 1 100%;
  }

  .panel-heading,
  .person-card,
  .department-card,
  .partner-card,
  .level-card,
  .permission-card,
  .writer-card,
  .traffic-card {
    padding: 12px;
  }

  .writer-chart-card,
  .portal-chart-card {
    padding: 0;
  }

  .writer-chart-card .panel-heading {
    padding: 12px 12px 0;
  }

  .person-macaron-top,
  .partner-macaron-top,
  .dept-macaron-top {
    flex-wrap: wrap;
  }

  .partner-rate-badge {
    margin-left: 52px;
  }

  .card-actions .small-btn,
  .card-actions .ghost-btn,
  .card-actions .danger-btn,
  .person-macaron .card-actions .small-btn,
  .dept-macaron .card-actions .small-btn,
  .partner-macaron .card-actions .small-btn,
  .row-actions .small-btn {
    flex: 1 1 100%;
  }

  table {
    min-width: 640px;
  }

  .compact-table table {
    min-width: 560px;
  }

  .partner-member-table,
  .portal-member-table {
    min-width: 760px;
  }

  th,
  td {
    padding: 10px 9px;
  }

  .rank-champion {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .rank-champion em {
    grid-column: 1 / -1;
    justify-self: start;
    font-size: 18px;
  }

  .rank-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .rank-row em {
    width: 100%;
    padding-left: 34px;
  }

  canvas,
  .writer-chart-card canvas,
  .portal-chart-card canvas {
    height: 230px;
    min-height: 220px;
  }
}

@media (max-width: 380px) {
  .hero-actions,
  .auth-actions,
  .section-bar .toolbar {
    grid-template-columns: 1fr;
  }

  .brand strong {
    font-size: 14px;
  }

  h1 {
    font-size: 22px;
  }

  .metric-card strong {
    font-size: 21px;
  }
}
