@import url('https://fonts.googleapis.com/css2?family=Syne:wght@600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

/* ============================================================
   ssp-styles.css — MySusun v2.1
   Light content area + Dark sidebar
   ============================================================ */
:root {
  --sidebar-w:  260px;
  --sidebar-cw: 64px;
  --topbar-h:   60px;
  --radius:     10px;
  --radius-sm:  6px;
  --radius-lg:  16px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.14);

  /* Sidebar — dark ink */
  --sb-bg:      #0e0e10;
  --sb-surface: #1c1c20;
  --sb-border:  #2a2a30;
  --sb-edge:    #3a3a42;
  --sb-text-1:  #e6ecf5;
  --sb-text-2:  #8a8a9a;
  --sb-text-3:  #42424e;

  /* Content — warm paper */
  --bg:         #f5f4f0;
  --surface:    #ffffff;
  --surface-2:  #eeecea;
  --border:     #e4e2de;
  --border-2:   #d4d2ce;
  --text-1:     #0e0e10;
  --text-2:     #4a4a58;
  --text-3:     #71717a;

  /* Accent — press orange */
  --accent:      #e8441a;
  --accent-dark: #c43714;
  --accent-dim:  rgba(232,68,26,0.10);
  --accent-glow: rgba(232,68,26,0.20);

  /* Secondary */
  --cyan:     #1ab8e8;
  --cyan-dim: rgba(26,184,232,0.12);

  /* Status */
  --success: #16a34a;
  --danger:  #dc2626;
  --warning: #d97706;
  --info:    #0284c7;

  /* Tier */
  --tier-basic:    #7a7a8a;
  --tier-pro:      #818cf8;
  --tier-business: #1ab8e8;

  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text-1); min-height: 100vh; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3,h4 { font-family: var(--font-display); line-height: 1.2; color: var(--text-1); }

