/* ==========================================================================
   Royal Crackers - admin dashboard styles
   ========================================================================== */

:root {
  --a-bg:      #f5f2ef;
  --a-panel:   #ffffff;
  --a-ink:     #22191a;
  --a-muted:   #7a6a63;
  --a-line:    #e8e0da;
  --a-red:     #b3121b;
  --a-red-dk:  #7d0c13;
  --a-gold:    #e8a020;
  --a-green:   #1c7a45;
  --a-blue:    #1264a3;
  --a-side:    #23100f;
  --a-side-2:  #35191a;
  --a-radius:  12px;
  --a-shadow:  0 2px 10px rgba(35, 16, 15, .07);
  --a-head:    "Outfit", "Segoe UI", system-ui, sans-serif;
  --a-body:    "Inter", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

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

a { color: var(--a-red); text-decoration: none; }
a:hover { color: var(--a-red-dk); }
img { max-width: 100%; display: block; }

h1, h2, h3, h4 { font-family: var(--a-head); font-weight: 700; margin: 0 0 .4em; line-height: 1.25; }
h1 { font-size: 26px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }

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

.sidebar {
  width: 250px; flex: none;
  background: linear-gradient(180deg, var(--a-side), #180b0b);
  color: #d8c3b6;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  z-index: 50;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 20px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand .mark {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  background: linear-gradient(140deg, var(--a-red), #5e0a0e);
  display: grid; place-items: center;
}
.sidebar-brand b { display: block; font-family: var(--a-head); font-size: 17px; color: #fff; line-height: 1.15; }
.sidebar-brand span { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: #a98d7b; }

.side-nav { padding: 14px 12px; flex: 1; }
.side-nav .group {
  font-size: 10.5px; letter-spacing: .15em; text-transform: uppercase;
  color: #8b7060; padding: 16px 12px 7px; font-weight: 700;
}
.side-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 9px; color: #d8c3b6;
  font-size: 14.5px; font-weight: 500; margin-bottom: 2px;
}
.side-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-nav a.active { background: var(--a-red); color: #fff; box-shadow: 0 6px 16px rgba(179,18,27,.35); }
.side-nav a .ico { width: 20px; text-align: center; font-size: 15px; }
.side-nav a .pill {
  margin-left: auto; background: var(--a-gold); color: #3d0a0d;
  font-size: 11px; font-weight: 800; padding: 1px 8px; border-radius: 99px;
}

.sidebar-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12.5px; color: #a98d7b; }
.sidebar-foot a { color: #f0c58a; }

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

.topbar {
  background: var(--a-panel); border-bottom: 1px solid var(--a-line);
  padding: 13px 26px; display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 40; box-shadow: var(--a-shadow);
}
.topbar h1 { margin: 0; font-size: 20px; }
.topbar .spacer { flex: 1; }
.topbar .who { text-align: right; font-size: 13px; color: var(--a-muted); line-height: 1.35; }
.topbar .who b { display: block; color: var(--a-ink); font-size: 14.5px; font-family: var(--a-head); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: linear-gradient(140deg, var(--a-red), #5e0a0e); color: #fff;
  display: grid; place-items: center; font-family: var(--a-head); font-weight: 700;
}
.burger { display: none; border: 0; background: transparent; font-size: 22px; cursor: pointer; color: var(--a-ink); }

.content { padding: 26px; flex: 1; }
.content-narrow { max-width: 940px; }

/* ---------------------------------------------------------------- cards */
.panel {
  background: var(--a-panel); border: 1px solid var(--a-line);
  border-radius: var(--a-radius); box-shadow: var(--a-shadow); margin-bottom: 22px;
}
.panel-head {
  padding: 15px 20px; border-bottom: 1px solid var(--a-line);
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.panel-head h3 { margin: 0; }
.panel-head .spacer { flex: 1; }
.panel-body { padding: 20px; }
.panel-body.tight { padding: 0; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 22px; }
.tile {
  background: var(--a-panel); border: 1px solid var(--a-line); border-radius: var(--a-radius);
  padding: 18px 20px; box-shadow: var(--a-shadow); position: relative; overflow: hidden;
}
.tile::after {
  content: ""; position: absolute; right: -18px; top: -18px; width: 76px; height: 76px;
  border-radius: 50%; background: currentColor; opacity: .07;
}
.tile .lbl { font-size: 12px; letter-spacing: .09em; text-transform: uppercase; color: var(--a-muted); font-weight: 700; }
.tile .val { font-family: var(--a-head); font-size: 30px; font-weight: 800; line-height: 1.15; margin-top: 4px; }
.tile .sub { font-size: 12.5px; color: var(--a-muted); }
.tile.red   { color: var(--a-red); }
.tile.green { color: var(--a-green); }
.tile.blue  { color: var(--a-blue); }
.tile.gold  { color: #b07a06; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  background: #faf6f2; color: var(--a-muted); text-align: left; white-space: nowrap;
  font-family: var(--a-head); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase;
  padding: 11px 14px; border-bottom: 1px solid var(--a-line);
}
table.data td { padding: 11px 14px; border-bottom: 1px solid #f2ece7; vertical-align: middle; }
table.data tbody tr:hover { background: #fdfaf7; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .t-right { text-align: right; }
table.data .t-center { text-align: center; }
table.data .nowrap { white-space: nowrap; }
.thumb { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; border: 1px solid var(--a-line); background: #faf6f2; }

/* ---------------------------------------------------------------- badges */
.badge {
  display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
  padding: 3px 10px; border-radius: 99px; white-space: nowrap;
}
.badge-pending    { background: #fff2dd; color: #96660a; }
.badge-confirmed  { background: #e6f1fc; color: #1264a3; }
.badge-packed     { background: #efe8fb; color: #5b32a8; }
.badge-dispatched { background: #e2f4ea; color: #1c7a45; }
.badge-delivered  { background: #d9f2e3; color: #14603a; }
.badge-cancelled  { background: #fdecec; color: #9b1111; }
.badge-on         { background: #e2f4ea; color: #1c7a45; }
.badge-off        { background: #f1eae4; color: #7a6a63; }
.badge-new        { background: #e6f1fc; color: #1264a3; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; cursor: pointer; font-family: var(--a-head); font-weight: 700; font-size: 14px;
  padding: 10px 18px; border-radius: 9px; background: var(--a-red); color: #fff;
  transition: filter .15s, transform .12s;
}
.btn:hover { filter: brightness(1.08); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 7px; }
.btn-dark  { background: var(--a-ink); }
.btn-green { background: var(--a-green); }
.btn-blue  { background: var(--a-blue); }
.btn-gold  { background: var(--a-gold); color: #3d0a0d; }
.btn-gold:hover { color: #3d0a0d; }
.btn-ghost { background: transparent; color: var(--a-ink); border: 1px solid var(--a-line); }
.btn-ghost:hover { background: #faf6f2; color: var(--a-ink); }
.btn-danger { background: #fdecec; color: #9b1111; }
.btn-danger:hover { background: #9b1111; color: #fff; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- forms */
.field { margin-bottom: 16px; }
.field label { display: block; font-family: var(--a-head); font-weight: 600; font-size: 13.5px; margin-bottom: 5px; }
.field .req { color: var(--a-red); }
.field .hint { font-size: 12.5px; color: var(--a-muted); margin-top: 4px; }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px; font-family: var(--a-body); font-size: 14.5px; color: var(--a-ink);
  background: #fff; border: 1px solid var(--a-line); border-radius: 9px;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: 0; border-color: var(--a-gold); box-shadow: 0 0 0 3px rgba(232,160,32,.18);
}
.textarea { min-height: 100px; resize: vertical; }
.row { display: grid; gap: 16px; }
.row-2 { grid-template-columns: 1fr 1fr; }
.row-3 { grid-template-columns: repeat(3, 1fr); }
.row-4 { grid-template-columns: repeat(4, 1fr); }
.check { display: flex; align-items: center; gap: 9px; font-size: 14.5px; margin-bottom: 10px; }
.check input { width: 17px; height: 17px; accent-color: var(--a-red); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { margin: 0; min-width: 150px; }

/* ---------------------------------------------------------------- alerts */
.alert { padding: 12px 16px; border-radius: 9px; margin-bottom: 16px; font-size: 14.5px; border: 1px solid transparent; }
.alert-success { background: #e2f4ea; border-color: #b6e0c7; color: #14603a; }
.alert-error   { background: #fdecec; border-color: #f3bcbc; color: #9b1111; }
.alert-info    { background: #e6f1fc; border-color: #c3ddf6; color: #14548c; }
.alert-warning { background: #fff2dd; border-color: #f2d9ae; color: #8a5a00; }

/* ---------------------------------------------------------------- login */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 30px 16px;
  background:
    radial-gradient(700px 340px at 20% 0%, rgba(232,160,32,.22), transparent 60%),
    linear-gradient(155deg, #4a1113, #1d0b0c);
}
.login-card {
  width: 100%; max-width: 420px; background: #fff; border-radius: 18px; padding: 34px;
  box-shadow: 0 30px 70px rgba(0,0,0,.45);
}
.login-card .mark {
  width: 54px; height: 54px; border-radius: 15px; margin-bottom: 16px;
  background: linear-gradient(140deg, var(--a-red), #5e0a0e); display: grid; place-items: center;
}
.login-card h1 { font-size: 24px; margin-bottom: 4px; }
.login-card p.sub { color: var(--a-muted); font-size: 14px; margin: 0 0 22px; }
.login-hint {
  margin-top: 18px; padding: 12px 14px; background: #faf6f2; border: 1px dashed var(--a-line);
  border-radius: 9px; font-size: 13px; color: var(--a-muted);
}

/* ---------------------------------------------------------------- misc */
.empty { text-align: center; padding: 54px 20px; color: var(--a-muted); }
.empty .emoji { font-size: 42px; margin-bottom: 8px; }
.muted { color: var(--a-muted); }
.small { font-size: 13px; }
.mt-2 { margin-top: 16px; } .mb-2 { margin-bottom: 16px; } .mb-0 { margin-bottom: 0; }
.strong { font-family: var(--a-head); font-weight: 700; }

.pager { display: flex; gap: 6px; padding: 14px 20px; flex-wrap: wrap; align-items: center; }
.pager a, .pager span {
  min-width: 34px; height: 34px; padding: 0 10px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--a-line); font-size: 14px; color: var(--a-ink); background: #fff;
}
.pager .current { background: var(--a-red); border-color: var(--a-red); color: #fff; font-weight: 700; }
.pager .gap { border: 0; }

.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 70px; gap: 12px; align-items: center; font-size: 13.5px; }
.bar { height: 10px; border-radius: 99px; background: #f1eae4; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--a-gold), var(--a-red)); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f2ece7; font-size: 14px; }
.timeline li:last-child { border-bottom: 0; }

/* printable invoice */
.invoice { background: #fff; padding: 30px; }
.invoice-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap;
                border-bottom: 2px solid var(--a-ink); padding-bottom: 16px; margin-bottom: 20px; }

@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .content { padding: 0; }
  .panel { border: 0; box-shadow: none; }
  body { background: #fff; }
}

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1024px) {
  .row-4 { grid-template-columns: repeat(2, 1fr); }
  .row-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0; transform: translateX(-100%);
    transition: transform .26s ease; box-shadow: 0 0 40px rgba(0,0,0,.4);
  }
  .sidebar.open { transform: translateX(0); }
  .burger { display: block; }
  .content { padding: 18px 16px; }
  .row-2, .row-3, .row-4 { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 110px 1fr 60px; }
}
