/* OmniDesk Multi-Entity Isolated Workspace Stylesheet */
:root {
  --bg-main: #0b1329;
  --bg-card: #152238;
  --bg-card-alt: #1e2f4d;
  --border-color: #243656;
  --border-active: #3b82f6;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-sub: #cbd5e1;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --tourism-theme: #0284c7;
  --trade-theme: #0d9488;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Header & Top Bar */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 2rem;
  background-color: #070d1e;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-logo {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #0284c7, #0d9488);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.15rem;
  color: #fff;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.4);
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-tag {
  font-size: 0.72rem;
  padding: 0.2rem 0.6rem;
  background: rgba(13, 148, 136, 0.15);
  color: #2dd4bf;
  border: 1px solid rgba(13, 148, 136, 0.3);
  border-radius: 9999px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.role-badge-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.role-select {
  background-color: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.45rem 0.8rem;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
}
.role-select:focus {
  border-color: var(--border-active);
}

/* 事业部一级分账切换条 (Strict Entity Switcher) */
.entity-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 2rem;
  background-color: #0f1c33;
  border-bottom: 2px solid #1a2c4e;
}

.entity-tabs {
  display: flex;
  gap: 0.75rem;
}

.entity-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 0.55rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.entity-btn:hover {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.05);
}

.entity-btn.active-tourism {
  background-color: #0284c7;
  color: #fff;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.entity-btn.active-trade {
  background-color: #0d9488;
  color: #fff;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.35);
}

.entity-isolation-indicator {
  font-size: 0.8rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.isolation-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
}

/* 二级子功能选项卡 (Sub-navigation) */
.sub-nav {
  display: flex;
  gap: 0.5rem;
  padding: 0.65rem 2rem;
  background-color: #12213a;
  border-bottom: 1px solid var(--border-color);
}

.sub-nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.45rem 0.95rem;
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.sub-nav-btn:hover {
  color: #fff;
}
.sub-nav-btn.active {
  background-color: var(--bg-card-alt);
  color: #fff;
  font-weight: 600;
  border: 1px solid var(--border-color);
}

/* 主工作区 */
.main-content {
  max-width: 1480px;
  margin: 0 auto;
  padding: 1.5rem 2rem 4rem;
}

.view-panel {
  display: none;
}
.view-panel.active {
  display: block;
}

/* 按钮规范 */
.btn {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  outline: none;
}

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

.btn-tourism {
  background-color: #0284c7;
  color: #fff;
}
.btn-tourism:hover {
  background-color: #0369a1;
}

.btn-trade {
  background-color: #0d9488;
  color: #fff;
}
.btn-trade:hover {
  background-color: #0f766e;
}

.btn-secondary {
  background-color: var(--bg-card-alt);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background-color: #2b3e63;
}

.btn-success {
  background-color: #059669;
  color: #fff;
}
.btn-success:hover {
  background-color: #047857;
}

.btn-danger {
  background-color: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 0.3rem 0.6rem;
  font-size: 0.78rem;
}
.btn-danger:hover {
  background-color: #ef4444;
  color: #fff;
}

.btn-add {
  background-color: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px dashed rgba(59, 130, 246, 0.4);
  width: 100%;
  justify-content: center;
  padding: 0.6rem;
  margin-top: 0.5rem;
  font-size: 0.85rem;
}
.btn-add:hover {
  background-color: rgba(59, 130, 246, 0.25);
}

/* 卡片布局 */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 0.75rem;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-actions {
  display: flex;
  gap: 0.6rem;
}

/* 表单与动态输入表格 */
.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
}

.field-input {
  background-color: #0c1424;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  color: var(--text-main);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.15s ease;
}
.field-input:focus {
  border-color: var(--border-active);
}

/* 动态行编辑表格 */
.edit-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0.75rem;
}

.edit-table th {
  background-color: #0e172a;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.edit-table td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.table-input {
  width: 100%;
  background-color: #0c1424;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 0.4rem 0.6rem;
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
}
.table-input:focus {
  border-color: var(--border-active);
  background-color: #101c33;
}

/* 实时指标浮动条 */
.live-summary-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  background: linear-gradient(135deg, #101e38, #182846);
  border: 1px solid #2d4268;
  border-radius: 8px;
  padding: 1.1rem 1.5rem;
  margin-bottom: 1.5rem;
}

.summary-item {
  display: flex;
  flex-direction: column;
}

.summary-label {
  font-size: 0.75rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.summary-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* 归档列表 */
.archive-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.archive-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #0f1c33;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.85rem 1.25rem;
}
.archive-item:hover {
  border-color: var(--border-active);
}

.archive-info-title {
  font-weight: 600;
  font-size: 0.95rem;
}
.archive-info-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* 正式单据预览区 (Print Ready) */
.doc-canvas {
  background: #ffffff;
  color: #0f172a;
  border-radius: 8px;
  padding: 2.5rem 3rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  max-width: 980px;
  margin: 1.5rem auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", sans-serif;
}

