/**
 * ForwardWay Timesheet - Accounting Portal Stylesheet
 * 财务专席核对看板 · 全员月度工资总表
 */

:root {
  --bg-dark: #070c18;
  --bg-card: #0c1427;
  --bg-card-sub: #111c35;
  --bg-card-hover: #162444;
  --border-color: #1e293b;
  --border-highlight: #334155;
  --border-gold: rgba(234, 179, 8, 0.35);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-blue: #3b82f6;
  --accent-gold: #facc15;
  --accent-gold-bg: rgba(234, 179, 8, 0.1);
  --accent-emerald: #10b981;
  --accent-emerald-bg: rgba(16, 185, 129, 0.12);
  --accent-purple: #a855f7;
  --accent-purple-bg: rgba(168, 85, 247, 0.12);
  --accent-rose: #f43f5e;

  --font-sans: 'Outfit', 'Noto Sans SC', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html, body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  user-select: text !important;
}

.accounting-body {
  overflow-x: hidden;
}

/* ============================================================
 * Top Bar
 * ============================================================ */
.accounting-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(11, 18, 33, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
}

.bar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  font-size: 22px;
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.system-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: #fff;
}

.sub-label {
  font-size: 11px;
  color: var(--text-dim);
}

.divider-v {
  width: 1px;
  height: 28px;
  background: var(--border-color);
}

.accounting-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  padding: 4px 10px;
  border-radius: 8px;
}

.avatar-acc {
  font-size: 16px;
}

.acc-meta {
  display: flex;
  flex-direction: column;
}

.acc-meta .name {
  font-size: 12px;
  font-weight: 700;
  color: #93c5fd;
}

.acc-meta .mode-tag {
  font-size: 10px;
  color: #60a5fa;
}

/* Month Navigation Pill */
.bar-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.month-pill-group {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 30px;
  padding: 3px 6px;
  gap: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.btn-month-nav {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-month-nav:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.month-label-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 20px;
  user-select: none;
  transition: background 0.15s ease;
}

.month-label-wrap:hover {
  background: rgba(255, 255, 255, 0.08);
}

.cal-icon {
  font-size: 13px;
}

.current-month-text {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  font-family: var(--font-mono);
}

.tag-month-status {
  font-size: 10px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 1px 6px;
  border-radius: 10px;
}

.tag-month-status.nodata {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.25);
}

.btn-reset-current {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #93c5fd;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s ease;
}

.btn-reset-current:hover {
  background: rgba(59, 130, 246, 0.3);
  color: #fff;
}

/* Actions Right */
.bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.btn-tool:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: var(--border-highlight);
}

.btn-capture-mode {
  border-color: rgba(59, 130, 246, 0.3);
  background: rgba(59, 130, 246, 0.08);
  color: #93c5fd;
}

.btn-capture-mode:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #fff;
}

.btn-export-jpg {
  border-color: rgba(234, 179, 8, 0.4);
  background: rgba(234, 179, 8, 0.12);
  color: #fde047;
}

.btn-export-jpg:hover {
  background: rgba(234, 179, 8, 0.25);
  color: #fff;
}

.quick-btn-group, .portal-jump-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-portal-jump {
  font-size: 11px;
  color: var(--text-dim);
  text-decoration: none;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.btn-portal-jump:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-color);
}

/* ============================================================
 * Master Container & Card
 * ============================================================ */
.accounting-container {
  max-width: 1440px;
  margin: 20px auto;
  padding: 0 20px 40px 20px;
}

.statement-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

/* Master Header Banner */
.statement-header {
  padding: 24px 28px 18px 28px;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(180deg, rgba(17, 28, 53, 0.7) 0%, rgba(12, 20, 39, 0.4) 100%);
}

.header-main-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.company-sub {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #60a5fa;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.statement-title {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.3px;
  margin-bottom: 6px;
}

.statement-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.statement-subtitle .sep {
  color: var(--text-dim);
}

.statement-subtitle strong {
  color: var(--text-main);
}

.header-stamp {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px dashed rgba(234, 179, 8, 0.45);
  background: rgba(234, 179, 8, 0.05);
  padding: 6px 14px;
  border-radius: 8px;
}

.stamp-icon {
  font-size: 20px;
}

.stamp-text {
  display: flex;
  flex-direction: column;
}

.stamp-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-gold);
}

.stamp-sub {
  font-size: 9px;
  color: #ca8a04;
  letter-spacing: 0.5px;
}

/* ============================================================
 * KPI Cards Grid
 * ============================================================ */
.kpi-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.kpi-card {
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-highlight);
}

.kpi-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.kpi-icon {
  font-size: 16px;
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.kpi-body {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 8px;
}

.kpi-cur {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-gold);
  font-family: var(--font-mono);
}

.kpi-num {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  font-family: var(--font-mono);
  letter-spacing: -0.5px;
}

.kpi-unit {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 2px;
}

.highlight-gold {
  color: var(--accent-gold) !important;
  text-shadow: 0 0 16px rgba(250, 204, 21, 0.25);
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.4;
}

