/* ==========================================================================
   MARAKKAAR BIRYANI — Franchise Partner module design system
   --------------------------------------------------------------------------
   Ported from the HyreSpot Channel Partner module. Structure, spacing and
   component behaviour are preserved exactly; palette, typography and logo are
   Marakkaar's.

   Brand mapping applied throughout:
     navy   #0d1b5e  ->  smoke  #1A1A1A   (sidebar / primary surface)
     blue   #2545C4  ->  red    #F1081D   (accent / CTA)
     orange #C45E00  ->  deep red #C00516 (attention)
     green  #16a34a  ->  black    #111111 (done)
     PALETTE IS RED + BLACK ONLY. Status reads through fill vs outline.
     Poppins          ->  Anton           (display)
     Inter            ->  Barlow          (UI / body)

   Token names match Marakkaar's existing public site and admin panel so this
   module sits alongside them without a second vocabulary.
   ========================================================================== */

:root {
  /* ── Core brand ── */
  --red:        #F1081D;
  --red-deep:   #C00516;
  --red-bright: #FF2438;
  --ink:        #111111;
  --black:      #000000;
  --white:      #FFFFFF;
  --paper:      #FBF7F2;
  --cream:      #F3ECE2;
  --line:       #E4DACD;
  --ash:        #6E665C;
  --ash-2:      #9A9388;
  --smoke:      #1A1A1A;
  --smoke-2:    #242424;
  /* Brand is RED + BLACK only. Token names are kept so existing usages
     keep working, but "done/good" now reads BLACK and "attention" DEEP RED.
     Status is differentiated by fill vs outline, never by a third hue. */
  --saffron:    #C00516;
  --leaf:       #111111;

  /* ── Semantic status ── */
  --ok:         #111111;
  --ok-bg:      #EFEAE1;
  --warn:       var(--red-deep);
  --warn-bg:    #FBE3E5;
  --bad:        var(--red);
  --bad-bg:     #FDE7E9;
  --info:       #4A443C;
  --info-bg:    #F3ECE2;
  --muted:      var(--ash);
  --border:     var(--line);
  --soft:       var(--paper);

  /* ── Type ── */
  --font-d:  'Anton', 'Arial Narrow', sans-serif;
  --font-ui: 'Barlow', system-ui, -apple-system, sans-serif;
  --font-c:  'Barlow Semi Condensed', 'Barlow', sans-serif;

  /* ── Radii & shadow ── */
  --r-xs: 4px; --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-pill: 999px;
  --sh-sm: 0 1px 2px rgba(17,17,17,.08);
  --sh-md: 0 6px 18px rgba(17,17,17,.12);
  --sh-lg: 0 18px 44px rgba(17,17,17,.18);
  --sh-red: 0 10px 30px rgba(241,8,29,.35);

  --sidebar-w: 248px;
}

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

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: var(--font-d);
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 400;
  margin: 0 0 .4em;
}

a { color: var(--red); text-decoration: none; }
a:hover { color: var(--red-deep); }

/* ==========================================================================
   LAYOUT — sidebar shell
   ========================================================================== */

.shell { display: flex; min-height: 100vh; }