/* ── App Layout ── */
.app { display: flex; min-height: 100vh; }
.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; background: var(--bg); transition: margin-left 0.28s cubic-bezier(.4,0,.2,1); }
.content { flex: 1; padding: 24px 28px; overflow-x: hidden; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w); background: var(--sb-bg);
  border-right: 1px solid var(--sb-border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 1000; font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition: transform 0.28s cubic-bezier(.4,0,.2,1);
}
.sidebar-brand, .sidebar-logo { padding: 22px 20px 18px; border-bottom: 1px solid var(--sb-border); flex-shrink: 0; display: flex; align-items: center; gap: 10px; }
.brand-logo { font-family: var(--font-display); font-size: 1.05rem; font-weight: 800; color: var(--sb-text-1); display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-logo:hover { text-decoration: none; }
.logo-mark { width: 32px; height: 32px; background: var(--accent); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 800; font-size: 13px; color: #fff; flex-shrink: 0; }
.brand-dot { width: 10px; height: 10px; background: var(--accent); border-radius: 50%; flex-shrink: 0; }
.logo-text { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--sb-text-1); }
.logo-text span { color: var(--accent); }
.brand-sub { font-size: 0.68rem; color: var(--sb-text-3); margin-top: 3px; text-transform: uppercase; letter-spacing: 0.06em; }
.sidebar-nav { flex: 1; padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.sidebar-section { padding: 16px 0 4px; }
.nav-label, .sidebar-label { font-size: 0.67rem; font-weight: 700; color: var(--sb-text-3); text-transform: uppercase; letter-spacing: 0.09em; padding: 8px 8px 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 10px; border-radius: var(--radius-sm); color: var(--sb-text-2); font-size: 0.88rem; font-weight: 500; cursor: pointer; transition: background 0.14s, color 0.14s; text-decoration: none; border: none; background: none; width: 100%; text-align: left; font-family: var(--font-body); }
.nav-item:hover { background: var(--sb-surface); color: var(--sb-text-1); text-decoration: none; }
.nav-item.active { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(232,68,26,0.18); }
.nav-item .nav-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.6; }
.nav-item:hover svg, .nav-item.active svg { opacity: 1; }
.nav-lock { margin-left: auto; font-size: 0.70rem; opacity: 0.45; }
.nav-badge { margin-left: auto; background: var(--accent); color: #fff; font-size: 0.62rem; font-weight: 700; padding: 2px 6px; border-radius: 20px; }

/* ── Nav Sub-menu (collapsible groups) ── */
.nav-group { margin-bottom: 2px; }
.nav-parent { position: relative; }
.nav-parent .nav-chevron { margin-left: auto; opacity: 0.4; transition: transform 0.2s; flex-shrink: 0; }
.nav-group.open > .nav-parent .nav-chevron { transform: rotate(180deg); }
.nav-children { max-height: 0; overflow: hidden; transition: max-height 0.25s ease; }
.nav-group.open > .nav-children { max-height: 500px; }
/* Hide admin-only until role confirmed, then show all at once */
.nav-admin-only { display: none; }
.sidebar.role-ready .nav-admin-only { display: block; }
.nav-child { padding: 10px 10px 10px 36px; font-size: 0.84rem; }
.sidebar.collapsed .nav-child { padding: 10px 0; justify-content: center; }

/* Collapsed sidebar — hide sub-menu text, show icon only */
.sidebar.collapsed .nav-children { max-height: 0 !important; }
.sidebar.collapsed .nav-parent .nav-chevron { display: none; }

/* Collapsed sidebar — hover expand submenu as flyout */
.sidebar.collapsed .nav-group { position: relative; }
.sidebar.collapsed .sidebar-nav { overflow: visible; }
.sidebar.collapsed .nav-group:hover > .nav-children,
.sidebar.collapsed .nav-group:focus-within > .nav-children {
  max-height: none !important;
  overflow: visible !important;
  position: absolute;
  left: 100%;
  top: 0;
  background: var(--sb-bg);
  border: 1px solid var(--sb-border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  box-shadow: 4px 4px 16px rgba(0,0,0,0.3);
  min-width: 180px;
  padding: 6px 0;
  z-index: 1002;
}
.sidebar.collapsed .nav-group:hover > .nav-children .nav-child {
  padding: 10px 14px;
  justify-content: flex-start;
  gap: 10px;
}
.sidebar.collapsed .nav-group:hover > .nav-children .nav-text { display: inline; }
.sidebar.collapsed .nav-group:hover > .nav-children .nav-icon { display: inline-flex; }
.sb-divider { height: 1px; background: var(--sb-border); margin: 6px 12px; }
.sidebar-footer, .sidebar-user { padding: 14px 16px; border-top: 1px solid var(--sb-border); flex-shrink: 0; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius-sm); cursor: pointer; transition: background 0.15s; text-decoration: none; }
.user-card:hover { background: var(--sb-surface); text-decoration: none; }
.user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--cyan)); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 700; font-size: 13px; color: #fff; flex-shrink: 0; }
.user-name { font-size: 0.88rem; font-weight: 500; color: var(--sb-text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role, .user-plan { font-size: 0.70rem; color: var(--sb-text-3); }
.ssp-logout-btn { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; background: transparent; border: none; border-radius: var(--radius-sm); color: var(--sb-text-2); font-family: var(--font-body); font-size: 0.85rem; font-weight: 500; cursor: pointer; text-align: left; transition: background 0.14s, color 0.14s; }
.ssp-logout-btn:hover { background: var(--sb-surface); color: var(--sb-text-1); }
#sb-expired-notice { background: rgba(220,38,38,0.08); border: 1px solid rgba(220,38,38,0.20); border-radius: var(--radius-sm); padding: 9px 12px; margin: 8px 0; font-size: 0.78rem; color: var(--danger); line-height: 1.5; }

/* ── Sidebar Collapsed State ── */
.sidebar { transition: width 0.28s cubic-bezier(.4,0,.2,1); }
.sidebar.collapsed { width: var(--sidebar-cw); overflow: visible; }
.sidebar.collapsed .logo-text { display: none; }
.sidebar.collapsed .sidebar-logo { justify-content: center; padding: 18px 0; }
.sidebar.collapsed .sidebar-nav { padding: 14px 8px; }
.sidebar.collapsed .sidebar-label { display: none; }
.sidebar.collapsed .sidebar-section { padding: 8px 0 0; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px 0; gap: 0; position: relative; }
.sidebar.collapsed .nav-text { display: none; }
.sidebar.collapsed .nav-lock { display: none; }
.sidebar.collapsed .nav-item .nav-icon { width: auto; }
.sidebar.collapsed .nav-item svg { width: 20px; height: 20px; }
.sidebar.collapsed .sidebar-footer { padding: 10px 8px; }
.sidebar.collapsed + .main,
body.sb-collapsed .main { margin-left: var(--sidebar-cw); }

/* Tooltip on hover — collapsed only */
.sidebar.collapsed .nav-item:hover::after {
  content: attr(title);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--sb-bg);
  color: var(--sb-text-1);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  white-space: nowrap;
  z-index: 1001;
  border: 1px solid var(--sb-border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  pointer-events: none;
}

/* ── Sidebar Toggle Button (header) ── */
#ssp-sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
#ssp-sidebar-toggle:hover { background: var(--surface-2); color: var(--text-1); }

/* ── Header Search Bar ── */
.hdr-search { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 12px; height: 36px; min-width: 180px; max-width: 280px; transition: border-color 0.15s, box-shadow 0.15s; }
.hdr-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim); }
.hdr-search svg { color: var(--text-3); flex-shrink: 0; }
.hdr-search input { border: none; background: none; outline: none; font-family: var(--font-body); font-size: 0.84rem; color: var(--text-1); width: 100%; }
.hdr-search input::placeholder { color: var(--text-3); }

