@import url('/assets/brand/brand.css');

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

body {
  margin: 0;
  background: var(--ppd-bg);
  color: var(--ppd-text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------------------------------------------------------------- shell */

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

.sidebar {
  width: 232px;
  flex: 0 0 232px;
  background: var(--ppd-surface);
  border-right: 1px solid var(--ppd-border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar .brand { display: block; padding: 2px 8px 18px; }
.sidebar .brand img { width: 150px; height: auto; display: block; }

.navlink {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 9px;
  color: var(--ppd-text); font-size: 14.5px; font-weight: 500;
  text-decoration: none;
}
.navlink:hover { background: var(--ppd-bg); text-decoration: none; }
.navlink.active { background: var(--ppd-mint); color: #133c31; font-weight: 600; }
.navlink .ico { width: 18px; text-align: center; opacity: .85; }
.navlink .count {
  margin-left: auto; font-size: 11.5px; font-weight: 700;
  background: var(--ppd-butter); color: #6b551d;
  border-radius: 20px; padding: 1px 7px;
}
.navsep { margin: 14px 12px 6px; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--ppd-text-muted); }

.newbtn { margin: 0 4px 8px; justify-content: center; }
.newbtn + .newbtn { margin-bottom: 12px; }

.sidefoot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--ppd-border); }
.who { display: flex; align-items: center; gap: 9px; padding: 6px 8px 10px; }
.who img { width: 32px; height: 32px; border-radius: 9px; }
.who .nm { font-size: 13.5px; font-weight: 600; line-height: 1.2; }
.who .rl { font-size: 11.5px; color: var(--ppd-text-muted); text-transform: capitalize; }

.main { flex: 1; min-width: 0; padding: 26px 22px 60px; }

.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar h1 { font-size: 23px; margin: 0; letter-spacing: -.02em; }
.topbar .spacer { flex: 1; }

.livedot { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ppd-text-muted); }
.livedot i { width: 8px; height: 8px; border-radius: 50%; background: #C9C9C9; display: inline-block; }
.livedot.on i { background: var(--ppd-mint); box-shadow: 0 0 0 0 rgba(146,204,186,.7); animation: pulse 2.2s infinite; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(146,204,186,.65); }
  70%  { box-shadow: 0 0 0 8px rgba(146,204,186,0); }
  100% { box-shadow: 0 0 0 0 rgba(146,204,186,0); }
}

/* --------------------------------------------------------------- pieces */

.card {
  background: var(--ppd-surface);
  border: 1px solid var(--ppd-border);
  border-radius: var(--ppd-radius);
  box-shadow: var(--ppd-shadow);
}
.card + .card { margin-top: 18px; }
.card .hd {
  padding: 14px 18px; border-bottom: 1px solid var(--ppd-border);
  display: flex; align-items: center; gap: 12px;
}
.card .hd h2 { margin: 0; font-size: 14px; text-transform: uppercase; letter-spacing: .08em; color: var(--ppd-text-muted); }
.card .hd .spacer { flex: 1; }
.card .bd { padding: 18px; }
.card .bd.flush { padding: 0; }

.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); margin-bottom: 20px; }
.stat {
  background: var(--ppd-surface); border: 1px solid var(--ppd-border);
  border-radius: var(--ppd-radius); padding: 16px 18px; box-shadow: var(--ppd-shadow);
  position: relative; overflow: hidden;
}
.stat::after { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--ppd-mint); }
.stat.alt::after   { background: var(--ppd-sky); }
.stat.warn::after  { background: var(--ppd-butter); }
.stat.money::after { background: var(--ppd-forest); }
.stat .lbl { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--ppd-text-muted); }
.stat .val { font-size: 26px; font-weight: 700; letter-spacing: -.025em; margin-top: 4px; }
.stat .sub { font-size: 12.5px; color: var(--ppd-text-muted); margin-top: 2px; }

/* --------------------------------------------------------------- table */

table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ppd-text-muted); font-weight: 600;
  padding: 10px 11px; border-bottom: 1px solid var(--ppd-border); white-space: nowrap;
}
table.grid td { padding: 10px 11px; border-bottom: 1px solid var(--ppd-border); vertical-align: middle; }

