:root {
  --bg: #f5efe4;
  --panel: rgba(255, 252, 246, 0.88);
  --panel-strong: #fffaf0;
  --ink: #1f2933;
  --muted: #68707a;
  --line: rgba(31, 41, 51, 0.1);
  --brand: #0d5c63;
  --brand-2: #d08c60;
  --accent: #f2c14e;
  --danger: #b93838;
  --success: #2f7d59;
  --shadow: 0 24px 60px rgba(13, 92, 99, 0.12);
  --radius-xl: 28px;
  --radius-lg: 18px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(208, 140, 96, 0.28), transparent 30%),
    radial-gradient(circle at top right, rgba(13, 92, 99, 0.18), transparent 26%),
    linear-gradient(180deg, #f8f4eb 0%, #efe4d2 100%);
}

body {
  padding: 24px;
}

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

button {
  cursor: pointer;
  border: none;
  border-radius: 999px;
  background: var(--brand);
  color: white;
  padding: 12px 18px;
  font-weight: 700;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(13, 92, 99, 0.16);
}

button.secondary {
  background: rgba(13, 92, 99, 0.1);
  color: var(--brand);
}

button.warn {
  background: var(--danger);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.layout {
  max-width: 1450px;
  margin: 0 auto;
}

.login-shell,
.app-shell {
  display: grid;
  gap: 22px;
}

.login-shell {
  min-height: calc(100vh - 48px);
  align-items: center;
}

.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
}

.card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  border-radius: var(--radius-xl);
  padding: 28px;
}

.brand-panel {
  position: relative;
  overflow: hidden;
  min-height: 560px;
}

.brand-panel::before,
.brand-panel::after {
  content: "";
  position: absolute;
  inset: auto;
  border-radius: 50%;
  filter: blur(10px);
}

.brand-panel::before {
  width: 320px;
  height: 320px;
  right: -60px;
  top: -80px;
  background: rgba(13, 92, 99, 0.12);
}

.brand-panel::after {
  width: 220px;
  height: 220px;
  left: -70px;
  bottom: -70px;
  background: rgba(242, 193, 78, 0.2);
}

.eyebrow {
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--brand);
  margin-bottom: 14px;
}

h1, h2, h3 {
  font-family: "Space Grotesk", sans-serif;
  margin: 0;
}

h1 {
  font-size: clamp(2.3rem, 4vw, 4.6rem);
  line-height: 0.95;
  max-width: 9ch;
}

.lead {
  max-width: 62ch;
  color: var(--muted);
  line-height: 1.7;
  margin-top: 16px;
}

.metric-strip {
  margin-top: 26px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric-tile {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(13, 92, 99, 0.09);
}

.metric-tile strong {
  display: block;
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.login-panel {
  align-self: center;
}

.stack {
  display: grid;
  gap: 16px;
}

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

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

label {
  display: grid;
  gap: 8px;
  font-size: 0.93rem;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  padding: 12px 14px;
  color: var(--ink);
  outline: none;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(13, 92, 99, 0.36);
  box-shadow: 0 0 0 4px rgba(13, 92, 99, 0.09);
}

.hint,
.muted {
  color: var(--muted);
  font-size: 0.92rem;
}

.demo-users {
  margin-top: 6px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: rgba(13, 92, 99, 0.07);
  display: grid;
  gap: 8px;
}

.demo-user-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.92rem;
}

.suggestion-list,
.permissions-grid {
  display: grid;
  gap: 10px;
}

.autocomplete {
  position: relative;
}

.suggestion-list.dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 280px;
  overflow-y: auto;
  padding: 10px;
  border-radius: 18px;
  background: rgba(255, 250, 240, 0.98);
  border: 1px solid var(--line);
  box-shadow: 0 18px 30px rgba(31, 41, 51, 0.12);
}

.suggestion-list.dropdown.open {
  display: grid;
}

.suggestion-item {
  width: 100%;
  text-align: left;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 12px 14px;
}

.suggestion-item strong,
.suggestion-item span {
  display: block;
}

.suggestion-item span {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.permission-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(13, 92, 99, 0.05);
  border: 1px solid rgba(13, 92, 99, 0.08);
}

.permission-item input {
  width: auto;
}

