:root {
  --ink: #101827;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f5f7fb;
  --card: #ffffff;
  --accent: #f97316;
  --accent-soft: rgba(249, 115, 22, 0.12);
  --blue: #0f3b57;
  --danger: #dc2626;
  --sidebar: #0b1723;
}

/* Base */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(135deg, #eef4f8, #f8fafc);
  font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  color: var(--ink);
}

a {
  color: inherit;
  text-decoration: none;
}

h1 {
  font-size: 34px;
  line-height: 1.1;
  margin: 0;
}

h2 {
  font-size: 20px;
  margin: 0;
}

small {
  color: var(--muted);
}

.hidden {
  display: none !important;
}

/* Layout */
.app-shell {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  width: 260px;
  background: var(--sidebar);
  color: #ffffff;
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
}

.main {
  margin-left: 260px;
  width: calc(100% - 260px);
  padding: 34px;
}

.auth-main {
  margin: 0;
  width: 100%;
  padding: 0;
}

/* Sidebar */
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 800;
  font-size: 20px;
}

.brand-mark {
  background: linear-gradient(135deg, var(--accent), #ffb86b);
  color: #111827;
  border-radius: 12px;
  padding: 9px 8px;
  font-size: 14px;
  box-shadow: 0 8px 24px #0003;
}

.sidebar nav {
  display: grid;
  gap: 8px;
  margin-top: 34px;
}

.sidebar nav a {
  padding: 12px 14px;
  border-radius: 12px;
  color: #dbeafe;
}

.sidebar nav a:hover {
  background: #1e293b;
}

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 12px;
  color: #cbd5e1;
}

.app-version {

  color: #94a3b8;

  font-weight: 700;

}



.muted-link {
  color: #fbbf24;
}

/* Page headings */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.12em;
  margin: 0 0 8px;
}

.subtle {
  color: var(--muted);
}

.tiny {
  font-size: 12px;
  color: var(--muted);
}

/* Cards and stats */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

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

.card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #ffffff;
  border-radius: 22px;
  box-shadow: 0 18px 45px #0f172a14;
  padding: 22px;
  margin-bottom: 18px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.highlight {
  background: linear-gradient(135deg, #0f3b57, #102638);
  color: #ffffff;
}

.highlight span {
  color: #bae6fd;
}

.stat-toggle-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
  gap: 6px;
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), #fb923c);
  border: 0;
  color: #111827;
  box-shadow: 0 12px 24px #f9731633;
}

.btn.small {
  padding: 7px 10px;
  font-size: 13px;
}

.btn.ghost {
  background: #f8fafc;
}

.btn.danger {
  color: #ffffff;
  background: var(--danger);
  border-color: var(--danger);
}

.btn.full {
  width: 100%;
}

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

.mini-toggle {
  border: 1px solid #d8e0ea;
  background: #ffffff;
  color: #0f172a;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.mini-toggle:hover {
  background: #f8fafc;
}

/* Costings list action buttons */
.list-edit-btn,
a[href*="/edit"].btn.small {
  background: #ff7a1a !important;
  color: #ffffff !important;
  border-color: #ff7a1a !important;
  font-weight: 900 !important;
  box-shadow: 0 8px 18px rgba(249, 115, 22, 0.22);
}

.list-print-btn,
a[href*="/print"].btn.small {
  background: #0f172a !important;
  color: #ffffff !important;
  border-color: #0f172a !important;
  font-weight: 900 !important;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.22);
}

.list-edit-btn:hover,
.list-print-btn:hover,
a[href*="/edit"].btn.small:hover,
a[href*="/print"].btn.small:hover {
  transform: translateY(-1px);
  opacity: 0.95;
}

/* Sections and tables */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 16px;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  padding: 13px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
}

/* Cleaner category labels */
.pill {
  display: inline-flex !important;
  align-items: center;
  gap: 7px;
  background: transparent !important;
  color: #334155 !important;
  border-radius: 0 !important;
  padding: 0 !important;
  font-size: 13px !important;
  font-weight: 900 !important;
}

.pill::before {
  content: "";
  width: 4px;
  height: 18px;
  border-radius: 999px;
  background: var(--accent);
  display: inline-block;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-grid.one {
  grid-template-columns: 1fr;
}

.span2 {
  grid-column: span 2;
}

label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 800;
  color: #334155;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 12px;
  font: inherit;
  background: #ffffff;
}

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

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.field-help {
  display: block;
  margin-top: -2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}