.sb {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--smoke);
  color: rgba(255,255,255,.72);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sb-brand {
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sb-brand img { height: 34px; width: auto; display: block; }

.sb-nav { padding: 12px 10px; flex: 1; }

.sb-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  margin-bottom: 2px;
  border-radius: var(--r-sm);
  color: rgba(255,255,255,.72);
  font-size: 13.5px;
  font-weight: 600;
  transition: background .15s, color .15s;
  min-height: 44px;
}
.sb-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.sb-item.active { background: var(--red); color: #fff; box-shadow: var(--sh-red); }
.sb-icon { width: 18px; text-align: center; flex: 0 0 18px; }

.sb-foot {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.sb-user { font-size: 12.5px; color: rgba(255,255,255,.55); line-height: 1.3; }
.sb-user strong { display: block; color: #fff; font-size: 13.5px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 14px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar h1 { font-size: 22px; margin: 0; }

.burger {
  display: none;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  width: 42px; height: 42px;
  font-size: 19px;
  cursor: pointer;
  color: var(--ink);
}

.content { padding: 22px; flex: 1; }
.sb-overlay { display: none; }

/* ==========================================================================
   STAT CARDS
   ========================================================================== */

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }

.sc {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--ash-2);
  border-radius: var(--r-md);
  padding: 16px 18px;
  box-shadow: var(--sh-sm);
}
.sc-eyebrow {
  font-family: var(--font-c);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.sc-value { font-family: var(--font-d); font-size: 30px; line-height: 1; color: var(--ink); }
.sc.red     { border-left-color: var(--red); }
.sc.gold    { border-left-color: var(--saffron); }
.sc.dark    { border-left-color: var(--ink); }   /* was .green — palette is red+black now */
.sc.ink     { border-left-color: var(--ink); }

/* ==========================================================================
   PANELS
   ========================================================================== */

.panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-sm);
  margin-bottom: 20px;
  overflow: hidden;
}
.panel-head {
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.panel-title { font-family: var(--font-d); font-size: 17px; margin: 0; text-transform: uppercase; }
.panel-body { padding: 18px; }

/* ==========================================================================
   STATUS PILLS
   ========================================================================== */

.pill {
  display: inline-block;
  padding: 4px 11px;
  border-radius: var(--r-pill);
  font-family: var(--font-c);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .9px;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid transparent;
}
/* Red + black only, so state is carried by FILL vs OUTLINE rather than hue:
   solid black = finished, solid red = stopped, outlines = in flight. */
.pill-activated { color: #fff;            background: var(--ink);     border-color: var(--ink); }
.pill-approved  { color: var(--ink);      background: transparent;    border-color: var(--ink); }
.pill-pending   { color: var(--red-deep); background: var(--warn-bg); border-color: var(--red-deep); }
.pill-review    { color: var(--ash);      background: var(--cream);   border-color: var(--line); }
.pill-submitted { color: var(--ink);      background: var(--cream);   border-color: var(--line); }
.pill-rejected  { color: #fff;            background: var(--red);     border-color: var(--red); }
.pill-neutral   { color: var(--muted);    background: var(--paper);   border-color: var(--line); }
.pill-edited    { color: var(--red-deep); background: var(--bad-bg);  border-color: rgba(241,8,29,.4); cursor: help; }

/* ==========================================================================
   TABLES
   ========================================================================== */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.dt { width: 100%; min-width: 820px; border-collapse: collapse; font-size: 13.5px; }
.dt thead th {
  background: var(--paper);
  font-family: var(--font-c);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.dt tbody td { padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.dt tbody tr:last-child td { border-bottom: 0; }
.dt tbody tr:hover { background: var(--paper); }
.dt .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.dt .ref { font-family: var(--font-c); font-weight: 700; letter-spacing: .5px; }

.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty-title { font-family: var(--font-d); font-size: 19px; color: var(--ink); margin-bottom: 6px; text-transform: uppercase; }

/* ==========================================================================
   FORMS
   ========================================================================== */

.field { margin-bottom: 15px; }
.field-lbl { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

.inp, .ta, .sel-m {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  background: var(--white);
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.ta { height: auto; min-height: 104px; padding: 11px 13px; resize: vertical; line-height: 1.55; }

/* ── HOVER STATES ──────────────────────────────────────────────────────
   Every interactive surface reacts before it is clicked, so the form feels
   responsive rather than static. Hover is a border/tint shift only; focus
   keeps its stronger ring so keyboard users still get the louder signal. */
.inp:hover, .ta:hover, .sel-m:hover { border-color: var(--ash-2); }
.inp:hover:focus, .ta:hover:focus, .sel-m:hover:focus { border-color: var(--red); }
.field:hover .field-lbl { color: var(--red-deep); }
.fp-field { transition: background .15s, box-shadow .15s; border-radius: var(--r-sm); }
.fp-field:hover { background: rgba(241,8,29,.028); }
.seg-btn:hover { color: var(--ink); }
.dt tbody tr { transition: background .12s; }
.sc { transition: transform .15s, box-shadow .15s; }
.sc:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.panel { transition: box-shadow .18s; }
.btn { transition: background .15s, border-color .15s, color .15s, transform .12s, box-shadow .15s; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }

.inp:focus, .ta:focus, .sel-m:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(241,8,29,.10);
}
.inp.err, .ta.err, .sel-m.err { border-color: var(--red); background: #FFF8F8; }

.sel-m {
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236E665C' d='M1.4 0 6 4.6 10.6 0 12 1.4 6 7.4 0 1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.affix { display: flex; align-items: stretch; }
.pfx {
  display: flex; align-items: center;
  padding: 0 13px;
  background: var(--paper);
  border: 1.5px solid var(--border);
  border-right: 0;
  border-radius: 9px 0 0 9px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.affix .inp { border-radius: 0 9px 9px 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 15px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 15px; }

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border: 1.5px solid transparent;
  border-radius: 9px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .3px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
  white-space: nowrap;
}
.btn-block { width: 100%; height: 48px; }
.btn-sm    { height: 36px; padding: 0 13px; font-size: 12.5px; }

.btn-red   { background: var(--red);  color: #fff; border-color: var(--red); box-shadow: var(--sh-red); }
.btn-red:hover   { background: var(--red-deep); border-color: var(--red-deep); color: #fff; }
.btn-ink   { background: var(--ink);  color: #fff; border-color: var(--ink); }
.btn-ink:hover   { background: var(--smoke-2); color: #fff; }
.btn-green { background: var(--ink);  color: #fff; border-color: var(--ink); }
.btn-green:hover { background: var(--black); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--border); }
.btn-ghost:hover { background: var(--paper); color: var(--ink); }

.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* ==========================================================================
   SEGMENTED CONTROL  (percentage / flat toggle)
   ========================================================================== */

.seg { display: inline-flex; background: var(--paper); border: 1.5px solid var(--border); border-radius: 9px; padding: 3px; gap: 3px; }
.seg-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 7px;
  cursor: pointer;
  min-height: 36px;
}
.seg-btn.active { background: var(--white); color: var(--ink); box-shadow: 0 1px 3px rgba(17,17,17,.12); }

/* ==========================================================================
   MODALS
   ========================================================================== */

.overlay {
  position: fixed; inset: 0;
  background: rgba(17,17,17,.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
  z-index: 90;
}
.overlay.show { opacity: 1; pointer-events: auto; }

.modal-wrap {
  position: fixed; inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
  z-index: 100;
  overflow-y: auto;
}
.modal-wrap.show { opacity: 1; pointer-events: auto; }

.modal {
  background: var(--white);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  transform: translateY(14px) scale(.985);
  transition: transform .22s ease;
}
.modal-wrap.show .modal { transform: translateY(0) scale(1); }

.modal-head {
  padding: 17px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.modal-title { font-family: var(--font-d); font-size: 18px; margin: 0; text-transform: uppercase; }
.modal-x { background: none; border: 0; font-size: 24px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; min-height: 44px; min-width: 44px; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 15px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ==========================================================================
   PRICE PANEL  (live coupon preview — mirrors fp_coupon_discount())
   ========================================================================== */

.price-panel { background: var(--paper); border: 1px solid var(--border); border-radius: var(--r-md); padding: 15px 17px; margin: 15px 0; }
.price-row { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 0; font-size: 14px; }
.price-row.total {
  border-top: 1.5px dashed var(--line);
  margin-top: 8px; padding-top: 12px;
  font-family: var(--font-d); font-size: 20px; text-transform: uppercase;
}
.price-row .val { font-variant-numeric: tabular-nums; font-weight: 700; }
.price-row.discount .val { color: var(--leaf); }
.price-warn { color: var(--red-deep); font-size: 12.5px; font-weight: 600; margin-top: 9px; }

/* ── Coupon box (also mirrored inline in emails) ── */
.coupon-box {
  border: 2px dashed var(--leaf);
  background: var(--ok-bg);
  border-radius: var(--r-md);
  padding: 15px;
  text-align: center;
  margin: 15px 0;
}
.coupon-code {
  font-family: var(--font-c);
  font-size: 23px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--ink);
}

/* ==========================================================================
   ALERTS
   ========================================================================== */

.alert { padding: 12px 15px; border-radius: var(--r-sm); margin-bottom: 16px; font-size: 13.5px; border: 1px solid transparent; }
.alert-ok   { background: var(--ok-bg);   color: var(--ink);        border-color: rgba(17,17,17,.28); }
.alert-bad  { background: var(--bad-bg);  color: var(--red-deep);border-color: rgba(241,8,29,.28); }
.alert-warn { background: var(--warn-bg); color: #8a5c00;        border-color: rgba(242,161,0,.35); }
.alert ul { margin: 6px 0 0; padding-left: 18px; }

/* ==========================================================================
   RESPONSIVE
   Breakpoints per spec: 1024 sidebar->drawer, 768 tables->cards, 640 modals->sheets
   ========================================================================== */

@media (max-width: 1024px) {
  .burger { display: inline-flex; align-items: center; justify-content: center; }
  .sb {
    position: fixed; top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 95;
  }
  .sb.open { transform: translateX(0); }
  .sb-overlay {
    display: block;
    position: fixed; inset: 0;
    background: rgba(17,17,17,.5);
    opacity: 0; pointer-events: none;
    transition: opacity .25s;
    z-index: 94;
  }
  .sb-overlay.show { opacity: 1; pointer-events: auto; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .content { padding: 15px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  /* Tables stack into cards; each cell labelled by its header. */
  .dt.stack { min-width: 0; }
  .dt.stack thead { display: none; }
  .dt.stack tbody tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    margin-bottom: 11px;
    padding: 5px 0;
    background: var(--white);
  }
  .dt.stack tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    border-bottom: 0;
    padding: 8px 14px;
    text-align: right;
  }
  .dt.stack tbody td::before {
    content: attr(data-lbl);
    font-family: var(--font-c);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .9px;
    text-transform: uppercase;
    color: var(--muted);
    text-align: left;
    flex: 0 0 auto;
  }
}

@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr; }
  .modal-wrap { align-items: flex-end; padding: 0; }
  .modal {
    max-width: 100%;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    max-height: 92vh;
    transform: translateY(100%);
  }
  .modal-wrap.show .modal { transform: translateY(0); }
  .modal-foot .btn { flex: 1; }
}

@media print {
  .sb, .topbar, .burger, .modal-wrap, .overlay { display: none !important; }
  .content { padding: 0; }
}

/* ==========================================================================
   BRAND MARK — mascot only
   The mascot PNG is black line art on transparency. On the dark header or
   sidebar it would disappear, so it sits on a white disc, mirroring the
   white separation it already has inside the full brand logo.
   ========================================================================== */
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; flex: 0 0 46px;
  background: var(--white); border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  transition: transform .18s, box-shadow .18s;
}
.brand-mark img { height: 34px; width: auto; display: block; }
.brand-mark:hover { transform: scale(1.05); box-shadow: 0 4px 14px rgba(241,8,29,.45); }
.brand-mark-lg { width: 84px; height: 84px; flex-basis: 84px; }
.brand-mark-lg img { height: 62px; }

/* ==========================================================================
   WIZARD PROGRESS
   The step is announced in words. The ticks below are unlabelled -- ten
   numbered chips added clutter without telling the applicant anything the
   heading does not already say.
   ========================================================================== */
.step-label {
  font-family: var(--font-d);
  font-size: 15px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink);
  margin-top: 13px;
}
.step-label span { color: var(--red); }

.step-dots { display: flex; gap: 4px; margin-top: 9px; }
.step-dot {
  flex: 1;
  height: 6px;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--line);
  cursor: pointer;
  transition: background .2s, transform .15s;
}
.step-dot:hover  { transform: scaleY(1.9); background: var(--ash-2); }
.step-dot.done   { background: var(--ink); }
.step-dot.active { background: var(--red); transform: scaleY(1.9); }
.step-dot.bad    { background: var(--red-bright); }
