/* =====================================================================
   Le Florist BD — Admin
   Palette is drawn from the workroom, not the storefront: stem-dark ink,
   cool paper, and a deep orchid plum for accents. Profit reads leaf-green,
   pre-order reads gold. Figures are set in a serif so money is the loudest
   thing on the page without needing colour to shout.
   ===================================================================== */

:root {
  --ink:      #1B2420;
  --ink-2:    #2A3630;
  --ink-3:    #46554D;
  --muted:    #6E7D74;
  --paper:    #FFFFFF;
  --canvas:   #F1F4F0;
  --line:     #DCE3D9;
  --line-2:   #EBEFE9;

  --plum:     #7A2E4E;
  --plum-dim: #F3E7EC;
  --leaf:     #3D6B4C;
  --leaf-dim: #E6EFE7;
  --gold:     #9A7526;
  --gold-dim: #F6EFDD;
  --clay:     #A33A2A;
  --clay-dim: #F7E6E2;

  --r:        6px;
  --sidebar:  248px;

  --sans: 'Hind Siliguri', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--plum); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--plum);
  outline-offset: 2px;
  border-radius: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Wordmark ---------- */
.wordmark {
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1;
  letter-spacing: -.01em;
}
.wordmark em { font-style: italic; }

/* ---------- Centered pages (login, installer, errors) ---------- */
.centered {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}
.centered-inner { width: 100%; max-width: 384px; }

.centered-wide { max-width: 720px; }

/* A single hairline stem running down the left of the form —
   the one decorative gesture on the page. */