.kpi-card-wage {
  border-color: rgba(234, 179, 8, 0.3);
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.08) 0%, var(--bg-card-sub) 100%);
}

.kpi-employer-splits {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.split-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
}

.split-name {
  color: var(--text-muted);
}

.split-val {
  font-weight: 700;
  font-family: var(--font-mono);
  color: #fff;
}

.split-hrs {
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* Empty / No Data Banner */
.nodata-banner {
  margin-top: 16px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px dashed rgba(59, 130, 246, 0.35);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.nodata-icon {
  font-size: 20px;
}

.nodata-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}

.nodata-text strong {
  color: #93c5fd;
}

.nodata-text span {
  color: var(--text-muted);
}

/* ============================================================
 * Table Section
 * ============================================================ */
.table-section {
  padding: 0;
  overflow: hidden;
}

.table-scroll-wrap {
  width: 100%;
  overflow-x: auto;
}

.accounting-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.accounting-table th,
.accounting-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}

.accounting-table th:last-child,
.accounting-table td:last-child {
  border-right: none;
}

/* Super & Sub Headers */
.accounting-table thead th {
  background: #0f182c;
  color: #cbd5e1;
  font-weight: 700;
  font-size: 11.5px;
  text-align: center;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-highlight);
  letter-spacing: 0.2px;
}

.col-group-hours {
  background: #14213d !important;
  color: #93c5fd !important;
  border-left: 1px solid var(--border-highlight);
  border-right: 1px solid var(--border-highlight);
}

.col-group-employer {
  background: #18233c !important;
  color: #c084fc !important;
  border-right: 1px solid var(--border-highlight);
}

.col-th-francis {
  color: #34d399 !important;
}

.col-wage {
  background: rgba(234, 179, 8, 0.08) !important;
  color: var(--accent-gold) !important;
}

/* Tbody Rows */
.accounting-table tbody tr {
  background: var(--bg-card);
  transition: background 0.12s ease;
}

.accounting-table tbody tr:nth-child(even) {
  background: rgba(15, 24, 44, 0.45);
}

.accounting-table tbody tr:hover {
  background: var(--bg-card-hover) !important;
}

.col-num {
  text-align: center !important;
  color: var(--text-dim);
  font-family: var(--font-mono);
  width: 44px;
}

.col-name {
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.emp-name-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}

.emp-icon {
  font-size: 14px;
}

.col-account {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
}

.col-mode {
  text-align: center !important;
  white-space: nowrap;
}

.badge-mode {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 600;
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.col-rate {
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-align: right !important;
  white-space: nowrap;
}

.col-days {
  text-align: center !important;
  font-family: var(--font-mono);
  font-weight: 600;
}

.col-sub-h, .col-hours-val {
  text-align: right !important;
  font-family: var(--font-mono);
  font-size: 12px;
}

.col-hours-val.total-h {
  font-weight: 700;
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.05);
}

.col-sub-emp, .col-emp-val {
  text-align: right !important;
  font-family: var(--font-mono);
  font-size: 12px;
}

.col-emp-val.francis {
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.05);
}

.col-wage-val {
  text-align: right !important;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 13px;
  color: var(--accent-gold);
  background: var(--accent-gold-bg);
  white-space: nowrap;
}

.col-status {
  text-align: center !important;
  white-space: nowrap;
}

.badge-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10.5px;
  font-weight: 600;
}

