* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-primary: #1677ff;
  --color-primary-dark: #0958d9;
  --color-primary-light: #e6f4ff;
  --color-bg: #eef2f7;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-text: #1e293b;
  --color-text-muted: #64748b;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.12);
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Microsoft YaHei', sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
}

/* ===== Login Page ===== */
.login-page {
  min-height: 100vh;
  background: #0f172a;
}

.login-layout {
  display: flex;
  min-height: 100vh;
}

.login-showcase {
  position: relative;
  flex: 1.1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  overflow: hidden;
  color: #fff;
}

.login-showcase-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(22, 119, 255, 0.45) 0%, transparent 55%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(99, 102, 241, 0.35) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 60% 10%, rgba(14, 165, 233, 0.25) 0%, transparent 45%),
    linear-gradient(145deg, #0c1929 0%, #0f2744 40%, #1a1f4e 100%);
}

.login-showcase-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.8;
}

.login-showcase-content {
  position: relative;
  z-index: 1;
  max-width: 440px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.login-brand-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  backdrop-filter: blur(8px);
}

.login-brand-icon svg {
  width: 22px;
  height: 22px;
  color: #93c5fd;
}

.login-brand-name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.login-showcase-title {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.login-showcase-desc {
  font-size: 15px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.72);
  margin-bottom: 36px;
}

.login-feature-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.login-feature-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  font-size: 18px;
  flex-shrink: 0;
}

.login-feature-list strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.login-feature-list span {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
}

.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
}

.login-orb-1 {
  width: 320px;
  height: 320px;
  background: rgba(22, 119, 255, 0.35);
  top: -80px;
  right: -60px;
  animation: login-float 8s ease-in-out infinite;
}

.login-orb-2 {
  width: 240px;
  height: 240px;
  background: rgba(139, 92, 246, 0.25);
  bottom: 10%;
  left: -40px;
  animation: login-float 10s ease-in-out infinite reverse;
}

.login-orb-3 {
  width: 180px;
  height: 180px;
  background: rgba(14, 165, 233, 0.2);
  bottom: -40px;
  right: 20%;
  animation: login-float 12s ease-in-out infinite;
}

@keyframes login-float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(12px, -16px); }
}

.login-panel {
  flex: 0 0 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  background: #f8fafc;
  position: relative;
}

.login-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at top right, rgba(22, 119, 255, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at bottom left, rgba(99, 102, 241, 0.04) 0%, transparent 50%);
  pointer-events: none;
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
}

.login-card-header {
  margin-bottom: 20px;
}

.login-card h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.login-card .subtitle {
  text-align: left;
  color: var(--color-text-muted);
  font-size: 14px;
  margin-bottom: 0;
}

.login-footer-note {
  position: relative;
  margin-top: 24px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 4px;
  border: none;
}

.auth-tab {
  flex: 1;
  padding: 10px 0;
  border: none;
  background: none;
  font-size: 14px;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
  margin-bottom: 0;
  border-bottom: none;
}

.auth-tab.active {
  color: var(--color-primary);
  font-weight: 600;
  background: #fff;
  box-shadow: var(--shadow-sm);
  border-bottom-color: transparent;
}

.auth-form .form-group:last-of-type {
  margin-bottom: 20px;
}

.auth-tip {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 16px;
  line-height: 1.5;
}

.success-msg {
  background: #ecfdf5;
  color: #059669;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 20px;
  border: 1px solid #a7f3d0;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: #374151;
}

.form-group input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: #1677ff;
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.1);
}

.btn {
  width: 100%;
  height: 44px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, #4f46e5 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(22, 119, 255, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, #4338ca 100%);
  box-shadow: 0 6px 16px rgba(22, 119, 255, 0.35);
}

.error-msg {
  background: #fef2f2;
  color: #dc2626;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 20px;
  border: 1px solid #fecaca;
}

.app-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 120% 80% at 0% 0%, rgba(22, 119, 255, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse 80% 60% at 100% 100%, rgba(99, 102, 241, 0.05) 0%, transparent 50%),
    var(--color-bg);
}

.app-header {
  height: 60px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.app-header .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.logo-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-primary) 0%, #6366f1 100%);
  border-radius: 8px;
  color: #fff;
}

.logo-icon svg {
  width: 18px;
  height: 18px;
}

.app-header .user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--color-text-muted);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary) 0%, #6366f1 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-greeting strong {
  color: var(--color-text);
  font-weight: 600;
}

