/* ========================================================
   AOA TAILORING - MASTER STYLESHEET
   Pure CSS - Tailoring Atelier Aesthetic
   Color Palette:
   - Primary Deep Atelier Green: #002B2C
   - Secondary Tailor Gold: #D6AA55
   - Neutral Warm Canvas: #F8F7F3
   - Surface White: #FFFFFF
   - Border Stone: #E7E5E4
   - Text Stone: #1C1917, #57534E, #78716C
   ======================================================== */

:root {
  --color-primary: #173b3b;
  --color-primary-light: #285454;
  --color-primary-dark: #102d2d;
  --color-gold: #a7834f;
  --color-gold-light: #efe7d8;
  --color-gold-dark: #806236;
  --color-bg: #F8F7F3;
  --color-surface: #ffffff;
  --color-surface-alt: #f3f3f6;
  --color-border: #e3e3e8;
  --color-border-strong: #d4d4dc;
  --color-text-main: #33333d;
  --color-text-muted: #686875;
  --color-text-light: #92929d;
  --page-gutter: clamp(1rem, 2vw, 1.75rem);
  --page-shell: 1500px;
  --font-serif: "Segoe UI", Arial, sans-serif;
  --font-sans: "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: linear-gradient(180deg, #f7f1ea 0%, #f1ece6 100%);
  color: var(--color-text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.015em;
}

.login-page {
  align-items: flex-start;
  padding-top: 3rem;
  background:
    radial-gradient(circle at top, rgba(181, 138, 77, 0.12), transparent 32%),
    linear-gradient(180deg, #f9f5f0 0%, #f1ece6 100%);
}

body,
.font-sans,
button,
input,
select,
textarea,
.btn,
.nav-link,
.form-label,
.form-input,
.form-select,
.form-textarea,
.badge,
.table-container,
table,
th,
td,
span,
label,
a,
small,
strong {
  font-family: var(--font-sans);
}

h1, h2, h3, h4,
.font-serif,
.card-title,
.stat-value,
.sidebar-brand-name {
  font-family: var(--font-serif);
  letter-spacing: -0.03em;
  font-weight: 700;
  color: var(--color-primary);
}

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

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

.sidebar {
  width: 260px;
  background: linear-gradient(180deg, #faf7f3 0%, #f5f0ea 100%);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  transition: transform 0.25s ease-in-out;
  box-shadow: 6px 0 18px rgba(27, 42, 42, 0.03);
}

.main-content {
  flex: 1;
  margin-left: 260px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

@media (max-width: 1023px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 35;
}

.sidebar-overlay.active {
  display: block;
}

/* Top Navigation Bar */
.top-nav {
  height: 64px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 20;
}

/* Content Area */
.page-body {
  padding: var(--page-gutter);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.page-body > * {
  width: min(100%, var(--page-shell));
  margin-left: auto;
  margin-right: auto;
}

.page-body > .max-w-3xl,
.page-body > .max-w-5xl,
.page-body > .max-w-6xl,
.page-body > .max-w-7xl,
.page-body > form,
.page-body > .space-y-6,
.page-body > .mx-auto {
  width: min(100%, var(--page-shell));
}

@media (min-width: 768px) {
  .page-body {
    padding: 1.75rem 2rem 2rem;
  }
}

/* Navigation Links */
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 0.9rem;
  border-radius: 0.8rem;
  color: var(--color-text-muted);
  font-size: 0.94rem;
  font-weight: 600;
  transition: all 0.15s ease;
  margin-bottom: 0.3rem;
}

.nav-link:hover {
  background-color: rgba(27, 42, 42, 0.04);
  color: var(--color-primary);
}

.nav-link.active {
  background: linear-gradient(135deg, #eef4f1 0%, #edf0ee 100%);
  color: var(--color-primary);
  font-weight: 700;
  border: 1px solid rgba(27, 42, 42, 0.07);
}

.nav-link.active svg {
  color: var(--color-primary);
}

.nav-header {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--color-text-light);
  padding: 1.1rem 0.9rem 0.5rem 0.9rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 700;
  border-radius: 0.8rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.btn-primary {
  background: linear-gradient(135deg, #1d2d2d 0%, #203333 100%);
  color: #FFFFFF;
  box-shadow: 0 8px 18px rgba(27, 42, 42, 0.12);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #152525 0%, #1c2d2d 100%);
}

.btn-gold {
  background: linear-gradient(135deg, #d5b170 0%, #b58a4d 100%);
  color: #FFFFFF;
}

.btn-gold:hover {
  background: linear-gradient(135deg, #c7a264 0%, #a57d3f 100%);
}

.btn-secondary {
  background-color: #FFFFFF;
  color: var(--color-text-main);
  border-color: var(--color-border-strong);
}

.btn-secondary:hover {
  background-color: #f7f3ee;
}

.btn-danger {
  background-color: #fce8e7;
  color: #8f2d2d;
  border-color: #eec7c5;
}

.btn-danger:hover {
  background-color: #f9d3d1;
}

.btn-sm {
  padding: 0.45rem 0.8rem;
  font-size: 0.8125rem;
  border-radius: 0.6rem;
}

/* Cards & Containers */
.card {
  background: linear-gradient(180deg, #fffdfb 0%, #fffaf5 100%);
  border: 1px solid #e8e0d7;
  border-radius: 1rem;
  box-shadow: 0 8px 18px rgba(27, 23, 18, 0.025);
  padding: 1.4rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid #efe7df;
}

.card-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.02em;
}

/* Form Controls */
.form-group {
  margin-bottom: 1.1rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-main);
  margin-bottom: 0.4rem;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.72rem 0.9rem;
  font-size: 0.9rem;
  border-radius: 0.8rem;
  border: 1px solid var(--color-border-strong);
  background-color: #fffdfb;
  color: var(--color-text-main);
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

label + .form-input,
label + .form-select,
label + .form-textarea {
  margin-top: 0;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: rgba(27, 42, 42, 0.48);
  box-shadow: 0 0 0 3px rgba(27, 42, 42, 0.08);
}

.form-input-number {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* Tables */
.table-container {
  overflow-x: auto;
  border-radius: 0.8rem;
  border: 1px solid var(--color-border);
  background: #FFFFFF;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

table.data-table th {
  background-color: #f5f1eb;
  padding: 0.8rem 1rem;
  font-weight: 700;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

table.data-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #f1ece7;
  vertical-align: middle;
}

table.data-table tbody tr:hover {
  background-color: #faf7f3;
}

table.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.7rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-active, .badge-completed {
  background-color: #edf4ef;
  color: #1c4a3d;
  border: 1px solid #cfe2d7;
}

.badge-inactive, .badge-draft {
  background-color: #f7f1e8;
  color: #775827;
  border: 1px solid #e8d7b0;
}

.badge-locked {
  background-color: #f7ecea;
  color: #7c2d2d;
  border: 1px solid #e7c7c6;
}

/* Stat Card */
.stat-card {
  background: linear-gradient(180deg, #fffdfb 0%, #f7f3ef 100%);
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  padding: 1.1rem 1.15rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 2px 8px rgba(27, 42, 42, 0.02);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 0.8rem;
  background: linear-gradient(135deg, #f2f7f5 0%, #efefe9 100%);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-value {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.1;
}

.stat-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

/* Measurement Spec Grid */
.spec-section-header {
  background: linear-gradient(180deg, #f8f4ee 0%, #f2eee8 100%);
  color: var(--color-primary);
  padding: 0.7rem 0.9rem;
  font-weight: 700;
  font-size: 14px;
  border-radius: 0.65rem;
  border: 1px solid #e7dfd4;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.spec-item {
  background: linear-gradient(180deg, #faf8f5 0%, #f6f2ee 100%);
  border: 1px solid #e9e1d6;
  border-radius: 0.72rem;
  padding: 0.8rem 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.spec-name {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.spec-val {
  font-family: var(--font-sans);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-primary);
}

.signature-columns {
  display: flex;
  width: 100%;
}

.signature-column {
  flex: 0 0 50%;
  text-align: center;
  padding: 0 8px;
}

/* Print Specification Sheet */
@media print {
  @page {
    margin: 12mm;
  }

  body {
    background: #FFFFFF !important;
    color: #000000 !important;
    font-size: 10pt;
  }
  .sidebar, .top-nav, .no-print, .btn, .flash-message, footer {
    display: none !important;
  }
  .main-content {
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
  }
  .page-body {
    padding: 0 !important;
    display: block !important;
  }
  .page-body > * {
    width: 100% !important;
    max-width: none !important;
  }
  .card {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  .table-container {
    overflow: visible !important;
    border-radius: 0 !important;
  }
  table.data-table {
    table-layout: fixed;
  }
  table.data-table th:nth-child(1),
  table.data-table td:nth-child(1) {
    width: 40%;
  }
  table.data-table th:nth-child(n+2),
  table.data-table td:nth-child(n+2) {
    width: 15%;
  }
  table.data-table th,
  table.data-table td {
    padding: 5px 6px !important;
    font-size: 8.5pt !important;
  }
  table.data-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .spec-section-header {
    break-after: avoid;
    page-break-after: avoid;
  }
  .signature-block {
    break-inside: avoid;
    page-break-inside: avoid;
    margin-top: 1.5rem !important;
    padding-top: 1rem !important;
  }
  .signature-columns {
    display: flex !important;
    width: 100% !important;
    flex-direction: row !important;
    align-items: flex-start !important;
  }
  .signature-column {
    display: block !important;
    flex: 0 0 50% !important;
    width: 50% !important;
    max-width: 50% !important;
    box-sizing: border-box !important;
    text-align: center !important;
    padding: 0 8px !important;
  }
  .print-header {
    border-bottom: 2px solid #000;
    padding-bottom: 10px;
    margin-bottom: 20px;
  }
  .print-table {
    width: 100%;
    border-collapse: collapse;
  }
  .print-table th, .print-table td {
    border: 1px solid #ccc;
    padding: 6px 8px;
    font-size: 10pt;
  }
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 50;
  visibility: hidden;
  opacity: 0;
  transition: all 0.2s ease;
}

.modal-backdrop.active {
  visibility: visible;
  opacity: 1;
}

.modal-box {
  background: #FFFFFF;
  border-radius: 1rem;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
}

/* Utility Helpers */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gap-1\.5 { gap: 0.375rem; }
@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .md\:flex-row { flex-direction: row; }
}
.w-full { width: 100%; }
.w-16 { width: 4rem; }
.h-16 { height: 4rem; }
.min-h-screen { min-height: 100vh; }
.max-w-md { max-width: 28rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-6xl { max-width: 72rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.p-2 { padding: 0.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.p-8 { padding: 2rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.pt-6 { padding-top: 1.5rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.border { border-width: 1px; border-style: solid; }
.border-stone-100 { border-color: #F5F5F4; }
.border-stone-200 { border-color: var(--color-border); }
.bg-white { background-color: #FFFFFF; }
.bg-stone-50 { background-color: #FAFAF9; }
.object-contain { object-fit: contain; }
.shadow-sm { box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.08); }
.font-serif { font-family: var(--font-serif); }
.tracking-wide { letter-spacing: 0.025em; }
.tracking-wider { letter-spacing: 0.05em; }
.uppercase { text-transform: uppercase; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-stone-400 { color: #A8A29E; }
.text-stone-500 { color: #78716C; }
.text-stone-600 { color: #57534E; }
.text-stone-700 { color: #44403C; }
.text-stone-800 { color: #292524; }
.text-stone-900 { color: #1C1917; }
.text-white { color: #FFFFFF; }
.text-rose-500 { color: #EF4444; }
.text-rose-600 { color: #E11D48; }
.text-amber-600 { color: #D97706; }
.text-amber-900 { color: #78350F; }
.text-emerald-600 { color: #059669; }
.text-purple-800 { color: #6B21A8; }
.text-sky-600 { color: #0284C7; }
.text-\[\#002B2C\] { color: var(--color-primary); }
.text-\[\#D6AA55\] { color: var(--color-gold); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.font-normal { font-weight: 400; }
.font-sans { font-family: var(--font-sans); }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace; }
.text-primary { color: var(--color-primary); }
.text-gold { color: var(--color-gold); }
.text-muted { color: var(--color-text-muted); }

.hidden { display: none !important; }
.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }
.inline-flex { display: inline-flex; }
.flex-1 { flex: 1 1 0%; }
.flex-wrap { flex-wrap: wrap; }
.flex-shrink-0 { flex-shrink: 0; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }

.w-1\/3 { width: 33.333333%; }
.w-1\/4 { width: 25%; }
.w-1\/5 { width: 20%; }
.w-1\/6 { width: 16.666667%; }
.w-2 { width: 0.5rem; }
.w-2\/5 { width: 40%; }
.w-3\.5 { width: 0.875rem; }
.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-6 { width: 1.5rem; }
.w-8 { width: 2rem; }
.w-9 { width: 2.25rem; }
.w-10 { width: 2.5rem; }
.w-12 { width: 3rem; }
.w-14 { width: 3.5rem; }
.h-2 { height: 0.5rem; }
.h-3\.5 { height: 0.875rem; }
.h-4 { height: 1rem; }
.h-5 { height: 1.25rem; }
.h-6 { height: 1.5rem; }
.h-8 { height: 2rem; }
.h-9 { height: 2.25rem; }
.h-10 { height: 2.5rem; }
.h-12 { height: 3rem; }
.h-14 { height: 3.5rem; }
.h-20 { height: 5rem; }
.bg-\[\#002B2C\] { background-color: var(--color-primary); }
.bg-\[\#D6AA55\] { background-color: var(--color-gold); }
.bg-\[\#F2F7F7\] { background-color: #F2F7F7; }
.bg-\[\#F8F7F3\] { background-color: var(--color-bg); }
.bg-amber-50 { background-color: #FFFBEB; }
.bg-amber-100 { background-color: #FEF3C7; }
.bg-amber-50\/30 { background-color: rgba(255, 251, 235, 0.3); }
.bg-amber-50\/50 { background-color: rgba(255, 251, 235, 0.5); }
.bg-purple-100 { background-color: #F3E8FF; }
.bg-rose-50 { background-color: #FFF1F2; }
.bg-stone-100 { background-color: #F5F5F4; }
.bg-stone-50\/50 { background-color: rgba(250, 250, 249, 0.5); }
.bg-stone-50 { background-color: #FAFAF9; }
.border-0 { border-width: 0; }
.border { border-width: 1px; border-style: solid; }
.border-b { border-bottom-width: 1px; border-bottom-style: solid; }
.border-b-2 { border-bottom-width: 2px; border-bottom-style: solid; }
.border-t { border-top-width: 1px; border-top-style: solid; }
.border-dashed { border-style: dashed; }
.border-amber-200 { border-color: #FCD34D; }
.border-amber-200\/70 { border-color: rgba(252, 211, 77, 0.7); }
.border-amber-300 { border-color: #FCD34D; }
.border-\[\#002B2C\] { border-color: var(--color-primary); }
.border-\[\#002B2C\]\/20 { border-color: rgba(0, 43, 44, 0.2); }
.border-\[\#002B2C\]\/30 { border-color: rgba(0, 43, 44, 0.3); }
.border-stone-200\/80 { border-color: rgba(231, 229, 228, 0.8); }
.border-stone-300 { border-color: #D6D3D1; }
.rounded { border-radius: 0.25rem; }
.rounded-full { border-radius: 9999px; }
.rounded-lg { border-radius: 0.5rem; }
.shadow-2xs { box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); }

.hover\:bg-\[#003b3d\]:hover { background-color: #003b3d; }
.hover\:bg-stone-100:hover { background-color: #F5F5F4; }
.hover\:bg-stone-200:hover { background-color: #E7E5E4; }
.hover\:bg-stone-50:hover { background-color: #FAFAF9; }
.hover\:border-\[#002B2C\]:hover { border-color: var(--color-primary); }
.hover\:border-stone-300:hover { border-color: #D6D3D1; }
.hover\:text-\[#002B2C\]:hover { color: var(--color-primary); }
.hover\:text-rose-800:hover { color: #9F1239; }
.hover\:text-stone-600:hover { color: #57534E; }
.hover\:text-stone-700:hover { color: #44403C; }
.hover\:text-stone-800:hover { color: #292524; }
.hover\:underline:hover { text-decoration: underline; }

.text-\[10px\] { font-size: 10px; }
.text-\[11px\] { font-size: 11px; }
.text-base { font-size: 1rem; }
.text-\[10px\] { font-size: 10px; }
.text-\[11px\] { font-size: 11px; }

.max-w-3xl { max-width: 48rem; }
.max-w-5xl { max-width: 64rem; }
.max-w-xs { max-width: 20rem; }

.top-full { top: 100%; }
.tracking-widest { letter-spacing: 0.2em; }

@media (min-width: 640px) {
  .sm\:block { display: block; }
  .sm\:flex-row { flex-direction: row; }
  .sm\:items-center { align-items: center; }
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sm\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sm\:w-48 { width: 12rem; }
}

@media (min-width: 768px) {
  .md\:col-span-1 { grid-column: span 1 / span 1; }
  .md\:col-span-2 { grid-column: span 2 / span 2; }
  .md\:col-span-3 { grid-column: span 3 / span 3; }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .md\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .md\:flex-row { flex-direction: row; }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lg\:hidden { display: none; }
}

.p-0 { padding: 0; }
.p-2\.5 { padding: 0.625rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }

.text-stone-300 { color: #D6D3D1; }

/* Shared admin interface: restrained, compact and data-first */
body {
  background: #F8F7F3;
  color: #33333d;
  letter-spacing: 0;
}

h1, h2, h3, h4,
.font-serif,
.card-title,
.stat-value,
.sidebar-brand-name {
  font-family: var(--font-sans);
  letter-spacing: -0.015em;
}

h1 {
  font-size: 1.35rem !important;
  font-weight: 600 !important;
}

.app-container {
  background: #F8F7F3;
}

.sidebar {
  width: 255px;
  background: #fff;
  border-right: 1px solid #e5e5e9;
  box-shadow: none;
}

.sidebar > div:first-child {
  min-height: 96px;
  padding: 1rem 1.25rem;
  background: #fff;
  border-bottom-color: #ececf0;
}

.sidebar > div:nth-child(3) {
  padding: 0.8rem 0.65rem;
}

.main-content {
  margin-left: 255px;
}

.top-nav {
  height: 62px;
  margin: 14px 18px 0;
  padding: 0 1rem;
  border: 1px solid #e4e4e9;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 2px 5px rgba(35, 35, 48, 0.09);
  backdrop-filter: none;
}

.top-nav-greeting {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  color: #777783;
  font-size: 0.86rem;
}

.top-nav-greeting strong {
  color: #555560;
  font-weight: 600;
}

.top-nav-company {
  margin-left: 0.35rem;
  color: #a0a0a9;
  font-size: 0.75rem;
}

.top-nav-avatar {
  display: flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 700;
}

.page-body {
  padding: 1rem 18px 1.5rem;
  gap: 0.9rem;
}

.page-body > * {
  width: min(100%, var(--page-shell));
}

.page-body > .max-w-3xl,
.page-body > .max-w-4xl,
.page-body > .max-w-5xl,
.page-body > .max-w-6xl,
.page-body > .max-w-7xl,
.page-body > form,
.page-body > .space-y-6,
.page-body > .mx-auto {
  max-width: min(100%, var(--page-shell));
}

.nav-header {
  padding: 0.8rem 0.65rem 0.4rem;
  color: #8a8a95;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.045em;
}

.nav-link {
  min-height: 38px;
  margin-bottom: 0.16rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid transparent;
  border-radius: 5px;
  color: #73737e;
  font-size: 0.88rem;
  font-weight: 400;
}

.nav-link:hover {
  background: #f7f7f9;
  color: var(--color-primary);
}

.nav-link.active {
  border-color: transparent;
  background: #f0f2f2;
  color: var(--color-primary);
  font-weight: 600;
}

.sidebar > div:last-child {
  background: #fafafd;
  border-top-color: #ececf0;
}

.card,
.stat-card {
  border: 1px solid #e4e4e9;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 2px 5px rgba(35, 35, 48, 0.08);
}

.card {
  padding: 1rem;
}

.card-header {
  margin-bottom: 0.9rem;
  padding-bottom: 0.65rem;
  border-bottom-color: #e7e7eb;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
}

.stat-card {
  padding: 1rem;
  gap: 0.8rem;
}

.stat-icon {
  width: 42px;
  height: 42px;
  border: 1px solid #e5e8e7;
  border-radius: 6px;
  background: #f5f7f6;
}

.stat-value {
  font-size: 1.65rem;
  font-weight: 600;
}

.stat-label {
  color: #777783;
  font-size: 0.78rem;
  font-weight: 500;
}

.btn {
  min-height: 36px;
  padding: 0.5rem 0.85rem;
  border-radius: 5px;
  font-size: 0.84rem;
  font-weight: 600;
  box-shadow: none;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

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

.btn-gold {
  background: var(--color-gold);
}

.btn-secondary {
  border-color: #d9d9df;
  background: #fff;
  color: #5e5e69;
}

.btn-secondary:hover {
  background: #f6f6f8;
}

.form-input,
.form-select,
.form-textarea {
  min-height: 38px;
  padding: 0.55rem 0.7rem;
  border-color: #d7d7de;
  border-radius: 5px;
  background: #fff;
  font-size: 0.88rem;
}

.form-select {
  padding-right: 2.25rem;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='m5 7.5 5 5 5-5' stroke='%235e5e69' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 13px;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: rgba(23, 59, 59, 0.55);
  box-shadow: 0 0 0 2px rgba(23, 59, 59, 0.08);
}

.form-label {
  margin-bottom: 0.35rem;
  color: #646470;
  font-size: 0.82rem;
  font-weight: 500;
}

.table-container {
  border-color: #e2e2e7;
  border-radius: 5px;
  box-shadow: none;
}

.dashboard-search-icon {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  transform: translateY(-50%);
}

.dashboard-search-field {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.dashboard-search-card {
  padding: 0.7rem 1rem;
}

.dashboard-search-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.customer-profile-history {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.customer-profile-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem 1.5rem;
}

.customer-profile-field {
  min-width: 0;
}

table.data-table.customer-list-table {
  min-width: 1000px;
  color: #45454d;
}

table.data-table.customer-list-table th {
  padding: 0.8rem 0.75rem;
  border-bottom: 1px solid #e6e6ea;
  background: #f8f8fa;
  color: #73737d;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}

table.data-table.customer-list-table td {
  padding: 0.9rem 0.75rem;
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
}

table.data-table.customer-list-table th {
  text-align: center;
}

table.data-table.customer-list-table tbody tr:last-child td {
  border-bottom: 0;
}

table.data-table.customer-list-table tbody tr:hover {
  background: #fbfbfa;
}

table.data-table.customer-list-table .customer-code-cell {
  color: #9a7945;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 700;
}

table.data-table.customer-list-table .customer-phone-cell {
  color: #56565f;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

table.data-table.customer-list-table .customer-muted-cell {
  color: #666670;
}

.customer-count-badge {
  display: inline-flex;
  min-width: 30px;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.55rem;
  border: 1px solid #e7e7e8;
  border-radius: 999px;
  background: #f7f7f6;
  color: #4e5352;
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

table.data-table.customer-list-table td:last-child {
  white-space: nowrap;
}

table.data-table.customer-list-table td:last-child .inline-flex {
  justify-content: center;
  gap: 0.4rem;
}

.customer-form-grid > .form-group {
  margin-bottom: 0;
}

.measurement-summary {
  display: grid;
  grid-template-columns: 1.25fr repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid #e4e1da;
  border-radius: 8px;
  background: #faf9f6;
}

.measurement-summary-item {
  min-width: 0;
  padding: 0.9rem 1rem;
  border-right: 1px solid #e8e6e1;
}

.measurement-summary-item:last-child {
  border-right: 0;
}

.measurement-summary-label {
  margin-bottom: 0.35rem;
  color: #85837e;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.045em;
  line-height: 1.35;
  text-transform: uppercase;
}

.measurement-summary-value {
  color: #2d3433;
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.measurement-summary-customer .measurement-summary-value {
  color: #173b3b;
}

.measurement-summary-note {
  margin-top: 0.2rem;
  color: #777873;
  font-size: 0.72rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.measurement-count-badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 0.3rem 0.65rem;
  border: 1px solid #e2eae8;
  border-radius: 999px;
  background: #f2f7f6;
  color: #173b3b;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
}

.measurement-record-code {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.6rem;
  border: 1px solid #e6e0d5;
  border-radius: 5px;
  background: #f8f6f1;
  color: #76613d;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.015em;
  line-height: 1.35;
  white-space: nowrap;
}

.measurement-form-page {
  font-size: 14px;
}

.measurement-image-thumbnail {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 180px;
  object-fit: contain;
  background: #f5f5f4;
  border: 1px solid #e7e5e4;
  border-radius: 0.5rem;
}

.measurement-form-page > .flex h1,
.measurement-form-page .card-header .card-title {
  font-size: 18px !important;
}

.measurement-form-page .text-xs:not(.measurement-step-number),
.measurement-form-page .form-label,
.measurement-form-page .form-input,
.measurement-form-page .form-select,
.measurement-form-page .form-textarea,
.measurement-form-page table.data-table th,
.measurement-form-page table.data-table td,
.measurement-form-page .spec-section-header {
  font-size: 14px;
}

.measurement-form-page table.data-table th,
.measurement-form-page .spec-section-header {
  letter-spacing: normal;
  text-transform: none;
}

.measurement-form-page table.measurement-spec-table {
  min-width: 640px;
  table-layout: fixed;
}

.measurement-form-page .measurement-spec-table th:nth-child(1),
.measurement-form-page .measurement-spec-table td:nth-child(1) {
  width: 32%;
}

.measurement-form-page .measurement-spec-table th:nth-child(2),
.measurement-form-page .measurement-spec-table td:nth-child(2) {
  width: 20%;
}

.measurement-form-page .measurement-spec-table th:nth-child(3),
.measurement-form-page .measurement-spec-table td:nth-child(3) {
  width: 24%;
}

.measurement-form-page .measurement-spec-table th:nth-child(4),
.measurement-form-page .measurement-spec-table td:nth-child(4) {
  width: 24%;
}

.measurement-input-wrap {
  position: relative;
  width: 100%;
  min-width: 0;
}

.measurement-input-wrap.has-unit .form-input {
  padding-right: 2.25rem;
}

.measurement-unit {
  position: absolute;
  top: 50%;
  right: 0.65rem;
  transform: translateY(-50%);
  color: #aaa9a4;
  font-size: 0.72rem;
  line-height: 1;
  pointer-events: none;
}

.measurement-form-page .measurement-step-number {
  font-size: 12px;
}

.permission-module {
  padding: 0.9rem;
  border: 1px solid #e5e5e9;
  border-radius: 8px;
  background: #fbfbfc;
}

.permission-module-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.65rem;
  color: #173b3b;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.permission-module-marker {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: #b09057;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.permission-option {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  padding: 0.65rem 0.7rem;
  border: 1px solid #e5e5e9;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.permission-option:hover {
  border-color: #b9c9c7;
  background: #fcfdfd;
}

.permission-option:has(input[type="checkbox"]:checked) {
  border-color: #cbd9d7;
  background: #f5f8f7;
}

.permission-option input[type="checkbox"] {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  margin: 0;
  accent-color: #173b3b;
  cursor: pointer;
}

.permission-option-text {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.permission-option-label {
  color: #45454d;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
}

.permission-option-code {
  color: #898992;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.68rem;
  line-height: 1.25;
}

.dashboard-search-control {
  position: relative;
  width: 100%;
  min-width: 0;
}

#liveCustomerSearch,
#liveDocumentSearch {
  display: block;
  width: 100%;
  height: 34px;
  min-height: 34px;
  padding-right: 2.75rem !important;
  padding-top: 0.4rem !important;
  padding-bottom: 0.4rem !important;
}

#liveCustomerResults,
#liveDocumentResults {
  position: absolute;
  top: 100%;
  left: 0;
  right: auto;
  width: 100%;
  margin-top: 0.25rem;
}

table.data-table {
  color: #555560;
  font-size: 0.83rem;
}

table.data-table th {
  padding: 0.65rem 0.8rem;
  background: #fafafd;
  color: #777783;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

table.data-table td {
  padding: 0.7rem 0.8rem;
  border-bottom-color: #ededf0;
}

table.data-table tbody tr:hover {
  background: #f8f8fa;
}

.badge {
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  letter-spacing: 0;
  text-transform: none;
}

.spec-section-header {
  padding: 0.6rem 0.75rem;
  border: 1px solid #e5e7e7;
  border-radius: 5px;
  background: #f2f5f4;
  font-size: 0.76rem;
  letter-spacing: 0.035em;
}

footer {
  background: #fff;
  border-top-color: #e7e7eb;
}

@media (max-width: 1023px) {
  .main-content {
    margin-left: 0;
  }

  .top-nav {
    margin: 10px 12px 0;
  }

  .page-body {
    padding: 0.85rem 12px 1rem;
  }
}

.document-search-result {
  display: block;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid #ededf0;
}

.document-search-result:last-child {
  border-bottom: 0;
}

.document-search-result:hover {
  background: #f8f8fa;
}

.document-search-result-heading {
  color: var(--color-primary);
  font-size: 0.84rem;
  font-weight: 600;
}

.document-search-result-description,
.document-search-message {
  color: var(--color-text-muted);
  font-size: 0.76rem;
}

.document-search-result-description {
  margin-top: 0.15rem;
}

.document-search-message {
  padding: 0.75rem;
}

.order-search-form {
  width: 100%;
  max-width: 100%;
}

.order-filter-grid {
  display: grid;
  grid-template-columns: minmax(240px, 2fr) minmax(130px, 1fr) minmax(120px, 1fr) auto;
  align-items: end;
  gap: 0.75rem;
}

.order-filter-grid .form-input,
.order-filter-grid .form-select {
  width: 100%;
  max-width: none;
}

.order-filter-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.order-status-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.order-status-form .form-select {
  min-width: 120px;
}

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

@media (max-width: 639px) {
  .login-page .form-input {
    font-size: 16px !important;
  }

  .top-nav {
    height: 56px;
    padding: 0 0.7rem;
  }

  .measurement-form-page .measurement-spec-container {
    overflow: visible;
  }

  .measurement-form-page table.measurement-spec-table,
  .measurement-form-page .measurement-spec-table tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .measurement-form-page .measurement-spec-table {
    table-layout: auto;
  }

  .measurement-form-page .measurement-spec-table thead {
    display: none;
  }

  .measurement-form-page .measurement-spec-table tbody tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem 0.5rem;
    padding: 0.8rem;
    border-bottom: 1px solid #ededf0;
  }

  .measurement-form-page .measurement-spec-table tbody tr:last-child {
    border-bottom: 0;
  }

  .measurement-form-page .measurement-spec-table tbody td {
    width: auto !important;
    min-width: 0;
    padding: 0;
    border: 0;
  }

  .measurement-form-page .measurement-spec-table .measurement-field-name {
    grid-column: 1 / -1;
  }

  .measurement-form-page .measurement-spec-table .measurement-field-name {
    color: var(--color-primary);
    font-weight: 700;
  }

  .measurement-form-page .measurement-spec-table td[data-mobile-label]::before {
    display: block;
    margin-bottom: 0.3rem;
    color: var(--color-text-muted);
    content: attr(data-mobile-label);
    font-size: 0.75rem;
    font-weight: 600;
  }

  .measurement-form-page .measurement-spec-table .measurement-input-wrap,
  .measurement-form-page .measurement-spec-table .measurement-input-wrap .form-input {
    width: 100%;
    min-width: 0;
  }

  .measurement-form-page .measurement-spec-table .form-input {
    min-height: 44px;
    padding: 0.55rem 0.65rem;
    font-size: 16px;
  }

  .measurement-form-page .measurement-spec-table .measurement-field-note .form-input::placeholder {
    font-size: 14px;
  }

  .measurement-form-page .measurement-spec-table .measurement-input-wrap.has-unit .form-input {
    padding-right: 0.65rem;
  }

  .measurement-form-page .measurement-spec-table .measurement-unit {
    display: none;
  }

  .measurement-form-page .form-input,
  .measurement-form-page .form-select,
  .measurement-form-page .form-textarea {
    font-size: 16px !important;
    -webkit-text-size-adjust: 100%;
  }

  .top-nav-company {
    display: none;
  }

  .top-nav-greeting {
    gap: 0.2rem;
    font-size: 0.78rem;
  }

  .page-body {
    gap: 0.7rem;
  }

  .dashboard-search-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
  }

  .customer-profile-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }

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

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

  .measurement-summary-item:nth-child(2) {
    border-right: 0;
  }

  .measurement-summary-item:nth-child(-n+2) {
    border-bottom: 1px solid #e8e6e1;
  }

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

  .order-filter-grid > div:first-child,
  .order-filter-actions {
    grid-column: 1 / -1;
  }

  .order-filter-actions > * {
    flex: 1;
  }

  .card {
    padding: 0.8rem;
  }
}

@media print {
  .measurement-summary {
    background: #fff !important;
    border-color: #bdbdbd !important;
  }

  .measurement-summary-item {
    border-color: #d0d0d0 !important;
  }
}
