:root {
  --bg: #eef2f0;
  --ink: #17201d;
  --muted: #6b7772;
  --panel: #ffffff;
  --line: #dce5e1;
  --side: #10231d;
  --side-soft: #1c332c;
  --accent: #e86f3d;
  --accent-dark: #c74e22;
  --green: #2c7a56;
  --amber: #b97213;
  --red: #b33d33;
  --shadow: 0 24px 70px rgba(20, 40, 34, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Aptos", "Segoe UI", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(232, 111, 61, 0.18), transparent 34rem),
    linear-gradient(135deg, #f8faf8 0%, var(--bg) 50%, #dfe9e4 100%);
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.auth-card {
  width: min(34rem, 100%);
  padding: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 2rem;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.overline {
  margin: 0 0 0.35rem;
  color: var(--accent-dark);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.04em;
}

h1 {
  font-size: clamp(2.4rem, 8vw, 4.8rem);
  line-height: 0.92;
}

h2 {
  font-size: clamp(1.8rem, 4vw, 3.2rem);
}

h3 {
  font-size: 1.35rem;
}

.muted,
.hint {
  color: var(--muted);
  line-height: 1.7;
}

.auth-tabs,
.top-actions,
.modal-actions,
.split {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.auth-tabs {
  margin: 1.5rem 0;
  padding: 0.35rem;
  border-radius: 999px;
  background: #edf3f0;
}

.tab,
.nav-item,
.secondary,
.primary,
.icon-btn {
  border: 0;
  border-radius: 999px;
}

.tab {
  flex: 1;
  padding: 0.75rem 1rem;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.tab.active,
.primary {
  color: white;
  background: var(--accent);
}

.primary,
.secondary {
  padding: 0.8rem 1.1rem;
  font-weight: 800;
}

button[disabled] {
  cursor: wait;
  opacity: 0.68;
}

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

.secondary {
  color: var(--ink);
  border: 1px solid var(--line);
  background: white;
}

.form-panel,
.panel,
.modal-card {
  display: grid;
  gap: 1rem;
}

label {
  display: grid;
  gap: 0.45rem;
  color: #394540;
  font-size: 0.9rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 0.85rem 0.95rem;
  color: var(--ink);
  background: #fbfdfc;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(232, 111, 61, 0.12);
}

.message {
  min-height: 1.2rem;
  color: var(--red);
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 18rem minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1.2rem;
  color: white;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent),
    var(--side);
}

.brand {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  padding: 0.6rem;
}

.brand-mark {
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  border-radius: 1rem;
  color: var(--side);
  background: #f0c35d;
  font-weight: 900;
}

.brand small,
.sidebar-footer span {
  display: block;
  color: rgba(255, 255, 255, 0.64);
}

nav {
  display: grid;
  gap: 0.45rem;
  margin-top: 2rem;
}

.nav-item {
  width: 100%;
  padding: 0.9rem 1rem;
  color: rgba(255, 255, 255, 0.74);
  background: transparent;
  text-align: left;
  font-weight: 800;
}

.nav-item.active,
.nav-item:hover {
  color: white;
  background: var(--side-soft);
}

.sidebar-footer {
  display: grid;
  gap: 0.8rem;
  margin-top: auto;
}

#logout-btn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 0.7rem;
  color: white;
  background: transparent;
}

.workspace {
  min-width: 0;
  padding: 1.5rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.drop-zone,
.panel,
.table-shell {
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 1.5rem;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 18px 50px rgba(20, 40, 34, 0.08);
}

.drop-zone {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  min-height: 8.5rem;
  padding: 1.4rem;
  border-style: dashed;
}

.drop-zone.dragover {
  border-color: var(--accent);
  background: #fff7f2;
}

.table-shell {
  width: 100%;
  max-width: 100%;
  margin-top: 1rem;
  overflow: auto;
}

table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
}

th,
td {
  max-width: 13rem;
  padding: 0.9rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #4f5d58;
  background: #f7faf8;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td {
  font-size: 0.9rem;
}

.row-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.mini {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.7rem;
  color: var(--ink);
  background: white;
  font-weight: 800;
}

.mini.danger {
  color: var(--red);
}

.shipment-stack {
  display: grid;
  gap: 0.28rem;
  min-width: 8rem;
}

.shipment-stack.tight {
  min-width: 6.5rem;
}

.shipment-line {
  display: flex;
  gap: 0.45rem;
  align-items: flex-start;
  line-height: 1.45;
}

.shipment-line .label {
  min-width: 3.8rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.shipment-line .value {
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.remarks-cell {
  min-width: 15rem;
  max-width: 18rem;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.ops-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, max-content));
  gap: 0.45rem;
}

.copy-inline {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
}

.copy-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  color: #40514b;
  background: #f6faf8;
  font-size: 0.72rem;
  font-weight: 800;
}

.grid.two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
}

.panel {
  padding: 1.2rem;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checkline input {
  width: auto;
}

.template-list,
.user-list,
.provider-list {
  display: grid;
  gap: 0.6rem;
}

.upload-summary {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.upload-summary-item {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  color: #51615b;
  background: #f6faf8;
  font-size: 0.82rem;
  font-weight: 800;
}

.upload-summary-item.active {
  color: white;
  border-color: var(--accent);
  background: var(--accent);
}

.upload-summary-item.done {
  border-color: rgba(44, 122, 86, 0.2);
  color: #216943;
  background: rgba(44, 122, 86, 0.1);
}

.list-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #fbfdfc;
}

.list-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.chip {
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  background: #edf3f0;
  color: #40514b;
}

.chip.ok {
  background: rgba(44, 122, 86, 0.12);
  color: #216943;
}

.chip.fail {
  background: rgba(179, 61, 51, 0.12);
  color: #9c362d;
}

dialog {
  width: min(42rem, calc(100% - 2rem));
  border: 0;
  border-radius: 1.5rem;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(16, 35, 29, 0.54);
  backdrop-filter: blur(3px);
}

.modal-card {
  padding: 1.4rem;
}

.modal-card header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.icon-btn {
  width: 2.2rem;
  height: 2.2rem;
  background: #eef2f0;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  max-width: 28rem;
  padding: 1rem 1.1rem;
  border-radius: 1rem;
  color: white;
  background: var(--side);
  box-shadow: var(--shadow);
}

.toast.success {
  background: var(--green);
}

.toast.error {
  background: var(--red);
}

.toast.info {
  background: var(--side);
}

.upload-status {
  position: fixed;
  right: 1rem;
  bottom: 5.6rem;
  z-index: 25;
  width: min(26rem, calc(100% - 2rem));
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 1rem;
  color: white;
  background: rgba(16, 35, 29, 0.96);
  box-shadow: var(--shadow);
}

.upload-status.success {
  background: rgba(44, 122, 86, 0.96);
}

.upload-status.error {
  background: rgba(179, 61, 51, 0.96);
}

.upload-status .icon-btn {
  color: white;
  background: rgba(255, 255, 255, 0.14);
}

.upload-status-text {
  margin: 0.2rem 0 0;
  color: rgba(255, 255, 255, 0.82);
}

.drag-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(16, 35, 29, 0.42);
  backdrop-filter: blur(5px);
}

.drag-card {
  width: min(32rem, calc(100% - 2rem));
  padding: 2rem;
  border: 2px dashed rgba(255, 255, 255, 0.75);
  border-radius: 2rem;
  color: white;
  text-align: center;
  background: linear-gradient(180deg, rgba(232, 111, 61, 0.9), rgba(16, 35, 29, 0.96));
  box-shadow: var(--shadow);
}

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

  .sidebar {
    position: relative;
    height: auto;
  }

  .topbar,
  .drop-zone,
  .grid.two,
  .split {
    display: grid;
    grid-template-columns: 1fr;
  }
}
