/* Noryy Admin – Shopify-style backend dashboard
   Dark sidebar + light content + KPI cards + charts */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar: #1d2327;
  --sidebar-hover: #2c3338;
  --bg: #f0f1f3;
  --card: #ffffff;
  --ink: #1a1d21;
  --ink-soft: #6b7280;
  --line: #e5e7eb;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --green: #16a34a;
  --red: #dc2626;
  --up: #dcfce7;
  --down: #fee2e2;
}

html, body { height: 100%; }

[hidden] { display: none !important; }

body {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; font-size: 13px; }

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

.login-overlay {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #1d2327, #111418);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.login-box {
  background: #fff;
  border-radius: 12px;
  padding: 40px 36px;
  width: 360px;
  text-align: center;
}
.login-logo { font-weight: 700; font-size: 24px; letter-spacing: .25em; }
.login-sub { color: var(--ink-soft); font-size: 13px; margin: 6px 0 24px; }
.login-box input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 14px;
  margin-bottom: 12px;
  outline: none;
}
.login-box input:focus { border-color: var(--accent); }
.login-error { color: var(--red); font-size: 12px; margin-top: 10px; min-height: 16px; }

/* ---------- layout ---------- */

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

.sidebar {
  width: 230px;
  background: var(--sidebar);
  color: #d1d5db;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
}
.sidebar__logo {
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: .25em;
  padding: 22px 22px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar__nav { padding: 12px 10px; flex: 1; }
.sidebar__nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
  color: #9ca3af;
}
.sidebar__nav a:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar__nav a.is-active { background: var(--accent); color: #fff; }
.sidebar__nav svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 7px;
}
.sidebar__foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar__link { font-size: 12.5px; color: #9ca3af; }
.sidebar__link:hover { color: #fff; }

.main { flex: 1; margin-left: 230px; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar__title { font-size: 19px; font-weight: 700; }
.topbar__right { display: flex; align-items: center; gap: 14px; }
.range-select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: #fff;
  outline: none;
}
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

.view { padding: 24px 28px; max-width: 1200px; width: 100%; }

/* ---------- KPI cards ---------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
}
.kpi__label { font-size: 12px; color: var(--ink-soft); display: flex; justify-content: space-between; }
.kpi__label a { color: var(--accent); font-size: 11px; }
.kpi__value { font-size: 24px; font-weight: 700; margin-top: 6px; }
.kpi__delta { font-size: 12px; font-weight: 600; margin-top: 6px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 20px; }
.kpi__delta--up { color: var(--green); background: var(--up); }
.kpi__delta--down { color: var(--red); background: var(--down); }

/* ---------- cards & charts ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 18px;
}
.card__title { font-size: 14.5px; font-weight: 700; margin-bottom: 4px; }
.card__sub { font-size: 12px; color: var(--ink-soft); margin-bottom: 14px; }
.chart-box { position: relative; height: 260px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-row { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; margin-bottom: 18px; }
.grid-row > .card { margin-bottom: 0; }
@media (max-width: 980px) { .grid-2, .grid-row { grid-template-columns: 1fr; } }

/* ---------- lists ---------- */

.stat-list { list-style: none; }
.stat-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  gap: 10px;
}
.stat-list li:last-child { border-bottom: 0; }
.stat-list .bar-wrap { flex: 1; max-width: 130px; }
.stat-list .bar { height: 6px; border-radius: 3px; background: var(--accent-soft); overflow: hidden; }
.stat-list .bar span { display: block; height: 100%; background: var(--accent); }
.stat-list .num { font-weight: 600; min-width: 46px; text-align: right; }
.stat-list .muted { color: var(--ink-soft); font-size: 12px; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--card);
}
table.data th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-soft);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:hover td { background: #fafafa; }
table.data code {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11.5px;
}
.status-pill {
  display: inline-block;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
}
.status--paid { background: var(--up); color: var(--green); }
.status--pending { background: #fef9c3; color: #a16207; }
.thumb {
  width: 38px; height: 46px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--bg);
}

/* ---------- buttons ---------- */

.btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
}
.btn:hover { background: #f9fafb; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: #4338ca; }
.btn--danger { color: var(--red); border-color: #fecaca; }
.btn--danger:hover { background: var(--down); }
.btn--sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn--block { width: 100%; }

.card__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.card__head .card__title { margin-bottom: 0; }

/* ---------- modal ---------- */

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 60;
}
.modal {
  background: #fff;
  border-radius: 12px;
  width: 440px;
  max-width: 92vw;
  padding: 24px;
  max-height: 88vh;
  overflow-y: auto;
}
.modal h3 { font-size: 16px; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 11.5px; font-weight: 600; color: var(--ink-soft); }
.field input, .field select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
}
.field input:focus { border-color: var(--accent); }
.modal__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

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

.toast {
  position: fixed;
  bottom: 26px; left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 11px 20px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 200;
}

/* ---------- empty / loading ---------- */

.empty { padding: 60px 0; text-align: center; color: var(--ink-soft); }
.loading { padding: 60px 0; text-align: center; color: var(--ink-soft); }

/* ---------- order management ---------- */

.order-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.order-tab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
}
.order-tab:hover { border-color: var(--ink); color: var(--ink); }
.order-tab.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.order-row { cursor: pointer; }

.status--refunded { background: #fee2e2; color: #b91c1c; }
.status--cancelled { background: #e5e7eb; color: #4b5563; }
.status--disputed { background: #fef3c7; color: #b45309; }
.status--unfulfilled { background: #fef3c7; color: #b45309; }

.modal--wide { width: 820px; max-width: 94vw; }
.modal__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 10px; }
.modal__head h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.om-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 26px; }
@media (max-width: 760px) { .om-grid { grid-template-columns: 1fr; } }
.om-title { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft); margin: 16px 0 8px; }
.om-title:first-child { margin-top: 0; }
.om-p { font-size: 13px; line-height: 1.6; }
.om-items td { padding: 8px 10px; }
.ful-box { background: var(--bg); border-radius: 8px; padding: 14px; margin-top: 12px; font-size: 13px; }

.timeline { list-style: none; }
.timeline li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; align-items: flex-start; }
.timeline li:last-child { border-bottom: 0; }
.tl-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: 0 0 auto; background: var(--accent); }
.tl-payment { background: var(--green); }
.tl-fulfillment { background: #f59e0b; }
.tl-tracking { background: #3b82f6; }
.tl-note { background: #94a3b8; }

@media (max-width: 860px) {
  .sidebar { width: 64px; }
  .sidebar__logo { font-size: 12px; letter-spacing: .1em; padding: 18px 8px; text-align: center; }
  .sidebar__nav a { justify-content: center; padding: 11px 8px; font-size: 0; gap: 0; }
  .sidebar__nav a svg { width: 19px; height: 19px; }
  .sidebar__nav a .nav-badge { display: none; }
  .sidebar__link { display: none; }
  .main { margin-left: 64px; }
  .view { padding: 18px 14px; }
}
