/* =========================================================================
   Instyle Glamour Retail POS — design system
   Palette and type lifted from the live gbsalon.com.au stylesheet so the
   back-of-house looks like the same business as the shopfront.
   Touch-first: nothing depends on hover, every control is >= 44px.
   ========================================================================= */

:root {
  /* ---- brand (live site tokens) --------------------------------------- */
  --berry:        #8C2435;
  --berry-deep:   #5C1F29;
  --wine:         #2E1216;
  --wine-2:       #241016;
  --gold:         #B0863C;
  --gold-soft:    #F5EBDA;

  --ink:          #2E1A1E;
  --body-ink:     #5A4F50;
  --muted-ink:    #8A6E73;
  --faint-ink:    #AC9499;

  --paper:        #FBF7F6;
  --blush:        #F7EBEC;
  --blush-2:      #F3E4E6;
  --line:         #EBDCDD;
  --line-2:       #F1E4E4;

  /* ---- semantic aliases used throughout ------------------------------- */
  --ink-2:        var(--body-ink);
  --ink-3:        var(--muted-ink);
  --bg:           var(--paper);
  --surface:      #ffffff;
  --surface-2:    #FDFAFA;

  --brand:        var(--berry);
  --brand-ink:    #ffffff;
  --brand-soft:   var(--blush);
  --brand-line:   #E4C9CE;
  --brand-dark:   var(--berry-deep);

  --accent:       var(--gold);
  --ok:           #2F6B4F;
  --ok-soft:      #E7F1EB;
  --warn:         #8A6115;
  --warn-soft:    var(--gold-soft);
  --bad:          #A32232;
  --bad-soft:     #FAE9EB;
  --info:         #3C5A73;
  --info-soft:    #ECF1F5;

  --radius:       14px;
  --radius-sm:    10px;
  --radius-lg:    20px;
  --shadow-sm:    0 1px 2px rgba(46,18,22,.05), 0 1px 3px rgba(46,18,22,.04);
  --shadow:       0 6px 20px rgba(46,18,22,.08);
  --shadow-lg:    0 22px 56px rgba(46,18,22,.22);

  --tap:          44px;
  --font-ui:      'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --mono:         'Spline Sans Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font:         var(--font-ui);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

body { font-size: 15px; line-height: 1.55; }

/* Display serif for headings — the single most recognisable brand cue. */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -.005em;
  line-height: 1.2;
  margin: 0 0 .45em;
  color: var(--ink);
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.22rem; }
h4, h5 {
  font-family: var(--font-ui);
  font-weight: 650; margin: 0 0 .5em; line-height: 1.3;
}
h4 { font-size: .95rem; } h5 { font-size: .88rem; }

p  { margin: 0 0 1em; color: var(--body-ink); }
a  { color: var(--berry); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }
small, .small { font-size: .82rem; }
.muted  { color: var(--muted-ink); }
.strong { font-weight: 650; }
.mono   { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: .92em; }
.nowrap { white-space: nowrap; }
.right  { text-align: right; }
.center { text-align: center; }
.hide   { display: none !important; }
.serif  { font-family: var(--font-display); }

::selection { background: var(--blush-2); color: var(--berry-deep); }

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