.doc-header {
  background-color: #1e3a8a;
  color: #ffffff;
  padding: 1.2rem 1.5rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
}
.doc-header-tourism {
  background-color: #0369a1;
}
.doc-header-trade {
  background-color: #0f766e;
}

.doc-table-formal {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-bottom: 1.25rem;
}
.doc-table-formal th {
  background-color: #f1f5f9;
  color: #1e293b;
  padding: 0.55rem 0.7rem;
  font-weight: 700;
  border: 1px solid #cbd5e1;
}
.doc-table-formal td {
  padding: 0.55rem 0.7rem;
  border: 1px solid #e2e8f0;
  color: #1e293b;
}
.doc-table-formal tr:nth-child(even) td {
  background-color: #f8fafc;
}

/* 打印控制 */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .top-nav, .entity-bar, .sub-nav, .no-print, .btn, .card-actions {
    display: none !important;
  }
  .main-content {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .doc-canvas {
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
  }
  @page {
    size: A4 portrait;
    margin: 12mm;
  }
}

/* 管理员后台策略控制条 (Admin Strategy Bar) */
.admin-strategy-bar {
  background: linear-gradient(135deg, #1e1b4b, #2e1065);
  border-bottom: 2px solid #6366f1;
  padding: 0.65rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.strategy-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: #c7d2fe;
}

.strategy-inputs {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.strategy-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: #e0e7ff;
}

.strategy-input {
  width: 90px;
  background: #0f172a;
  border: 1px solid #4338ca;
  color: #38bdf8;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  font-weight: 700;
  font-family: ui-monospace, monospace;
  outline: none;
}
.strategy-input:focus {
  border-color: #818cf8;
}

/* 币种切换组件 (Currency Switcher) */
.currency-pill-group {
  display: inline-flex;
  background-color: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 2px;
}

.currency-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.currency-toggle-btn.active-curr {
  background-color: #2563eb;
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* 员工快捷速算卡片 */
.fast-quote-card {
  background: linear-gradient(135deg, #0d2823, #113832);
  border: 1px solid #14b8a6;
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

/* 超级管理员战略指挥中心专属样式 */
.admin-console-wrapper {
  display: block;
}

.admin-hero-banner {
  background: linear-gradient(135deg, #1e1b4b 0%, #2e1065 50%, #0f172a 100%);
  border: 1px solid #6366f1;
  border-radius: 12px;
  padding: 1.75rem 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.2);
}

.admin-hero-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.admin-hero-sub {
  font-size: 0.88rem;
  color: #c7d2fe;
  margin-top: 0.35rem;
  line-height: 1.6;
}

.admin-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.75rem;
}

.admin-card {
  background: #111a30;
  border: 1px solid #2d3f66;
  border-radius: 10px;
  padding: 1.5rem;
}

.admin-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.75rem;
  margin-bottom: 1.25rem;
}

.admin-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #e0e7ff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-template-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.85rem;
}

.admin-textarea {
  background-color: #0b1120;
  border: 1px solid #2d3f66;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  color: #f8fafc;
  font-size: 0.84rem;
  font-family: inherit;
  resize: vertical;
  min-height: 65px;
  outline: none;
}
.admin-textarea:focus {
  border-color: #6366f1;
}

/* 穿透模式提示条 (Impersonation Banner) */
.impersonate-banner {
  background: linear-gradient(90deg, #b45309, #d97706);
  color: #ffffff;
  padding: 0.6rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
}

/* 双规则设定控制台切换与卡片样式 */
.rule-console-tabs {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.rule-tab-btn {
  background: #111a30;
  border: 1px solid #2d3f66;
  color: var(--text-muted);
  padding: 0.65rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.rule-tab-btn:hover {
  color: #fff;
  border-color: #4f46e5;
}
.rule-tab-btn.active-tourism-rule {
  background: #0284c7;
  color: #fff;
  border-color: #38bdf8;
  box-shadow: 0 4px 15px rgba(2, 132, 199, 0.4);
}
.rule-tab-btn.active-trade-rule {
  background: #0d9488;
  color: #fff;
  border-color: #2dd4bf;
  box-shadow: 0 4px 15px rgba(13, 148, 136, 0.4);
}

/* 厂商档案与联系方式卡片 */
.supplier-contact-card {
  background: #0f1c33;
  border: 1px solid #243656;
  border-radius: 8px;
  padding: 1.1rem;
  margin-bottom: 1.25rem;
}

/* 结案状态标签 */
.status-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.status-quoting {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.status-confirmed {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.status-settled {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* 结案操作栏 */
.closure-card {
  background: linear-gradient(135deg, #132420, #1c3832);
  border: 1px solid #059669;
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

/* 防呆警告盒 */
.foolproof-box {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  border-radius: 6px;
  padding: 0.65rem 0.9rem;
  font-size: 0.8rem;
  line-height: 1.5;
  margin-top: 0.5rem;
}
