:root {
  --bg: #eef3f9;
  --panel: #ffffff;
  --panel-border: #dbe4ef;
  --text: #162033;
  --muted: #66758a;
  --dark-card: #101a30;
  --dark-card-2: #16213c;
  --primary: #2d7ff9;
  --success: #16a34a;
  --danger: #dc2626;
  --neutral: #6b7280;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, #f6f9fc 0%, #edf3fa 100%);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

.page-shell {
  width: min(1360px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 108px;
}

.page-header,
.account-card,
.panel,
.kpi-card {
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.page-header,
.account-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  padding: 16px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 60px;
}

.page-header h1,
.section-title h2 {
  margin: 0;
  font-weight: 700;
}

.page-header p,
.section-title p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.header-title,
.header-status,
.header-meta {
  display: flex;
  align-items: center;
}

.header-title {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.header-status {
  gap: 16px;
}

.header-meta {
  flex-direction: column;
  align-items: flex-start;
  color: var(--muted);
  font-size: 13px;
}

.header-meta strong {
  color: var(--text);
  font-size: 14px;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #e7f0ff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
}

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

.btn-secondary {
  background: #eef4fb;
  color: var(--text);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.status-active {
  background: #e9f9ef;
  color: var(--success);
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge-light {
  background: #edf4ff;
  color: var(--primary);
}

.badge-editable {
  background: #ecfdf3;
  color: var(--success);
}

.badge-readonly {
  background: #f3f4f6;
  color: var(--neutral);
}

.account-card {
  margin-top: 16px;
  background: #fbfdff;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border-radius: 14px;
  background: #f3f7fc;
  border: 1px solid #e3ebf5;
}

.label {
  color: var(--muted);
  font-weight: 700;
}

.value {
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 260px;
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.kpi-column {
  display: grid;
  gap: 16px;
}

.kpi-card {
  padding: 16px;
  background: linear-gradient(180deg, var(--dark-card), var(--dark-card-2));
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.kpi-label {
  display: block;
  color: #9fb2d3;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.kpi-value {
  display: block;
  margin-top: 10px;
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
}

.negative {
  color: #ff7b7b;
}

.positive {
  color: #4ade80;
}

.record-list,
.result-stack {
  display: grid;
  gap: 16px;
}

.record-item {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  background: #f9fbfe;
}

.record-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.record-status {
  padding: 6px 10px;
  border-radius: 999px;
  background: #eaf2ff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.record-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.input-group input,
.input-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #d8e2ef;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.input-group textarea {
  resize: vertical;
  min-height: 88px;
}

.input-group.full {
  grid-column: 1 / -1;
}

.result-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: 14px;
  background: #f8fbff;
  border: 1px solid #e0e8f3;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 30px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.result-positive {
  background: #e9f9ef;
  color: var(--success);
}

.result-negative {
  background: #fdecec;
  color: var(--danger);
}

.result-neutral {
  background: #f1f3f5;
  color: var(--neutral);
}

.footer-action-bar {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: flex;
  gap: 12px;
  justify-content: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(219, 228, 239, 0.95);
  border-radius: 16px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(10px);
}

.footer-action-bar .btn-primary {
  min-width: 112px;
}

@media (max-width: 1120px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .kpi-column {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .account-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .page-shell {
    width: min(100% - 20px, 100%);
    padding-top: 20px;
  }

  .page-header,
  .section-title,
  .record-top,
  .header-status,
  .footer-action-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .account-grid,
  .record-grid,
  .kpi-column {
    grid-template-columns: 1fr;
  }

  .btn {
    width: 100%;
  }

  .kpi-value {
    font-size: 30px;
  }

  .footer-action-bar {
    left: 10px;
    right: 10px;
    bottom: 10px;
  }
}

/* Sheet comparison pages */

.sheet-body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f4f7fb;
  color: #172033;
}

.sheet-shell {
  width: min(1480px, calc(100% - 24px));
  margin: 0 auto;
  padding: 6px 0 12px;
}

.top-tool-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  padding: 4px 6px;
  background: #ffffff;
  border: 1px solid #d8e1ec;
  border-radius: 4px;
}

.top-tool-bar-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.top-tool-bar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.tool-nav-btn.is-active {
  background: #18264a;
  border-color: #223252;
  color: #fff;
}

.date-picker-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #475569;
}

.date-picker-wrap span {
  font-weight: 700;
}

.date-picker-wrap input {
  height: 28px;
  padding: 2px 8px;
  border: 1px solid #d5dfeb;
  border-radius: 4px;
  background: #fbfdff;
  color: #1f2937;
}

.tool-btn {
  height: 28px;
  padding: 0 10px;
  border: 1px solid #d5dfeb;
  border-radius: 4px;
  background: #f7faff;
  color: #334155;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.tool-link {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border: 1px solid #d5dfeb;
  border-radius: 4px;
  background: #f7faff;
  color: #334155;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}

button.tool-link,
button.tool-nav-btn {
  font-family: inherit;
  cursor: pointer;
}

.app-global-nav {
  width: min(1480px, calc(100% - 24px));
  margin: 0 auto 4px;
  flex-wrap: wrap;
  box-sizing: border-box;
}


.app-view[hidden] {
  display: none !important;
}

.tool-btn.active {
  background: #18264a;
  border-color: #223252;
  color: #fff;
}

.tool-panel-stack {
  display: grid;
  gap: 4px;
  margin-bottom: 4px;
}

.tool-panel {
  padding: 8px;
  background: #ffffff;
  border: 1px solid #d8e1ec;
  border-radius: 4px;
}

.standalone-shell {
  padding-top: 12px;
}

.standalone-header {
  margin-bottom: 6px;
  padding: 6px 8px;
  background: #ffffff;
  border: 1px solid #d8e1ec;
  border-radius: 4px;
}

.standalone-header h1 {
  margin: 0;
  font-size: 16px;
}

.report-page-title-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

.report-page-title-inner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

/* Match Website Database ▼: light border, grey chevron (not solid indigo) */
.report-pl-filter-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 16px;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  background: #f8fafc;
  font-size: 7px;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  flex-shrink: 0;
}

.report-pl-filter-toggle:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #334155;
}

.report-pl-filter-toggle[aria-expanded="true"] {
  background: #e0e7ff;
  border-color: #818cf8;
  color: #3730a3;
}

.report-pl-filter-popover {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 50;
  min-width: 112px;
  padding: 4px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.report-pl-filter-popover[hidden] {
  display: none !important;
}

.report-pl-filter-opt {
  display: block;
  width: 100%;
  padding: 6px 10px;
  border: none;
  border-radius: 4px;
  background: transparent;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
  color: #334155;
}

.report-pl-filter-opt:hover {
  background: #f1f5f9;
}

.report-pl-filter-opt.is-active {
  background: #e0e7ff;
  color: #1e3a8a;
  font-weight: 700;
}

.report-filter-empty {
  padding: 10px 8px;
  font-size: 12px;
  color: #64748b;
  text-align: center;
}

/* Report Daily: Total P/L filter in 2nd column header (was top banner) */
.report-daily-pl-th {
  text-align: left;
  vertical-align: bottom;
  min-width: 10.5rem;
}

.report-daily-pl-filter-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  text-align: left;
}

.report-daily-pl-filter-wrap .report-pl-filter-popover {
  left: 0;
  right: auto;
}

.report-daily-pl-title.report-page-title-inner {
  font-size: 11px;
  line-height: 1.3;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 4px;
  width: 100%;
}

.standalone-header p {
  margin: 2px 0 0;
  color: #64748b;
  font-size: 11px;
}

.standalone-panel {
  margin-top: 0;
}

.tool-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.tool-panel-head h2 {
  margin: 0;
  font-size: 13px;
}

.tool-panel-head span {
  font-size: 11px;
  color: #64748b;
}

.tool-metrics {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.tool-metric {
  min-width: 140px;
  padding: 6px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #f8fbff;
}

.tool-metric span {
  display: block;
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
}

.tool-metric strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
}

.mini-table th,
.mini-table td {
  padding: 6px 8px;
  border: 1px solid #e3e9f1;
  font-size: 11px;
  text-align: left;
}

.mini-table th {
  background: #eef4fb;
  color: #1f3555;
}

/* Site-wide mini-table: odd rows white, even light gray (Report / Bank / ID / Website / modals) */
.mini-table tbody tr:nth-child(odd) td {
  background-color: #ffffff;
}

.mini-table tbody tr:nth-child(even) td {
  background-color: #e9ecf2;
}

.wide-table {
  table-layout: fixed;
}

.summary-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  margin-bottom: 4px;
  padding: 4px 6px;
  background: #ffffff;
  border: 1px solid #d8e1ec;
  border-radius: 4px;
}

.summary-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  font-size: 11px;
  color: #475569;
}

.sheet-pc-picker {
  display: inline-flex;
  align-items: center;
  margin: 0;
  flex-shrink: 0;
}

.sheet-pc-select {
  min-width: 72px;
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  color: #0f172a;
  font-family: inherit;
  cursor: pointer;
}

.sheet-initial-bank-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  flex-shrink: 0;
  font-size: 11px;
  color: #475569;
}

