/* Nanhe Sitare — hand-written CSS, no build step.
   Deliberately not Tailwind: HRMS has a compiled app.css that must be rebuilt
   before a new utility class works, which has caused silent styling failures.
   Plain CSS removes that whole class of problem.

   Dense enough for a 14-inch laptop, but with bigger touch targets than Tender
   Desk — this app gets used on a phone while somebody is answering DMs. */

:root {
  --ink: #1b1a22;
  --ink-soft: #5f5c6e;
  --line: #e6e3ee;
  --bg: #f7f6fb;
  --card: #ffffff;

  /* Warm and a bit playful — this is a children's book shop, not a tender desk. */
  --brand: #7a4fd6;
  --brand-dark: #6540bb;
  --brand-soft: #f1ebfe;
  --accent: #e8853a;

  --ok: #157a4d;
  --ok-soft: #e6f5ee;
  --warn: #9a6209;
  --warn-soft: #fdf3e2;
  --danger: #b3222c;
  --danger-soft: #fdeced;
  --muted: #8b8798;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--brand); }

/* ---------- top nav ---------- */
.topnav { background: #241f36; color: #f3f0fa; }
.topnav-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 16px;
  min-height: 50px; display: flex; align-items: center; gap: 18px;
  flex-wrap: wrap;
}
.brand {
  color: #fff; text-decoration: none; font-weight: 700; font-size: 15px;
  letter-spacing: .2px; display: flex; align-items: center; gap: 7px;
}
.brand .star { color: #ffcb5c; font-size: 16px; }
.brand span { color: #c3aaff; font-weight: 600; }

.topnav-links { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.topnav-links a {
  color: #cfc8e4; text-decoration: none; font-size: 13px; font-weight: 500;
  padding: 6px 10px; border-radius: 6px;
}
.topnav-links a:hover { color: #fff; background: rgba(255,255,255,.08); }
.topnav-links a.on { color: #fff; background: rgba(255,255,255,.14); }

.badge-dot {
  display: inline-block; min-width: 17px; padding: 0 5px; margin-left: 5px;
  background: var(--accent); color: #fff; border-radius: 9px;
  font-size: 11px; font-weight: 700; text-align: center; line-height: 17px;
}

.topnav-user { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.topnav-user .who { color: #f3f0fa; font-weight: 600; }
.topnav-user .muted-link { color: #a49bc0; text-decoration: none; }
.topnav-user .muted-link:hover { color: #fff; }

.role-chip {
  padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600;
  background: #372f4f; color: #d3c4ff;
}
.role-admin { background: #3d2a5c; color: #dcc7ff; }
.role-staff { background: #2c3a4d; color: #b9d6f5; }

.linkbtn {
  background: none; border: none; color: #a49bc0; cursor: pointer;
  font: inherit; padding: 0;
}
.linkbtn:hover { color: #fff; text-decoration: underline; }
.inline { display: inline; }

/* ---------- layout ---------- */
.page { max-width: 1280px; margin: 0 auto; padding: 18px 16px 56px; }
.page-narrow { max-width: 860px; }

h1 { font-size: 21px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 0 0 10px; }
h3 { font-size: 13px; margin: 0 0 6px; text-transform: uppercase;
     letter-spacing: .5px; color: var(--ink-soft); }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 16px; flex-wrap: wrap;
}
.page-head .sub { color: var(--ink-soft); font-size: 13px; margin: 0; }
.page-head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px; margin-bottom: 14px;
}
.card-tight { padding: 12px 14px; }
.card h2 { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.cols { display: grid; gap: 14px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-sidebar { grid-template-columns: 1fr 320px; align-items: start; }
@media (max-width: 900px) {
  .cols-2, .cols-3, .cols-sidebar { grid-template-columns: 1fr; }
}

.muted { color: var(--ink-soft); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }
.strong { font-weight: 600; }
.spacer { flex: 1; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }

/* ---------- stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
         margin-bottom: 14px; }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(2, 1fr); } }

.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 13px 15px; text-decoration: none; color: inherit; display: block;
}
a.stat:hover { border-color: var(--brand); }
.stat .label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--ink-soft); font-weight: 600;
}
.stat .value { font-size: 23px; font-weight: 700; margin-top: 3px;
               font-variant-numeric: tabular-nums; }
.stat .note { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.stat.good .value { color: var(--ok); }
.stat.bad .value { color: var(--danger); }
.stat.warn .value { color: var(--warn); }

/* ---------- tables ---------- */
.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.grid th {
  text-align: left; font-size: 11px; text-transform: uppercase;
  letter-spacing: .4px; color: var(--ink-soft); font-weight: 600;
  padding: 7px 9px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.grid td { padding: 9px; border-bottom: 1px solid var(--line);
           vertical-align: top; }
.grid tr:last-child td { border-bottom: none; }
.grid tbody tr:hover { background: #fbfaff; }
.grid td.num, .grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
.grid .row-link { text-decoration: none; color: var(--ink); font-weight: 600; }
.grid .row-link:hover { color: var(--brand); }
.grid-total td { border-top: 2px solid var(--line); font-weight: 700; }

.table-wrap { overflow-x: auto; }

/* ---------- chips and pills ---------- */
.pill {
  display: inline-block; padding: 2px 9px; border-radius: 11px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.pill-unpaid { background: var(--danger-soft); color: var(--danger); }
.pill-partly_paid { background: var(--warn-soft); color: var(--warn); }
.pill-paid { background: var(--ok-soft); color: var(--ok); }
.pill-cancelled { background: #eeecf3; color: var(--muted); }
.pill-instagram { background: #fdeaf3; color: #b53478; }
.pill-whatsapp { background: #e4f7ea; color: #1c7a41; }
.pill-other, .pill-repeat, .pill-referral { background: #eef0f6; color: #52586b; }
.pill-live { background: var(--ok-soft); color: var(--ok); }
.pill-off { background: #eeecf3; color: var(--muted); }
.pill-error { background: var(--danger-soft); color: var(--danger); }

/* ---------- tabs / filters ---------- */
.tabs {
  display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line); padding-bottom: 10px;
}
.tabs a {
  padding: 6px 12px; border-radius: 7px; text-decoration: none;
  color: var(--ink-soft); font-size: 13px; font-weight: 500;
  border: 1px solid transparent;
}
.tabs a:hover { background: #fff; border-color: var(--line); }
.tabs a.on { background: var(--brand); color: #fff; font-weight: 600; }
.tabs a .count { opacity: .75; margin-left: 4px; font-size: 12px; }

.filterbar {
  display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap;
  margin-bottom: 12px;
}
.filterbar label { margin: 0 0 3px; }
.filterbar .field { min-width: 150px; }
.filterbar input[type=search], .filterbar input[type=text] { min-width: 220px; }

/* ---------- forms ---------- */
.auth { max-width: 380px; margin: 60px auto; }
.auth-brand { font-size: 27px; margin-bottom: 2px; font-weight: 700; }
.auth-brand .star { color: #f0a92b; }
.auth-brand span { color: var(--brand); }

label { display: block; font-size: 12px; font-weight: 600; margin: 12px 0 4px; }
label.inline-label {
  display: inline-flex; align-items: center; gap: 7px; font-weight: 500;
  margin: 10px 0 0; font-size: 13px;
}

/* Listed by type rather than a bare `input` so checkboxes and radios keep
   their natural size. Every text-like type is here on purpose — a missing one
   leaves that field at whatever narrow default the browser picks. */
input[type=text], input[type=password], input[type=email], input[type=number],
input[type=date], input[type=datetime-local], input[type=url], input[type=tel],
input[type=time], input[type=file], input[type=search],
select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #d8d4e4;
  border-radius: 7px; font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(122, 79, 214, .14);
}
input[readonly], input:disabled, select:disabled {
  background: #f4f3f8; color: var(--ink-soft);
}
textarea { resize: vertical; }

.helptext { display: block; font-size: 11.5px; color: var(--ink-soft);
            margin-top: 4px; line-height: 1.45; }
.field { margin-bottom: 4px; }
.field-row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.field-row-3 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 700px) {
  .field-row, .field-row-3 { grid-template-columns: 1fr; }
}

.formerror { color: var(--danger); font-size: 12px; margin: 4px 0 0; }
.formerror ul { margin: 0; padding-left: 16px; }
.errorbox {
  background: var(--danger-soft); border: 1px solid #f3c9cc; color: #8d1c24;
  border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; font-size: 13px;
}
.errorbox ul { margin: 4px 0 0; padding-left: 18px; }

.form-actions {
  display: flex; gap: 10px; align-items: center; margin-top: 18px;
  padding-top: 14px; border-top: 1px solid var(--line); flex-wrap: wrap;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-block; padding: 9px 16px; background: var(--brand);
  color: #fff; border: 1px solid var(--brand); border-radius: 7px;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  line-height: 1.3; white-space: nowrap;
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-ghost { background: #fff; color: var(--ink); border-color: #d8d4e4; }
.btn-ghost:hover { background: #f7f5fc; color: var(--brand);
                   border-color: var(--brand); }
.btn-danger { background: #fff; color: var(--danger); border-color: #ecc3c6; }
.btn-danger:hover { background: var(--danger); color: #fff;
                    border-color: var(--danger); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn:disabled, .btn[aria-disabled=true] {
  opacity: .5; cursor: not-allowed; pointer-events: none;
}

/* ---------- messages ---------- */
.messages { list-style: none; margin: 0 0 14px; padding: 0; }
.msg {
  padding: 10px 13px; border-radius: 8px; margin-bottom: 8px; font-size: 13px;
  border: 1px solid transparent;
}
.msg-success { background: var(--ok-soft); border-color: #bfe4d1; color: #14603e; }
.msg-error   { background: var(--danger-soft); border-color: #f3c9cc; color: #8d1c24; }
.msg-warning { background: var(--warn-soft); border-color: #f2ddb6; color: #7d4f06; }
.msg-info    { background: var(--brand-soft); border-color: #ddd0fb; color: #4b2e91; }

/* ---------- notices ---------- */
.notice {
  border-radius: 8px; padding: 11px 14px; font-size: 13px; margin-bottom: 14px;
  background: var(--brand-soft); border: 1px solid #ddd0fb; color: #402578;
}
.notice-warn { background: var(--warn-soft); border-color: #f2ddb6; color: #6f4705; }
.notice-danger { background: var(--danger-soft); border-color: #f3c9cc; color: #8d1c24; }
.notice b { font-weight: 700; }
.notice p { margin: 0 0 6px; }
.notice p:last-child { margin-bottom: 0; }

.empty {
  text-align: center; padding: 40px 20px; color: var(--ink-soft);
}
.empty .big { font-size: 30px; margin-bottom: 8px; }
.empty h2 { font-size: 16px; color: var(--ink); margin-bottom: 6px; }
.empty p { margin: 0 auto 14px; max-width: 420px; font-size: 13px; }

/* ---------- setup checklist ---------- */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
  border-bottom: 1px dashed var(--line); font-size: 13px;
}
.checklist li:last-child { border-bottom: none; }
.checklist .box {
  width: 16px; height: 16px; border: 2px solid #cfc9dd; border-radius: 4px;
  flex: none;
}

/* ---------- dashboard task lists ---------- */
.tasklist { list-style: none; margin: 0; padding: 0; }
.tasklist li {
  display: flex; gap: 10px; align-items: baseline; padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.tasklist li:last-child { border-bottom: none; }
.tasklist a { text-decoration: none; font-weight: 600; color: var(--ink); }
.tasklist a:hover { color: var(--brand); }
.tasklist .meta { color: var(--ink-soft); font-size: 12px; }

/* ---------- channel status strip ---------- */
.channelstrip { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.channelcard {
  flex: 1; min-width: 250px; background: var(--card); border-radius: 10px;
  border: 1px solid var(--line); padding: 11px 14px; font-size: 13px;
}
.channelcard .head {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  margin-bottom: 3px;
}
.channelcard .name { font-weight: 700; }

/* ---------- inbox ---------- */
.inbox { display: grid; grid-template-columns: 330px 1fr; gap: 14px;
         align-items: start; }
@media (max-width: 900px) { .inbox { grid-template-columns: 1fr; } }

.threadlist { list-style: none; margin: 0; padding: 0; }
.threadlist li { border-bottom: 1px solid var(--line); }
.threadlist li:last-child { border-bottom: none; }
.threadlist a {
  display: block; padding: 11px 13px; text-decoration: none; color: inherit;
}
.threadlist a:hover { background: #faf8ff; }
.threadlist a.on { background: var(--brand-soft); }
.threadlist .top {
  display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
}
.threadlist .who { font-weight: 700; font-size: 13.5px; }
.threadlist .when { font-size: 11px; color: var(--muted); white-space: nowrap; }
.threadlist .snippet {
  font-size: 12.5px; color: var(--ink-soft); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.threadlist .unread .who::after {
  content: ''; display: inline-block; width: 7px; height: 7px;
  background: var(--accent); border-radius: 50%; margin-left: 6px;
}

.thread {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  display: flex; flex-direction: column; min-height: 480px;
}
.thread-head {
  padding: 13px 16px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  flex-wrap: wrap;
}
.thread-body {
  padding: 16px; flex: 1; overflow-y: auto; max-height: 56vh;
  background: #faf9fd;
}
.thread-foot { padding: 12px 16px; border-top: 1px solid var(--line); }

.bubble {
  width: fit-content; max-width: 74%;
  padding: 8px 12px; border-radius: 12px; margin-bottom: 10px;
  font-size: 13.5px; line-height: 1.45; word-wrap: break-word;
  overflow-wrap: anywhere;
}
/* pre-wrap belongs on the text alone, never on the bubble — on the bubble it
   turns the template's own indentation into visible blank space. */
.bubble .body { margin: 0; white-space: pre-wrap; }
.bubble .attach { opacity: .75; margin-top: 3px; }
.bubble .stamp { display: block; font-size: 10.5px; margin-top: 3px; opacity: .7; }
.bubble-in { background: #fff; border: 1px solid var(--line); }
.bubble-out {
  background: var(--brand); color: #fff; margin-left: auto;
  border-bottom-right-radius: 3px;
}
.bubble-out.failed { background: var(--danger-soft); color: #8d1c24;
                     border: 1px solid #f3c9cc; }
.bubble-in { border-bottom-left-radius: 3px; }

.daysep {
  text-align: center; font-size: 11px; color: var(--muted); margin: 14px 0 12px;
  font-weight: 600;
}

/* ---------- invoice builder ---------- */
.lines { width: 100%; border-collapse: collapse; }
.lines th {
  text-align: left; font-size: 11px; text-transform: uppercase;
  letter-spacing: .4px; color: var(--ink-soft); font-weight: 600;
  padding: 0 6px 6px;
}
.lines td { padding: 4px 6px; vertical-align: top; }
.lines input { padding: 7px 8px; }
.lines .col-qty { width: 78px; }
.lines .col-money { width: 108px; }
.lines .col-del { width: 34px; text-align: center; padding-top: 12px; }
.lines label { display: none; }
.lines .helptext { display: none; }
.lines tr.deleted { opacity: .4; }

.totals { margin-left: auto; max-width: 330px; }
.totals .row {
  display: flex; justify-content: space-between; padding: 5px 0;
  font-size: 13px; gap: 20px;
}
.totals .row.big {
  border-top: 2px solid var(--line); margin-top: 5px; padding-top: 9px;
  font-size: 17px; font-weight: 700;
}
.totals .row.profit { color: var(--ok); font-weight: 600; }
.totals .row .v { font-variant-numeric: tabular-nums; }

/* ---------- printable invoice ---------- */
.sheet {
  background: #fff; max-width: 820px; margin: 20px auto; padding: 40px;
  border: 1px solid var(--line); border-radius: 8px;
}
.sheet-head { display: flex; justify-content: space-between; gap: 30px;
              margin-bottom: 26px; }
.sheet-head .biz { font-size: 22px; font-weight: 700; margin-bottom: 3px; }
.sheet-head .tag { color: var(--ink-soft); font-size: 12.5px; }
.sheet-head .meta { text-align: right; font-size: 13px; }
.sheet-head .inv-no { font-size: 17px; font-weight: 700; }
.sheet-logo { max-height: 64px; max-width: 190px; margin-bottom: 8px; }
.sheet-parties { display: flex; gap: 40px; margin-bottom: 22px; }
.sheet-parties > div { flex: 1; }
.sheet table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sheet table th {
  text-align: left; padding: 8px 6px; border-bottom: 2px solid #ddd;
  font-size: 11px; text-transform: uppercase; letter-spacing: .4px;
}
.sheet table td { padding: 9px 6px; border-bottom: 1px solid #eee; }
.sheet .pay-box {
  margin-top: 24px; padding: 13px 15px; background: #faf9fd;
  border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px;
}
.sheet-foot { margin-top: 26px; padding-top: 14px; border-top: 1px solid #eee;
              font-size: 12.5px; color: var(--ink-soft); text-align: center; }
.paid-stamp {
  display: inline-block; border: 3px solid var(--ok); color: var(--ok);
  padding: 4px 14px; border-radius: 7px; font-weight: 800; font-size: 15px;
  letter-spacing: 1.5px; transform: rotate(-4deg);
}
.cancel-stamp {
  display: inline-block; border: 3px solid var(--danger); color: var(--danger);
  padding: 4px 14px; border-radius: 7px; font-weight: 800; font-size: 15px;
  letter-spacing: 1.5px; transform: rotate(-4deg);
}

.printbar {
  max-width: 820px; margin: 16px auto 0; display: flex; gap: 8px;
  justify-content: flex-end; flex-wrap: wrap;
}

@media print {
  .topnav, .foot, .printbar, .messages { display: none !important; }
  body { background: #fff; }
  .sheet { border: none; margin: 0; padding: 0; max-width: none; }
}

/* ---------- steps / guides ---------- */
.steps { margin: 8px 0 0; padding-left: 20px; font-size: 13px; }
.steps li { margin-bottom: 7px; line-height: 1.5; }

.copybox {
  display: flex; gap: 8px; align-items: center; margin-top: 4px;
}
.copybox input {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
  background: #f7f6fb;
}

/* ---------- footer ---------- */
.foot {
  max-width: 1280px; margin: 0 auto; padding: 18px 16px 30px;
  color: var(--muted); font-size: 12px; border-top: 1px solid var(--line);
}

/* ---------- help page ---------- */
/* Screenshots are the point of this page, so they get room: full width of the
   card, a border so the page chrome in the picture does not bleed into the
   page chrome around it, and a caption-sized gap. */
.help figure {
  margin: 14px 0 16px;
}
.help figure img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff;
}
.help h3 {
  margin-top: 20px; font-size: 13px; color: var(--ink);
  text-transform: none; letter-spacing: 0;
}
.help h3:first-of-type { margin-top: 14px; }
.help p { margin: 0 0 10px; }
.help code {
  background: #f1eefb; padding: 1px 5px; border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
}

/* Lists that read as prose rather than as data. */
.plain { margin: 0 0 10px; padding-left: 20px; }
.plain li { margin-bottom: 6px; line-height: 1.5; }

.toc { margin: 0; padding-left: 20px; font-size: 13.5px; }
.toc li { margin-bottom: 5px; }
.toc a { text-decoration: none; font-weight: 500; }
.toc a:hover { text-decoration: underline; }

.pill-admin { background: #3d2a5c; color: #dcc7ff; }

/* Anchor targets must clear the sticky-feeling top nav when jumped to. */
.help[id] { scroll-margin-top: 16px; }