/* Grouped form sections */
.field-group,
.pricing-section {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 20px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fafc;
  margin-bottom: 18px;
}

.field-group + .field-group,
.pricing-section + .field-group,
.field-group + .pricing-section {
  margin-top: 18px;
}

.field-group-title {
  grid-column: span 2;
  font-size: 13px;
  font-weight: 900;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: -2px;
}

.field-group-note {
  grid-column: span 2;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  margin-top: -6px;
}

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

/* Search */
.search-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.search-row input {
  max-width: 420px;
}

/* Login */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, #fb923c33, transparent 30%),
    linear-gradient(135deg, #07111f, #102638);
}

.login-card {
  width: min(440px, 100%);
  background: #ffffff;
  border-radius: 28px;
  padding: 34px;
  box-shadow: 0 30px 80px #0005;
}

.login-brand {
  color: #111827;
  margin-bottom: 24px;
}

.alert {
  background: #fee2e2;
  color: #991b1b;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 14px;
}

.empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

/* Accordions */
.accordion-card {
  padding: 0 !important;
  overflow: hidden;
}

.accordion-summary {
  list-style: none;
  cursor: pointer;
  padding: 24px;
  font-size: 22px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.accordion-summary::-webkit-details-marker {
  display: none;
}

.accordion-summary::after {
  content: "›";
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  transition: transform 0.2s ease;
}

.accordion-card[open] .accordion-summary::after {
  transform: rotate(90deg);
}

.accordion-content {
  padding: 0 24px 24px;
}

.accordion-summary .subtle {
  font-size: 16px;
  font-weight: 500;
  margin-left: auto;
  margin-right: 20px;
}

/* Line item actions */
.table-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-form {
  display: inline;
}

.drag-handle {
  cursor: grab;
  color: var(--muted);
  font-size: 20px;
  width: 30px;
  text-align: center;
  user-select: none;
}

.line-item-row.dragging {
  opacity: 0.45;
  background: #f8fafc;
}

.sortable-table tr.line-item-row {
  transition: background 0.15s ease;
}

.sortable-table tr.line-item-row:hover {
  background: #f8fafc;
}

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.status-in-progress {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-completed {
  background: #dcfce7;
  color: #15803d;
}

.status-archived {
  background: #e5e7eb;
  color: #4b5563;
}

/* Print helper styles */
.print-actions {
  position: static !important;
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
}

.internal-badge {
  display: none !important;
}

@media print {
  .print-actions {
    display: none !important;
  }

  .internal-badge {
    display: block !important;
    background: #101828 !important;
    color: #ffffff !important;
    border-radius: 18px;
    padding: 14px 18px;
    font-size: 13px;
    line-height: 1.25;
    max-width: 190px;
    text-align: center;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* Highlight animations */
.form-highlight {
  animation: formPulse 1.4s ease;
}

@keyframes formPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.35);
  }

  45% {
    box-shadow: 0 0 0 10px rgba(249, 115, 22, 0.12);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(249, 115, 22, 0);
  }
}

.row-highlight {
  animation: rowPulse 1.8s ease;
}

@keyframes rowPulse {
  0% {
    background: rgba(249, 115, 22, 0.22);
    box-shadow: inset 4px 0 0 var(--accent);
  }

  50% {
    background: rgba(249, 115, 22, 0.10);
    box-shadow: inset 4px 0 0 var(--accent);
  }

  100% {
    background: transparent;
    box-shadow: inset 0 0 0 transparent;
  }
}

/* Mobile */
@media (max-width: 900px) {
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
  }

  .app-shell {
    display: block;
  }

  .main {
    margin: 0;
    width: 100%;
    padding: 18px;
  }

  .cards,
  .summary-cards,
  .form-grid,
  .field-group,
  .pricing-section {
    grid-template-columns: 1fr;
  }

  .span2,
  .field-group-title,
  .field-group-note,
  .field-group .span2 {
    grid-column: span 1;
  }

  .page-head {
    display: grid;
  }

  .actions,
  .section-head {
    flex-wrap: wrap;
  }

  .sidebar nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .sidebar-foot {
    display: none;
  }

  .accordion-summary {
    align-items: flex-start;
    gap: 12px;
  }

  .accordion-summary .subtle {
    display: none;
  }
}
