/* Màn Công ty (tiền tố co-). Chỉ dùng token của style.css. */

.co-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 240px;
  max-width: 380px;
  color: var(--muted);
}
.co-search .i {
  position: absolute;
  left: 12px;
  pointer-events: none;
}
.co-search-input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition:
    border-color var(--duration-base),
    box-shadow var(--duration-base);
}
.co-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.co-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.co-results-in {
  animation: fade-in var(--duration-base) var(--ease-out);
}

/* Lưới thẻ */
.co-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.co-card {
  display: grid;
  gap: 12px;
  width: 100%;
  padding: 16px;
  text-align: left;
  color: inherit;
  cursor: pointer;
}
.co-card:active {
  transform: scale(0.98);
}
.co-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.co-card-title {
  display: grid;
  min-width: 0;
}
.co-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}
.co-industry {
  font-size: 13px;
}
.co-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.co-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.co-stat {
  display: grid;
}
.co-stat-label {
  font-size: 12px;
}
.co-stat-val {
  font-size: 17px;
  font-weight: 700;
}
.co-primary {
  display: flex;
  align-items: center;
  min-height: 28px;
  font-size: 13px;
}
.co-primary-who {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* Bảng */
.co-name-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: none;
  font-weight: 600;
  text-align: left;
  transition: color var(--duration-base);
}
.co-name-btn:active {
  transform: scale(0.98);
}
@media (hover: hover) {
  .co-name-btn:hover {
    color: var(--accent);
  }
}

/* Chi tiết */
.co-panel {
  display: grid;
  gap: 18px;
}
.co-detail-head {
  display: grid;
  gap: 14px;
}
.co-detail-id {
  display: flex;
  align-items: center;
  gap: 14px;
}
.co-detail-id .co-card-title {
  flex: 1;
}
.co-detail-name {
  font-size: 18px;
  overflow-wrap: anywhere;
}
.co-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}
.co-fact {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.co-fact dt {
  font-size: 12px;
}
.co-fact dd {
  margin: 0;
  font-weight: 600;
}
.co-lists {
  display: grid;
  gap: 18px;
}
.co-section {
  display: grid;
  gap: 8px;
}
.co-rows {
  display: grid;
  gap: 8px;
}
.co-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-align: left;
  transition:
    transform var(--duration-base) var(--ease-out),
    border-color var(--duration-base),
    box-shadow var(--duration-base);
}
button.co-item:active {
  transform: scale(0.99);
}
@media (hover: hover) {
  button.co-item:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
  }
}
.co-item-main {
  display: grid;
  flex: 1;
  min-width: 0;
}
.co-item-title {
  font-weight: 600;
  overflow-wrap: anywhere;
}
.co-item-sub {
  font-size: 12px;
}
.co-item-value {
  font-weight: 600;
  white-space: nowrap;
}
.co-dot {
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
}

/* Biểu đồ doanh thu */
.co-chart-wrap {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.co-readout {
  min-height: 22px;
  font-weight: 600;
}
.co-chart {
  width: 100%;
  height: auto;
  overflow: visible;
}
.co-axis {
  stroke: var(--line);
  stroke-width: 1;
}
.co-bar {
  outline: none;
  cursor: default;
}
.co-bar-rect {
  fill: var(--accent);
  opacity: 0.75;
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: co-grow var(--duration-enter) var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * var(--stagger-step));
  transition: opacity var(--duration-base);
}
.co-bar-val,
.co-bar-year {
  fill: var(--muted);
  font-size: 12px;
}
.co-bar-val {
  fill: var(--text);
  font-weight: 600;
  animation: fade-in var(--duration-enter) var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * var(--stagger-step) + var(--duration-base));
}
.co-bar:hover .co-bar-rect,
.co-bar:focus-visible .co-bar-rect {
  opacity: 1;
}
.co-bar:focus-visible .co-bar-rect {
  stroke: var(--text);
  stroke-width: 2;
}

/* Hộp thêm/sửa */
.co-del {
  margin-right: auto;
}
.co-del-note {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--warn);
  font-weight: 500;
}

@keyframes co-grow {
  from {
    transform: scaleY(0);
  }
}

/* Hẹp: bảng thành danh sách thẻ */
@media (max-width: 720px) {
  .co-search {
    max-width: none;
  }
  .co-tbl thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .co-tbl,
  .co-tbl tbody,
  .co-tbl tr,
  .co-tbl td {
    display: block;
  }
  .co-tbl-wrap {
    border: 0;
    background: none;
  }
  .co-tbl tr {
    margin-bottom: 10px;
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
  }
  .co-tbl td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border: 0;
    white-space: normal;
    text-align: right;
  }
  .co-tbl td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    text-align: left;
  }
  .co-tbl td:first-child::before {
    content: none;
  }
}
