/* ============================================================
 * Admin dashboard styles — Sinar Elektronik (white + red).
 * styles.css provides the shared color tokens and .btn helpers.
 * ============================================================ */

.admin-body { background: var(--surface-secondary); }

.admin-layout { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }

/* ---- Sidebar ---- */
.admin-sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 1.4rem 1rem;
  position: sticky; top: 0; height: 100vh;
}
.admin-brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.2rem; margin-bottom: 1.8rem; padding: 0 .5rem; }
.admin-brand .brand-name span { color: var(--primary); }
.admin-nav { display: flex; flex-direction: column; gap: .3rem; flex: 1; }
.admin-nav-item {
  display: flex; align-items: center; gap: .7rem;
  background: none; border: none; color: var(--muted);
  padding: .7rem .8rem; border-radius: 10px; font-size: .95rem; font-weight: 500;
  cursor: pointer; text-align: left; font-family: inherit; transition: all .15s ease;
}
.admin-nav-item:hover { background: var(--surface-secondary); color: var(--text-primary); }
/* Red active indicator — tinted background + left red bar */
.admin-nav-item.active {
  background: var(--primary-light); color: var(--primary); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--primary);
}
.admin-back { color: var(--text-secondary); font-size: .85rem; padding: .6rem .8rem; margin-top: 1rem; }
.admin-back:hover { color: var(--primary); }
.admin-sidebar { box-shadow: var(--shadow-sm); }

/* ---- Main ---- */
.admin-main { min-width: 0; }
.admin-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.3rem 2rem; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 20;
}
.admin-topbar h1 { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); letter-spacing: -.01em; }
.admin-view { padding: 1.8rem 2rem 3rem; }
.btn-sm { padding: .45rem .9rem; font-size: .85rem; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

/* ---- Loading / status ---- */
.admin-status { color: var(--muted); text-align: center; padding: 3rem 0; }
.admin-status.error { color: var(--danger); }

/* ---- Stat cards ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1.1rem; margin-bottom: 2rem; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.2rem 1.3rem; display: flex; flex-direction: column; gap: .3rem;
  box-shadow: var(--shadow-sm);
}
.stat-card .stat-icon {
  font-size: 1.1rem; width: 36px; height: 36px; border-radius: var(--radius-sm);
  display: grid; place-items: center; background: var(--primary-light); margin-bottom: .3rem;
}
.stat-card .stat-label { color: var(--text-secondary); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-card .stat-value { font-size: 1.7rem; font-weight: 800; color: var(--text-primary); }
.stat-card .stat-sub { color: var(--text-secondary); font-size: .8rem; }

/* ---- Panels ---- */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.4rem 1.5rem; margin-bottom: 1.6rem; box-shadow: var(--shadow-sm);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.1rem; gap: 1rem; flex-wrap: wrap; }
.panel-head h2 { font-size: 1.15rem; font-weight: 700; color: var(--text-primary); }
.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.6rem; }

