:root {
  --bg: #fff7fa;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #fff0f6;
  --text: #5f5862;
  --muted: #aaa0a8;
  --border: #f4c8d7;
  --primary: #ee9ab8;
  --primary-strong: #e47fa5;
  --success: #8bbfae;
  --cyan: #b9ddd8;
  --cyan-soft: #eef9f7;
  --pink: #ee9ab8;
  --pink-soft: #fff0f6;
  --pink-border: #efb7cc;
  --danger: #d97b95;
  --danger-bg: #fff0f4;
  --shadow: 0 12px 30px rgba(219, 156, 180, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(rgba(244, 200, 215, 0.32) 1px, transparent 1px),
    linear-gradient(90deg, rgba(244, 200, 215, 0.28) 1px, transparent 1px),
    radial-gradient(circle at 8% 4%, rgba(255, 214, 229, 0.74), transparent 28%),
    radial-gradient(circle at 92% 0%, rgba(234, 246, 244, 0.86), transparent 26%),
    linear-gradient(180deg, #fffafd 0%, #fff4f9 44%, #fafafa 100%),
    var(--bg);
  background-size:
    42px 42px,
    42px 42px,
    auto,
    auto,
    auto;
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial,
    sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

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

.page-decor {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.app-shell,
.auth-screen {
  position: relative;
  z-index: 1;
}

.decor-bow,
.decor-star {
  position: absolute;
  opacity: 0.72;
}

.decor-bow {
  width: 76px;
  height: 42px;
}

.decor-bow::before,
.decor-bow::after {
  content: "";
  position: absolute;
  top: 8px;
  width: 34px;
  height: 26px;
  border: 2px solid #eeb2c8;
  background: rgba(255, 238, 246, 0.82);
}

.decor-bow::before {
  left: 2px;
  border-radius: 22px 8px 20px 8px;
  transform: rotate(18deg);
}

.decor-bow::after {
  right: 2px;
  border-radius: 8px 22px 8px 20px;
  transform: rotate(-18deg);
}

.decor-bow-left {
  left: 28px;
  top: 130px;
}

.decor-bow-right {
  right: 30px;
  top: 52%;
  transform: rotate(18deg);
}

.decor-star {
  width: 18px;
  height: 18px;
  background: #fff4c9;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 56%, 79% 91%, 50% 68%, 21% 91%, 32% 56%, 2% 35%, 39% 35%);
  filter: drop-shadow(0 4px 8px rgba(226, 160, 185, 0.24));
}

.decor-star-one {
  left: 7%;
  bottom: 18%;
}

.decor-star-two {
  right: 9%;
  top: 23%;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

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

h1 {
  color: #d98aa8;
  text-shadow:
    2px 0 0 rgba(245, 211, 223, 0.68),
    0 4px 14px rgba(225, 142, 173, 0.18);
}

.festival-banner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 18px;
  overflow: hidden;
  border: 1px solid var(--pink-border);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.96), rgba(255, 238, 246, 0.94)),
    #fff;
  box-shadow:
    var(--shadow),
    inset 0 0 0 5px rgba(255, 244, 248, 0.84);
  margin-bottom: 18px;
  min-height: 138px;
  padding: 18px 178px 18px 20px;
}

.festival-banner,
.panel,
.metric-card,
.auth-card {
  position: relative;
}

.panel::before,
.metric-card::before,
.auth-card::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 7px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(90deg, #f1b0c8, #ffe2ec, #f1b0c8);
  opacity: 0.72;
  pointer-events: none;
}

.panel::after,
.metric-card::after,
.auth-card::after {
  content: "";
  position: absolute;
  right: 9px;
  bottom: 8px;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid #efb7cc;
  background:
    linear-gradient(45deg, transparent 45%, #efb7cc 45% 55%, transparent 55%),
    linear-gradient(-45deg, transparent 45%, #efb7cc 45% 55%, transparent 55%),
    #fff6fa;
  opacity: 0.7;
  transform: rotate(8deg);
  pointer-events: none;
}

.festival-banner::before,
.festival-banner::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.festival-banner::before {
  width: 280px;
  height: 90px;
  right: -42px;
  top: 16px;
  border: 1px dashed rgba(235, 172, 195, 0.72);
  border-radius: 18px;
  background:
    linear-gradient(90deg, transparent 0 16px, rgba(239, 183, 204, 0.34) 16px 17px, transparent 17px 34px),
    rgba(255, 250, 252, 0.7);
  box-shadow:
    0 18px 0 rgba(255, 230, 239, 0.48),
    0 36px 0 rgba(255, 247, 250, 0.68);
  transform: rotate(-6deg);
}

.festival-banner::after {
  width: 100%;
  height: 1px;
  left: 0;
  bottom: 0;
  border-radius: 0;
  background: linear-gradient(90deg, transparent, var(--pink), transparent);
  transform: none;
}

.festival-copy {
  position: relative;
  z-index: 1;
}

.aiko-frame {
  user-select: none;
  pointer-events: none;
  overflow: hidden;
  border: 1px solid rgba(239, 183, 204, 0.76);
  background: rgba(255, 255, 255, 0.68);
  box-shadow:
    0 12px 24px rgba(211, 139, 166, 0.22),
    inset 0 0 0 4px rgba(255, 246, 250, 0.72);
}

.aiko-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 48%;
  filter: saturate(0.92) brightness(1.04);
}

.hero-aiko {
  position: absolute;
  z-index: 2;
  right: 22px;
  bottom: -14px;
  width: min(164px, 28vw);
  height: 164px;
  border-radius: 28px;
}

.hero-aiko img {
  object-position: center 42%;
}

.auth-aiko {
  position: absolute;
  right: -18px;
  top: -74px;
  width: 112px;
  height: 112px;
  border-radius: 50%;
}

.auth-aiko img {
  object-position: center 42%;
}

.festival-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--pink-border);
  border-radius: 999px;
  background: #fff;
  color: #d98aa8;
  box-shadow: 0 4px 12px rgba(225, 142, 173, 0.14);
  font-size: 12px;
  font-weight: 800;
  padding: 0 10px;
  margin-bottom: 8px;
}

.festival-copy strong {
  display: block;
  color: #c9809d;
  font-size: 20px;
  line-height: 1.25;
  text-shadow: 0 3px 12px rgba(225, 142, 173, 0.14);
}

.festival-copy p {
  color: #9e8f99;
  margin-top: 5px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.1;
}

h2 {
  font-size: 17px;
  line-height: 1.25;
}

.topbar p,
.section-heading p {
  color: var(--muted);
  margin-top: 5px;
}

.topbar-actions,
.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.button-row.compact {
  gap: 8px;
}

.btn {
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  padding: 0 14px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.btn:hover {
  border-color: var(--pink-border);
  box-shadow: 0 8px 18px rgba(225, 142, 173, 0.16);
  transform: translateY(-1px);
}

.btn.primary {
  background: linear-gradient(135deg, #f3a8c2, #e487a9);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 8px 18px rgba(225, 142, 173, 0.2);
}

.btn.primary:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.76);
}

.btn.danger {
  background: var(--danger-bg);
  border-color: #ffc9c2;
  color: var(--danger);
}

.btn.small {
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric-card {
  min-height: 92px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 241, 247, 0.88)),
    var(--surface);
  padding: 16px;
  box-shadow:
    var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.metric-card:nth-child(5) {
  border-color: var(--pink-border);
  background:
    linear-gradient(180deg, rgba(255, 236, 244, 0.98), rgba(255, 249, 252, 0.9)),
    var(--surface);
  box-shadow:
    var(--shadow),
    inset 0 0 0 4px rgba(255, 248, 251, 0.86);
}

.metric-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 10px;
}

