/* ═══════════════════════════════════════════════
   FeminineCart Dispatch Studio — Premium Edition
   ═══════════════════════════════════════════════ */

:root {
  --ink: #13091F;
  --wine: #5B2D8E;
  --wine-dark: #3B1260;
  --wine-light: #7C3AED;
  --rose: #8B5CCE;
  --blush: #EDE0FF;
  --cream: #F8F4FF;
  --paper: #ffffff;
  --line: #D8C8F0;
  --muted: #8B7AAB;
  --gold: #C9A227;
  --gold-light: #FAF0C8;
  --shadow-xs: 0 1px 2px rgba(59,18,96,.05), 0 2px 8px rgba(59,18,96,.06);
  --shadow: 0 2px 6px rgba(59,18,96,.05), 0 10px 28px rgba(59,18,96,.09), 0 24px 52px rgba(59,18,96,.05);
  --shadow-float: 0 4px 10px rgba(59,18,96,.06), 0 20px 48px rgba(59,18,96,.14), 0 48px 96px rgba(59,18,96,.08);
  --radius: 7px;
  --radius-sm: 4px;
}

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

body {
  margin: 0;
  background: #F3EEFF;
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Auth shell toggle ── */
.app-shell { display: none; }
body.authenticated .app-shell { display: block; }
body.authenticated .login-screen { display: none; }

/* ── Login ── */
.login-screen {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #F3EEFF 0%, #E4D4F8 50%, #EDE0FF 100%);
  padding: 20px;
}
.login-card {
  width: min(420px, 100%);
  padding: 44px;
  border: 1px solid rgba(91,45,142,.14);
  background: rgba(255,252,255,.95);
  backdrop-filter: blur(20px);
  box-shadow: 0 24px 80px rgba(59,18,96,.18), 0 2px 0 rgba(255,255,255,.8) inset;
  border-radius: var(--radius);
  text-align: center;
}
.login-card .brand { justify-content: center; margin-bottom: 28px; }
.login-card h1 { font: 600 30px/1.1 'Playfair Display', serif; margin: 0 0 10px; letter-spacing: -.03em; }
.login-card > p { color: var(--muted); font-size: 13px; line-height: 1.7; margin: 0 0 26px; }
.login-card label { text-align: left; margin-bottom: 14px; }
.login-card .primary-button { width: 100%; margin-top: 8px; justify-content: center; }
.login-error { color: #b24646 !important; min-height: 20px; margin: 12px 0 0 !important; font-size: 11px !important; }

/* ── Toast ── */
.toast {
  position: fixed; left: 50%; bottom: 24px;
  transform: translate(-50%, 16px);
  opacity: 0;
  background: var(--ink); color: #fff;
  padding: 12px 20px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600;
  box-shadow: 0 8px 28px rgba(28,16,24,.25);
  pointer-events: none; transition: .22s;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── App shell ── */
.app-shell {
  max-width: 1520px;
  margin: auto;
  padding: 0 40px 88px;
}

/* ── Topbar ── */
.topbar {
  height: 88px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}
.topbar::after {
  content: '';
  position: absolute;
  bottom: 0; left: -40px; right: -40px;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--blush) 15%,
    var(--wine-light) 40%,
    var(--rose) 50%,
    var(--wine-light) 60%,
    var(--blush) 85%,
    transparent 100%);
  opacity: .7;
}

/* ── Brand ── */
.brand {
  color: var(--ink); text-decoration: none;
  font-family: 'Playfair Display', serif;
  font-size: 22px; font-weight: 700;
  display: flex; align-items: center; gap: 11px;
  letter-spacing: -.025em;
}
.brand small {
  font-family: 'Plus Jakarta Sans';
  font-size: 10px; text-transform: uppercase;
  letter-spacing: .18em; color: var(--rose);
  border-left: 1px solid var(--line);
  padding-left: 12px; font-weight: 600;
}
.brand-mark {
  font-family: 'Playfair Display';
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(145deg, var(--wine-light) 0%, var(--wine) 50%, var(--wine-dark) 100%);
  color: #fff; font-size: 20px;
  box-shadow: 0 3px 10px rgba(90,31,71,.45), inset 0 1px 0 rgba(255,255,255,.15);
}

/* ── Topbar actions ── */
.topbar-actions {
  display: flex; align-items: center; gap: 12px;
  color: var(--muted); font-size: 12px;
}
.live-dot {
  height: 7px; width: 7px; border-radius: 50%;
  background: #5b946a;
  box-shadow: 0 0 0 3px rgba(91,148,106,.2), 0 0 0 6px rgba(91,148,106,.07);
}

/* ── Buttons ── */
button { font: inherit; cursor: pointer; }

.primary-button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--wine-dark);
  background: linear-gradient(160deg, var(--wine-light) 0%, var(--wine) 45%, var(--wine-dark) 100%);
  color: #fff; font-weight: 700; font-size: 12px; letter-spacing: .04em;
  transition: all .18s; position: relative; overflow: hidden;
  box-shadow: 0 2px 8px rgba(90,31,71,.32), inset 0 1px 0 rgba(255,255,255,.12);
  text-decoration: none;
}
.primary-button::before {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 45%;
  background: linear-gradient(180deg, rgba(255,255,255,.1) 0%, transparent 100%);
  pointer-events: none;
}
.primary-button:hover {
  box-shadow: 0 4px 18px rgba(90,31,71,.45), inset 0 1px 0 rgba(255,255,255,.1);
  transform: translateY(-1px);
}
.primary-button span { font-size: 17px; vertical-align: -1px; }

