/* ═══════════════════════════════════════════════════════════════
   SHREDDER ADMIN — Dark Navy + Electric Blue
   Font: DM Sans + JetBrains Mono
   Mobile-first responsive, 48px+ touch targets
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg:        #07090f;
  --bg-card:   #0d1117;
  --bg-raised: #161b22;
  --bg-hover:  #1c2333;
  --bg-input:  #0d1117;
  --border:    #21262d;
  --border-hi: #30363d;
  --text:      #e6edf3;
  --text-mid:  #8b949e;
  --text-dim:  #484f58;
  --blue:      #2f81f7;
  --blue-hi:   #58a6ff;
  --green:     #2ea043;
  --green-hi:  #3fb950;
  --red:       #f85149;
  --amber:     #d29922;
  --amber-hi:  #e3b341;
  --purple:    #a371f7;
  --cyan:      #39d2c0;
  --coral:     #f78166;
  --radius:    10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --font:      'DM Sans', -apple-system, sans-serif;
  --mono:      'JetBrains Mono', monospace;
  --sidebar-w: 240px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.55; min-height: 100%; -webkit-font-smoothing: antialiased; }
a { color: var(--blue-hi); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ───────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page { padding: 24px; flex: 1; }

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); background: var(--bg-card); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 100;
  transition: transform .25s ease;
}
.sidebar__brand {
  display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
}
.sidebar__logo {
  width: 34px; height: 34px; background: linear-gradient(135deg, #f85149, #f97316);
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; color: #fff; flex-shrink: 0;
}
.sidebar__name { font-weight: 800; font-size: 16px; letter-spacing: -0.5px; }
.sidebar__close { display: none; background: none; border: none; color: var(--text-mid); font-size: 24px; cursor: pointer; margin-left: auto; }
.sidebar__nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: var(--radius-sm); color: var(--text-mid); font-size: 13.5px; font-weight: 500;
  transition: all .15s; text-decoration: none; margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.nav-item--active { background: rgba(47,129,247,.1); color: var(--blue-hi); font-weight: 600; }
.nav-item--active .nav-icon { stroke: var(--blue-hi); }
.nav-item--logout { color: var(--red); }
.nav-item--logout:hover { background: rgba(248,81,73,.08); }
.nav-icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.nav-divider { height: 1px; background: var(--border); margin: 10px 12px; }
.sidebar__footer { padding: 12px; border-top: 1px solid var(--border); }
.sidebar__user { display: flex; align-items: center; gap: 10px; padding: 8px 4px 10px; }
.sidebar__user-info { display: flex; flex-direction: column; }
.sidebar__user-name { font-size: 13px; font-weight: 600; }
.sidebar__user-role { font-size: 11px; color: var(--text-dim); }

.avatar {
  width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 14px; color: #fff; flex-shrink: 0;
}

/* ── Top Bar ──────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 24px; border-bottom: 1px solid var(--border);
  background: var(--bg-card); min-height: 60px; position: sticky; top: 0; z-index: 50;
}
.topbar__menu {
  display: none; background: none; border: none; color: var(--text-mid); cursor: pointer; padding: 4px;
  stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round;
}
.topbar__menu svg { stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.topbar__title { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; flex: 1; }
.topbar__right { display: flex; align-items: center; gap: 10px; }

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
  padding: 12px 18px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
  margin: 16px 24px 0; transition: all .3s;
}
.alert--success { background: rgba(46,160,67,.1); border: 1px solid rgba(46,160,67,.3); color: var(--green-hi); }
.alert--error   { background: rgba(248,81,73,.08); border: 1px solid rgba(248,81,73,.25); color: var(--red); }
.alert--info    { background: rgba(47,129,247,.08); border: 1px solid rgba(47,129,247,.25); color: var(--blue-hi); }

/* ── Stat Cards ───────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 28px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; display: flex; flex-direction: column; gap: 6px; transition: border-color .15s;
}
.stat-card:hover { border-color: var(--border-hi); }
.stat-card__label { font-size: 12px; color: var(--text-dim); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.stat-card__value { font-size: 30px; font-weight: 800; letter-spacing: -1px; line-height: 1.1; }
.stat-card__sub { font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 4px; }
.stat-card__dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.stat-card--blue .stat-card__value { color: var(--blue-hi); }
.stat-card--green .stat-card__value { color: var(--green-hi); }
.stat-card--amber .stat-card__value { color: var(--amber-hi); }
.stat-card--coral .stat-card__value { color: var(--coral); }
.stat-card--purple .stat-card__value { color: var(--purple); }
.stat-card--cyan .stat-card__value { color: var(--cyan); }

/* ── Cards / Panels ───────────────────────────────────────── */
.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; margin-bottom: 20px;
}
.card__header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.card__title { font-size: 14px; font-weight: 700; }
.card__body { padding: 20px; }
.card__footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }

