/* =====================================================================
   Jetstore CRM — main.css  (dark luxury aviation theme)
   ===================================================================== */

:root {
  --bg:        #07090F;
  --surface:   #0D1117;
  --surface-2: #11161F;
  --border:    rgba(146,117,0,0.20);
  --border-strong: rgba(146,117,0,0.40);
  --gold:      #927500;
  --gold-light:#C9A96E;
  --text:      #EEF2F5;
  --muted:     #7A95AC;
  --success:   #2D5A27;
  --success-light:#7BBF6E;
  --danger:    #5A2727;
  --danger-light:#D98A8A;
  --info:      #2A4A6B;

  --radius: 4px;
  --radius-lg: 8px;
  --shadow: 0 8px 30px rgba(0,0,0,0.45);
  --shadow-gold: 0 0 24px rgba(146,117,0,0.18);

  --font-head: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --sidebar-w: 248px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-head); font-weight: 600; letter-spacing: -0.01em; margin: 0; }

a { color: var(--gold-light); text-decoration: none; }
a:hover { color: var(--gold); }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.ta-r { text-align: right; }
.nowrap { white-space: nowrap; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 3px; font-size: 12px; color: var(--gold-light); }

/* ---- Buttons ------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body); font-weight: 600; font-size: 14px;
  letter-spacing: 0.03em; padding: 11px 20px; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer; transition: all .18s ease;
  min-height: 44px; line-height: 1;
}
.btn--gold { background: var(--gold); color: var(--bg); }
.btn--gold:hover { background: var(--gold-light); box-shadow: var(--shadow-gold); }
.btn--ghost { background: transparent; color: var(--gold-light); border-color: var(--border-strong); }
.btn--ghost:hover { background: rgba(146,117,0,0.08); border-color: var(--gold); }
.btn--sm { padding: 8px 14px; min-height: 38px; font-size: 13px; }
.btn--block { width: 100%; }
.btn--danger { background: var(--danger); color: var(--danger-light); }

.link { background: none; border: none; color: var(--gold-light); cursor: pointer; font: inherit; padding: 0; }
.link:hover { color: var(--gold); text-decoration: underline; }
.link--danger { color: var(--danger-light); }

/* ---- Cards --------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-lg);
  padding: 22px;
  transition: box-shadow .2s ease, border-color .2s ease;
}
.card:hover { box-shadow: var(--shadow-gold); }
.card__title { font-size: 18px; color: var(--text); margin-bottom: 14px; }
.card__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.card__head .card__title { margin-bottom: 0; }

/* ---- Badges -------------------------------------------------------- */
.badge {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em; white-space: nowrap;
  border: 1px solid transparent;
}
.badge--new       { background: rgba(146,117,0,0.15);  color: var(--gold-light); border-color: var(--border-strong); }
.badge--contacted { background: rgba(42,74,107,0.30);  color: #8FB8E0; }
.badge--qualified { background: rgba(42,74,107,0.40);  color: #A9CDF0; }
.badge--meeting   { background: rgba(120,90,160,0.30); color: #C5A9E8; }
.badge--offer     { background: rgba(201,169,110,0.20);color: var(--gold-light); }
.badge--nego      { background: rgba(180,120,30,0.25); color: #E8B765; }
.badge--won       { background: rgba(45,90,39,0.40);   color: var(--success-light); }
.badge--lost      { background: rgba(90,39,39,0.40);   color: var(--danger-light); }

.chip {
  display: inline-block; padding: 3px 9px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 11px; color: var(--muted);
}

/* ---- Alerts -------------------------------------------------------- */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px; font-size: 14px; border: 1px solid; }
.alert--info  { background: rgba(42,74,107,0.20); border-color: var(--info); color: #A9CDF0; }
.alert--error { background: rgba(90,39,39,0.25); border-color: var(--danger); color: var(--danger-light); }

/* ---- Forms --------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 12px; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.field__input {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); padding: 11px 13px; border-radius: var(--radius);
  font-family: var(--font-body); font-size: 14px; width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease; min-height: 44px;
}
.field__input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(146,117,0,0.15); }
.field__input--sm { min-height: 38px; padding: 8px 11px; font-size: 13px; }
select.field__input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%237A95AC' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 32px; }
textarea.field__input { min-height: auto; resize: vertical; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid--1 { grid-template-columns: 1fr; }
.field--full { grid-column: 1 / -1; }

/* ---- Tables -------------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-weight: 600; font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); padding: 12px 14px;
  border-bottom: 2px solid var(--gold); white-space: nowrap;
}
.table td { padding: 13px 14px; border-bottom: 1px solid rgba(255,255,255,0.04); vertical-align: middle; }
.table tbody tr:nth-child(even) { background: rgba(255,255,255,0.015); }
.table tbody tr:hover { background: rgba(146,117,0,0.06); }
.table--clickable tbody tr { cursor: pointer; }
.table__empty { text-align: center; color: var(--muted); padding: 32px 0; }
.table th.is-sortable { cursor: pointer; user-select: none; }
.table th.is-sortable:hover { color: var(--gold-light); }
.table th.is-sorted::after { content: ' ▾'; color: var(--gold); }
.table th.is-sorted.asc::after { content: ' ▴'; }
.table--kv td:first-child { color: var(--muted); width: 45%; }

/* ---- Pagination ---------------------------------------------------- */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.pagination button {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  min-width: 38px; min-height: 38px; border-radius: var(--radius); cursor: pointer; font: inherit;
}
.pagination button.is-active { background: var(--gold); color: var(--bg); border-color: var(--gold); }
.pagination button:disabled { opacity: .4; cursor: default; }

/* ---- Modal --------------------------------------------------------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(3,4,8,0.78); backdrop-filter: blur(3px); }
.modal__panel {
  position: relative; background: var(--surface); border: 1px solid var(--border-strong);
  border-top: 3px solid var(--gold); border-radius: var(--radius-lg);
  width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow);
}
.modal__panel--wide { max-width: 820px; }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.modal__head h2 { font-size: 20px; }
.modal__close { background: none; border: none; color: var(--muted); font-size: 28px; line-height: 1; cursor: pointer; padding: 0 4px; }
.modal__close:hover { color: var(--gold-light); }
.modal__body { padding: 24px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 12px; margin-top: 8px; }

/* ---- Auth (login) -------------------------------------------------- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; position: relative; overflow: hidden; }
.auth__bg { position: absolute; inset: 0; background:
  radial-gradient(900px 500px at 70% -10%, rgba(146,117,0,0.14), transparent 60%),
  radial-gradient(700px 500px at 0% 110%, rgba(201,169,110,0.08), transparent 60%); }
.auth__card {
  position: relative; z-index: 1; width: 100%; max-width: 400px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-top: 3px solid var(--gold); border-radius: var(--radius-lg);
  padding: 40px 34px; box-shadow: var(--shadow);
}
.auth__brand { text-align: center; margin-bottom: 28px; }
.auth__logo { width: 56px; height: 56px; margin-bottom: 12px; }
.auth__title { font-size: 34px; color: var(--text); }
.auth__sub { color: var(--muted); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; margin: 4px 0 0; }
.auth__form { display: flex; flex-direction: column; gap: 16px; margin-top: 8px; }
.auth__foot { text-align: center; color: var(--muted); font-size: 11px; letter-spacing: 0.06em; margin: 26px 0 0; }

/* ---- Detail view --------------------------------------------------- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; margin-bottom: 20px; }
.detail-grid dt { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.detail-grid dd { margin: 0 0 4px; font-size: 15px; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 18px 20px; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); }
.timeline__meta { font-size: 12px; color: var(--muted); }
.timeline__note { margin: 4px 0 0; }

/* ---- Outreach campaign actions ------------------------------------- */
.outreach-actions { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 14px; }
.outreach-actions__row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.outreach-form { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.outreach-form[hidden] { display: none; }

/* Flash card (shared with operators/empty-legs modules) */
.card--flash { border-left-color: var(--gold-light); background: rgba(146,117,0,0.10); padding: 12px 18px; margin-bottom: 18px; }

/* Inline forms used in operator/campaign tables */
form.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
tr.is-inactive { opacity: 0.5; }

/* ---- Progress bar (Share a Leg pools) ----------------------------- */
.progress { height: 8px; width: 160px; max-width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin-bottom: 4px; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-light)); }
