:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --line: #dbe4f0;
  --line-strong: #c7d3e3;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eaf2ff;
  --success: #16a34a;
  --success-soft: #eaf8ef;
  --warning: #d97706;
  --warning-soft: #fff5e8;
  --danger: #dc2626;
  --danger-soft: #feeeee;
  --shadow-sm: 0 8px 24px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 16px 40px rgba(15, 23, 42, 0.08);
  --radius-xl: 24px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --container: 1320px;
}

* {
  box-sizing: border-box;
  min-width: 0;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

input,
select,
textarea {
  outline: none;
}

.hidden {
  display: none !important;
}

.container {
  width: min(var(--container), calc(100% - 32px));
  margin: 0 auto;
}

.app-shell {
  min-height: 100vh;
}

/* ===== TOPBAR ===== */
.topbar {
  position: static;
  background: rgba(243, 246, 251, 0.96);
  border-bottom: 1px solid rgba(199, 211, 227, 0.8);
}

.topbar-inner {
  min-height: 88px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 16px 0;
}

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

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: #2563eb;
  color: #ffffff;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.03em;
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.18);
  flex: 0 0 auto;
}

.brand-text h1 {
  margin: 0;
  font-size: 1.7rem;
  line-height: 1.15;
  font-weight: 800;
  color: var(--text);
}

.brand-text p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ===== MAIN ===== */
.page-content {
  padding: 24px 0 34px;
}

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

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  box-shadow: var(--shadow-sm);
  min-height: 136px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-label {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.stat-value {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.05;
}

.stat-value.success {
  color: var(--success);
}

.stat-value.danger {
  color: var(--danger);
}

.stat-note {
  margin-top: 10px;
  font-size: 0.94rem;
  color: var(--muted);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  overflow: visible;
}

.panel-head {
  padding: 20px 20px 0;
}

.panel-head-inline {
  padding-bottom: 0;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.2;
  font-weight: 800;
}

.panel-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.96rem;
}

/* ===== BUTTON ===== */
.btn {
  height: 46px;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.96rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.16);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #ffffff;
  color: var(--text);
  border-color: var(--line-strong);
}

.btn-secondary:hover {
  background: #f8fbff;
  border-color: #9bb7ef;
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #f3c3c3;
}

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

.btn-file {
  position: relative;
  overflow: hidden;
}

/* ===== LIST TOOLBAR ===== */
.list-toolbar {
  padding: 16px 20px 18px;
  display: grid;
  gap: 14px;
}