/* ---- Data table ---- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { text-align: left; padding: .7rem .6rem; border-bottom: 1px solid var(--border); font-size: .9rem; color: var(--text-primary); }
.data-table th { color: var(--text-secondary); font-weight: 700; font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; background: var(--surface-secondary); }
.data-table tbody tr:hover { background: var(--surface-secondary); }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .row-actions { display: flex; gap: .4rem; justify-content: flex-end; }

.table-scroll { overflow-x: auto; }

/* ---- Badges / pills ---- */
.badge { display: inline-block; font-size: .7rem; font-weight: 700; padding: .22rem .55rem; border-radius: var(--radius-sm); text-transform: uppercase; letter-spacing: .02em; }
/* Order fulfilment statuses: needs_shipping → shipped → completed (+ cancelled) */
.badge.needs_shipping { background: #fff7e6; color: #b26a00; }   /* amber — awaiting action */
.badge.shipped { background: var(--primary-light); color: var(--primary); }  /* red — in transit */
.badge.completed { background: #e8f6ee; color: var(--success); }  /* green — done */
.badge.cancelled { background: #fdecec; color: var(--danger); }   /* red — cancelled */
/* Legacy fallbacks (pre-migration) so a stray value still renders sensibly */
.badge.paid, .badge.pending { background: #fff7e6; color: #b26a00; }
.stock-badge { font-weight: 700; font-variant-numeric: tabular-nums; }
.stock-badge.ok { color: var(--success); }
.stock-badge.low { color: #b26a00; }
.stock-badge.out { color: var(--danger); }

.icon-action {
  background: var(--surface); border: 1px solid var(--border); color: var(--text-primary);
  border-radius: var(--radius-sm); padding: .35rem .6rem; font-size: .8rem; cursor: pointer; font-family: inherit;
  transition: all .15s ease;
}
.icon-action:hover { border-color: var(--primary); color: var(--primary); }
.icon-action.danger:hover { border-color: var(--danger); color: var(--danger); }

/* ---- Bar chart (horizontal) ---- */
.bars { display: flex; flex-direction: column; gap: .7rem; }
.bar-row { display: grid; grid-template-columns: 120px 1fr auto; gap: .8rem; align-items: center; }
.bar-label { font-size: .85rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { background: var(--surface-secondary); border-radius: 999px; height: 12px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 999px; }
.bar-value { font-size: .82rem; font-variant-numeric: tabular-nums; color: var(--text-primary); font-weight: 600; }

/* ---- Line/area chart (SVG) ---- */
.chart-wrap { width: 100%; }
.line-chart { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; gap: 1.2rem; margin-top: .6rem; font-size: .82rem; color: var(--text-secondary); }
.chart-legend span::before { content: "●"; margin-right: .35rem; }
.legend-rev::before { color: var(--primary); }
.legend-ord::before { color: var(--text-secondary); }
.line-chart { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); padding: .3rem; }
.chart-toggle { display: flex; gap: .3rem; }
.chart-toggle button {
  background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary);
  padding: .35rem .8rem; border-radius: var(--radius-sm); font-size: .82rem; cursor: pointer; font-family: inherit;
  transition: all .15s ease;
}
.chart-toggle button.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---- Modal ---- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 90; display: grid; place-items: center; padding: 1rem; }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  width: min(560px, 100%); max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1.2rem 1.4rem; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 1.15rem; }
.modal-body { padding: 1.4rem; }
.modal-foot { display: flex; justify-content: flex-end; gap: .7rem; padding: 1rem 1.4rem; border-top: 1px solid var(--border); flex-wrap: wrap; }
/* Wider variant for detail views that show a table + side-by-side blocks. */
.modal.modal-lg { width: min(760px, 100%); }

/* ---- Form ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid .full { grid-column: 1 / -1; }
.form-field { display: flex; flex-direction: column; gap: .35rem; }
.form-field label { font-size: .82rem; color: var(--text-secondary); font-weight: 500; }
.form-field input, .form-field textarea, .form-field select {
  background: var(--surface); border: 1px solid var(--border); color: var(--text-primary);
  padding: .6rem .75rem; border-radius: var(--radius-sm); font-size: .92rem; font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-field input:focus, .form-field textarea:focus, .form-field select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.form-field textarea { resize: vertical; min-height: 70px; }
.form-error { color: var(--danger); font-size: .82rem; margin-top: .5rem; }

/* ---- Toasts ---- */
.toast-host { position: fixed; bottom: 1.4rem; right: 1.4rem; z-index: 200; display: flex; flex-direction: column; gap: .6rem; }
.toast {
  background: var(--surface); color: var(--text-primary);
  border: 1px solid var(--border); border-left: 3px solid var(--primary);
  padding: .8rem 1.1rem; border-radius: var(--radius-sm); font-size: .9rem; box-shadow: var(--shadow);
  animation: toast-in .2s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .panel-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center;
    gap: .5rem; padding: .8rem 1rem;
  }
  .admin-brand { margin-bottom: 0; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; flex: 1 1 100%; }
  .admin-nav-item span { display: none; }
  .admin-back { margin-top: 0; }
  .admin-view { padding: 1.2rem; }
  .form-grid { grid-template-columns: 1fr; }
}


/* ---- Logout button (styled like the nav links) ---- */
button.admin-back {
  background: none; border: none; text-align: left; width: 100%;
  font-family: inherit; cursor: pointer;
}

/* ---- Login screen ---- */
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: var(--surface-secondary); }
.login-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  width: min(400px, 100%); padding: 2rem; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 1rem;
}
.login-brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.2rem; color: var(--text-primary); }
.login-brand .brand-name span { color: var(--primary); }
.login-card h1 { font-size: 1.4rem; font-weight: 800; color: var(--text-primary); }
.login-sub { color: var(--text-secondary); font-size: .9rem; margin-top: -.5rem; }