.sheet-initial-bank-label span {
  white-space: nowrap;
}

.sheet-initial-bank-input {
  width: 92px;
  padding: 4px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  font-size: 11px;
  font-weight: 600;
  color: #0f172a;
}

.sheet-initial-bank-input.sheet-initial-bank-input--locked,
.sheet-initial-bank-input:read-only {
  background: #f1f5f9;
  color: #334155;
  cursor: not-allowed;
}

.sheet-pc-select:hover {
  border-color: #94a3b8;
}

.summary-profit {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 30px;
  padding: 4px 10px;
  background: #18264a;
  border-radius: 2px;
  color: #fff;
}

.summary-profit span {
  color: #d5def0;
  font-size: 10px;
  font-weight: 700;
}

.summary-profit strong {
  font-size: 14px;
}

.toggle-info-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 4px 8px;
  border: 1px solid #d5dfeb;
  border-radius: 4px;
  background: #f7faff;
  color: #334155;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.toggle-icon {
  font-size: 10px;
  line-height: 1;
}

.sheet-info {
  margin-bottom: 4px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #dfe7f0;
  border-radius: 4px;
  transition: max-height 0.2s ease, opacity 0.2s ease, margin 0.2s ease, padding 0.2s ease;
  overflow: hidden;
}

.info-row {
  display: grid;
  gap: 8px;
}

/* Account Info: 12 chips in 4×3 grid so one row doesn’t dominate */
.info-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.info-row + .info-row {
  margin-top: 4px;
}

.info-chip {
  min-height: 32px;
  padding: 3px 6px;
  background: #f9fbfd;
  border: 1px solid #e4ebf3;
  border-radius: 2px;
}

.info-chip span {
  display: block;
  margin-bottom: 2px;
  color: #7b8797;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.info-chip strong {
  font-size: 12px;
  font-weight: 700;
}

.sheet-info.is-collapsed {
  max-height: 0;
  opacity: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 4px;
}

.kpi-row-item {
  min-height: 36px;
  padding: 5px 8px;
  background: #18264a;
  border: 1px solid #223252;
  border-radius: 4px;
  color: #fff;
}

.kpi-row-item span {
  display: block;
  color: #b8c4df;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
}

.kpi-row-item strong {
  display: block;
  margin-top: 2px;
  font-size: 14px;
}

.sheet-table-wrap {
  margin-top: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.sheet-table-main {
  width: 100%;
  min-width: 1412px;
  border-collapse: collapse;
  table-layout: fixed;
}

.col-no {
  width: 38px;
}

.col-company {
  width: 168px;
}

.col-online {
  width: 88px;
}

.col-txn-status {
  width: 56px;
}

.sheet-online-duration {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.col-num,
.col-result {
  width: 72px;
}

.col-result-bank {
  width: 92px;
}

.col-short {
  width: 72px;
}

.col-transfer-end {
  width: 132px;
}

.col-remark {
  width: 128px;
}

.col-jp-ap {
  width: 72px;
}

.col-delete {
  width: 44px;
}

.col-delete-th {
  font-size: 11px;
  padding: 2px 2px !important;
}

.sheet-row-delete-td {
  padding: 2px !important;
  vertical-align: middle;
}

.sheet-table-main td.sheet-row-delete-td .sheet-row-delete-btn {
  box-sizing: border-box;
  min-width: 22px;
  height: 22px;
  padding: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid #fecaca;
  border-radius: 4px;
  background: #fff;
  color: #dc2626;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.sheet-table-main td.sheet-row-delete-td .sheet-row-delete-btn:hover {
  background: #fef2f2;
  border-color: #f87171;
  color: #b91c1c;
}

.sheet-table-main th,
.sheet-table-main td {
  padding: 2px 3px;
  border: 1px solid #e3e9f1;
  font-size: 11px;
  vertical-align: middle;
  word-break: normal;
  overflow-wrap: anywhere;
}

.sheet-table-main td.zone-note {
  word-break: break-word;
}

.sheet-table-main td.sheet-transfer-td {
  overflow: hidden;
  max-width: 0;
}

.sheet-inter-pc-transfer {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.sheet-transfer-amt-input {
  flex: 1 1 0;
  min-width: 0;
  max-width: none !important;
  text-align: right;
  box-sizing: border-box;
  padding: 2px 4px;
  font-size: 10px;
}

.sheet-transfer-pc-select {
  flex: 0 0 56px;
  width: 56px;
  min-width: 56px;
  max-width: 56px;
  padding: 2px 2px;
  font-size: 10px;
  font-weight: 600;
  box-sizing: border-box;
}

.sheet-table-main th {
  background: #dbe8f8;
  color: #183153;
  font-weight: 700;
}

/* Home sheet: odd/even zebra; zone columns slightly distinct */
.sheet-table-main tbody tr:nth-child(odd) td {
  background-color: #ffffff;
}

.sheet-table-main tbody tr:nth-child(even) td {
  background-color: #e9ecf2;
}

.sheet-table-main tbody tr:nth-child(odd) td.zone-input {
  background-color: #ffffff;
}

.sheet-table-main tbody tr:nth-child(even) td.zone-input {
  background-color: #e4e8ef;
}

.sheet-table-main tbody tr:nth-child(odd) td.zone-meta {
  background-color: #f8fafc;
}

.sheet-table-main tbody tr:nth-child(even) td.zone-meta {
  background-color: #dde2eb;
}

.sheet-table-main tbody tr:nth-child(odd) td.zone-process {
  background-color: #f5f7fa;
}

.sheet-table-main tbody tr:nth-child(even) td.zone-process {
  background-color: #d8dde6;
}

.sheet-table-main tbody tr:nth-child(odd) td.zone-result {
  background-color: #e8f5e4;
}

.sheet-table-main tbody tr:nth-child(even) td.zone-result {
  background-color: #d2e6cc;
}

.sheet-table-main tbody tr:nth-child(odd) td.zone-result.positive {
  background-color: #e0f2dc;
}

.sheet-table-main tbody tr:nth-child(even) td.zone-result.positive {
  background-color: #c8e0c0;
}

.sheet-table-main tbody tr:nth-child(odd) td.zone-result.negative {
  background-color: #fde8e8;
}

.sheet-table-main tbody tr:nth-child(even) td.zone-result.negative {
  background-color: #e8d4d4;
}

.sheet-table-main tbody tr:nth-child(odd) td.zone-note {
  background-color: #f7f6fa;
}

.sheet-table-main tbody tr:nth-child(even) td.zone-note {
  background-color: #e5e2ed;
}

.sheet-a .sheet-table-main td:first-child,
.sheet-b .sheet-table-main td:first-child,
.sheet-c .sheet-table-main td:first-child {
  font-weight: 700;
}

.align-left {
  text-align: left;
}

.align-center {
  text-align: center;
}

.align-right {
  text-align: right;
}

/* zone-* backgrounds merged into .sheet-table-main tbody zebra rules above */

.company-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: auto;
  min-width: 22px;
  padding: 2px 4px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.toggle-inline-icon {
  color: #64748b;
  font-size: 10px;
  transition: transform 0.2s ease;
}

.company-toggle[aria-expanded="true"] .toggle-inline-icon {
  transform: rotate(180deg);
}

.company-cell {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
}

.company-cell.company-cell-inline-title {
  flex-direction: row;
  align-items: center;
  min-width: 0;
}

.company-cell-top {
  display: flex;
  align-items: center;
  gap: 4px;
}

.company-cell-top-with-toggle {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.company-cell-top-with-toggle .sheet-field-company,
.company-cell-top-with-toggle .sheet-company-readonly {
  flex: 1 1 auto;
  min-width: 0;
}

.company-details-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: auto;
  min-width: 14px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.company-details-toggle .toggle-inline-icon {
  display: inline-block;
  color: #64748b;
  font-size: 7px;
  line-height: 1;
}

.sheet-round-toolbar-btns .sheet-add-row-toolbar-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
}

.company-credentials {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid #e8edf4;
  font-size: 10px;
  line-height: 1.35;
  color: #334155;
}

.company-cred-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
}

.company-cred-line-plain .company-cred-v {
  font-weight: 600;
}

.company-cred-k {
  font-weight: 700;
  color: #1e293b;
}

.company-cred-sep {
  margin-right: 2px;
}

.company-cred-v {
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-all;
}

.company-cred-editable .company-cred-display {
  flex: 1 1 auto;
  min-width: 0;
}

.company-cred-actions {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 4px;
}

.company-cred-actions .sheet-modal-btn {
  padding: 1px 6px;
  font-size: 10px;
  line-height: 1.3;
}

.company-cred-input {
  flex: 1 1 140px;
  min-width: 0;
  max-width: 100%;
  padding: 2px 6px;
  font-size: 11px;
}

.sheet-copy-btn {
  flex-shrink: 0;
  padding: 1px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  color: #334155;
  font-size: 10px;
  line-height: 1.3;
  cursor: pointer;
}

.sheet-copy-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.company-credentials--modal {
  font-size: 11px;
}

.sheet-table-main td.company-list-col-td {
  vertical-align: middle;
  overflow: hidden;
  max-width: 0;
}

.company-cell {
  width: 100%;
  min-width: 0;
}

.company-cell-top-with-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  min-width: 0;
}

.company-cell .sheet-field-company {
  flex: 1 1 auto;
  min-width: 0;
}

.company-popover {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 20;
  min-width: 180px;
  padding: 8px 10px;
  border: 1px solid #d6e0eb;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
  font-size: 11px;
  color: #475569;
}

.company-popover div + div {
  margin-top: 4px;
}

.company-popover strong {
  color: #1f2937;
}

.transfer-cell {
  position: relative;
  width: 100%;
  min-width: 0;
}

.transfer-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 10px;
  line-height: 1.2;
  cursor: pointer;
  text-align: left;
}

