/* ═══════════════════════════════════════════
   Phase 3 Modules: Sales & Finance
   ═══════════════════════════════════════════ */

/* ── Kanban Board ── */
.kanban-wrap {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 0 0 16px;
  min-height: calc(100vh - 200px);
}
.kanban-col {
  min-width: 240px;
  max-width: 280px;
  flex-shrink: 0;
  background: var(--surface, #fbf9f4);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
}
.kanban-col-head {
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .08em;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--surface, #fbf9f4);
  z-index: 1;
}
.kanban-col-head .cnt {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 8px;
  font-family: 'Cormorant Garamond', serif;
  letter-spacing: .15em;
}
.kanban-col-body {
  padding: 8px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kanban-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  padding: 10px 12px;
  cursor: pointer;
  transition: box-shadow .15s;
  border-radius: 4px;
}
.kanban-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.kanban-card .kc-title {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kanban-card .kc-addr {
  font-size: 11px;
  color: var(--mute);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kanban-card .kc-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
}
.kanban-card .kc-amount {
  font-family: 'Cormorant Garamond', serif;
  font-size: 14px;
  color: var(--accent);
  letter-spacing: .05em;
}
.kanban-card .kc-dots {
  display: flex;
  gap: 3px;
}
.kanban-card .kc-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line);
}
.kanban-card .kc-dot.done {
  background: var(--sage);
}
.kanban-card .kc-dot.warn {
  background: var(--error);
}
.kanban-card.overdue {
  border-left-color: var(--error);
}

/* ── Status Pills ── */
.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
  letter-spacing: .08em;
  font-weight: 400;
}
.pill-draft { background: rgba(138,133,128,.1); color: var(--mute); }
.pill-sent { background: rgba(107,125,160,.12); color: #5a6f8a; }
.pill-signed { background: rgba(138,148,132,.12); color: #5a6e54; }
.pill-expired { background: rgba(196,92,92,.1); color: var(--error); }
.pill-pending { background: rgba(154,132,86,.1); color: var(--accent); }
.pill-paid { background: rgba(138,148,132,.12); color: #5a6e54; }
.pill-overdue { background: rgba(196,92,92,.1); color: var(--error); }
.pill-void { background: rgba(138,133,128,.08); color: var(--mute); text-decoration: line-through; }

/* ── Module Tables ── */
.mod-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.mod-table th {
  background: var(--surface, #fbf9f4);
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: .1em;
  color: var(--mute);
  text-transform: uppercase;
  white-space: nowrap;
}
.mod-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.mod-table tr:hover td {
  background: rgba(154,132,86,.03);
}
.mod-table .num {
  font-family: 'Cormorant Garamond', serif;
  font-size: 15px;
  letter-spacing: .03em;
}
.mod-table .neg {
  color: var(--error);
}

/* ── Module Tabs ── */
.mod-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.mod-tab {
  padding: 10px 20px;
  font-size: 13px;
  letter-spacing: .05em;
  color: var(--mute);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all .15s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
}
.mod-tab:hover { color: var(--ink); }
.mod-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 500;
}

/* ── Form Controls ── */
.mod-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 13px;
  font-family: 'Noto Sans TC', sans-serif;
  color: var(--ink);
  outline: none;
  transition: border-color .15s;
}
.mod-input:focus {
  border-color: var(--accent);
}
.mod-input::placeholder {
  color: var(--mute);
  font-weight: 300;
}
.mod-select {
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 13px;
  font-family: 'Noto Sans TC', sans-serif;
  color: var(--ink);
  outline: none;
  cursor: pointer;
}
.mod-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 13px;
  font-family: 'Noto Sans TC', sans-serif;
  color: var(--ink);
  outline: none;
  resize: vertical;
  min-height: 80px;
}
.mod-btn {
  padding: 8px 20px;
  font-size: 12px;
  letter-spacing: .15em;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-family: 'Noto Sans TC', sans-serif;
  transition: all .15s;
}
.mod-btn:hover {
  background: #8a7446;
}
.mod-btn-outline {
  padding: 8px 20px;
  font-size: 12px;
  letter-spacing: .15em;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-family: 'Noto Sans TC', sans-serif;
  transition: all .15s;
}
.mod-btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.mod-btn-danger {
  padding: 8px 20px;
  font-size: 12px;
  letter-spacing: .15em;
  border: 1px solid var(--error);
  background: var(--error);
  color: #fff;
  cursor: pointer;
  font-family: 'Noto Sans TC', sans-serif;
}

/* ── KPI Cards ── */
.mod-kpi {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 18px 20px;
}
.mod-kpi .kpi-label {
  font-family: 'Cormorant Garamond', serif;
  font-size: 10px;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--mute);
  margin-bottom: 6px;
}
.mod-kpi .kpi-value {
  font-family: 'Cormorant Garamond', serif;
  font-size: 32px;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
}
.mod-kpi .kpi-sub {
  font-size: 11px;
  color: var(--mute);
}

/* ── Warning Banner ── */
.mod-warning {
  background: rgba(196,92,92,.06);
  border-left: 3px solid var(--error);
  padding: 12px 16px;
  font-size: 13px;
  color: #7a3a3a;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.mod-success {
  background: rgba(138,148,132,.06);
  border-left: 3px solid var(--sage);
  padding: 12px 16px;
  font-size: 13px;
  color: #3a5e40;
  margin-bottom: 16px;
}
.mod-info {
  background: rgba(107,125,160,.06);
  border-left: 3px solid #6b7da0;
  padding: 12px 16px;
  font-size: 13px;
  color: #4a5a72;
  margin-bottom: 16px;
}

/* ── Profit Visualization ── */
.profit-bar {
  height: 8px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
  margin: 4px 0;
}
.profit-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .3s;
}
.profit-bar-fill.good { background: var(--sage); }
.profit-bar-fill.warn { background: var(--terra); }
.profit-bar-fill.danger { background: var(--error); }

/* ── Timeline / Milestone ── */
.milestone-line {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 20px 0;
}
.milestone-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--card);
  flex-shrink: 0;
  position: relative;
}
.milestone-dot.done {
  border-color: var(--sage);
  background: var(--sage);
}
.milestone-dot.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(154,132,86,.2);
}
.milestone-dot.overdue {
  border-color: var(--error);
  background: var(--error);
}
.milestone-seg {
  flex: 1;
  height: 2px;
  background: var(--line);
}
.milestone-seg.done {
  background: var(--sage);
}

/* ── Modal ── */
.mod-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mod-modal {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 28px 32px;
  min-width: 420px;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
}
.mod-modal h3 {
  font-family: 'Noto Serif TC', serif;
  font-weight: 500;
  font-size: 18px;
  margin-bottom: 16px;
  letter-spacing: .05em;
}

/* ── Responsive ── */
@media (max-width: 1200px) {
  .kanban-wrap { gap: 8px; }
  .kanban-col { min-width: 200px; }
}
