@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:wght@400;500;600&family=Syne:wght@700;800&display=swap');

/* ── Design tokens ─────────────────────────────────────────────────── */
:root {
  /* AeroRev primary palette */
  --navy:          #0A1628;
  --navy-mid:      #0d1526;
  --navy-deep:     #080e1a;
  --lime:          #C8F04A;
  --lime-alt:      #C4F135;
  --lime-dark:     #a8cc2a;

  /* Status / semantic (unchanged) */
  --green:         #00BDA5;
  --green-light:   #e6faf7;
  --red:           #F2545B;
  --red-light:     #fff0f0;
  --yellow:        #FFAB4A;
  --yellow-light:  #fff8e6;

  /* Page / layout */
  --bg:            #F4F6FA;
  --white:         #ffffff;
  --border:        #DDE3EE;
  --border-light:  #EEF2F7;
  --text:          #2D3E50;
  --text-muted:    #516F90;
  --text-light:    #8bacc8;

  --radius-sm:     4px;
  --radius:        8px;
  --radius-lg:     12px;
  --shadow:        0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md:     0 4px 16px rgba(0, 0, 0, 0.12);
}

/* ── Reset & base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
}

/* ── Header ────────────────────────────────────────────────────────── */
.app-header {
  background: var(--navy);
  border-bottom: 1px solid rgba(200, 240, 74, 0.15);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.2);
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
  height: 58px;
  display: flex;
  align-items: center;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand-wordmark {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.01em;
}

.brand-aero { color: #F0F4FF; }
.brand-rev  { color: #C8F04A; }

.brand-subtitle {
  font-size: 11px;
  font-weight: 400;
  color: rgba(240, 244, 255, 0.45);
  letter-spacing: 0.01em;
}

.hs-badge {
  background: rgba(200, 240, 74, 0.12);
  color: #C8F04A;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid rgba(200, 240, 74, 0.25);
}

/* ── Main layout ───────────────────────────────────────────────────── */
.app-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Cards ─────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  background: #FAFBFC;
}

.step-label {
  display: flex;
  align-items: center;
  gap: 12px;
}

.step-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--lime);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-label h2 {
  font-family: 'Syne', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.step-label p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

.card-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Forms ─────────────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.req { color: var(--red); }

input[type="text"],
input[type="password"],
select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  font-family: 'DM Sans', sans-serif;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(200, 240, 74, 0.2);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23516F90' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.input-wrap {
  position: relative;
}

.input-wrap input { padding-right: 42px; }

.eye-btn {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 0 var(--radius) var(--radius) 0;
  transition: color 0.15s;
}
.eye-btn:hover { color: var(--text); }

.hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
}

.hint a { color: var(--navy); text-decoration: none; }
.hint a:hover { text-decoration: underline; }

code {
  font-family: 'DM Mono', 'SFMono-Regular', Consolas, monospace;
  font-size: 11px;
  background: #EEF4F8;
  padding: 1px 4px;
  border-radius: 3px;
  color: var(--navy);
}

/* ── CSV Format guide ──────────────────────────────────────────────── */
.format-guide {
  background: #FAFBFC;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.format-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.format-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@media (max-width: 640px) {
  .format-cols { grid-template-columns: 1fr; }
}

.format-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  border-left-width: 3px;
}

.required-col { border-left-color: var(--lime); }
.optional-col { border-left-color: var(--border); }

.col-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.col-req-tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.col-opt-tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.col-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.col-desc em {
  font-style: normal;
  font-family: 'DM Mono', 'SFMono-Regular', Consolas, monospace;
  background: #EEF4F8;
  padding: 0 3px;
  border-radius: 2px;
  color: var(--navy);
}

/* ── Drop zone ─────────────────────────────────────────────────────── */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  background: #FAFBFC;
  user-select: none;
}

.dropzone:hover {
  border-color: var(--lime);
  background: rgba(200, 240, 74, 0.06);
}