.transfer-toggle [data-field="transferTo"] {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transfer-toggle .toggle-inline-icon {
  flex-shrink: 0;
}

.transfer-popover {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 22;
  min-width: 220px;
  padding: 6px;
  border: 1px solid #d6e0eb;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.bank-option {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #1f2937;
  text-align: left;
  cursor: pointer;
}

.bank-option:hover {
  background: #f3f7fc;
}

.bank-option .bank-code {
  font-size: 11px;
  font-weight: 700;
}

.bank-option .bank-name {
  font-size: 10px;
  color: #64748b;
}

.result-table td {
  background: #eefdea;
}

.aux-table td {
  background: #fafcff;
}

.focus-panel {
  border-color: #93c5fd;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.08);
}

.muted-panel {
  opacity: 0.92;
}

.status-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.status-cell.done {
  background: #e7f8ec;
  color: #15803d;
}

.status-cell.pending {
  background: #fff1dc;
  color: #b45309;
}

.status-cell.hold {
  background: #eef2f7;
  color: #475569;
}

.compact-info .info-row {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.compact-head th,
.compact-head td,
.fast-table th,
.fast-table td {
  font-size: 12px;
}

.sheet-txn-status-td {
  vertical-align: middle;
  padding: 2px 4px !important;
}

.sheet-txn-status-select {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 2px 2px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 3px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  cursor: pointer;
  font-family: inherit;
  box-sizing: border-box;
}

.sheet-table-main tbody tr:nth-child(odd) td.sheet-txn-status-td.sheet-txn-status-success,
.sheet-table-main tbody tr:nth-child(even) td.sheet-txn-status-td.sheet-txn-status-success {
  background-color: #ccfbf1 !important;
}

.sheet-txn-status-td.sheet-txn-status-success .sheet-txn-status-select {
  background: #f0fdfa;
  color: #0f766e;
  border-color: #5eead4;
}

.sheet-table-main tbody tr:nth-child(odd) td.sheet-txn-status-td.sheet-txn-status-pending,
.sheet-table-main tbody tr:nth-child(even) td.sheet-txn-status-td.sheet-txn-status-pending {
  background-color: #dbeafe !important;
}

.sheet-txn-status-td.sheet-txn-status-pending .sheet-txn-status-select {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #93c5fd;
}

.sheet-table-main tbody tr:nth-child(odd) td.sheet-txn-status-td.sheet-txn-status-kencing,
.sheet-table-main tbody tr:nth-child(even) td.sheet-txn-status-td.sheet-txn-status-kencing {
  background-color: #fee2e2 !important;
}

.sheet-txn-status-td.sheet-txn-status-kencing .sheet-txn-status-select {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fca5a5;
}

@media (max-width: 1180px) {
  .info-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .info-row:not(.info-grid) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .sheet-shell {
    width: min(100% - 12px, 100%);
    padding-top: 12px;
  }

  .top-tool-bar,
  .summary-bar {
    flex-wrap: wrap;
    align-items: stretch;
  }

  .toggle-info-btn {
    margin-left: 0;
  }

  .info-row,
  .compact-info .info-row {
    grid-template-columns: 1fr;
  }

  /* Home KPI: 2 columns × 3 rows on phone (was 1 col — too tall) */
  .kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .kpi-row-item {
    min-height: 32px;
    padding: 4px 6px;
  }

  .kpi-row-item strong {
    font-size: 13px;
  }

  .sheet-bank-check {
    grid-template-columns: 1fr;
  }

  .tool-metrics {
    flex-direction: column;
  }

  /* —— Top nav: 2-column grid, full-width date row —— */
  .top-tool-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 8px;
  }

  .top-tool-bar-left {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .top-tool-bar-right {
    margin-left: 0;
    justify-content: space-between;
    flex-wrap: nowrap;
    width: 100%;
    padding-top: 4px;
    border-top: 1px solid #e8eef5;
  }

  .tool-link.tool-nav-btn {
    justify-content: center;
    min-height: 36px;
    font-size: 12px;
  }

  .date-picker-wrap {
    flex: 1;
    min-width: 0;
  }

  .date-picker-wrap input[type="date"] {
    max-width: 100%;
  }

  .auth-logout-btn {
    flex-shrink: 0;
  }

  /* —— Home: summary + round toolbar —— */
  .summary-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .sheet-round-toolbar-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: stretch;
  }

  .sheet-round-toolbar-btns .sheet-modal-btn,
  .sheet-round-toolbar-btns .sheet-save-round-btn,
  .sheet-round-toolbar-btns .sheet-round-history-btn {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    justify-content: center;
  }

  /* —— Website DB: horizontal scroll + readable column min widths —— */
  .website-db-table-scroll .website-db-table {
    min-width: 680px;
  }

  .website-db-table-scroll .website-db-th-website,
  .website-db-table-scroll td.website-db-website-cell {
    min-width: 200px;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .website-db-company-text {
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  /* —— Bank DB: one tall card per PC — PC header first, then sections (not a grid of boxes) —— */
  .bank-db-table-scroll {
    overflow-x: visible;
    border: none;
    background: transparent;
    padding-bottom: 8px;
  }

  #view-bank-database .bank-db-table {
    min-width: 0 !important;
    width: 100%;
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
  }

  #view-bank-database .bank-db-table thead {
    display: none;
  }

  #view-bank-database .bank-db-table tbody {
    display: block;
  }

  #view-bank-database .bank-db-table tbody tr {
    display: flex;
    flex-direction: column;
    margin-bottom: 18px;
    border: 1px solid #c9d4e3;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
  }

  #view-bank-database .bank-db-table tbody tr:nth-child(even) td {
    background: transparent !important;
  }

  /* Visual order: PC → bank identity → online → telco/misc → game → actions */
  #view-bank-database .bank-db-table tbody td:nth-child(9) {
    order: 1;
  }

  #view-bank-database .bank-db-table tbody td:nth-child(1) {
    order: 2;
  }

  #view-bank-database .bank-db-table tbody td:nth-child(2) {
    order: 3;
  }

  #view-bank-database .bank-db-table tbody td:nth-child(3) {
    order: 4;
  }

  #view-bank-database .bank-db-table tbody td:nth-child(4) {
    order: 5;
  }

  #view-bank-database .bank-db-table tbody td:nth-child(5) {
    order: 6;
  }

  #view-bank-database .bank-db-table tbody td:nth-child(6) {
    order: 7;
  }

  #view-bank-database .bank-db-table tbody td:nth-child(7) {
    order: 8;
  }

  #view-bank-database .bank-db-table tbody td:nth-child(8) {
    order: 9;
  }

  #view-bank-database .bank-db-table tbody td:nth-child(10) {
    order: 10;
  }

  #view-bank-database .bank-db-table tbody td:nth-child(11) {
    order: 11;
  }

  #view-bank-database .bank-db-table tbody td {
    display: block;
    width: 100% !important;
    max-width: none !important;
    padding: 12px 16px;
    border: none;
    border-bottom: 1px solid #e8edf4;
    box-sizing: border-box;
    white-space: normal !important;
    text-overflow: clip !important;
    font-size: 14px;
    line-height: 1.45;
    color: #0f172a;
  }

  /* PC: single clear title strip */
  #view-bank-database .bank-db-table tbody td:nth-child(9) {
    padding: 18px 16px !important;
    border-bottom: none;
    background: linear-gradient(165deg, #1a3058 0%, #18264a 100%);
    color: #fff;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.02em;
  }

  #view-bank-database .bank-db-table tbody td:nth-child(9)::before {
    content: "PC";
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.72);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
  }

  /* Bank / account block: light band */
  #view-bank-database .bank-db-table tbody td:nth-child(1),
  #view-bank-database .bank-db-table tbody td:nth-child(2),
  #view-bank-database .bank-db-table tbody td:nth-child(3),
  #view-bank-database .bank-db-table tbody td:nth-child(4) {
    background: #f7f9fc;
  }

  #view-bank-database .bank-db-table tbody td:nth-child(1) {
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }

  /* Section breaks (single column flow, not a grid) */
  #view-bank-database .bank-db-table tbody td:nth-child(5) {
    margin-top: 4px;
    padding-top: 16px;
    border-top: 1px dashed #cbd5e1;
    background: #fff;
  }

  #view-bank-database .bank-db-table tbody td:nth-child(7) {
    padding-top: 14px;
    border-top: 1px dashed #e2e8f0;
    background: #fff;
  }

  #view-bank-database .bank-db-table tbody td:nth-child(10) {
    padding-top: 14px;
    border-top: 1px dashed #e2e8f0;
    background: #fff;
  }

  #view-bank-database .bank-db-table tbody td:last-child {
    border-bottom: none;
  }

  #view-bank-database .bank-db-table tbody td::before {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: none;
    letter-spacing: 0;
    margin-bottom: 6px;
  }

  #view-bank-database .bank-db-table tbody td:nth-child(1)::before {
    content: "Bank";
  }

  #view-bank-database .bank-db-table tbody td:nth-child(2)::before {
    content: "Account name";
  }

  #view-bank-database .bank-db-table tbody td:nth-child(3)::before {
    content: "Account number";
  }

  #view-bank-database .bank-db-table tbody td:nth-child(4)::before {
    content: "Gmail";
  }

  #view-bank-database .bank-db-table tbody td:nth-child(5)::before {
    content: "User online";
  }

  #view-bank-database .bank-db-table tbody td:nth-child(6)::before {
    content: "Online pass";
  }

  #view-bank-database .bank-db-table tbody td:nth-child(7)::before {
    content: "TAC number";
  }

  #view-bank-database .bank-db-table tbody td:nth-child(8)::before {
    content: "Telco";
  }

  #view-bank-database .bank-db-table tbody td:nth-child(10)::before {
    content: "Game number";
  }

  #view-bank-database .bank-db-table tbody td:nth-child(11)::before {
    content: none;
    display: none !important;
  }

  #view-bank-database .bank-db-table thead th.bank-db-actions-th,
  #view-bank-database .bank-db-table tbody td.bank-db-actions-td {
    position: static !important;
    right: auto !important;
    box-shadow: none !important;
    text-align: left !important;
    background: #f1f5f9 !important;
    padding: 14px 16px !important;
  }

  #view-bank-database .bank-db-table tbody td.bank-db-actions-td .bank-db-delete-btn {
    width: 100%;
    min-height: 44px;
    font-size: 14px;
  }

  #view-bank-database .bank-db-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  #view-bank-database .bank-db-toolbar .sheet-modal-btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  /* —— ID Database: card rows —— */
  #view-all-id .all-id-table {
    width: 100%;
    table-layout: auto;
  }

  #view-all-id .all-id-table thead {
    display: none;
  }

  #view-all-id .all-id-table tbody {
    display: block;
  }

  #view-all-id .all-id-table tbody tr {
    display: block;
    margin-bottom: 12px;
    border: 1px solid #d8e1ec;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  }

  #view-all-id .all-id-table tbody tr:nth-child(even) td {
    background: transparent !important;
  }

  #view-all-id .all-id-table tbody td {
    display: block;
    width: 100% !important;
    padding: 10px 12px;
    border: none;
    border-bottom: 1px solid #eef2f7;
    box-sizing: border-box;
  }

  #view-all-id .all-id-table tbody td:last-child {
    border-bottom: none;
  }

  #view-all-id .all-id-table tbody td::before {
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 6px;
  }

  #view-all-id .all-id-table tbody td:nth-child(1)::before {
    content: "PC";
  }

  #view-all-id .all-id-table tbody td:nth-child(2)::before {
    content: "Website";
  }

  #view-all-id .all-id-table tbody td:nth-child(3)::before {
    content: "Report (Total P/L)";
  }

  #view-all-id .all-id-table tbody td:nth-child(4)::before {
    content: "Activity";
  }

  #view-all-id .all-id-toolbar-top {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  #view-all-id .all-id-toolbar-actions {
    flex-direction: column;
    align-items: stretch;
  }

  #view-all-id .all-id-date-range {
    flex-wrap: wrap;
  }

  /* —— Website DB toolbar —— */
  #view-website-database .website-db-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  #view-website-database .website-db-toolbar-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  #view-website-database .website-db-toolbar .sheet-modal-btn {
    width: 100%;
    justify-content: center;
  }

  /* —— Sheet main table: clearer scroll area —— */
  .sheet-table-wrap {
    border-radius: 8px;
    border: 1px solid #e3e9f1;
    background: #fafbfd;
  }
}