/* ---- Promo pricing (admin) ---- */
.discount-hint { font-size: .82rem; color: var(--text-secondary); }
.discount-badge { display: inline-block; background: var(--primary); color: #fff; font-size: .7rem; font-weight: 700; padding: .12rem .45rem; border-radius: var(--radius-sm); margin-right: .35rem; }
.discount-warn { color: var(--warning); }
.sale-price { color: var(--primary); font-weight: 700; }
.sale-off { color: var(--primary); font-size: .72rem; font-weight: 700; }
.muted-dash { color: var(--border); }

/* ---- Image manager (admin) ---- */
.image-manager { margin-top: 1.4rem; border-top: 1px solid var(--border); padding-top: 1.1rem; }
.im-label { display: block; font-size: .82rem; color: var(--text-secondary); font-weight: 600; margin-bottom: .7rem; }
.im-note { margin-top: 1rem; color: var(--text-secondary); font-size: .85rem; }
.im-main { display: flex; align-items: center; gap: .8rem; margin-bottom: .9rem; }
.im-main-preview {
  width: 96px; height: 96px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  display: grid; place-items: center; overflow: hidden; background: var(--surface-secondary);
}
.im-main-preview img { width: 100%; height: 100%; object-fit: cover; }
.im-emoji { font-size: 2.4rem; }
.im-main-tag { font-size: .72rem; font-weight: 700; color: var(--primary); background: var(--primary-light); padding: .2rem .55rem; border-radius: var(--radius-sm); }
.im-empty { color: var(--text-secondary); font-size: .8rem; }
.im-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .7rem; margin-bottom: .9rem; }
.im-cell { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
/* Image boxes pin their <img> absolutely: on a centred grid item `height: 100%`
   degrades to `auto`, so a portrait photo renders at full height and only its
   top slice shows. Absolute positioning gives a definite height so object-fit
   works. `contain` here because admins need to see the whole image. */
.im-cell-preview { position: relative; height: 64px; display: grid; place-items: center; background: var(--surface-secondary); overflow: hidden; }
.im-cell-preview > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 2px; }
.im-cell-preview .im-emoji { font-size: 1.6rem; }
.im-cell-actions { display: flex; flex-direction: column; gap: .2rem; padding: .3rem; }
.im-cell-actions .icon-action { font-size: .68rem; padding: .2rem .3rem; text-align: center; }
.im-single-actions { margin-bottom: .9rem; }
.im-upload { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.im-hint { color: var(--text-secondary); font-size: .75rem; }
.im-status { color: var(--primary); font-size: .78rem; }


/* ---- Products table toolbar (search) ---- */
.table-toolbar { margin: 0 0 1rem; }
.search-field { position: relative; max-width: 360px; }
.search-field-icon { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); opacity: .55; font-size: .85rem; pointer-events: none; }
.search-field-input {
  width: 100%; padding: .55rem .8rem .55rem 2.1rem;
  background: var(--surface-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary); font-size: .9rem; font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.search-field-input:focus { outline: none; border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 3px var(--primary-light); }
.search-field-input::placeholder { color: var(--text-secondary); }

/* ---- Product row thumbnail ---- */
.row-thumb {
  position: relative;
  display: inline-grid; place-items: center; overflow: hidden;
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-secondary);
}
.row-thumb > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 2px; }
.row-thumb-emoji { font-size: 1.4rem; }

/* Compact variant for order cards, where space is tight. Same contract as
   .row-thumb (absolute img so portrait shots aren't cropped). */
.oc-thumb {
  position: relative; flex-shrink: 0;
  display: inline-grid; place-items: center; overflow: hidden;
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-secondary);
}
.oc-thumb > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 1px; }
.oc-thumb-emoji { font-size: 1rem; }

/* ---- Edit form active-image preview ---- */
.form-preview { display: flex; align-items: center; gap: .8rem; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.preview-thumb {
  position: relative;
  display: inline-grid; place-items: center; overflow: hidden;
  width: 64px; height: 64px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-secondary); flex-shrink: 0;
}
.preview-thumb > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 2px; }
.preview-thumb-emoji { font-size: 2rem; }
.form-preview-meta { display: flex; flex-direction: column; }
.form-preview-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); }
.form-preview-name { font-weight: 600; color: var(--text-primary); }


/* Order status flow hint under the update dropdown */
.status-flow-hint { display: block; margin-top: .4rem; font-size: .75rem; color: var(--text-secondary); }


