:root {
  --bg: #f7f1e8;
  --surface: rgba(255, 251, 245, 0.9);
  --surface-strong: #fffdf9;
  --surface-soft: #f4ebe0;
  --border: rgba(113, 81, 48, 0.12);
  --border-strong: rgba(113, 81, 48, 0.2);
  --text: #2f2418;
  --muted: #7b6753;
  --accent: #d98049;
  --accent-strong: #bb6734;
  --accent-soft: rgba(217, 128, 73, 0.14);
  --success-soft: rgba(81, 170, 129, 0.16);
  --danger-soft: rgba(216, 105, 117, 0.16);
  --info-soft: rgba(110, 144, 182, 0.16);
  --shadow: 0 20px 50px rgba(133, 99, 61, 0.12);
  --shadow-soft: 0 10px 24px rgba(133, 99, 61, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "DM Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 214, 170, 0.5), transparent 28%),
    radial-gradient(circle at top right, rgba(185, 220, 202, 0.42), transparent 28%),
    linear-gradient(180deg, #fffdf9 0%, #f8f2ea 45%, #f2e9de 100%);
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.28), transparent 55%);
}

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

.hidden {
  display: none !important;
}

.shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.topbar,
.table-card,
.control-bar,
.alert-banner,
.stat-card,
.modal {
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.topbar {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 28px 30px;
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(255, 213, 177, 0.65), transparent 30%),
    linear-gradient(135deg, rgba(255, 253, 249, 0.98), rgba(246, 237, 225, 0.98));
}

.topbar::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -48px;
  top: -62px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217, 128, 73, 0.16), transparent 68%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
  position: relative;
  z-index: 1;
}

.brand-mark {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-family: "Syne", sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  color: #fffaf5;
  background: linear-gradient(135deg, #ebaa78, #cb6c34);
  box-shadow: 0 14px 28px rgba(203, 108, 52, 0.22);
}

.brand h1,
.modal h2,
.empty-state h2 {
  margin: 0;
  font-family: "Syne", sans-serif;
  letter-spacing: -0.04em;
}

.brand h1 {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
}

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

.page {
  display: grid;
  gap: 22px;
  margin-top: 22px;
}

.badge,
.filter-btn {
  border: 1px solid var(--border);
}

.import-card {
  display: grid;
  grid-template-columns: minmax(240px, 0.95fr) minmax(320px, 1.05fr);
  gap: 22px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 30px;
  background:
    radial-gradient(circle at top right, rgba(217, 128, 73, 0.12), transparent 28%),
    linear-gradient(180deg, rgba(255, 253, 249, 0.98), rgba(246, 237, 226, 0.96));
  box-shadow: var(--shadow);
}

.import-copy h2 {
  margin: 10px 0 10px;
  font: 800 clamp(1.6rem, 3vw, 2.25rem)/1 "Syne", sans-serif;
  letter-spacing: -0.04em;
}

.import-copy p {
  margin: 0;
  max-width: 34rem;
  color: var(--muted);
  line-height: 1.6;
}

.section-kicker {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(217, 128, 73, 0.1);
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.import-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(113, 81, 48, 0.1);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.58);
}

.import-textarea {
  min-height: 132px;
  resize: vertical;
}

.import-hint {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(244, 235, 224, 0.78);
  color: #6c5947;
  line-height: 1.55;
}

.import-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.stat-card {
  position: relative;
  border-radius: 30px;
  padding: 28px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 248, 241, 0.84), transparent 45%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 241, 232, 0.98));
}

.stat-card-single {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px 20px;
  align-items: center;
}

.stat-card.urgent {
  border-color: rgba(217, 128, 73, 0.32);
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: auto -36px -36px auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217, 128, 73, 0.12), transparent 68%);
}

.stat-icon {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  margin-bottom: 0;
  background: linear-gradient(135deg, rgba(255, 234, 215, 0.95), rgba(244, 223, 203, 0.85));
  font-weight: 700;
  font-size: 1.35rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.stat-value {
  font: 800 clamp(2.6rem, 5vw, 4rem)/0.95 "Syne", sans-serif;
  letter-spacing: -0.06em;
  position: relative;
  z-index: 1;
}

.stat-label {
  margin-top: 2px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  font-weight: 700;
}

.stat-sub {
  margin-top: 0;
  color: #5e4e40;
  font-size: 1rem;
  max-width: 28rem;
  position: relative;
  z-index: 1;
}

.control-bar {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 251, 245, 0.82);
  backdrop-filter: blur(12px);
}

