.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.75fr);
  gap: 16px;
  margin-bottom: 16px;
}

.dashboard-side {
  display: grid;
  gap: 16px;
}

.chart-panel {
  min-height: 310px;
}

.chart-shell {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 7px;
  height: 205px;
  padding: 18px 4px 22px;
}

.chart-grid-line {
  position: absolute;
  right: 0;
  left: 0;
  border-top: 1px dashed #e7ebe5;
}

.chart-grid-line:nth-child(1) { top: 20%; }
.chart-grid-line:nth-child(2) { top: 50%; }
.chart-grid-line:nth-child(3) { top: 80%; }

.trend-column {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 1;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  height: 100%;
  min-width: 12px;
}

.trend-column:hover .chart-tooltip {
  opacity: 1;
  transform: translate(-50%, -5px);
}

.trend-bar {
  width: min(10px, 38%);
  min-height: 2px;
  border-radius: 5px 5px 2px 2px;
  transition: height 300ms ease;
}

.trend-bar.in {
  background: linear-gradient(180deg, #53a680, var(--green));
}

.trend-bar.out {
  background: linear-gradient(180deg, #e8c476, var(--gold));
}

.trend-label {
  position: absolute;
  bottom: -19px;
  left: 50%;
  color: #9aa39e;
  font-size: 8px;
  white-space: nowrap;
  transform: translateX(-50%);
}

.chart-tooltip {
  position: absolute;
  z-index: 4;
  bottom: 105%;
  left: 50%;
  width: max-content;
  max-width: 180px;
  border-radius: 7px;
  padding: 6px 8px;
  color: #fff;
  font-size: 9px;
  line-height: 1.5;
  text-align: center;
  background: rgba(16, 35, 31, 0.94);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 0);
  transition: 130ms ease;
}

.chart-legend {
  display: flex;
  gap: 16px;
  color: var(--muted);
  font-size: 9px;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.legend-dot.in { background: var(--green); }
.legend-dot.out { background: var(--gold); }

.import-guide {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 13px 15px;
  background: #f7f9f5;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.75;
}

.import-guide ol {
  margin: 7px 0 0;
  padding-left: 20px;
}

.import-template-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
  color: var(--muted);
  font-size: 11px;
}

.import-file-input {
  padding: 8px 10px;
}

#import-error {
  margin-top: 12px;
}

.distribution-list,
.recent-list,
.stack-list {
  display: grid;
  gap: 12px;
}

.distribution-row {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) auto;
  gap: 5px 12px;
  align-items: center;
}

.distribution-row strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.distribution-row .amount {
  font-family: 'Cascadia Mono', Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
}

.progress {
  grid-column: 1 / -1;
  overflow: hidden;
  height: 5px;
  border-radius: 999px;
  background: #edf1ec;
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), #66aa87);
}

.recent-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}

.recent-item:last-child {
  border-bottom: 0;
}

.recent-icon {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 9px;
  font-size: 9px;
  font-weight: 800;
}

.recent-icon.in {
  color: var(--green);
  background: var(--green-soft);
}

.recent-icon.out {
  color: var(--gold-dark);
  background: var(--gold-soft);
}

.recent-copy {
  min-width: 0;
}

