:root {
  --bg: #0e1013;
  --bg-soft: rgba(18, 20, 25, 0.82);
  --card: rgba(30, 34, 43, 0.88);
  --card-strong: #20242d;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f6f3ed;
  --muted: rgba(246, 243, 237, 0.68);
  --accent: #f3864a;
  --accent-soft: rgba(243, 134, 74, 0.16);
  --blue: #6cb4ff;
  --green: #57d18b;
  --yellow: #f1c65d;
  --red: #ff7373;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --radius-xs: 10px;
  --font-sans: "Avenir Next", "SF Pro Display", "Segoe UI", sans-serif;
  --font-mono: "SF Mono", "Menlo", "Consolas", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(243, 134, 74, 0.16), transparent 36%),
    radial-gradient(circle at top right, rgba(108, 180, 255, 0.14), transparent 28%),
    linear-gradient(180deg, #11141a 0%, #090b0f 100%);
  color: var(--text);
  font-family: var(--font-sans);
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.ambient {
  position: fixed;
  inset: auto;
  width: 34rem;
  height: 34rem;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.18;
  pointer-events: none;
}

.ambient-one {
  top: -8rem;
  right: -6rem;
  background: #f3864a;
}

.ambient-two {
  bottom: -10rem;
  left: -8rem;
  background: #5b86ff;
}

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

.login-card,
.table-card,
.drawer,
.modal,
.stats-card {
  backdrop-filter: blur(18px);
}

.login-card {
  width: min(34rem, 100%);
  padding: 2.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-soft);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 0.77rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.04;
  letter-spacing: -0.04em;
}

.lead,
.subtle-copy {
  color: var(--muted);
  line-height: 1.6;
}

.lead {
  margin-top: 1rem;
}

.login-form {
  margin-top: 2rem;
  display: grid;
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.5rem;
}

.field span {
  font-size: 0.88rem;
  color: var(--muted);
}

.field input,
.field select,
.field textarea,
.search-field input {
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  outline: none;
  transition: border-color 120ms ease, transform 120ms ease, background 120ms ease;
}

.field textarea {
  resize: vertical;
  min-height: 6.5rem;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-field input:focus {
  border-color: rgba(243, 134, 74, 0.72);
  background: rgba(255, 255, 255, 0.05);
}

.primary-button,
.secondary-button,
.circle-button,
.upload-button,
.pill,
.tab,
.icon-close {
  border: 1px solid transparent;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    background 120ms ease,
    color 120ms ease,
    opacity 120ms ease;
}

.primary-button {
  padding: 0.95rem 1.15rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #f59a65, #f3864a);
  color: #20120b;
  font-weight: 800;
}

.primary-button:hover,
.secondary-button:hover,
.circle-button:hover,
.upload-button:hover,
.pill:hover,
.tab:hover,
.icon-close:hover {
  transform: translateY(-1px);
}

.secondary-button,
.upload-button {
  padding: 0.82rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line);
  color: var(--text);
}

.secondary-button.small {
  padding: 0.55rem 0.8rem;
  font-size: 0.9rem;
}

.circle-button {
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59a65, #f3864a);
  color: #1f120b;
  font-size: 1.5rem;
  font-weight: 700;
}

.form-error {
  min-height: 1.2rem;
  color: #ffb6b6;
  font-size: 0.9rem;
}