/* ── Header Notification Icon ── */
.hdr-icon-btn { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-2); cursor: pointer; transition: all 0.15s; position: relative; flex-shrink: 0; }
.hdr-icon-btn:hover { background: var(--surface-2); color: var(--text-1); }
.hdr-notif-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; border: 2px solid var(--surface); }

/* ── Header Profile Dropdown ── */
.hdr-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; position: relative; }
.hdr-profile { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: var(--radius-sm); cursor: pointer; transition: background 0.15s; user-select: none; }
.hdr-profile:hover { background: var(--surface-2); }
.hdr-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--cyan)); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 700; font-size: 13px; color: #fff; flex-shrink: 0; }
.hdr-user-name { font-size: 0.84rem; font-weight: 500; color: var(--text-1); white-space: nowrap; }
.hdr-chevron { color: var(--text-3); transition: transform 0.2s; }
.hdr-profile:hover .hdr-chevron { color: var(--text-2); }

.hdr-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 200px;
  padding: 6px;
  z-index: 200;
  animation: hdr-dd-in 0.15s ease;
}
.hdr-dropdown.show { display: block; }
@keyframes hdr-dd-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

.hdr-dd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 0.84rem;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.hdr-dd-item:hover { background: var(--surface-2); color: var(--text-1); text-decoration: none; }
.hdr-dd-item svg { opacity: 0.5; flex-shrink: 0; }
.hdr-dd-item:hover svg { opacity: 0.8; }
.hdr-dd-divider { height: 1px; background: var(--border); margin: 4px 0; }
.hdr-dd-logout { color: var(--danger); }
.hdr-dd-logout:hover { background: rgba(220,38,38,0.06); color: var(--danger); }
.hdr-dd-logout svg { opacity: 0.7; }

/* ============================================================
   TOPBAR / HEADER
   ============================================================ */