.btn-logout {
  height: 32px;
  padding: 0 16px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  font-size: 13px;
  cursor: pointer;
}

.btn-logout:hover {
  background: #f9fafb;
}

.app-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

.app-sidebar {
  width: 220px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  border-right: 1px solid var(--color-border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
}

.sidebar-brand-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-light);
  border-radius: 8px;
  color: var(--color-primary);
}

.sidebar-brand-icon svg {
  width: 16px;
  height: 16px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 8px 12px 16px;
  gap: 2px;
  flex: 1;
}

.sidebar-divider {
  height: 1px;
  background: var(--color-border);
  margin: 8px 4px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 14px;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}

.sidebar-icon {
  font-size: 16px;
  width: 22px;
  height: 22px;
  text-align: center;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-icon-logo img {
  width: 22px;
  height: 22px;
  display: block;
  border-radius: 5px;
  object-fit: cover;
}

.sidebar-item:hover {
  background: rgba(22, 119, 255, 0.08);
  color: var(--color-primary);
}

.sidebar-item.active {
  background: linear-gradient(135deg, rgba(22, 119, 255, 0.14) 0%, rgba(99, 102, 241, 0.08) 100%);
  color: var(--color-primary);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--color-primary);
}

.dingding-page .page-header,
.chuanyun-page .page-header,
.yida-page .page-header {
  margin-bottom: 0;
}

.chuanyun-content,
.dingding-content,
.notable-content,
.yida-content {
  min-height: 0;
}

.module-form-row {
  margin-bottom: 16px;
}

.inline-input-group {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.inline-input-group input {
  flex: 1;
  min-width: 0;
}

.inline-input-group .btn {
  width: auto;
  flex-shrink: 0;
  white-space: nowrap;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.notable-create-row {
  margin-top: 8px;
}

.record-fields-wrap {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px dashed #e5e7eb;
}

.record-fields-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.record-fields-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
}

.record-fields-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}

.record-field-item {
  margin-bottom: 0;
}

.record-field-item label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: #374151;
}

.record-field-item input,
.record-field-item textarea {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}

.record-field-item textarea {
  min-height: 72px;
  padding: 10px 12px;
  resize: vertical;
}

.record-field-item input:focus,
.record-field-item textarea:focus {
  border-color: #1677ff;
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.1);
}

.record-field-type {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 400;
  color: #9ca3af;
}

.record-field-item-full {
  grid-column: 1 / -1;
}

.record-field-item select,
.record-select-input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  outline: none;
}

.record-select-multi {
  min-height: 120px;
  padding: 8px 12px;
}

.record-field-item select:focus,
.record-select-input:focus {
  border-color: #1677ff;
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.1);
}

@media (max-width: 768px) {
  .record-fields-form {
    grid-template-columns: 1fr;
  }
}

.json-input {
  width: 100%;
  padding: 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  font-family: Consolas, monospace;
  resize: vertical;
  outline: none;
}

.json-input:focus {
  border-color: #1677ff;
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.1);
}

.select-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  outline: none;
}

.select-input:focus {
  border-color: #1677ff;
}

.contacts-info {
  margin-top: 12px;
  font-size: 13px;
  color: #16a34a;
}

.user-count-info {
  align-self: center;
  font-size: 13px;
  color: #6b7280;
}

.mapping-table code {
  font-family: Consolas, monospace;
  font-size: 12px;
  color: #1677ff;
}

.mapping-value-cell {
  min-width: 220px;
}

.mapping-manual {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
}

.contacts-info {
  margin-top: 12px;
  font-size: 13px;
  color: #16a34a;
}

.json-preview {
  background: #0f172a;
  color: #e2e8f0;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
  font-family: Consolas, monospace;
}

.json-result-box {
  margin-bottom: 16px;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.top-nav-item {
  flex-shrink: 0;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--color-text-muted);
  text-decoration: none;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
  border-bottom: none;
  margin-bottom: 0;
}

.top-nav-item:hover {
  color: var(--color-primary);
  background: rgba(22, 119, 255, 0.06);
}

.top-nav-item.active {
  color: var(--color-primary);
  font-weight: 600;
  background: var(--color-primary-light);
  border-bottom-color: transparent;
}

.json-result-wrap {
  padding: 0 4px 4px;
}

.json-result {
  margin: 0;
  padding: 16px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  max-height: 480px;
}