.shell {
  position: relative;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.4rem;
  background: rgba(12, 14, 18, 0.82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand span {
  color: var(--accent);
}

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

.tab-group {
  display: inline-flex;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.tab {
  padding: 0.62rem 0.95rem;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.tab.active {
  background: rgba(255, 255, 255, 0.92);
  color: #171a20;
}

.page {
  width: min(1160px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1.4rem;
  align-items: end;
}

.hero h2 {
  margin-top: 0.4rem;
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.role-badge {
  display: inline-flex;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #ffd2ba;
  font-size: 0.83rem;
  font-weight: 700;
}

.search-field {
  display: grid;
  gap: 0.5rem;
}

.search-field span {
  color: var(--muted);
  font-size: 0.88rem;
}

.stats-grid {
  margin-top: 1.6rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.stats-card {
  padding: 1.1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--card);
}

.stats-card p {
  color: var(--muted);
  font-size: 0.88rem;
}

.stats-card strong {
  display: block;
  margin-top: 0.5rem;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  letter-spacing: -0.04em;
}

.filter-row {
  margin-top: 1.5rem;
}

.pill-group {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.pill {
  padding: 0.6rem 0.95rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line);
  color: var(--muted);
}

.pill.active {
  background: rgba(243, 134, 74, 0.18);
  border-color: rgba(243, 134, 74, 0.36);
  color: #ffd8c5;
}

.table-card,
.drawer,
.modal {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.table-card {
  margin-top: 1.2rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-head,
.drawer-head,
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  padding: 1.3rem 1.3rem 0;
}

.card-head h3,
.drawer-head h3,
.modal-head h3 {
  font-size: 1.55rem;
  letter-spacing: -0.04em;
}

.table-wrap {
  overflow: auto;
  padding: 1rem 1.3rem 1.3rem;
}

.records-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.records-table th,
.records-table td {
  padding: 0.95rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.records-table thead th {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.records-table tbody tr {
  cursor: pointer;
}

.records-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.88rem;
}

.status-chip,
.priority-chip,
.doc-chip,
.tiny-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.status-chip.in_transit {
  background: rgba(108, 180, 255, 0.15);
  color: #bee0ff;
}

.status-chip.delivered {
  background: rgba(87, 209, 139, 0.16);
  color: #c5f6d8;
}

.status-chip.pending {
  background: rgba(241, 198, 93, 0.16);
  color: #ffe1a1;
}

.priority-chip.urgent {
  background: rgba(255, 115, 115, 0.14);
  color: #ffc3c3;
}

.priority-chip.normal {
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.54);
  backdrop-filter: blur(4px);
}

.drawer,
.modal {
  position: fixed;
  z-index: 50;
}

.drawer {
  top: 1rem;
  right: 1rem;
  bottom: 1rem;
  width: min(31rem, calc(100vw - 1.5rem));
  border-radius: 1.8rem;
  overflow: auto;
}

.drawer-content,
.modal-body {
  padding: 1.3rem;
}

.drawer-section {
  display: grid;
  gap: 0.8rem;
  margin-bottom: 1.3rem;
}

.drawer-row {
  display: grid;
  gap: 0.25rem;
}

.drawer-row label {
  color: var(--muted);
  font-size: 0.85rem;
}

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.2rem;
}

.icon-close {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line);
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
}

.modal {
  inset: 50% auto auto 50%;
  width: min(58rem, calc(100vw - 1.5rem));
  max-height: calc(100vh - 2rem);
  transform: translate(-50%, -50%);
  border-radius: 1.8rem;
  overflow: auto;
}

.form-grid {
  display: grid;
  gap: 1rem;
}

.four-up {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.two-up {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.section-block + .section-block {
  margin-top: 1.4rem;
}

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

.section-head h4 {
  font-size: 1.1rem;
}

.items-editor {
  display: grid;
  gap: 0.8rem;
}

.item-row {
  display: grid;
  grid-template-columns: 1.05fr 1.6fr 0.7fr 0.7fr auto;
  gap: 0.7rem;
  padding: 0.8rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}

.item-row button {
  align-self: center;
}

.upload-button {
  position: relative;
  overflow: hidden;
}

.upload-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.documents-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.doc-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--text);
}

.doc-chip button {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.8rem;
  margin-top: 1.7rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.4rem;
  transform: translateX(-50%);
  z-index: 60;
  padding: 0.85rem 1rem;
  border-radius: 999px;
  background: rgba(17, 19, 24, 0.95);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}

@media (max-width: 960px) {
  .hero,
  .stats-grid,
  .four-up,
  .three-up,
  .two-up,
  .item-row {
    grid-template-columns: 1fr;
  }

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

  .topbar-actions {
    justify-content: space-between;
    row-gap: 0.6rem;
    align-items: stretch;
  }

  .tab-group {
    width: 100%;
  }

  .tab {
    flex: 1;
    text-align: center;
  }

  .page {
    width: min(100% - 1rem, 100%);
  }

  .drawer {
    inset: auto 0 0 0;
    width: auto;
    height: min(82vh, 45rem);
    border-radius: 1.4rem 1.4rem 0 0;
  }
}