.list-toolbar-top {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.search-box {
  width: 100%;
}

.search-box input {
  width: 100%;
  height: 56px;
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 16px;
  padding: 0 16px;
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box input::placeholder {
  color: #94a3b8;
}

.search-box input:focus {
  border-color: #9bb7ef;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}

.filter-wrap {
  display: grid;
  grid-template-columns: repeat(3, minmax(168px, 1fr));
  gap: 12px;
  align-items: stretch;
  min-width: 0;
}

.filter-popover {
  position: relative;
  min-width: 0;
}

.filter-trigger {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 82px;
  height: 82px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 16px;
  padding: 14px 42px 14px 16px;
  display: grid;
  grid-template-rows: 1fr auto;
  align-content: center;
  gap: 4px;
  text-align: left;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}

.filter-trigger:hover {
  border-color: #bfd0ea;
  transform: translateY(-1px);
}

.filter-trigger.is-open {
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.filter-trigger > span {
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 6px;
}

.filter-trigger > strong {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-caret {
  position: absolute;
  top: 50%;
  right: 16px;
  width: 10px;
  height: 10px;
  margin-top: -7px;
  border-right: 2px solid #475569;
  border-bottom: 2px solid #475569;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.filter-trigger.is-open .filter-caret {
  transform: rotate(-135deg);
  margin-top: -2px;
}

.filter-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--surface);
  border: 1px solid #d6e0ee;
  border-radius: 18px;
  box-shadow: 0 22px 40px rgba(15, 23, 42, 0.12);
  padding: 10px;
  display: grid;
  gap: 6px;
}

.filter-option {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  text-align: left;
  font-weight: 700;
  transition: background 0.2s ease, color 0.2s ease;
}

.filter-option:hover {
  background: #eff6ff;
  color: var(--primary);
}

.filter-option.is-active {
  background: #e8f0ff;
  color: var(--primary);
}

.list-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.list-toolbar-actions .btn {
  flex: 0 0 auto;
}

/* ===== ALERT ===== */
.alerts-list {
  padding: 20px;
  display: grid;
  gap: 12px;
}

.alert-item {
  border: 1px solid #f1d1d1;
  background: #fff8f8;
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.alert-title {
  font-weight: 700;
  color: var(--text);
}

.alert-meta {
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 4px;
}

/* ===== TABLE ===== */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  padding: 0 20px 20px;
}

.data-table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table thead th {
  background: #f8fbff;
  color: #334155;
  font-size: 0.92rem;
  font-weight: 800;
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  white-space: nowrap;
}

.data-table thead th:first-child {
  border-left: 1px solid var(--line);
  border-top-left-radius: 14px;
}

.data-table thead th:last-child {
  border-right: 1px solid var(--line);
  border-top-right-radius: 14px;
}

.data-table tbody td {
  padding: 14px 12px;
  border-bottom: 1px solid #edf2f8;
  background: #ffffff;
  vertical-align: middle;
}

.data-table tbody tr td:first-child {
  border-left: 1px solid #edf2f8;
}

.data-table tbody tr td:last-child {
  border-right: 1px solid #edf2f8;
}

.data-table tbody tr:hover td {
  background: #fbfdff;
}

.item-thumb {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #f8fafc;
  display: block;
}

.item-name-link {
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  color: var(--text);
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.item-name-link:hover {
  color: var(--primary);
}

.item-subline {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.table-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-btn {
  height: 34px;
  min-width: 52px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--text);
  font-weight: 700;
  padding: 0 12px;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  border-color: #9bb7ef;
  background: #f8fbff;
}

.icon-btn.danger {
  color: var(--danger);
  border-color: #f3c3c3;
  background: #fff8f8;
}

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

/* ===== BADGE ===== */
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.badge-ok {
  background: var(--success-soft);
  color: var(--success);
}

.badge-warn {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-muted {
  background: #eef2f7;
  color: #64748b;
}

.empty-state {
  padding: 18px 16px;
  border: 1px dashed var(--line-strong);
  background: var(--surface-soft);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
  font-weight: 600;
}

/* ===== MODAL ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
}

.detail-modal {
  z-index: 80;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(4px);
}

.modal-dialog {
  position: relative;
  width: min(920px, calc(100% - 24px));
  margin: 40px auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-md);
  max-height: calc(100vh - 80px);
  overflow: auto;
}

.detail-dialog {
  width: min(1080px, calc(100% - 24px));
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 22px 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
}

.modal-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.modal-close {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: #475569;
  font-size: 1.5rem;
  line-height: 1;
}

.modal-close:hover {
  background: #f8fbff;
}

.modal-form {
  padding: 20px 22px 22px;
}

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

.form-group {
  display: grid;
  gap: 8px;
}

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

.form-group label {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--text);
}

.form-group label span {
  color: var(--danger);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group textarea {
  resize: vertical;
  min-height: 110px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: #9bb7ef;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ===== DETAIL CONTENT ===== */
.detail-scroll {
  max-height: calc(100vh - 170px);
  overflow: auto;
  padding: 18px 22px 22px;
  scrollbar-width: thin;
  scrollbar-color: #c7d3e3 transparent;
}

.detail-scroll::-webkit-scrollbar {
  width: 10px;
}

.detail-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.detail-scroll::-webkit-scrollbar-thumb {
  background: #c7d3e3;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.detail-scroll::-webkit-scrollbar-thumb:hover {
  background: #9fb3cc;
  background-clip: content-box;
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 90;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100% - 32px));
}

.toast {
  transform: translateY(10px);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  border-radius: 16px;
  padding: 14px 16px;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  border: 1px solid transparent;
  background: #ffffff;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  background: #effaf3;
  color: #166534;
  border-color: #b7e2c4;
}

.toast-error {
  background: #fff2f2;
  color: #991b1b;
  border-color: #f3c3c3;
}

.toast-warning {
  background: #fff8eb;
  color: #9a5508;
  border-color: #f1d39a;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1180px) {
  .list-toolbar-top {
    grid-template-columns: 1fr;
  }

  .filter-wrap {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .topbar-inner {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .topbar-actions {
    width: 100%;
    justify-content: stretch;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .topbar-actions .btn,
  .topbar-actions .btn-file {
    width: 100%;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .filter-wrap {
    grid-template-columns: 1fr;
  }

  .filter-trigger {
    height: 74px;
    min-height: 74px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .modal-dialog {
    margin: 12px auto;
    max-height: calc(100vh - 24px);
    border-radius: 20px;
  }

  .detail-dialog {
    width: min(100%, calc(100% - 12px));
  }
}

@media (max-width: 640px) {
  .container {
    width: min(var(--container), calc(100% - 20px));
  }

  .topbar {
    position: static;
  }

  .topbar-inner {
    gap: 14px;
    padding: 14px 0;
  }

  .brand {
    align-items: flex-start;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 13px;
  }

  .brand-text h1 {
    font-size: 1.22rem;
    line-height: 1.2;
  }

  .brand-text p {
    font-size: 0.9rem;
    line-height: 1.45;
  }

  .topbar-actions {
    grid-template-columns: 1fr;
  }

  .page-content {
    padding: 18px 0 24px;
  }

  .panel-head {
    padding: 18px 16px 0;
  }

  .list-toolbar {
    padding: 14px 16px 16px;
  }

  .list-toolbar-top {
    gap: 12px;
  }

  .list-toolbar-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .list-toolbar-actions .btn {
    width: 100%;
  }

  .btn {
    width: 100%;
    height: 48px;
  }

  .search-box input {
    height: 52px;
    border-radius: 14px;
  }

  .filter-trigger {
    height: 72px;
    min-height: 72px;
    border-radius: 14px;
  }

  .filter-trigger > span {
    font-size: 0.98rem;
  }

  .filter-trigger > strong {
    font-size: 0.82rem;
  }

  .stats-grid {
    gap: 14px;
  }

  .stat-card {
    min-height: 122px;
    padding: 18px;
  }

  .stat-label {
    font-size: 0.92rem;
  }

  .stat-value {
    font-size: 2rem;
  }

  .stat-note {
    font-size: 0.92rem;
  }

  .alerts-list {
    padding: 16px;
  }

  .alert-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel {
    border-radius: 18px;
  }

  .table-wrap {
    padding: 0 16px 16px;
  }

  .modal-header,
  .modal-form,
  .detail-scroll {
    padding-left: 16px;
    padding-right: 16px;
  }

  .modal-footer {
    flex-direction: column-reverse;
  }

  .toast-container {
    right: 10px;
    bottom: 10px;
    width: calc(100% - 20px);
  }
}

/* ===== PRODUCT GRID SIMPLE ===== */
.product-grid-wrap {
  padding: 0 20px 20px;
}

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

.product-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
  border-color: #bfd0ea;
}

.product-thumb-button {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0 0 12px;
  cursor: pointer;
}

.product-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  object-fit: cover;
  display: block;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.product-thumb-placeholder {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.product-name-button {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.35;
  cursor: pointer;
  margin-bottom: 8px;
}

.product-name-button:hover {
  color: var(--primary);
}

.product-stock {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 14px;
}

.product-stock-label {
  font-size: 0.92rem;
  color: var(--muted);
  font-weight: 600;
}

.product-stock-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
}

.product-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.product-card-check {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.product-card-check input {
  width: 18px;
  height: 18px;
}

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

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

@media (max-width: 640px) {
  .product-grid-wrap {
    padding: 0 16px 16px;
  }

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

  .product-card {
    padding: 12px;
    border-radius: 16px;
  }

  .product-name-button {
    font-size: 0.96rem;
  }

  .product-stock-value {
    font-size: 1.2rem;
  }

  .product-card-actions {
    grid-template-columns: 1fr;
  }
}

/* ===== DETAIL MODAL UI ===== */
.detail-hero {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
}

.detail-hero-media {
  width: 100%;
}

.detail-hero-image,
.detail-hero-placeholder {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #f8fafc;
  display: block;
  object-fit: cover;
}

.detail-hero-body {
  min-width: 0;
}

.detail-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.detail-title {
  margin: 0 0 6px;
  font-size: 2rem;
  line-height: 1.15;
  font-weight: 800;
  word-break: break-word;
}

.detail-subtitle {
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 14px;
  word-break: break-word;
}

.detail-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.detail-stat {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}

.detail-stat-label {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.detail-stat-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
  word-break: break-word;
}

.detail-stat-value.is-unit {
  font-size: 1.4rem;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.detail-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.detail-info-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  min-width: 0;
}

.detail-info-card.full {
  grid-column: 1 / -1;
}

.detail-info-label {
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.detail-info-value {
  font-size: 1.05rem;
  font-weight: 700;
  word-break: break-word;
}

.detail-history-box {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
}

.detail-history-title {
  margin: 0 0 12px;
  font-size: 1.1rem;
  font-weight: 800;
}

.detail-history-list {
  display: grid;
  gap: 10px;
}

.detail-history-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}

.detail-history-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.detail-history-date {
  color: var(--muted);
  font-size: 0.92rem;
}

.detail-history-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}

.detail-action-box {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
}

.detail-action-title {
  margin: 0 0 6px;
  font-size: 1.15rem;
  font-weight: 800;
}

.detail-action-subtitle {
  margin: 0 0 16px;
  color: var(--muted);
}

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

.detail-action-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

@media (max-width: 900px) {
  .detail-hero {
    grid-template-columns: 1fr;
  }

  .detail-hero-media {
    max-width: 280px;
  }

  .detail-stats {
    grid-template-columns: 1fr;
  }

  .detail-info-grid {
    grid-template-columns: 1fr;
  }

  .detail-history-grid {
    grid-template-columns: 1fr;
  }

  .detail-action-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .detail-dialog {
    width: calc(100% - 12px);
    margin: 6px auto;
    border-radius: 18px;
    max-height: calc(100vh - 12px);
  }

  .detail-scroll {
    max-height: calc(100vh - 120px);
    padding: 14px 14px 16px;
  }

  .detail-hero {
    gap: 14px;
    padding: 14px;
    border-radius: 16px;
  }

  .detail-hero-media {
    max-width: 100%;
  }

  .detail-title {
    font-size: 1.5rem;
  }

  .detail-subtitle {
    font-size: 0.95rem;
    margin-bottom: 12px;
  }

  .detail-stat {
    padding: 10px 12px;
  }

  .detail-stat-value {
    font-size: 1.5rem;
  }

  .detail-stat-value.is-unit {
    font-size: 1.2rem;
  }

  .detail-actions,
  .detail-action-buttons {
    display: grid;
    grid-template-columns: 1fr;
  }

  .detail-actions .btn,
  .detail-action-buttons .btn {
    width: 100%;
  }

  .detail-info-card {
    padding: 12px;
    border-radius: 14px;
  }

  .detail-history-box,
  .detail-action-box {
    padding: 14px;
    border-radius: 16px;
  }
}