.report-period-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.report-tab {
  padding: 6px 12px;
  border: 1px solid #d5dfeb;
  border-radius: 4px;
  background: #f7faff;
  color: #334155;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.report-tab.is-active {
  background: #18264a;
  border-color: #223252;
  color: #fff;
}

.report-inline-picker {
  margin-left: auto;
}

.report-hint {
  margin: 0 0 8px;
  font-size: 10px;
  color: #64748b;
}

.report-profit-btn,
.report-drill-pc-btn,
.report-drill-year-month-btn,
.website-db-report-drill-btn {
  padding: 2px 8px;
  border: 1px dashed #cbd5e1;
  border-radius: 4px;
  background: #f8fafc;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.report-profit-btn.positive,
.report-drill-pc-btn.positive,
.report-drill-year-month-btn.positive,
.website-db-report-drill-btn.positive {
  color: #15803d;
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.report-profit-btn.negative,
.report-drill-pc-btn.negative,
.report-drill-year-month-btn.negative,
.website-db-report-drill-btn.negative {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fef2f2;
}

.report-detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(15, 23, 42, 0.35);
}

#report-drill-backdrop {
  z-index: 42;
}

.report-drill-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.report-drill-head h3 {
  flex: 1;
  margin: 0;
  min-width: 0;
}

