* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #eef1f4;
  color: #2c3338;
  font-size: 14px;
}
a { color: #2f7cd6; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Login page (not inside the shell) ---------- */
body.centered { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: #f2f4f6; }
.login-card { background: #fff; border-radius: 10px; padding: 32px; max-width: 380px; width: 100%; box-shadow: 0 4px 24px rgba(0,0,0,0.08); }
.login-card h1 { text-align: center; color: #4a4a4a; margin: 0 0 6px; }
.login-card .brand { text-align:center; font-weight:700; font-size:1.4rem; margin-bottom: 20px; }
.login-card .brand span { color: #7cb342; }
input, select, button {
  width: 100%; padding: 10px 12px; margin-top: 10px; border-radius: 6px;
  border: 1px solid #d7dce1; background: #fff; color: #2c3338; font-size: 0.92rem;
}
button {
  background: #7cb342; color: #fff; font-weight: 600; border: none; cursor: pointer;
}
button:hover { background: #689f38; }
button.secondary { background: #fff; border: 1px solid #c7cdd3; color: #4a4a4a; }
button.secondary:hover { background: #f2f4f6; }
button.danger { background: #e53935; }
button.danger:hover { background: #c62828; }
.status { padding: 10px 12px; border-radius: 6px; margin-bottom: 12px; font-size: 0.88rem; }
.status.ok { background: #eaf6ea; color: #388e3c; border: 1px solid #c8e6c9; }
.status.bad { background: #fdecea; color: #c62828; border: 1px solid #f5c6cb; }

/* ---------- Shell layout ---------- */
.shell { display: flex; flex-direction: column; min-height: 100vh; }

.top-nav {
  background: linear-gradient(180deg, #8bc34a, #689f38);
  display: flex; align-items: center; height: 56px; padding: 0 18px;
  flex-shrink: 0; color: #fff;
}
.top-nav .logo { font-weight: 800; font-size: 1.15rem; margin-right: 28px; white-space: nowrap; }
.top-nav .logo span { opacity: 0.85; font-weight: 400; }
.top-nav .tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.top-nav .tabs a {
  color: rgba(255,255,255,0.92); text-decoration: none; padding: 0 14px; height: 56px;
  display: flex; align-items: center; font-size: 0.88rem; white-space: nowrap; border-bottom: 3px solid transparent;
}
.top-nav .tabs a:hover { background: rgba(255,255,255,0.08); }
.top-nav .tabs a.active { background: rgba(0,0,0,0.15); border-bottom-color: #fff; font-weight: 600; }
.top-nav .who { font-size: 0.82rem; white-space: nowrap; margin-left: 12px; display:flex; align-items:center; gap:10px; }
.top-nav .who a { color: #fff; text-decoration: underline; }

.shell-body { display: flex; flex: 1; min-height: 0; }

.sidebar { width: 210px; background: #262b36; flex-shrink: 0; padding: 10px 0; }
.sidebar a {
  display: block; padding: 11px 20px; color: #b8bfc9; text-decoration: none; font-size: 0.88rem;
  border-left: 3px solid transparent;
}
.sidebar a:hover { background: #1e232c; color: #fff; }
.sidebar a.active { background: #1e232c; color: #8bc34a; border-left-color: #8bc34a; font-weight: 600; }
.sidebar a.placeholder { color: #6b7280; }
.sidebar a.placeholder::after { content: " (soon)"; font-size: 0.72rem; opacity: 0.7; }

.main { flex: 1; padding: 20px 24px; overflow-x: auto; min-width: 0; }
.main h1 { font-size: 1.05rem; font-weight: 700; color: #4a4a4a; margin: 0 0 14px; }

/* ---------- Toolbar (Bookmarks / Filter / Add / Delete row) ---------- */
.toolbar {
  display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #e2e6ea;
  border-radius: 6px 6px 0 0; padding: 10px 12px; flex-wrap: wrap;
}
.toolbar button, .toolbar .tool-btn {
  width: auto; margin-top: 0; padding: 7px 16px; font-size: 0.85rem; font-weight: 500;
  background: #f4f6f8; color: #4a4a4a; border: 1px solid #d7dce1;
}
.toolbar button:hover, .toolbar .tool-btn:hover { background: #e9edf0; }
.toolbar button.primary { background: #7cb342; color: #fff; border-color: #7cb342; }
.toolbar button.primary:hover { background: #689f38; }
.toolbar .spacer { flex: 1; }
.toolbar input[type="text"], .toolbar input[type="date"] {
  width: auto; margin-top: 0; padding: 7px 10px; font-size: 0.85rem;
}

/* ---------- Card (forms, panels) ---------- */
.card { background: #fff; border: 1px solid #e2e6ea; border-radius: 8px; padding: 20px; margin-bottom: 18px; }

/* ---------- Table ---------- */
.data-table-wrap { background: #fff; border: 1px solid #e2e6ea; border-top: none; border-radius: 0 0 6px 6px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid #eef1f4; font-size: 0.86rem; white-space: nowrap; }
th { background: #f8f9fb; color: #6b7280; font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:hover td { background: #f8fafb; }
td a { color: #2f7cd6; font-weight: 500; }

.badge { padding: 3px 10px; border-radius: 20px; font-size: 0.74rem; font-weight: 600; display: inline-block; }
.badge.online, .badge.approved, .badge.synced { background: #e8f5e9; color: #388e3c; }
.badge.offline, .badge.failed, .badge.rejected { background: #fdecea; color: #d32f2f; }
.badge.pending, .badge.unknown { background: #fff8e1; color: #f9a825; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: #fff; border: 1px solid #e2e6ea; border-radius: 8px; padding: 16px 18px; }
.stat-card .num { font-size: 1.7rem; font-weight: 700; color: #2c3338; }
.stat-card .label { font-size: 0.78rem; color: #8a9099; margin-top: 4px; }

.actions form { display: inline; width: auto; }
.actions button { width: auto; padding: 5px 12px; margin: 0 4px 0 0; font-size: 0.8rem; }

/* ---------- Pagination footer ---------- */
.pagination-bar {
  display: flex; align-items: center; gap: 14px; padding: 10px 14px; background: #fff;
  border: 1px solid #e2e6ea; border-top: none; border-radius: 0 0 6px 6px; font-size: 0.82rem; color: #6b7280;
}
.pagination-bar .page-btn {
  width: auto; padding: 5px 11px; margin: 0; background: #f4f6f8; border: 1px solid #d7dce1; color: #4a4a4a; cursor: default;
}
.pagination-bar .page-btn.active { background: #7cb342; color: #fff; border-color: #7cb342; }
.pagination-bar .spacer { flex: 1; }

.coming-soon { text-align: center; padding: 60px 20px; color: #8a9099; }
.coming-soon .icon { font-size: 2.4rem; margin-bottom: 10px; }

/* ---------- Today overview: donuts, trend, live feed ---------- */
.donut-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 20px; }
.donut-card { background: #fff; border: 1px solid #e2e6ea; border-radius: 8px; padding: 16px; text-align: center; }
.donut-title { font-weight: 700; color: #4a4a4a; font-size: 0.85rem; margin-bottom: 10px; }
.donut-card canvas { max-height: 140px; }
.donut-legend { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; font-size: 0.76rem; color: #4a4a4a; text-align: left; }
.donut-legend span { display: flex; align-items: center; gap: 6px; }
.donut-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; flex-shrink: 0; }

.two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; margin-bottom: 20px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

.live-feed { max-height: 420px; overflow-y: auto; }
.live-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid #eef1f4; }
.live-row:last-child { border-bottom: none; }
.live-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: #eef1f4; }
.live-avatar-placeholder { display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.live-info { flex: 1; min-width: 0; }
.live-action { font-weight: 600; font-size: 0.85rem; color: #2c3338; }
.live-time { font-size: 0.78rem; color: #8a9099; }
.live-name { font-size: 0.8rem; color: #4a4a4a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-source { font-size: 0.75rem; color: #8a9099; white-space: nowrap; flex-shrink: 0; }

/* ---------- Sidebar tree groups (e.g. Organization > Department/Position/Area) ---------- */
.sidebar-group summary {
  padding: 11px 20px; color: #b8bfc9; font-size: 0.88rem; cursor: pointer; list-style: none;
  display: flex; align-items: center; justify-content: space-between;
}
.sidebar-group summary::-webkit-details-marker { display: none; }
.sidebar-group summary::after { content: '▸'; font-size: 0.7rem; transition: transform 0.15s; color: #6b7280; }
.sidebar-group[open] summary::after { transform: rotate(90deg); }
.sidebar-group summary:hover { background: #1e232c; color: #fff; }
.sidebar-child {
  display: block; padding: 9px 20px 9px 36px; color: #99a1ac; text-decoration: none; font-size: 0.83rem;
  border-left: 3px solid transparent;
}
.sidebar-child:hover { background: #1e232c; color: #fff; }
.sidebar-child.active { background: #1e232c; color: #8bc34a; border-left-color: #8bc34a; font-weight: 600; }
.sidebar-child.placeholder { color: #5b6270; }
.sidebar-child.placeholder::after { content: " (soon)"; font-size: 0.7rem; opacity: 0.7; }

/* ---------- Notification bell ---------- */
.notif-bell { position: relative; margin-left: auto; margin-right: 14px; }
.notif-btn { width: auto; margin: 0; padding: 6px 10px; background: transparent; border: none; font-size: 1.15rem; cursor: pointer; position: relative; color: #fff; }
.notif-badge {
  position: absolute; top: -2px; right: -2px; background: #e53935; color: #fff; font-size: 0.62rem;
  font-weight: 700; border-radius: 20px; padding: 1px 5px; min-width: 16px; text-align: center; line-height: 1.4;
}
.notif-dropdown {
  position: absolute; top: 42px; right: 0; width: 300px; background: #fff; border: 1px solid #e2e6ea;
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.15); z-index: 50; overflow: hidden;
}
.notif-item { display: flex; align-items: center; gap: 10px; padding: 12px 16px; color: #2c3338; text-decoration: none; font-size: 0.85rem; border-bottom: 1px solid #eef1f4; }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: #f8fafb; text-decoration: none; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.notif-empty { padding: 16px; color: #8a9099; font-size: 0.85rem; text-align: center; }