.metric-card strong {
  display: block;
  font-size: 24px;
  line-height: 1.15;
  word-break: break-all;
  color: #c87898;
  text-shadow: none;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(255, 248, 251, 0.92)),
    var(--surface);
  box-shadow:
    var(--shadow),
    inset 0 0 0 4px rgba(255, 247, 250, 0.72);
  padding: 18px;
  margin-bottom: 18px;
}

.panel,
.metric-card {
  outline: 1px solid rgba(255, 255, 255, 0.78);
  outline-offset: -7px;
}

.panel h2 {
  color: #c87898;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.file-drop {
  display: grid;
  place-items: center;
  min-height: 120px;
  border: 1px dashed var(--pink-border);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 247, 250, 0.98), rgba(255, 235, 244, 0.8)),
    #fff;
  cursor: pointer;
  text-align: center;
  padding: 18px;
}

.file-drop input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-drop-title {
  display: block;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

#fileStatus {
  color: var(--muted);
}

.mapping-area {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.mapping-toolbar,
.mapping-grid,
.entry-form,
.filter-grid {
  display: grid;
  gap: 12px;
}

.mapping-toolbar {
  grid-template-columns: minmax(0, 1fr) 160px;
  margin-bottom: 14px;
}

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

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

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

.form-wide {
  grid-column: span 2;
}

.form-button {
  grid-column: span 2;
}

.user-table-wrap {
  margin-top: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  padding: 0 10px;
  outline: none;
}

input::placeholder {
  color: #c1b5bd;
}

input:focus,
select:focus {
  border-color: var(--pink-border);
  box-shadow:
    0 0 0 3px rgba(239, 183, 204, 0.18),
    0 8px 18px rgba(225, 142, 173, 0.12);
}

.import-summary {
  margin: 14px 0;
  color: var(--muted);
  background: var(--surface-strong);
  border: 1px solid rgba(239, 183, 204, 0.42);
  border-radius: 6px;
  padding: 10px 12px;
}

.warning-text {
  color: var(--danger);
  margin-top: 4px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow:
    inset 0 0 0 5px rgba(255, 247, 250, 0.82),
    0 10px 24px rgba(219, 156, 180, 0.12);
  padding: 6px;
}

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

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid #f7d8e3;
  text-align: left;
  white-space: nowrap;
}