.report-drill-back {
  flex-shrink: 0;
  padding: 2px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #f8fafc;
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
  color: #334155;
}

.report-drill-empty {
  color: #94a3b8;
}

.report-detail-sheet {
  position: fixed;
  z-index: 41;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(96vw, 720px);
  max-height: min(80vh, 560px);
  overflow: auto;
  padding: 12px 14px;
  border: 1px solid #d8e1ec;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  isolation: isolate;
}

.report-detail-sheet.report-drill-sheet {
  z-index: 43;
}

.report-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.report-detail-head h3 {
  margin: 0;
  font-size: 14px;
}

.report-detail-close {
  padding: 0 6px;
  border: 0;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
}

.report-detail-sub {
  margin: 0 0 8px;
  font-size: 11px;
  color: #64748b;
}

.report-detail-table th.align-right,
.report-detail-table td.align-right {
  text-align: right;
}

.report-pl-to-sheet {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  color: inherit;
}

.report-pl-to-sheet.positive {
  color: #15803d;
}

.report-pl-to-sheet.negative {
  color: #b91c1c;
}

.sheet-row-focus {
  outline: 2px solid #3b82f6;
  background: #eff6ff;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.25);
}

.all-id-toolbar {
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.all-id-toolbar-top {
  justify-content: space-between;
  gap: 12px;
}

.all-id-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

.all-id-date-range {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #475569;
}

.all-id-date-range input[type="date"] {
  padding: 5px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font: inherit;
  font-size: 12px;
  background: #fff;
}

.all-id-date-sep {
  color: #94a3b8;
}

.all-id-pc-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #475569;
}

.all-id-pc-filter select {
  min-width: 120px;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-size: 12px;
}

.all-id-table {
  table-layout: fixed;
  width: 100%;
}

.all-id-col-pc {
  width: 3.2rem;
}

.all-id-col-web {
  width: 40%;
  min-width: 0;
}

.all-id-col-profit {
  width: 12.5rem;
  min-width: 10rem;
}

.all-id-col-activity {
  width: auto;
  min-width: 0;
}

.all-id-website-cell {
  vertical-align: middle;
  font-size: 11px;
}

.all-id-website-line {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
  min-width: 0;
}

.all-id-company-name {
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-word;
}

.all-id-detail-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 3px;
  background: #f8fafc;
  font-size: 7px;
  line-height: 1;
  cursor: pointer;
  color: #64748b;
}

.all-id-detail-btn:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: #334155;
}

.all-id-detail-arrow {
  font-size: 7px;
  line-height: 1;
  pointer-events: none;
}

.all-id-th-profit {
  text-align: left;
  white-space: nowrap;
  vertical-align: bottom;
}

/* Same ▼ P/L filter pattern as Report; popover under left-aligned title */
.all-id-profit-filter-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  text-align: left;
}

.all-id-profit-filter-wrap .report-pl-filter-popover {
  left: 0;
  right: auto;
}

.all-id-th-profit-title.report-page-title-inner {
  font-size: 11px;
  line-height: 1.3;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 4px;
  width: 100%;
  max-width: 100%;
}

.all-id-th-profit-title.report-page-title-inner > span {
  text-align: left;
}

.all-id-table .all-id-profit-td {
  vertical-align: middle;
  text-align: right;
}

.all-id-table thead th:nth-child(3) {
  text-align: left;
}

/* Same pill / dashed / underline as Report daily P/L (report-profit-btn) */
.all-id-table .all-id-profit-td .report-profit-btn.all-id-profit-drill {
  display: inline-block;
  width: auto;
  max-width: 100%;
  text-align: center;
}

#all-id-profit-backdrop {
  z-index: 46;
}

#all-id-profit-sheet {
  z-index: 47;
  width: min(96vw, 640px);
}

#all-id-profit-backdrop[hidden],
#all-id-profit-sheet[hidden] {
  display: none !important;
}

.all-id-activity-cell {
  font-size: 9px;
  line-height: 1.35;
  vertical-align: middle;
  padding-right: 8px !important;
  overflow-x: auto;
  max-width: 100%;
}

.all-id-activity-line {
  display: block;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.all-id-activity-sep {
  color: #94a3b8;
  font-weight: 400;
}

.all-id-activity-k {
  color: #64748b;
  font-weight: 600;
  margin-right: 2px;
}

.all-id-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(15, 23, 42, 0.35);
}

.all-id-modal {
  position: fixed;
  z-index: 51;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 400px);
  padding: 14px 16px;
  border: 1px solid #d8e1ec;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  isolation: isolate;
}

.all-id-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
}

.all-id-modal-head h3 {
  margin: 0;
  font-size: 14px;
}

.all-id-modal-close {
  padding: 0 6px;
  border: 0;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #64748b;
}

.all-id-modal-body {
  margin: 0;
}

.all-id-modal-cred-card {
  font-size: 11px;
}

.all-id-empty {
  text-align: center;
  color: #64748b;
  padding: 16px 8px;
  font-size: 12px;
}

/* —— Bank Database —— */
.bank-db-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* Horizontal scroll + sticky Actions column so Delete stays visible */
.bank-db-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #e3e9f1;
  border-radius: 4px;
  background: #fff;
}

.bank-db-table {
  min-width: 1040px;
  width: 100%;
  table-layout: fixed;
}

.bank-db-table col.bank-db-col-bank {
  width: 4.5%;
}
.bank-db-table col.bank-db-col-name {
  width: 11%;
}
.bank-db-table col.bank-db-col-account {
  width: 9%;
}
.bank-db-table col.bank-db-col-gmail {
  width: 14%;
}
.bank-db-table col.bank-db-col-online {
  width: 9%;
}
.bank-db-table col.bank-db-col-pass {
  width: 8%;
}
.bank-db-table col.bank-db-col-tac {
  width: 8%;
}
.bank-db-table col.bank-db-col-telco {
  width: 7%;
}
.bank-db-table col.bank-db-col-pc {
  width: 5%;
}
.bank-db-table col.bank-db-col-game {
  width: 7%;
}
.bank-db-table col.bank-db-col-actions {
  width: 88px;
}

