@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ─── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --bg: #f0f2f5;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --border: #e2e5ea;
  --border-strong: #c8cdd6;

  --ink: #111827;
  --ink-2: #374151;
  --ink-3: #6b7280;
  --ink-4: #9ca3af;

  --blue: #2563eb;
  --blue-dim: #eff4ff;
  --blue-border: #bfcffd;

  --green: #059669;
  --green-dim: #ecfdf5;
  --green-border: #a7f3d0;

  --red: #dc2626;
  --red-dim: #fef2f2;
  --red-border: #fecaca;

  --amber: #d97706;
  --amber-dim: #fffbeb;
  --amber-border: #fde68a;

  --sidebar-bg: #141c2b;
  --sidebar-border: rgba(255,255,255,0.06);
  --sidebar-text: rgba(255,255,255,0.65);
  --sidebar-text-active: #ffffff;
  --sidebar-hover: rgba(255,255,255,0.05);
  --sidebar-active: rgba(255,255,255,0.09);

  --radius-sm: 4px;
  --radius: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow: 0 2px 8px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.16), 0 4px 12px rgba(0,0,0,0.08);

  --font: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', monospace;
}

/* ─── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); min-height: 100vh; line-height: 1.55; }
a { color: var(--blue); text-decoration: none; }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.3; color: var(--ink); }

/* ─── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

/* ─── Utilities ─────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-muted { color: var(--ink-3); }
.text-sm { font-size: 0.833rem; }
.text-xs { font-size: 0.767rem; }
.text-center { text-align: center; }
.font-mono { font-family: var(--mono); }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* ─── Login Page ────────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 1rem;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.25rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-md);
}

.login-header {
  margin-bottom: 1.75rem;
}

.login-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.login-wordmark .mark {
  width: 32px;
  height: 32px;
  background: var(--sidebar-bg);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-wordmark .mark span {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: #fff;
  letter-spacing: 0.01em;
}

.login-wordmark h1 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
}

.login-header h2 {
  font-size: 1.3rem;
  margin-bottom: 0.3rem;
}

.login-header p {
  font-size: 0.875rem;
  color: var(--ink-3);
}

.login-notice {
  background: var(--blue-dim);
  border: 1px solid var(--blue-border);
  border-radius: var(--radius);
  padding: 0.65rem 0.85rem;
  font-size: 0.8rem;
  color: #1d4ed8;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.error-msg {
  background: var(--red-dim);
  border: 1px solid var(--red-border);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  font-size: 0.833rem;
  color: var(--red);
  margin-bottom: 1rem;
}

/* ─── Form Elements ─────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 0.35rem;
  letter-spacing: 0.01em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.form-group textarea {
  resize: vertical;
  min-height: 76px;
  line-height: 1.5;
}

.form-group select {
  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='%236b7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 2rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* ─── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s, opacity 0.12s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover:not(:disabled) { background: #1d4ed8; border-color: #1d4ed8; }

.btn-dark { background: var(--sidebar-bg); color: #fff; border-color: var(--sidebar-bg); }
.btn-dark:hover:not(:disabled) { background: #1e2a3b; }

.btn-outline { background: transparent; color: var(--ink-2); border-color: var(--border-strong); }
.btn-outline:hover:not(:disabled) { background: var(--surface-2); }

.btn-ghost { background: transparent; color: var(--ink-3); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--ink-2); }

.btn-danger { background: var(--red-dim); color: var(--red); border-color: var(--red-border); }
.btn-danger:hover:not(:disabled) { background: #fee2e2; }

.btn-success { background: var(--green-dim); color: var(--green); border-color: var(--green-border); }
.btn-success:hover:not(:disabled) { background: #d1fae5; }

.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-lg { padding: 0.7rem 1.4rem; font-size: 0.95rem; }
.btn-block { width: 100%; justify-content: center; }

/* ─── App Layout ────────────────────────────────────────────────────────────── */
.app-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