/* ------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: var(--tap); padding: .6rem 1.1rem;
  font-family: var(--font-ui); font-size: .92rem; font-weight: 600; line-height: 1.1;
  letter-spacing: .005em;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  cursor: pointer; text-decoration: none;
  transition: background .14s ease, border-color .14s ease, color .14s ease, transform .05s ease;
}
.btn:hover { background: var(--blush); border-color: var(--brand-line); color: var(--berry-deep); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn[disabled]:hover { background: var(--surface); border-color: var(--line); color: var(--ink); }

.btn-primary { background: var(--berry); border-color: var(--berry); color: #fff; }
.btn-primary:hover { background: var(--berry-deep); border-color: var(--berry-deep); color: #fff; }
.btn-ok      { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover{ background: #24563f; border-color: #24563f; color: #fff; }
.btn-danger  { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: #851a28; border-color: #851a28; color: #fff; }
.btn-gold    { background: var(--gold); border-color: var(--gold); color: #2E1216; }
.btn-gold:hover { background: #9a7433; border-color: #9a7433; color: #fff; }
.btn-ghost   { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--blush); }
.btn-lg  { min-height: 56px; font-size: 1.02rem; padding: .8rem 1.5rem; }
.btn-xl  { min-height: 62px; font-size: 1.08rem; padding: 1rem 1.6rem; width: 100%; }
.btn-sm  { min-height: 36px; padding: .35rem .75rem; font-size: .84rem; }
.btn-block { width: 100%; }

.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; }

/* -------------------------------------------------------------- fields */
label, .label {
  display: block; font-size: .78rem; font-weight: 650; color: var(--ink-2);
  margin-bottom: .32rem; letter-spacing: .02em;
}
.hint { font-size: .78rem; color: var(--muted-ink); margin-top: .28rem; line-height: 1.45; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=search], input[type=tel], input[type=date], input[type=datetime-local],
input[type=url], input[type=file], select, textarea {
  width: 100%; min-height: var(--tap);
  padding: .55rem .8rem;
  font-family: var(--font-ui); font-size: .94rem; color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  appearance: none;
  transition: border-color .14s ease, box-shadow .14s ease;
}
input:hover, select:hover, textarea:hover { border-color: var(--brand-line); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--berry);
  box-shadow: 0 0 0 3px rgba(140,36,53,.10);
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%238A6E73' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .85rem center; padding-right: 2.3rem;
}
textarea { min-height: 92px; resize: vertical; line-height: 1.55; }
input:disabled, select:disabled, textarea:disabled { background: var(--line-2); color: var(--muted-ink); }
input[type=checkbox], input[type=radio] { width: 19px; height: 19px; accent-color: var(--berry); }

.checkline { display: flex; align-items: center; gap: .6rem; min-height: var(--tap); }
.checkline label { margin: 0; font-weight: 500; font-size: .9rem; color: var(--ink); letter-spacing: 0; }

