:root {
  color-scheme: light;
  --bg: #eef2ff;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-solid: #ffffff;
  --panel-soft: rgba(248, 245, 255, 0.7);
  --panel-tint: rgba(233, 225, 255, 0.62);
  --ink: #2b224a;
  --muted: #7a7596;
  --line: rgba(159, 143, 214, 0.28);
  --line-strong: rgba(126, 101, 205, 0.35);
  --accent: #8a62df;
  --accent-strong: #6f43ca;
  --accent-soft: rgba(226, 215, 255, 0.82);
  --accent-wash: rgba(177, 143, 243, 0.16);
  --rose: #e58cd3;
  --sky: #8eaaf7;
  --gold: #9d83ff;
  --red: #d94b6f;
  --shadow: 0 24px 70px rgba(97, 78, 158, 0.18);
  --shadow-soft: 0 14px 36px rgba(113, 96, 172, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  position: relative;
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(118deg, rgba(238, 242, 255, 0.98) 0%, rgba(242, 236, 255, 0.96) 37%, rgba(235, 242, 255, 0.98) 67%, rgba(250, 236, 255, 0.92) 100%),
    var(--bg);
  color: var(--ink);
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(102deg, rgba(146, 168, 255, 0.2), transparent 28%, rgba(225, 169, 238, 0.22) 58%, transparent 86%),
    linear-gradient(14deg, transparent 0%, rgba(255, 255, 255, 0.58) 48%, transparent 100%);
}

.login-view,
.app-shell {
  position: relative;
  z-index: 1;
}

::selection {
  background: rgba(159, 120, 239, 0.26);
}

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

button {
  cursor: pointer;
  transition:
    transform 0.14s ease,
    box-shadow 0.14s ease,
    border-color 0.14s ease,
    background 0.14s ease;
}

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

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.hidden {
  display: none !important;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(128deg, rgba(148, 124, 236, 0.2), transparent 44%),
    linear-gradient(284deg, rgba(229, 140, 211, 0.2), transparent 46%),
    var(--bg);
}

.login-panel {
  width: min(420px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: white;
  background: linear-gradient(135deg, var(--sky), var(--accent) 52%, var(--rose));
  box-shadow: 0 16px 34px rgba(138, 98, 223, 0.32);
  font-weight: 800;
}

.login-panel h1 {
  margin: 18px 0 24px;
  font-size: 28px;
  line-height: 1.2;
}

.login-form,
.kol-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
}

label span,
legend {
  color: #463a74;
  font-size: 13px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  padding: 9px 11px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 0 0 4px rgba(138, 98, 223, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.icon-button {
  min-height: 38px;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 8px 14px;
  font-weight: 700;
  white-space: nowrap;
}

.primary-button {
  background: linear-gradient(135deg, #9ea9ff, var(--accent) 54%, #d88ee9);
  color: #fff;
  box-shadow: 0 12px 26px rgba(138, 98, 223, 0.28);
}

.primary-button:hover {
  background: linear-gradient(135deg, #8998f4, var(--accent-strong) 54%, #c873dc);
}

.secondary-button {
  background: rgba(239, 233, 255, 0.86);
  border-color: var(--line-strong);
  color: var(--accent-strong);
}

.secondary-button:hover,
.ghost-button:hover,
.icon-button:hover {
  border-color: var(--line-strong);
  box-shadow: 0 10px 24px rgba(113, 96, 172, 0.12);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.42);
  border-color: var(--line);
  color: var(--ink);
}

.danger-button {
  background: rgba(255, 235, 242, 0.78);
  border-color: rgba(217, 75, 111, 0.28);
  color: var(--red);
}

.icon-button {
  width: 38px;
  padding: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.54);
  border-color: var(--line);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

.full-width {
  width: 100%;
}

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

.success-message {
  color: #2d8a55;
}

.app-shell {
  min-height: 100vh;
  padding: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto 16px;
  max-width: 1480px;
  padding: 8px 2px;
}

.topbar h1 {
  margin: 3px 0 0;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.1;
  color: #2e2458;
}

.eyebrow {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

.current-user {
  color: var(--muted);
  font-size: 14px;
}

.metrics-strip,
.toolbar,
.workspace {
  max-width: 1480px;
  margin: 0 auto;
}

.metrics-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.metric {
  min-height: 82px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
}

.metric-value {
  font-size: 28px;
  font-weight: 850;
  color: #4b2eb5;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 140px 150px 150px 120px auto;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.46);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
}

.search-box {
  position: relative;
}

.search-box span {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-weight: 800;
}

.search-box input {
  padding-left: 34px;
}

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

.table-wrap,
.detail-pane {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.table-wrap {
  min-height: 520px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: rgba(246, 243, 255, 0.78);
  color: #5d5580;
  font-size: 12px;
  font-weight: 800;
}

td {
  font-size: 14px;
}

tbody tr {
  transition: background 0.12s ease;
}

tbody tr:hover,
tbody tr.selected {
  background: rgba(237, 230, 255, 0.62);
}

.name-cell {
  display: grid;
  gap: 5px;
}

.name-cell strong {
  font-size: 15px;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  background: rgba(232, 224, 255, 0.9);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 750;
}

.badge.trainer {
  background: rgba(255, 226, 247, 0.86);
  color: #995492;
}

.badge.bigtech {
  background: rgba(222, 234, 255, 0.86);
  color: #4f63b1;
}

.media-list,
.compact-list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.detail-pane .compact-list {
  gap: 0;
  font-size: 12px;
  line-height: 1.55;
}

.detail-pane .compact-list li {
  padding: 6px 0;
}

.detail-pane .compact-list li + li {
  border-top: 1px solid rgba(159, 143, 214, 0.14);
}

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

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

.pagination-bar {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: rgba(246, 243, 255, 0.46);
}

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

.page-info {
  min-width: 64px;
  color: #4b3d78;
  font-size: 12px;
  font-weight: 750;
  text-align: center;
}

.detail-pane {
  position: sticky;
  top: 18px;
  min-height: 520px;
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.detail-pane::-webkit-scrollbar,
.kol-form::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.detail-pane::-webkit-scrollbar-thumb,
.kol-form::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb {
  border: 3px solid rgba(246, 243, 255, 0.82);
  border-radius: 999px;
  background: rgba(138, 98, 223, 0.42);
}

.detail-empty {
  min-height: 520px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.detail-content {
  display: grid;
  gap: 0;
  padding: 18px;
  font-size: 12px;
}

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

.detail-title h2 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.25;
}

.detail-section {
  display: grid;
  gap: 8px;
  padding: 14px 0;
  border-top: 1px solid rgba(159, 143, 214, 0.18);
}

.detail-section h3 {
  margin: 0;
  color: #584a81;
  font-size: 14px;
  line-height: 1.35;
}

.detail-text {
  margin: 0;
  color: #332a58;
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.profile-photo-link {
  width: min(200px, 100%);
  display: block;
}

.profile-photo {
  width: min(200px, 100%);
  height: 200px;
  display: block;
  border: 1px solid var(--line);
  border-radius: 14px;
  object-fit: contain;
  background: var(--panel-soft);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: #413468;
  font-size: 12px;
}

.tag button {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(157, 131, 255, 0.22);
  color: #62518c;
  padding: 0;
  line-height: 1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(42, 35, 75, 0.38);
  backdrop-filter: blur(10px);
}

.modal-panel {
  width: min(980px, 100%);
  max-height: min(92vh, 980px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--panel);
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 246, 255, 0.56);
}

.modal-header h2 {
  margin: 0;
  font-size: 22px;
  color: #31255f;
}

.kol-form {
  overflow: auto;
  padding: 20px;
}

fieldset {
  min-width: 0;
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0 0 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
}

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

.avatar-editor {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.avatar-preview-wrap {
  width: 112px;
  height: 112px;
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 32px;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.88), transparent 28%),
    linear-gradient(135deg, rgba(142, 170, 247, 0.36), rgba(138, 98, 223, 0.42), rgba(229, 140, 211, 0.38));
  box-shadow: 0 18px 36px rgba(111, 67, 202, 0.18);
  overflow: hidden;
}

.avatar-preview {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.avatar-placeholder {
  color: #fff;
  font-size: 24px;
  font-weight: 850;
  text-shadow: 0 2px 12px rgba(65, 42, 122, 0.2);
}

.avatar-controls {
  display: grid;
  gap: 10px;
}

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

.duplicate-warning {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(217, 75, 111, 0.26);
  border-radius: 18px;
  background: rgba(255, 235, 242, 0.62);
}

.duplicate-copy {
  display: grid;
  gap: 4px;
}

.duplicate-copy strong {
  color: var(--red);
}

.duplicate-copy p {
  margin: 0;
  color: #684766;
  font-size: 13px;
  line-height: 1.5;
}

.duplicate-list {
  display: grid;
  gap: 8px;
}

.duplicate-item {
  min-height: 48px;
  display: grid;
  gap: 3px;
  justify-items: start;
  border: 1px solid rgba(159, 143, 214, 0.3);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  padding: 9px 11px;
  text-align: left;
}

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

.user-modal-panel {
  width: min(860px, 100%);
}

.password-modal-panel {
  width: min(440px, 100%);
}

.user-form {
  display: grid;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.account-list-wrap {
  overflow-x: auto;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-soft);
}

.segment {
  min-height: 32px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #777099;
  font-size: 13px;
  font-weight: 760;
  padding: 6px;
}

.segment.active {
  background: rgba(255, 255, 255, 0.86);
  color: var(--accent-strong);
  box-shadow: 0 8px 20px rgba(111, 67, 202, 0.14);
}

.tag-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

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

.speech-item {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(160px, 0.7fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-soft);
}

.file-pill {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px dashed rgba(138, 98, 223, 0.38);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
  font-size: 13px;
}

.file-pill input {
  display: none;
}

.file-pill strong {
  max-width: 160px;
  overflow: hidden;
  color: #382c68;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-footer {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-spacer {
  flex: 1;
}

a {
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

  .detail-pane {
    position: static;
    max-height: none;
  }
}

@media (max-width: 900px) {
  .app-shell {
    padding: 14px;
  }

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

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

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

  .search-box {
    grid-column: 1 / -1;
  }

  .table-wrap {
    overflow-x: auto;
  }

  .pagination-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-actions {
    justify-content: space-between;
  }

  table {
    min-width: 900px;
  }

  .form-grid,
  .avatar-editor,
  .speech-item {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .metrics-strip,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .login-panel,
  .kol-form {
    padding: 18px;
  }

  .modal-backdrop {
    padding: 0;
  }

  .modal-panel {
    width: 100%;
    height: 100vh;
    max-height: none;
    border-radius: 0;
  }

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