:root {
  --gold: #886902;
  --gold-dark: #6b5201;
  --gold-light: #a07c03;
  --gold-xlight: rgba(136,105,2,0.08);
  --gold-glow: rgba(136,105,2,0.25);
  --cream: #fefcf5;
  --cream-mid: #f5f2e8;
  --cream-border: #eae2d6;
  --dark: #1e2b2e;
  --dark-alt: #263538;
  --muted: #5b6e73;
  --muted-light: #4a5a5e;
  --border: #e0d9cd;
  --white: #ffffff;
  --red: #dc3545;
  --green: #1e7c3a;
  --blue: #0d6efd;
  --fb-blue: #1877f2;
  --ig-pink: #e1306c;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-pill: 50px;
  --shadow-sm: 0 2px 8px rgba(30,43,46,0.06);
  --shadow-md: 0 6px 20px rgba(30,43,46,0.10);
  --shadow-lg: 0 12px 40px rgba(30,43,46,0.14);
  --transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { overflow-x: hidden; }
body { font-family: 'Inter', sans-serif; background: var(--cream); color: var(--dark); line-height: 1.5; }
.hidden { display: none !important; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* LOGIN */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--dark) 0%, #2a3d41 50%, var(--dark) 100%);
  padding: 1rem;
}
.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  animation: fadeIn .5s ease;
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo-img { width: 60px; height: 60px; border-radius: 14px; margin: 0 auto .8rem; display: block; object-fit: cover; }
.login-logo h1 { font-size: 1.6rem; font-weight: 800; color: var(--dark); letter-spacing: -1px; }
.login-logo h1 span { color: var(--gold); }
.login-logo p { font-size: .8rem; color: var(--muted); margin-top: .2rem; }
.login-field { margin-bottom: 1rem; }
.login-field label { display: flex; align-items: center; gap: .4rem; font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .35rem; }
.login-field label i { color: var(--gold); font-size: .7rem; }
.login-field input { width: 100%; padding: .75rem 1rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--cream); font-family: inherit; font-size: .9rem; color: var(--dark); transition: var(--transition); }
.login-field input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-xlight); background: var(--white); }
.login-btn { width: 100%; padding: .85rem; border: none; border-radius: var(--radius-pill); background: linear-gradient(135deg, var(--gold), var(--gold-light)); color: var(--white); font-family: inherit; font-size: .95rem; font-weight: 700; cursor: pointer; transition: var(--transition); box-shadow: 0 6px 18px var(--gold-glow); margin-top: .5rem; }
.login-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 28px var(--gold-glow); }
.login-error { margin-top: .8rem; padding: .6rem .8rem; border-radius: var(--radius-sm); background: #fff0f0; border: 1px solid #fcc; color: var(--red); font-size: .8rem; font-weight: 600; text-align: center; }

/* DASHBOARD */
.dashboard { min-height: 100vh; display: flex; flex-direction: column; }
.dash-header {
  background: linear-gradient(135deg, var(--dark) 0%, #2a3d41 100%);
  padding: .8rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
}
.dash-brand { display: flex; align-items: center; gap: .7rem; }
.dash-brand-img { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; }
.dash-brand h2 { font-size: 1.15rem; font-weight: 800; color: var(--white); letter-spacing: -.5px; }
.dash-brand h2 span { color: #f0c84a; }
.dash-subtitle { font-size: .65rem; color: rgba(255,255,255,.5); font-weight: 600; text-transform: uppercase; letter-spacing: .8px; }
.dash-right { display: flex; align-items: center; gap: 1rem; }
.dash-time { text-align: right; }
.live-time { font-size: .95rem; font-weight: 700; color: #f0c84a; font-variant-numeric: tabular-nums; }
.live-date { font-size: .65rem; color: rgba(255,255,255,.5); }
.dash-user { display: flex; align-items: center; gap: .5rem; }
.dash-avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--gold), var(--gold-light)); color: var(--white); display: flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 800; }
.dash-name { font-size: .8rem; font-weight: 700; color: var(--white); }
.dash-role { font-size: .62rem; color: rgba(255,255,255,.5); }
.btn-logout { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); color: rgba(255,255,255,.6); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: .8rem; transition: var(--transition); }
.btn-logout:hover { background: rgba(220,53,69,.2); border-color: rgba(220,53,69,.4); color: #ff6b6b; }

/* STATS BAR */
.stats-bar { display: flex; gap: .6rem; padding: 1rem 1.5rem; overflow-x: auto; scrollbar-width: none; }
.stats-bar::-webkit-scrollbar { display: none; }
.stat-card { flex: 1; min-width: 130px; display: flex; align-items: center; gap: .7rem; background: var(--white); border: 1px solid var(--cream-border); border-radius: var(--radius-md); padding: .8rem 1rem; box-shadow: var(--shadow-sm); transition: var(--transition); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card.total { background: linear-gradient(135deg, var(--dark), #2a3d41); border-color: transparent; }
.stat-card.total .stat-num { color: #f0c84a; }
.stat-card.total .stat-label { color: rgba(255,255,255,.6); }
.stat-icon { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.stat-icon.messenger { background: rgba(24,119,242,.1); color: var(--fb-blue); }
.stat-icon.instagram { background: rgba(225,48,108,.1); color: var(--ig-pink); }
.stat-icon.total { background: rgba(240,200,74,.15); color: #f0c84a; }
.stat-num { font-size: 1.3rem; font-weight: 800; color: var(--dark); line-height: 1; }
.stat-label { font-size: .65rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }

.dash-main { flex: 1; padding: 0 1.5rem 1.5rem; }
.section-label { font-size: .72rem; font-weight: 800; color: var(--gold); text-transform: uppercase; letter-spacing: 2px; display: flex; align-items: center; gap: .5rem; margin-bottom: .8rem; }

/* TABS */
.comms-tabs { display: flex; gap: .3rem; margin-bottom: 1rem; background: var(--cream-mid); border-radius: var(--radius-md); padding: .25rem; border: 1px solid var(--cream-border); }
.comms-tab { flex: 1; display: flex; align-items: center; justify-content: center; gap: .4rem; padding: .65rem 1rem; border: none; border-radius: var(--radius-sm); background: transparent; color: var(--muted); font-family: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; transition: var(--transition); }
.comms-tab:hover { color: var(--gold); }
.comms-tab.active { background: var(--white); color: var(--gold); box-shadow: var(--shadow-sm); font-weight: 700; }

/* INBOX TOOLBAR */
.inbox-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .6rem; }
.inbox-filters { display: flex; gap: .3rem; flex-wrap: wrap; }
.filter-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .35rem .8rem; border: 1.5px solid var(--border); border-radius: var(--radius-pill); background: var(--white); color: var(--muted); font-family: inherit; font-size: .72rem; font-weight: 600; cursor: pointer; transition: var(--transition); }
.filter-chip:hover { border-color: var(--gold); color: var(--gold); }
.filter-chip.active { background: linear-gradient(135deg, var(--gold), var(--gold-light)); color: var(--white); border-color: var(--gold); }
.inbox-actions { display: flex; align-items: center; gap: .5rem; }
.inbox-search { display: flex; align-items: center; gap: .4rem; background: var(--cream); border: 1.5px solid var(--border); border-radius: var(--radius-pill); padding: .35rem .8rem; transition: var(--transition); }
.inbox-search:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-xlight); }
.inbox-search i { color: var(--muted); font-size: .75rem; }
.inbox-search input { border: none; background: transparent; font-family: inherit; font-size: .8rem; color: var(--dark); width: 140px; outline: none; }
.btn-refresh { display: inline-flex; align-items: center; gap: .3rem; padding: .4rem .9rem; border: 1.5px solid var(--gold); border-radius: var(--radius-pill); background: var(--white); color: var(--gold); font-family: inherit; font-size: .72rem; font-weight: 700; cursor: pointer; transition: var(--transition); }
.btn-refresh:hover { background: var(--gold); color: var(--white); transform: translateY(-1px); }
.btn-refresh.loading i { animation: spin .8s linear infinite; }

/* INBOX CONTAINER */
.inbox-container { display: grid; grid-template-columns: 340px 1fr; gap: 0; background: var(--white); border: 1.5px solid var(--cream-border); border-radius: var(--radius-lg); overflow: hidden; min-height: 520px; box-shadow: var(--shadow-md); }
.inbox-list { border-right: 1.5px solid var(--cream-border); overflow-y: auto; max-height: 520px; scrollbar-width: thin; }
.inbox-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem; padding: 3rem 1rem; color: var(--muted); text-align: center; font-size: .85rem; }
.inbox-empty i { font-size: 2rem; opacity: .3; }
.convo-item { display: flex; align-items: center; gap: .7rem; padding: .8rem 1rem; border-bottom: 1px solid var(--cream-border); cursor: pointer; transition: var(--transition); position: relative; }
.convo-item:hover { background: var(--gold-xlight); }
.convo-item.active { background: var(--gold-xlight); border-left: 3px solid var(--gold); }
.convo-avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .85rem; color: var(--white); flex-shrink: 0; }
.convo-avatar.messenger { background: var(--fb-blue); }
.convo-avatar.instagram { background: linear-gradient(135deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
.convo-info { flex: 1; min-width: 0; }
.convo-name { font-size: .82rem; font-weight: 700; color: var(--dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo-preview { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: .1rem; }
.convo-meta { display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; flex-shrink: 0; }
.convo-time { font-size: .62rem; color: var(--muted); font-weight: 500; }

/* CHAT PANEL */
.chat-panel { display: flex; flex-direction: column; min-height: 0; }
.chat-header { display: flex; align-items: center; gap: .7rem; padding: .7rem 1rem; border-bottom: 1.5px solid var(--cream-border); background: var(--cream); }
.chat-back { display: none; background: none; border: none; color: var(--gold); font-size: 1rem; cursor: pointer; padding: .3rem; }
.chat-contact { display: flex; align-items: center; gap: .6rem; flex: 1; }
.chat-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--gold); color: var(--white); display: flex; align-items: center; justify-content: center; font-size: .8rem; }
.chat-contact-name { font-size: .88rem; font-weight: 700; color: var(--dark); }
.chat-contact-platform { font-size: .65rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.chat-contact-platform.messenger { color: var(--fb-blue); }
.chat-contact-platform.instagram { color: var(--ig-pink); }
.chat-header-actions { display: flex; align-items: center; gap: .4rem; }
.btn-icon { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); background: var(--white); color: var(--muted); display: flex; align-items: center; justify-content: center; font-size: .75rem; cursor: pointer; transition: var(--transition); }
.btn-icon:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-xlight); }
.btn-delete:hover { border-color: var(--red); color: var(--red); background: rgba(220,53,69,.08); }
.chat-body { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .5rem; min-height: 380px; max-height: 380px; scrollbar-width: thin; }
.msg-bubble { max-width: 72%; padding: .6rem .9rem; border-radius: 14px; font-size: .82rem; line-height: 1.5; animation: slideUp .2s ease; position: relative; }
.msg-bubble.incoming { align-self: flex-start; background: var(--cream-mid); color: var(--dark); border-bottom-left-radius: 4px; }
.msg-bubble.outgoing { align-self: flex-end; background: linear-gradient(135deg, var(--gold), var(--gold-light)); color: var(--white); border-bottom-right-radius: 4px; }
.msg-time { font-size: .6rem; margin-top: .2rem; opacity: .6; }
.msg-bubble.outgoing .msg-time { text-align: right; }
.chat-reply { padding: .6rem 1rem; border-top: 1.5px solid var(--cream-border); background: var(--cream); }
.reply-row { display: flex; gap: .4rem; }
.reply-row input { flex: 1; border: 1.5px solid var(--border); border-radius: var(--radius-pill); padding: .6rem 1rem; font-family: inherit; font-size: .85rem; color: var(--dark); background: var(--white); transition: var(--transition); }
.reply-row input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-xlight); }
.btn-send { width: 40px; height: 40px; border-radius: 50%; border: none; background: linear-gradient(135deg, var(--gold), var(--gold-light)); color: var(--white); font-size: .9rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: var(--transition); flex-shrink: 0; }
.btn-send:hover { transform: scale(1.08); box-shadow: 0 4px 12px var(--gold-glow); }
.reply-hint { font-size: .62rem; color: var(--muted); padding: .3rem .2rem 0; }
.reply-hint span { font-weight: 700; }

