/* ─── Layout ──────────────────────────────────────── */
:root {
  --sf-purple: #534AB7;
  --sf-purple-light: #EEEDFE;
  --sf-purple-mid: #AFA9EC;
  --sf-sidebar-width: 210px;
  --sf-topbar-height: 52px;
  --sf-green: #0F6E56;
  --sf-green-light: #E1F5EE;
  --sf-red: #A32D2D;
  --sf-red-light: #FCEBEB;
  --sf-amber: #854F0B;
  --sf-amber-light: #FAEEDA;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont,
    'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  background: #f4f3f8;
  color: #1a1a2e;
}

/* ─── Main layout shell ───────────────────────────── */
.sf-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ─────────────────────────────────────── */
.sf-sidebar {
  width: var(--sf-sidebar-width);
  background: #fff;
  border-right: 1px solid #e8e7f0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.2s ease;
}

/* Logo */
.sf-logo {
  padding: 16px;
  border-bottom: 1px solid #e8e7f0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.sf-logo-mark {
  width: 30px;
  height: 30px;
  background: var(--sf-purple);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  flex-shrink: 0;
}
.sf-logo-text {
  font-size: 15px;
  font-weight: 500;
  color: #1a1a2e;
}

/* Back link */
.sf-nav-back {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 12px;
  color: #666;
  cursor: pointer;
  border-bottom: 1px solid #e8e7f0;
  text-decoration: none;
  flex-shrink: 0;
}
.sf-nav-back:hover { background: #f4f3f8; color: #1a1a2e; }

/* Nav */
.sf-nav {
  padding: 8px;
  flex: 1;
  overflow-y: auto;
}
.sf-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: #555;
  text-decoration: none;
  margin-bottom: 2px;
  transition: background 0.15s;
}
.sf-nav-item:hover { background: #f4f3f8; color: #1a1a2e; }
.sf-nav-item.active {
  background: var(--sf-purple-light);
  color: var(--sf-purple);
  font-weight: 500;
}
.sf-nav-item i { font-size: 17px; flex-shrink: 0; }
.sf-nav-label {
  font-size: 10px;
  color: #999;
  padding: 8px 10px 3px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Shop switcher */
.sf-shop-switcher {
  padding: 10px;
  border-top: 1px solid #e8e7f0;
  flex-shrink: 0;
}
.sf-shop-switcher-label {
  font-size: 10px;
  color: #999;
  margin-bottom: 5px;
}
.sf-shop-select {
  width: 100%;
  padding: 6px 8px;
  font-size: 12px;
  border-radius: 8px;
  border: 1px solid #e8e7f0;
  background: #f4f3f8;
  color: #1a1a2e;
  cursor: pointer;
}
.sf-shop-select:focus {
  outline: none;
  border-color: var(--sf-purple-mid);
}

/* ─── Main area ───────────────────────────────────── */
.sf-main-area {
  margin-left: var(--sf-sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* ─── Topbar ──────────────────────────────────────── */
.sf-topbar {
  height: var(--sf-topbar-height);
  background: #fff;
  border-bottom: 1px solid #e8e7f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}
.sf-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sf-topbar-title {
  font-size: 14px;
  font-weight: 500;
  color: #1a1a2e;
}
.sf-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sf-menu-toggle {
  background: none;
  border: 1px solid #e8e7f0;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  color: #555;
}

/* ─── Notifications ───────────────────────────────── */
.sf-notif-btn {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #e8e7f0;
  background: #f4f3f8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 17px;
  color: #555;
}
.sf-notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #D85A30;
  color: #fff;
  font-size: 9px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
}
.sf-notif-dropdown {
  width: 300px;
  padding: 0;
  border: 1px solid #e8e7f0;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.sf-notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  border-bottom: 1px solid #e8e7f0;
}
.sf-notif-clear {
  font-size: 11px;
  color: var(--sf-purple);
  background: none;
  border: none;
  cursor: pointer;
}
.sf-notif-empty {
  padding: 16px;
  font-size: 12px;
  color: #999;
  text-align: center;
}
.sf-notif-item {
  padding: 10px 14px;
  border-bottom: 1px solid #f0eff5;
  font-size: 12px;
}
.sf-notif-item:last-child { border-bottom: none; }
.sf-notif-item.success { border-left: 3px solid #0F6E56; }
.sf-notif-item.error { border-left: 3px solid #A32D2D; }
.sf-notif-item.info { border-left: 3px solid var(--sf-purple); }
.sf-notif-item.warning { border-left: 3px solid #854F0B; }
.sf-notif-msg { color: #1a1a2e; }
.sf-notif-time { color: #999; font-size: 11px; margin-top: 2px; }

/* ─── Avatar ──────────────────────────────────────── */
.sf-avatar-btn {
  background: none;
  border: none;
  padding: 0;
}
.sf-avatar-btn::after { display: none; }
.sf-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--sf-purple-light);
  color: var(--sf-purple);
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ─── Page content ────────────────────────────────── */
.sf-content {
  padding: 20px;
  flex: 1;
}

/* ─── Auth layout ─────────────────────────────────── */
.sf-auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f4f3f8;
}
.sf-auth-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e8e7f0;
  padding: 32px;
  width: 100%;
  max-width: 400px;
}
.sf-auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
}
.sf-auth-title {
  font-size: 20px;
  font-weight: 500;
  color: #1a1a2e;
  margin-bottom: 6px;
}
.sf-auth-subtitle {
  font-size: 13px;
  color: #666;
  margin-bottom: 24px;
}

/* ─── Stat cards ──────────────────────────────────── */
.sf-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.sf-stat {
  background: #fff;
  border: 1px solid #e8e7f0;
  border-radius: 10px;
  padding: 14px;
}
.sf-stat-label {
  font-size: 11px;
  color: #888;
  margin-bottom: 5px;
}
.sf-stat-val {
  font-size: 20px;
  font-weight: 500;
  color: #1a1a2e;
}
.sf-stat-sub {
  font-size: 11px;
  color: #aaa;
  margin-top: 3px;
}
.sf-stat-up { color: var(--sf-green); }
.sf-stat-down { color: var(--sf-red); }

/* ─── Cards ───────────────────────────────────────── */
.sf-card {
  background: #fff;
  border: 1px solid #e8e7f0;
  border-radius: 12px;
  padding: 16px;
}
.sf-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.sf-card-title {
  font-size: 13px;
  font-weight: 500;
  color: #1a1a2e;
}
.sf-card-link {
  font-size: 12px;
  color: var(--sf-purple);
  text-decoration: none;
}
.sf-card-link:hover { text-decoration: underline; }

/* ─── Quick actions ───────────────────────────────── */
.sf-quick-action {
  background: #fff;
  border: 1px solid #e8e7f0;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-decoration: none;
  color: #1a1a2e;
  transition: background 0.15s, border-color 0.15s;
}
.sf-quick-action:hover {
  background: var(--sf-purple-light);
  border-color: var(--sf-purple-mid);
  color: var(--sf-purple);
}
.sf-quick-action i {
  font-size: 20px;
  color: var(--sf-purple);
}
.sf-quick-action-label { font-size: 12px; font-weight: 500; }

/* ─── Revenue period tabs ─────────────────────────── */
.sf-period-tabs { display: flex; gap: 4px; }
.sf-tab {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #e8e7f0;
  cursor: pointer;
  color: #666;
  background: transparent;
  transition: all 0.15s;
}
.sf-tab:hover { border-color: var(--sf-purple-mid); color: var(--sf-purple); }
.sf-tab.active {
  background: var(--sf-purple-light);
  color: var(--sf-purple);
  border-color: var(--sf-purple-mid);
  font-weight: 500;
}

/* ─── Status pills ────────────────────────────────── */
.sf-pill {
  font-size: 10px;
  padding: 3px 9px;
  border-radius: 20px;
  font-weight: 500;
  white-space: nowrap;
}
.sf-pill-dispatched { background: var(--sf-green-light); color: var(--sf-green); }
.sf-pill-pending { background: var(--sf-amber-light); color: var(--sf-amber); }
.sf-pill-received { background: var(--sf-purple-light); color: var(--sf-purple); }
.sf-pill-overdue { background: var(--sf-red-light); color: var(--sf-red); }
.sf-pill-collected { background: #e8e7f0; color: #555; }
.sf-pill-paid { background: var(--sf-green-light); color: var(--sf-green); }
.sf-pill-unpaid { background: var(--sf-red-light); color: var(--sf-red); }

/* ─── Dispatch list items ─────────────────────────── */
.sf-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: #f9f8fc;
  border-radius: 8px;
  margin-bottom: 6px;
}
.sf-list-item:last-child { margin-bottom: 0; }
.sf-list-ref {
  font-size: 12px;
  font-weight: 500;
  color: #1a1a2e;
}
.sf-list-meta {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
}

/* ─── Transaction items ───────────────────────────── */
.sf-txn-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #f0eff5;
}
.sf-txn-item:last-child { border-bottom: none; }
.sf-txn-desc { font-size: 12px; color: #1a1a2e; }
.sf-txn-meta { font-size: 11px; color: #888; margin-top: 2px; }
.sf-txn-credit { font-size: 12px; font-weight: 500; color: var(--sf-green); }
.sf-txn-debit { font-size: 12px; font-weight: 500; color: var(--sf-red); }

/* ─── Social dots ─────────────────────────────────── */
.sf-social-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-right: 8px;
}
.sf-ig-dot { background: #D85A30; }
.sf-tt-dot { background: #2C2C2A; }

/* ─── Stock items ─────────────────────────────────── */
.sf-stock-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-radius: 7px;
  margin-bottom: 5px;
  font-size: 12px;
}
.sf-stock-ok { background: #f9f8fc; color: #1a1a2e; }
.sf-stock-low { background: var(--sf-red-light); color: var(--sf-red); }

/* ─── Shop cards (overview) ───────────────────────── */
.sf-shop-card {
  background: #fff;
  border: 1px solid #e8e7f0;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.15s;
}
.sf-shop-card:hover { border-color: var(--sf-purple-mid); }
.sf-shop-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0eff5;
}
.sf-shop-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--sf-purple-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--sf-purple);
  flex-shrink: 0;
}
.sf-shop-name {
  font-size: 13px;
  font-weight: 500;
  color: #1a1a2e;
}
.sf-shop-acc { font-size: 11px; color: #999; margin-top: 2px; }
.sf-shop-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.sf-shop-stat {
  background: #f9f8fc;
  border-radius: 8px;
  padding: 8px 10px;
}
.sf-shop-stat-label { font-size: 10px; color: #888; margin-bottom: 2px; }
.sf-shop-stat-val { font-size: 13px; font-weight: 500; color: #1a1a2e; }
.sf-warn-stat {
  background: var(--sf-amber-light);
  border-radius: 8px;
  padding: 8px 10px;
}
.sf-warn-label { font-size: 10px; color: var(--sf-amber); margin-bottom: 2px; }
.sf-warn-val { font-size: 13px; font-weight: 500; color: #633806; }

/* ─── Buttons ─────────────────────────────────────── */
.sf-btn {
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: opacity 0.15s;
}
.sf-btn:hover { opacity: 0.88; }
.sf-btn-primary { background: var(--sf-purple); color: #fff; }
.sf-btn-outline {
  background: transparent;
  color: #1a1a2e;
  border: 1px solid #e8e7f0;
}
.sf-btn-outline:hover { background: #f4f3f8; }
.sf-btn-danger { background: var(--sf-red-light); color: var(--sf-red); }
.sf-btn-sm { padding: 5px 12px; font-size: 12px; }

/* ─── Forms ───────────────────────────────────────── */
.sf-form-label {
  font-size: 12px;
  font-weight: 500;
  color: #444;
  margin-bottom: 5px;
  display: block;
}
.sf-form-control {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid #e8e7f0;
  border-radius: 8px;
  background: #fff;
  color: #1a1a2e;
  transition: border-color 0.15s;
}
.sf-form-control:focus {
  outline: none;
  border-color: var(--sf-purple-mid);
  box-shadow: 0 0 0 3px rgba(83,74,183,0.08);
}
.sf-form-hint {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
}
.sf-form-error {
  font-size: 11px;
  color: var(--sf-red);
  margin-top: 4px;
}

/* ─── Page header ─────────────────────────────────── */
.sf-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.sf-page-title {
  font-size: 18px;
  font-weight: 500;
  color: #1a1a2e;
}
.sf-page-subtitle {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}

/* ─── Toast messages ──────────────────────────────── */
.sf-messages {
  padding: 10px 20px 0;
}
.sf-toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 8px;
  position: relative;
}
.sf-toast-success { background: var(--sf-green-light); color: #085041; }
.sf-toast-error { background: var(--sf-red-light); color: #501313; }
.sf-toast-info { background: var(--sf-purple-light); color: #26215C; }
.sf-toast-warning { background: var(--sf-amber-light); color: #412402; }
.sf-toast-close {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  margin-left: auto;
  color: inherit;
  opacity: 0.6;
}
.sf-toast-close:hover { opacity: 1; }

/* ─── Empty state ─────────────────────────────────── */
.sf-empty {
  text-align: center;
  padding: 40px 20px;
  color: #888;
}
.sf-empty i { font-size: 40px; color: #ccc; margin-bottom: 10px; display: block; }
.sf-empty-title { font-size: 14px; font-weight: 500; color: #555; margin-bottom: 6px; }
.sf-empty-text { font-size: 12px; }

/* ─── Tables ──────────────────────────────────────── */
.sf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.sf-table th {
  font-size: 11px;
  font-weight: 500;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 12px;
  border-bottom: 1px solid #e8e7f0;
  text-align: left;
}
.sf-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f0eff5;
  color: #1a1a2e;
  vertical-align: middle;
}
.sf-table tr:last-child td { border-bottom: none; }
.sf-table tr:hover td { background: #f9f8fc; }

/* ─── Responsive ──────────────────────────────────── */
@media (max-width: 991px) {
  .sf-sidebar {
    transform: translateX(-100%);
  }
  .sf-sidebar.open {
    transform: translateX(0);
  }
  .sf-main-area {
    margin-left: 0;
  }
  .sf-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 576px) {
  .sf-stat-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .sf-content { padding: 14px; }
}