.bank-db-table .bank-db-cell {
  overflow: hidden;
  vertical-align: top;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.bank-db-table .bank-db-cell-bank,
.bank-db-table .bank-db-cell-pc,
.bank-db-table .bank-db-cell-game {
  white-space: nowrap;
  text-overflow: ellipsis;
}

.bank-db-table .bank-db-cell-gmail,
.bank-db-table .bank-db-cell-online,
.bank-db-table .bank-db-cell-account {
  white-space: nowrap;
  text-overflow: ellipsis;
}

.bank-db-actions-th,
.bank-db-actions-td {
  width: 88px;
  min-width: 88px;
  max-width: 88px;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

.bank-db-table thead th.bank-db-actions-th {
  position: sticky;
  right: 0;
  z-index: 3;
  background: #eef4fb;
  box-shadow: -6px 0 10px rgba(15, 23, 42, 0.06);
}

.bank-db-table tbody td.bank-db-actions-td {
  position: sticky;
  right: 0;
  z-index: 2;
  padding: 6px 8px;
  box-shadow: -6px 0 10px rgba(15, 23, 42, 0.06);
}

.bank-db-table tbody tr:nth-child(odd) td.bank-db-actions-td {
  background-color: #ffffff;
}

.bank-db-table tbody tr:nth-child(even) td.bank-db-actions-td {
  background-color: #e9ecf2;
}

.bank-db-table .bank-db-delete-btn {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
}

/* —— Website Database —— */
.website-db-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.website-db-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.website-db-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #e3e9f1;
  border-radius: 4px;
  background: #fff;
}

.website-db-table {
  font-size: 11px;
}

/* Fixed column widths: avoid Website column swallowing middle space and pushing Report to the far right */
.website-db-table col.website-db-col-no {
  width: 32px;
}
.website-db-table col.website-db-col-group {
  width: 96px;
}
.website-db-table col.website-db-col-website {
  width: 34%;
}
.website-db-table col.website-db-col-status {
  width: 48px;
}
.website-db-table col.website-db-col-report {
  width: 168px;
}
.website-db-table col.website-db-col-actions {
  width: 140px;
}

.website-db-table th,
.website-db-table td {
  padding: 3px 6px;
  vertical-align: top;
}

/* Header cells slightly taller than body so headers don’t look flatter than data cells */
.website-db-table thead th {
  font-size: 13px;
  line-height: 1.35;
  padding: 8px 8px;
  vertical-align: middle;
}

.website-db-table td.website-db-actions {
  vertical-align: middle;
}

.website-db-th-no {
  width: 32px;
  min-width: 30px;
  max-width: 36px;
  text-align: center !important;
  font-weight: 700;
  padding-left: 2px !important;
  padding-right: 2px !important;
  box-sizing: border-box;
}

.website-db-no {
  color: #1f3555;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center !important;
  vertical-align: middle;
  padding-left: 2px !important;
  padding-right: 2px !important;
  width: 32px;
  max-width: 36px;
  box-sizing: border-box;
}

.website-db-th-group {
  min-width: 96px;
  white-space: nowrap;
}

.website-db-th-website {
  min-width: 160px;
}

.website-db-th-status {
  width: 48px;
  min-width: 48px;
}

.website-db-th-report {
  min-width: 120px;
  white-space: nowrap;
  text-align: left;
}

.website-db-report-th {
  position: relative;
  vertical-align: middle;
}

.website-db-report-th-inner {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  width: auto;
  max-width: 100%;
  flex-wrap: wrap;
}

.website-db-report-th-text {
  font-weight: 700;
}

.website-db-report-filter-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 16px;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  background: #f8fafc;
  font-size: 7px;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
}

.website-db-report-filter-toggle:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #334155;
}

.website-db-report-filter-toggle[aria-expanded="true"] {
  background: #e0e7ff;
  border-color: #818cf8;
  color: #3730a3;
}

.website-db-report-filter-popover {
  position: absolute;
  left: 0;
  right: auto;
  top: calc(100% + 4px);
  z-index: 40;
  min-width: 112px;
  padding: 4px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Must override display:flex above or [hidden] won’t hide (second ▼ click won’t close) */
.website-db-report-filter-popover[hidden] {
  display: none !important;
}

.website-db-report-filter-opt {
  display: block;
  width: 100%;
  padding: 6px 10px;
  border: none;
  border-radius: 4px;
  background: transparent;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
  color: #334155;
}

.website-db-report-filter-opt:hover {
  background: #f1f5f9;
}

.website-db-report-filter-opt.is-active {
  background: #e0e7ff;
  color: #1e3a8a;
  font-weight: 700;
}

.website-db-th-actions {
  width: 140px;
}

.website-db-website-cell {
  vertical-align: middle;
}

.website-db-company-text {
  font-weight: 600;
  color: #0f172a;
  word-break: break-word;
}

.website-db-actions {
  white-space: nowrap;
  vertical-align: middle;
}

.website-db-actions .sheet-modal-btn {
  padding: 4px 8px;
  font-size: 10px;
  margin-right: 4px;
}

.website-db-empty {
  text-align: center;
  color: #64748b;
  padding: 16px;
  font-size: 12px;
}

.website-db-status-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
}

.website-db-status-cell {
  text-align: center;
  vertical-align: middle !important;
}

.website-db-status-eye {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 22px;
  height: 20px;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  color: #475569;
  cursor: pointer;
}

.website-db-status-eye:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}

.website-db-eye-icon {
  display: block;
  pointer-events: none;
}

.website-db-status-modal-body {
  flex: 1 1 auto;
  min-height: 200px;
  max-height: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0 2px;
}

.website-db-status-detail {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 0;
}

.website-db-status-tabs {
  display: flex;
  flex-shrink: 0;
  gap: 0;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 6px 6px 0 0;
}

.website-db-status-tab {
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 8px;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1.25;
}

.website-db-status-tab:hover {
  color: #334155;
  background: rgba(255, 255, 255, 0.6);
}

.website-db-status-tab.is-active {
  color: #1e3a8a;
  background: #fff;
  border-bottom-color: #2563eb;
}

.website-db-status-count {
  font-weight: 600;
  color: #94a3b8;
}

.website-db-status-tab.is-active .website-db-status-count {
  color: #64748b;
}

.website-db-status-panels {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fafbfc;
  border: 1px solid #e8edf4;
  border-top: none;
  border-radius: 0 0 6px 6px;
}

.website-db-status-panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px;
  display: none;
}

.website-db-status-panel.is-active {
  display: block;
}

.website-db-status-id-list {
  margin: 0;
  padding: 0 0 0 2px;
  list-style: none;
}

.website-db-status-id-line {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 5px 8px;
  margin-bottom: 4px;
  background: #fff;
  border: 1px solid #e8edf4;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.4;
  word-break: break-all;
}

.website-db-status-id-line:last-child {
  margin-bottom: 0;
}

.website-db-status-pc {
  flex-shrink: 0;
  font-weight: 700;
  color: #1e40af;
  font-variant-numeric: tabular-nums;
}

.website-db-status-sep {
  flex-shrink: 0;
  color: #94a3b8;
}

.website-db-status-idtxt {
  flex: 1 1 auto;
  min-width: 0;
  color: #0f172a;
  font-weight: 600;
}

.website-db-status-empty {
  margin: 8px 0 0;
  padding: 8px;
}

.website-db-status-hint {
  flex-shrink: 0;
  margin: 8px 4px 0;
  padding-top: 6px;
  border-top: 1px solid #f1f5f9;
  font-size: 10px;
  color: #94a3b8;
  line-height: 1.45;
}

.website-db-muted {
  color: #94a3b8;
}

.website-db-report-cell {
  white-space: nowrap;
}

.website-db-form-modal h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.website-db-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.website-db-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #334155;
}

.website-db-field span:first-child {
  font-weight: 600;
  color: #1e293b;
}

.website-db-field input,
.website-db-field select {
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 12px;
}