.notable-form-fields {
  margin-bottom: 8px;
}

.app-main {
  flex: 1;
  padding: 20px 24px 32px;
  overflow: auto;
  max-width: 1400px;
}

.module-page {
  animation: page-fade-in 0.35s ease;
}

@keyframes page-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 28px;
  border-radius: var(--radius-xl);
  margin-bottom: 16px;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
}

.page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.6;
  pointer-events: none;
}

.page-hero-dingding {
  background: linear-gradient(135deg, #eff6ff 0%, #e0e7ff 50%, #f0f9ff 100%);
  border-color: #bfdbfe;
}

.page-hero-dingding::before {
  background: radial-gradient(circle at 90% 20%, rgba(22, 119, 255, 0.15) 0%, transparent 50%);
}

.page-hero-chuanyun {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 50%, #f0fdf4 100%);
  border-color: #a7f3d0;
}

.page-hero-chuanyun::before {
  background: radial-gradient(circle at 90% 20%, rgba(16, 185, 129, 0.12) 0%, transparent 50%);
}

.page-hero-yida {
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 50%, #fef3c7 100%);
  border-color: #fed7aa;
}

.page-hero-yida::before {
  background: radial-gradient(circle at 90% 20%, rgba(249, 115, 22, 0.12) 0%, transparent 50%);
}

.page-hero-notable {
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 50%, #e0e7ff 100%);
  border-color: #c4b5fd;
}

.page-hero-notable::before {
  background: radial-gradient(circle at 90% 20%, rgba(139, 92, 246, 0.12) 0%, transparent 50%);
}

.page-hero-text {
  position: relative;
  z-index: 1;
}

.page-hero-text h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.page-hero-text p {
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.6;
  max-width: 520px;
}

.page-hero-badge {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  backdrop-filter: blur(4px);
  align-self: center;
}

.module-content {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.page-header {
  margin-bottom: 16px;
}

.page-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text);
}

.blank-content {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--color-border);
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--color-text-muted);
  font-size: 15px;
  box-shadow: var(--shadow-sm);
}

.blank-content::before {
  content: '🚧';
  font-size: 36px;
  opacity: 0.6;
}

.config-card,
.result-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.config-card:hover,
.result-card:hover {
  box-shadow: var(--shadow-md);
}

.config-section + .config-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid #f0f0f0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
}

.section-desc {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group.inline {
  margin-bottom: 0;
}

.form-group-full {
  grid-column: 1 / -1;
}

.form-group .field-hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #9ca3af;
  line-height: 1.4;
}

.form-group .inline-input-group select {
  flex: 1;
  min-width: 0;
  height: 44px;
}

.form-group .inline-input-group input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}

.form-group .inline-input-group input:focus {
  border-color: #1677ff;
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.1);
}

.sheet-select-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sheet-select-group .inline-input-group {
  align-items: stretch;
}

.sheet-select-input {
  flex: 1;
  min-width: 0;
  height: 44px;
}

.sheet-manual-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
}

.sheet-manual-input:focus {
  border-color: #1677ff;
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.1);
}

.sheet-list-preview {
  margin-top: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

.sheet-preview-table {
  margin: 0;
}

.sheet-preview-table th,
.sheet-preview-table td {
  padding: 10px 12px;
  font-size: 13px;
}

.sheet-preview-table tbody tr.is-selected {
  background: #eff6ff;
}

.btn-link.btn-use-sheet {
  padding: 0;
  font-size: 13px;
}

.link-btn {
  font-size: 13px;
  color: #1677ff;
  text-decoration: none;
}

.link-btn:hover {
  text-decoration: underline;
}

.module-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
}

.module-info-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
}

.module-label {
  flex-shrink: 0;
  width: 56px;
  color: #6b7280;
}

.module-desc {
  color: #374151;
}

.permission-code {
  font-size: 13px;
  color: #1677ff;
  font-family: Consolas, monospace;
}

.config-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.btn-auto {
  width: auto;
  padding: 0 24px;
}

.btn-outline {
  background: #fff;
  color: #1677ff;
  border: 1px solid #1677ff;
}