.secondary-button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255,255,255,.9);
  color: var(--wine); font-weight: 700; font-size: 12px; letter-spacing: .02em;
  transition: all .18s;
  box-shadow: var(--shadow-xs);
  text-decoration: none;
}
.secondary-button:hover {
  border-color: var(--rose);
  box-shadow: 0 4px 14px rgba(58,22,42,.1);
  transform: translateY(-1px);
}

/* ── Eyebrow / headings ── */
.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 10px; letter-spacing: .22em;
  text-transform: uppercase; font-weight: 700;
}
.intro h1, h2 { font-family: 'Playfair Display'; margin: 0; }
.intro h1 {
  font-size: clamp(40px, 5vw, 66px);
  line-height: 1.02; letter-spacing: -.05em;
}
.intro h1 em { font-weight: 600; color: var(--wine); }

/* ── Intro ── */
.intro {
  padding: 62px 0 50px;
  display: flex; justify-content: space-between;
  align-items: flex-end; gap: 40px;
}
.intro-stats {
  display: flex; align-items: center; gap: 28px;
  padding: 20px 28px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(255,255,255,.85);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255,255,255,.6);
  flex-shrink: 0;
}
.stat { text-align: center; }
.stat-num {
  display: block;
  font-family: 'Playfair Display'; font-size: 38px; font-weight: 700;
  color: var(--wine); line-height: 1; letter-spacing: -.04em;
}
.stat span:last-child {
  display: block; font-size: 10px;
  text-transform: uppercase; letter-spacing: .16em;
  color: var(--muted); margin-top: 5px;
}
.stat-divider { width: 1px; height: 44px; background: var(--line); }

/* ── Workspace ── */
.workspace {
  display: block;
}
.form-panel { max-width: 860px; }

/* ── Panel card ── */
.panel {
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,.65);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}
.form-panel { padding: 36px; }

.panel-heading {
  display: flex; justify-content: space-between; align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 22px;
}
.panel-heading h2 { font-size: 24px; letter-spacing: -.03em; margin-top: 4px; }
.label-area-heading h2 { font-size: 24px; letter-spacing: -.03em; }
.step { font-family: 'DM Mono'; font-size: 11px; color: var(--muted); }