.website-db-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 520px) {
  .website-db-field-row {
    grid-template-columns: 1fr;
  }
}

.website-db-form-actions {
  margin-top: 4px;
}

#website-db-form-backdrop {
  z-index: 72;
}

#website-db-form-modal {
  z-index: 73;
  max-height: min(90vh, 620px);
  overflow: auto;
}

#website-db-form-backdrop[hidden],
#website-db-form-modal[hidden] {
  display: none !important;
}

#website-db-status-backdrop {
  z-index: 74;
}

#website-db-status-modal {
  z-index: 75;
  width: min(92vw, 480px);
  max-height: min(88vh, 600px);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
}

#website-db-status-modal .sheet-post-save-head {
  flex-shrink: 0;
}

#website-db-status-modal .sheet-modal-actions {
  flex-shrink: 0;
  margin-top: 8px;
}

#website-db-status-backdrop[hidden],
#website-db-status-modal[hidden] {
  display: none !important;
}

.sheet-round-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 8px 0 6px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

.sheet-save-round-btn {
  padding: 6px 14px;
  border: 1px solid #1e3a5f;
  border-radius: 6px;
  background: #18264a;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.sheet-save-round-btn:hover {
  background: #223252;
}

.sheet-round-toolbar-btns {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.sheet-round-history-btn {
  padding: 6px 14px;
  border: 1px solid #334155;
  border-radius: 6px;
  background: #fff;
  color: #1e293b;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.sheet-round-history-btn:hover {
  background: #f1f5f9;
}

.sheet-field-input {
  width: 100%;
  max-width: 140px;
  padding: 2px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  font-size: 11px;
  font-family: inherit;
  background: #fff;
}

.sheet-field-input.sheet-field-company {
  max-width: 100%;
  text-overflow: ellipsis;
}

.sheet-remark-td {
  position: relative;
  vertical-align: middle;
  overflow: visible;
}

.sheet-remark-inner {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.sheet-field-input.sheet-field-remark {
  flex: 1 1 0;
  min-width: 0;
  max-width: none;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-remark-full-btn {
  flex: 0 0 auto;
  padding: 0 3px;
  min-width: 18px;
  height: 20px;
  font-size: 11px;
  line-height: 1;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
}

.sheet-remark-full-btn:hover {
  background: #e2e8f0;
}

.sheet-remark-full-popover {
  position: fixed;
  z-index: 200;
  margin: 0;
  min-width: min(280px, 90vw);
  max-width: min(400px, 92vw);
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.45;
  color: #0f172a;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
  white-space: pre-wrap;
  word-break: break-word;
}

.sheet-field-num {
  max-width: 72px;
  text-align: right;
}

.sheet-field-kencing {
  max-width: 64px;
}

.sheet-company-readonly {
  font-size: 10px;
  font-weight: 600;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.25;
}

.sheet-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 23, 42, 0.4);
}

.sheet-modal {
  position: fixed;
  z-index: 61;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 420px);
  padding: 16px 18px;
  border: 1px solid #d8e1ec;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.2);
}

.sheet-modal-wide {
  width: min(96vw, 640px);
}

.sheet-modal h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.sheet-post-save-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.sheet-post-save-head h3 {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 15px;
}

.sheet-modal-x-close {
  flex-shrink: 0;
  padding: 0 4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #64748b;
}

.sheet-modal-x-close:hover {
  color: #0f172a;
  background: #f1f5f9;
}

.sheet-modal-msg,
.sheet-modal-sub {
  margin: 0 0 12px;
  font-size: 12px;
  color: #475569;
  line-height: 1.45;
}

.sheet-bank-check {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}

.sheet-bank-check-item {
  padding: 10px 12px;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  background: #f8fbff;
}

.sheet-bank-check-item span {
  display: block;
  margin-bottom: 4px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.sheet-bank-check-item strong {
  display: block;
  color: #18264a;
  font-size: 18px;
  line-height: 1.1;
}

.sheet-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.sheet-modal-btn {
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  font-size: 12px;
  cursor: pointer;
  color: #334155;
}

.sheet-modal-btn.primary {
  background: #18264a;
  border-color: #223252;
  color: #fff;
}

.sheet-modal-btn.primary:hover {
  background: #223252;
}

/* Next-round adjust modal: fill viewport, less scroll; actions pinned to bottom */
.sheet-adjust-modal {
  display: flex;
  flex-direction: column;
  width: min(98vw, 1280px);
  max-width: 1280px;
  max-height: 98vh;
  overflow-x: hidden;
  overflow-y: hidden;
  isolation: isolate;
}

#sheet-adjust-modal[hidden],
#sheet-adjust-backdrop[hidden] {
  display: none !important;
}

.sheet-adjust-modal .sheet-adjust-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(100vh - 140px);
  overflow: auto;
  margin: 6px 0;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 4px;
  background: #f8fafc;
}

.sheet-adjust-modal .sheet-modal-actions {
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  margin-top: 4px;
}

.sheet-adjust-modal h3 {
  margin: 0 0 4px;
  flex-shrink: 0;
}

.sheet-adjust-modal .sheet-modal-sub {
  margin: 0 0 6px;
  flex-shrink: 0;
}

.sheet-bank-check-inline {
  margin-bottom: 10px;
  flex-shrink: 0;
}

.sheet-adjust-table {
  margin: 0;
  font-size: 11px;
}

.sheet-adjust-inp {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 11px;
}

.sheet-adjust-th-company {
  min-width: 320px;
  vertical-align: middle;
}

.sheet-adjust-th-label {
  display: inline;
  margin-right: 8px;
  font-weight: 700;
}

.sheet-adjust-add-wd {
  padding: 4px 10px;
  font-size: 10px;
  vertical-align: middle;
}

.sheet-adjust-th-clear {
  width: 72px;
  text-align: center;
  white-space: nowrap;
}

.sheet-adjust-clear-td {
  text-align: center;
  vertical-align: middle;
  width: 72px;
}

.sheet-adjust-clear-btn {
  padding: 4px 8px;
  font-size: 10px;
  white-space: nowrap;
}

.sheet-adjust-table td:nth-child(2) .sheet-adjust-inp {
  max-width: none;
}

#company-details-backdrop {
  z-index: 70;
}

#company-details-modal {
  z-index: 71;
  width: min(92vw, 380px);
}

#company-details-backdrop[hidden],
#company-details-modal[hidden] {
  display: none !important;
}

.company-details-modal-body {
  margin: 0;
  max-height: min(70vh, 440px);
  overflow: auto;
}

#sheet-round-history-backdrop {
  z-index: 62;
}

/* .sheet-round-history-modal uses flex and overrides [hidden]; force hide when closed */
#sheet-round-history-backdrop[hidden],
#sheet-round-history-modal[hidden] {
  display: none !important;
}

.sheet-round-history-modal {
  z-index: 63;
  width: min(98vw, 1100px);
  max-height: min(90vh, 900px);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  isolation: isolate;
}

.sheet-round-history-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 12px;
  color: #334155;
}

.sheet-round-history-select {
  min-width: 220px;
  max-width: 100%;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12px;
  background: #fff;
}

.sheet-round-history-modal .sheet-round-history-table-wrap {
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(58vh, 560px);
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 4px;
  background: #f8fafc;
  position: relative;
  z-index: 0;
}

.sheet-round-history-modal .sheet-modal-actions {
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.sheet-round-history-table {
  width: max-content;
  min-width: 100%;
  font-size: 10px;
}

.sheet-round-history-table th,
.sheet-round-history-table td {
  white-space: nowrap;
  padding: 4px 6px;
}

.sheet-round-history-table td.company-list-cell-td {
  white-space: normal;
  vertical-align: top;
  min-width: 200px;
  max-width: 280px;
}

/* —— Access roles: main (default) / agent / visitor —— */
.access-share-wrap {
  position: relative;
}

.access-share-toggle {
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #1e3a5f;
  cursor: pointer;
}

.access-share-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 300;
  min-width: min(360px, 92vw);
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #dbe4ef;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.access-share-hint {
  margin: 0 0 10px;
  font-size: 11px;
  color: #64748b;
  line-height: 1.4;
}