.dropzone.dragging {
  border-color: var(--lime);
  background: rgba(200, 240, 74, 0.06);
  transform: scale(1.01);
}

.dz-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.dz-icon {
  width: 44px;
  height: 44px;
  color: var(--text-light);
  stroke: var(--text-light);
}

.dz-primary {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.dz-secondary {
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Preview ───────────────────────────────────────────────────────── */
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.preview-header h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Tables ────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: #F4F6FA;
  padding: 9px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  color: var(--text);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #FAFBFC; }

td.muted { color: var(--text-muted); font-style: italic; }

.options-cell {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'DM Mono', 'SFMono-Regular', Consolas, monospace;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Type badges ───────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-dropdown  { background: #EDF7FF; color: #0066CC; }
.badge-radio     { background: #FFF5E6; color: #CC5500; }
.badge-checkbox  { background: #E6F9F7; color: #007A6C; }
.badge-text      { background: #F3F0FF; color: #5E35B1; }
.badge-number    { background: #FFF8E1; color: #B45309; }
.badge-date      { background: #E3F2FD; color: #1565C0; }

.badge-success   { background: var(--green-light);  color: #007A6C; }
.badge-error     { background: var(--red-light);    color: var(--red); }
.badge-pending   { background: #F5F8FA;             color: var(--text-muted); }
.badge-progress  { background: var(--yellow-light); color: #8B5A00; }

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s, box-shadow 0.15s, opacity 0.15s;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  font-family: 'DM Sans', sans-serif;
}

.btn-primary {
  background: var(--navy);
  color: var(--lime);
}
.btn-primary:hover:not(:disabled) {
  background: var(--navy-mid);
  box-shadow: 0 2px 8px rgba(10, 22, 40, 0.3);
}
.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-outline {
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover {
  background: var(--bg);
  border-color: var(--text-muted);
}

.btn-sm { padding: 5px 10px; font-size: 12px; }

.btn-lg {
  width: 100%;
  justify-content: center;
  padding: 13px 24px;
  font-size: 15px;
  border-radius: var(--radius);
}

/* ── Tabs ──────────────────────────────────────────────────────────── */
.tab-nav {
  display: flex;
  gap: 4px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 4px;
  box-shadow: var(--shadow);
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: center;
  padding: 9px 18px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
  font-family: 'DM Sans', sans-serif;
}

.tab-btn:hover { background: var(--bg); color: var(--text); }

.tab-btn.active {
  background: var(--lime);
  color: var(--navy);
  box-shadow: 0 1px 4px rgba(200, 240, 74, 0.35);
}

/* ── Manage toolbar ────────────────────────────────────────────────── */
.toolbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.analyze-progress {
  padding: 12px 24px 16px;
  border-top: 1px solid var(--border-light);
  background: #FAFBFC;
}

.warn-box {
  margin: 0 24px 12px;
  background: #FFF8E6;
  border: 1px solid #FFE4A0;
  border-left: 3px solid var(--yellow);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12px;
  color: #7A5000;
}

.warn-box ul {
  margin-top: 4px;
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ── Filter bar ────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  border-top: 1px solid var(--border-light);
  background: #FAFBFC;
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 180px;
}

.search-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  padding: 7px 12px 7px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--white);
}

.search-wrap input:focus {
  outline: none;
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(200, 240, 74, 0.2);
}

.filter-bar select {
  padding: 7px 28px 7px 10px;
  font-size: 13px;
}

.filter-count {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Bulk action bar ───────────────────────────────────────────────── */
.bulk-bar {
  background: rgba(10, 22, 40, 0.04);
  border: 1px solid rgba(10, 22, 40, 0.12);
  border-radius: var(--radius-lg);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bulk-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
}

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

/* ── Properties table specific ─────────────────────────────────────── */
.col-cb      { width: 36px; }
.col-source  { width: 80px; }
.col-usage   { width: 72px; text-align: center; }
.col-date    { width: 110px; white-space: nowrap; font-size: 12px; color: var(--text-muted); }
.col-actions { width: 60px; text-align: center; }

td.col-usage  { text-align: center; }
td.col-actions { text-align: center; }

.prop-label {
  font-weight: 600;
  color: var(--text);
  display: block;
}

.prop-internal {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'DM Mono', 'SFMono-Regular', Consolas, monospace;
  margin-top: 1px;
  display: block;
}

/* Usage cell indicators */
.usage-none     { color: var(--text-light); font-size: 12px; }
.usage-check    { color: var(--green); font-size: 16px; font-weight: 700; }
.usage-cross    { color: var(--border); font-size: 16px; }
.usage-spinner  { color: var(--yellow); font-size: 11px; }
.usage-count    { font-size: 12px; font-weight: 700; }
.usage-count.has-values { color: var(--green); }
.usage-count.no-values  { color: var(--text-light); }
.usage-error    { font-size: 10px; color: var(--red); }

/* Source badges */
.badge-custom { background: #EDF7FF; color: #0066CC; }
.badge-system { background: #F5F8FA; color: var(--text-muted); }

/* Row state when deleted */
tr.row-deleted td { opacity: 0.35; text-decoration: line-through; }

/* Inline delete button */
.btn-icon {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-icon:hover { background: var(--red-light); color: var(--red); border-color: #ffd0d0; }
.btn-icon:disabled { opacity: 0.35; cursor: not-allowed; }

/* Danger button variant */
.btn-danger {
  background: var(--red);
  color: var(--white);
  border: none;
}
.btn-danger:hover { background: #d43a41; }

/* ── Empty state ───────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.empty-icon {
  color: var(--text-light);
  margin-bottom: 12px;
}

.empty-state p { font-size: 14px; }

/* ── Modal ─────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  max-width: 440px;
  width: 90%;
  box-shadow: var(--shadow-md);
}

.modal-title {
  font-family: 'Syne', sans-serif;
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}

.modal-body {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── Error box ─────────────────────────────────────────────────────── */
.error-box {
  background: var(--red-light);
  border: 1px solid #ffd0d0;
  border-left: 3px solid var(--red);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--red);
  font-size: 13px;
}

.error-box ul {
  margin-top: 8px;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ── Progress ──────────────────────────────────────────────────────── */
.progress-track {
  height: 8px;
  background: var(--border-light);
  border-radius: 100px;
  overflow: hidden;
  margin-top: 16px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--navy), var(--lime));
  border-radius: 100px;
  transition: width 0.3s ease;
}

.progress-text {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ── Results summary cards ─────────────────────────────────────────── */
.results-summary {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

@media (max-width: 480px) {
  .results-summary { grid-template-columns: 1fr; }
}

.summary-stat {
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.summary-stat.total   { background: rgba(10, 22, 40, 0.05); }
.summary-stat.success { background: var(--green-light); }
.summary-stat.failed  { background: var(--red-light); }

.stat-number {
  display: block;
  font-family: 'Syne', sans-serif;
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}

.summary-stat.total   .stat-number { color: var(--navy); }
.summary-stat.success .stat-number { color: var(--green); }
.summary-stat.failed  .stat-number { color: var(--red); }

.stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

/* ── Error detail in table ─────────────────────────────────────────── */
.error-detail {
  font-size: 11px;
  color: var(--red);
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.success-detail {
  font-size: 11px;
  font-family: 'DM Mono', 'SFMono-Regular', Consolas, monospace;
  color: var(--text-muted);
}

/* ── Clickable usage check button ──────────────────────────────────── */
.usage-check-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--green);
  font-size: 16px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}
.usage-check-btn:hover {
  background: var(--green-light);
  color: #005e55;
}

/* ── Usage detail modal ─────────────────────────────────────────────── */
.modal-usage {
  max-width: 520px;
}

.usage-detail-list {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
}

.usage-detail-list li {
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
}

.usage-detail-list li:last-child {
  border-bottom: none;
}

.usage-detail-none {
  color: var(--text-muted);
  font-style: italic;
}