.field { margin-bottom: 1rem; }
.grid  { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 860px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------- cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card + .card { margin-top: 1rem; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.15rem .85rem; border-bottom: 1px solid var(--line-2);
}
.card-head h2, .card-head h3 { margin: 0; }
.card-body { padding: 1.15rem; }
.card-foot { padding: .9rem 1.15rem; border-top: 1px solid var(--line-2); background: var(--surface-2); }

/* -------------------------------------------------------------- badges */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .22rem .6rem; border-radius: 999px;
  font-family: var(--font-ui);
  font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  background: var(--line-2); color: var(--ink-2); white-space: nowrap;
}
.badge.ok    { background: var(--ok-soft);   color: var(--ok); }
.badge.warn  { background: var(--warn-soft); color: var(--warn); }
.badge.bad   { background: var(--bad-soft);  color: var(--bad); }
.badge.info  { background: var(--info-soft); color: var(--info); }
.badge.muted { background: var(--line-2);    color: var(--muted-ink); }
.badge.brand { background: var(--berry);     color: #fff; }
.badge.gold  { background: var(--gold-soft); color: #7A5C1F; }

/* ------------------------------------------------------------- notices */
.notice {
  display: flex; gap: .75rem; align-items: flex-start;
  padding: .85rem 1.05rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface-2);
  margin-bottom: 1rem; font-size: .9rem; line-height: 1.55; color: var(--ink-2);
}
.notice > span:first-child { font-weight: 700; flex: 0 0 auto; }
.notice.ok   { background: var(--ok-soft);   border-color: #C6DED1; color: #22503b; }
.notice.warn { background: var(--warn-soft); border-color: #E7D3AC; color: #6E4D11; }
.notice.bad  { background: var(--bad-soft);  border-color: #EFC8CD; color: #851a28; }
.notice.info { background: var(--blush);     border-color: var(--brand-line); color: var(--berry-deep); }

/* -------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { padding: .78rem .85rem; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.data th {
  font-size: .69rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--muted-ink); font-weight: 700; background: var(--surface-2);
  position: sticky; top: 0; z-index: 1; white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
table.data tbody tr:hover { background: var(--blush); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .row-link { color: var(--ink); font-weight: 620; }
table.data .row-link:hover { color: var(--berry); }

.empty { padding: 2.8rem 1rem; text-align: center; color: var(--muted-ink); font-size: .92rem; }

/* Responsive tables become cards on small screens */
@media (max-width: 720px) {
  table.stack, table.stack thead, table.stack tbody, table.stack tr, table.stack th, table.stack td { display: block; }
  table.stack thead { position: absolute; left: -9999px; }
  table.stack tr {
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    margin-bottom: .7rem; padding: .5rem .2rem; background: var(--surface);
  }
  table.stack tr:hover { background: var(--surface); }
  table.stack td { border: none; padding: .38rem .85rem; display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
  table.stack td::before {
    content: attr(data-label);
    font-size: .69rem; text-transform: uppercase; letter-spacing: .08em;
    color: var(--muted-ink); font-weight: 700; flex: 0 0 auto;
  }
  table.stack td.num { text-align: right; }
}

/* ---------------------------------------------------------- pagination */
.pager { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; padding: .9rem 1.15rem; }
.pager a, .pager span {
  min-width: 40px; min-height: 40px; padding: 0 .65rem;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink-2); font-size: .87rem; font-weight: 600;
}
.pager a:hover { background: var(--blush); border-color: var(--brand-line); text-decoration: none; }
.pager .on { background: var(--berry); border-color: var(--berry); color: #fff; }
.pager .off { opacity: .4; }

/* --------------------------------------------------------------- modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(36,16,22,.58);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem; z-index: 900; backdrop-filter: blur(3px);
}
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: min(560px, 100%); max-height: 92vh; overflow: auto;
}
.modal-head { padding: 1.25rem 1.4rem .5rem; }
.modal-head h3 { margin: 0; }
.modal-body { padding: .5rem 1.4rem 1rem; }
.modal-foot { padding: 1rem 1.4rem 1.4rem; display: flex; gap: .6rem; flex-wrap: wrap; }
.modal-foot .btn { flex: 1 1 auto; }
.modal-wide { width: min(900px, 100%); }

/* --------------------------------------------------------------- toast */
#toasts {
  position: fixed; z-index: 1200; left: 50%; transform: translateX(-50%);
  bottom: calc(1rem + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: .5rem;
  width: min(520px, calc(100% - 2rem)); pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--wine-2); color: #F7EBEC; padding: .85rem 1.15rem;
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  font-size: .9rem; font-weight: 500; display: flex; gap: .6rem; align-items: flex-start;
  border-left: 3px solid var(--gold);
  animation: toast-in .2s ease-out;
}
.toast.ok  { border-left-color: #6FBF95; }
.toast.bad { background: #6E1620; border-left-color: #E88C96; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------ spinners */
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.32); border-top-color: #fff;
  animation: spin .7s linear infinite; display: inline-block;
}
.spinner.dark { border-color: rgba(140,36,53,.2); border-top-color: var(--berry); }
.spinner.lg { width: 42px; height: 42px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--line-2) 25%, #FAF4F4 50%, var(--line-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------------------------------------------------------- utilities */
.flex { display: flex; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.stackv { display: flex; flex-direction: column; gap: .4rem; }
.wrap-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; }
.w-full { width: 100%; }
.divider { height: 1px; background: var(--line-2); margin: 1rem 0; border: 0; }

/* Thin gold rule — used sparingly, as on the live site. */
.rule-gold { height: 2px; width: 46px; background: var(--gold); border: 0; border-radius: 2px; margin: 0 0 1rem; }

/* -------------------------------------------------- centred auth pages */
.auth-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(1100px 520px at 12% -12%, var(--blush) 0%, transparent 58%),
    radial-gradient(760px 420px at 100% 0%, var(--gold-soft) 0%, transparent 52%),
    var(--paper);
}
.auth-card { width: min(430px, 100%); }
.auth-brand { text-align: center; margin-bottom: 1.5rem; }
.auth-brand .logo { width: 186px; height: auto; margin: 0 auto 1.1rem; display: block; }
.auth-brand h1 { font-size: 1.5rem; margin-bottom: .12rem; }
.auth-brand p { color: var(--muted-ink); font-size: .88rem; margin: 0; }
.auth-foot { text-align: center; margin-top: 1.2rem; font-size: .82rem; color: var(--muted-ink); }

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
}
