@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #f7f9fc;
  --card: #ffffff;
  --primary: #4f7cff;
  --accent: #ff7a18;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(79, 124, 255, 0.08);
  --shadow-soft: 0 4px 16px rgba(15, 23, 42, 0.05);
  --border: #e5e7eb;
  --muted: #6b7280;
  --text: #111827;
}

* { box-sizing: border-box; }
body { font-family: Inter, Arial, sans-serif; margin: 0; background: var(--bg); color: var(--text); line-height: 1.45; }
body.employee-view { padding-bottom: 100px; }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.25; color: #0f172a; }
h1 { font-size: clamp(1.7rem, 2.8vw, 2rem); font-weight: 700; }
h2 { font-size: clamp(1.2rem, 2vw, 1.45rem); font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 600; }
p { margin: 0 0 10px; }
a { color: var(--primary); text-decoration: none; }
.container {
  max-width: 1180px;
  margin: 24px auto;
  background: var(--card);
  padding: 24px;
  border-radius: 18px;
  border: 1px solid #eef2f7;
  box-shadow: var(--shadow-soft);
}
.header {
  background: #ffffff;
  color: #1f2937;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e9edf5;
}
.header a { color: #334155; margin-right: 12px; text-decoration: none; }
.brand { font-weight: 700; letter-spacing: 0.01em; }
.user-pill {
  background: #eef2ff;
  color: #334155;
  padding: 7px 12px;
  border-radius: 999px;
  margin-right: 12px;
  font-size: 12px;
  font-weight: 500;
}
.inline-form { display: inline; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.card {
  border: 1px solid #edf1f7;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-soft);
}
button {
  background: var(--primary);
  color: #fff;
  border: 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  min-height: 44px;
}
button.secondary, .button.secondary { background: #94a3b8; }
.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  background: var(--primary);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  min-height: 44px;
}
.button.success { background: var(--success); }
.button.danger { background: var(--danger); }
.button.warning { background: var(--warning); }
button.success { background: var(--success); }
button.danger { background: var(--danger); }
button.warning { background: var(--warning); }

button:active, .button:active { transform: scale(0.97); }
.card { transition: transform .2s ease, box-shadow .2s ease; }
@media (hover:hover) {
  .card:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12); }
}