.stem {
  border-left: 1px solid var(--line);
  padding-left: 22px;
}

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  margin-bottom: 5px;
}
.input, select.input, textarea.input {
  width: 100%;
  padding: 9px 12px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: border-color .12s ease;
}
.input:focus { border-color: var(--plum); outline: none; box-shadow: 0 0 0 3px var(--plum-dim); }
.input::placeholder { color: #A6B2AA; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: var(--r);
  cursor: pointer;
  transition: background-color .12s ease, border-color .12s ease;
}
.btn-primary { background: var(--plum); color: #fff; }
.btn-primary:hover { background: #642541; text-decoration: none; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--line-2); text-decoration: none; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Messages ---------- */
.msg {
  padding: 11px 14px;
  border-radius: var(--r);
  font-size: 14px;
  margin-bottom: 18px;
  border: 1px solid transparent;
}
.msg-error   { background: var(--clay-dim); border-color: #E8C9C2; color: #7C2A1D; }
.msg-success { background: var(--leaf-dim); border-color: #C8DCCB; color: #2C5137; }
.msg-info    { background: var(--plum-dim); border-color: #E3CDD6; color: #5E2340; }

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

.sidebar {
  width: var(--sidebar);
  flex: 0 0 var(--sidebar);
  background: var(--ink);
  color: #C7D2CA;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  padding: 22px 20px 18px;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand small {
  display: block;
  font-size: 11.5px;
  color: #7E9188;
  margin-top: 2px;
}
.nav { padding: 14px 10px; flex: 1; overflow-y: auto; }
.nav-group {
  font-size: 11.5px;
  color: #6C7F76;
  padding: 14px 10px 6px;
  letter-spacing: .02em;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  color: #C7D2CA;
  border-radius: var(--r);
  font-size: 14.5px;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav a.is-active { background: var(--plum); color: #fff; }
.nav a .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; opacity: .55; flex: none;
}
.nav a.soon { opacity: .42; cursor: default; }
.nav a.soon:hover { background: none; color: #C7D2CA; }

.sidebar-foot {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 12.5px;
  color: #7E9188;
}
.sidebar-foot a { color: #C7D2CA; }

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

.topbar {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topbar h1 { font-size: 19px; font-weight: 600; margin: 0; }
.topbar .who { font-size: 13px; color: var(--muted); text-align: right; }
.topbar .who strong { display: block; color: var(--ink); font-weight: 500; }

.content { padding: 28px; flex: 1; }
.content > * + * { margin-top: 24px; }

/* ---------- Figures: the one loud element ---------- */
.figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.figure { background: var(--paper); padding: 18px 20px 20px; }
.figure .label { font-size: 13px; color: var(--muted); }
.figure .value {
  font-family: var(--serif);
  font-size: 38px;
  line-height: 1.1;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.figure .value.leaf { color: var(--leaf); }
.figure .value.plum { color: var(--plum); }
.figure .sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* ---------- Panels & tables ---------- */
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.panel-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.panel-head h2 { font-size: 15.5px; font-weight: 600; margin: 0; }
.panel-body { padding: 18px; }

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: #F8FAF7;
}
table.data td { padding: 11px 18px; border-bottom: 1px solid var(--line-2); }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }

.empty { padding: 40px 18px; text-align: center; color: var(--muted); }
.empty p { margin: 0 0 14px; }

/* ---------- Tags ---------- */
.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 12.5px;
  line-height: 1.6;
  border: 1px solid transparent;
}
.tag-pending  { background: var(--gold-dim); color: var(--gold); border-color: #E5D6AE; }
.tag-active   { background: var(--plum-dim); color: var(--plum); border-color: #E3CDD6; }
.tag-done     { background: var(--leaf-dim); color: var(--leaf); border-color: #C8DCCB; }
.tag-off      { background: var(--line-2); color: var(--muted); border-color: var(--line); }
.tag-bad      { background: var(--clay-dim); color: var(--clay); border-color: #E8C9C2; }

/* ---------- Installer steps ---------- */
.steps { display: flex; gap: 0; margin-bottom: 28px; border-bottom: 1px solid var(--line); }
.step {
  flex: 1;
  padding: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.step b { display: block; font-weight: 500; color: var(--ink-3); }
.step.done { color: var(--leaf); border-bottom-color: var(--leaf); }
.step.done b { color: var(--leaf); }
.step.now { color: var(--plum); border-bottom-color: var(--plum); }
.step.now b { color: var(--plum); }

.check { width: 100%; border-collapse: collapse; font-size: 14px; }
.check td { padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.check td:last-child { text-align: right; }
.ok   { color: var(--leaf); }
.fail { color: var(--clay); }
.warn { color: var(--gold); }

.stack > * + * { margin-top: 20px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px; }
  .nav-group { display: none; }
  .nav a { padding: 7px 12px; }
  .content, .topbar { padding: 18px; }
  .row2 { grid-template-columns: 1fr; }
  .figure .value { font-size: 32px; }
}

/* ---------- Gallery ---------- */
.grid-media {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 16px;
}
.media-card { margin: 0; }
.media-card a { display: block; }
.media-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--line-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  display: block;
}
.media-card figcaption { padding-top: 7px; }
.media-name {
  display: block;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.media-meta { display: block; font-size: 12px; color: var(--muted); }
.media-actions { display: flex; gap: 12px; margin-top: 5px; }
.media-actions form { display: inline; }

.linkish {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 12.5px;
  color: var(--plum);
  cursor: pointer;
  text-decoration: underline;
}
.linkish.danger { color: var(--clay); }

.media-edit { margin-top: 8px; display: grid; gap: 6px; }
.media-edit .input { font-size: 13px; padding: 6px 9px; }
.media-edit .btn { padding: 6px 12px; font-size: 13.5px; }

.pager { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 22px; }
.pager a {
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: 13.5px;
  color: var(--ink);
}
.pager a:hover { background: var(--line-2); text-decoration: none; }
.pager a.is-active { background: var(--plum); border-color: var(--plum); color: #fff; }

/* Picker used by the catalog forms */
.media-picker { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.media-picker .grid-media { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.media-picker label { cursor: pointer; display: block; }
.media-picker input[type=radio] { position: absolute; opacity: 0; }
.media-picker input[type=radio]:checked + img {
  border-color: var(--plum);
  box-shadow: 0 0 0 3px var(--plum-dim);
}
.media-picker input[type=radio]:focus-visible + img { outline: 2px solid var(--plum); outline-offset: 2px; }

/* ---------- Catalog ---------- */
.head-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.row-thumb {
  width: 40px; height: 30px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 4px;
  display: block;
}
.row-thumb-empty { background: var(--line-2); }

.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  color: var(--ink-3);
  margin-top: 6px;
  font-weight: 400;
  cursor: pointer;
}
.check-row input { margin-top: 4px; flex: none; }

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 4px;
}

.btn-danger { background: var(--clay); color: #fff; }
.btn-danger:hover { background: #8A2E20; text-decoration: none; }

.inline-form {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  padding: 12px 0;
}
.inline-field { display: block; flex: 1 1 160px; min-width: 120px; }
.inline-field > span {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 4px;
}
.inline-form .check-row { margin-top: 0; padding-bottom: 9px; }
.inline-form .input { padding: 7px 10px; font-size: 14px; }

textarea.input { resize: vertical; min-height: 68px; font-family: inherit; }

@media (max-width: 860px) {
  .row3 { grid-template-columns: 1fr; }
  .head-tools { width: 100%; }
  .head-tools form { width: 100%; }
}

/* ---------- Permission checklists ---------- */
.perm-group { border-top: 1px solid var(--line-2); padding-top: 14px; }
.perm-group:first-of-type { border-top: 0; padding-top: 0; }
.perm-group h3 {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  margin: 0 0 4px;
  letter-spacing: .02em;
}
.perm-group .check-row { margin-top: 3px; }
.perm-group .tag { margin-left: 6px; }

/* ---------- Builder preview ---------- */
.pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 2px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px 14px;
  max-height: 260px;
  overflow-y: auto;
}

.concept { display: grid; grid-template-columns: 320px 1fr; gap: 22px; align-items: start; }
.concept-img img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r);
  display: block;
}
.concept-img-empty {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: var(--line-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--muted);
  font-size: 13.5px;
}
.concept-body table.data th:first-child,
.concept-body table.data td:first-child { padding-left: 0; }
.concept-body table.data th:last-child,
.concept-body table.data td:last-child { padding-right: 0; }

details summary { cursor: pointer; list-style: none; }
details summary::-webkit-details-marker { display: none; }

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

/* ---------- Settings with a side menu ---------- */
.settings-layout { display: grid; grid-template-columns: 210px 1fr; gap: 24px; align-items: start; }

.settings-nav {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 6px;
  position: sticky;
  top: 24px;
}
.settings-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 11px;
  border-radius: var(--r);
  color: var(--ink);
  font-size: 14.5px;
}
.settings-nav a:hover { background: var(--line-2); text-decoration: none; }
.settings-nav a.is-active { background: var(--plum); color: #fff; }
.settings-nav .count { font-size: 12px; opacity: .55; font-variant-numeric: tabular-nums; }

.settings-body > * + * { margin-top: 24px; }

@media (max-width: 860px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; display: flex; flex-wrap: wrap; gap: 4px; }
  .settings-nav a { padding: 7px 12px; }
  .settings-nav .count { display: none; }
}

.plain-list { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--ink-3); }
.plain-list li { margin-bottom: 3px; }

/* ---------- Order detail ---------- */
.order-grid { display: grid; grid-template-columns: 300px 1fr; gap: 24px; align-items: start; }
.order-grid table.data th:first-child,
.order-grid table.data td:first-child { padding-left: 0; }
.order-grid table.data th:last-child,
.order-grid table.data td:last-child { padding-right: 0; }

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

/* ---------- Order stage strip ---------- */
.stage-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}
.stage-now { font-size: 15px; color: var(--ink-3); }
.stage-now .tag { margin-right: 8px; }
.stage-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stage-actions form { display: inline; }

.btn-sm { padding: 7px 13px; font-size: 14px; }

.track {
  display: flex;
  gap: 4px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.track span {
  flex: 1 1 auto;
  min-width: 88px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  padding: 5px 8px;
  background: var(--line-2);
  border-radius: 4px;
}
.track span.done { background: var(--leaf-dim); color: var(--leaf); }
.track span.now  { background: var(--plum); color: #fff; }

/* ---------- Money summary ---------- */
.money-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.money-box { background: var(--paper); padding: 14px 16px 16px; }
.money-box .label { font-size: 12.5px; color: var(--muted); }
.money-box .value {
  font-family: var(--serif);
  font-size: 27px;
  line-height: 1.15;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.money-box .value.leaf { color: var(--leaf); }
.money-box .value.plum { color: var(--plum); }
.money-box .sub { font-size: 12px; color: var(--muted); }

input.qty { text-align: right; padding: 6px 9px; }

.pin-input {
  text-align: center;
  font-size: 26px;
  letter-spacing: 14px;
  padding: 12px;
  font-family: var(--serif);
}

.area-search { margin-bottom: 8px; }

.cost-quick { display: flex; gap: 5px; align-items: center; justify-content: flex-end; }
.cost-quick .qty { width: 72px; padding: 5px 7px; font-size: 13px; }

/* ---------- Simple bar chart ---------- */
.bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 180px;
  padding-bottom: 22px;
  overflow-x: auto;
}
.bar {
  flex: 1 1 26px;
  min-width: 26px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
}
.bar-fill { background: var(--plum); border-radius: 3px 3px 0 0; min-height: 3px; }
.bar-label {
  position: absolute;
  bottom: -20px;
  left: 0; right: 0;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- Collapsible catalog sections ---------- */
.pick-section { border-top: 1px solid var(--line); }
.pick-section > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  cursor: pointer;
  font-size: 14.5px;
  font-weight: 500;
  list-style: none;
}
.pick-section > summary::-webkit-details-marker { display: none; }
.pick-section > summary::before {
  content: "▸";
  color: var(--muted);
  font-size: 12px;
  margin-right: 2px;
  transition: transform .12s ease;
}
.pick-section[open] > summary::before { content: "▾"; }
.pick-section > summary:hover { background: #F8FAF7; }
.pick-section > summary > span:first-of-type { flex: 1; }
.pick-section table.data thead { display: none; }

/* ---------- Running total while an order is being typed ---------- */
.tally {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin: 18px 0 0;
  padding: 13px 20px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--r);
  box-shadow: 0 6px 24px rgba(31, 36, 30, .22);
}
.tally-lines {
  display: flex;
  gap: 16px;
  align-items: baseline;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: rgba(255, 255, 255, .72);
  font-variant-numeric: tabular-nums;
}
.tally-lines strong { color: #fff; font-weight: 500; }
.tally-lines .was { color: rgba(255, 255, 255, .45); }
.tally-total { display: flex; align-items: baseline; gap: 10px; }
.tally-total .label { font-size: 13px; color: rgba(255, 255, 255, .7); }
.tally-total .value {
  font-family: var(--serif);
  font-size: 25px;
  font-variant-numeric: tabular-nums;
}
.tally-total .profit { font-size: 13px; color: #A8D0A0; font-variant-numeric: tabular-nums; }
.tally-total .profit.bad { color: #F0B3A4; }

@media (max-width: 640px) {
  .tally { padding: 11px 14px; gap: 10px; }
  .tally-total .value { font-size: 21px; }
}

.chosen-pic {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--paper-2, #FAFBF9);
}
.chosen-pic img {
  width: 64px; height: 64px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}