#ssp-header, .topbar {
  background: rgba(245,244,240,0.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border); padding: 0 18px; height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; position: sticky; top: 0; z-index: 100; flex-shrink: 0;
}
.topbar-title h2, #hdr-title { font-family: var(--font-display); font-size: 1rem; font-weight: 700; color: var(--text-1); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title p, #hdr-sub { font-size: 0.76rem; color: var(--text-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title-txt { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--text-1); flex: 1; }
.topbar-subtitle { font-size: 13px; color: var(--text-2); font-weight: 400; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.btn-icon { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; background: transparent; color: var(--text-2); border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer; transition: all 0.15s; }
.btn-icon:hover { background: var(--surface-2); border-color: var(--border); }
.notif-dot { width: 7px; height: 7px; background: var(--accent); border-radius: 50%; position: absolute; top: 6px; right: 6px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; border-radius: var(--radius-sm); font-family: var(--font-body); font-size: 0.85rem; font-weight: 600; cursor: pointer; border: none; transition: all 0.15s; text-decoration: none; white-space: nowrap; line-height: 1; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(232,68,26,0.35); }
.btn-secondary { background: var(--surface); color: var(--text-2); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-2); color: var(--text-1); border-color: var(--border-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text-1); }
.btn-danger { background: rgba(220,38,38,0.08); color: var(--danger); border: 1px solid rgba(220,38,38,0.18); }
.btn-danger:hover { background: rgba(220,38,38,0.15); }
.btn-success { background: rgba(22,163,74,0.08); color: var(--success); border: 1px solid rgba(22,163,74,0.18); }
.btn-sm { padding: 5px 12px; font-size: 0.80rem; }
.btn-lg { padding: 11px 22px; font-size: 0.92rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled, .btn[disabled] { opacity: 0.4; cursor: not-allowed; pointer-events: none; transform: none !important; box-shadow: none !important; }

/* ============================================================
   BADGES
   ============================================================ */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 100px; font-size: 0.70rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.badge-trial, .badge-basic { background: rgba(122,122,138,0.12); color: var(--tier-basic); }
.badge-pro      { background: rgba(129,140,248,0.12); color: var(--tier-pro); }
.badge-business { background: rgba(26,184,232,0.12);  color: var(--tier-business); }
.badge-success  { background: rgba(22,163,74,0.10);   color: var(--success); }
.badge-danger   { background: rgba(220,38,38,0.10);   color: var(--danger); }
.badge-warning, .badge-pending { background: rgba(217,119,6,0.10); color: var(--warning); }
.badge-info     { background: rgba(2,132,199,0.10);   color: var(--info); }
.badge-accent, .badge-press { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-glow); }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 0.82rem; font-weight: 600; color: var(--text-1); }
.form-hint  { font-size: 0.75rem; color: var(--text-3); }
input:not([type=radio]):not([type=checkbox]), select, textarea, .form-input, .setting-input { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-1); font-family: var(--font-body); font-size: 0.88rem; padding: 8px 12px; width: 100%; outline: none; transition: border-color 0.15s, box-shadow 0.15s; line-height: 1.5; }
input:not([type=radio]):not([type=checkbox]):focus, select:focus, textarea:focus, .form-input:focus, .setting-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(232,68,26,0.10); }
input:not([type=radio]):not([type=checkbox])::placeholder { color: var(--text-3); }
select { cursor: pointer; }
textarea { resize: vertical; min-height: 80px; }
.input-unit { display: flex; align-items: stretch; }
.input-unit input, .input-unit .form-input, .input-unit .setting-input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); flex: 1; }
.unit-label { background: var(--surface-2); border: 1px solid var(--border); border-left: none; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 0 12px; font-size: 0.80rem; color: var(--text-3); display: flex; align-items: center; white-space: nowrap; }
.toggle { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider { position: absolute; inset: 0; background: var(--border-2); border-radius: 22px; cursor: pointer; transition: background 0.2s; }
.toggle-slider::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform 0.2s; }
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 4px 0; gap: 16px; }
.toggle-info { flex: 1; }
.err-box { background: rgba(220,38,38,0.07); border: 1px solid rgba(220,38,38,0.20); border-radius: var(--radius-sm); padding: 9px 13px; font-size: 0.83rem; color: var(--danger); display: none; }
.err-box.show { display: block; }