/* ─── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 1.25rem 1.1rem 1rem;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-mark {
  width: 28px;
  height: 28px;
  background: var(--blue);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-mark span {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  color: #fff;
  letter-spacing: 0.02em;
}

.brand-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--sidebar-text-active);
  line-height: 1.2;
}

.brand-name small {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--sidebar-text);
  margin-top: 1px;
}

.sidebar-user {
  padding: 0.875rem 1.1rem;
  border-bottom: 1px solid var(--sidebar-border);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(37,99,235,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: #93c5fd;
  flex-shrink: 0;
  font-family: var(--mono);
}

.user-info .name {
  font-size: 0.833rem;
  font-weight: 500;
  color: var(--sidebar-text-active);
  line-height: 1.2;
}

.user-info .role {
  font-size: 0.7rem;
  color: var(--sidebar-text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sidebar-balance {
  margin-top: 0.75rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
}

.sidebar-balance .bal-label {
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sidebar-text);
  margin-bottom: 0.15rem;
}

.sidebar-balance .bal-value {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 500;
  color: #fff;
  line-height: 1;
}

.sidebar-balance .bal-sub {
  font-size: 0.7rem;
  color: var(--sidebar-text);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-balance .bal-sub strong {
  color: #93c5fd;
  font-family: var(--mono);
}

.sidebar-nav {
  flex: 1;
  padding: 0.6rem 0;
}

.nav-group-label {
  padding: 0.75rem 1.1rem 0.3rem;
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.28);
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 1.1rem;
  font-size: 0.847rem;
  color: var(--sidebar-text);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background 0.1s, color 0.1s;
  position: relative;
}

.nav-item:hover { background: var(--sidebar-hover); color: var(--sidebar-text-active); }
.nav-item.active { background: var(--sidebar-active); color: var(--sidebar-text-active); font-weight: 500; }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 2px;
  background: var(--blue);
  border-radius: 0 2px 2px 0;
}

.nav-badge {
  background: var(--blue);
  color: #fff;
  border-radius: 10px;
  padding: 0.1rem 0.45rem;
  font-size: 0.67rem;
  font-weight: 600;
  min-width: 18px;
  text-align: center;
  font-family: var(--mono);
}

.sidebar-footer {
  padding: 0.875rem 1.1rem;
  border-top: 1px solid var(--sidebar-border);
}

/* ─── Main Content ──────────────────────────────────────────────────────────── */
.main-content { overflow-y: auto; }

.page-header {
  padding: 1.5rem 1.75rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.page-header h1 { font-size: 1.2rem; }
.page-header p { font-size: 0.833rem; color: var(--ink-3); margin-top: 0.15rem; }

.page-body { padding: 1.25rem 1.75rem; }

/* ─── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card + .card { margin-top: 1rem; }

.card-header {
  padding: 0.875rem 1.1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.card-header h3 { font-size: 0.875rem; font-weight: 600; color: var(--ink-2); }
.card-body { padding: 1.1rem; }

/* ─── Stat Row ──────────────────────────────────────────────────────────────── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
}

.stat-box .stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.stat-box .stat-value {
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1;
}

.stat-box .stat-sub {
  font-size: 0.75rem;
  color: var(--ink-4);
  margin-top: 0.3rem;
}

.stat-box.primary {
  background: var(--sidebar-bg);
  border-color: transparent;
}
.stat-box.primary .stat-label { color: rgba(255,255,255,0.45); }
.stat-box.primary .stat-value { color: #fff; }
.stat-box.primary .stat-sub { color: rgba(255,255,255,0.35); }

/* ─── Transaction List ──────────────────────────────────────────────────────── */
.txn-list { list-style: none; }

.txn-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1.1rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.txn-item:last-child { border-bottom: none; }
.txn-item:hover { background: var(--surface-2); }

.txn-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.txn-dot.credit { background: var(--green); }
.txn-dot.debit { background: var(--red); }
.txn-dot.neutral { background: var(--ink-4); }

.txn-info { flex: 1; min-width: 0; }
.txn-desc { font-size: 0.875rem; color: var(--ink-2); font-weight: 400; }
.txn-meta { font-size: 0.75rem; color: var(--ink-4); margin-top: 0.1rem; }

.txn-amount {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
}
.txn-amount.positive { color: var(--green); }
.txn-amount.negative { color: var(--red); }
.txn-amount.zero { color: var(--ink-4); }

/* ─── Shop ──────────────────────────────────────────────────────────────────── */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.875rem;
}

.shop-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.shop-item:hover { border-color: var(--blue); box-shadow: var(--shadow); }

