/* Property AU — brand tokens, matched to propertyau_stock (navy + gold).
   System font stack, neutral layered shadows, transform/opacity motion,
   explicit hover/focus-visible/active states everywhere. */

:root {
  /* Brand */
  --navy: #1a2744;
  --navy-dark: #111a30;
  --gold: #c8952a;
  --gold-light: #e0aa40;
  --gold-dark: #a97c1f;

  /* charcoal scale: neutral greys + navy dark shades */
  --charcoal-950: #111a30;
  --charcoal-900: #1a2744;
  --charcoal-800: #22304f;
  --charcoal-700: #2c3a5a;
  --charcoal-600: #556074;
  --charcoal-400: #8b93a3;
  --charcoal-200: #d3d8e0;
  --charcoal-100: #e9ebef;
  --charcoal-50: #f6f7f9;

  /* emerald tokens remapped to gold (existing accents read as brand gold) */
  --emerald-700: #a97c1f;
  --emerald-600: #c8952a;
  --emerald-500: #d4a02f;
  --emerald-400: #e0aa40;
  --emerald-100: #f5e9d0;

  --font-display: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

html {
  font-family: var(--font-body);
  scroll-behavior: smooth;
}

h1, h2, h3, .font-display {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

body {
  line-height: 1.6;
  background-color: var(--charcoal-50);
  color: var(--charcoal-900);
}

/* Layered, neutral navy-tinted shadows — never flat shadow-md */
.shadow-elevated {
  box-shadow:
    0 1px 2px rgba(17, 26, 48, 0.06),
    0 4px 10px -2px rgba(17, 26, 48, 0.08),
    0 10px 24px -8px rgba(17, 26, 48, 0.12);
}

.shadow-floating {
  box-shadow:
    0 2px 4px rgba(17, 26, 48, 0.10),
    0 12px 28px -6px rgba(17, 26, 48, 0.16),
    0 24px 48px -16px rgba(17, 26, 48, 0.24);
}

/* Motion: transform/opacity only, spring-ish easing */
.transition-brand {
  transition-property: transform, opacity, box-shadow, background-color, border-color, color;
  transition-duration: 180ms;
  transition-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-primary {
  background-color: var(--gold);
  color: white;
  border: 1px solid var(--gold-dark);
}
.btn-primary:hover {
  background-color: var(--gold-light);
  transform: translateY(-1px);
}
.btn-primary:active {
  background-color: var(--gold-dark);
  transform: translateY(0);
}
.btn-primary:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 2px;
}

.btn-secondary {
  background-color: white;
  color: var(--charcoal-800);
  border: 1px solid var(--charcoal-200);
}
.btn-secondary:hover {
  border-color: var(--charcoal-400);
  background-color: var(--charcoal-50);
}
.btn-secondary:active {
  background-color: var(--charcoal-100);
}
.btn-secondary:focus-visible {
  outline: 2px solid var(--charcoal-600);
  outline-offset: 2px;
}

a, button, input, select, textarea {
  transition-property: transform, opacity, box-shadow, background-color, border-color, color;
  transition-duration: 150ms;
}

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 1px;
}

.card {
  background: white;
  border: 1px solid var(--charcoal-100);
  border-radius: 0.75rem;
}

/* Consistent "boxed section" header row: eyebrow + title left, one action right */
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.875rem;
  margin-bottom: 1.125rem;
  border-bottom: 1px solid var(--charcoal-100);
}
.card-eyebrow {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--charcoal-400);
  margin-bottom: 0.125rem;
}

/* Numbered step badge on sale-form sections */
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.875rem;
  height: 1.875rem;
  border-radius: 9999px;
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

/* Icon chip used on dashboard stat cards */
.icon-chip {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon-chip svg { width: 1.125rem; height: 1.125rem; }

/* Segmented proportional bar (cash position at a glance) */
.seg-bar {
  display: flex;
  width: 100%;
  height: 0.625rem;
  border-radius: 9999px;
  overflow: hidden;
  background: var(--charcoal-100);
}
.seg-bar > span {
  height: 100%;
  transition: width 240ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.stat-card {
  background: white;
  border: 1px solid var(--charcoal-100);
  border-radius: 0.75rem;
  padding: 1.25rem;
}

/* Dashboard alert-link target highlight */
[data-parts-section]:target {
  border-radius: 0.5rem;
  animation: target-flash 2200ms ease-out;
}
@keyframes target-flash {
  0% { background-color: var(--emerald-100); box-shadow: 0 0 0 3px var(--emerald-400); }
  100% { background-color: transparent; box-shadow: 0 0 0 0 transparent; }
}

.nav-link {
  color: var(--charcoal-200);
}
.nav-link:hover {
  color: white;
  transform: translateY(-1px);
}
.nav-link.active {
  color: var(--gold-light);
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-pending { background: var(--charcoal-100); color: var(--charcoal-700); }
.badge-partial { background: #fef3c7; color: #92400e; }
.badge-paid { background: var(--emerald-100); color: var(--emerald-700); }
.badge-overpaid { background: #ede9fe; color: #5b21b6; }
.badge-warn { background: #fee2e2; color: #991b1b; }
/* Linked to a Stocklist listing (gold tint) */
.badge-linked { background: rgba(200, 149, 42, 0.14); color: #8a6a1f; margin-left: 0.5rem; font-size: 0.625rem; letter-spacing: 0.02em; }
/* Statements: hide fully-paid (zero-balance) deals when "Balances only" is on */
.hide-zero .stmt-zero { display: none !important; }

/* --- Form fields (matched to propertyau_stock) --- */
.field-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--charcoal-700);
  margin-bottom: 0.25rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.required-label::after {
  content: ' *';
  color: var(--gold);
}
.field-input {
  display: block;
  width: 100%;
  border: 1px solid var(--charcoal-200);
  border-radius: 0.5rem;
  padding: 0.45rem 0.65rem;
  font-size: 0.875rem;
  color: #1f2937;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.field-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200, 149, 42, 0.15);
}
.field-input::placeholder { color: var(--charcoal-400); }
select.field-input { appearance: auto; }
textarea.field-input { resize: vertical; min-height: 80px; }

/* Scrollable table wrapper */
.table-scroll {
  overflow-x: auto;
}

/* Rows hidden by the instant table filter */
.filter-hidden { display: none !important; }

/* Collapsible section cards on the sale form */
.section-collapsed > :not(.card-header) { display: none !important; }
.section-collapsed > .card-header { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
/* hide header actions (e.g. "+ Add payment part") while a section is collapsed */
.section-collapsed > .card-header button:not(.section-chevron),
.section-collapsed > .card-header a { display: none; }
.section-chevron {
  color: var(--charcoal-400);
  padding: 0.35rem;
  border-radius: 0.5rem;
  display: inline-flex;
  align-items: center;
  line-height: 0;
  flex-shrink: 0;
  cursor: pointer;
}
.section-chevron:hover { color: var(--charcoal-700); background: var(--charcoal-100); }
.section-chevron-icon { transition: transform 160ms ease; }
.section-collapsed > .card-header .section-chevron-icon { transform: rotate(-90deg); }

/* Clickable, sortable column headers (Pipedrive-style) */
.th-sortable { cursor: pointer; -webkit-user-select: none; user-select: none; }
.th-sortable:hover { color: #fff; }
.sort-arrow { color: var(--gold-light); font-weight: 700; }

/* Flash message entrance */
.flash-msg { animation: fadein 0.3s ease; }
@keyframes fadein {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-in {
  animation: fade-in-up 220ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Print safety */
@media print {
  nav, footer { display: none !important; }
}