.badge-status.active {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-status.empty {
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

/* Tfoot Summary Row */
.accounting-table tfoot td {
  background: #111a2e;
  font-weight: 800;
  color: #fff;
  border-top: 2px solid var(--border-highlight);
  border-bottom: none;
  padding: 12px 14px;
}

.tfoot-label {
  text-align: right;
  font-size: 12px;
  letter-spacing: 0.5px;
  color: #cbd5e1;
}

.tfoot-val {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.tfoot-val.grand-wage {
  color: var(--accent-gold);
  font-size: 14px;
  background: var(--accent-gold-bg);
}

/* ============================================================
 * Master Footer / Audit Note
 * ============================================================ */
.statement-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: #091020;
  border-top: 1px solid var(--border-color);
  font-size: 11px;
  color: var(--text-dim);
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-right strong {
  color: var(--text-muted);
}

.footer-right .sep {
  margin: 0 6px;
  color: var(--text-dim);
}

/* ============================================================
 * Toast Notification
 * ============================================================ */
.accounting-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #334155;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  z-index: 1000;
  display: none;
  pointer-events: none;
  animation: toastFade 0.2s ease-out;
}

@keyframes toastFade {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ============================================================
 * Single Viewport Capture Mode (📸 一屏截屏模式)
 * Fits entire month accounting statement on one screen without scrolling
 * ============================================================ */
body.viewport-capture-mode {
  height: 100vh !important;
  max-height: 100vh !important;
  overflow: hidden !important;
}

body.viewport-capture-mode .accounting-app-wrapper {
  height: 100vh !important;
  display: flex;
  flex-direction: column;
}

body.viewport-capture-mode .accounting-top-bar {
  padding: 6px 16px !important;
}

body.viewport-capture-mode .accounting-container {
  margin: 6px auto !important;
  padding: 0 12px !important;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: 100%;
  width: 100%;
}

body.viewport-capture-mode .statement-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 8px;
}

body.viewport-capture-mode .statement-header {
  padding: 10px 14px 8px 14px !important;
}

body.viewport-capture-mode .header-main-row {
  margin-bottom: 8px !important;
}

body.viewport-capture-mode .statement-title {
  font-size: 16px !important;
  margin-bottom: 2px !important;
}

body.viewport-capture-mode .statement-subtitle {
  font-size: 10px !important;
}

body.viewport-capture-mode .kpi-cards-grid {
  gap: 8px !important;
}

body.viewport-capture-mode .kpi-card {
  padding: 8px 10px !important;
}

body.viewport-capture-mode .kpi-header {
  margin-bottom: 4px !important;
}

body.viewport-capture-mode .kpi-label {
  font-size: 10.5px !important;
}

body.viewport-capture-mode .kpi-num {
  font-size: 18px !important;
}

body.viewport-capture-mode .kpi-sub {
  font-size: 9.5px !important;
}

body.viewport-capture-mode .table-section {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.viewport-capture-mode .table-scroll-wrap {
  flex: 1;
  overflow: hidden;
}

body.viewport-capture-mode .accounting-table th,
body.viewport-capture-mode .accounting-table td {
  padding: 5px 8px !important;
  font-size: 10.5px !important;
}

body.viewport-capture-mode .statement-footer {
  padding: 6px 14px !important;
  font-size: 9.5px !important;
}

/* ============================================================
 * Print Media Styles
 * ============================================================ */
@media print {
  .accounting-top-bar, .accounting-toast {
    display: none !important;
  }
  body, html {
    background: #fff !important;
    color: #000 !important;
  }
  .statement-card {
    border: none !important;
    box-shadow: none !important;
    background: #fff !important;
  }
  .accounting-table th, .accounting-table td {
    color: #000 !important;
    border-color: #ddd !important;
  }
  .kpi-card {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
  }
  .kpi-num {
    color: #0f172a !important;
  }
  .highlight-gold {
    color: #b45309 !important;
    text-shadow: none !important;
  }
}

/* ============================================================
 * Mobile Phone Portrait Responsiveness (<= 768px)
 * ============================================================ */
@media (max-width: 768px) {
  .accounting-app-wrapper {
    padding: 8px 8px 24px 8px;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Top Bar */
  .accounting-top-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 10px 12px;
    gap: 10px;
    border-radius: 12px;
  }

  .bar-left {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 8px;
  }

  .sub-label,
  .divider-v {
    display: none;
  }

  .brand-logo {
    font-size: 20px;
  }

  .system-title {
    font-size: 12.5px;
    white-space: nowrap;
  }

  .accountant-meta .role-tag {
    display: none;
  }

  .bar-center {
    width: 100%;
    justify-content: center;
  }

  .month-pill-group {
    width: 100%;
    justify-content: space-between;
    padding: 4px 8px;
  }

  .current-month-text {
    font-size: 13px;
    white-space: nowrap;
  }

  .bar-right {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }

  .btn-capture-mode {
    width: 100%;
    justify-content: center;
    padding: 6px 10px;
    font-size: 11.5px;
  }

  .action-btn-group {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 6px;
  }

  .btn-tool {
    justify-content: center;
    padding: 6px 8px;
    font-size: 11px;
    white-space: nowrap;
  }

  /* Statement Card */
  .statement-card {
    padding: 12px;
    border-radius: 12px;
    gap: 12px;
  }

  .statement-header {
    padding: 12px;
    gap: 10px;
  }

  .header-main-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .header-stamp {
    align-self: flex-start;
  }

  .statement-title {
    font-size: 17px;
    line-height: 1.35;
    word-break: break-word;
  }

  .statement-subtitle {
    font-size: 11px;
    line-height: 1.6;
    gap: 4px;
  }

  .statement-subtitle .sep {
    display: none;
  }

  .statement-subtitle > span {
    display: inline-block;
    background: rgba(15, 23, 42, 0.6);
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 4px;
    margin-bottom: 4px;
  }

  /* KPI Cards Grid */
  .kpi-cards-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 0 12px;
  }

  .kpi-card {
    padding: 12px 14px;
  }

  .kpi-num {
    font-size: 22px;
  }

  /* Table */
  .table-section {
    padding: 0 12px 12px 12px;
  }

  .table-scroll-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    border-radius: 8px;
  }

  .accounting-table {
    min-width: 600px;
  }

  .accounting-table th,
  .accounting-table td {
    white-space: nowrap !important;
    padding: 6px 8px !important;
    font-size: 11px !important;
  }

  .statement-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 10px 12px;
    font-size: 10.5px;
  }
}