.shop-item .item-name { font-size: 0.9rem; font-weight: 600; color: var(--ink); margin-bottom: 0.3rem; }
.shop-item .item-desc { font-size: 0.8rem; color: var(--ink-3); flex: 1; margin-bottom: 0.875rem; line-height: 1.45; }
.shop-item .item-cost {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 0.7rem;
}
.shop-item .item-cost span { color: var(--ink-4); font-size: 0.75rem; font-family: var(--font); }

/* ─── Table ─────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 0.853rem; }

thead th {
  background: var(--surface-2);
  padding: 0.6rem 0.9rem;
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
  color: var(--ink-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
  color: var(--ink-2);
  vertical-align: middle;
}
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }

/* ─── Badge ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
}

.badge-green { background: var(--green-dim); color: var(--green); border-color: var(--green-border); }
.badge-red { background: var(--red-dim); color: var(--red); border-color: var(--red-border); }
.badge-amber { background: var(--amber-dim); color: var(--amber); border-color: var(--amber-border); }
.badge-blue { background: var(--blue-dim); color: var(--blue); border-color: var(--blue-border); }
.badge-gray { background: var(--surface-2); color: var(--ink-3); border-color: var(--border); }

/* ─── Pending Request ───────────────────────────────────────────────────────── */
.request-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  margin-bottom: 0.75rem;
}
.request-card.is-mine { border-left-color: var(--amber); }
.request-card.is-theirs { border-left-color: var(--blue); }

.request-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.request-amount {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 500;
}
.request-amount.positive { color: var(--green); }
.request-amount.negative { color: var(--red); }

.request-meta { font-size: 0.8rem; color: var(--ink-3); margin-top: 0.15rem; }
.request-note { font-size: 0.8rem; color: var(--ink-3); margin-top: 0.35rem; font-style: italic; }

.approval-progress {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: var(--ink-3);
}

.approval-pips { display: flex; gap: 3px; }
.approval-pip {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
}
.approval-pip.filled { background: var(--green); }

/* ─── Item Editor ───────────────────────────────────────────────────────────── */
.item-editor {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem;
  margin-bottom: 0.6rem;
  background: var(--surface-2);
  position: relative;
}
.item-editor .remove-item { position: absolute; top: 0.6rem; right: 0.6rem; }

/* ─── Empty State ───────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--ink-4);
}
.empty-state p { font-size: 0.875rem; }

/* ─── User Row ──────────────────────────────────────────────────────────────── */
.user-row { display: flex; align-items: center; gap: 0.5rem; }
.avatar-sm {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--blue-dim);
  color: var(--blue);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ─── Toast ─────────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  pointer-events: none;
}

.toast {
  background: var(--ink);
  color: #fff;
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  font-size: 0.833rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 240px;
  max-width: 340px;
  animation: toastIn 0.2s ease;
  pointer-events: all;
  border-left: 3px solid transparent;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); background: #1c0a0a; }
.toast.info { border-left-color: var(--blue); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ─── Modal ─────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(1px);
  animation: fadeIn 0.15s ease;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.18s ease;
}

.modal h3 { font-size: 1rem; margin-bottom: 0.75rem; }
.modal p { font-size: 0.875rem; color: var(--ink-2); margin-bottom: 0.4rem; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.1rem;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ─── Txn Modal ─────────────────────────────────────────────────────────────── */
.modal-txn-wrap { max-height: 55vh; overflow-y: auto; margin: 0 -1.5rem; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

/* ─── Spinner ───────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.55s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Tabs (inline sub-nav) ─────────────────────────────────────────────────── */
.sub-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 0 1.75rem;
}

.sub-tab {
  padding: 0.7rem 1rem;
  font-size: 0.847rem;
  font-weight: 500;
  color: var(--ink-3);
  cursor: pointer;
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.12s, border-color 0.12s;
}
.sub-tab:hover { color: var(--ink-2); }
.sub-tab.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ─── Section label ─────────────────────────────────────────────────────────── */
.section-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
  margin-bottom: 0.75rem;
}

/* ─── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .sidebar-nav { display: flex; flex-wrap: wrap; gap: 0; }
  .nav-item { width: auto; padding: 0.5rem 0.85rem; }
  .nav-item.active::before { display: none; }
  .page-body { padding: 1rem; }
  .form-row { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr; }
}

/* ─── Notification Bell ─────────────────────────────────────────────────────── */