/* ============================================================
   CARDS & PANELS
   ============================================================ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.card-header { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-title { font-family: var(--font-display); font-size: 0.90rem; font-weight: 700; color: var(--text-1); }
.card-body { padding: 20px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.panel-header { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-title { font-family: var(--font-display); font-size: 14px; font-weight: 700; color: var(--text-1); }
.panel-body { padding: 18px 20px; }
.info-row { display: flex; gap: 8px; margin-bottom: 8px; font-size: 0.85rem; }
.info-label { font-size: 0.78rem; color: var(--text-3); width: 80px; flex-shrink: 0; padding-top: 1px; }
.info-val { color: var(--text-1); }
.tip-box { background: rgba(232,68,26,0.06); border: 1px solid rgba(232,68,26,0.16); border-radius: var(--radius-sm); padding: 12px 16px; font-size: 0.83rem; color: var(--text-2); display: flex; gap: 10px; align-items: flex-start; margin-bottom: 20px; }
.tip-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.section-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.section-header h3 { font-size: 1rem; font-weight: 700; }
.section-header p  { font-size: 0.80rem; color: var(--text-3); }
.divider { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* ============================================================
   STATS
   ============================================================ */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 28px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 28px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; position: relative; overflow: hidden; transition: box-shadow 0.2s; }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--accent); opacity: 0; transition: opacity 0.2s; }
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-card:hover::before { opacity: 1; }
.stat-label { font-size: 0.70rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); margin-bottom: 8px; }
.stat-value, .stat-val { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; color: var(--text-1); }
.stat-sub { font-size: 0.78rem; color: var(--text-3); margin-top: 4px; }
.stat-change { font-size: 12px; color: var(--success); font-weight: 500; margin-top: 4px; }
.stat-change.down { color: var(--danger); }

/* ============================================================
   CONTENT GRID & TOOL CARDS
   ============================================================ */