.search-input,
.sort-select,
.field input,
.field select,
.field textarea {
  width: 100%;
  color: var(--text);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(130, 103, 73, 0.16);
  border-radius: 16px;
  padding: 14px 16px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.search-input::placeholder,
.field input::placeholder,
.field textarea::placeholder {
  color: #a08d7d;
}

.search-input:focus,
.sort-select:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(222, 123, 66, 0.45);
  box-shadow: 0 0 0 4px rgba(222, 123, 66, 0.12);
}

.search-input {
  flex: 1 1 260px;
}

.filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 11px 15px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
}

.filter-btn.active {
  color: var(--text);
  background: var(--accent-soft);
  border-color: rgba(222, 123, 66, 0.35);
  box-shadow: 0 10px 18px rgba(217, 128, 73, 0.08);
}

.sort-select {
  width: auto;
  min-width: 180px;
}

.table-card {
  border-radius: 30px;
  padding: 12px;
  background: rgba(255, 251, 245, 0.94);
}

.table-wrap {
  overflow: auto;
  border-radius: 22px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.62);
  border-radius: 22px;
  overflow: hidden;
}

th,
td {
  text-align: left;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(130, 103, 73, 0.1);
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  background: rgba(244, 235, 224, 0.72);
}

tbody tr {
  transition: background 180ms ease, transform 180ms ease;
}

tbody tr:hover {
  background: rgba(240, 227, 212, 0.44);
}

.mono {
  font-family: "Consolas", "Courier New", monospace;
}

.desc-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.desc-wrap strong {
  font-size: 1rem;
}

.desc-note {
  color: var(--muted);
  font-size: 0.85rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  white-space: nowrap;
  font-weight: 700;
}

.badge.pending {
  background: var(--accent-soft);
  color: #9c592f;
}

.badge.received {
  background: var(--success-soft);
  color: #2f7754;
}

.badge.cancelled {
  background: rgba(140, 126, 114, 0.12);
  color: #66584d;
}

.action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mini-btn,
.primary-btn,
.ghost-btn,
.danger-btn,
.icon-btn {
  border: 1px solid transparent;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.mini-btn:hover,
.primary-btn:hover,
.ghost-btn:hover,
.danger-btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.mini-btn {
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  padding: 10px 13px;
  border-color: rgba(130, 103, 73, 0.12);
  font-weight: 600;
}

.primary-btn {
  padding: 14px 20px;
  background: linear-gradient(135deg, #eeb78d, #d97f49);
  color: #fffaf4;
  font-weight: 700;
  box-shadow: 0 16px 28px rgba(217, 128, 73, 0.2);
}

.ghost-btn {
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.82);
  border-color: var(--border);
  color: var(--text);
}

.danger-btn {
  padding: 14px 18px;
  background: var(--danger-soft);
  color: #9d4453;
  border-color: rgba(216, 105, 117, 0.28);
}

.icon-btn {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.82);
  border-color: var(--border);
  color: var(--text);
  font-weight: 700;
}

.empty-state {
  padding: 88px 24px;
  text-align: center;
}

.empty-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(255, 214, 155, 0.45), rgba(233, 165, 116, 0.38));
  font-family: "Syne", sans-serif;
  font-size: 1.3rem;
}

.empty-state p {
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(88, 68, 48, 0.24);
  backdrop-filter: blur(10px);
  z-index: 20;
}

.modal {
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border-radius: 32px;
  padding: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 242, 235, 0.98));
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

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

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

.field-span-2 {
  grid-column: span 2;
}

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

.detail-stack {
  display: grid;
  gap: 22px;
  margin-top: 24px;
}

.detail-amount {
  font: 800 2.5rem/1 "Syne", sans-serif;
  letter-spacing: -0.05em;
}

.detail-title {
  margin: 6px 0 0;
  color: #5f5043;
  font-size: 1.05rem;
}

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

.detail-item {
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(130, 103, 73, 0.1);
}

.detail-item.full {
  grid-column: span 2;
}

.detail-item span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.detail-item strong {
  display: block;
  margin-top: 8px;
  font-size: 1rem;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  padding: 14px 18px;
  border-radius: 18px;
  color: #fff;
  box-shadow: var(--shadow);
}

.toast.success {
  background: linear-gradient(135deg, #62bf91, #3a9b6b);
}

.toast.error {
  background: linear-gradient(135deg, #de7f8a, #bf5967);
}

.toast.info {
  background: linear-gradient(135deg, #7b9ab5, #5f7991);
}

@media (max-width: 980px) {
  .sort-select {
    width: 100%;
  }

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

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

  .topbar {
    flex-direction: column;
    align-items: stretch;
    padding: 22px;
  }

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

  .stat-card-single {
    grid-template-columns: 1fr;
  }

  .field-span-2,
  .detail-item.full {
    grid-column: span 1;
  }

  .modal-actions,
  .detail-actions {
    flex-direction: column-reverse;
  }
}
