@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@300;400&family=DM+Sans:wght@400;500&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --obsidian:  #0A0A0C;
  --onyx:      #141418;
  --graphite:  #1E1E24;
  --slate:     #2A2A32;
  --ash:       #6B6B78;
  --silver:    #9B9BA8;
  --pearl:     #E8E6E1;
  --ivory:     #F5F3EE;

  --gold-deep:  #8B6914;
  --gold:       #C49B2C;
  --gold-light: #D4AF37;
  --gold-glow:  #E8C84A;
  --gold-pale:  #F0DCA0;

  --persian-blue:  #1C3A5F;
  --persian-rose:  #8C3A3A;
  --turquoise:     #2A8B7A;

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'DM Sans', -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', monospace;
}

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

html, body {
  height: 100%;
  background: var(--obsidian);
  color: var(--pearl);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Pattern background */
.pattern-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23D4AF37' stroke-width='0.5'%3E%3Cpath d='M40 0 L80 40 L40 80 L0 40Z'/%3E%3Cpath d='M40 10 L70 40 L40 70 L10 40Z'/%3E%3Cpath d='M40 20 L60 40 L40 60 L20 40Z'/%3E%3Ccircle cx='40' cy='40' r='8'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 80px 80px;
}

/* Main container */
.app {
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

/* Offline banner */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--graphite);
  color: var(--silver);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
  padding: 8px;
  display: none;
}

.offline-banner.visible {
  display: block;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 24px 0 16px;
}

.header-brand {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 24px;
  color: var(--pearl);
}

.header-title {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold);
}

.header-rule {
  height: 1px;
  background: var(--gold);
  border: none;
  margin-bottom: 24px;
}

/* Divider */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: var(--slate);
}

.divider svg {
  flex-shrink: 0;
}

/* Section labels */
.section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ash);
  margin-bottom: 12px;
}

/* Vendor selector */
.vendor-select {
  width: 100%;
  padding: 12px 16px;
  background: var(--graphite);
  color: var(--pearl);
  border: 1px solid var(--slate);
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 15px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B6B78' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  cursor: pointer;
  min-height: 44px;
}

.vendor-select:focus {
  outline: none;
  border-color: var(--gold-deep);
  box-shadow: 0 0 0 2px rgba(196, 155, 44, 0.15);
}

.new-vendor-toggle {
  display: inline-block;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  min-height: 44px;
  line-height: 36px;
}

.new-vendor-toggle:hover {
  color: var(--gold-light);
}

/* New vendor inline form */
.new-vendor-form {
  display: none;
  margin-top: 12px;
  padding: 16px;
  background: var(--onyx);
  border: 1px solid var(--slate);
  border-radius: 6px;
}

.new-vendor-form.visible {
  display: block;
}

.new-vendor-form .form-row {
  margin-bottom: 10px;
}

.new-vendor-form .form-row:last-child {
  margin-bottom: 0;
}

/* Form inputs */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"] {
  width: 100%;
  padding: 10px 14px;
  background: var(--graphite);
  color: var(--pearl);
  border: 1px solid var(--slate);
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 14px;
  min-height: 44px;
}

input:focus {
  outline: none;
  border-color: var(--gold-deep);
}

input::placeholder {
  color: var(--ash);
}

label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ash);
  margin-bottom: 6px;
}

/* Textarea */
.transcript-input {
  width: 100%;
  min-height: 120px;
  padding: 14px 16px;
  background: var(--graphite);
  color: var(--pearl);
  border: 1px solid var(--slate);
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 15px;
  resize: vertical;
  line-height: 1.5;
}

.transcript-input::placeholder {
  color: var(--silver);
}

.transcript-input:focus {
  outline: none;
  border-color: var(--gold-deep);
  box-shadow: 0 0 0 2px rgba(196, 155, 44, 0.15);
}

/* Buttons */
.btn {
  display: block;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  min-height: 44px;
  transition: background 0.15s;
}

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

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

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--slate);
  color: var(--pearl);
}

.btn-secondary:hover {
  background: var(--ash);
}

.btn-small {
  display: inline-block;
  width: auto;
  padding: 8px 16px;
  font-size: 13px;
  min-height: 36px;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.btn-row .btn {
  flex: 1;
}

/* Loading pulse */
@keyframes gold-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.loading {
  animation: gold-pulse 1.2s ease-in-out infinite;
  pointer-events: none;
}

/* Extract button margin */
.extract-section {
  margin-top: 12px;
}

/* Draft table */
.draft-section {
  display: none;
}

.draft-section.visible {
  display: block;
}

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

.draft-table thead th {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  text-align: left;
  padding: 0 4px 10px;
  white-space: nowrap;
}

.draft-table thead th:nth-child(n+2) {
  text-align: right;
}

.draft-table thead th:last-child {
  text-align: center;
  width: 36px;
}

.draft-table tbody td {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--pearl);
  padding: 8px 4px;
  border-top: 1px solid var(--slate);
  vertical-align: middle;
}

.draft-table tbody td:nth-child(n+2) {
  text-align: right;
  white-space: nowrap;
}

.draft-table tbody td:last-child {
  text-align: center;
}

.draft-table .product-name {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Inline edit inputs */
.draft-table .inline-edit {
  background: var(--graphite);
  border: 1px solid var(--gold-deep);
  color: var(--pearl);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 4px 6px;
  border-radius: 3px;
  width: 64px;
  text-align: right;
  min-height: 32px;
}

.draft-table .inline-edit:focus {
  outline: none;
  border-color: var(--gold);
}

/* Delete button */
.btn-delete {
  background: none;
  border: none;
  color: var(--ash);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-delete:hover {
  color: #C05050;
}

/* Total row */
.draft-total {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 16px;
  padding: 12px 4px 0;
  border-top: 1px solid var(--gold);
  margin-top: 4px;
}

.draft-total-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold-light);
}

.draft-total-value {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 500;
  color: var(--gold-light);
}

.draft-footnote {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ash);
  margin-top: 8px;
  text-align: right;
}

/* Notes */
.notes-section {
  margin-top: 16px;
}

.notes-input {
  width: 100%;
  min-height: 60px;
  padding: 10px 14px;
  background: var(--graphite);
  color: var(--pearl);
  border: 1px solid var(--slate);
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 14px;
  resize: vertical;
}

.notes-input:focus {
  outline: none;
  border-color: var(--gold-deep);
}

.notes-input::placeholder {
  color: var(--ash);
}

/* Finalize section */
.finalize-section {
  display: none;
  margin-top: 8px;
}

.finalize-section.visible {
  display: block;
}

.confirm-text {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--pearl);
  text-align: center;
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}

/* Success state */
.finalize-success {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  background: var(--onyx);
  border: 1px solid var(--turquoise);
  border-radius: 6px;
}

.finalize-success.visible {
  display: flex;
}

.finalize-success svg {
  flex-shrink: 0;
}

.finalize-success a {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--turquoise);
  text-decoration: none;
}

.finalize-success a:hover {
  color: var(--gold-light);
}

/* Error text */
.error-text {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--persian-rose);
  margin-top: 8px;
}

.error-border {
  border-color: var(--persian-rose) !important;
}

/* Responsive table scroll */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .header-brand { font-size: 20px; }
  .draft-table { font-size: 13px; }
  .draft-table thead th { font-size: 9px; }
  .draft-table .inline-edit { width: 52px; font-size: 13px; }
}