th {
  background:
    linear-gradient(180deg, #fff5fa, #ffeaf3);
  color: #bf7a96;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}

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

tbody tr:hover td {
  background: #fff9fc;
}

tbody td:first-child,
thead th:first-child {
  border-left: 1px solid #f7d8e3;
}

tbody td:last-child,
thead th:last-child {
  border-right: 1px solid #f7d8e3;
}

.number-cell {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px;
}

.type-pill,
.count-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
}

.type-pill.first {
  background: #eef9f7;
  color: var(--success);
}

.type-pill.renewal {
  background: #fff0f6;
  color: var(--primary);
}

.type-pill.unknown {
  background: #f6f2f5;
  color: var(--muted);
}

.count-pill {
  background: #fff0f6;
  border: 1px solid rgba(239, 183, 204, 0.56);
  color: #bf7a96;
}

.detail-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: min(360px, 100%);
}

.detail-tools input {
  min-width: 220px;
}

.link-btn {
  border: 0;
  background: transparent;
  color: var(--danger);
  padding: 0;
  cursor: pointer;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row-actions .link-btn:first-child {
  color: var(--primary);
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background:
    linear-gradient(rgba(244, 200, 215, 0.32) 1px, transparent 1px),
    linear-gradient(90deg, rgba(244, 200, 215, 0.28) 1px, transparent 1px),
    rgba(255, 250, 252, 0.98);
  background-size: 42px 42px;
  padding: 20px;
}

.auth-card {
  width: min(420px, 100%);
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(255, 241, 247, 0.92)),
    var(--surface);
  box-shadow:
    var(--shadow),
    inset 0 0 0 4px rgba(255, 247, 250, 0.76);
  padding: 24px;
}

.auth-card h2 {
  font-size: 20px;
}

.auth-card p {
  color: var(--muted);
  margin-top: 6px;
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.auth-message {
  min-height: 20px;
  color: var(--danger) !important;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100% - 36px));
  background: #172033;
  color: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.is-hidden {
  display: none !important;
}

@media (max-width: 1180px) {
  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 1440px);
    padding-top: 14px;
  }

  .topbar,
  .section-heading,
  .festival-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .festival-banner {
    min-height: 0;
    padding: 16px 96px 16px 14px;
  }

  .hero-aiko {
    right: 6px;
    bottom: 8px;
    width: 84px;
    height: 84px;
    opacity: 0.84;
    border-radius: 20px;
  }

  .auth-aiko {
    width: 78px;
    height: 78px;
    right: -8px;
    top: -48px;
    opacity: 0.86;
  }

  .decor-bow,
  .decor-star {
    opacity: 0.38;
  }

  .detail-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .detail-tools input {
    min-width: 0;
  }

  .metric-grid,
  .mapping-grid,
  .entry-form,
  .filter-grid,
  .mapping-toolbar {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 78px;
  }

  .form-wide,
  .form-button {
    grid-column: span 1;
  }

  .panel {
    padding: 14px;
  }
}