/* ---- Admin Messages (chat) ---- */
.ac-layout { display: grid; grid-template-columns: 300px 1fr; gap: 1.2rem; height: calc(100vh - 200px); min-height: 420px; }
.ac-sidebar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-sm); }
.ac-sidebar-head { padding: .9rem 1rem; font-weight: 700; border-bottom: 1px solid var(--border); font-size: .95rem; }
.ac-list { flex: 1; overflow-y: auto; }
.ac-conv { display: flex; flex-direction: column; gap: .15rem; width: 100%; text-align: left; background: none; border: none; border-bottom: 1px solid var(--border); padding: .7rem 1rem; cursor: pointer; font-family: inherit; }
.ac-conv:hover { background: var(--surface-secondary); }
.ac-conv.active { background: var(--primary-light); box-shadow: inset 3px 0 0 var(--primary); }
.ac-conv-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.ac-conv-name { font-weight: 600; color: var(--text-primary); font-size: .9rem; }
.ac-unread { background: var(--primary); color: #fff; font-size: .68rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 999px; display: inline-grid; place-items: center; padding: 0 5px; }
.ac-conv-email { font-size: .76rem; color: var(--text-secondary); }
.ac-conv-last { font-size: .8rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ac-thread { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-sm); }
.ac-empty { margin: auto; color: var(--text-secondary); padding: 2rem; }
.ac-thread-head { padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: .1rem; }
.ac-thread-head strong { color: var(--text-primary); }
.ac-thread-email { font-size: .8rem; color: var(--text-secondary); }
.ac-thread-msgs { flex: 1; overflow-y: auto; padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .5rem; }
.ac-msg { max-width: 72%; display: flex; flex-direction: column; gap: .15rem; }
.ac-msg-body { display: inline-block; padding: .5rem .75rem; border-radius: 12px; font-size: .9rem; line-height: 1.35; white-space: pre-wrap; word-break: break-word; }
.ac-msg-time { font-size: .68rem; color: var(--text-secondary); }
.ac-msg.admin { align-self: flex-end; align-items: flex-end; }
.ac-msg.admin .ac-msg-body { background: var(--primary); color: #fff; border-bottom-right-radius: 3px; }
.ac-msg.customer { align-self: flex-start; }
.ac-msg.customer .ac-msg-body { background: var(--surface-secondary); color: var(--text-primary); border: 1px solid var(--border); border-bottom-left-radius: 3px; }
.ac-compose { display: flex; gap: .6rem; padding: .8rem 1rem; border-top: 1px solid var(--border); }
.ac-compose input { flex: 1; background: var(--surface-secondary); border: 1px solid var(--border); color: var(--text-primary); padding: .6rem .8rem; border-radius: var(--radius-sm); font-size: .9rem; font-family: inherit; }
.ac-compose input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

@media (max-width: 720px) {
  .ac-layout { grid-template-columns: 1fr; height: auto; }
  .ac-sidebar { max-height: 240px; }
  .ac-thread { min-height: 360px; }
}


/* ---- Orders: one status per tab ---- */
.orders-head-hint { font-size: .82rem; color: var(--text-secondary); }

/* The tab bar starts flush under the panel head; the list gets its own spacing. */
.orders-panel .admin-tabs { margin-bottom: 0; }
.orders-body { padding-top: 1rem; }

/* Cards fill the width the board used to split into columns. */
.order-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: .8rem; align-items: start;
}

.order-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .8rem; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .18s ease, border-color .18s ease;
}
.order-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--primary); }
.order-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.order-card-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.order-card-id { font-family: monospace; font-size: .74rem; color: var(--text-secondary); }
.order-card-total { font-weight: 800; color: var(--text-primary); font-size: .95rem; }
.order-card-customer { font-weight: 600; color: var(--text-primary); margin-top: .3rem; font-size: .92rem; }
.order-card-meta { display: flex; gap: .4rem; align-items: center; color: var(--text-secondary); font-size: .78rem; margin-top: .2rem; }
/* What's in the order: thumbnail + first product name + "+N more". */
.order-card-items {
  display: flex; align-items: center; gap: .45rem;
  margin-top: .55rem; padding-top: .55rem; border-top: 1px solid var(--border);
  min-width: 0;
}
.oc-item-name {
  font-size: .82rem; color: var(--text-primary); font-weight: 500;
  /* One line: card width is the constraint, and the full name is in the title. */
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.oc-item-qty { font-size: .78rem; color: var(--text-secondary); font-weight: 600; flex-shrink: 0; }
.oc-more {
  flex-shrink: 0; margin-left: auto; cursor: help;
  font-size: .7rem; font-weight: 700; padding: .1rem .4rem; border-radius: 999px;
  background: var(--surface-secondary); color: var(--text-secondary); border: 1px solid var(--border);
}

.order-card-actions { display: flex; gap: .4rem; margin-top: .7rem; flex-wrap: wrap; }
.btn-xs { padding: .3rem .6rem; font-size: .75rem; border-radius: var(--radius-sm); }

@media (max-width: 560px) {
  .order-list { grid-template-columns: 1fr; }
}


/* ---- Payment info (admin order detail) ---- */
.payment-info { margin-top: .8rem; border-top: 1px solid var(--border); padding-top: .8rem; display: flex; flex-direction: column; gap: .4rem; }
.payment-info-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; font-size: .85rem; color: var(--text-secondary); }
.pay-badge { font-size: .72rem; font-weight: 700; padding: .2rem .55rem; border-radius: var(--radius-sm); text-transform: uppercase; letter-spacing: .02em; }
.pay-badge.pay-paid { background: #e8f6ee; color: var(--success); }
.pay-badge.pay-pending { background: #fff7e6; color: #b26a00; }
.pay-badge.pay-failed, .pay-badge.pay-expired, .pay-badge.pay-cancelled { background: #fdecec; color: var(--danger); }
.pay-badge.pay-unconfigured { background: var(--surface-secondary); color: var(--text-secondary); }
.pay-txn { font-family: monospace; font-size: .78rem; color: var(--text-primary); background: var(--surface-secondary); padding: .12rem .4rem; border-radius: 5px; word-break: break-all; }


/* Awaiting-payment status (kept out of the fulfilment pipeline until paid) */
.badge.awaiting_payment { background: #eef1f6; color: #55617a; }


/* Read-only review summary in the admin product edit form */
.form-preview-reviews { font-size: .8rem; color: var(--text-secondary); margin-top: .15rem; }


/* ---- Fulfillment pills + adapted stage label on order cards ---- */
.order-card-tags { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .5rem; }
.fulfil-pill { font-size: .68rem; font-weight: 700; padding: .12rem .45rem; border-radius: 999px; white-space: nowrap; }
.fulfil-pill.delivery { background: var(--primary-light); color: var(--primary); }
.fulfil-pill.pickup { background: #eef1f6; color: #55617a; }
.stage-pill { font-size: .68rem; font-weight: 600; padding: .12rem .45rem; border-radius: 999px; background: var(--surface-secondary); color: var(--text-secondary); }


/* ---- Homepage banners view ---- */
.panel-note { color: var(--text-secondary); font-size: .85rem; padding: 0 1.1rem .8rem; }
.muted-sm { display: block; color: var(--text-secondary); font-size: .78rem; margin-top: .15rem; }
.banner-thumb {
  display: inline-block; width: 84px; height: 48px; flex-shrink: 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; background: var(--surface-secondary);
}
.banner-thumb { position: relative; }
/* `cover` is right here — a banner is displayed as a wide crop anyway. */
.banner-thumb > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.banner-swatch { display: block; width: 100%; height: 100%; }
.banner-image-row { display: flex; align-items: flex-start; gap: .8rem; }
.banner-image-inputs { display: flex; flex-direction: column; gap: .4rem; flex: 1; min-width: 0; }
.form-hint { color: var(--text-secondary); font-size: .76rem; margin-top: .4rem; }
.order-btns { display: flex; gap: .25rem; }
.order-btns .icon-action { padding: .2rem .45rem; }
.icon-action:disabled { opacity: .4; cursor: not-allowed; }
.icon-action:disabled:hover { border-color: var(--border); color: var(--text-secondary); }


/* ---- Aftersales view ---- */
.as-admin-filters {
  display: flex; flex-wrap: wrap; gap: 1.2rem;
  padding: 0 1.1rem 1rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem;
}
.as-admin-filter { display: flex; flex-direction: column; gap: .4rem; }
.as-admin-label {
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-secondary);
}
.as-admin-head { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.as-admin-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .8rem; font-size: .88rem;
}
/* min-width:0 + wrapping so a long email doesn't run into the next column. */
.as-admin-grid > div { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.as-admin-grid > div > span, .as-admin-grid > div > strong { overflow-wrap: anywhere; }
.as-admin-section { margin-top: 1.3rem; }
.as-admin-section h4 {
  font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-secondary); margin-bottom: .5rem;
}
.as-admin-desc {
  white-space: pre-wrap; font-size: .9rem;
  background: var(--surface-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .8rem .9rem;
}
.as-admin-items { list-style: none; margin-top: .7rem; display: flex; flex-direction: column; gap: .25rem; font-size: .88rem; }
.as-admin-actions { flex-wrap: wrap; }
.as-admin-section textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--border); color: var(--text-primary);
  padding: .7rem .85rem; border-radius: var(--radius-sm); font: inherit; font-size: .9rem; resize: vertical;
}
.as-admin-section textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

/* Evidence photos — thumbnails open the full-size image in a new tab. */
.as-admin-photos { display: flex; flex-wrap: wrap; gap: .5rem; }
.as-admin-photo {
  position: relative; display: block; width: 84px; height: 84px; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-secondary);
  transition: border-color .15s ease, transform .15s ease;
}
.as-admin-photo:hover { border-color: var(--primary); transform: translateY(-2px); }
.as-admin-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* Aftersales status + type badges (orders' own statuses are styled above). */
.badge.submitted    { background: #eef1f6; color: #55617a; }
.badge.under_review { background: #fff7e6; color: #b26a00; }
.badge.approved     { background: #e8f6ee; color: var(--success); }
.badge.processing   { background: #e8f0fe; color: #1a56db; }
.badge.rejected     { background: #fdecec; color: var(--danger); }
.badge.type-warranty_claim  { background: var(--primary-light); color: var(--primary); }
.badge.type-return_exchange { background: #eef1f6; color: #55617a; }


/* ---- Bulk product import wizard ---- */
.panel-head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.imp-body { padding: 0 1.1rem 1.2rem; }
.imp-intro { padding: 0 0 .8rem; }
.imp-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary); }

/* Step indicator */
.imp-steps {
  display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; list-style: none;
  padding: 0 1.1rem 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border);
}
.imp-step { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--text-secondary); }
.imp-step-num {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  font-size: .74rem; font-weight: 700;
  background: var(--surface-secondary); color: var(--text-secondary); border: 1px solid var(--border);
}
.imp-step.current { color: var(--text-primary); font-weight: 700; }
.imp-step.current .imp-step-num { background: var(--primary); color: #fff; border-color: var(--primary); }
.imp-step.done .imp-step-num { background: var(--success); color: #fff; border-color: var(--success); }

/* Upload */
.imp-drop {
  display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
  padding: 1.2rem; border: 1px dashed var(--border); border-radius: var(--radius);
  background: var(--surface-secondary); margin-bottom: .6rem;
}
.imp-drop input[type="file"] { font-size: .9rem; color: var(--text-secondary); }

/* File metadata + mapping */
.imp-filemeta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .8rem;
  padding: .9rem 1rem; margin-bottom: 1rem; font-size: .88rem;
  background: var(--surface-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.imp-filemeta > div { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.imp-filemeta strong, .imp-filemeta span { overflow-wrap: anywhere; }
.imp-map-table td { vertical-align: middle; }
.imp-select {
  width: 100%; max-width: 320px; padding: .45rem .6rem; font: inherit; font-size: .88rem;
  background: var(--surface); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.imp-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.imp-sample { color: var(--text-secondary); font-size: .84rem; max-width: 260px; overflow-wrap: anywhere; }
.imp-req {
  font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--primary); background: var(--primary-light); padding: .1rem .35rem; border-radius: var(--radius-sm);
}

/* Preview summary chips */
.imp-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.imp-chip {
  font-size: .82rem; font-weight: 600; padding: .35rem .7rem; border-radius: 999px;
  background: var(--surface-secondary); color: var(--text-secondary); border: 1px solid var(--border);
}
.imp-chip.ready { background: #e8f6ee; color: var(--success); border-color: #bfe3cd; }
.imp-chip.duplicate { background: #fff7e6; color: #b26a00; border-color: #f5d99a; }
.imp-chip.error { background: #fdecec; color: var(--danger); border-color: #f7cccc; }

/* Per-row status */
.badge.imp-ready { background: #e8f6ee; color: var(--success); }
.badge.imp-duplicate { background: #fff7e6; color: #b26a00; }
.badge.imp-error { background: #fdecec; color: var(--danger); }
.badge.imp-empty { background: #eef1f6; color: #55617a; }
.badge.imp-outcome-imported { background: #e8f6ee; color: var(--success); }
.badge.imp-outcome-skipped { background: #fff7e6; color: #b26a00; }
.badge.imp-outcome-failed { background: #fdecec; color: var(--danger); }
.badge.imp-needs-image { background: #e8f0fe; color: #1a56db; margin-left: .3rem; }
.imp-preview-table tr.imp-row-error td, .imp-preview-table tr.imp-row-duplicate td { background: rgba(0,0,0,.015); }
.imp-preview-table tr.imp-row-empty td { opacity: .6; }
.imp-ok { color: var(--success); font-weight: 600; font-size: .85rem; }
.imp-bad { color: var(--danger); font-weight: 600; }

/* Row notes */
.imp-notes { list-style: none; display: flex; flex-direction: column; gap: .2rem; font-size: .78rem; max-width: 320px; }
.imp-notes li { overflow-wrap: anywhere; color: var(--text-secondary); }
.imp-notes li.error { color: var(--danger); }
.imp-notes li.warn { color: #b26a00; }

.imp-problems {
  margin-top: 1rem; padding: .9rem 1rem;
  background: #fff7e6; border: 1px solid #f5d99a; border-radius: var(--radius-sm);
}
.imp-problems h4 { font-size: .84rem; color: #b26a00; margin-bottom: .4rem; }
.imp-problems ul { list-style: none; display: flex; flex-direction: column; gap: .2rem; font-size: .82rem; }

.imp-warn {
  padding: .7rem .9rem; margin-bottom: 1rem; font-size: .86rem;
  background: #fff7e6; color: #8a5400; border: 1px solid #f5d99a; border-radius: var(--radius-sm);
}
.imp-headline { font-size: 1.05rem; margin-bottom: 1rem; }
.imp-headline strong { color: var(--success); }

.imp-checkbox {
  display: flex; gap: .6rem; align-items: flex-start; margin: 1rem 0;
  padding: .8rem .9rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; font-size: .88rem;
}
.imp-checkbox input { margin-top: .2rem; accent-color: var(--primary); }
.imp-checkbox span { display: flex; flex-direction: column; gap: .15rem; }
.imp-checkbox small { color: var(--text-secondary); font-size: .78rem; }

.imp-actions { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-top: 1.2rem; }


/* ---- In-panel tab bar ----
   Shared by the Products All/Out-of-stock tabs and the Orders status tabs, so
   both read the same. `.prod-*` is kept as an alias for the products view. */
.admin-tabs, .prod-tabs {
  display: flex; gap: .3rem; padding: 0 1.1rem; border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.admin-tab, .prod-tab {
  display: inline-flex; align-items: center; gap: .45rem;
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: .6rem .8rem; font: inherit; font-size: .9rem; font-weight: 600;
  color: var(--text-secondary); cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.admin-tab:hover, .prod-tab:hover { color: var(--primary); }
.admin-tab.active, .prod-tab.active { color: var(--text-primary); border-bottom-color: var(--primary); }
.admin-tab-count, .prod-tab-count {
  font-size: .74rem; font-weight: 700; padding: .1rem .4rem; border-radius: 999px;
  background: var(--surface-secondary); color: var(--text-secondary); border: 1px solid var(--border);
}
.admin-tab-count.warn, .prod-tab-count.warn { background: #fdecec; color: var(--danger); border-color: #f7cccc; }
.prod-tabs + .panel-note { padding-top: .9rem; }

/* Sidebar count badge (out-of-stock items needing attention) */
.nav-badge {
  margin-left: auto; font-size: .7rem; font-weight: 700; line-height: 1;
  padding: .2rem .4rem; border-radius: 999px;
  background: var(--danger); color: #fff;
}


/* ---- Categories (custom icon per category) ---- */
.cat-admin-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: .8rem; padding: 0 1.1rem 1.2rem;
}
.cat-admin-card {
  display: grid; grid-template-columns: 56px 1fr; grid-template-areas:
    "icon meta"
    "actions actions"
    "error error";
  align-items: center; gap: .6rem .8rem;
  padding: .9rem; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
}
/* Mirrors the storefront tile: rounded square, cropped, photo replaces the glyph. */
.cat-admin-icon {
  grid-area: icon;
  position: relative; overflow: hidden;
  display: grid; place-items: center; width: 56px; height: 56px;
  border-radius: var(--radius-sm);
  background: var(--primary-light); color: var(--primary);
}
.cat-admin-icon.has-photo { background: var(--surface-secondary); }
/* `contain` + a little padding, matching the storefront tile, so this preview
   shows the same framing a shopper gets. */
.cat-admin-icon > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.cat-admin-icon .cat-icon { width: 26px; height: 26px; }
.cat-admin-meta { grid-area: meta; display: flex; flex-direction: column; min-width: 0; }
.cat-admin-meta strong { overflow-wrap: anywhere; }
.cat-admin-actions { grid-area: actions; display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.cat-admin-error { grid-area: error; margin: 0; }



/* ---- Shipping zones (Jabodetabek delivery coverage) ---- */
.zones-intro {
  margin: -.3rem 0 1rem; color: var(--text-secondary); font-size: .85rem;
  max-width: 70ch; line-height: 1.5;
}
/* The city name is printed once per group and left blank on the rows beneath it,
   so keep the column narrow enough that the kecamatan stays the visual anchor. */
#zonesTableHost .data-table td:first-child { white-space: nowrap; }



/* ---- Order detail view (modal) ---- */
.od-head {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding-bottom: .9rem; margin-bottom: 1.1rem; border-bottom: 1px solid var(--border);
}
.od-placed { font-size: .82rem; color: var(--text-secondary); margin-left: auto; }

/* Customer + fulfillment sit side by side; they're both short. */
.od-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.od-block {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .85rem .9rem; background: var(--surface-secondary);
}
.od-section { margin-top: 1.4rem; }
/* Line item cell: thumbnail beside the snapshotted product name. */
.od-item { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.od-item-text { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.od-item-name { font-weight: 500; color: var(--text-primary); overflow-wrap: anywhere; }
/* The customer's request for this line. Amber and boxed so whoever is packing
   can't miss it while scanning the item list. */
.od-item-note {
  display: inline-block; font-size: .8rem; line-height: 1.45;
  background: #fff7e6; color: #7a4e00; border: 1px solid #f5d99b;
  border-radius: var(--radius-sm); padding: .25rem .45rem;
  overflow-wrap: anywhere; white-space: normal;
}
.od-item-note strong { color: #6b4400; font-weight: 700; }
.od-block h4, .od-section h4 {
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-secondary); margin-bottom: .5rem;
}
.od-strong { font-weight: 700; color: var(--text-primary); font-size: .95rem; }
.od-muted { color: var(--text-secondary); font-size: .82rem; margin-top: .3rem; line-height: 1.45; }
.od-address { font-style: normal; color: var(--text-primary); font-size: .88rem; margin-top: .25rem; line-height: 1.45; }

/* Label/value pairs (customer contact, payment). */
.od-pairs { display: grid; grid-template-columns: auto 1fr; gap: .3rem .8rem; margin-top: .4rem; font-size: .86rem; }
.od-pairs dt { color: var(--text-secondary); }
.od-pairs dd { color: var(--text-primary); overflow-wrap: anywhere; }
.od-pairs a { color: var(--primary); text-decoration: none; }
.od-pairs a:hover { text-decoration: underline; }

/* Money breakdown, right-aligned like a receipt. */
.od-totals {
  display: grid; grid-template-columns: 1fr auto; gap: .35rem 1.5rem;
  max-width: 340px; margin-left: auto; font-size: .9rem;
}
.od-totals dt { color: var(--text-secondary); }
.od-totals dd { text-align: right; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.od-totals dd.minus { color: var(--danger); }
.od-totals dt.grand, .od-totals dd.grand {
  border-top: 1px solid var(--border); padding-top: .45rem; margin-top: .2rem;
  font-weight: 800; color: var(--text-primary); font-size: 1.05rem;
}

/* Status actions: the primary moves, then a manual picker as the escape hatch
   (moving an order backwards, or reopening a cancelled one). */
.od-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.od-manual { margin-top: .9rem; padding-top: .9rem; border-top: 1px dashed var(--border); }
.od-manual > label {
  display: block; font-size: .78rem; font-weight: 600; color: var(--text-secondary); margin-bottom: .35rem;
}
.od-manual-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.od-manual-row select {
  flex: 0 1 220px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-primary);
  padding: .5rem .7rem; border-radius: var(--radius-sm); font-size: .9rem; font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.od-manual-row select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.od-manual .status-flow-hint { margin-top: .5rem; }

/* ---- Status timeline ---- */
.order-timeline { list-style: none; margin: 0; padding: 0 0 0 1.1rem; position: relative; }
/* The connecting rail behind the dots. */
.order-timeline::before {
  content: ""; position: absolute; left: 3px; top: .55rem; bottom: .55rem;
  width: 2px; background: var(--border);
}
.timeline-point {
  position: relative; display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; padding: .42rem 0;
}
/* Each point carries its stage color via `color`, so the dot's ring and (when
   it's the current stage) its fill both pick it up. The label/time have their
   own colors, so this never leaks into the text. */
.timeline-point.placed, .timeline-point.awaiting_payment { color: #8a94a6; }
.timeline-point.needs_shipping { color: #f0b429; }
.timeline-point.shipped { color: var(--primary); }
.timeline-point.completed { color: var(--success); }
.timeline-point.cancelled { color: var(--danger); }
.timeline-point::before {
  content: ""; position: absolute; left: -1.1rem; top: .72rem;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--surface); border: 2px solid currentColor;
}
/* The stage the order is in now: filled, with a soft halo. */
.timeline-point.current::before {
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent);
}

.timeline-label {
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
  font-size: .88rem; font-weight: 600; color: var(--text-secondary);
}
.timeline-point.current .timeline-label { color: var(--text-primary); font-weight: 700; }
.timeline-tag {
  font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: .1rem .35rem; border-radius: 999px;
  background: var(--surface-secondary); color: var(--text-secondary); border: 1px solid var(--border);
}
.timeline-tag.now { background: var(--primary-light); color: var(--primary); border-color: transparent; }
.timeline-time { font-size: .78rem; color: var(--text-secondary); white-space: nowrap; font-variant-numeric: tabular-nums; }
/* Stage reached before status tracking existed — no timestamp to show. */
.timeline-time.unknown { font-style: italic; opacity: .75; }
.timeline-note {
  margin-top: .7rem; font-size: .78rem; color: var(--text-secondary);
  line-height: 1.45; padding-left: 1.1rem;
}

@media (max-width: 620px) {
  .od-grid { grid-template-columns: 1fr; }
  .od-placed { margin-left: 0; }
  .od-totals { max-width: none; }
  .timeline-point { flex-direction: column; gap: .1rem; }
}



/* ---- Notification bell + dropdown ---- */
/* The topbar is space-between with the title on the left, so the bell and the
   refresh button share one group on the right. */
.topbar-actions { display: flex; align-items: center; gap: .6rem; }

/* Anchor for the absolutely-positioned panel. */
.notif { position: relative; }

.notif-bell {
  position: relative; display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  background: none; border: 1px solid transparent; cursor: pointer;
  font-size: 1.15rem; line-height: 1;
  transition: background .15s ease, border-color .15s ease;
}
.notif-bell:hover { background: var(--surface-secondary); border-color: var(--border); }
.notif-bell:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.notif-bell.has-unread .notif-bell-icon { filter: none; }

/* Unread count, matching the sidebar badge's red pill. */
.notif-count {
  position: absolute; top: 1px; right: 1px;
  min-width: 17px; height: 17px; padding: 0 4px;
  display: inline-grid; place-items: center;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-size: .64rem; font-weight: 700; line-height: 1;
  border: 2px solid var(--surface);   /* separates it from the icon underneath */
}

/* One shake when something new arrives, so it's noticeable peripherally. */
@keyframes notif-ring {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(14deg); }
  30% { transform: rotate(-12deg); }
  45% { transform: rotate(9deg); }
  60% { transform: rotate(-7deg); }
  75% { transform: rotate(4deg); }
}
.notif-bell.ring .notif-bell-icon {
  display: inline-block;
  animation: notif-ring .9s ease-in-out;
  transform-origin: 50% 15%;
}
@media (prefers-reduced-motion: reduce) {
  .notif-bell.ring .notif-bell-icon { animation: none; }
}

.notif-mute {
  background: none; border: none; cursor: pointer; padding: .1rem .2rem;
  font-size: .95rem; line-height: 1; border-radius: 5px;
}
.notif-mute:hover { background: var(--surface-secondary); }
.notif-mute.muted { opacity: .55; }

/* The panel sits above the sticky topbar (z-index 20) but below modals (90). */
.notif-panel {
  position: absolute; top: calc(100% + .5rem); right: 0; z-index: 40;
  width: min(360px, calc(100vw - 2rem));
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden;
}
.notif-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  padding: .8rem 1rem; border-bottom: 1px solid var(--border);
  font-size: .92rem;
}
.notif-panel-actions { display: flex; align-items: center; gap: .5rem; }
.notif-panel-actions .link-btn { font-size: .78rem; }

.notif-list { max-height: min(420px, 60vh); overflow-y: auto; }
.notif-empty { padding: 1.6rem 1rem; text-align: center; color: var(--text-secondary); font-size: .84rem; line-height: 1.5; }

/* Rows follow the conversation-list pattern: full-width borderless buttons. */
.notif-item {
  display: flex; gap: .7rem; width: 100%; text-align: left;
  padding: .7rem 1rem; background: none; border: none;
  border-bottom: 1px solid var(--border); cursor: pointer; font: inherit;
  transition: background .12s ease;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface-secondary); }
/* Unread rows get a tinted ground and a red rail down the left edge. */
.notif-item.unread { background: var(--primary-light); box-shadow: inset 3px 0 0 var(--primary); }
.notif-item.unread:hover { background: var(--primary-light); filter: brightness(.98); }
.notif-item-icon { font-size: 1rem; line-height: 1.3; flex-shrink: 0; }
.notif-item-text { display: flex; flex-direction: column; gap: .12rem; min-width: 0; }
.notif-item-title { font-size: .86rem; font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.notif-item.unread .notif-item-title { font-weight: 700; }
.notif-item-body { font-size: .8rem; color: var(--text-secondary); overflow-wrap: anywhere; }
.notif-item-time { font-size: .72rem; color: var(--text-secondary); opacity: .85; }

@media (max-width: 600px) {
  .notif-panel { position: fixed; top: 62px; right: .75rem; left: .75rem; width: auto; }
}