.btn-outline:hover {
  background: #e6f4ff;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
  border: none;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-danger:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.delete-table .col-check {
  width: 44px;
  text-align: center;
}

.delete-table input[type='checkbox'] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.message-box {
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
}

.message-box.success {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

.message-box.error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.message-box.info {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.result-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.result-count {
  font-size: 13px;
  color: #6b7280;
}

.table-wrap {
  overflow-x: auto;
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
}

.table-pagination .page-info {
  font-size: 13px;
  color: #6b7280;
}

.table-pagination .page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
}

.data-table th {
  background: #fafafa;
  font-weight: 500;
  color: #374151;
}

.data-table tbody tr:hover {
  background: #fafafa;
}

.form-source {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.form-source-name {
  font-weight: 500;
  color: #1f2937;
}

.form-source-code {
  font-size: 12px;
  color: #9ca3af;
  font-family: Consolas, monospace;
}

.btn-link {
  border: none;
  background: none;
  color: #1677ff;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
}

.btn-link:hover {
  text-decoration: underline;
}

.schedule-card {
  margin-top: 0;
}

.mode-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 1px solid #e5e7eb;
}

.mode-tab {
  padding: 10px 20px;
  border: none;
  background: none;
  font-size: 14px;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.mode-tab:hover {
  color: #1677ff;
}

.mode-tab.active {
  color: #1677ff;
  font-weight: 600;
  border-bottom-color: #1677ff;
}

.mode-panel {
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.schedule-add-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.schedule-input {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
}

.schedule-select {
  min-width: 140px;
}

.schedule-hint {
  font-size: 13px;
  color: #6b7280;
  margin: 0 0 12px;
}

.schedule-empty {
  text-align: center;
  color: #9ca3af;
  padding: 24px !important;
}

.schedule-code {
  font-size: 12px;
  word-break: break-all;
}

.schedule-actions {
  white-space: nowrap;
}

.schedule-actions .btn-link {
  margin-left: 10px;
}

.schedule-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
}

.schedule-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  background: #f3f4f6;
  color: #6b7280;
}

.schedule-status.success {
  background: #ecfdf5;
  color: #059669;
}

.schedule-status.error {
  background: #fef2f2;
  color: #dc2626;
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  z-index: 1000;
  transition: background 0.28s ease;
}

.drawer-overlay.is-visible {
  background: rgba(0, 0, 0, 0.45);
}

body.drawer-open {
  overflow: hidden;
}

.drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(820px, 72vw);
  height: 100vh;
  background: #fff;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s ease;
}

.schedule-drawer {
  width: min(820px, 72vw);
}

.drawer-panel.is-visible {
  transform: translateX(0);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.drawer-header h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.drawer-close {
  border: none;
  background: none;
  font-size: 24px;
  line-height: 1;
  color: #9ca3af;
  cursor: pointer;
}

.drawer-close:hover {
  color: #374151;
}

.drawer-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 28px;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
  background: #fff;
}

.drawer-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #f0f0f0;
}

.drawer-section h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px;
  color: #374151;
}

.drawer-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.drawer-section-header h4 {
  margin: 0;
}

.drawer-section-tip {
  font-size: 13px;
  color: #6b7280;
  margin: 0 0 10px;
}

.drawer-mapping-wrap {
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid #f0f0f0;
  border-radius: 8px;
}

.drawer-mapping-table {
  font-size: 14px;
}

.drawer-mapping-table th,
.drawer-mapping-table td {
  padding: 12px 14px;
}

.schedule-drawer .form-group {
  margin-bottom: 16px;
}

.schedule-drawer .form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: #374151;
}

.schedule-drawer .form-group input,
.schedule-drawer .form-group select,
.schedule-drawer .form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
}

.input-readonly {
  background: #f9fafb;
  color: #6b7280;
  cursor: not-allowed;
}

.schedule-drawer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.schedule-drawer-row .form-group {
  flex: 1;
  min-width: 140px;
}

.btn-sm {
  padding: 4px 12px;
  font-size: 13px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.modal-card {
  width: 100%;
  max-width: 720px;
  max-height: 80vh;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  border: none;
  background: none;
  font-size: 24px;
  line-height: 1;
  color: #9ca3af;
  cursor: pointer;
}

.modal-close:hover {
  color: #374151;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.detail-loading,
.detail-error {
  text-align: center;
  color: #6b7280;
  padding: 24px 0;
}

.detail-error {
  color: #dc2626;
}

.detail-section + .detail-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #f0f0f0;
}

.detail-section h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.detail-item,
.detail-list-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
}

.detail-label {
  font-size: 12px;
  color: #9ca3af;
}

.detail-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.detail-form-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  background: #fafafa;
  border-radius: 8px;
}