/* COMMENTS */
.comments-list { display: flex; flex-direction: column; gap: .5rem; }
.comment-card { background: var(--white); border: 1px solid var(--cream-border); border-radius: var(--radius-md); padding: 1rem; transition: var(--transition); animation: slideUp .3s ease; }
.comment-card:hover { border-color: var(--gold); box-shadow: var(--shadow-sm); }
.comment-top { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.comment-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--fb-blue); color: var(--white); display: flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 800; flex-shrink: 0; }
.comment-name { font-size: .82rem; font-weight: 700; color: var(--dark); }
.comment-time { font-size: .62rem; color: var(--muted); }
.comment-post { font-size: .65rem; color: var(--gold); font-weight: 600; }
.comment-body { font-size: .85rem; color: var(--muted-light); line-height: 1.6; padding-left: 2.6rem; }
.comment-actions { display: flex; gap: .4rem; padding-left: 2.6rem; margin-top: .5rem; }
.comment-reply-btn { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .6rem; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--white); color: var(--muted); font-family: inherit; font-size: .65rem; font-weight: 600; cursor: pointer; transition: var(--transition); }
.comment-reply-btn:hover { border-color: var(--gold); color: var(--gold); }
.comment-reply-box { display: none; padding-left: 2.6rem; margin-top: .5rem; }
.comment-reply-box.show { display: flex; gap: .3rem; }
.comment-reply-box input { flex: 1; border: 1px solid var(--border); border-radius: var(--radius-pill); padding: .4rem .8rem; font-family: inherit; font-size: .78rem; }
.comment-reply-box input:focus { outline: none; border-color: var(--gold); }
.comment-reply-box button { padding: .4rem .8rem; border: none; border-radius: var(--radius-pill); background: var(--gold); color: var(--white); font-family: inherit; font-size: .72rem; font-weight: 700; cursor: pointer; }

