/* ========================================
   海豚管理系统 · SaaS Admin Design System
   风格参考：Tabler Admin / 冷链 B2B
   主色：Ocean Teal · 侧栏：浅灰毛玻璃
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --accent: #0D9488;
  --accent-hover: #0F766E;
  --accent-soft: rgba(13, 148, 136, 0.12);
  --accent-ring: rgba(13, 148, 136, 0.28);

  --blue: #0D9488;
  --blue-hover: #0F766E;
  --blue-light: #CCFBF1;
  --blue-bg: rgba(13, 148, 136, 0.1);

  --red: #E11D48;
  --orange: #EA580C;
  --green: #16A34A;
  --purple: #7C3AED;
  --teal: #06B6D4;

  --bg: #F1F5F9;
  --bg-accent: #E2E8F0;
  --card: #FFFFFF;
  --sidebar-bg: rgba(248, 250, 252, 0.72);
  --sidebar-border: rgba(148, 163, 184, 0.28);
  --sidebar-text: #64748B;
  --sidebar-text-active: #0F172A;
  --sidebar-hover: rgba(15, 23, 42, 0.05);
  --sidebar-active: rgba(13, 148, 136, 0.12);

  --text: #0F172A;
  --text2: #64748B;
  --text3: #94A3B8;

  --border: #E2E8F0;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.04);
  --shadow-hover: 0 4px 24px rgba(15, 23, 42, 0.08);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --font: "Plus Jakarta Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", ui-monospace, monospace;

  --sidebar-w: 208px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(13, 148, 136, 0.07), transparent 55%),
    radial-gradient(900px 500px at -5% 100%, rgba(14, 165, 233, 0.05), transparent 50%),
    var(--bg);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.55;
  min-height: 100vh;
}

/* ===== Layout ===== */
.app-layout { display: flex; min-height: 100vh; }

/* ===== Sidebar (light gray + frosted glass) ===== */
.app-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82) 0%, rgba(241, 245, 249, 0.68) 55%, rgba(226, 232, 240, 0.55) 100%);
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  border-right: 0.5px solid var(--sidebar-border);
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.45) inset, 2px 0 16px rgba(15, 23, 42, 0.025);
  padding: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}
.app-sidebar .brand {
  padding: 16px 14px 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--sidebar-text-active);
  letter-spacing: -0.3px;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.35);
}
.app-sidebar .brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #14B8A6, #0EA5E9);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 6px 16px rgba(13, 148, 136, 0.35);
  flex-shrink: 0;
}
.app-sidebar .brand-mark svg { width: 18px; height: 18px; }
.app-sidebar .brand-text { display: flex; flex-direction: column; gap: 1px; line-height: 1.2; }
.app-sidebar .brand-text small {
  font-size: 10px;
  font-weight: 500;
  color: var(--sidebar-text);
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.app-sidebar nav {
  flex: 1;
  padding: 10px 8px 16px;
  overflow-y: auto;
}

.nav-group { margin-bottom: 14px; }
.nav-group-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94A3B8;
  padding: 4px 10px 6px;
}

.app-sidebar nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  margin-bottom: 2px;
  border: 1px solid transparent;
}
.app-sidebar nav a:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-active);
}
.app-sidebar nav a.active {
  background: var(--sidebar-active);
  color: var(--accent-hover);
  border-color: rgba(13, 148, 136, 0.22);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(13, 148, 136, 0.08);
}
.app-sidebar nav a svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}
.app-sidebar nav a.active svg { color: var(--accent); opacity: 1; }

.app-sidebar .sidebar-footer {
  padding: 12px 12px 14px;
  border-top: 1px solid var(--sidebar-border);
  font-size: 11px;
  color: #94A3B8;
  text-align: left;
  line-height: 1.45;
  background: rgba(255, 255, 255, 0.28);
}
.app-sidebar .sidebar-footer strong {
  display: block;
  color: #475569;
  font-weight: 600;
  margin-bottom: 2px;
}

/* ===== Main Content ===== */
.app-main {
  flex: 1;
  width: 100%;
  min-width: 0;
  padding: 24px 28px 36px;
  animation: pageIn 0.35s ease both;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ===== Top Bar ===== */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  gap: 12px;
}
.top-bar h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text);
}
.top-bar .breadcrumb {
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 4px;
}
.top-bar .breadcrumb span { color: var(--text3); margin: 0 4px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(180deg, #14B8A6 0%, #0D9488 100%);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,0.2) inset, 0 4px 12px rgba(13, 148, 136, 0.28);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #0D9488 0%, #0F766E 100%);
  box-shadow: 0 6px 16px rgba(13, 148, 136, 0.32);
}
.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
.btn-secondary:hover { background: #F8FAFC; border-color: #CBD5E1; }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-icon { width: 30px; height: 30px; padding: 0; justify-content: center; border-radius: var(--radius-sm); }

/* ===== Cards ===== */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
}
.card:hover { box-shadow: var(--shadow-hover); }

/* ===== Stat Cards Grid ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.stat-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}
.stat-card::after { display: none; }
.stat-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--text2);
  font-weight: 500;
  margin-bottom: 0;
  line-height: 1.35;
}
.stat-card .stat-value {
  font-family: var(--font);
  font-size: 33px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  color: var(--text);
}
.stat-card .stat-change {
  font-size: 11px;
  margin-top: 8px;
  color: var(--text2);
}
.stat-card .stat-change.up { color: var(--red); }
.stat-card .stat-change.down { color: var(--green); }
.stat-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-icon svg { width: 16px; height: 16px; }
.stat-hint {
  font-size: 11px;
  color: var(--text3);
  margin-top: 6px;
  line-height: 1.35;
}
.stat-icon--teal { background: rgba(13, 148, 136, 0.12); color: var(--accent); }
.stat-icon--green { background: rgba(22, 163, 74, 0.12); color: var(--green); }
.stat-icon--orange { background: rgba(234, 88, 12, 0.12); color: var(--orange); }
.stat-icon--red { background: rgba(225, 29, 72, 0.12); color: var(--red); }
.stat-icon--purple { background: rgba(124, 58, 237, 0.12); color: var(--purple); }
.stat-icon--blue { background: rgba(13, 148, 136, 0.12); color: var(--blue); }
.stat-value--money { font-size: 29px; letter-spacing: -0.015em; }
.stat-value--sm {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text2);
  letter-spacing: 0;
}

/* ===== KPI dashboard sections ===== */
.kpi-section { margin-bottom: 20px; }
.kpi-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.kpi-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: 0.02em;
}
.kpi-section-link {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}
.kpi-section-link:hover { text-decoration: underline; }
.stats-grid--kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-rows { display: flex; flex-direction: column; gap: 14px; }
.kpi-row-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text3);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}
@media (max-width: 1100px) {
  .stats-grid--kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .stats-grid--kpi { grid-template-columns: 1fr; }
}