.recent-copy strong {
  display: block;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-copy span {
  color: var(--muted);
  font-size: 9px;
}

.recent-value {
  text-align: right;
}

.recent-value strong {
  display: block;
  font-family: 'Cascadia Mono', Consolas, monospace;
  font-size: 10.5px;
}

.recent-value span {
  color: var(--muted);
  font-size: 8.5px;
}

.section-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 16px;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.quick-action {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  padding: 12px;
  text-align: left;
  background: #fbfcf9;
  cursor: pointer;
  transition: 150ms ease;
}

.quick-action:hover {
  border-color: #c6d2c9;
  background: #fff;
  transform: translateY(-1px);
}

.quick-action .metric-icon {
  flex: 0 0 auto;
}

.quick-action strong {
  display: block;
  font-size: 11px;
}

.quick-action span {
  color: var(--muted);
  font-size: 9px;
}

.form-section {
  margin: 0 0 18px;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  padding: 16px;
  background: #fcfdfb;
}

.form-section:last-child {
  margin-bottom: 0;
}

.form-section legend {
  padding: 0 8px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.form-grid .span-2 {
  grid-column: span 2;
}

.form-grid .span-3 {
  grid-column: span 3;
}

.form-grid .span-4 {
  grid-column: span 4;
}

.preview-panel {
  border: 1px solid #e5dbc2;
  border-radius: 13px;
  padding: 14px 16px;
  background:
    radial-gradient(circle at 100% 0, rgba(216, 169, 77, 0.12), transparent 14rem),
    #fffaf0;
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 11px;
}

.preview-head strong {
  font-size: 11px;
}

.preview-head span {
  color: var(--muted);
  font-size: 9px;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 11px;
}

.preview-item {
  min-width: 0;
}

.preview-item span {
  display: block;
  overflow: hidden;
  color: #8a7d63;
  font-size: 8.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-item strong {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  font-family: 'Cascadia Mono', Consolas, monospace;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-note {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 16px;
  margin-bottom: 12px;
  border-radius: 9px;
  padding: 9px 11px;
  color: #436056;
  font-size: 10px;
  background: #eef5f0;
}

.stock-note strong {
  font-family: 'Cascadia Mono', Consolas, monospace;
}

.readonly-note {
  border-left: 3px solid var(--gold);
  margin-bottom: 16px;
  padding: 10px 12px;
  color: #72674f;
  font-size: 10px;
  background: #fffaf0;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.summary-tile {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 15px 16px;
  background: rgba(255, 255, 255, 0.84);
}

.summary-tile span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.summary-tile strong {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  font-family: 'Cascadia Mono', Consolas, monospace;
  font-size: 18px;
  letter-spacing: -0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-tile strong.negative {
  color: var(--red);
}

.summary-tile small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.info-block {
  border-bottom: 1px solid var(--line-soft);
  padding: 9px 2px;
}

.info-block span {
  display: block;
  color: var(--muted);
  font-size: 9px;
}

.info-block strong {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 3px;
  font-size: 11px;
  font-weight: 600;
}

.role-pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 9px;
  font-weight: 700;
}

.role-pill.admin { color: #8c6219; background: #f7e8c7; }
.role-pill.manager { color: #285f78; background: #e4eff4; }
.role-pill.operator { color: #176448; background: #e1f0e8; }
.role-pill.viewer { color: #66726c; background: #edf0ec; }

.user-cell {
  display: flex;
  align-items: center;
  gap: 9px;
}

.user-cell .avatar {
  width: 29px;
  height: 29px;
  font-size: 10px;
}

.user-cell strong {
  display: block;
  font-size: 11px;
}

.user-cell span {
  color: var(--muted);
  font-size: 9px;
}

.danger-zone {
  border-color: #efd8d4;
  background: #fffafa;
}

.hint {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
}

.status-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9aa39e;
}

.status-dot.active::before {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 122, 90, 0.12);
}

.status-dot.inactive::before {
  background: #aeb6b1;
}

.table-wrap {
  max-height: calc(100vh - 126px);
  overflow: auto;
}

.data-table thead th {
  z-index: 3;
}

.data-table.full-fields thead .sticky-col {
  z-index: 4;
}

.data-table.full-fields thead .actions-col {
  z-index: 4;
}

.data-table.full-fields thead .select-col {
  z-index: 5;
}
.bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
  border: 1px solid #dce6dd;
  border-radius: 12px;
  padding: 10px 12px;
  color: #315b4b;
  font-size: 11px;
  background: #f4f9f4;
}

.bulk-bar.is-empty {
  color: var(--muted);
  background: #f8faf7;
}

.bulk-count strong {
  color: var(--green);
  font-family: 'Cascadia Mono', Consolas, monospace;
  font-size: 14px;
}

.bulk-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.bulk-bar.is-empty .bulk-actions {
  opacity: 0.62;
}

.select-col {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  text-align: center;
}

.select-col input,
.inline-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
  cursor: pointer;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 11px;
  cursor: pointer;
}

.data-table tbody tr.is-selected td {
  background: #edf7f0;
}

.data-table.full-fields .select-col {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--card);
  box-shadow: 1px 0 0 var(--line-soft);
}

.data-table.full-fields thead .select-col {
  z-index: 5;
  background: #f7f9f5;
}

.data-table.full-fields .sticky-col {
  left: 44px;
}

.data-table.full-fields tbody tr:hover .select-col,
.data-table.full-fields tbody tr.is-selected .select-col {
  background: #edf7f0;
}

.data-table.full-fields tr.is-voided .select-col {
  background: #fbfbfb;
}

.data-table tfoot td {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  font-weight: 800;
  background: #f9fbf7;
}

.totals-strip {
  margin-bottom: 12px;
}

.totals-strip .summary-tile {
  border-color: #dfe8df;
  background: linear-gradient(180deg, #ffffff, #f7faf6);
}

.line-clamp {
  display: -webkit-box;
  overflow: hidden;
  max-width: 260px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.page-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 14px;
  border: 1px solid #e6ddc9;
  border-radius: 10px;
  padding: 10px 12px;
  color: #72674f;
  font-size: 10px;
  line-height: 1.65;
  background: #fffcf3;
}

.page-note strong {
  color: #564a31;
}

@media (max-width: 1180px) {
  .dashboard-grid,
  .section-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .dashboard-side {
    grid-template-columns: 1fr;
  }
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .form-grid .span-3,
  .form-grid .span-4 {
    grid-column: span 2;
  }
  .summary-strip,
  .info-grid {
    grid-template-columns: 1fr;
  }
  .preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .quick-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .table-wrap {
    max-height: calc(100vh - 104px);
  }
}

@media (max-width: 720px) {
  .table-wrap {
    max-height: calc(100vh - 88px);
  }
  .bulk-bar {
    align-items: flex-start;
    flex-direction: column;
  }
  .bulk-actions {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid .span-2,
  .form-grid .span-3,
  .form-grid .span-4 {
    grid-column: span 1;
  }
}