.content-grid { display: grid; grid-template-columns: 1fr 360px; gap: 20px; }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.tools-grid-sm { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tool-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s; position: relative; display: flex; flex-direction: column; }
.tool-card:not(.locked):hover { border-color: var(--accent-glow); transform: translateY(-2px); box-shadow: var(--shadow-md); }
a.tool-card, .tool-card-link { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; cursor: pointer; transition: all 0.2s ease; text-decoration: none; display: block; background: var(--surface-2); position: relative; overflow: hidden; }
a.tool-card:hover, .tool-card-link:hover { border-color: var(--accent-glow); transform: translateY(-2px); box-shadow: var(--shadow-md); text-decoration: none; }
.tool-icon-wrap { padding: 24px 20px 16px; display: flex; align-items: center; gap: 14px; }
a.tool-card .tool-icon-wrap, .tool-card-link .tool-icon-wrap { width: 38px; height: 38px; background: var(--sb-bg); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; margin-bottom: 10px; position: relative; z-index: 1; padding: 0; }
.tool-icon { width: 48px; height: 48px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }
.tool-icon.amber  { background: rgba(232,68,26,0.10); border: 1px solid rgba(232,68,26,0.20); }
.tool-icon.purple { background: rgba(129,140,248,0.10); border: 1px solid rgba(129,140,248,0.20); }
.tool-icon.blue   { background: rgba(26,184,232,0.10); border: 1px solid rgba(26,184,232,0.20); }
.tool-icon.green  { background: rgba(22,163,74,0.10);  border: 1px solid rgba(22,163,74,0.20); }
.tool-name { font-family: var(--font-display); font-size: 0.95rem; font-weight: 700; color: var(--text-1); margin-bottom: 3px; position: relative; z-index: 1; }
.tool-tier-badge { margin-top: 4px; }
.tool-body { padding: 0 20px 20px; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.tool-desc { font-size: 0.85rem; color: var(--text-2); line-height: 1.55; position: relative; z-index: 1; }
.tool-open-btn { margin-top: auto; }
.lock-overlay { position: absolute; inset: 0; background: rgba(238,236,234,0.88); backdrop-filter: blur(2px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; z-index: 10; }
.lock-icon { width: 44px; height: 44px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.lock-text { text-align: center; }
.lock-text strong { display: block; font-size: 0.88rem; color: var(--text-1); margin-bottom: 3px; }
.lock-text span   { font-size: 0.78rem; color: var(--text-2); }
.tool-card.locked .tool-icon-wrap, .tool-card.locked .tool-body { filter: blur(2px); user-select: none; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; overflow-x: auto; }
table, .user-table, .log-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th { background: var(--surface-2); padding: 11px 14px; text-align: left; font-size: 0.70rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text-2); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-ava { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-dim); border: 1px solid var(--accent-glow); display: flex; align-items: center; justify-content: center; font-size: 0.80rem; font-weight: 700; color: var(--accent); flex-shrink: 0; }
.user-ava-name  { font-weight: 600; font-size: 0.88rem; color: var(--text-1); }
.user-ava-email { font-size: 0.78rem; color: var(--text-3); }
.days-left.ok   { color: var(--success); }
.days-left.warn { color: var(--warning); }
.days-left.bad  { color: var(--danger); }
.days-left.none { color: var(--text-3); }

/* ============================================================
   ACTIVITY LOG
   ============================================================ */
.action-badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 100px; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.action-login   { background: rgba(22,163,74,0.10);   color: var(--success); }
.action-logout  { background: rgba(152,152,166,0.12); color: var(--text-3); }
.action-tool    { background: var(--accent-dim);       color: var(--accent); }
.action-save    { background: rgba(2,132,199,0.10);   color: var(--info); }
.action-default { background: rgba(152,152,166,0.12); color: var(--text-3); }
.filter-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filter-btn { padding: 5px 14px; border: 1px solid var(--border); border-radius: 100px; background: var(--surface); color: var(--text-2); font-family: var(--font-body); font-size: 0.80rem; font-weight: 500; cursor: pointer; transition: all 0.15s; }
.filter-btn:hover, .filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ============================================================
   BILLING / PLAN / ACTIVITY / QUICK LINKS
   ============================================================ */
.billing-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.billing-card-header { padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; border-bottom: 1px solid var(--border); }
.billing-card-body { padding: 14px 18px; }
.order-number { font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; color: var(--text-1); }
.order-date   { font-size: 0.78rem; color: var(--text-3); margin-top: 2px; }
.order-total  { font-size: 1.05rem; font-weight: 700; color: var(--accent); }
.order-status { font-size: 0.68rem; font-weight: 700; padding: 3px 10px; border-radius: 100px; text-transform: uppercase; letter-spacing: 0.04em; }
.status-completed  { background: rgba(22,163,74,0.10);  color: var(--success); }
.status-processing { background: rgba(2,132,199,0.10);  color: var(--info); }
.status-pending    { background: rgba(217,119,6,0.10);  color: var(--warning); }
.order-items { font-size: 0.85rem; color: var(--text-2); }
.order-item-row { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--border); }
.order-item-row:last-child { border-bottom: none; }
.btn-invoice { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-2); font-family: var(--font-body); font-size: 0.80rem; font-weight: 500; text-decoration: none; transition: all 0.15s; cursor: pointer; }
.btn-invoice:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.plan-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 24px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.plan-name { font-family: var(--font-display); font-size: 1.3rem; font-weight: 800; color: var(--text-1); }
.plan-expiry { font-size: 0.82rem; color: var(--text-3); margin-top: 4px; }
.plan-banner { background: var(--sb-bg); border-radius: var(--radius); padding: 16px 18px; display: flex; align-items: center; gap: 14px; border: 1px solid var(--sb-border); }
.plan-banner-icon { width: 36px; height: 36px; background: var(--accent); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.plan-banner-text { flex: 1; }
.plan-banner-title { font-family: var(--font-display); font-size: 13px; font-weight: 700; color: #fff; margin-bottom: 2px; }
.plan-banner-sub   { font-size: 11px; color: var(--sb-text-3); }
.activity-list { display: flex; flex-direction: column; }
.activity-item { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 5px; flex-shrink: 0; }
.activity-dot.blue  { background: var(--cyan); }
.activity-dot.grey  { background: var(--text-3); }
.activity-dot.green { background: var(--success); }
.activity-text { font-size: 13px; color: var(--text-2); line-height: 1.4; }
.activity-text strong { color: var(--text-1); font-weight: 600; }
.activity-time { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.quick-link { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); color: var(--text-2); text-decoration: none; font-size: 13px; transition: all 0.15s; border: 1px solid transparent; }
.quick-link:hover { background: var(--surface-2); border-color: var(--border); color: var(--text-1); text-decoration: none; }
.quick-link-icon { width: 30px; height: 30px; background: var(--surface-2); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.quick-access { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 28px; }
.qa-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 100px; font-size: 0.82rem; color: var(--text-2); cursor: pointer; transition: all 0.15s; text-decoration: none; }
.qa-chip:hover { border-color: var(--accent-glow); color: var(--accent); text-decoration: none; }

/* ============================================================
   SLOTS / PAGINATION / MODAL / TOAST / LOADING
   ============================================================ */
.slot-bar-wrap { background: var(--surface-2); border-radius: 100px; height: 6px; overflow: hidden; margin-top: 8px; }
.slot-bar { height: 100%; background: var(--accent); border-radius: 100px; transition: width 0.4s ease; }
.slot-bar.full { background: var(--danger); }
.invite-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 24px; display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.invite-card .form-group { flex: 1; min-width: 200px; }
.slots-info { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.slots-num  { font-family: var(--font-display); font-size: 1.8rem; font-weight: 800; color: var(--text-1); }
.slots-label{ font-size: 0.80rem; color: var(--text-3); }
.pagination { display: flex; gap: 8px; align-items: center; margin-top: 16px; justify-content: center; }
.page-btn { padding: 6px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-2); cursor: pointer; font-size: 0.82rem; font-family: var(--font-body); transition: all 0.15s; }
.page-btn:hover  { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; pointer-events: none; }
.page-info { font-size: 0.82rem; color: var(--text-3); }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.40); z-index: 500; display: none; align-items: center; justify-content: center; padding: 16px; }
.modal-bg.show { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); width: 560px; max-width: 100%; max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: modalIn 0.18s ease; }
@keyframes modalIn { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-header h3 { font-family: var(--font-display); font-size: 0.95rem; font-weight: 700; }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.modal-close { background: none; border: none; color: var(--text-3); cursor: pointer; font-size: 1.2rem; line-height: 1; padding: 4px; transition: color 0.15s; }
.modal-close:hover { color: var(--text-1); }
#toast { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast-item, .toast { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 16px; font-size: 0.84rem; color: var(--text-1); box-shadow: var(--shadow-md); display: flex; align-items: center; gap: 8px; max-width: 300px; animation: toastIn 0.2s ease; }
.toast-item.success, .toast.success { border-left: 3px solid var(--success); }
.toast-item.error,   .toast.error   { border-left: 3px solid var(--danger); }
.toast-item.warn,    .toast.warn    { border-left: 3px solid var(--warning); }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
/* ── SSP Loading Screen ── */
#ssp-loading { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; z-index: 99999; gap: 10px; font-family: var(--font-body); font-size: 0.85rem; color: var(--text-3); }
#ssp-loading-spin { width: 18px; height: 18px; border: 2.5px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: sspSpin 0.7s linear infinite; flex-shrink: 0; }
@keyframes sspSpin { to { transform: rotate(360deg); } }

.loading-screen { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; z-index: 999; gap: 12px; font-size: 0.90rem; color: var(--text-3); }
.spinner { width: 20px; height: 20px; border: 2.5px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   EMPTY STATE / SETTINGS / UTILITIES
   ============================================================ */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty-state .icon, .empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state h3 { font-size: 1rem; color: var(--text-1); margin-bottom: 6px; }
.empty-state p  { font-size: 0.88rem; margin-bottom: 16px; }
.empty-staff { text-align: center; padding: 30px; color: var(--text-3); font-size: 0.85rem; }
.settings-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 20px; overflow: hidden; }
.settings-section-title { padding: 14px 20px; border-bottom: 1px solid var(--border); font-family: var(--font-display); font-size: 0.88rem; font-weight: 700; color: var(--text-1); display: flex; align-items: center; gap: 8px; }
.settings-body { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.setting-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.setting-field { display: flex; flex-direction: column; gap: 6px; }
.setting-label { font-size: 0.82rem; font-weight: 600; color: var(--text-1); }
.setting-desc  { font-size: 0.75rem; color: var(--text-3); margin-top: 2px; }
.margin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.save-bar { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; z-index: 10; }
.save-status { font-size: 0.82rem; color: var(--text-3); }
.save-status.saved  { color: var(--success); }
.save-status.saving { color: var(--accent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .row2 { grid-template-columns: 1fr; } }
.slot-info { font-size: 0.82rem; color: var(--text-3); margin-bottom: 14px; }
.slot-info strong { color: var(--text-1); }

/* Hamburger button — mobile only, diinject oleh sidebar-loader.js */
#ssp-hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
#ssp-hamburger-btn:hover { background: var(--surface-2); color: var(--text-1); }

/* ── Tool Page Layout ── */
/* Guna .main.tool-page untuk semua tool pages */
/* Berbeza dari .main biasa (dashboard) yang boleh scroll */
/* ── Tool Page Layout ──
   Desktop: semua fit dalam 100vh — header + tool + footer
   Mobile:  page scroll, tool expand penuh
─────────────────────────────────────────── */
.main.tool-page {
  height: 100vh;          /* exact — bukan min-height */
}
.main.tool-page #header-container { flex-shrink: 0; }
.main.tool-page .tool-area {
  flex: 1;
  min-height: 0;          /* kritikal — benarkan shrink bawah 100vh */
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.main.tool-page #footer-container { flex-shrink: 0; }

/* Mobile — page scroll */
@media (max-width: 768px) {
  .main.tool-page {
    height: auto;
    min-height: 100vh;
  }
  .main.tool-page .tool-area {
    overflow: visible;
    height: auto;
    flex: none;
  }
}

/* ── Tool Area — guna .main.tool-page .tool-area di atas ── */

/* ── Footer ── */
#ssp-footer { padding: 14px 28px; border-top: 1px solid var(--border); font-size: 0.75rem; color: var(--text-3); text-align: center; flex-shrink: 0; }

/* ── Role-based visibility ── */
body[data-role="user"] .admin-only { display: none !important; }
/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } .content-grid { grid-template-columns: 1fr; } }
@media (max-width: 768px) {
  .main { margin-left: 0 !important; overflow-x: hidden; }
  .content { padding: 16px; overflow-x: hidden; }
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; }
  .sidebar.collapsed { width: var(--sidebar-w) !important; }
  .sidebar.collapsed .nav-text,
  .sidebar.collapsed .sidebar-label,
  .sidebar.collapsed .logo-text { display: initial; }
  .sidebar.collapsed .nav-item { justify-content: initial; padding: 5px 10px; gap: 10px; }
  .sidebar.collapsed .sidebar-nav { padding: 14px 12px; }
  .sidebar.collapsed .sidebar-logo { justify-content: initial; padding: 22px 20px 18px; }
  .sidebar.collapsed .sidebar-section { padding: 16px 0 4px; }
  .sidebar.collapsed .nav-item svg { width: 16px; height: 16px; }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.12); }
  #ssp-sidebar-toggle { display: none; }
  .hdr-search { display: none; }
  .hdr-user-name { display: none; }
  .stats-row, .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
  .tools-grid, .tools-grid-sm { grid-template-columns: 1fr !important; }
  .setting-row { grid-template-columns: 1fr; }
}
@media (max-width: 480px) { .stats-row, .stats-grid { grid-template-columns: 1fr; } }