/* ── Tables ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 10px 14px; font-weight: 600; font-size: 11px;
  color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: var(--bg-hover); }
tbody tr:last-child td { border-bottom: none; }

/* ── Badges / Pills ───────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 99px; font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge--green  { background: rgba(46,160,67,.12); color: var(--green-hi); }
.badge--red    { background: rgba(248,81,73,.1);  color: var(--red); }
.badge--amber  { background: rgba(210,153,34,.12); color: var(--amber-hi); }
.badge--blue   { background: rgba(47,129,247,.1); color: var(--blue-hi); }
.badge--purple { background: rgba(163,113,247,.1); color: var(--purple); }
.badge--dim    { background: var(--bg-raised); color: var(--text-dim); }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-mid); margin-bottom: 6px; }
.form-hint { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.input {
  width: 100%; padding: 10px 14px; background: var(--bg-input); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-family: var(--font); font-size: 14px;
  outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47,129,247,.12); }
.input::placeholder { color: var(--text-dim); }
.input--mono { font-family: var(--mono); font-size: 13px; letter-spacing: .5px; }
select.input { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b949e' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
textarea.input { resize: vertical; min-height: 100px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; background: var(--bg-raised); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-family: var(--font);
  font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; white-space: nowrap; min-height: 38px;
  text-decoration: none;
}
.btn:hover { background: var(--bg-hover); border-color: var(--border-hi); text-decoration: none; }
.btn--primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn--primary:hover { background: #388bfd; }
.btn--danger { background: rgba(248,81,73,.1); border-color: rgba(248,81,73,.3); color: var(--red); }
.btn--danger:hover { background: rgba(248,81,73,.18); }
.btn--success { background: rgba(46,160,67,.1); border-color: rgba(46,160,67,.3); color: var(--green-hi); }
.btn--success:hover { background: rgba(46,160,67,.18); }
.btn--sm { padding: 6px 12px; font-size: 12px; min-height: 30px; }
.btn--lg { padding: 12px 28px; font-size: 15px; font-weight: 700; min-height: 48px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Pagination ───────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 4px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.pg-btn {
  padding: 8px 14px; background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-mid); font-size: 13px; font-weight: 500;
  text-decoration: none; transition: all .15s; min-width: 38px; text-align: center;
}
.pg-btn:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.pg-btn--active { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 700; }
.pg-dots { color: var(--text-dim); padding: 0 6px; }

/* ── Empty state ──────────────────────────────────────────── */
.empty { text-align: center; padding: 48px 20px; color: var(--text-dim); }
.empty__icon { font-size: 42px; margin-bottom: 12px; opacity: .5; }
.empty__title { font-size: 16px; font-weight: 600; color: var(--text-mid); margin-bottom: 6px; }
.empty__desc { font-size: 13px; }

/* ── Filters bar ──────────────────────────────────────────── */
.filters {
  display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap;
}
.filters .input { max-width: 240px; }
.filters select.input { max-width: 160px; }
.filter-count { font-size: 12px; color: var(--text-dim); margin-left: auto; }

/* ── Modal ────────────────────────────────────────────────── */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 500; padding: 20px;
}
.modal {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; padding: 28px;
}
.modal__title { font-size: 18px; font-weight: 700; margin-bottom: 18px; }
.modal__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ── Login Page ───────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 20px;
}
.login-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 40px; width: 100%; max-width: 400px;
}
.login-card__logo { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; justify-content: center; }
.login-card__logo-icon {
  width: 44px; height: 44px; background: linear-gradient(135deg, #f85149, #f97316);
  border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 20px; color: #fff;
}
.login-card__logo-text { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.login-card h2 { font-size: 16px; text-align: center; margin-bottom: 24px; color: var(--text-mid); font-weight: 500; }

/* ── Detail view ──────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: var(--border); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 18px; }
.detail-cell { background: var(--bg-card); padding: 12px 16px; }
.detail-cell__label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; margin-bottom: 2px; }
.detail-cell__value { font-size: 14px; font-weight: 500; word-break: break-all; }
.detail-cell--full { grid-column: 1 / -1; }
.detail-cell--mono .detail-cell__value { font-family: var(--mono); font-size: 15px; color: var(--blue-hi); letter-spacing: 1px; }

/* ── Misc ─────────────────────────────────────────────────── */
.text-dim { color: var(--text-dim); }
.text-mid { color: var(--text-mid); }
.text-blue { color: var(--blue-hi); }
.text-green { color: var(--green-hi); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber-hi); }
.text-mono { font-family: var(--mono); }
.text-sm { font-size: 12px; }
.text-right { text-align: right; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mb-md { margin-bottom: 16px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.inline-flex { display: inline-flex; align-items: center; gap: 6px; }

/* ── Responsive ───────────────────────────────────────────── */
@media (min-width: 769px) {
  .content { margin-left: var(--sidebar-w); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%); width: 280px;
    box-shadow: 4px 0 24px rgba(0,0,0,.4);
  }
  .sidebar--open { transform: translateX(0); }
  .sidebar__close { display: block; }
  .topbar__menu { display: block; }
  .page { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card__value { font-size: 22px; }
  .form-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters .input, .filters select.input { max-width: 100%; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; }
  .topbar__title { font-size: 16px; }
}
