:root {
  --md-rose: #c45c6a;
  --md-rose-dark: #a84855;
  --md-rose-light: #fdf5f6;
  --md-border: #ececec;
  --md-border-soft: #f5f5f5;
  --bg: #ffffff;
  --card: #ffffff;
  --text: #333333;
  --muted: #777777;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 16px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  background: #fafafa;
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.app { min-height: 100vh; display: flex; flex-direction: column; }

/* ── Header (trắng như mdmedical.vn) ── */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 32px;
  background: #fff;
  border-bottom: 1px solid var(--md-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}

.brand-logo {
  height: 44px;
  width: auto;
  display: block;
}

.breadcrumb {
  flex: 1;
  font-size: 14px;
  color: var(--muted);
  min-width: 0;
}

.top-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* ── Page ── */
.page {
  max-width: 1140px;
  margin: 0 auto;
  padding: 28px 20px 20px;
  flex: 1;
  width: 100%;
}

.order-form {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--md-border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.form-top {
  display: grid;
  grid-template-columns: 1fr 280px;
  border-bottom: 1px solid var(--md-border-soft);
}

.form-section {
  padding: 24px 28px;
}

.form-section--customer {
  border-right: 1px solid var(--md-border-soft);
}

.form-section--summary {
  background: #fff;
}

.form-section--order {
  background: #fff;
  border-bottom: 1px solid var(--md-border-soft);
}

.form-section--products {
  padding-bottom: 28px;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.section-head--between {
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.section-head h2 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
}

.section-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--md-rose-light);
  color: var(--md-rose);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.section-badge--accent {
  background: var(--md-rose);
  color: #fff;
  font-size: 13px;
}

.grid-order-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 20px;
}

.grid-order-meta .field--gift {
  grid-column: 1 / -1;
}

.summary-box {
  background: #fafafa;
  border: 1px solid var(--md-border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 14px;
}

.summary-row span { color: var(--muted); }

.summary-row strong {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.summary-row input,
.summary-row .summary-input {
  width: 120px;
  text-align: right;
  padding: 8px 10px;
  border: 1px solid var(--md-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}

.summary-row input:focus {
  outline: none;
  border-color: var(--md-rose);
  box-shadow: 0 0 0 3px rgba(196, 92, 106, 0.1);
}

.summary-row--total {
  margin-bottom: 0;
  padding-top: 14px;
  margin-top: 6px;
  border-top: 1px solid var(--md-border);
}

.summary-row--total span {
  font-weight: 600;
  color: var(--text);
}

.summary-row--total strong {
  font-size: 22px;
  color: var(--md-rose-dark);
  font-weight: 700;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}

.span-2 { grid-column: span 2; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  min-width: 0;
}

.field span {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.field input,
.field select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--md-border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--md-rose);
  box-shadow: 0 0 0 3px rgba(196, 92, 106, 0.1);
}

.field input[readonly] {
  background: #fafafa;
  color: var(--muted);
}

.field--search { margin-bottom: 16px; max-width: 420px; }

.btn {
  border: none;
  border-radius: 4px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.btn.primary {
  background: var(--md-rose);
  color: #fff;
}

.btn.primary:hover { background: var(--md-rose-dark); }

.btn.ghost {
  background: #fff;
  border: 1px solid var(--md-border);
  color: var(--text);
}

.btn.ghost:hover { background: #fafafa; }

.btn.outline {
  background: #fff;
  border: 1px solid var(--md-rose);
  color: var(--md-rose-dark);
  padding: 8px 16px;
  font-size: 13px;
}

.btn.outline:hover { background: var(--md-rose-light); }

.btn.link {
  background: transparent;
  color: var(--md-rose);
  padding: 4px 8px;
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--md-border);
  border-radius: var(--radius-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 900px;
}

th, td {
  padding: 11px 12px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--md-border-soft);
}

th {
  background: #fafafa;
  color: var(--muted);
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

tbody tr:hover { background: #fafafa; }
tbody tr:last-child td { border-bottom: none; }

td input,
td select {
  width: 100%;
  min-width: 60px;
  padding: 8px;
  border: 1px solid var(--md-border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
}

td select { min-width: 180px; }

.dropdown {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid var(--md-border);
  border-radius: var(--radius-sm);
  max-height: 240px;
  overflow: auto;
  z-index: 50;
  box-shadow: var(--shadow-lg);
}

.dropdown.show { display: block; }

.dropdown-item {
  padding: 11px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--md-border-soft);
  font-size: 14px;
}

.dropdown-item:hover { background: var(--md-rose-light); }
.dropdown-item:last-child { border-bottom: none; }

.page-footer {
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: var(--muted);
  background: #fff;
  border-top: 1px solid var(--md-border-soft);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--text);
  color: #fff;
  padding: 14px 22px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  transform: translateY(8px);
  box-shadow: var(--shadow-lg);
  z-index: 200;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; padding: 12px 16px; gap: 10px; }
  .breadcrumb { order: 3; width: 100%; }
  .form-top { grid-template-columns: 1fr; }
  .form-section--customer { border-right: none; border-bottom: 1px solid var(--md-border-soft); }
  .grid-2, .grid-order-meta { grid-template-columns: 1fr; }
  .span-2, .grid-order-meta .field--gift { grid-column: span 1; }
  .form-section { padding: 20px 16px; }
  .page { padding: 16px 12px 12px; }
}

@media (max-width: 600px) {
  .top-actions { width: 100%; }
  .top-actions .btn { flex: 1; }
  .brand-logo { height: 36px; }
}