.pagination {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(31, 41, 51, 0.35);
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-card {
  width: min(720px, 100%);
  background: var(--panel-strong);
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(31, 41, 51, 0.25);
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.modal-card-wide {
  width: min(1200px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.bill-editor-form {
  gap: 18px;
}

.bill-item-list {
  display: grid;
  gap: 16px;
}

.bill-item-row {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.58);
}

.app-shell {
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 18px;
  overflow-y: auto;
  padding-right: 6px;
}

.brand-mini {
  padding: 22px;
}

.brand-mini h2 {
  font-size: 1.2rem;
  margin-top: 8px;
}

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

.nav-item {
  width: 100%;
  text-align: left;
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.42);
  color: var(--ink);
  border: 1px solid transparent;
}

.nav-item.active {
  background: linear-gradient(135deg, var(--brand), #083f43);
  color: white;
  border-color: rgba(255, 255, 255, 0.3);
}

.workspace {
  display: grid;
  gap: 22px;
}

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

.topbar h1 {
  max-width: none;
  font-size: clamp(1.7rem, 2vw, 2.6rem);
  line-height: 1;
}

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

.summary-grid,
.dashboard-grid,
.form-grid,
.report-grid,
.list-grid {
  display: grid;
  gap: 18px;
}

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

.summary-card {
  padding: 22px;
  border-radius: var(--radius-xl);
  color: white;
  background: linear-gradient(145deg, rgba(13, 92, 99, 0.96), rgba(8, 63, 67, 0.95));
  min-height: 148px;
}

.summary-card:nth-child(2) {
  background: linear-gradient(145deg, rgba(208, 140, 96, 0.98), rgba(165, 102, 56, 0.96));
}

.summary-card:nth-child(3) {
  background: linear-gradient(145deg, rgba(47, 125, 89, 0.96), rgba(30, 92, 63, 0.96));
}

.summary-card:nth-child(4) {
  background: linear-gradient(145deg, rgba(77, 94, 125, 0.95), rgba(44, 57, 80, 0.95));
}

.summary-card strong {
  display: block;
  font-size: 2.3rem;
  margin: 20px 0 8px;
}

.dashboard-grid {
  grid-template-columns: 1.05fr 0.95fr;
}

.form-grid {
  grid-template-columns: 1.05fr 0.95fr;
}

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

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

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.section-title h3 {
  font-size: 1.2rem;
}

.pill-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(13, 92, 99, 0.08);
  color: var(--brand);
  font-weight: 700;
  font-size: 0.85rem;
}

.status {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(13, 92, 99, 0.08);
  font-size: 0.84rem;
  font-weight: 700;
}

.status.Rejected,
.status.Overdue {
  background: rgba(185, 56, 56, 0.12);
  color: var(--danger);
}

.status.Rework {
  background: rgba(242, 193, 78, 0.2);
  color: #8f6600;
}

.status.Delivered,
.status.Approved,
.status.Packed {
  background: rgba(47, 125, 89, 0.14);
  color: var(--success);
}

.status.Assigned,
.status.Checked,
.status.Stitched {
  background: rgba(13, 92, 99, 0.11);
  color: var(--brand);
}

.status.Received {
  background: rgba(208, 140, 96, 0.16);
  color: #8c5d37;
}

.order-list,
.timeline,
.report-list,
.user-list {
  display: grid;
  gap: 14px;
}

.order-card,
.timeline-item,
.report-item,
.user-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
}

.order-head,
.item-row,
.timeline-head,
.report-head,
.user-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.order-meta,
.order-actions,
.inline-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.order-actions button,
.inline-actions button {
  padding: 9px 14px;
}

.subbill-list {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.subbill-item {
  padding: 12px;
  border-radius: 14px;
  background: rgba(13, 92, 99, 0.05);
  border: 1px solid rgba(13, 92, 99, 0.08);
}

.history-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.tracking-summary,
.stage-line {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.stage-chip {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(13, 92, 99, 0.06);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.stage-chip.done {
  background: rgba(47, 125, 89, 0.14);
  color: var(--success);
}

.history-details {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.history-detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(13, 92, 99, 0.05);
}

.history-json {
  margin: 8px 0 0;
  padding: 12px;
  border-radius: 14px;
  background: rgba(13, 92, 99, 0.05);
  font-size: 0.82rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

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

.status-deck {
  display: grid;
  gap: 14px;
}

.status-stage {
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(13, 92, 99, 0.08);
  background: rgba(255, 255, 255, 0.6);
}

.status-stage-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.status-stage-head h4 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

.status-stage-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.status-bill-card {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: white;
}

.status-bill-card strong {
  display: block;
  overflow-wrap: anywhere;
}

.kanban-column {
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(13, 92, 99, 0.08);
  min-height: 260px;
}

.kanban-column h4 {
  margin: 0 0 12px;
  font-family: "Space Grotesk", sans-serif;
}

.kanban-item {
  padding: 12px;
  border-radius: 14px;
  background: white;
  border: 1px solid var(--line);
  margin-bottom: 10px;
}

.search-bar {
  display: grid;
  grid-template-columns: 1.2fr repeat(3, minmax(0, 1fr));
  gap: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}

th {
  color: var(--muted);
  font-weight: 700;
}

.empty {
  padding: 26px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed rgba(13, 92, 99, 0.2);
  border-radius: var(--radius-lg);
}

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

.danger-text {
  color: var(--danger);
}

.print-note {
  padding: 14px 16px;
  background: rgba(242, 193, 78, 0.18);
  border-radius: 16px;
  color: #7d5c00;
}

.flash-banner {
  padding: 14px 18px;
  border-radius: 16px;
  background: rgba(47, 125, 89, 0.14);
  color: var(--success);
  border: 1px solid rgba(47, 125, 89, 0.2);
  font-weight: 700;
}

.sidebar-credit {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 0.88rem;
  line-height: 1.5;
}

.sidebar-credit a {
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
}

.sidebar-credit a:hover {
  text-decoration: underline;
}

@media (max-width: 1220px) {
  .app-shell,
  .hero,
  .dashboard-grid,
  .form-grid,
  .report-grid,
  .list-grid,
  .field-grid,
  .summary-grid,
  .search-bar,
  .split,
  .kanban {
    grid-template-columns: 1fr;
  }

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

@media print {
  body {
    padding: 0;
    background: white;
  }

  .sidebar,
  .topbar-actions,
  .nav-list,
  button {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .card,
  .summary-card,
  .order-card,
  .report-item {
    box-shadow: none;
    border: 1px solid #ddd;
    background: white;
  }
}