/* ── Form sections ── */
.form-section { padding: 22px 0; border-bottom: 1px solid var(--line); }
.section-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .18em;
  color: var(--wine); margin-bottom: 18px;
}
.section-label::before {
  content: '';
  width: 3px; height: 13px;
  background: linear-gradient(180deg, var(--wine-light), var(--rose));
  border-radius: 2px; flex-shrink: 0;
}

/* ── Field grid ── */
.field-grid { display: grid; gap: 14px; }
.field-grid.two { grid-template-columns: 1fr 1fr; }
.field-grid .full { grid-column: 1 / -1; }

label {
  font-size: 11px; font-weight: 700;
  letter-spacing: .05em; color: #7a5c6a; display: block;
}
input, textarea, select {
  display: block; width: 100%;
  border: 1px solid #ddd0d8;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.82);
  color: var(--ink);
  font: 400 13px 'Plus Jakarta Sans';
  padding: 11px 13px; margin-top: 7px;
  outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
input:hover, textarea:hover { border-color: var(--rose); }
input:focus, textarea:focus, select:focus {
  border-color: var(--wine);
  box-shadow: 0 0 0 3px rgba(124,45,95,.1);
  background: #fff;
}
textarea { resize: vertical; line-height: 1.5; }
select { appearance: none; 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 d='M1 1l5 5 5-5' stroke='%238a6d79' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; cursor: pointer; }

/* ── Input with unit addon ── */
.input-unit { position: relative; margin-top: 7px; }
.input-unit input { margin-top: 0; padding-right: 44px; }
.unit-badge {
  position: absolute; right: 1px; top: 1px; bottom: 1px;
  display: flex; align-items: center; padding: 0 11px;
  font-size: 10px; font-weight: 700; letter-spacing: .07em; color: var(--muted);
  background: rgba(237,223,232,.55); border-left: 1px solid var(--line);
  border-radius: 0 3px 3px 0; pointer-events: none;
}

/* ── Payment toggle ── */
.pay-toggle {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px; margin-bottom: 14px;
}
.pay-opt {
  padding: 12px 8px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--paper);
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
  color: var(--muted); cursor: pointer; transition: .18s;
  text-align: center;
}
.pay-opt:hover { border-color: var(--rose); color: var(--wine); background: rgba(255,252,250,.9); }
.pay-opt.active[data-val="PAID"]        { background: #eaf4ed; border-color: #4a8c5c; color: #2d6e42; }
.pay-opt.active[data-val="COD"]         { background: #fff4e6; border-color: #d4830a; color: #a35e08; }
.pay-opt.active[data-val="PARTIAL COD"] { background: #fef9e7; border-color: #c9a227; color: #8c6e0a; }

/* ── Form footer ── */
.form-footer {
  padding-top: 22px;
  display: flex; justify-content: space-between; align-items: center;
  color: var(--muted); font-size: 11px;
}

/* ── Tracking panel ── */
.tracking-panel { padding: 28px; }
.tracking-copy { font-size: 12px; line-height: 1.8; color: var(--muted); margin: 18px 0; }
.track-search { display: flex; gap: 7px; }
.track-search input { margin: 0; }
.track-search button {
  background: var(--ink); color: #fff; border: 0;
  border-radius: var(--radius-sm); padding: 0 14px;
  font-size: 12px; font-weight: 700; white-space: nowrap; transition: .15s;
}
.track-search button:hover { background: var(--wine); }
.track-result {
  margin: 18px 0 20px; padding: 16px;
  border: 1px dashed #d8c4ce; border-radius: var(--radius-sm); min-height: 96px;
}
.track-result.empty {
  text-align: center; color: var(--muted); font-size: 12px;
  display: grid; place-items: center; gap: 5px;
}
.track-result p { margin: 0; }
.empty-icon { font-size: 24px; color: var(--rose); }
.track-result strong { font-family: 'DM Mono'; font-size: 13px; }
.track-details { display: grid; gap: 8px; font-size: 12px; color: var(--muted); }
.track-details b { color: var(--ink); }
.status { display: inline-block; background: #e8f3e9; color: #477753; font-size: 10px; font-weight: 700; letter-spacing: .08em; padding: 4px 8px; border-radius: 3px; }
.recent-head {
  display: flex; justify-content: space-between;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .13em; color: var(--wine);
  padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.recent-head button { border: 0; background: none; color: var(--muted); font-size: 10px; cursor: pointer; }
.recent-orders { max-height: 220px; overflow: auto; }
.recent-order {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid #f0e8ea; cursor: pointer; transition: .12s;
}
.recent-order:hover { opacity: .75; }
.recent-order strong { font-family: 'DM Mono'; font-size: 11px; }
.recent-order small { color: var(--muted); display: block; margin-top: 3px; }

/* ── Label area ── */
.label-area { margin-top: 70px; }
.label-area-heading {
  display: flex; justify-content: space-between;
  align-items: flex-end; margin-bottom: 26px;
}
.label-actions { display: flex; gap: 8px; }
.label-stage {
  padding: 56px;
  background: linear-gradient(155deg, #281020 0%, #180c14 55%, #20101c 100%);
  display: flex; justify-content: center;
  border-radius: var(--radius);
  position: relative; overflow: hidden;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.04), 0 16px 48px rgba(0,0,0,.22);
}
.label-stage::before {
  content: ''; position: absolute; inset: 0; border-radius: var(--radius);
  background: radial-gradient(ellipse at 25% 25%, rgba(124,45,95,.25) 0%, transparent 65%),
              radial-gradient(ellipse at 75% 80%, rgba(163,72,118,.12) 0%, transparent 55%);
  pointer-events: none;
}

/* ── Thermal label ── */
.thermal-label {
  width: 4in; height: 6in;
  background: #fff; color: #111;
  padding: .2in .22in;
  font-family: 'Plus Jakarta Sans';
  display: flex; flex-direction: column;
  position: relative; z-index: 1;
  border: 1px solid #d0c0c8;
  box-shadow:
    0 4px 12px rgba(0,0,0,.12),
    0 20px 56px rgba(0,0,0,.38),
    0 48px 96px rgba(0,0,0,.18);
}

.label-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  border-bottom: 2.5px solid #111;
  padding-bottom: 10px;
}
.label-logo {
  font-family: 'Playfair Display'; font-size: 24px;
  font-weight: 700; letter-spacing: -.06em; line-height: 1;
}
.label-logo span { font-style: italic; }
.label-type {
  text-align: right; font-family: 'DM Mono';
  font-size: 8px; letter-spacing: .14em; line-height: 1.65; color: #444;
}

.label-order {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; padding: 9px 0; border-bottom: 1px solid #bbb;
}
.label-order div:last-child { text-align: right; }
.label-order span, .route-tag {
  display: block; font-family: 'DM Mono';
  font-size: 7.5px; letter-spacing: .12em; color: #555; margin-bottom: 3px;
}
.label-order strong { font-family: 'DM Mono'; font-size: 12.5px; }

.label-route {
  display: grid; grid-template-columns: 1fr 32px 1.2fr;
  gap: 8px; padding: 11px 0; border-bottom: 2px solid #111; flex: 1;
}
.label-route p { white-space: pre-line; }
.label-route section { font-size: 9.5px; line-height: 1.5; }
.label-route strong { font-size: 12px; display: block; margin-bottom: 5px; }
.label-route p { margin: 0; color: #333; }
.route-line {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; color: #777;
  font-family: 'DM Mono'; font-size: 7px; gap: 4px;
}
.route-line i { font-style: normal; color: #111; font-size: 18px; line-height: 1; }

.label-product {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid #bbb; gap: 8px;
}
.lp-left { flex: 1; min-width: 0; }
.lp-label {
  font-family: 'DM Mono'; font-size: 7.5px;
  letter-spacing: .12em; color: #555; display: block; margin-bottom: 2px;
}
.lp-desc { font-size: 10px; font-weight: 600; color: #111; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-meta { display: flex; gap: 12px; flex-shrink: 0; }
.lp-meta-item { text-align: center; }
.lp-meta-num { font-family: 'DM Mono'; font-size: 11px; font-weight: 700; color: #111; display: block; }
.lp-meta-lbl { font-family: 'DM Mono'; font-size: 7px; letter-spacing: .1em; color: #666; display: block; }

.label-barcode { text-align: center; padding: 10px 0 8px; border-bottom: 1px solid #bbb; }
.label-barcode svg { width: 100%; height: 58px; display: block; }
.label-barcode strong { font-family: 'DM Mono'; font-size: 11.5px; letter-spacing: .14em; margin-top: 5px; display: block; }

.label-bottom {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 9px; gap: 8px;
}
.label-pay-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px; border-radius: 3px;
  font-family: 'DM Mono'; font-size: 9px; font-weight: 700;
  letter-spacing: .1em; white-space: nowrap; flex-shrink: 0;
}
.pay-badge-paid    { background: #e8f4ed; color: #2d6e42; border: 1px solid #a8ccb2; }
.pay-badge-cod     { background: #fff5e6; color: #a35e08; border: 1px solid #f0c070; }
.pay-badge-partial { background: #fef9e7; color: #8c6e0a; border: 1px solid #e8d060; }
.label-bottom-meta { text-align: right; }
.label-bottom-meta span { display: block; font-family: 'DM Mono'; font-size: 7px; letter-spacing: .06em; color: #666; line-height: 1.7; }

.print-note { text-align: center; color: var(--muted); font-size: 11px; margin: 18px 0; }

/* ── Responsive ── */
@media (max-width: 880px) {
  .app-shell { padding: 0 20px 56px; }
  .topbar { height: 72px; }
  .topbar::after { left: -20px; right: -20px; }
  .brand small, .topbar-actions > span:not(.live-dot) { display: none; }
  .intro { padding: 44px 0 36px; flex-direction: column; align-items: flex-start; gap: 24px; }
  .intro-stats { width: 100%; justify-content: space-around; }
  .workspace { grid-template-columns: 1fr; }
  .form-panel, .tracking-panel { padding: 22px; }
  .field-grid.two { grid-template-columns: 1fr; }
  .field-grid .full { grid-column: auto; }
  .pay-toggle { grid-template-columns: 1fr 1fr; }
  .pay-toggle .pay-opt:last-child { grid-column: 1 / -1; }
  .form-footer, .label-area-heading { align-items: flex-start; gap: 14px; flex-direction: column; }
  .label-stage { padding: 20px 6px; overflow: auto; justify-content: flex-start; }
  .thermal-label { flex: none; }
  .label-actions { width: 100%; }
  .label-actions button, .label-actions a { flex: 1; justify-content: center; }
}

/* ── Print ── */
@media print {
  @page { size: 4in 6in; margin: 0; }

  /* Remove every non-label element from layout completely */
  .login-screen,
  .topbar,
  .intro,
  .workspace,
  .label-area-heading,
  .label-stage::before,
  .print-note,
  .toast { display: none !important; }

  html, body {
    margin: 0 !important; padding: 0 !important;
    background: #fff !important; overflow: hidden !important;
  }

  .app-shell { padding: 0 !important; max-width: none !important; }
  main       { margin: 0 !important; padding: 0 !important; }
  .label-area { margin: 0 !important; padding: 0 !important; }

  .label-stage {
    padding: 0 !important; margin: 0 !important;
    background: none !important; box-shadow: none !important;
    border-radius: 0 !important; min-height: 0 !important;
    display: flex !important; justify-content: flex-start !important;
  }

  .thermal-label {
    flex: none !important;
    width: 4in !important; height: 6in !important;
    margin: 0 !important; padding: .2in .22in !important;
    box-shadow: none !important; border: 1px solid #ccc !important;
  }
}