/* ACTIVITY LOG */
.activity-log { margin-top: 1.5rem; }
.log-list { background: var(--white); border: 1px solid var(--cream-border); border-radius: var(--radius-md); max-height: 180px; overflow-y: auto; scrollbar-width: thin; }
.log-empty { text-align: center; padding: 1.5rem; color: var(--muted); font-size: .82rem; }
.log-item { display: flex; align-items: center; gap: .6rem; padding: .55rem 1rem; border-bottom: 1px solid var(--cream-border); font-size: .78rem; color: var(--muted-light); animation: slideUp .2s ease; }
.log-item:last-child { border-bottom: none; }
.log-time { font-size: .65rem; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.log-icon { color: var(--gold); font-size: .7rem; flex-shrink: 0; }

.dash-footer { text-align: center; padding: 1rem; border-top: 1px solid var(--cream-border); font-size: .7rem; color: var(--muted); }

/* RESPONSIVE */
@media (max-width: 900px) {
  .inbox-container { grid-template-columns: 1fr; min-height: auto; }
  .inbox-list { max-height: 300px; border-right: none; border-bottom: 1.5px solid var(--cream-border); }
  .inbox-list.chat-open { display: none; }
  .chat-panel.chat-open { display: flex; }
  .chat-back { display: flex; }
  .chat-body { min-height: 350px; max-height: 350px; }
  .inbox-search input { width: 100px; }
}
@media (max-width: 768px) {
  .dash-header { padding: .6rem .8rem; }
  .dash-brand h2 { font-size: 1rem; }
  .dash-brand-img { width: 32px; height: 32px; }
  .dash-subtitle { display: none; }
  .dash-user > div:first-child { display: none; }
  .dash-time .live-date { display: none; }
  .stats-bar { padding: .6rem .8rem; gap: .4rem; }
  .stat-card { min-width: 110px; padding: .6rem .7rem; }
  .stat-num { font-size: 1rem; }
  .stat-icon { width: 32px; height: 32px; font-size: .9rem; }
  .dash-main { padding: 0 .8rem 1rem; }
  .comms-tab span { display: none; }
  .comms-tab i { font-size: 1rem; }
  .inbox-toolbar { flex-direction: column; align-items: stretch; }
  .inbox-filters { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .inbox-filters::-webkit-scrollbar { display: none; }
  .inbox-actions { justify-content: space-between; }
  .filter-chip { white-space: nowrap; flex-shrink: 0; }
}