.notif-wrap {
  position: relative;
  margin-left: auto;
  flex-shrink: 0;
}

.notif-bell {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.65);
  padding: 0.3rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  position: relative;
  transition: color 0.15s, background 0.15s;
}
.notif-bell:hover { color: #fff; background: rgba(255,255,255,0.1); }

.notif-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 99px;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
}

.notif-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 280px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  z-index: 9999;
  overflow: hidden;
}

.notif-header {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b7280;
  padding: 0.65rem 0.9rem 0.45rem;
  border-bottom: 1px solid #f1f5f9;
}

.notif-empty {
  padding: 1rem 0.9rem;
  font-size: 0.8rem;
  color: #9ca3af;
  text-align: center;
}

.notif-item {
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid #f8fafc;
  transition: background 0.1s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: #f0f7ff; }
.notif-item.read   { background: #fff; }

.notif-msg {
  font-size: 0.8rem;
  color: #374151;
  line-height: 1.4;
}
.notif-time {
  font-size: 0.72rem;
  color: #9ca3af;
  margin-top: 0.2rem;
}

/* ─── Announcements ─────────────────────────────────────────────────────────── */

.announcement-card {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fcd34d;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.6rem;
}
.ann-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 0.1rem; }

/* ─── Shop categories ────────────────────────────────────────────────────────── */

.item-category {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 0.2rem;
}

/* Shop item description — constrained height with auto-shrink via JS */
.item-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
  height: 3.5em;
  overflow: hidden;
  flex: 1;
}

/* ─── Transaction tag (sender name) ─────────────────────────────────────────── */
.txn-tag {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(99,102,241,0.08);
  border-radius: 4px;
  padding: 0 0.35rem;
  vertical-align: middle;
}

/* ─── Order status badge (cancelled) ────────────────────────────────────────── */
.badge-red {
  background: #fee2e2;
  color: #b91c1c;
}

/* ─── Form hints ─────────────────────────────────────────────────────────────── */
.form-hint {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 0.3rem;
  line-height: 1.4;
}

/* ─── Small button variant ───────────────────────────────────────────────────── */
.btn-xs {
  padding: 0.15rem 0.5rem;
  font-size: 0.72rem;
  border-radius: 5px;
}

/* ─── Credit tab stat layout ─────────────────────────────────────────────────── */
.mt-1 { margin-top: 0.75rem; }

/* ─── Green text for positive adjustments ────────────────────────────────────── */
.text-green { color: #16a34a; }
.text-red   { color: #dc2626; }

/* ─── Main topbar (holds notification bell) ──────────────────────────────────── */

.main-topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 52px;
}

/* Override notif-bell for the light topbar context */
.main-topbar .notif-bell {
  color: var(--ink-3);
  background: none;
  padding: 0.45rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.main-topbar .notif-bell:hover {
  color: var(--ink);
  background: var(--surface-2);
  border-color: var(--border-strong);
}

/* Notif panel drops from topbar */
.main-topbar .notif-panel {
  top: calc(100% + 4px);
  right: 1.75rem;
}

/* ─── Category filter buttons — visible against white ────────────────────────── */

.cat-btn {
  padding: 0.3rem 0.85rem;
  font-size: 0.78rem;
  border-radius: 99px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface-2);
  cursor: pointer;
  color: var(--ink-2);
  transition: all 0.15s;
  font-weight: 500;
}
.cat-btn:hover  { border-color: var(--blue); color: var(--blue); background: var(--blue-dim); }
.cat-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ─── Announcement admin card (history view) ─────────────────────────────────── */

.ann-admin-card {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.ann-admin-card:last-child { border-bottom: none; }
.ann-admin-card:hover { background: var(--surface-2); }

.ann-admin-content { flex: 1; min-width: 0; }
.ann-admin-text    { font-size: 0.875rem; color: var(--ink); line-height: 1.45; }
.ann-admin-meta    { font-size: 0.72rem; color: var(--ink-4); margin-top: 0.3rem; }
.ann-admin-actions { display: flex; gap: 0.4rem; align-items: flex-start; flex-shrink: 0; }