/* ===== Section ===== */
.section {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.section-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 14px;
  letter-spacing: -0.2px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text);
}

/* ===== Table ===== */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  color: var(--text2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  background: #F8FAFC;
}
table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table tr:last-child td { border-bottom: none; }
table tbody tr { transition: background 0.12s; }
table tbody tr:hover td { background: #F0FDFA; }

/* ===== Badge ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.1px;
}
.badge-blue { background: var(--blue-bg); color: var(--accent-hover); }
.badge-green { background: #DCFCE7; color: #15803D; }
.badge-red { background: #FFE4E6; color: #BE123C; }
.badge-orange { background: #FFEDD5; color: #C2410C; }
.badge-gray { background: #F1F5F9; color: var(--text2); }
.badge-purple { background: #EDE9FE; color: #6D28D9; }

/* ===== Level Tag ===== */
.level-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}

/* ===== Form ===== */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 5px;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: #F8FAFC;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.form-control:focus {
  border-color: var(--accent);
  background: var(--card);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%2364748B' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
textarea.form-control { resize: vertical; min-height: 60px; }

/* ===== Filter Bar ===== */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}
.filter-bar .form-control { width: auto; min-width: 140px; }
.filter-bar .search-input { min-width: 200px; }

/* ===== Modal · Tabler / SaaS sheet ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  overflow: hidden;
}
.modal-overlay.show { display: flex; animation: modalFade .18s ease; }
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  display: flex;
  flex-direction: column;
  width: 520px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 48px);
  margin: 0;
  padding: 0;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 16px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.03), 0 24px 64px rgba(15, 23, 42, 0.22);
  overflow: hidden;
  flex-shrink: 0;
  animation: modalIn .22s cubic-bezier(.2,.8,.2,1);
}
.modal.modal-lg { width: 580px; }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #F8FAFC 0%, #fff 100%);
  flex-shrink: 0;
}
.modal-kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}
.modal-header h3,
.modal-header .modal-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
}
.modal-close {
  width: 32px; height: 32px; border: none; border-radius: 8px;
  background: transparent; color: var(--text2);
  display: grid; place-items: center; cursor: pointer; flex-shrink: 0;
  transition: background .15s, color .15s;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-close svg { width: 18px; height: 18px; }
.modal-body {
  flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto;
  padding: 18px 20px 8px; -webkit-overflow-scrolling: touch;
}
.modal-footer, .modal-actions {
  display: flex; gap: 8px; justify-content: flex-end; align-items: center;
  padding: 14px 20px 18px; border-top: 1px solid var(--border);
  background: #fff; flex-shrink: 0; margin-top: 0;
}
.modal-section { margin-bottom: 16px; }
.modal-section:last-child { margin-bottom: 8px; }
.modal-section-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 10px;
}
.modal-section-label::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row .form-group { margin-bottom: 0; }
.form-row .span-2 { grid-column: 1 / -1; }
.modal-panel {
  padding: 14px; background: #F8FAFC; border: 1px solid var(--border); border-radius: 12px;
}
.modal-panel .form-row { gap: 10px 12px; }
.modal-panel-title, .modal-panel .block-title {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 13px; font-weight: 650; margin-bottom: 10px; color: var(--text);
}
.modal-hint { font-size: 12px; color: var(--text3); font-weight: 500; }
@media (max-width: 560px) {
  .form-row { grid-template-columns: 1fr; }
  .form-row .span-2 { grid-column: auto; }
  .modal, .modal.modal-lg { width: 100%; }
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
  font-size: 12px;
  color: var(--text2);
}
.pagination button {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.pagination button:hover { background: #F0FDFA; border-color: #99F6E4; color: var(--accent-hover); }
.pagination button:disabled { opacity: 0.4; cursor: default; }

/* ===== Empty / Loading ===== */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text2); }
.empty-state .icon { font-size: 36px; margin-bottom: 8px; }
.empty-state .text { font-size: 13px; }
.loading { text-align: center; padding: 30px; color: var(--text2); font-size: 13px; }

/* ===== Utility ===== */
.flex { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.flex-1 { flex: 1; }
.mt-2 { margin-top: 12px; }
.mb-2 { margin-bottom: 12px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gap-sm { gap: 6px; }

@media (max-width: 960px) {
  .app-sidebar { width: 72px; }
  .app-sidebar .brand-text,
  .app-sidebar .nav-group-label,
  .app-sidebar nav a span,
  .app-sidebar .sidebar-footer { display: none; }
  .app-sidebar nav a { justify-content: center; padding: 12px; }
  .app-main { padding: 20px 16px; }
  :root { --sidebar-w: 72px; }
}