.access-share-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #1e293b;
  margin-top: 8px;
}

.access-share-sub {
  font-weight: 500;
  color: #64748b;
}

.access-share-row {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  align-items: center;
}

.access-share-input {
  flex: 1;
  min-width: 0;
  font-size: 10px;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
}

.visitor-scope-banner {
  margin: 0 0 10px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #1e3a8a;
  background: #e0e7ff;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
}

.sheet-readonly-val {
  display: inline-block;
  min-height: 18px;
  font-size: 11px;
  padding: 2px 4px;
  color: #1e293b;
}

.sheet-txn-readonly {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  font-weight: 700;
  font-size: 11px;
}

.sheet-readonly-transfer {
  gap: 6px;
}

body[data-access-role="agent"] .summary-profit,
body[data-access-role="agent"] .kpi-agent-hide,
body[data-access-role="agent"] th.col-pl,
body[data-access-role="agent"] td.col-pl {
  display: none !important;
}

body[data-access-role="visitor"] .access-hide-visitor {
  display: none !important;
}

body[data-access-role="agent"] .access-hide-agent {
  display: none !important;
}

body[data-access-role="visitor"] .summary-left [data-summary-bank],
body[data-access-role="visitor"] .summary-left [data-summary-account],
body[data-access-role="visitor"] .sheet-initial-bank-label,
body[data-access-role="visitor"] .toggle-info-btn {
  display: none !important;
}

/* Visitor Home: only PC × P/L summary — hide full sheet UI */
.visitor-pc-pl-panel {
  display: none;
  max-width: 520px;
  padding: 8px 0 20px;
}

body[data-access-role="visitor"] .visitor-hide-detail {
  display: none !important;
}

body[data-access-role="visitor"] .visitor-pc-pl-panel {
  display: block;
}

.visitor-pc-pl-title {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.visitor-pc-pl-meta {
  margin: 0 0 12px;
  font-size: 12px;
  color: #64748b;
}

.visitor-pc-pl-table {
  max-width: 360px;
}

/* —— Login / owner gate —— */
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(180deg, #e8eef6 0%, #d8e4f2 100%);
}

.auth-screen[hidden] {
  display: none !important;
}

.auth-card {
  width: min(420px, 100%);
  padding: 28px 24px 24px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.auth-title {
  margin: 0 0 8px;
  font-size: 1.35rem;
  text-align: center;
}

.auth-lead {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}

.auth-field input {
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  padding: 4px;
  background: #f1f5f9;
  border-radius: 10px;
}

.auth-tab {
  flex: 1;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
}

.auth-tab.is-active {
  background: #fff;
  color: #1e3a5f;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.auth-panel {
  margin-top: 4px;
}

.auth-submit {
  width: 100%;
  margin-top: 8px;
  padding: 10px 14px;
}

.auth-error {
  margin: 14px 0 0;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
}

.auth-logout-btn {
  margin-left: 8px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #475569;
  cursor: pointer;
}

.auth-logout-btn:hover {
  background: #f8fafc;
}

.access-accounts-block {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
}

.access-accounts-block:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.access-accounts-heading {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
}

.access-add-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}

.access-add-row .access-add-id {
  flex: 1 1 100px;
  min-width: 0;
}

.access-add-row .access-add-pw {
  flex: 1 1 100px;
  min-width: 0;
}

.access-accounts-list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 160px;
  overflow: auto;
}

.access-account-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  font-size: 11px;
  border-bottom: 1px solid #f1f5f9;
}

.access-account-line:last-child {
  border-bottom: none;
}

.access-account-id {
  font-weight: 600;
  color: #0f172a;
  word-break: break-all;
}

.access-account-remove {
  flex-shrink: 0;
  padding: 4px 8px;
  font-size: 10px;
}

/* —— Management page (owner) —— standard admin layout */
#view-management {
  background: linear-gradient(180deg, #eef2f6 0%, #f8fafc 48%);
  min-height: calc(100vh - 56px);
}

#view-management .management-page-shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 20px 56px;
}

.management-page-intro {
  margin-bottom: 28px;
}

.management-page-title {
  margin: 0 0 10px;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.management-page-lead {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: #64748b;
}

.management-page-lead strong {
  color: #334155;
  font-weight: 600;
}

.management-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.management-create-card {
  padding: 28px 28px 26px;
  margin-bottom: 36px;
}

.management-card-title {
  margin: 0 0 8px;
  font-size: 1.125rem;
  font-weight: 700;
  color: #0f172a;
}

.management-card-desc {
  margin: 0 0 24px;
  font-size: 13px;
  line-height: 1.55;
  color: #64748b;
}

.management-form-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 20px;
}

.management-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}

.management-field-label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.management-optional {
  font-weight: 500;
  color: #94a3b8;
}

.management-input,
.management-select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.management-input:hover,
.management-select:hover {
  border-color: #94a3b8;
}

.management-input:focus,
.management-select:focus {
  outline: none;
  border-color: #2d7ff9;
  box-shadow: 0 0 0 3px rgba(45, 127, 249, 0.15);
}

.management-field-hint {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.4;
}

.management-role-legend {
  margin-bottom: 24px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.management-role-legend-title {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.management-role-legend-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.55;
  color: #475569;
}

.management-role-legend-list li {
  margin-bottom: 6px;
}

.management-role-legend-list li:last-child {
  margin-bottom: 0;
}

.management-create-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding-top: 4px;
}

.management-btn-primary {
  min-width: 140px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: #2563eb;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.25);
  transition: background 0.15s, box-shadow 0.15s;
}

.management-btn-primary:hover {
  background: #1d4ed8;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

.management-btn-ghost {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  background: transparent;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.management-btn-ghost:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #334155;
}

.management-section-heading {
  margin: 0 0 14px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
}

.management-existing-wrap {
  margin-top: 8px;
}

.management-table-card {
  padding: 0;
  overflow: hidden;
}

.management-table-wrap {
  overflow: auto;
  max-height: min(55vh, 480px);
  border: none;
  border-radius: 0;
}

.management-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.management-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 8px;
  text-align: left;
  font-weight: 700;
  color: #334155;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.management-table .mgmt-col-idx {
  width: 40px;
  text-align: center;
}

.management-table .mgmt-col-actions {
  min-width: 260px;
  text-align: right;
}

.management-table tbody td {
  padding: 10px 8px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.management-table tbody tr:last-child td {
  border-bottom: none;
}

.management-table tbody tr.management-row-inactive {
  background: #fff1f2;
}

.management-table tbody tr.management-row-inactive td {
  color: #64748b;
}

.management-actions-cell {
  text-align: right;
  white-space: nowrap;
}

.management-action-btn {
  padding: 6px 10px;
  font-size: 11px;
  margin-left: 6px;
}

.management-action-btn.danger {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fef2f2;
}

.management-action-btn.danger:hover {
  background: #fee2e2;
}

.mgmt-badge {
  display: inline-block;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
}

.mgmt-badge-active {
  color: #166534;
  background: #dcfce7;
  border: 1px solid #86efac;
}

.mgmt-badge-inactive {
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #fca5a5;
}

.management-table-empty {
  margin: 0;
  padding: 20px 20px 24px;
  font-size: 13px;
  color: #64748b;
  text-align: center;
  line-height: 1.5;
}

.management-edit-lead {
  margin: 0 0 14px;
  font-size: 13px;
  color: #64748b;
  line-height: 1.45;
}

.management-edit-actions {
  margin-top: 4px;
}