/* Keep the money columns on screen: the customer cell is the one that can grow
   unboundedly, so it truncates rather than pushing totals out of view. */
table.grid td.who { max-width: 210px; }
table.grid td.who .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid tbody tr:hover { background: var(--ppd-bg); }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.grid .muted { color: var(--ppd-text-muted); }
.tablewrap { overflow-x: auto; }

tr.clickrow { cursor: pointer; }

/* A cancelled row is dimmed, but not so far that the red stops registering,
   and it carries a red edge so the state is visible without reading a column. */
tr.cancelled-row { opacity: .72; }
tr.cancelled-row > td:first-child { box-shadow: inset 3px 0 0 #C0392B; }
tr.cancelled-row:hover { opacity: 1; }

/* ------------------------------------------------------------- photos */

.thumb {
  width: 46px; height: 46px; flex: 0 0 46px;
  border-radius: 9px; overflow: hidden; display: block;
  background: var(--ppd-bg); border: 1px solid var(--ppd-border);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-empty {
  display: flex; align-items: center; justify-content: center; height: 100%;
  font-size: 8.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ppd-text-muted); opacity: .7; text-align: center;
}

.photogrid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.photocell {
  border: 1px solid var(--ppd-border); border-radius: 11px; overflow: hidden;
  background: var(--ppd-bg);
}
.photocell img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.photocell .cap { padding: 7px 10px; font-size: 11.5px; }
.photocell .photoacts {
  display: flex; gap: 6px; padding: 0 8px 8px; flex-wrap: wrap;
}
.photocell .photoacts .btn { flex: 1; justify-content: center; padding: 4px 8px; font-size: 12px; }

.expander {
  border: 0; background: none; cursor: pointer;
  padding: 0 7px 0 0; margin: 0;
  color: var(--ppd-text-muted); font-size: 15px; line-height: 1;
  vertical-align: baseline;
}
.expander:hover { color: var(--ppd-primary); }
.expander[aria-expanded="true"] { color: var(--ppd-primary); }
tr.itemrow > td { border-bottom: 1px solid var(--ppd-border); }
tr.itemrow table.grid th { font-size: 10px; padding: 6px 10px; }
tr.itemrow table.grid td { padding: 6px 10px; border-bottom: 0; }
tr.itemrow table.grid tbody tr:hover { background: transparent; }

tr.flash-new { animation: flashnew 2.4s ease-out; }
@keyframes flashnew {
  0%   { background: var(--ppd-butter); }
  100% { background: transparent; }
}

/* --------------------------------------------------------------- chips */

.chip {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: var(--ppd-bg); color: var(--ppd-text-muted); border: 1px solid var(--ppd-border);
}
.chip.paid       { background: #E4F3EC; color: #14664A; border-color: #C6E5D7; }
.chip.pending    { background: #FCF3D9; color: #806316; border-color: #F1E3B4; }
.chip.refunded   { background: #F1EEF9; color: #5B4B8A; border-color: #DFD8F0; }
.chip.fulfilled  { background: #E4F3EC; color: #14664A; border-color: #C6E5D7; }
.chip.unfulfilled{ background: #EAF6FC; color: #205F79; border-color: #CDE8F4; }
/* Cancelled is the one state that must not be missed at a glance, so it reads
   as solid red rather than another pastel pill like the rest. */
.chip.cancelled {
  background: #C0392B; color: #fff; border-color: transparent;
  font-weight: 700; letter-spacing: .02em;
}
.chip.none       { background: #F4F1EE; color: #8A8177; border-style: dashed; }
.chip.rep        { background: var(--ppd-mint); color: #133C31; border-color: transparent; }

/* --------------------------------------------------------------- forms */

label.f { display: block; font-size: 12.5px; font-weight: 600; color: var(--ppd-text-muted); margin-bottom: 5px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; font: inherit; font-size: 14px;
  color: var(--ppd-text); background: var(--ppd-surface);
  border: 1px solid var(--ppd-border); border-radius: 9px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--ppd-mint); box-shadow: 0 0 0 3px rgba(146,204,186,.28);
}
textarea { resize: vertical; min-height: 84px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: 9px; border: 1px solid transparent;
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  background: var(--ppd-primary); color: #fff; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.ghost { background: var(--ppd-surface); color: var(--ppd-text); border-color: var(--ppd-border); }
.btn.ghost:hover { background: var(--ppd-bg); filter: none; }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn.danger { background: #B4534F; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters .fld { min-width: 130px; }
.filters .fld.grow { flex: 1; min-width: 190px; }

.notice { padding: 11px 14px; border-radius: 9px; font-size: 14px; margin-bottom: 16px; border: 1px solid; }
.notice.ok  { background: #E4F3EC; border-color: #C6E5D7; color: #14664A; }
.notice.err { background: #FAEAEA; border-color: #EFD3D3; color: #8C3A3A; }
.notice.info{ background: #EAF6FC; border-color: #CDE8F4; color: #205F79; }

.empty { padding: 46px 20px; text-align: center; color: var(--ppd-text-muted); }
.empty img { width: 76px; opacity: .55; margin-bottom: 12px; }

/* --------------------------------------------------------------- login */

.loginpage { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; }
.loginpage .blob, .loginpage .leaf { position: absolute; opacity: .3; pointer-events: none; }
.loginpage .blob { width: 300px; top: -70px; right: -70px; transform: rotate(18deg); }
.loginpage .leaf { width: 220px; bottom: -50px; left: -40px; transform: rotate(-14deg); }
.loginbox {
  width: 100%; max-width: 380px; background: var(--ppd-surface);
  border: 1px solid var(--ppd-border); border-radius: 18px; padding: 34px 30px;
  box-shadow: 0 2px 4px rgba(93,95,95,.05), 0 18px 44px rgba(93,95,95,.11); position: relative;
}
.loginbox img.logo { width: 210px; display: block; margin: 0 auto 22px; }
.loginbox .fld { margin-bottom: 13px; }
.loginbox .btn { width: 100%; margin-top: 8px; padding: 11px; }
.loginbox .hint { margin-top: 18px; font-size: 12.5px; color: var(--ppd-text-muted); text-align: center; }

/* --------------------------------------------------------------- chart */

.spark { display: flex; align-items: flex-end; gap: 3px; height: 62px; }
.spark .bar { flex: 1; min-width: 2px; background: var(--ppd-mint); border-radius: 3px 3px 0 0; min-height: 2px; }
.spark .bar:hover { background: var(--ppd-forest); }

/* --------------------------------------------------------------- toast */

#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 9px; z-index: 60; }
.toast {
  background: var(--ppd-surface); border: 1px solid var(--ppd-border); border-left: 4px solid var(--ppd-mint);
  border-radius: 10px; padding: 11px 15px; min-width: 250px; max-width: 340px;
  box-shadow: 0 4px 18px rgba(93,95,95,.16); animation: slidein .25s ease-out;
}
.toast .t { font-size: 13.5px; font-weight: 700; }
.toast .d { font-size: 12.5px; color: var(--ppd-text-muted); margin-top: 1px; }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ------------------------------------------------------------ utility */

.row { display: flex; gap: 18px; flex-wrap: wrap; }
.row > .col { flex: 1; min-width: 280px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.muted { color: var(--ppd-text-muted); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 0; font-size: 14px; }
dl.kv dt { color: var(--ppd-text-muted); font-size: 12.5px; padding-top: 2px; }
dl.kv dd { margin: 0; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar { width: auto; flex: none; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--ppd-border); }
  .sidebar .brand { padding: 0 10px 0 0; }
  .sidebar .brand img { width: 108px; }
  .navsep, .sidefoot .who .rl { display: none; }
  .sidefoot { margin: 0 0 0 auto; padding: 0; border: 0; }
  .main { padding: 20px 16px 48px; }
}

@media print {
  .sidebar, .topbar .btn, #toasts, .noprint { display: none !important; }
  .main { padding: 0; }
  .card { box-shadow: none; border-color: #ddd; }
  body { background: #fff; }
}