.detail-value {
  font-size: 14px;
  color: #1f2937;
  word-break: break-all;
}

.detail-op {
  padding: 10px 12px;
  background: #fafafa;
  border-radius: 8px;
}

.detail-op-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 14px;
}

.detail-op-user {
  font-weight: 500;
  color: #1f2937;
}

.detail-op-type {
  color: #1677ff;
}

.detail-op-date {
  color: #9ca3af;
  font-size: 13px;
}

.detail-remark {
  margin-top: 4px;
  font-size: 13px;
  color: #6b7280;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.profile-info-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}

.profile-info-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.profile-info-label {
  font-size: 14px;
  color: #6b7280;
  flex-shrink: 0;
}

.profile-info-value {
  font-size: 14px;
  color: #1f2937;
  font-weight: 500;
}

.profile-inline-input {
  flex: 1;
  max-width: 280px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
}

.profile-status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.license-expired-banner {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 10px 20px;
  background: #fef2f2;
  border-bottom: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 14px;
  text-align: center;
}

.license-expired-banner a {
  color: #dc2626;
  font-weight: 600;
  text-decoration: underline;
}

.profile-status-badge.active {
  background: #ecfdf5;
  color: #059669;
}

.profile-status-badge.expired {
  background: #fef2f2;
  color: #dc2626;
}

.profile-section-desc {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 14px;
}

.profile-admin-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.license-duration-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.generated-key-box {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 14px;
  background: #f0f7ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
}

.generated-key-label {
  font-size: 13px;
  color: #374151;
}

.generated-key-box code {
  flex: 1;
  font-size: 14px;
  color: #1677ff;
  word-break: break-all;
}

.profile-user-modal .form-group {
  margin-bottom: 14px;
}

.profile-user-modal .form-group input,
.profile-user-modal .form-group select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid #e5e7eb;
}

@media (max-width: 768px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .detail-form-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .config-actions {
    flex-direction: column;
  }

  .btn-auto {
    width: 100%;
  }
}

.stream-card {
  margin-top: 20px;
}

.stream-guide {
  margin: 12px 0 16px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  color: #4b5563;
  line-height: 1.6;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.status-badge.status-online {
  background: #ecfdf5;
  color: #059669;
}

.status-badge.status-pending {
  background: #fffbeb;
  color: #d97706;
}

.status-badge.status-offline {
  background: #f3f4f6;
  color: #6b7280;
}

.status-badge.status-error {
  background: #fef2f2;
  color: #dc2626;
}

.log-text {
  display: block;
  max-width: 260px;
  font-size: 12px;
  color: #6b7280;
  word-break: break-all;
}

.status-text.success {
  color: #059669;
}

.status-text.error {
  color: #dc2626;
}

.status-text.muted {
  color: #9ca3af;
}

.field-code {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 2px;
}

.drawer-section-first {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.listener-drawer .field-hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #9ca3af;
  line-height: 1.4;
}

.listener-drawer .checkbox-group {
  margin-bottom: 0;
}

.listener-drawer .checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #374151;
  user-select: none;
}

.listener-drawer .checkbox-label input[type='checkbox'] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #2563eb;
}

.listener-drawer .mapping-value-cell select,
.listener-drawer .mapping-value-cell input {
  width: 100%;
  min-width: 140px;
}

.listener-drawer .mapping-mode {
  min-width: 110px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.action-cell .btn-link {
  margin-right: 10px;
}

.action-cell .btn-link.danger {
  color: #dc2626;
}

/* ===== Responsive ===== */
@media (max-width: 960px) {
  .login-showcase {
    display: none;
  }

  .login-panel {
    flex: 1;
    background: linear-gradient(160deg, #0f2744 0%, #1a1f4e 40%, #f8fafc 40%);
    padding-top: 80px;
  }

  .login-card {
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.2);
  }
}

@media (max-width: 768px) {
  .app-sidebar {
    width: 64px;
  }

  .sidebar-brand span:not(.sidebar-brand-icon),
  .sidebar-item span:not(.sidebar-icon) {
    display: none;
  }

  .sidebar-brand {
    justify-content: center;
    padding: 16px 8px;
  }

  .sidebar-item {
    justify-content: center;
    padding: 12px;
  }

  .page-hero {
    flex-direction: column;
    padding: 20px;
  }

  .page-hero-badge {
    align-self: flex-start;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}