table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { border-bottom: 1px solid #eef2f7; padding: 11px 9px; text-align: left; vertical-align: top; }
th a { color: #0f172a; text-decoration: none; }
.badge { padding: 3px 9px; border-radius: 999px; color: #fff; font-size: 12px; text-transform: lowercase; }
.badge.pending { background: var(--warning); }
.badge.approved, .badge.issued, .badge.inbox-valid, .badge.inbox-processed { background: var(--success); }
.badge.rejected, .badge.inbox-invalid, .badge.inbox-failed, .badge.inbox-rejected { background: var(--danger); }
.badge.cancelled, .badge.inbox-duplicate { background: #64748b; }
.badge.inbox-pending { background: var(--warning); }
.badge.inbox-dry-run { background: #6f42c1; }
.error { background: #fff0f0; color: #a30000; padding: 10px; border-radius: 10px; }
.auth-box { max-width: 420px; margin-top: 80px; }
.form-grid { display: grid; gap: 10px; }
label input, select, textarea { width: 100%; margin-top: 5px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; font-family: inherit; }
.hint { color: var(--muted); font-size: 13px; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { border: 1px solid #edf1f7; padding: 12px; border-radius: var(--radius-sm); margin-bottom: 10px; background: var(--card); }
.row-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.progress { height: 12px; background:#e9edf7; border-radius:999px; overflow:hidden; margin-bottom: 16px; }
.progress > div { height:100%; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .8s ease; }
.level-card .progress {
  height: 16px;
  background: #ecf2ff;
}
.level-card .progress > div {
  background: linear-gradient(90deg, #4f7cff 0%, #6d8fff 45%, #8ab0ff 100%);
}
.empty-state {
  padding: 20px;
  border: 1px dashed #d7dfef;
  border-radius: var(--radius);
  color: #64748b;
  background: #f9fbff;
  text-align: center;
}
.notification-unread { border-left: 4px solid var(--primary); background: #eef4ff; }
.notification-read { opacity: 0.85; }
.row-form input, .row-form select { width: auto; margin-top: 0; }
.alert { padding: 10px; border-radius: 6px; margin-bottom: 12px; }
.alert-error { background: #ffe3e3; color: #a30000; }
.alert-success { background: #e6ffef; color: #0f6b34; }
pre { white-space: pre-wrap; word-break: break-word; background: #f7f7f7; padding: 10px; border-radius: 6px; }
.muted { color: var(--muted); }
.metric { font-size: 30px; font-weight: 700; margin: 4px 0 8px; }

.page-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi-card { position: relative; overflow: hidden; }
.kpi-card::after {
  content: '';
  position: absolute;
  right: -20px;
  top: -20px;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, rgba(79,124,255,.18), rgba(79,124,255,0));
}
.kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eef3ff;
  color: var(--primary);
}
.kpi-card .label { color: var(--muted); font-size: 13px; }
.kpi-card .value { font-size: 32px; font-weight: 700; margin-top: 8px; }
.kpi-card .delta { color: var(--muted); font-size: 13px; }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 6px; }
.split-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 14px; }
.activity-list li { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.soft-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: #fff3e9;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.admin-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 258px;
  padding: 20px 14px;
  background: #f8faff;
  border-right: 1px solid #e7edf8;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  box-shadow: 3px 0 20px rgba(15, 23, 42, 0.05);
  z-index: 30;
}
.admin-sidebar a { color: #475569; display: flex; align-items: center; gap: 8px; padding: 10px 11px; margin: 2px 0; border-radius: 11px; }
.admin-sidebar a.active, .admin-sidebar a:hover { background: #e9efff; color: #1e3a8a; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sidebar-nav { display: flex; flex-direction: column; }
.sidebar-footer { margin-top: auto; display: grid; gap: 8px; }
.menu-toggle { display: none; background: transparent; border: 1px solid #dbe3f4; color: #334155; }

body:has(.admin-sidebar) .container { margin-left: 294px; width: calc(100% - 348px); max-width: none; }

.table-shell { border: 1px solid #edf1f7; border-radius: var(--radius); overflow: hidden; }
.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; color: var(--muted); }
.rewards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.reward-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }

.hero-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.achievement-grid, .mission-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.achievement-card { background: #fffbf5; border: 1px solid #ffe9d6; }
.mission-card .progress { margin-top: 8px; margin-bottom: 8px; }
.leaderboard-preview td:first-child { font-weight: 700; color: var(--primary); }


.employee-header-shell {
  width: 100%;
  display: grid;
  gap: 12px;
}
.employee-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.employee-brand { font-size: 1.1rem; }
.employee-header-sub {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.employee-badge { margin-right: 0; }
.employee-menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border-radius: 12px;
  font-size: 20px;
  background: #f8fbff;
}

.employee-bottom-nav {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 35;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #e4ebf8;
  border-radius: 18px;
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.1);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 7px;
}

.employee-bottom-nav a {
  min-height: 52px;
  border-radius: 999px;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  margin-right: 0;
}
.employee-bottom-nav a span { font-size: 16px; line-height: 1; transition: transform .2s ease, text-shadow .2s ease; }
.employee-bottom-nav a.active {
  color: #1d4ed8;
  background: #e2ebff;
  box-shadow: inset 0 0 0 1px #cddcff, 0 6px 14px rgba(59, 130, 246, 0.22);
}
.employee-bottom-nav a.active span {
  transform: scale(1.08);
  text-shadow: 0 1px 8px rgba(59, 130, 246, 0.45);
}

.employee-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 36;
  opacity: 0;
  transition: opacity .25s ease;
}
.employee-drawer-overlay.open { opacity: 1; }
.employee-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(84vw, 320px);
  height: 100vh;
  background: #fff;
  z-index: 37;
  box-shadow: -6px 0 24px rgba(15, 23, 42, 0.16);
  transform: translateX(104%);
  transition: transform .25s ease;
  padding: 18px 14px;
}
.employee-drawer.open { transform: translateX(0); }
.employee-drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.employee-drawer-links { display: grid; gap: 10px; }
.employee-drawer-links a,
.employee-drawer-links button {
  background: #f8fbff;
  border: 1px solid #e5ecfa;
  border-radius: 12px;
  color: #334155;
  min-height: 46px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  font-weight: 600;
}

.employee-drawer-links .inline-form {
  display: block;
}

.employee-drawer-links .inline-form button {
  width: 100%;
  justify-content: flex-start;
  background: #fff5f5;
  border-color: #ffd5d5;
  color: #b42318;
}

.level-indicator { font-size: 1.05rem; margin-bottom: 8px; }

.hero-action {
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.points-hero {
  background: linear-gradient(140deg, #4f7cff 0%, #5f8dff 60%, #7aa6ff 100%);
  color: #fff;
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 12px 26px rgba(79, 124, 255, 0.24);
  border: 1px solid rgba(255,255,255,.22);
}
.points-hero .hero-value { font-size: clamp(2rem, 5vw, 2.4rem); font-weight: 700; margin: 8px 0; }
.points-hero .hero-helper {
  margin-top: 8px;
  font-size: 14px;
  color: rgba(255, 255, 255, .92);
}
.level-card {
  background: linear-gradient(180deg, #fff9f2 0%, #fffefb 100%);
  border: 1px solid #ffe1bf;
  box-shadow: var(--shadow-soft);
}
.level-next {
  border: 1px dashed #fdba74;
  background: #fff6eb;
  color: #9a3412;
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 10px;
  font-size: 14px;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.mission-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid #e4ecff;
}
.mission-state {
  font-size: 12px;
  border-radius: 999px;
  padding: 4px 9px;
  font-weight: 600;
}
.mission-state--progress { background: #eef3ff; color: #3451a6; }
.mission-state--almost { background: #fff7ed; color: #9a3412; }
.mission-state--done { background: #ecfdf3; color: #166534; }
.mission-progress-line {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #64748b;
}
.mission-card--almost { border-color: #ffd8ac; }
.mission-card--done { border-color: #bdebcf; background: linear-gradient(180deg, #ffffff 0%, #f6fff9 100%); }
.mission-card .progress {
  height: 14px;
  background: #e7eefc;
}


.streak-card-panel {
  background: linear-gradient(180deg, #fff8f1 0%, #fffdf9 100%);
  border: 1px solid #ffd8b5;
}

.streak-card {
  margin-top: 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 14px;
  padding: 12px;
}
.streak-head { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.streak-text { margin: 8px 0 4px; color: #9a3412; }
.streak-helper { margin: 0; color: #b45309; font-size: 13px; }

.season-progress-card {
  border: 1px solid #e3ecff;
  border-radius: 14px;
  padding: 16px;
  background: #f8fbff;
}
.season-meta { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: 13px; color: #475569; }
.season-rank {
  background: #eaf1ff;
  border: 1px solid #d6e4ff;
  color: #1e3a8a;
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
  font-size: 14px;
}

.mission-card--almost {
  animation: almostPulse 1.8s ease-in-out infinite;
}
@keyframes almostPulse {
  0%,100% { box-shadow: 0 4px 14px rgba(245, 158, 11, 0.12); }
  50% { box-shadow: 0 8px 22px rgba(245, 158, 11, 0.28); }
}

.celebrate-pop::before {
  content: '🎉 ✨ 🎁';
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 60;
  background: #ffffff;
  border: 1px solid #dce6ff;
  border-radius: 999px;
  padding: 8px 12px;
  box-shadow: 0 10px 20px rgba(15,23,42,.16);
  animation: fadeCelebrate 1.4s ease forwards;
}
@keyframes fadeCelebrate {
  0% { transform: translateY(-8px) scale(.9); opacity: 0; }
  20% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-10px) scale(1.02); opacity: 0; }
}

.reward-status { margin-top: 10px; border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.reward-status-ok { background: #ebfff1; color: #166534; }
.reward-status-almost { background: #fff6ea; color: #9a3412; }
.reward-status-low { background: #f1f5f9; color: #475569; }
.reward-card--affordable { border-color: #c9efdb; background: linear-gradient(180deg, #ffffff 0%, #f5fff9 100%); }
.reward-card--almost { border-color: #ffd8af; }
.reward-card--locked { border-color: #dbe3ef; }

.engagement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.engagement-title { margin-bottom: 6px; color: #0f172a; }
.challenge-card { border-color: #ffd5b3; background: linear-gradient(180deg, #fffdfa 0%, #fff5ec 100%); }
.team-mission-card { border-color: #d6e5ff; background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%); }
.bonus-card { border-color: #ffe3bf; background: linear-gradient(180deg, #fffefb 0%, #fff8ee 100%); }
.motivation-card {
  border-color: #dce8ff;
  background: linear-gradient(135deg, #f8fbff 0%, #f1f7ff 55%, #eef3ff 100%);
  margin-bottom: 16px;
}
.motivation-main {
  margin: 6px 0 8px;
  font-weight: 700;
  color: #1e3a8a;
}
.shop-motivation { margin-bottom: 14px; }

.points-toast-stack {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: grid;
  gap: 8px;
  width: min(92vw, 360px);
}
.points-toast {
  background: #ffffff;
  border: 1px solid #dce6ff;
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
  padding: 12px 14px;
  transform: translateY(-18px);
  opacity: 0;
  transition: all .25s ease;
}
.points-toast.show {
  transform: translateY(0);
  opacity: 1;
}
.points-toast-title { font-weight: 700; color: #1e3a8a; }
.points-toast-sub { font-size: 13px; color: #64748b; }
.points-toast--celebrate {
  border-color: #ffd7a8;
  box-shadow: 0 14px 32px rgba(249, 115, 22, 0.22);
}

.leaderboard-card { overflow: hidden; }
.table-compact th,
.table-compact td { padding: 12px 10px; }
.rank-row { transition: background .2s ease; }
.rank-row.rank-1 {
  background: linear-gradient(90deg, #fff8dc 0%, #fff2b8 100%);
  border-left: 4px solid #eab308;
}
.rank-row.rank-2 { background: linear-gradient(90deg, #f8fafc 0%, #f1f5f9 100%); border-left: 4px solid #94a3b8; }
.rank-row.rank-3 { background: linear-gradient(90deg, #fff5ec 0%, #ffedd5 100%); border-left: 4px solid #fb923c; }
.rank-cell {
  font-weight: 700;
  font-size: 16px;
}
.rank-name {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rank-highlight {
  background: #fff;
  border: 1px solid #f6d365;
  color: #854d0e;
  border-radius: 999px;
  font-size: 11px;
  padding: 2px 8px;
  font-weight: 700;
}

.empty-state {
  padding: 22px;
  border: 1px dashed #d7dfef;
  border-radius: var(--radius);
  color: #64748b;
  background: linear-gradient(180deg, #f9fbff 0%, #f5f9ff 100%);
  text-align: center;
}
.empty-state strong { color: #1e3a8a; }

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title .soft-icon { width: 30px; height: 30px; font-size: 14px; }
.section-title-inverse {
  color: #fff;
  font-weight: 600;
}
.section-title-inverse .soft-icon {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.employee-page-title { margin-bottom: 20px; }

.dashboard-shell > .section-title,
.dashboard-shell > .empty-state,
.dashboard-shell > .mission-grid,
.dashboard-shell > .split-grid,
.dashboard-shell > .achievement-grid {
  margin-top: 18px;
}

.dashboard-shell > .section-title:first-of-type {
  margin-top: 0;
}
.points-pill {
  background: #fff7eb;
  border: 1px solid #ffdfbe;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 14px;
  color: #9a3412;
}
.mission-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}
.achievement-title {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}
.rewards-shop-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.reward-card { border-width: 1px; }
.reward-card-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}
.reward-emoji { margin-right: 4px; }
.reward-cost {
  font-weight: 700;
  font-size: 13px;
  color: #1e40af;
  background: #e8efff;
  border-radius: 999px;
  padding: 4px 9px;
  white-space: nowrap;
}

@media (max-width: 920px) {
  .split-grid, .hero-grid { grid-template-columns: 1fr; }
  .hero-grid { gap: 14px; margin-bottom: 20px; }
  .menu-toggle { display: inline-block; }
  .admin-sidebar { transform: translateX(-102%); transition: transform .25s ease; width: 270px; }
  .admin-sidebar.open { transform: translateX(0); }
  body:has(.admin-sidebar) .container { margin: 14px; width: auto; padding: 18px; border-radius: 14px; }
  .button, button { min-height: 46px; width: 100%; justify-content: center; }
  .quick-actions .button { flex: 1 1 180px; justify-content: center; }
  .cards,
  .achievement-grid,
  .mission-grid,
  .rewards-shop-grid { grid-template-columns: 1fr; gap: 12px; }
  .header { padding: 12px 14px; align-items: flex-start; }
  .employee-header-top,
  .employee-header-sub,
  .reward-card-head,
  .mission-head,
  .page-title,
  .progress-label { flex-direction: column; align-items: flex-start; }
  .employee-bottom-nav { left: 8px; right: 8px; bottom: 8px; }
  .employee-bottom-nav a { min-height: 50px; font-size: 11px; }
  .employee-bottom-nav a.active span { transform: scale(1.06); }
  .points-pill { width: 100%; border-radius: 12px; text-align: center; }
  .table-compact th,
  .table-compact td,
  .leaderboard-preview th,
  .leaderboard-preview td { padding: 14px 8px; font-size: 14px; }
  .progress { margin-bottom: 12px; height: 14px; }
  .container { margin: 14px; padding: 18px; border-radius: 14px; }
}
